|
Post by tenochtitlanuk on Apr 3, 2023 3:46:32 GMT -5
Several ( possibly relevant!) thoughts.
1 errors like 3001- from the dll help file.....
3000-3999 Error messages from the FTP server program, predigested by FTP4W. FTPERR_UNEXPECTEDANSWER The FTP server sent a response that FTP4W didn't expect. FTP4W doesn't know whether the command was successful or not. FTPERR_CANNOTCHANGETYPE The FTP server cannot change to the requested transfer type (ASCII, BINARY, or L8). FTPERR_CMDNOTIMPLEMENTED The FTP server recognized the command, but it does not know how to execute it. FTPERR_PWDBADFMT The FTP server reports its current working directory, but FTP4W cannot parse the answer. FTPERR_PASVCMDNOTIMPL The FTP server does not support passive mode. (FTP4W needs this mode for several functions.)
2 Is your ftp server on a commercial or free site? DriveHQ cut off my ftp access after I'd run experiments on it, but left the free web-interface version working! This despite them saying I had '100 ftp sessions then limit of ten per day'.
3 My version subroutine closes the ftp connection after every call, so if you send a 'change directory' it is forgotten for the next call. Move it outside the subroutine to when you quit, perhaps, or use full pathnames?
Let us know if you get it working! I'm currently in the throws of downsizing/moving house- so little time on my computers....
|
|
|
Post by tenochtitlanuk on Mar 28, 2023 14:39:15 GMT -5
It 'works' for me on LB 4.51 under Linux/Wine. But very hard to see any difference on the selection of a button or moving selection click to a new one.
|
|
|
Post by tenochtitlanuk on Mar 15, 2023 17:28:05 GMT -5
See Wikipedia-
The CSV file format is not fully standardized. Separating fields with commas is the foundation, but commas in the data or embedded line breaks have to be handled specially. Some implementations disallow such content while others surround the field with quotation marks, which yet again creates the need for escaping if quotation marks are present in the data. This will apply too to space-separators, reverse-slash separators, or w.h.y. It is therefore up to the CODER to ensure that the data fields do not include the separator character- if you ignore that caution, beware!
As a heavy user of word$( I have never had cause to see the anomalous outputs!
|
|
|
Post by tenochtitlanuk on Mar 12, 2023 13:54:23 GMT -5
I suggested to atomose that if he uses LB rather than JB he could make his games download a hi-score table to display when starting, & upload a user's score to a ftp server when exiting This high-score table would be generated by a program run by him say hourly, that read all new high scores and sorted them.
However I don't want people to know my ( paid for) username and password for the ftp/http server that runs my website, for obvious reasons!!! And yes, I could create and run a local server, ensure its security, and run it 24 h/24 with a static or edirected ISP address- hastle!
Anyway, as an experiment I created a FREE ftp site courtesy of DriverHQ. Very straightforward to create. The following code shows uploading a file, downloading a file, and also getting the remote directory listing. To use it you need ftp4w32.dll from my site in the same directory as you save the code below. PM me if you want to try it, and I'll send the username/password I used. But I'd prefer you set up your own site as you can delete my files or change the password!!
nomainwin
dim error$(6000)
error$( 0) ="No problem.." error$( 1003) ="user not connected to server" error$( 1004) ="cannot open file" error$( 1008) ="action not taken" error$( 1010) ="server cannot open file" error$( 3001) ="3001" error$( 5002) ="5002"
WindowWidth = 800 WindowHeight = 550
global parentftp, port, pasv, ftphost$, login$, password$, initpath$, upload$, serverFile$, backLocal$, TRUE, FALSE, ftpsession
port = 21 'port to use. pasv = 1 'PASV mode? 1 is yes, 0 is no. ftphost$ = "ftp.drivehq.com" 'ftp site address. login$ = "*************" 'ftp site username login. password$ = "*************" 'ftp site password. initpath$ = "" 'leave blank if you want the site's default. upload$ = "exampleN4a.txt" 'full path & file info for local file to upload. NB could all be the same... serverFile$ = "exampleN4b.txt" 'what file is called on the ftp server. backLocal$ = "exampleN4c.txt" 'what to call the returned local downloaded file.
TRUE = 1 FALSE = 0
ftpsession = FALSE
button #w.b1, " Upload ", [upload], LR, 550, 50, 110, 30 button #w.b2, "Download", [download], LR, 400, 50, 110, 30 button #w.b3, "Server dir'y", [remoteDir], LR, 250, 50, 110, 30
texteditor #w.te, 10, 10, 740, 400
open "LB" for window as #w
#w "trapclose [quit.main]"
#w "font bold 12"
parentftp =hwnd( #w)
wait
[upload] call action "upload" wait
[download] call action "download" wait
[remoteDir] call action "Server dir'y" wait
sub action command$ ' Implements at present file upload/download ( with renaming if you want) and remote direstory listing. open "ftp4w32.dll" for dll as #ftp ftpsession = TRUE calldll #ftp, "FtpInit", parentftp as long, res as long : #w.te "Initialising "; res; " "; error$( res) calldll #ftp, "FtpSetSynchronousMode", void as long : #w.te "Mode set async" calldll #ftp, "FtpSetDefaultPort", port as long, void as long : #w.te "Port set 21" calldll #ftp, "FtpSetPassiveMode", pasv as long, void as long : #w.te "Mode set passive" calldll #ftp, "FtpLogin", ftphost$ as struct, login$ as struct, password$ as struct, parentftp as long, 0 as long, res as long: #w.te "Logging in. Returned "; res 'calldll #ftp, "FtpCWD", initpath$ as struct, res as long : #w.te "Change remote working directory " ; res; " "; error$( res); " "
if command$ ="upload" then calldll #ftp, "FtpSendFile", upload$ as struct, serverFile$ as struct, 0 as long, 0 as long, parentftp as long, 0 as long, res as long:_ #w.te "Sent file "; upload$; " as "; serverFile$; " & received error "; error$( res) end if
if command$ ="download" then calldll #ftp, "FtpRecvFile", serverFile$ as struct, backLocal$ as struct, 0 as long, 0 as long, parentftp as long, 0 as long, res as long:_ #w.te "Requesting file "; serverFile$; " for download as "; backLocal$;_ " error ="; res; " "; error$( res) end if
if command$ ="Server dir'y" then dirlist$ ="ftplist.tmp": argument$ ="" calldll #ftp, "FtpDir", argument$ as struct, dirlist$ as struct, 1 as long, parentftp as long, 0 as long, res as long:_ #w.te "Dir'y listing..": #w.te argument$ open dirlist$ for input as #fIn content$ =input$( #fIn, lof( #fIn)) close #fIn kill dirlist$ #w.te content$ end if
[closeftp] calldll #ftp, "FtpCloseConnection", void as long: #w.te "Connection closed... "; calldll #ftp, "FtpRelease", void as long : #w.te " .. and released." close #ftp ftpsession = FALSE
#w.te "__________________________________" #w.te ""
end sub
[quit.main] close #w if ftpsession = TRUE then calldll #ftp, "FtpCloseConnection", void as long calldll #ftp, "FtpRelease", void as long close #ftp end if end
' Initialising 0 No problem.. ' Mode set async ' Port set 21 ' Mode set passive ' Logging in. Returned 0 ' Sent file exampleN4.txt & received error No problem.. ' Dir'y listing..
' drwx------ 1 user group 138 Mar 09 16:06 My Documents ' drwx------ 1 user group 3093195 Mar 09 16:06 My Pictures ' drwx------ 1 user group 111 Mar 11 20:56 tenoch ' drwx------ 1 user group 24332 Mar 09 16:06 wwwhome ' drwx------ 1 user group 0 Mar 12 12:55 drivehqshare ' -rwx------ 1 user group 23 Mar 09 16:53 example.txt ' -rwx------ 1 user group 34 Mar 10 18:49 exampleN.txt ' -rwx------ 1 user group 33 Mar 10 19:32 exampleN2.txt ' -rwx------ 1 user group 44 Mar 11 21:47 exampleN3.txt ' -rwx------ 1 user group 129 Mar 12 12:54 exampleN4.txt ' -rwx------ 1 user group 129 Mar 12 12:55 exampleN4c.txt ' Requesting file exampleN4c.txt for download ; error =0 No problem.. ' Connection closed ' .. and released.
|
|
|
Post by tenochtitlanuk on Feb 26, 2023 16:53:37 GMT -5
Yeah. But my method you can easily select bits you want translating and bits you do not. But I was surprised at how many changes I had to make by hand when I recently scanned some old programs from the seventies- the old dot-matrix characters proved hard to decipher and often needed me to correct by hand.
|
|
|
Post by tenochtitlanuk on Feb 26, 2023 10:11:18 GMT -5
Gaslook- if you have a pdf document it is easy to screengrab it a page at a time and do OCR (optical character recognition) to get the text- then use Google translate. I did that recently on a Kindle novel I'd bought is Spanish and wanted to use in class with a Google English version. It also pointed out a whole lot of 'Mexicanismos'- words common in Mexico but not in Europe. But it took me a while to do about 90 pages!!I am NOT encouraging anyone to distribute such copies to othe people...
|
|
|
Post by tenochtitlanuk on Feb 22, 2023 16:11:25 GMT -5
Atomose was asking how easy it is to add code to a game to save a score/username somewhere, and retrieve it to display a list of high scores. The easy method on my site is an example. Master computer can send/receive commands to control say hardware. For a game-- Game creator's computer runs code to read the files that the game-players machine uploaded when they exited the game, sorts them, and puts up perhaps daily a leader board. This would then be read when the player next starts the game ( or could be checked for at regular intervals while playing). Image below shos the principle in action. Lefthand code, on one computer, sits waiting for a text input and sends it when the button is pushed. Righthand code- on the same computer or another anywhere on the 'net, regularly checks if this file is changed. The image below shows three stages on a test run. Will add the code on my website asap. At present a bit fraught as the buyer of the house of the people who were going to buy ours have just backed out.... in the UK this is possible until 'contracts are exchanged'. So wemay lose the house we were expecting to buy... Ho Hum.
|
|
|
Post by tenochtitlanuk on Feb 22, 2023 4:41:44 GMT -5
Is permission for the rpi32-353 file set to allow execute?
|
|
|
Post by tenochtitlanuk on Feb 18, 2023 16:14:03 GMT -5
I think it is LB or the underlying Smalltalk, since when you print to PDF it does the same- puts a fill colour of black behind the black characters!¬
|
|
|
Post by tenochtitlanuk on Feb 17, 2023 15:48:58 GMT -5
I haven't run MS for years and run LB under Wine/Linux Mint. Practically no differences from running LB under Windows. BUT I've never got it to print correctly from the editor- it prints black blocks, like black characters with a black background. No big deal- I just select all, copy and paste into Gedit or other editor if I want to print. Incidentally it does the same if I print from LB to a pdf file.
EDIT PS you can load a saved LB PDF file and change the fill colour to white in LibreOffice. Will then show/print correctly.
|
|
|
Post by tenochtitlanuk on Feb 10, 2023 17:14:11 GMT -5
A simplistic version of this cropped up on FaceBook and TikTok. Just had to code it..
The spheres move linearly through the centre, but the brain interprets it as a rotating square..
Will do a webpage soon with my code. The backdrop is our lovely Bae Abertawe-- that's Swansea Bay to you Saesnegau..
|
|
|
Post by tenochtitlanuk on Jan 28, 2023 16:23:13 GMT -5
For some reason the graphic isn't/wasn't showing... OK now.
|
|
|
Post by tenochtitlanuk on Jan 28, 2023 16:01:16 GMT -5
Seeing some graphics on JB Forum and a follow-up to earlier LB at graphics curio I disinterred my Lissajous code and added HSV colouring so you can see a set of 16 being drawn. I played with various versions- some using EOR pixel drawing- but this one I was most pleased with. nomainwin
WindowWidth = 720 WindowHeight = 780
graphicbox #w.g 12, 2, 680, 680
open "Lissajous" for window as #w
#w "trapclose quit"
#w.g "down ; fill darkblue" #w.g "color white ; size 2 ; flush"
global col$ radius =36
dim SI( 3600), CO( 3600)
for t =0 to 359 SI( t) =S( t) ' look-up array for sin ( of t in degrees) CO( t) =C( t) next t
for ny =1 to 8 for nx =1 to 8 for theta =0 to 359 step 0.4 xS =int( nx *80 +radius *SI( ( nx *theta) mod 360) -20) yS =int( ny *80 +radius *CO( ( ny *theta) mod 360) -20) #w.g "set "; xS; " "; yS scan next theta next nx next ny
#w.g "flush" #w.g "size 2" '#w.g "rule "; _R2_XORPEN '#w.g "color white" [here] for theta =0 to 359 step 0.4 for nx =1 to 8 for ny =1 to 8 'xS =int( nx *80 +radius *S( nx *theta) -20) xS =int( nx *80 +radius *SI( ( nx *theta) mod 360) -20) 'yS =int( ny *80 +radius *C( ny *theta) -20) yS =int( ny *80 +radius *CO( ( ny *theta) mod 360) -20) call hsv2rgb theta, 0.99, 0.99 #w.g "color "; col$ #w.g "set "; xS; " "; yS next ny scan next nx next theta
#w.g "getbmp scr 1 1 680 680" #w.g "cls" #w.g "drawbmp scr 1 1" 'bmpsave "scr", "lissajous" +right$( "000" +str$( h), 3) +".bmp" goto [here]
wait ' _________________________________________________________
function S( t) t =( t +360) mod 360 S =sin( t *3.14159265 /180) end function
function C( t) t =( t +360) mod 360 C =cos( t *3.14159265 /180) end function
sub hsv2rgb h, s, v ' hue 0-360, saturation 0-1, value 0-1 if h >=360 or s >1 or v >1 then wait c =v *s ' chroma h =h x =c *( 1 -abs( ( ( h /60) mod 2) -1)) m =v -c ' matching adjustment
select case case h < 60 r = c: g = x: b = 0 case h <120 r = x: g = c: b = 0 case h <180 r = 0: g = c: b = x case h <240 r = 0: g = x: b = c case h <300 r = x: g = 0: b = c case else r = c: g = 0: b = x end select
rd = abs( int( 256 *( r + m))) gn = abs( int( 256 *( g + m))) bu = abs( int( 256 *( b + m))) col$ =right$( " " +str$( rd), 3) +" " +right$( " " +str$( gn), 3) +" " +right$( " " +str$( bu), 3)
end sub
sub quit h$ close #w end end sub
|
|
|
Post by tenochtitlanuk on Jan 26, 2023 4:25:27 GMT -5
Great project- and some well-thought out extensions with the avatars.
Exactly the kind of project I too have found LB excels at- electro-mechanical tinkering, and easy production of graphic output!
|
|
|
Post by tenochtitlanuk on Jan 18, 2023 17:58:46 GMT -5
I think of this one as 'Heat Death of the Universe'- the Big Crunch.
|
|