RE: Anyone with free time want to help this guy? - bplus - 11-16-2024
BTW no word from our guy "l" but MS Outlook has seen fit to reclassify my Bank Statement as junk mail. Sure, to them it probably is.
RE: Anyone with free time want to help this guy? - Pete - 11-16-2024
Well now that Mark's established it's his fault for this turning into a political thing, let's continue...
https://qb64phoenix.com/forum/showthread.php?tid=3200&pid=29905#pid29905
RE: Anyone with free time want to help this guy? - bplus - 11-16-2024
Mr l has replied and is rewriting code comments into English from Spanish and sending later.
RE: Anyone with free time want to help this guy? - Pete - 11-16-2024
Good, because we're not going to see Pete's Handy Dandy Spanish REM to English REM utility anytime pronto.
+1 for successful phishing expedition. You are now tied with Steve, amazing.
Pete
RE: Anyone with free time want to help this guy? - bplus - 11-16-2024
Wow thanks Pete, well he's still first in my book.
I sent a sample RA setup using UDT's here it is for you guys to follow along. It was likely posted here before:
Code: (Select All) _Title "UDT to Random Access File Test" ' b+ 2021-12-24
Type Image
As String * 255 Text, FileName
As Long SzX, SzY, PosX, PosY
End Type
Const SW = 1000, SH = 700
ReDim As Image TheItem(1 To 100), TheRecord
TheItem(1).Text = FakeText$(255)
TheItem(1).FileName = FakeText$(255)
Print TheItem(1).Text
Print Len(TheItem(1).Text)
Print TheItem(1).FileName
Print Len(TheItem(1).FileName)
Print "zzz"
Sleep
'make fake data to file
For i = 1 To 100
TheItem(i).Text = FakeText$(255)
TheItem(i).SzX = 100 + Rnd * 20
TheItem(i).SzY = 70 + Rnd * 14
TheItem(i).PosX = Rnd * (SW - TheItem(i).SzX)
TheItem(i).PosY = Rnd * (SH - TheItem(i).SzY)
TheItem(i).FileName = FakeText$(255)
Next
Open "Data Dump.RA" For Random As #1 Len = Len(TheRecord)
For i = 1 To 100
'odious and tedious is this
TheRecord.Text = TheItem(i).Text
TheRecord.SzX = TheItem(i).SzX
TheRecord.SzY = TheItem(i).SzY
TheRecord.PosX = TheItem(i).PosX
TheRecord.PosY = TheItem(i).PosY
TheRecord.FileName = TheItem(i).FileName
Put #1, , TheRecord
Next
Close #1
Print "Data File Ready"
' OK we got data filed! Now can we get it back
Open "Data Dump.RA" For Random As #1 Len = Len(TheRecord)
For i = 1 To 100
Cls
Get #1, i, TheRecord
Print "Record Number:"; i
Print "Text: "; TheRecord.Text
Print "SzX:"; TheRecord.SzX
Print "SzY:"; TheRecord.SzY
Print "PosX:"; TheRecord.PosX
Print "PosY:"; TheRecord.PosY
Print "FileName:"; TheRecord.FileName
Print " zzz..."
Sleep
Next
Close #1
Function FakeText$ (lengthh)
BlankString$ = Space$(lengthh)
fini = Int(Rnd * 255) + 1
For i = 1 To fini
Mid$(BlankString$, i, 1) = Chr$(Rnd * (96 - 32) + 32)
Next
FakeText$ = BlankString$
End Function
I was thinking, hoping, we go through some theory and practice and he could work out the details in applying to his particular code but there is sure to be an unrelated detail to snag the transition.
RE: Anyone with free time want to help this guy? - TempodiBasic - 11-17-2024
Hi
I liked to post a my 2cent demo on UDT and Random File for database...
Code: (Select All)
Rem demo of UDT database
Rem #defining UDT, #array of UDT, #creating reading overwriting RANDOM file
Rem #reading array in one shot, #managing file, #handle runtime error
Rem #using Global subroutines, #console mode output, #formatting output text
Type MyRecord
i As Integer
s As Single
sS As String * 10
leng As Long
End Type
Dim MioRecord(1 To 9) As MyRecord
Cls , 1
GoSub MakeDataFile
Cls , 2
GoSub ReadDataFile
Cls , 3
GoSub ShowDataOnRequest
Cls , 1
Print " Quitting"
End
PrintDataOnScreen:
Cls , 4
Print " Record number " + ss$
Print
Print "Miorecord.i = "; MioRecord(Val(ss$)).i
Print "Miorecord.s = "; MioRecord(Val(ss$)).s
Print "Miorecord.sS = "; MioRecord(Val(ss$)).sS
Print "Miorecord.leng = "; MioRecord(Val(ss$)).leng
Print
GoSub WaitAKeyPressed
Return
ShowDataOnRequest:
ss$ = ""
While ss$ <> "Q"
Locate 1, 1
Print "Press 1 to 9 for see data in choosen record"
ss$ = UCase$(InKey$)
If InStr("123456789", ss$) > 0 And ss$ <> "" Then GoSub PrintDataOnScreen
' remember to avoid to search a null string using INSTR otherwise you'll get a logical bug
Wend
Return
ReadDataFile:
If _FileExists(NomeFile$) Then Print "File already on disc, we read it!" Else Print "File not found, operation failed!"
On Error GoTo Failure
numfile = FreeFile
Open NomeFile$ For Random As #numfile Len = Len(MioRecord())
Get #numfile, , MioRecord() ' <-- one step to get data of an array!The old way need a FOR or WHILE NOT EOF() loop
Close #numfile
Print "Read data from random file"
GoSub WaitAKeyPressed
Return
MakeDataFile:
NomeFile$ = "DummyDat.dat"
If _FileExists(NomeFile$) Then Print "File already on disc, we overwrite it!" Else Print "File not found, we create it!"
numfile = FreeFile
Open NomeFile$ For Random As #numfile Len = Len(MioRecord())
For a% = 1 To 9 Step 1
MioRecord(a%).i = a%
MioRecord(a%).s = a% / 10
MioRecord(a%).sS = Str$(a%)
MioRecord(a%).leng = Len(MioRecord(a%).sS)
Rem Put #numfile, , MioRecord(a%) <-- this is the old way to store data each record a time
Next a%
Put #numfile, , MioRecord()
Close #numfile
Print "Data file made"
GoSub WaitAKeyPressed
Return
WaitAKeyPressed:
Print "waiting a keypressed"
Do: s$ = InKey$: Loop Until s$ <> ""
Return
Failure:
Cls , 5
Color 30, 2
Print " System Failure! Data file not found!" + Chr$(13) + "Now Quitting"
End
Return
it follows the old fashion of GOSUB and GOTO but each GOSUB / RETURN can be switched into a SUB/END SUB with the right parameters.
While ON ERROR GOTO cannot be converted into modern Subroutine.
It shows the difference between Qbasic/QB45 and QB64pe: the news is that you can save and read a whole array to/from file in QB64pe.
RE: Anyone with free time want to help this guy? - bplus - 11-17-2024
Back in the day, Random access, RA, files took place of need to create an array for the file.
The file acted as the array you could read/write to, so changes were made directly without UDT array which we didn't have then anyway, though we had "fields".
I am starting to wonder if RA is best way to go these days. The longer you have the file open while processing, the more likely an error to occur eg a crash causing data corruption.
Now that we do have UDT arrays, just load the file data into it and process from that then when done rewrite the data file.
RA's are also nice if data file is HUGE! too big for UDT array?
RE: Anyone with free time want to help this guy? - Kernelpanic - 11-19-2024
Is the person in need of help still busy translating? It must be a tremendous text!
|