Hi,
I was wondering if we have some documentation and sample code how to create APNS and GCM using Caché ObjectScript.
Thanks
Kumar
InterSystems ObjectScript is a scripting language to operate with data using any data model of InterSystems Data Platform (Objects, Relational, Key-Value, Document, Globals) and to develop business logic for serverside applications on InterSystems Data Platform.
Hi,
I was wondering if we have some documentation and sample code how to create APNS and GCM using Caché ObjectScript.
Thanks
Kumar
This was what I first wrote. Here is the test, first putting in an invalid value:
Deployment Type? (G)ateway or (I)HE: F
Invalid Choice
Deployment Type? (G)ateway or (I)HE: G
Hi,
I've organized my repository using TortoiseSVN. I was careful to use only svn commands while creating my file structure. Now all Subversion commands are working at the command line but not from within my IDE (Cache Studio). Basically I'm trying to write a plug-in for my IDE to use Subversion from within the Studio. Trying to integrate Subversion into my IDE, something like Subclipse, but for Cache Studio. The error occurred after reorganizing my code into directories. For example at the command-line, svn info and svn status and all other commands work perfectly. All Subversion commands work at the command prompt!
I am sending an HTTP request to cache class:
s rObj=##class
The request gets to the OnPreHTTP class method
Class xyz Extends %CSP.Page [ ProcedureBlock ]
{
ClassMethod OnPreHTTP() As %Boolean
{
q 1
}
}The question is how to retrieve the request payload in the OnPreHTTP method.
I am trying to write some code that takes in a string and does a serverside transformation of it to find embedded URLs and replace it with clickable links. I found the following regex for Javascript which is rated highly on StackOverflow;
replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');And I tried to do the following in Caché ObjectScript but it's not working:
set matcher=##class(%Regex.Matcher).%New("/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.
Hi!
Consider I have a class Package.Data with Property UniqueStringValue as %String.
I introduced the Index for this property:
Index ValueIndex on UniqueStringValue [Unique];
It works well. But if I try to check if there is an object with the certain value in code like this:
if ##class(Package.Data).ValueIndexExists(value)
this expression fails, if value="value", even if there is an instance with instance.UniqueStingValue="Value"
How can I set the index to prevent saving case sensitive values in this class?
While I can see the benefits that $ZSTORAGE could have if used properly, I have not seen it used in the environments I have worked in. I was wondering if there are any developers that promote its usage.
If used properly, I would imagine it could be highly effective in maximizing free memory since some processes will never go over X amount, while others may very well need much more.
What is the difference between $case and $select?.Where places to use $case and $select?
If I were trying to access an index of a global variable, what time complexity would this operation have? My understanding of languages like Java/C++ is that arrays are stored as blocks of memory so that x[15] would have a lookup time complexity of O(1) because it just goes to (address of the array + 15) and retrieves the value stored there.
How does this work in Cache where the index of a variable isn't necessarily an integer value? If I were to have a variable like the following:
x("Adam") = "Red"
x("George") = "Blue"
x("Bryan") = "Green"
etc.
I am in the planning stages of making things more uniform in our routines and I would like to know what the easiest way would be to include an .inc at the beginning of each .mac routine. Has anyone written something that would open all routines and place something into the first row while leaving the rest of the routine unchanged? Thanks for any guidance you all may provide.
Points to remember before you start:
Hello guys,
I've got this piece of code which runs the method "WebMethod", that belongs to %SOAP.WebBase.cls.
It grabs the outcome from an internal webservice we have and after that, it writes into a file.
The thing is, when I browse the file contents, I realize that in the place where a special character should be, I see a question mark.
By querying the same webservice from a special soap tool called "SoapSonar" (I've been using this for years), the outcome shows up this special character (shows it properly).
So I wonder.
Have you ever thought what could be a reason why some development environment (database, language) would eventually become popular? What part of this popularity could be explain as language quality? What by new and idioms approaches introduced by early language adopters? What is due to healthy ecosystem collaboration? What is due to some marketing genius?
So I know it's been a while, and I hate to let my adoring fans down... just not enough to actually start writing again. But the wait is over and I'm back! Now bask in my beautiful ginger words!
For this series, I am going to look at some common problems we see in the WRC and discuss some common solutions. Of course, even if you find a solution here, you are always welcome to call in and expression you gratitude, or just hear my voice!
This week's common problem: "My query returns no data."
Is there a way to have a Data Lookup table be automatically updated via a script or cache code? We have a file that is being created by our EMR, and we need to import it into Ensemble to update it. Just trying to see if we can automate this process.
Thanks
Scott Roth
Ohio State University Wexner Medical Center
Cache rendering of an old classic:
s enc="dQZ4nK1VzU7DMAy+I/EEveTcCWicpt3UU2VABTRA/AhBeYW+As/U7vE4VNhxypJuoAlhS1vixJ//"_
"06TNsy5p4TppzRKTNqtMXuXQjSSrdEPSEmmtK1uZssp1l0Z3nHJ9fEQroJURlQLHNE35WPYWx7N3"_
"YpJYkeRe4mQzkEKuGDwjkHTBP+9JW4oUsB+Y2CVj2JuttlkFAbhbfdIuRU/jhvZkryejtNok7UpO"_
"Moww3JbdcPifW8APosVi4Q9Otwck5LMojmKOojNnDUIXe0XEvnVrdaEeiF95H8BYgXG38o6i0Vpg"_
"lhSO00TVkN6VelRPaq1q9ehucnizrGopJ5TY+8zHzOBSPih8jjnLQWbyKSYy25Cpe+JXMTdM2dZS"_
"cbAu3YP42EQw4GOq1a16VjfEtWoCGHJdS5dAjkPoYgRTCsw8DG4MaSAw2G++KfA6So0v9xTJVmHD"_
"0UjTAeD4TQ7oRr1EMMbXm2N6IyO1AxtDLS2NCBqHiCIYX+9hLxGGtCxk2Me0D8Q5eknNcafW0j47"_
"SiBNqVcYTSHEM3ASTfwvogDB4qFKc9G+YTzYg4yfqYyfqd2M6O6KqnOh3vgaK1SHIP8403/IitX/"_
"khVb/JYVkBdCh4/53gmCHyZoh3kApk/BrNdcOsBMDzb/hCPEI+zfA/fnvjTWnn8BUo3vtEE="
s enc=$SYSTEM.Util.Decompress($SYSTEM.Encryption.Base64Decode(enc))
w enc
I was benchmarking the populate utils when I noticed something strange. Consider this simple benchmarking method:
ClassMethod runBench(count As %Integer = 300000)
{
s types=["name","ssn","company","title","phone","city","street","zip","mission","state","color","product","string","integer","float"]
//s types=["name","ssn"]
s iter=types.%GetIterator()
while iter.%GetNext(.key,.value){
s start=$P($ZTS,",",2)
s opt={}
s opt.type=value
for i=1:1:count{
s res=##class(DataGen.Generator).genVal(opt) }
s end=$P($ZTS,",",2)
s total=end-start
w value_$C(9)_" total time:"_total_$C(9)_" rate: "_$NORMALIZE(count/total,2)_" per second",!
}
}
Hi, community!
Consider you need to exclude substring(s) from a string.
I did it with the following snippet:
/// excludes all the substrings from the string
ClassMethod ExcludeSubstring(substr,str as %String) As %String
{
while ($L(str,substr)>1) {
set str=$Piece(str,substr)_$Piece(str,substr,2,*)
}
quit str
}So, for example:
USER> set str=”ExcludemeGoodstringExcludemeExcludemeGoodstring” w ##class(User.Utils).ExcludeSubstring(“Excludeme”,str) GoodstringGoodstring
Is this the optimal approach or I reinvented the wheel?
Is there any way that I can check the native type of an object script variable? (similar to the typeof check in javascript)
I see that the DynamicArray class uses the type of the variable for its output, I would like to do something similar when I receive a value as an argument to my method.
USER>s var1 = 123 //No quotes, number type
USER>s var2 = "123" //quotes, string type
//DynamicArray can tell the difference
USER>s arr = []
USER>d arr.%Push(var1)
USER>d arr.%Push(var2)
USER>w arr.%ToJSON()
[123,"123"] //first value is output without quotes, second value is quoted
Does anyone have a good example of using %Net.SSH.Session to do a scp copy of a file from one server to another? I tried calling do $ZF(-1,"scp /ensemble/Scott/sr1.dat egate@inteng3:/home/egate/Scott/") but did not have any success in getting the system to copy the file over to what I am calling inteng3.
Thanks
Scott
How can I prevent large number truncation when using the DynamicObject and DynamicArray classes to create JSON in objectscript and then parsing the result in javascript. Are there any global settings that configure the output when using these classes?
I am looking at converting to the new DynamicObject and DynamicArray classes to build JSON. Our current (homegrown) JSON library forces string representation of numbers too long because of errors we were seeing with long numbers being truncated on the client, I am hoping to accomplish the same with the new classes.
Using the following...
//Get PDF stream object previously saved
Set pdfStreamContainer = ##Class(Ens.StreamContainer).%OpenId(context.StreamContainerID)
Try {
Set pdfStreamObj = pdfStreamContainer.StreamGet()
}
Catch {
$$$TRACE("Error opening stream object ID = "_context.StreamContainerID)
Quit
}Would it be possible to search the pdfStreamObj for certain values like a Medical Record, or Patient Name?
Thanks
Scott
Hi,
Thanks for your time.
Plain $ZF(-1) and $ZF(-2) calls from Cache Studio or Terminal have stopped launching the OS shell from Win10.
cmd (Windows Command Prompt) should be launched.
Configuration:
Windows 10 Anniversary Update, Ensemble 2016.2.0.585.0 Developer Edition x64
Is this common? I have enabled both %Developer role and a Cache CallOut privilege for all users that operate in this scenario.
In Terminal, W $ZF(-1) prints -1, W $ZF(-2) prints -1
In Studio, W $ZF(-1) hangs the IDE, W $ZF(-2) prints 0
In all four cases, cmd (Windows Command Prompt) is not launched!
Any ideas, anybody?
We don't often use SQL within our org, which is mostly due to the performance issue we experience due to the quantity of data we are reviewing.
Aside from the standard performance measures for non-Caché databases, are there any recommended approaches when querying large tables?
The table would have roughly 50M records, but there are not a finite amount of sub-nodes.
I have a standard text file that is coming out of a system new line delimited. Each document will have the same field structure each time.
ID: xxxxxxxxx Name: xxxx,xxxx Age: xx Sex: x OSU Wexner Medical Center Harding Hospital Treatment at 7/14/2016 10:39:34 AM % Energy Set 50 % Charge Delivered 255.4 mC Current 0.91 A Stimulus Duration 7.0 Sec Frequency 40 Hz Pulse Width 0.50 mSec Static Impedance 1170 Ohm Dynamic Impedance 200 Ohm EEG Endpoint is not detected EMG Endpoint 15 Sec Base Heart Rate 78 b/m Peak Heart Rate 91 b/m Average Seizure Energy Index 7471.4 ?V? Postictal Suppression Index N/A Maximum Sustained Power 15787.0 ?V? Time to Peak Power 12 Sec Maximum Sustained Coherence 99.3 % Time to Peak Coherence 17 Sec Early Ictal Amplitude 113.1 ?V Midictal Amplitude 177.7 ?V Post-Ictal Amplitude N/A Program Selected: LOW 0.5 CHARGE RATE
Does anyone have a snippet to create the Namespace and database with defaults in one command?
Something like:
do ##class(Utils.Namespace).Create(Name)Please share?
Thank you in advance!
I am trying to write some code to check to see if a directory exists before creating a new directory.
When I do the following I am not getting a response, but the directory exists..
do ##class(%File).DirectoryExists("/ensemble/")am I missing something?
I would like to integrate SQL into our ObjectScript routines in order to illustrate how SQL can be used to minimize development time. However, there are two questions I have.
A new Health Connect customer has a few experienced Java folks on their interface team. As they get more into Health Connect and learn Caché ObjectScript they thought it would be useful to have a list of common Java statements with an equivalent statement in ObjectScript. They mentioned string manipulation as an example, but would be interested in other areas as well.
This seems like something that is probably already floating around somewhere. Does anyone have something like this or other "COS jumpstart for Java devs" materials?
Thanks,
Marc