There is no limit to perfection.
By the way, your code shows 175 characters, where did the number 174 come from?
- Log in to post comments
There is no limit to perfection.
By the way, your code shows 175 characters, where did the number 174 come from?
Ah, got it.
I improved my score to 179 (see above).
Have you used a test case?
size = 207 195 179
ClassMethod Type(a...) As %String
{
f j=$i(r):1:a{s w=$tr(a(j)," "),p=$f(w,",")-2 f i=2:1:$l(w,",") s c=$l($p(w,",",i)),r=$s(p=c:r,r+p-c<2:2,c<p*2#r:3,1:4),p=c} q $p("Constant7Increasing7Decreasing7Unsorted",7,r)
}Have you used a test case?
Try this:
ClassMethod test2()
{
set tKP = ..%New()
set tIdentifierSerial = ##class(HS.Message.AddUpdateHubRequest).%OpenId(21986071).Identifiers
zw tIdentifierSerial
set tKP.IsSerial = 1
set tKP.IsList = 1
set tSerial = tIdentifierSerial.GetObjectNext(.tKey)
for {
if tKey="" {quit}
do tKP.SerialList.InsertObject(tSerial)
set tSerial = tIdentifierSerial.GetObjectNext(.tKey)
}
w tKP.%Save()
}As far as I understand, the author wants to calculate the value of a field based on some list of fields whose names he takes from some table. Right?
Try inserting an apostrophe through concatenation, something like
INSERT INTO MyText
(text)
VALUES
('I visited O' || CHAR(39) || 'Brien before heading out of town.')I'm getting an error:
ERROR #9406: Unexpected format for value of field, searchCriteria, using class base mapping
After fixing the JSON, the error disappeared:
{"searchCriteria": {..}} ==> {"searchCriteria": [{..}]}Also note the mapping between the fields professionalId/professionalNif and preparation/actPreparation
Your code does not take into account the numbers, so an incorrect result is given for "L33T C0d3r".
SELECT JSON_ARRAYAGG(json_obj) FROM (SELECT TOP 5 JSON_OBJECT( 'Name':name ,'Age':age ,'DOB':to_char(dob,'Day DD Month YYYY') ) json_obj FROM sample.person )
SELECT JSON_ARRAYAGG(json_obj) FROM (SELECT JSON_OBJECT( 'Name':name ,'Age':age ,'DOB':to_char(dob,'Day DD Month YYYY') ) json_obj FROM sample.person ) WHERE %VID BETWEEN 1 AND 5
Reduced your code to 127:
ClassMethod ToKeyPad(p) As %String
{
a s l=$f(" 0 1 ABC2 DEF3 GHI4 JKL5 MNO6 PQRS7TUV8 WXYZ9",$$$UPPER($e(p,$i(i)))) q:l=1 r s:l $p(r,l-2\5,*+l-2#5+1)="" g a
}Reduced your code to 137:
ClassMethod ToKeyPad(p) As %String
{
f i=1:1:$l(p){f j=0:1:9{f l=1:1:$f($p(" 0^1^ABC2^DEF3^GHI4^JKL5^MNO6^PQRS7^TUV8^WXYZ9","^",j+1),$e($$$UPPER(p),i))-1 s r=$g(r)_j}} q r
}Take a look at %SelectMode Property
Yes, most likely this is legacy code. For some reason I thought that since the %JSON package classes appeared only in IRIS, the code would also have to be new.
PS: by the way, can you compile an XData block without a name? Studio doesn't highlight the error?
It is strange that the bug has not been fixed yet, because it is easy to fix it by adding one line to ##class(%JSON.Generator).GenerateMappingFromXdata():
<..>
For i=1:1:count {
Set xdata=compiledclass.XDatas.GetAt(i)
Set configName=xdata.Name
If configName="" Continue ; since the Name field is required, how can it be empty?
If xdata.MimeType'="text/xml" Continue
<..>PS: by the way, I didn't quite understand why need to check "configName", given that "Name" is a required field. Any ideas?
For versions of Caché 5.0.x, try the following code:
#include %systemInclude
n
s list=$lb(
"test",
"for",
"searching unknown strings here is a very long piece with enough characters to get a lowercase alpha as a $list marker",
"items",
"in",
"aaatArGetwaaaa",
"lists",
$lb(
"/subs",
"/values",
"nested list",
"did you see that ""w"" before the third piece?",
"Stuart Strickland",
"Yaron Munz")
)
s str=$$$UPPER($$cccvt^%Wpglo(list,$$$MaxStringLength,.warn))
; or
; s str=$$$UPPER($$listDump^%Wprim(list,9))
i 'warn {
s str=$e(str,3,$l(str)-2) ; remove << & >>
;s @("LIST="_str) zw LIST
w !,$f(str,$$$UPPER("Targetw"))
}Result: 162
If you end up searching for globals that use $lb(), then you might find it useful:
You can convert a list to a string (and vice versa), regardless of the number of nestings. Unfortunately, I can't test this code for Caché 5.x, but I think it should work. Here is a small example of searching for a string in a list:
#include %systemIncludeResult: 162n s list=$lb( "test", "for", "searching unknown strings here is a very long piece with enough characters to get a lowercase alpha as a $list marker", "items", "in", "aaatArGetwaaaa", "lists", $lb( "/subs", "/values", "nested list", "did you see that ""w"" before the third piece?", "Stuart Strickland", "Yaron Munz") ) s str=$$$UPPER(##class(%Utility).FormatString(list,,.overflow)) i 'overflow { ;s @("LIST="_str) zw LIST w !,$f(str,$$$UPPER("Targetw")) }
There are much more interesting examples in the documentation, for example:
w -"2Cats"_"Rats" w "8 apples" - "4 oranges" w "8 apples" - "four oranges"
To your data storage scheme, I would like to clarify one point. Let's say there is the following data:
| ID |
|---|
| 1 |
| 2 |
| 3 |
| ID | Organizations |
|---|---|
| 1 | 2,3 |
| 2 | 1,2 |
| 3 | 1,3 |
If you delete ID=1 (GetOrgUpdatesResponse), then ID=2 and ID=3 (Organization) will be automatically deleted. But in this case, the rows ID=2 and ID=3 (GetOrgUpdatesResponse) will contain incorrect data and the referential integrity will be violated. Or am I wrong?
Alternatively, you can create a custom task that runs every 15 minutes, in which to enable disabled users. Since there are other ways to connect besides CSP, this will be more universal.
PS: why not disable "Disable account if login limit reached" and reduce Invalid login limit?
What about method %SYS.Audit.Erase(Flags As %Integer = 0)?
Erase the audit file. Flags: 0 - Erase all contents 1 - Erase and create new audit file 2 - Erase and create new audit file, treat as encryption state changed Note that bit 1 infers that ALL data in the audit database will be deleted, not just Audit data
Look at the class %SYSTEM.CSP:
CSS>d $system.CSP.DisplayConfig()
...
CSS>w $system.CSP.GetConfig("DefaultPasswordChangePage")
%CSP.PasswordChange.cls
CSS>d $system.CSP.SetConfig("DefaultPasswordChangePage","CSS.CSP.ChangePassword.cls")
CSS>w $system.CSP.GetConfig("DefaultPasswordChangePage")
CSS.CSP.ChangePassword.clsI did a little test: I created ZAUTHENTICATE.mac from scratch only with your code and got an error
5610 Referenced macro not defined: GetCredentialsFailed
After adding the following lines, the compilation was successful:
GetCredentials(ServiceName,Namespace,Username,Password,Credentials) Public {
#include %occErrors
#include %sySecurity
...
}Out of curiosity, how would you override that write statement in %CSP.Lookup? Isn't that generated code which one wouldn't want to touch?The source code of the %CSP.PageLookup class is available in %SYS namespace
I also noticed three things from your screenshots:
Now it's clearer, you're cleaning up own audit records.
As @Yaron Munz pointed out, it's most likely that the Task2 user does not have some rights.
For simplicity, you can login to Caché Terminal under this user in the ACB namespace and call your code:
ACB:Task2>Do ^CleanAuditLogTables(14)
The problem can be solved in two ways:
Write " <a href=""javascript:searchSort("..QuoteJS(value)");"" title=""Sort Results by "alias""">"
|
V
Write " <a href=""javascript:searchSort("i");"" title=""Sort Results by "alias""">"I am confused by the name of your task "Clean Audit Log Tables" and the fact that for some reason it is in the ACB namespace. This is your own task?
By default, Caché already has a system task PurgeAudit in the %SYS namespace, where you can also specify the number of days (Purge Audit Log)
Try calling the method ##сlass(%SYS.Audit).Delete() manually and see what result it will return.