Railo stored procedure in cfscript - railo

Does Railo have
<cfscript>
svc = new storedProc();
</cfscript>
It looks like there was some discussion about it in Google groups.
Edit:
I'm trying this:
<cfscript>
response = storedproc(procedure="app.GetErrorCodes",result="response",returncode="yes");
</cfscript>
And am getting "No matching function [STOREDPROC] found"
Edit 2:
This works:
<cfstoredproc procedure="app.GetErrorCodes" debug="yes" result="response" returncode="yes" >
</cfstoredproc>
Except I don't see a query in the result.
Edit 3:
This works:
<cfscript>
storedproc procedure="app.GetErrorCodes" result="response" returncode="yes";
</cfscript>
except I don't see a query inside the result.
Oh wait! I think I found it!
https://groups.google.com/forum/#!msg/railo/UUP0WRuLLX4/zpbKkvekDiAJ
At last! Whew! That only took ALL DAY.

The Railo docs site shows this is supported
<cfscript>
storedproc
[blockfactor="number"]
[cachedafter="datetime"]
[cachedwithin="timeSpan"]
[cachename="string"]
[datasource="string"]
[debug="boolean"]
[password="string"]
procedure="string"
[result="string"]
[returncode="boolean"]
[timeout="number"]
[username="string"] {
}
</cfscript>

Related

aws dynamodb query attribute value that contains special character?

