|
Post by tenochtitlanuk on Jan 4, 2019 16:15:31 GMT -5
Done by two sorts, the second would undo the first. You need to do the first sort, using the whole 2D table, then locate the start and end of the required bit and re-sort using the new column but specifying the start and finish.. I reckon.
|
|
|
Post by tenochtitlanuk on Dec 29, 2018 10:36:38 GMT -5
Me neither!!
|
|
|
Post by tenochtitlanuk on Dec 29, 2018 7:51:19 GMT -5
Just change to
inputcsv #m, cowNumber, recogn$, followNum, also, date$, milkingTime, milkAmount, milkmeterNumber ... which forces it to see date as a string. Sorry, didn't notice, since date not used further..
|
|
|
Post by tenochtitlanuk on Dec 28, 2018 15:44:28 GMT -5
I've rewritten your code to get nearer to what I think you intend.. you had discrepancies between number of data items and names.. and it is not obvious wheter you are clear about string versus numeric data in files and their values. I've built in a loop through the data. I strongly recommend the kind of variable names I used- called 'camelCase' because it allows you to name variables in a memorable way, and the capitals show the separate parts of the name. Is the following getting towards what you want?
mainwin 63 30
open "calibratie\calibratie.txt" for input as #c open "melkteller.csv" for input as #m
M =3000 dim meterNumber( M), calibrationDate( M), calibrationValue( M)
i =1 print " meterNumber calibrationDate calibrationValue" while not( eof( #c)) ' file entry # 1 2 3 ' meterNumber calibrationDate calibrationValue input #c, meterNumber( i), calibrationDate( i), calibrationValue( i) print ,meterNumber( i), calibrationDate( i), calibrationValue( i) i = i + 1 wend
close #c
print "" print "cowNumber recogn followNum also date milkingTime milkAmount milkmeterNumber"
open "newFile.csv" for output as #fOut
while not( eof( #m)) ' file entry # 1 2 3 4 5 6 7 8 ' 40, Krokus, 3, 250, 6-12-20018, 17:43, 5.4, 3 inputcsv #m, cowNumber, recogn$, followNum, also, date, milkingTime, milkAmount, milkmeterNumber
print cowNumber, recogn$, followNum, also, date, milkingTime, milkAmount, milkmeterNumber,_ using( "####.#", milkAmount /calibrationValue( milkmeterNumber)) #fOut milkAmount /calibrationValue( milkmeterNumber) wend
close #m close #fOut print: print "Done."
|
|
|
Post by tenochtitlanuk on Dec 15, 2018 18:25:13 GMT -5
I ought to get out my Exagear/LB installation on one of my Pis. Didn't check comparative timings when I installed it a year or so ago. Quote is from a reply of mine on the Pi Forum... [/i]
|
|
|
Post by tenochtitlanuk on Nov 21, 2018 11:47:33 GMT -5
Looks like the Wheeling data is offered only as a pdf file. You can't just find the data as text in such files.
There are good, free online pdf-to-text converters. You can also do it from a pdf editor, like Acrobat. And you can call a command-line utility- I use Ubuntu Linux, and there's a good pdf2txt converter.
My feeling is that rather than try to do it programmatically in LB, it's easiest to save the pdf and then use the online services to get out the text. This can then be 'parsed' in LB to fund the data items you require. I think!!
|
|
|
Post by tenochtitlanuk on Nov 16, 2018 8:39:06 GMT -5
Array ah( ) is declared as 1 dimensional, but later referred to as a 2D array- so I can't test your code.
|
|
|
Post by tenochtitlanuk on Nov 14, 2018 16:46:27 GMT -5
Couple examples for you-
E$ ="07051518" ' this is a string not an array.
print E$ 'To get bits two-at-a-time you could use 'mid$(' eg..... print "As a string "; mid$( E$, 1, 2)' ' will print the first two chars #1 and #2 in the string as a string two characters long print "and as a number "; val( mid$( E$, 1, 2)) ' will print them as a number print "As a string "; mid$( E$, 3, 2) ' will print the chars #3 and #4 in the string as a string two characters long print "and as a number "; val( mid$( E$, 3, 2)) ' will print them as a number print
'Another useful way is to space the pairs with a character- typically a space od a comma ( is csv) E2$ ="07 05 15 18" print E2$ print "As a string, first two chars represent "; word$( E2$, 1, " ") print " and as a number the second pair have value "; val( word$( E2$, 2, " "))
|
|
|
Post by tenochtitlanuk on Nov 14, 2018 7:05:31 GMT -5
I knocked up some that might be closer to what you want ( ?) ( right-click and save from here..) nomainwin
WindowWidth =260 WindowHeight =200
graphicbox #w.gb, 20, 20, 200, 50
bmpbutton #w.L2stop, "L2stop.bmp", L2stopClicked, LR, 150, 10 bmpbutton #w.L2, "L2.bmp", L2Clicked, LR, 120, 10 bmpbutton #w.pause, "pause.bmp", pauseClicked, LR, 90, 10 bmpbutton #w.R2, "R2.bmp", R2Clicked, LR, 60, 10 bmpbutton #w.R2stop, "R2stop.bmp", R2stopClicked, LR, 30, 10
open "Button Example" for window as #w wait
sub L2stopClicked bttnHandle$ #w.gb "fill 255 0 0" end sub
sub L2Clicked bttnHandle$ #w.gb "fill 0 255 0" end sub
sub pauseClicked bttnHandle$ #w.gb "fill 40 40 40" end sub
sub R2Clicked bttnHandle$ #w.gb "fill 0 0 255" end sub
sub R2stopClicked bttnHandle$ #w.gb "fill 220 220 80" end sub
sub quit h$ close #w end end sub
Save the bmp from here to the directory you save the program code...
|
|
|
Post by tenochtitlanuk on Nov 12, 2018 9:48:32 GMT -5
|
|
|
Post by tenochtitlanuk on Nov 12, 2018 4:46:31 GMT -5
No native way. Since the structure of a 24bit bmp file is known, you can 'getbmp' of the chosen pixel and read the three colours. This works and is usable in JB too. In LB we can read by using Windows functions. Example below reads all the pixels of a screen and replaces them with their RGB colours rotated. I've used this a lot ( see my many web examples) but it is NOT fast!
nomainwin
WindowWidth =500 WindowHeight =500
open "getpixel in Liberty BASIC" for graphics_nsb as #wg
#wg "trapclose quit"
handleg =hwnd( #wg) calldll #user32, "GetDC", handleg as ulong, hDC as ulong
#wg "down ; fill 110 110 60 ; color 110 110 60" #wg "backcolor 255 0 0 ; goto 150 150 ; circlefilled 100" #wg "backcolor 0 255 0 ; goto 300 250 ; circlefilled 100" #wg "backcolor 0 0 255 ; goto 150 350 ; circlefilled 100"
for x =1 to 500 for y =1 to 500
calldll #gdi32, "GetPixel", hDC as ulong, x as long, y as long, pixcol as ulong bl = int( pixcol /( 256*256)) gr = int( (pixcol -bl *256*256) / 256) re = int( pixcol -bl *256*256 -gr *256) grey = int( ( bl +gr +re) /3 /32) ' not eye-sensitivity adjusted #wg "color "; gr; " "; bl; " "; re #wg "set "; x; " "; y
scan next y next x
wait
sub quit h$ close #h$ callDll #user32, "ReleaseDC", handleg as ulong, hDC as ulong, result as ushort end end sub
|
|
|
Post by tenochtitlanuk on Nov 11, 2018 3:54:06 GMT -5
I've found the UBW a great resource in the past. Also recommend the Eibotboard from Schmalz ( sold by EvilMadScientists) which has stepper motor drivers built in and interfaces via Inkscape, the vector-drawing package ( available for Windows, and Linux, which I use.... See the following on my LB site... eggbotairwriterbitwhacker
|
|
|
Post by tenochtitlanuk on Nov 1, 2018 17:38:15 GMT -5
On Yahoo Groups there's been a thread in which date$ behaved strangely with 'and' conditional. For me the varied forms of date$( were just right to calculate UNIX dates for my tide-predictor.
I had to use the first version, as the second errors out. The third version works...
'#1 works OK d$ = date$( "mm/dd/yyyy") UnixTimeNowSecs =( date$( d$) -date$( "01/01/1970")) *24 *60 *60 +time$( "seconds") ' -3600 -adjust for British Summer Time print "<"; UnixTimeNowSecs; ">"
#2 FAILS UnixTimeNowSecs =( date$( "mm/dd/yyyy")) -date$( "01/01/1970")) *24 *60 *60 +time$( "seconds") ' -3600 -adjust for British Summer Time 'rint "<"; UnixTimeNowSecs; ">" here
'#3 works OK UnixTimeNowSecs =( date$( chr$( 34) +date$( "mm/dd/yyyy") +chr$( 34)) -date$( "01/01/1970")) *24 *60 *60 +time$( "seconds") ' -3600 -adjust for British Summer Time print "<"; UnixTimeNowSecs; ">"re
|
|
|
Post by tenochtitlanuk on Oct 31, 2018 13:30:29 GMT -5
See the help files-- Reading DATA into Arrays DATA is READ into variables. It cannot be READ directly into arrays. To fill arrays with DATA items, first READ the item into a variable, then use that variable to fill an index of the array. EDIT You say you are using JB, where this reply holds. In LB you CAN read data directly...
dim l$( 3)
for n = 1 to 3 read d$ l$( n) =d$ next n
data "array 1", "array 2", "array 3"
|
|
|
Post by tenochtitlanuk on Oct 29, 2018 4:52:13 GMT -5
Google says... How do you convert decimals to Sexagesimal? Here's How: The whole units of degrees will remain the same (i.e. in 121.135° longitude, start with 121°). Multiply the decimal by 60 (i.e. .135 * 60 = 8.1). The whole number becomes the minutes (8'). Take the remaining decimal and multiply by 60. ... The resulting number becomes the seconds (6").
You'll find int() helpful to code this..
|
|