Post by longtimebasic on Oct 22, 2018 17:30:07 GMT
Good day,
I'm working with ISBN numbers for books, in particular the 978-prefixed series. For example, 9780064431781. A vendor we're using takes a subset of the whole ISBN number and uses it as an identifying string for a given product. Having to only enter 8 digits as opposed to the full set of 13 does speed things up a bit. I'm concerned about possible duplicate numbers. So, I was attempting to calculate all the legal ISBN numbers for the whole series. I'd broken up the program so it would run on my i7 as four separate processes, might as well maximize the efficiencies of having four cores!
So, the program was going along calculating the ISBNS:
series 1: 9780000000000 to 9782499999999
series 2: 9782500000000 to 9784999999999
series 3: 9785000000000 to 9787499999999
series 4: 9787500000000 to 9789999999999
Now, determining if an ISBN is valid or not requires computing a checksum value which is derived from applying a mask against the first 12 digits then deriving the remainder via a modulo 10 division. That result is subtracted from 10 and further given a modulo 10 division. if the now single number matches the 13th digit of the ISBN its calculated the correct checksum. This part of the program was working fine and had no problems.
Finally, once it found a valid ISBN it would write both the vendor subset,full ISBN as a single string to a sequential file (opened for output). A single entry, using the example above would look like: 06443178,9780064431781.
Once the file size got over 4GB, however, Just BASIC wasn't happy anymore and brought them all to a screeching halt! it gave me an error of needing a reference to a #long variable type. My issue and the reason for this post is that whilst I've seen references to Just BASIC integers being "huge," obviously 4 GB isn't huge enough. I can't quite find where I can assign a variable to be designated as "long" so that the process won't stop. 4GB... why am I suddenly thinking this is a problem due to JB being a 32 bit implementation? If this is indeed the case, are there any plans for a 64 bit version to get around this limit anytime in the near future?
Thanks for any assistance, even if it is only to confirm my suspicion of running into the wall.
The error log gives this:
Error log timestamp Monday 10/22/18 09:57:12
Runtime error: Invalid argument #2. Expected #long
Error(Exception)>>defaultAction
Error(Exception)>>activateHandler: <anUndefinedObject>
Error(Exception)>>handle
Error(Exception)>>signal
Error class(Exception class)>>signal: <'Invalid argument #2....'>
BasicRunProgram(Object)>>error: <'Invalid argument #2....'>
BasicRunProgram(BasicProgram)>>terminateRun: <anAPICallInvalidArgumentType>
[] in BasicProgram>>errorHandlerBlock
ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anAPICallInvalidArgumentType>
[] in ExceptionHandler>>handle:
ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
BlockClosure>>invisibleEnsure: <aBlockClosure>
ExceptionHandler>>handle: <anAPICallInvalidArgumentType>
ExceptionHandler>>findHandler: <anAPICallInvalidArgumentType>
APICallInvalidArgumentType(Exception)>>activateHandler: <anExceptionHandler>
APICallInvalidArgumentType(Exception)>>handle
APICallInvalidArgumentType(Exception)>>signal
KernelDLL(DynamicLinkLibrary)>>invalidArgument
KernelDLL>>setFilePointer: <aFileHandle> offset: <4294967296> offsetHigh: <aByteArray> move: <0>
FileHandle>>readInto: <'
96235701,869623570...'> atPage: <1048576> pageSize: <4096>
FileHandle>>readInto: <'
96235701,869623570...'> atPosition: <4294967296>
File>>readBuffer: <'
96235701,869623570...'> atPosition: <4294967297>
FileStream>>position: <4294967296>
FileStream>>putBytesFrom: <'96235887,86962358878'> from: <1> to: <20>
FileStream(WriteStream)>>putBytesFrom: <'96235887,86962358878'>
FileStream>>nextPutAll: <'96235887,86962358878'>
BasicFile>>writeItem: <'96235887,86962358878'>
BasicFile>>writeItemCr: <'96235887,86962358878'>
[] in PrintCommand>>deviceCr:handle:
BlockClosure>>value: <aBasicRunProgram> value: <'#ilist'> value: <aBasicStringContext>
BasicTripleParameterContextHolder>>value
[] in BasicRunProgram>>begin
ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure>
[] in ExceptionHandler>>activateDuring:
ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
BlockClosure>>invisibleEnsure: <aBlockClosure>
ExceptionHandler>>activateDuring: <aBlockClosure>
ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure>
BlockClosure>>on: <anError class> do: <aBlockClosure>
BasicRunProgram>>begin
BasicRunProgram(BasicProgram)>>run
BasicOnDemandCompiler class>>readTknFile: <'C:\BProgs\cfindisbns...'> callingProgram: <anUndefinedObject> commandLine: <''>
Basic class>>start
Message>>perform
NotificationManager>>empty
NotificationManager>>runPendingEvents
NotificationManager>>runEventLoop
Message>>perform
Message>>evaluate
Process>>safelyEvaluate: <aMessage>
I'm working with ISBN numbers for books, in particular the 978-prefixed series. For example, 9780064431781. A vendor we're using takes a subset of the whole ISBN number and uses it as an identifying string for a given product. Having to only enter 8 digits as opposed to the full set of 13 does speed things up a bit. I'm concerned about possible duplicate numbers. So, I was attempting to calculate all the legal ISBN numbers for the whole series. I'd broken up the program so it would run on my i7 as four separate processes, might as well maximize the efficiencies of having four cores!
So, the program was going along calculating the ISBNS:
series 1: 9780000000000 to 9782499999999
series 2: 9782500000000 to 9784999999999
series 3: 9785000000000 to 9787499999999
series 4: 9787500000000 to 9789999999999
Now, determining if an ISBN is valid or not requires computing a checksum value which is derived from applying a mask against the first 12 digits then deriving the remainder via a modulo 10 division. That result is subtracted from 10 and further given a modulo 10 division. if the now single number matches the 13th digit of the ISBN its calculated the correct checksum. This part of the program was working fine and had no problems.
Finally, once it found a valid ISBN it would write both the vendor subset,full ISBN as a single string to a sequential file (opened for output). A single entry, using the example above would look like: 06443178,9780064431781.
Once the file size got over 4GB, however, Just BASIC wasn't happy anymore and brought them all to a screeching halt! it gave me an error of needing a reference to a #long variable type. My issue and the reason for this post is that whilst I've seen references to Just BASIC integers being "huge," obviously 4 GB isn't huge enough. I can't quite find where I can assign a variable to be designated as "long" so that the process won't stop. 4GB... why am I suddenly thinking this is a problem due to JB being a 32 bit implementation? If this is indeed the case, are there any plans for a 64 bit version to get around this limit anytime in the near future?
Thanks for any assistance, even if it is only to confirm my suspicion of running into the wall.
The error log gives this:
Error log timestamp Monday 10/22/18 09:57:12
Runtime error: Invalid argument #2. Expected #long
Error(Exception)>>defaultAction
Error(Exception)>>activateHandler: <anUndefinedObject>
Error(Exception)>>handle
Error(Exception)>>signal
Error class(Exception class)>>signal: <'Invalid argument #2....'>
BasicRunProgram(Object)>>error: <'Invalid argument #2....'>
BasicRunProgram(BasicProgram)>>terminateRun: <anAPICallInvalidArgumentType>
[] in BasicProgram>>errorHandlerBlock
ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anAPICallInvalidArgumentType>
[] in ExceptionHandler>>handle:
ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
BlockClosure>>invisibleEnsure: <aBlockClosure>
ExceptionHandler>>handle: <anAPICallInvalidArgumentType>
ExceptionHandler>>findHandler: <anAPICallInvalidArgumentType>
APICallInvalidArgumentType(Exception)>>activateHandler: <anExceptionHandler>
APICallInvalidArgumentType(Exception)>>handle
APICallInvalidArgumentType(Exception)>>signal
KernelDLL(DynamicLinkLibrary)>>invalidArgument
KernelDLL>>setFilePointer: <aFileHandle> offset: <4294967296> offsetHigh: <aByteArray> move: <0>
FileHandle>>readInto: <'
96235701,869623570...'> atPage: <1048576> pageSize: <4096>
FileHandle>>readInto: <'
96235701,869623570...'> atPosition: <4294967296>
File>>readBuffer: <'
96235701,869623570...'> atPosition: <4294967297>
FileStream>>position: <4294967296>
FileStream>>putBytesFrom: <'96235887,86962358878'> from: <1> to: <20>
FileStream(WriteStream)>>putBytesFrom: <'96235887,86962358878'>
FileStream>>nextPutAll: <'96235887,86962358878'>
BasicFile>>writeItem: <'96235887,86962358878'>
BasicFile>>writeItemCr: <'96235887,86962358878'>
[] in PrintCommand>>deviceCr:handle:
BlockClosure>>value: <aBasicRunProgram> value: <'#ilist'> value: <aBasicStringContext>
BasicTripleParameterContextHolder>>value
[] in BasicRunProgram>>begin
ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure>
[] in ExceptionHandler>>activateDuring:
ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
BlockClosure>>invisibleEnsure: <aBlockClosure>
ExceptionHandler>>activateDuring: <aBlockClosure>
ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure>
BlockClosure>>on: <anError class> do: <aBlockClosure>
BasicRunProgram>>begin
BasicRunProgram(BasicProgram)>>run
BasicOnDemandCompiler class>>readTknFile: <'C:\BProgs\cfindisbns...'> callingProgram: <anUndefinedObject> commandLine: <''>
Basic class>>start
Message>>perform
NotificationManager>>empty
NotificationManager>>runPendingEvents
NotificationManager>>runEventLoop
Message>>perform
Message>>evaluate
Process>>safelyEvaluate: <aMessage>