go to post Julius Kavay · Sep 13, 2022 A small change (two bytes longer) to your solution makes it perfect, I think, for all cases ClassMethod findShort(s) As %Integer { f i=1:1 ret:$locate(" "_s_" "," [^ ]{"_i_"} ") i } BUT, and that's, what I want to say: this function is an awesome demonstration of economic nature of ObjectScript in comparison to Java. Your one-liner vs. a whole page of code... I love ObjectScript! Sorry, that had to be said...
go to post Julius Kavay · Sep 2, 2022 Take a look on the documentation of an (old) Cache instance (download the latest Cache 2018.x from WRC, if neccessary). There is a ZEN tutorial. You can follow the samples on IRIS, the ZEN classes are part of IRIS installation. Do not ask me for details, I have never used ZEN.
go to post Julius Kavay · Aug 17, 2022 I'm sure, someone has a more elegant solution, anyway, I do it the quick-and-dirty way: ClassMethod Lines(nsp = {$namespace}) { s (cls,sum)="" s glo=$na(^|"^"_##class(%SYS.Namespace).GetGlobalDest(nsp,"oddDEF")|oddDEF) f {s cls=$o(@glo@(cls)),mth="" q:cls="" f s mth=$o(@glo@(cls,"m",mth)) q:mth="" s sum=sum+$g(^(mth,30)) } q sum }
go to post Julius Kavay · Aug 15, 2022 The only tricky thing is the (web)management portal. Put the following few lines into a "test.html" file and the open it with your favorite browser. <html> <head></head> <body> A simple text with some spaces<br> <pre>A simple text with some spaces</pre> </body> </html> You see the difference?
go to post Julius Kavay · Aug 15, 2022 Did you check this or are you just saying that? What does this query show? select MyColumn, length(MyColumn) from TableA
go to post Julius Kavay · Jul 27, 2022 You can take the line from your own code, but with a suitable parameter Set BASE64=BASE64_file.Read(someCount) // someCount = aNumber * 3 For example 30000 instead of 32000. By the way, you read (8 bit) bytes, so there is no need to do the output-UTF8 conversion.
go to post Julius Kavay · Jul 27, 2022 First of all, it's meaningless to post several KB of raw data. Either provide it somewhere for download or make an attachment (if possible). Second, Base64 encodings converts 3 (incoming) bytes into 4 (outgoing) bytes, this means you always (except the last one) have to read multiple of 3 bytes at once, convert it, and put into the output stream. Your file.Read() reads 32000 bytes, which is NOT a multiple of 3!
go to post Julius Kavay · Jul 9, 2022 After spending about 30 seconds on Google, I found following links https://www.astm.org/e1394-97.html // ?? https://toolkits.horiba-abx.com/documentation/download.php?id=71068 // downloads a pdf https://meganorms.com/st-astm-e1394-97.html https://www.iso.org/obp/ui/#iso:std:iso:18812:ed-1:v1:en ... and many other links Don't ask me,how accurate they are...
go to post Julius Kavay · Jul 4, 2022 I have an (some ten years old) one which I use in the %ZSTART routine. Sometimes (for maintenance or whatever other reasons) you have to (re)start Cache and nowdays IRIS, but you want to start just some of the automatic processes listed in %ZSTART. If you forgot to disable those other before shutdown a init-file comes handy to disable things before start. A sample section looks like this: [Start] # 0 = do not start # 1 = start LoginServer = 1 UserLogin = 0 SystemTasks = 1 UserTasks = 0 I added some more comments to the class, you can download the InitFile.xml (class export) from my FTP server (which will be open for the next few days). Addr: ftp.kavay.at User: dcmember Pass: member-of-DC
go to post Julius Kavay · Jul 1, 2022 sorry, in front of me is a linux... but what about iris terminal <instanceName> Does this work for you?
go to post Julius Kavay · Jun 28, 2022 The general syntax for calling routines from another namespace is: do label^|namesapce|routine where - you can omit the label and - namespace is either the name of the namespace (like set namesapce="USER") or the path to the database (preceded by two carets), where the routine resides. I see right now, Config.MapGlobals accesses the ^SYS global via the path to the database (take a look at the Storage section) - so in theory, you can call all classmethods from the above class as: do zClassmethodname^|"%SYS"|Config.MapGlobals.1(args...) merely, I do NOT recommend to do this (the cass is in deployed mode, so we do not know, what the code really does and (instance)methods are private, so you can't call them from outside).
go to post Julius Kavay · Jun 28, 2022 First, the correct (or better) way for the above code snipet were: new $NAMESPACE zn "%SYS" do ##class(Config.MapGlobals).Delete(...) quit second, one can call routines (and (class)methodes are compiled to rotines) from another namespace by using extended syntax, but in that case such a routine uses the globals (if the routine does a global access) from the CALLING namespace. In Your case this won't work because the Config.MapGlobals uses globals which resides in %SYS namespace and not in the namesspace you are in.
go to post Julius Kavay · Jun 14, 2022 Sure, you can check some key points:- the size of your PDF-file (in bytes) must be the same as the size of the context.strDocument- the size of the encoded stream must be 1.33 times of the unencoded stream (see below)- the second parameter of the Base64Encode() method must be set to 1, else you get a stream with line breaks! set docSize = context.strDocument.Size set encSize = context.strDocumentEncoded.Size if -docSize#3+docSize*4/3-encSize { write "Base64 stream has wrong size" } Your "old" version sent a string, the new version should send a stream - is there everything OK? Just double check all the recent changes.
go to post Julius Kavay · Jun 13, 2022 If you have a (whatever) class with an property like: Property propName As %Stream.GlobalCharacter; and you have an instance of that object in a variable obj then a command like the below write obj.propName --> nn@%Stream.GlobalCharacter shows you the object reference, which is (formal) an integer number followed by an '@' symbol followed by the name of the class. With other words, what you see is correct.
go to post Julius Kavay · Jun 7, 2022 you miss the object reference! set context.strDocumentEncoded = B64EncodeStream(request.streamPDF) // ---------------------------^^^^^^^ this should be something set context.strDocumentEncoded = ##(your.class).B64EncodeStream(request.streamPDF) but you have another problems too: your context.strDocument and context.strDocumentEncoded are currently STRING properties (according to the operation you try to do), which are limitet to a maxlength of 3.47MB! You have to change both to a STREAM, so you can handle PDFs larger then ca. 2.6MB (because 2.6 * 4 / 3 ==> 3.46MB, the limit for a string variable). After you change context.strDocument and context.strDocumentEncoded to a stream properties, you could use this code: Class DC.Someclass Extends %RegisteredObject { Parameter CHUNKSIZE = 2097144; ClassMethod ToBase64(src As %Stream.Object, dst As %Stream.Object) As %Status { i ..#CHUNKSIZE#3=0, src.Rewind(), dst.Rewind() { set sts=$$$OK while 'src.AtEnd,sts { do dst.Write($system.Encryption.Base64Encode(src.Read(..#CHUNKSIZE,.sts),1)) } } else { set sts=$$Error^%apiOBJ(5001,"Chunksize or src/dst-problem") } quit sts } } if ##class(your.class).ToBase64(context.strDocument,context.strDocumentEncoded) write "OK" It seems, this task will take some time... you have to check, how context.strDocument is populated and how context.strDocumentEncoded is later in code used. Good luck.
go to post Julius Kavay · Jun 6, 2022 it looks like an OREF but it is just a string, try set obj = [1,2] write obj --> NN@%Library.DynamicArray write $isobject(obj) --> 1 set ^myGlobal = obj set obj=^myGlobal write obj --> NN@%Library.DynamicArray write $isobject(obj) --> 0 see also my answer in https://community.intersystems.com/post/handling-globalcharacterstream-production-service?page=1#comment-189746
go to post Julius Kavay · Jun 6, 2022 It seems, you read the whole PDF into one string thenconverting this to Base64... So there are two "chances to get an error": - the PDF is longer then the MAXSTRING value (which is 3641144 chars) and - converting a string to Base64 increases the length of the string by a factor of 1.333 (you get your maxstr here). The solution is: you read your PDF in chunks, convert this chunks into Base64 and output the converted data into a stream. Due to the nature of Base64, the length of the chunks you read in MUST BE a multiple of 3 (3 input bytes will be converted into 4 output bytes).
go to post Julius Kavay · Jun 4, 2022 As an ObjectScript routine, remove the "ClassMethod" keyword (which, as the name indicates, belongs to classes. Then either add a "Public" keyword or you remove the brackets ("{", "}") too, but then all variables will have the same scope: ProcData(file = "c:\temp\zipcitystate.csv") Public { set str=##class(%Stream.FileCharacter).%New() do str.LinkToFile(file) while 'str.AtEnd { set $listbuild(ZIP,CITY,STATE)=$listfromstring(str.ReadLine()) // now you have the individual columns // in ZIP, CITY and STATE variables for further processing write "Zip=",ZIP,?12,"City=",CITY,?40,"State=",STATE,! } // depending on the way of your implementation, a "kill str" // would be needed to free up the file kill str } Oh, and to invoke the above procedure just do a: do ProcData^YourRoutineName() // or do ProcData^YourRoutineName("path-to-file")
go to post Julius Kavay · Jun 2, 2022 A simple method like ClassMethod ProcData(file = "c:\temp\zipcitystate.csv") { set str=##class(%Stream.FileCharacter).%New() do str.LinkToFile(file) while 'str.AtEnd { set $listbuild(ZIP,CITY,STATE)=$listfromstring(str.ReadLine()) // now you have the individual columns // in ZIP, CITY and STATE variables for further processing write "Zip=",ZIP,?12,"City=",CITY,?40,"State=",STATE,! } // depending on the way of your implementation, a "kill str" // would be needed to free up the file kill str } to do the job. Then call the method as do ##class(your.class).ProcData() // or do ##class(your.class).ProcData("path-to-the-file")