attribute itemJson stored as follow
"itemJson": {
"S": "{\"sold\":\"3\",\"listingTime\":\"20210107211621\",\"listCountry\":\"US\",\"sellerCountry\":\"US\",\"currentPrice\":\"44.86\",\"updateTime\":\"20210302092220\",\"itemLocation\":\"Miami,FL,USA\",\"listType\":\"FixedPrice\",\"categoryName\":\"Machines\",\"itemID\":\"293945109477\",\"sellerID\":\"holiday_for_you\",\"s3Key\":\"US/2021/2/FixedPrice/293945109477.json\",\"visitCount\":\"171\",\"createTime\":\"20210201233158\",\"listingStatus\":\"Completed\",\"endTime\":\"2021-02-28T20:22:57\",\"currencyID\":\"USD\"}"
},
i want to query with filter:contains(itemJson, "sold":"0") with java sdk,i tried those syntax,all fail
expressionValues.put(":v2", AttributeValue.builder().s("\\\"sold\\\":\\\"0\\\"").build());
expressionValues.put(":v2", AttributeValue.builder().s("sold:0"").build());
what is the right way to my filter syntax?
I try #Balu Vyamajala's syntax on the dynamodb web console as follow,did not get the solution yet
contains (itemJson, :subValue) with value of "sold\":\"3\"" seems to be working.
Working example on a Query Api and worked as expected:
QuerySpec querySpec = new QuerySpec()
.withKeyConditionExpression("pk = :v_pk")
.withFilterExpression("contains (itemJson, :subValue)")
.withValueMap(new ValueMap().withString(":v_pk", "6").withString(":subValue", "sold\":\"3\""));
and to test from Aws console we just need to enter "sold":"2"

JSON.Net "Could not read query operator" in SelectTokens

I'm trying to get some info from some JSON I got from magicthegathering.io using the SelectTokens method in JSON.Net. However, when I try to do this I get an error "Could not read query operator".
Here's the code I'm using:
JToken jtoken = JToken.Parse(
#"{""cards"":[{""name"":""Krark-Clan Engineers"",""manaCost"":""{3}{R}"",""cmc"":4,""colors"":[""Red""],""type"":""Creature — Goblin Artificer"",""types"":[""Creature""],""subtypes"":[""Goblin"",""Artificer""],""rarity"":""Uncommon"",""set"":""5DN"",""text"":""{R}, Sacrifice two artifacts: Destroy target artifact."",""flavor"":""\""Well, I jammed the whatsit into the whackdoodle, but I think I broke the thingamajigger.\"""",""artist"":""Pete Venters"",""number"":""70"",""power"":""2"",""toughness"":""2"",""layout"":""normal"",""multiverseid"":50201,""imageUrl"":""http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=50201&type=card"",""foreignNames"":[{""name"":""喀勒克族机械工"",""language"":""Chinese Simplified"",""multiverseid"":81620},{""name"":""Ingénieurs du clan Krark"",""language"":""French"",""multiverseid"":80795},{""name"":""Ingenieure des Krark-Clans"",""language"":""German"",""multiverseid"":80960},{""name"":""Ingegneri di Krark-Clan"",""language"":""Italian"",""multiverseid"":81290},{""name"":""クラーク族の技師"",""language"":""Japanese"",""multiverseid"":80630},{""name"":""Engenheiros do Clã-de-Krark"",""language"":""Portuguese (Brazil)"",""multiverseid"":81455},{""name"":""Ingenieros del clan Krark"",""language"":""Spanish"",""multiverseid"":81125}],""printings"":[""5DN""],""originalText"":""{R}, Sacrifice two artifacts: Destroy target artifact."",""originalType"":""Creature — Goblin Artificer"",""legalities"":[{""format"":""Commander"",""legality"":""Legal""},{""format"":""Freeform"",""legality"":""Legal""},{""format"":""Legacy"",""legality"":""Legal""},{""format"":""Mirrodin Block"",""legality"":""Legal""},{""format"":""Modern"",""legality"":""Legal""},{""format"":""Prismatic"",""legality"":""Legal""},{""format"":""Singleton 100"",""legality"":""Legal""},{""format"":""Tribal Wars Legacy"",""legality"":""Legal""},{""format"":""Vintage"",""legality"":""Legal""}],""id"":""a4d05fd27ec5d7df470e91218f1ca885eda4f0c6""}]}"
);
var foundTokens = jtoken.SelectTokens(#"$..cards[?(#.name=""Krark - Clan Engineers"")].imageUrl", true);
if (foundTokens.Any())
{
string selected = foundTokens.Last().ToString();
Console.WriteLine("Found: " + selected);
}
else
{
Console.WriteLine("Found nothing!");
}
(Here is a fiddle with the same code as shown above.)
When I try to get the same path using online JSONPath testing tools (here or here for example) it works as expected.
Why doesn't this work in JSON.Net? And how can I fix it?
Thanks!
You have to use == for string comparison; = is only for numerical values.
You have to enclose your string in single quotes.
e.g. #.name=='Krark - Clan Engineers')
forked fiddle

Unable to read AT Command Response

I test some basic AT Command in Hyperterminal. The GSM modem response as per my command too. But problem is that it shows me the unreadable text. I use the following code :
AT
OK
AT+CUSD=1,"*247#",15
OK
+CUSD: 1,"0062004B006100730068000A00310020004D0032004D0020005400720061006E007300
6600650072000A0032002000440069007300620075007200730065000A00330020004D0079002000
62004B006100730068000A0034002000480065006C0070006C0069006E0065000A",72
AT+CUSD=1,"1",15
OK
AT+CUSD=1,"*247#",15 command should display
Menu 1
Menu 2
Menu 3
Something like that. But it displayed the hexadecimal code which it unreadable. How can I get plain text ? Can anyone help Me ?
Judging by information provided. Where when you send the +CUSD request with DCS (Data Coding Scheme) of 15. And the response from the Bkash service with DCS of 72. It looks like your modem does not support the encoding specified in the DCS from Bkash.
I found is fairly similar question and solution to this question. Try and ensure that +CSCS is set to something like IRA or GSM and see what happens then with your +CUSD responses.
Use the following functions to decode "UCS2" response data:
public static String HexStr2UnicodeStr(String strHex)
{
byte[] ba = Hex2ByteArray(strHex);
return HexBytes2UnicodeStr(ba);
}
public static String HexBytes2UnicodeStr(byte[] ba)
{
var strMessage = Encoding.BigEndianUnicode.GetString(ba, 0, ba.Length);
return strMessage;
}
for example:
String str2 = SmsEngine.HexStr2UnicodeStr("0062004B006100730068000A00310020004D0032004D0020005400720061006E0073006600650072000A0032002000440069007300620075007200730065000A00330020004D007900200062004B006100730068000A0034002000480065006C0070006C0069006E0065000A");
// str2 = "bKash\n1 M2M Transfer\n2 Disburse\n3 My bKash\n4 Helpline\n"
Please also check UnicodeStr2HexStr()
Hi this code is something called PDU (Protocol Data Unit). To decode it is not straight forward. you need to understand the structure first.

xpath query not working in BizTalk orchestration

I'm trying to rewrite a BizTalk 2010 application and do away with an external assembly, but I seem to be running into xpath problems.
We have a process that stores a healthcare claim (837P) as xml in the database, and we need to extract it later. I have a WCF port calling a stored procedure that returns an xml message that looks something like this:
<ClaimXml_SEL_GetClaimXmlResponse xmlns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo">
<StoredProcedureResultSet0>
<StoredProcedureResultSet0 xmlns="http://schemas.microsoft.com/Sql/2008/05/ProceduresResultSets/dbo/ClaimXml_SEL_GetClaimXml">
<Claim><![CDATA[<ns0:X12_00401_837_P (etc.)
So what I need to do is extract the actual 837P message - the part that starts with ns0:X12_00401_837_P.
The helper class is very simple, just has a method like this:
public XmlDocument ExtractClaimXml(XmlDocument xDoc)
{
XmlDocument xReturn = new XmlDocument();
XmlNode node = xDoc.SelectSingleNode("/*[local-name()='ClaimXml_SEL_GetClaimXmlResponse' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo']/*[local-name()='StoredProcedureResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo']/*[local-name()='StoredProcedureResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/ProceduresResultSets/dbo/ClaimXml_SEL_GetClaimXml']/*[local-name()='Claim' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/ProceduresResultSets/dbo/ClaimXml_SEL_GetClaimXml']");
xReturn.LoadXml(node.InnerText);
return xReturn;
}
and then the Message Assignment shape has this code:
rawClaimXml = ClaimXmlResponse;
strippedClaim = XmlHelperClass.ExtractClaimXml(rawClaimXml);
Claim837P = strippedClaim;
...where ClaimXmlResponse; is the message shown above, Claim837P is an 837P message, and rawClaimXml & strippedClaim are xml variables. This works just fine, but it seems excessive to call an external assembly.
I tried this in the assingment shape:
rawClaimXml = xpath(ClaimXmlResponse, "same xpath as above");
strippedClaim.LoadXml(rawClaimXml.InnerText);
Claim837P = strippedClaim;
...but get the error "'UnderlyingXmlDocument.InnerText': .NET property is write-only because it does not have a get accessor".
So then I tried just getting a string from the xpath query:
rawClaimString = xpath(ClaimXmlResponse, "string(same xpath as above)");
rawClaimString = rawClaimString.Replace("<![CDATA[", "");
rawClaimString = rawClaimString.Replace(">]]>",">");
strippedClaim.LoadXml(rawClaimString);
Claim837P = strippedClaim;
...but that's no good. Also tried a variant:
rawClaimXml = xpath(ClaimXmlResponse, "same xpath as above");
rawClaimString = rawClaimXml.InnerXml.ToString();
rawClaimString = rawClaimString.Replace("<![CDATA[", "");
rawClaimString = rawClaimString.Replace(">]]>",">");
strippedClaim.LoadXml(rawClaimString);
Claim837P = strippedClaim;
...but still no good. Any suggestions?
Thanks!
1-
Here's a couple of things you can try:
Wrap the xpath in the string() function. xpath(ClaimXmlResponse,
"string(same xpath as above)");
Append the /text() node to the xpath. xpath(ClaimXmlResponse, "same
xpath as above/text()");
A combination of the two.
Can you elaborate on the goal here? There's nothing wrong with using the helper class. If it's the extra Assembly that's bothering you, you can always add the .cs to the BizTalk Project.
2-
Coming from a different direction, you can use Path option for the Inbound BizTalk message body on the Messages Tab of the WCF-Custom Adpater configuration.
I was also facing the similar issue but when I gone through your various solution I got the solution for my question.
For me this worked **
rawClaimString = xpath(ClaimXmlResponse, "string(same xpath as
above)");
**
thanks for that phew ;)
Coming to the solution for your problem you can distinguishly promote the node that holding your response and try to access that node using .notation and assign it to the sting this ll return the expected output to you :)

Peculiar error with ColdFusion on BlueDragon.NET

We've got an odd issue occurring with ColdFusion on BlueDragon.NET. Asking here because of the broad experience of StackOverflow users.
Tags inside POSTed content to out BlueDragon.NET server gets removed, and we're not sure where in the stack it's getting removed. So for example if we post this data
[CORE]
Lesson_Status=Incomplete
Lesson_Location=comm_13_a02_bs_enus_t17s06v01
score=
time=00:00:56
[Core_Lesson]
<sd ac="" pc="7.0" at="1289834380459" ct="" ><t id="lo8" sc=";;" st="c" /></sd>
<sd ac='' pc='7.0' at='1289834380459' ct='' ><t id='lo8' sc=';;' st='c' /></sd>
<sd ac="" pc="7.0" at="1289834380459" ct="" ><t id="lo8" sc=";;" st="c" /></sd>
<sd ac="" pc="7.0" at="1289834380459" ct="" ><t id="lo8" sc=";;" st="c" /></sd>
<b>hello1</b>
<i>hello2</i>
<table border><td>hello3</td></table>
<sd>hello4</sd>
<sd ac="1">hello5</sd>
<t>hello6</t>
<t />
<t attr="hello8" />
<strong>hello10</strong>
<img>
><>
What we get back is this:
[CORE]
Lesson_Status=Incomplete
Lesson_Location=comm_13_a02_bs_enus_t17s06v01
score=
time=00:00:56
[Core_Lesson]
hello1
hello2
hello3
hello4
hello5
hello6
hello10
>
That is, anything that starts with < and ends with > is getting stripped or filtered and no longer appears in ColdFusion's FORM scope when it's posted.
Our server with BlueDragon JX does not suffer this problem.
If we bypass using the default FORM scope and use this code, the tag-like content appears:
<cfscript>
// get the content string of the raw HTTP headers, will include all POST content as a long querystring
RAWREQUEST = GetHttpRequestData();
// split the string on "&" character, each variable should now be separate
// note that at this point duplicate variables will get clobbered
RAWFORMFIELDS = ListToArray(RAWREQUEST.content, "&");
// We're creating a structure like "FORM", but better
BetterFORM = StructNew();
// Go over each of the raw form fields, take the key
// and add it as a key, and decode the value into the value field
// and trap the whole thing if for some reason garbage gets in there
for(i=1;i LTE ArrayLen(RAWFORMFIELDS);i = i + 1) {
temp = ListToArray(RAWFORMFIELDS[i], "=");
try {
tempkey = temp[1];
tempval = URLDecode(temp[2]);
StructInsert(BetterFORM, tempkey, tempval);
} catch(Any e) {
tempThisError = "Malformed Data: " & RAWFORMFIELDS[i];
// Log the value of tempThisError here?
// WriteOutput(tempThisError);
}
}
</cfscript>
<cfdump var="#BetterFORM#">
If we do this, and use the created BetterFORM variable, it's there, so it does not seem to be a problem with the requests being filtered at some other point in the stack. I was thinking maybe it was URLScan, but that appears not to be installed. Since BD.NET runs on .NET as the engine, perhaps there's some sanitization setting that is being used on all variables somehow?
Suggestions, ideas, etc are welcome on this issue.
I don't have a BD.NET instance handy to check, but Adobe ColdFusion has a setting in the cf administrator to strip "invalid tags". That's my best guess. Adobe CF replaces them with "invalidTag", my guess is that BD.Net just strips it silently.
It turned out to be very mundane.
We had a custom tag that did customized string replacements. On one server, it was modified to NOT replace all tags. On this server, we were using an older version that did. So the fault was not a difference between BlueDragon JX and BlueDragon.NET -- it was developer team error.

Resources