go to post Robert Cemper · Jun 28, 2018 with large numbers exceeding 64bit integers the logic with integer division \ and modulo #was causing wrong results. So I changed it to pure string interpretation.Recommendation:pass all numbers as strings to escape from numeric normalizationNOT write $$^zahl(102100900002103201200301.6123100)einhundertzwei Trilliarden einhundert Trillionen neunhundert Billiarden zwei Billionen einhundertdrei Milliarden zweihundertein Millionen zweihundert TausendBUT write $$^zahl("102100900002103201200301.6123100")einhundertzwei Trilliarden einhundert Trillionen neunhundert Billiarden zwei Billionen einhundertdrei Milliarden zweihundertein Millionen zweihundert Tausend dreihunderteins Komma sechs eins zwei drei eins null nullIf you feel think this is exaggerated think about banking calculations for countries within low rated currencies.
go to post Robert Cemper · Jun 28, 2018 You are right. Though due to the internal limits, next time I would avoid \ and # operations in favor of $E() for the next versionAs there are some strange effects in handling numerics due to normalizationwrite $$^zahl(1.3400) >>>> eins Komma drei vier write $$^zahl("1.3400") >> eins Komma drei vier null null
go to post Robert Cemper · Jun 28, 2018 Hola Francisco,You motivated me to do something similar for German.It's is straightforward .int routine and you are welcome to add the code to your project.GermanNumberToText I did it up to 10e21, negatives and unlimited decimals. (except what is cut down due to internal limits)I tried to catch all the irregular structures of the language like singular/plural, varying genders, upper/lower caseand tried to keep the output readable: w $$^zahl(-190000103201101.3903)Minus einhundertneunzig Billionen einhundertdrei Millionen zweihundertein Tausend einhunderteins Komma drei neun null drei For quick copy:Updated to avoid failover from integer to floating format for large numbers (2018-06-28 16:34 UTC) zahl(num="",gen="") Public { ;;; convert number as German text ;;; w $$^zahl(-1123.505) >>>> Minus ein Tausend einhundertdreiundzwanzig Komma fünf null fünf set dec=$p(num,".",2),dec=$s(dec?1.N:$$dec(dec),1:"") if num=0 quit "null"_dec set neg=$S(num<0:"Minus ",1:"") if $l(neg) set num=$tr(num,"-") if num=1 set gen=$zcvt(gen,"U") quit neg_"ein"_$case(gen,"W":"e","S":"es","M":"",:"s") if num<10e23 quit neg_$$trd($p(num,"."))_dec quit "*** Zahl zu groß ***"} ;dec(num) { set dec=" Komma" for p=1:1:$l(num) set dec=dec_" "_$$zig($e(num,p)) quit dec}zig(num) { if num<10 quit $li($lb("null","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun"),num+1) if num<20 quit $li($lb("zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"),num-9) set zig=$e(num,*-1),zn=$e(num,*) set res=$s(zig=3:"dreißig" ,1:$li($lb(,"zwan",,"vier","fünf","sech","sieb","acht","neun"),zig)_"zig") if zn set res=$s(zn=1:"ein",1:$$zig(zn))_"und"_res quit res }hun(num) { set hun=$e(num,*-2),zig=$e(num,*-1,*),res="",m="hundert" set res=$s(hun=1:"ein"_m ,hun>1:$$zig(hun)_m ,1:"" ) quit $replace(res_$$zig(zig),"null","")}ein(res) { if $e(res,*-3,*)="eins" set res=$e(res,1,*-1) quit $replace(res,"null","")} tsd(num) { ;1,000 10e3 set tsd=$e(num,*-5,*-3),hun=$e(num,*-2,*),res="" if tsd set res=$$ein($$hun(tsd))_" Tausend " quit res_$$hun(hun)}mio(num) { ;1,000,000 10e6 set mio=$e(num,*-8,*-6),tsd=$e(num,*-5,*),m=" Million" set res=$s(mio=1:"eine"_m_" " ,mio>1:$$ein($$hun(mio))_m_"en " ,1:"") quit res_$$tsd(tsd)}mrd(num) { ;1,000,000,000 10e9 set mrd=$e(num,*-11,*-9),mio=$e(num,*-8,*),m=" Milliarde" set res=$s(mrd=1:"eine"_m_" " ,mrd>1:$$ein($$hun(mrd))_m_"n " ,1:"" ) quit res_$$mio(mio)}bio(num) { ;1,000,000,000,000 10e12 set bio=$e(num,*-14,*-12),mrd=$e(num,*-11,*),m=" Billion" set res=$s(bio=1:"eine"_m_" " ,bio>1:$$ein($$hun(bio))_m_"en " ,1:"" ) quit res_$$mrd(mrd)}brd(num) { ;1,000,000,000,000,000 10e15 set brd=$e(num,*-17,*-15),bio=$e(num,*-14,*),res="",m=" Billiarde" set res=$s(brd=1:"eine"_m_" " ,brd>1:$$ein($$hun(brd))_m_"n"_" " ,1:"" ) quit res_$$bio(bio)}tri(num) {;1,000,000,000,000,000,000 10e18 set tri=$e(num,*-20,*-18),brd=$e(num,*-17,*),m=" Trillion" set res=$s(tri=1:"eine"_m_" " ,tri>1:$$ein($$hun(tri))_m_"en"_" " ,1:"" ) quit res_$$brd(brd)} trd(num) { ;1,000,000,000,000,000,000,000 10e21 set trd=$e(num,*-23,*-21),tri=$e(num,*-20,*),m=" Trilliarde" set res=$s(trd=1:"eine"_m_" " ,trd>1:$$ein($$hun(trd))_m_"n"_" " ,1:"" ) quit res_$$tri(tri)}
go to post Robert Cemper · Jun 28, 2018 Before dealing with adapters you should check if your UDP reaches your server at all.You always get it if your server is on the same LAN segment as the sender.But you depend on the setup of the router in the case that it is not in your LAN "neighborhood".2nd your firewall should be willing to let pass this UDP.Then you may check the traffic with some external tool to make it visible.Or you check it directly from terminal following the instructions in IO device guidechapter UDP Client/Server CommunicationUDP is supported through the %Net.UDP class. This class provides methodsto Send() a packet to a specified destination and port,to Recv() a packet from the socket,and to Reply() to the transmitter of the last received packet.
go to post Robert Cemper · Jun 27, 2018 you have the option to read by character usingREAD *varThen you read exactly 1 byte in its decimal representation set file="C:\ZZ\myfile.bin"open file:"RS":0 else write "file not open", ! quitfor use file read *byte use 0 write byte,?5,"x\"_$ZHEX(byte),?12,"char:",$C(byte),!Docs on READYou may also use %File Class and use a Read method with length 1
go to post Robert Cemper · Jun 26, 2018 Use $ZCVT() function for decoding,set y="<html><body><h1>Greater = > lower 0= < Ampersand = & OK</h1></body></html>"write $zcvt(y,"I","HTML")<html><body><h1>greater = > lower 0= < Ampersand = & OK</h1></body></html>Attention all &..; have to be in lower case See doc $ZCONVERT()
go to post Robert Cemper · Jun 25, 2018 2 possible solutions: TEST3(STATUS=1) [STATUS,MSG] PUBLIC { X "S MSG=$S(STATUS:""HELLO"", 1:""GOODBYE"")" W !,MSG}TEST4(%STATUS=1) PUBLIC { X "S %MSG=$S(%STATUS:""HELLO"", 1:""GOODBYE"")" W !,%MSG }see also my article Summary on Local Variable Scoping
go to post Robert Cemper · Jun 23, 2018 Full doc is here :https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?APP=1&LIBRARY=%25SYS&CLASSNAME=%25Library.FileMethod CopyFile:https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25Library.File#METHOD_CopyFile
go to post Robert Cemper · Jun 22, 2018 Vitaliy,That's excellent. I had the vague feeling that it should be somewhere, somehow, ... ass these are all supported collations.Now I have the correct solution!Many thanks !
go to post Robert Cemper · Jun 21, 2018 You can also create your own conversion function like this: Class SQL.ext [ Abstract ]{ClassMethod fromUTC(ts As %TimeStamp) As %TimeStamp [ SqlName = fromUTC, SqlProc ]{ quit $ZDT($ZDTH($ZDTH(ts,3),-3),3,1,2)}}Then you simply use SELECT SQL.fromUTC(CreationTime) FROM Tableto get the conversion
go to post Robert Cemper · Jun 21, 2018 You try to upload a file and JS Code a the same time during your SUBMIT action.so your &js< ...> lands every 32000 characters inside your file.&js<..> is just a hidden WRITE and allows javascript syntax checking inside the <.. >example: &js<alert('Unable to create user.');> is identic to Write "alert('Unable to create user.');",! So your concept doesn't work that wayYou would require a second independent JS routine in a browser to call for progress using CSP hyperevent.
go to post Robert Cemper · Jun 20, 2018 method %ProcessError should output the real error but what you see is the result of ZT "JGTW" Method %ProcessError(fun As %String,msgid As %Integer) [ Final ]{Use ..Gateway.GatewayDevice If fun="Y9" Do ..%ReadObjects(..Gateway) QuitSet error=$zobjexport(12)Set x=$$$ERROR($$$RemoteGatewayError,error) Use ..Gateway.CurrentDeviceZt "JGTW"} Your error lands in the highlighted line. But as the method is FINAL you can't overload it.Your original class System.Object might be a less restricted copy.In addition, I see ZTRAP command this may explain why Try / Catch didn't react as expected.
go to post Robert Cemper · Jun 20, 2018 I was unable to identify the class System.Object you inherit for your proxy object.But the methods you call are all available in %Net.Remote.Proxyso verify the definition of System.Objector change your class toClass writetofile.WriteFile Extends %Net.Remote.Proxy [ ProcedureBlock ]I think you fail in %OnNew() in ..%Constructor(..)I might be worth for testing to replaceQuit ..%Constructor(p0,"writetofile.WriteFile",0)by Try { set obj=..%Constructor(p0,"writetofile.WriteFile",0)}Catch erroor {..... set obj=""}Quit obj
go to post Robert Cemper · Jun 20, 2018 you miss a check in your codeSet conn = ##class(%Net.Remote.Gateway).%New() // No error hereSet tSC = conn.%Connect("127.0.0.1", "55000", "NETTEST") // No error here IF 'tSC ........... // check if connection was succesfulSet api = ##class(writetofile.WriteFile).%New(conn) //Here comes the errorset strFile = "d:\temp\example.txt"set strInput = "Hello world"set ret = api.FilePut(strFile,strInput)Set tSC = conn.%Disconnect()Your connection may have failed, so next call will fail too,
go to post Robert Cemper · Jun 18, 2018 looking into %SYS code for ^ERRORS( was disappointing. WRC might have a better advice.
go to post Robert Cemper · Jun 18, 2018 Yeah, I meant that.You still may try from SMP>Administration>CSP Gateway Mgmt > Event Log to detect something.Warning: I did this recently and found 4 years of log over I don't know how many upgrades.
go to post Robert Cemper · Jun 18, 2018 Was it the same machine?+ a clean shutdown in 2015 ? Mounting your DB from Terminal "%SYS" may give you a better error message.%SYS>d ^DATABASE 1) Create a database 2) Edit a database 3) List databases 4) Delete a database 5) Mount a database 6) Dismount a database 7) Compact globals in a database 8) Show free space for a database 9) Show details for a database10) Recreate a database11) Manage database encryption12) Return unused space for a database13) Compact free space in a database14) Defragment globals in a database
go to post Robert Cemper · Jun 18, 2018 Did you take a look to ALL available namespaces? (I mean really checking the global)there is ^ERRORS in every namespace.Since if your CSP is offroad ^ERRORS can be too.