How to capture the keywords in raw data and change the keywords? - powerbuilder

When I use PostURL function to post the blob data, And I have the variable to get the response text, but I have some pronblem, the raw data has something wrong
For example:
[{"status":"U","a":"","b":"","complete":"0000-00-00 00:00:00","link":"https:\/\/abc.efgh.com\/test?area=100&ref=5ERF2221","count":0}]
You will see link column's value has wrong I want to change it to
https://abc.efgh.com/test?area=100&ref=5ERF2221"
The correct result
[{"status":"U","a":"","b":"","complete":"0000-00-00 00:00:00","link":"https://abc.efgh.com/test?area=100&ref=5ERF2221","count":0}]
how to solve this problem?

You can use the function to replace by searching for "\/" and changing it to "/".
Here is an example of how to use the powerbuilder function:
Replace PowerScript function

Related

How to submit a raw value (no parameter name and value pair) for a request's query string using Retrofit?

I have an API endpoint which expects an authorization code to be sent as the request's query string. The entire query string is the code, there is no parameter name and value pair, as it is usually the case.
How can I describe this using Retrofit?
I wrote this:
#GET("/Accounts/OauthLogin")
fun authenticaten(#Query('param') accessCode: String);
But instead of submitting a request that looks like /Accounts/OauthLogin?param=<code>, I want a request that is just /Accounts/OauthLogin?<code>
How can I accomplish that?
Thanks!
Eduardo
Use #QueryName instead of #Query
https://square.github.io/retrofit/2.x/retrofit/index.html?retrofit2/http/QueryName.html
Try this one
#GET("order/detail.json/{ordercode}")
Call<OrderDetailModel> getOrderDetails(#Path("ordercode") String ordercode);
Ben P's answer is correct. By using #QueryName we can append the query without a key/val pair. This is the working way to achieve #Query and #Path without a replace block.
If you want to have something like exampleapi.com/clients?string
you'll want to use the following format
Correct Way
#GET("clients")
fun getClients(#QueryName()string: String): Call<ClientsModel>
Incorrect Way
#GET("{string}")
fun getClients(#Query("clients")#Path("string")string: String): Call<ClientsNetworkModel>

Append text to part of regex match

I need to make some funky json. Basically the format should be
"userName:string":"teddyblackk"
Notice the string in there. I need to append the data type to the key name, given the normal looking json
"userName":"teddyblack"
Does anyone have any suggestions on how to accomplish this. I was thinking that maybe there was someway to take a macth to the regex:
"\"[a-zA-Z0-9-_]\"[\s]*:[\s]*\"[a-zA-Z0-9-_]\"" ==> a json string key value pair
and take the first half and append a ":string" into it.
Any suggestions?
Thanks
use this pattern
(?="\s*:)
and replace w/ :string
Demo

Could not parse sql timestamp string error message

At the point of posting a record to a database table I get the following error:
Could not parse sql timestamp string.
At the click of a button my code does the following:
qry1.Open;
qry1.Insert;
qry1.FieldByName('files_uploaded').asdatetime := qry2.FieldByName('files_uploaded').asdatetime;
qry1.Post;
qry1.Close;
The datatype for the field in the database table is timestamp.
Example of the data in the field : 2014-04-23T14:48:40.816+01:00.
I'm not entirely sure what I'm doing wrong or unless its something to do with the field data.
Any help would be appreciated.
Try setting ".Value" instead of defining the Data Type. When you use .Value the dataset will convert everything that is necessary.
qry1.Open;
qry1.Insert;
qry1.FieldByName('files_uploaded').Value :=qry2.FieldByName('files_uploaded').Value;
qry1.Post;
qry1.Close;
Please try this code:
qry1.Open;
qry1.Insert;
qry1.FieldByName('files_uploaded').AsSQLTimeStamp :=qry2.FieldByName('files_uploaded').AsSQLTimeStamp;
qry1.Post;
qry1.Close;

Android get data from the parse table (json file) (imported in parse.com-data browser)

I have one json file, that I imported in parse.com->data browser->import partition. I can get the String and image value from the table but I have no idea about how to get following values. First column have name chapters of type array look like one field following,
[{"__type":"Pointer","className":"Chapter","objectId":"BCr3uAnapV"}]
how to get above value and second column have, name user of type object look like following,
{"password":"xxx"}
Please any one help me for above, I have tried Googling but it did not help.
EDIT:
See following screen shot: arrow display column 1) chapter and have another column 2) user I want to fetch (get ) that for e.g. if we want to get data of String type like: String provider = (String) objectList.get(i).get("provider"); this manner this way I want to above data, below my screen shot:
This line is a relation (of type Pointer) to another Class in Parse:
[{"__type":"Pointer","className":"Chapter","objectId":"BCr3uAnapV"}]
The class being Chapter. You can make sure this object is fetched together with the object pointing to it using "include":
query.include("chapter");
When you query for the other object, using query.include on pointer relations will ensure these related objects are fetched as well.

Show a bulleted list from Strings.xml file in android

I have a problem that I want to show a bulleted list contents which is resided in strings.xml file as an array elements. Then the problem is that how to convert the array elements in Html List format? Can any one suggest any solution regarding the same.
Thanks in advance
I just put the symbol directly into the strings.xml without any codes or anything:
<string name="msg_sms_no_note">• Notes and attachments will not be sent.</string>
I think, the most elegant way of doing this is to load a WebView and put your string in it. this way, you use the common ul/li convention and you can style it at your leisure with CSS.
Use the unicode escape sequence "\u2022" in strings.xml
like so:
<string name="menu_new_trip_desc">View them in: \n\u2022 Table
The problem with the approach suggested by some of the answers in this thread of putting the bullet unicode character (i.e. \u2022) in each of the Strings in the String array is that you don't get proper indentation when one or more Strings within the String array span multiple lines. What you get is formatting as follows:
In order to get proper indentation you're better using BulletSpan. By doing so you'll get formatting as follows:
To use BulletSpan what you'll need to do is create a SpannableStringBuilder instance, append each String in your String array to this SpannableStringBuilder instance and as you append each String call the setSpan(...) method on the SpannableStringBuilder instance passing in a BulletSpan instance for the what parameter. You can find an example of this in the appendBulletSpan(...) Kotlin extension function located here.

Resources