Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - John

Pages: [1] 2 3 ... 26
1
Code and examples / Re: Text search
« on: 18. May 2018, 13:45:13 »
http://schemas.microsoft.com/SMI/2005/WindowsSettings

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Interesting the links are HTTP and not HTTPS. Is there some advantage of not using a secure connection?


2
Code and examples / Re: Text search
« on: 17. May 2018, 03:46:14 »
If you guys are getting tired of searching for Prince(ss), HERE is something to take the edge off.  :D

3
Code and examples / Re: Text search
« on: 14. May 2018, 20:02:46 »
Quote
Hey, I didn't complain about speed differences.

I would be interested in the performance difference between your MASM BASIC and OxygenBasic. Which do you think is more feature rich?

4
Code and examples / Re: Text search
« on: 14. May 2018, 02:45:39 »
Quote
In every other respect, SB is a solid piece of SW with a very good design and professional implementation. And it is multiplatform too.

I fell in love with Script BASIC on our first date.  :-*

5
Code and examples / Re: Text search
« on: 13. May 2018, 18:11:17 »
Quote
In any case, it's kind of an overkill for what is effectively a case-insensitive Instr().

In this case, you're right. LIKE is best used with the JOKER() function to extract data within a pattern. The INSTR() seems twice as fast.

Code: [Select]
OPEN "warpeace.txt" FOR INPUT AS 1
flen = FILELEN("warpeace.txt")
fstr = INPUT(flen, 1)
SPLITA fstr BY "\n" to farr
OPTION COMPARE sbCaseInsensitive
FOR idx = 0 to UBOUND(farr)
  IF INSTR(farr[idx], "PrInCe") THEN PRINT FORMAT("%~[000000] ~", idx + 1), farr[idx],"\n"
NEXT


jrs@jrs-laptop:~/sb/examples/test$ time scriba findit.sb > findit.out

