Search found 688 matches

by grindstone
Mar 22, 2020 18:28
Forum: General
Topic: Parse string to tree structure (solved)
Replies: 61
Views: 2287

Re: Parse string to tree structure

@badidea: Great work! That reminds me that I have to clean my nesting boxes (and my letter box, too, I get this little lodger since three years). http://users.freebasic-portal.de/grindstone/Screenshots/Meise3.jpg And here are my two pennies to the tree parser: #Include "dirTree.bi" Dim As ...
by grindstone
Mar 20, 2020 16:01
Forum: General
Topic: Parse string to tree structure (solved)
Replies: 61
Views: 2287

Re: Parse string to tree structure

In the meantime I put the tTreeNode class into a library I call "dirTree.bi": #Include Once "dir.bi" Type tDirTreeNode As String fName 'name of the current subfolder As UInteger attr 'attributes As Integer depth 'tree depth of the current folder As boolean deflate = TRUE 'deflati...
by grindstone
Mar 20, 2020 13:25
Forum: General
Topic: Parse string to tree structure (solved)
Replies: 61
Views: 2287

Re: Parse string to tree structure

Something like this ?
by grindstone
Mar 18, 2020 14:37
Forum: General
Topic: virus outbreak sim
Replies: 12
Views: 573

Re: virus outbreak sim

the dead are moving !! Maybe zombies? *grin* Tip: In FB a TYPE can contain an array of itself: type thuman dim as double x , y '' spot of thuman dim as long kl '' color state of thuman dim as integer tijd1 , tijd2 ''counter for keeping time Static As thuman human() 'humans array Declare Sub act(<op...
by grindstone
Mar 10, 2020 14:30
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

I recoded my snippet to really count (instead of calculate) the number of values. Const tallylen = 256^4/8 Dim As String str1, substr, dict Dim As Integer strlen, dummy, inputcount, outputcount Dim As ULong Ptr von, bis Dim As UByte Ptr dictptr, tally = Callocate(tallylen) Open ExePath + "\inpu...
by grindstone
Mar 09, 2020 13:34
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

Thank you for testing, due to it I found a bug in my code (and fixed it, see above). But very strange - our machines seem to behave quite different: 10000000 characters: instrtest11: 0.689609581455835 tally: 0.4877191733044564 20000000 characters: instrtest11: 1.343974237574243 tally: 0.678297967142...
by grindstone
Mar 08, 2020 22:32
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

And now the same with assembly code. Anyone to beat this? Const tallylen = 256^4/8 Dim As String str1, substr, dict Dim As Integer strlen, dummy Dim As ULong Ptr von, bis Dim As UByte Ptr dictptr, tally = Callocate(tallylen) strlen = 10000000 'strlen = 13*1024*1024 'strlen = 12 str1 = String(strlen,...
by grindstone
Mar 07, 2020 15:30
Forum: Windows
Topic: Epoch time.
Replies: 30
Views: 1200

Re: Epoch time.

deltarho[1859] wrote:With that epoch my date of birth epoch time is 1512518400000. I may change the epoch to 1 January 1920 making folk think that I am younger than I really am. Image
And I assumed you were born in 1859... *grin*
by grindstone
Mar 06, 2020 14:49
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

A different approach (my thanks to dodicat for mentioning the tally string). I think this can stick with jimg's code - without assembly *grin* : Dim As String str1, substr Dim As String dict Dim As Integer strlen Dim As UByte Ptr stp Const tallylen = 256^4/8 Dim As UByte Ptr tally = Callocate(tallyl...
by grindstone
Mar 05, 2020 5:02
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

Very impressive! I've tried another way to do the job: Writing the 4-byte-words into a tree structure and then traverse the tree to create the dictionary string. It works nearly as fast as jimg's code, but it runs out of memory (on my 32 bit machine) if the number of different words exceeds a certai...
by grindstone
Mar 03, 2020 15:37
Forum: Beginners
Topic: Reading Data From External Program
Replies: 10
Views: 467

Re: Reading Data From External Program

@chris319: Thank you for taking the work out of my hands to translate the description. May I add your translation to the code example?
by grindstone
Mar 03, 2020 12:34
Forum: Beginners
Topic: Reading Data From External Program
Replies: 10
Views: 467

Re: Reading Data From External Program

Thanks, but how do I read the frame data into an array in FB? The simplest way is: -Open the output file -Transfer the data to the array -Close/kill the output file It seems I can send commands to ffmpeg, and it responds, but I need to set up a second pipe to read in the received data which I don't...
by grindstone
Mar 02, 2020 14:52
Forum: Beginners
Topic: Reading Data From External Program
Replies: 10
Views: 467

Re: Reading Data From External Program

I regulary use ffmpeg for audio conversion. The easiest way of access is by a pipe: #Include "crt\stdio.bi" Dim As String ffmpeg = "C:\programs\ffmpeg.exe" 'replace with the full path of your ffmpeg.exe Dim As String order = ffmpeg + " ?" 'replace the question mark with...
by grindstone
Mar 02, 2020 13:59
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

Double post, erased. (Sorry)
by grindstone
Mar 02, 2020 13:58
Forum: General
Topic: Instr()
Replies: 25
Views: 940

Re: Instr()

Just for pleasure, the snippet from above with pointer access: Dim As String str1 For a As LongInt = 0 To 10000000 str1+= Chr( Int( Rnd * 256 )) Next 'str1 = "abcdefghijklmnopqrstuvwx" Dim As String dict = String(Len(str1) + 10, 0) Dim As String n1, n2 Dim As Long Ptr lp = Cast(Long Ptr, S...

Go to advanced search