I think latency is more important than bandwith. Studio works fine on 100kb/s wireless connection, but when ping goes higher than 1s it becomes kind of slow.
- Log in to post comments
I think latency is more important than bandwith. Studio works fine on 100kb/s wireless connection, but when ping goes higher than 1s it becomes kind of slow.
I want to edit this answer.
Thanks. I thought it would be something like this, but hoped there was a system method somewhere.
There is more to URL then just that. For example:
It's for translating response status into Caché status. I have the following code:
ClassMethod GetResponseStatus(Request As %Net.HttpRequest) As %Status
{
Set Status = Request.HttpResponse.StatusCode
Quit:(Status = 200) $$$OK
Set Body = Request.HttpResponse.Data.Read($$$MaxCacheInt)
Quit $$$ERROR($$$GeneralError,"Status code: " _ Status _ " ReasonPhrase: " _ Request.HttpResponse.ReasonPhrase _ " StatusLine: " _ Request.HttpResponse.StatusLine _ " Body: " _ Body)
}And I want to add URL reporting to it.
I meant: write a new class with method generator. And inherit from it.
I assume that's a comment to my answer?
If yes, here's the working code. Maybe I missed some changes in my answer. Because, again, I needed to do too much changes to run the code in the first place.
Thank you.
Also note, that e.Log() calls LOG^%ETN.
You can fill $zerror by passing a name into LOG^%ETN:
Do LOG^%ETN("test")
It would record your current $zerror value, replace it with "test", execute LOG captue, and at the end restore $zerror to what it was before the call.
Formatted your code a little.
getst(getvars, StBeg, temp) ; Save call stack in local or global array; In:; getvars = 1 - save variables defined at the last stack level; getvars = 0 or omitted - don't save; default = 0; StBeg - starting stack level for save; default: 1; temp - where to save ($name).; Out:; temp - number of stack levels saved ; temp(1) - call at StBeg level; temp(2) - call at StBeg+1 level; ...; temp(temp) - call at StBeg+temp-1 level;; Calls are saved in format:; label+offset^rouname +CommandNumberInsideCodeLine~CodeLine w/o leading spaces"; E.g.:; temp(3) = First+2^%ZUtil +3~i x=""1stAarg"" s x=x+1 s c=$$Null(x,y)"; Sample calls:; d getst^%ZUtil(0,1,$name(temp)) ; save calls w/o variables in temp starting from level 1; d getst^%ZUtil(1,4,$name(^zerr($i(^zerr)))) ; save calls with variables in ^zerr starting from level 4new loop,zzz,StEndset getvars = $get(getvars)set StBeg = $get(StBeg, 1) kill @temp set @temp = 0 set StEnd = $STACK(-1)-2for loop = StBeg:1:StEnd {set @temp = @temp+1set @temp@(@temp) = $STACK(loop, "PLACE") _ "~" _ $zstrip($STACK(loop, "MCODE"), "<W") if getvars,(loop=StEnd) {set zzz="" for { set zzz = $order(@zzz)quit:zzz="" set @temp@(@temp,zzz) = $get(@zzz)}if $zerror'="" {set @temp@(@temp,"$ze") = $zerror}}}quit 1Another queue processing sample is now available in this GitHub repository, courtesy of Vladimir Prushkovskiy.
I wondered actually, what for do you prefix all variable names with "zzzz".
Thanks. Removed that as it's useless without zzzz variables.
Thank you.
Consider adding links to cache documentation from the page that describes the issue, we now have version agnostic urls even. For example this issue could use a link to documentation.
Another question is: what's wrong with postconditionals? They exist not only in caché objectscript and in fact very useful as they allow elimination of all 3 lines blocks with one if condition and one action to execute if if is true. Can I disable an issue type for a project?
Could you please tell what do you want to achieve with making 'Open as read-only' setting default?
Hello.
How can I get/set pool size value for a Production item programmatically? I can't find it in a "Settings Defaults" list.
There is rarely a need to modify web application config in production.
How would you have done it? It's 35 lines of code in total, 25 if we remove persistence (because singleton does not actually has persistence, but OP seemed to need it).
> you could not implement singleton which will be working across jobs, only for this same process;
Storing something in %/PPG would not work across jobs too. Singleton is a single-thread anyway.
> to share instance to teh object you could emply %-named variable or process-private global.
Wrote another singleton using % variable. How would I do it with PPG (any global)? When you set global to an OREF it actually sets a string: "int@class". And you could not convert it back to an OREF with $$$objIntToOref at a later date because the object would be already destroyed.
/// Another singleton
Class Utils.Singleton2 Extends %SystemBase
{
Property Content As %String;
/// Set a = ##class(Utils.Singleton2).Get()
ClassMethod Get() As Utils.Singleton2
{
#Define Var %Var
If '$Data($$$Var) || '$IsObject($$$Var) {
Set Obj = ..%New()
Set $$$Var = Obj
} Else {
Set Obj = $$$Var
}
Return Obj
}
/// Do ##class(Utils.Singleton2).Test()
ClassMethod Test()
{
Set a = ##class(Utils.Singleton2).Get()
Set a.Content = $Random(100)
Set b = ##class(Utils.Singleton2).Get()
Write b.Content
}
}>$SYSTEM.Status.GetErrorText(sc)["Something"
Would not always work correctly in applications with users requesting content in several languages (for example web app). Why not use error codes?
If $SYSTEM.Status.GetErrorCodes(sc)[$$$GeneralError $$$ThrowStatus(sc)It would be great to see this new docs UI in action. Any chance of open beta?
I would recommend you forego projects entirely and iterate over classes directly with %Dictionary package.
I usually add my classes and system classes I often reference from my classes into the project, so they can be opened faster (without dialog).
Since project is a collection of classes (and other items, yes, but we're talking about classes here) the flow would be something like that:
I'm just saying that 3rd step can have more callers (alternative routes to 3rd step if you will), for example:
Thanks!
I often need to run queries from a terminal, so I extended Caché ObjectScript with zsql command to run queries and display the results. Here's how it works:
zsql "SELECT TOP 2 Name FROM Sample.Person"Would output:
Name Adams,Chris Z. Adams,Danielle P
To achieve it I created %ZLANGC00 mac routine with the following code:
; %ZLANGC00
; custom commands for ObjectScript
; http://docs.intersystems.com/cache20141/csp/docbook/DocBook.UI.Page.cls?KEY=GSTU_customize
Quit
/// Execute Query and display the results/// Call like this:/// zsql "SELECT TOP 10 Name FROM Sample.Person"
ZSQL(Query)
#Dim ResultSet As%SQL.StatementResultSet ResultSet = ##class(%SQL.Statement).%ExecDirect(, Query)
Do ResultSet.%Display()
QuitSave and compile it and then you can execute sql (class queries too) in a terminal with zsql command:
zsql "SELECT * FROM Sample.SP_Sample_By_Name('Z')"That said I myself prefer executing SQL queries in SMP because you don't need to type them there (drag&drop from the left panel or copy&paste from the code) - it's very convenient.
One approach would be to use %XML.DataSet to convert SQL results into XML:
Set result=##class(%XML.DataSet).%New()
Do result.Prepare("SELECT TOP 3 ID, Name FROM Sample.Person")
Do result.Execute() 1
Do result.WriteXML("root",,,,,1) Outputs:
<root>
<s:schema id="DefaultDataSet" xmlns="" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<s:element name="DefaultDataSet" msdata:IsDataSet="true">
<s:complexType>
<s:choice maxOccurs="unbounded">
<s:element name="SQL">
<s:complexType>
<s:sequence>
<s:element name="ID" type="s:long" minOccurs="0" />
<s:element name="Name" type="s:string" minOccurs="0" />
</s:sequence>
</s:complexType>
</s:element>
</s:choice>
</s:complexType>
<s:unique name="Constraint1" msdata:PrimaryKey="true">
<s:selector xpath=".//SQL" />
<s:field xpath="ID" />
</s:unique>
</s:element>
</s:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<DefaultDataSet xmlns="">
<SQL diffgr:id="SQL1" msdata:rowOrder="0">
<ID>96</ID>
<Name>Adam,Wolfgang F.</Name>
</SQL>
<SQL diffgr:id="SQL2" msdata:rowOrder="1">
<ID>188</ID>
<Name>Adams,Phil H.</Name>
</SQL>
<SQL diffgr:id="SQL3" msdata:rowOrder="2">
<ID>84</ID>
<Name>Ahmed,Edward V.</Name>
</SQL>
</DefaultDataSet>
</diffgr:diffgram>
</root>There is also %SQL.Export.Mgr class, which does SQL export.
%XML.Reader and %SQL.Import.Mgr respectively.
What kind of SQL support are talking about here?