real   0m0.270s
user   0m0.244s
sys   0m0.024s
jrs@jrs-laptop:~/sb/examples/test$ tail -n50 findit.out
[062012] am! No, it can't be!" Pierre kept saying as he kissed Princess
[062065] crossed his mind: "Wasn't it all a dream? Isn't Princess Mary
[062067] this- and suddenly Princess Mary will tell her, and she will be sure
[062105] bliss he now knew. Prince Vasili, who having obtained a new post and
[062135] to Princess Mary with a gaily mocking smile: "He looks just, yes, just
[062146] little of Pierre, but when Princess Mary mentioned him a
[062150] The change that took place in Natasha at first surprised Princess
[062157] Princess Mary felt that she had no right to reproach her even in her
[062164] When Princess Mary returned to her room after her nocturnal talk
[062175] at her seemed to Princess Mary, and sorry as she was to see her
[062179] "But what's to be done? She can't help it," thought the princess.
[062187] But noticing the grieved expression on Princess Mary's face she
[062197] "Then why are you crying? I am happy for your sake," said Princess
[062743] flight from it, the death of Prince Andrew, Natasha's despair, Petya's
[062871] At the beginning of winter Princess Mary came to Moscow. From
[062876] "I never expected anything else of him," said Princess Mary to
[062891] When the princess came out of the countess' room Nicholas met her
[062900] princess' carriage had disappeared.
[062905] Nicholas did not reply and tried to avoid speaking of the princess
[062914] princess, but his silence irritated her.
[062951] by Nicholas, Princess Mary confessed to herself that she had been
[062983] With Mademoiselle Bourienne's help the princess had maintained the
[062993] looked at the princess. She still sat motionless with a look of
[062999] "Good-by, Princess!" said he.
[063012] "Yes, Princess," said Nicholas at last with a sad smile, "it doesn't
[063018] Princess Mary gazed intently into his eyes with her own luminous
[063032] princess had caught a glimpse of the man she had known and loved,
[063042] why. "Thank you, Princess," he added softly. "Sometimes it is hard."
[063044] "So that's why! That's why!" a voice whispered in Princess Mary's
[063065] "Princess, for God's sake!" he exclaimed, trying to stop her.
[063066] "Princess!"
[063079] In the winter of 1813 Nicholas married Princess Mary and moved to
[063313] and Sonya, blaming himself and commending her. He had asked Princess
[063350] same scale as under the old prince.
[063402] Ivanovich, the late prince's architect, who was living on in
[063649] when she and Countess Mary spoke of Prince Andrew (she never mentioned
[063650] him to her husband, who she imagined was jealous of Prince Andrew's
[063837] Rostovs he had received a letter from Prince Theodore, asking him to
[063962] "And have you talked everything well over with Prince Theodore?" she
[063968] he did frighten me... You've seen the princess? Is it true she's in
[064250] questions as to whether Prince Vasili had aged and whether Countess
[064282] Nicholas and Natasha always brought him back to the health of Prince
[064297] translate things into his mother's language, "Prince Alexander
[064305] "Well, and how is Prince Alexander to blame? He is a most
[064422] Prince Theodore, and she helped him by asking how his affairs with
[064423] Prince Theodore had gone.
[064479] his brows. "Prince Theodore and all those. To encourage culture and
[064909] right, and let there be but one banner- that of active virtue.' Prince
[065024] Prince Andrew- and his father had neither shape nor form, but he
[065031] Prince Andrew in the house, Nicholas never imagined him in human
jrs@jrs-laptop:~/sb/examples/test$



6
Code and examples / Re: Text search
« on: 13. May 2018, 17:46:09 »
Mike brings up an interesting issue with the use of LIKE in this example. Since SPLITA is removing the line terminator as the split character the CHOMP shouldn't be needed. Here is my solution to the problem.

Code: [Select]
OPEN "warpeace.txt" FOR INPUT AS 1
flen = FILELEN("warpeace.txt")
fstr = INPUT(flen, 1)
SPLITA fstr BY chr(10) to farr
lnum = 1
OPTION COMPARE sbCaseInsensitive
FOR idx = 0 to UBOUND(farr)
  IF " " & farr[idx] & " " LIKE "*PrInCe*" THEN PRINT FORMAT("%~[000000] ~", lnum), farr[idx],"\n"
  lnum += 1
NEXT


jrs@jrs-laptop:~/sb/examples/test$ time scriba findit.sb > findit.out

real   0m0.531s
user   0m0.520s
sys   0m0.012s
jrs@jrs-laptop:~/sb/examples/test$ tail -n50 findit.out
[062012] am! No, it can't be!" Pierre kept saying as he kissed Princess
[062065] crossed his mind: "Wasn't it all a dream? Isn't Princess Mary
[062067] this- and suddenly Princess Mary will tell her, and she will be sure
[062105] bliss he now knew. Prince Vasili, who having obtained a new post and
[062135] to Princess Mary with a gaily mocking smile: "He looks just, yes, just
[062146] little of Pierre, but when Princess Mary mentioned him a
[062150] The change that took place in Natasha at first surprised Princess
[062157] Princess Mary felt that she had no right to reproach her even in her
[062164] When Princess Mary returned to her room after her nocturnal talk
[062175] at her seemed to Princess Mary, and sorry as she was to see her
[062179] "But what's to be done? She can't help it," thought the princess.
[062187] But noticing the grieved expression on Princess Mary's face she
[062197] "Then why are you crying? I am happy for your sake," said Princess
[062743] flight from it, the death of Prince Andrew, Natasha's despair, Petya's
[062871] At the beginning of winter Princess Mary came to Moscow. From
[062876] "I never expected anything else of him," said Princess Mary to
[062891] When the princess came out of the countess' room Nicholas met her
[062900] princess' carriage had disappeared.
[062905] Nicholas did not reply and tried to avoid speaking of the princess
[062914] princess, but his silence irritated her.
[062951] by Nicholas, Princess Mary confessed to herself that she had been
[062983] With Mademoiselle Bourienne's help the princess had maintained the
[062993] looked at the princess. She still sat motionless with a look of
[062999] "Good-by, Princess!" said he.
[063012] "Yes, Princess," said Nicholas at last with a sad smile, "it doesn't
[063018] Princess Mary gazed intently into his eyes with her own luminous
[063032] princess had caught a glimpse of the man she had known and loved,
[063042] why. "Thank you, Princess," he added softly. "Sometimes it is hard."
[063044] "So that's why! That's why!" a voice whispered in Princess Mary's
[063065] "Princess, for God's sake!" he exclaimed, trying to stop her.
[063066] "Princess!"
[063079] In the winter of 1813 Nicholas married Princess Mary and moved to
[063313] and Sonya, blaming himself and commending her. He had asked Princess
[063350] same scale as under the old prince.
[063402] Ivanovich, the late prince's architect, who was living on in
[063649] when she and Countess Mary spoke of Prince Andrew (she never mentioned
[063650] him to her husband, who she imagined was jealous of Prince Andrew's
[063837] Rostovs he had received a letter from Prince Theodore, asking him to
[063962] "And have you talked everything well over with Prince Theodore?" she
[063968] he did frighten me... You've seen the princess? Is it true she's in
[064250] questions as to whether Prince Vasili had aged and whether Countess
[064282] Nicholas and Natasha always brought him back to the health of Prince
[064297] translate things into his mother's language, "Prince Alexander
[064305] "Well, and how is Prince Alexander to blame? He is a most
[064422] Prince Theodore, and she helped him by asking how his affairs with
[064423] Prince Theodore had gone.
[064479] his brows. "Prince Theodore and all those. To encourage culture and
[064909] right, and let there be but one banner- that of active virtue.' Prince
[065024] Prince Andrew- and his father had neither shape nor form, but he
[065031] Prince Andrew in the house, Nicholas never imagined him in human
jrs@jrs-laptop:~/sb/examples/test$

7
Code and examples / Re: Text search
« on: 12. May 2018, 17:36:20 »
Quote
Is that the intended use of LIKE "*PrInCe*"?

I was just showing how SB case insensitivity could be applied in either the pattern string or the search string.

 

8
Code and examples / Re: Text search
« on: 10. May 2018, 21:18:39 »
Sorry. I don't understand your question.

The * is a JOKER (Peter Verhas's term) for anything before or after prince. WILDCARD is replacement for the JOKER character if it * is part of the search text.

HERE is a good example of using SB pattern matching to extract the function names from an XML wrapped SWIG generated file based on the SQLite's .h include file.

9
Code and examples / Re: Text search
« on: 10. May 2018, 07:12:10 »
0.007312 seconds.

That's pretty fast.

My old laptop and Script BASIC for Linux 64 bit does the *prince* patten match of warpeace.txt in about a 1/2 second which is fast enough for my needs.

10
Code and examples / Re: Text search
« on: 01. May 2018, 22:42:54 »
As Mike mentioned the case insensitivity can be toggled on/off anywhere during program execution with the OPTION statement.

Code: [Select]
OPEN "warpeace.txt" FOR INPUT AS 1
flen = FILELEN("warpeace.txt")
fstr = INPUT(flen, 1)
SPLITA fstr BY chr(10) to farr
lnum = 1
OPTION COMPARE sbCaseInsensitive
FOR idx = 0 to UBOUND(farr)
  IF CHOMP(farr[idx]) > "" AND farr[idx] LIKE "*PrInCe*" THEN PRINT FORMAT("%~[000000] ~", lnum), farr[idx],"\n"
  lnum += 1
NEXT


jrs@jrs-laptop:~/sb/examples/test$ tail -n 20 results.findit
[062993] looked at the princess. She still sat motionless with a look of
[062999] "Good-by, Princess!" said he.
[063012] "Yes, Princess," said Nicholas at last with a sad smile, "it doesn't
[063042] why. "Thank you, Princess," he added softly. "Sometimes it is hard."
[063044] "So that's why! That's why!" a voice whispered in Princess Mary's
[063065] "Princess, for God's sake!" he exclaimed, trying to stop her.
[063066] "Princess!"
[063079] In the winter of 1813 Nicholas married Princess Mary and moved to
[063313] and Sonya, blaming himself and commending her. He had asked Princess
[063350] same scale as under the old prince.
[063402] Ivanovich, the late prince's architect, who was living on in
[063649] when she and Countess Mary spoke of Prince Andrew (she never mentioned
[063650] him to her husband, who she imagined was jealous of Prince Andrew's
[063837] Rostovs he had received a letter from Prince Theodore, asking him to
[063962] "And have you talked everything well over with Prince Theodore?" she
[063968] he did frighten me... You've seen the princess? Is it true she's in
[064250] questions as to whether Prince Vasili had aged and whether Countess
[064297] translate things into his mother's language, "Prince Alexander
[064305] "Well, and how is Prince Alexander to blame? He is a most
[064479] his brows. "Prince Theodore and all those. To encourage culture and
jrs@jrs-laptop:~/sb/examples/test$


11
Code and examples / Re: Text search
« on: 01. May 2018, 22:12:37 »
Quote
Results do not match nicely what I see above; apparently, there are different versions of W+P around.

Here is what I'm using.

12
Code and examples / String Concatenate
« on: 01. May 2018, 06:20:51 »
I notice a thread (argument) on the PowerBASIC forum about the best way to concatenate a string. I thought I would extend that thread here and get your opinion/advice on concatenating a string. The only rule is the string must be populated with nulls.  (CHR$(0)) Keep in mind that the string you create has to be deallocated (freed) before returning to the command prompt.

Here is the Script BASIC attempt for reference.

Code: [Select]
FOR idx = 1 TO 1000
  this &= 0x0
NEXT
PRINT LEN(this),"\n"


jrs@jrs-laptop:~/sb/examples/test$ time scriba concat.sb
1000

real   0m0.006s
user   0m0.004s
sys   0m0.000s


100000

real   0m0.988s
user   0m0.948s
sys   0m0.036s


This example just allocates a 1,000,000 byte string of nulls.

Code: [Select]
this = STRING(1000000, 0)
PRINT LEN(this),"\n"


jrs@jrs-laptop:~/sb/examples/test$ time scriba 1milstr.sb
1000000

real   0m0.009s
user   0m0.004s
sys   0m0.000s
jrs@jrs-laptop:~/sb/examples/test$

13
Community news and announcements / Re: Conforums closing down
« on: 30. April 2018, 00:43:59 »
I think it's much simpler than that.

Drake picked up PowerBASIC in a fire sale. All Bob left Vivian was debt. Like Sage who thought they could make money selling ProvideX to non-associated customers and in the end it would pay for the purchase and they get ProvideX free with no royalty or by the seat fees. Unfortunately it didn't work out that way as the liability was far more than the revenue it produced.

It looks like Drake is stuck with a compiler only a dead man can compile. You can't fill a sink hole with a pale and a shovel.



14
Code and examples / Re: Text search
« on: 28. April 2018, 10:24:05 »
That is easily done with grep.

Here is a Script BASIC example of searching the War and Peace text file version (3.2 meg file) for Prince.

Code: [Select]
OPEN "warpeace.txt" FOR INPUT AS 1
flen = FILELEN("warpeace.txt")
fstr = INPUT(flen, 1)
SPLITA fstr BY chr(10) to farr
lnum = 1
FOR idx = 0 to UBOUND(farr)
  IF CHOMP(farr[idx]) > "" AND farr[idx] LIKE "*Prince*" THEN PRINT FORMAT("%~[000000] ~", lnum), farr[idx],"\n"
  lnum += 1
NEXT


jrs@jrs-laptop:~/sb/examples/test$ time scriba findit.sb > results.findit

real   0m0.473s
user   0m0.448s
sys   0m0.028s
jrs@jrs-laptop:~/sb/examples/test$ ls -l warpeace.txt
-rw-rw-r-- 1 jrs jrs 3202941 Aug 29  2017 warpeace.txt
jrs@jrs-laptop:~/sb/examples/test$ tail -n 20 results.findit
[062743] flight from it, the death of Prince Andrew, Natasha's despair, Petya's
[062871] At the beginning of winter Princess Mary came to Moscow. From
[062876] "I never expected anything else of him," said Princess Mary to
[062951] by Nicholas, Princess Mary confessed to herself that she had been
[062999] "Good-by, Princess!" said he.
[063012] "Yes, Princess," said Nicholas at last with a sad smile, "it doesn't
[063042] why. "Thank you, Princess," he added softly. "Sometimes it is hard."
[063044] "So that's why! That's why!" a voice whispered in Princess Mary's
[063065] "Princess, for God's sake!" he exclaimed, trying to stop her.
[063066] "Princess!"
[063079] In the winter of 1813 Nicholas married Princess Mary and moved to
[063313] and Sonya, blaming himself and commending her. He had asked Princess
[063649] when she and Countess Mary spoke of Prince Andrew (she never mentioned
[063650] him to her husband, who she imagined was jealous of Prince Andrew's
[063837] Rostovs he had received a letter from Prince Theodore, asking him to
[063962] "And have you talked everything well over with Prince Theodore?" she
[064250] questions as to whether Prince Vasili had aged and whether Countess
[064297] translate things into his mother's language, "Prince Alexander
[064305] "Well, and how is Prince Alexander to blame? He is a most
[064479] his brows. "Prince Theodore and all those. To encourage culture and
jrs@jrs-laptop:~/sb/examples/test$


15
Community news and announcements / Re: Indroducing BASIC8
« on: 05. March 2018, 05:53:09 »
Do you except Google Pay (GPay) as a payment method? I wouldn't use it enough to go through becoming a Steam member.

If you send me a copy, I'll setup your own BASIC8 board on AllBASIC.info forum.  :)


Pages: [1] 2 3 ... 26