convert stringUri to hierarchicalUri Android - android-studio

I converted hierarchicalUri to string using toString() method.
Now when I'm parsing the string back to Uri using Uri.parse() method it's returning me a "stringUri" which is unacceptable for setImageURI() method.
How can I parse string to hierarchicalUri from stringUri
I tried to parsing a string back to Uri using Uri.parse() method it's returning me a "stringUri" I was expecting ImageView setImageURI() method accept stringUri

Related

Converting a string into an array in Typescript?

I'm using Angular 4 and a Spring service that I throws an exception with the message being the toString of a List of messages. The problem is that when I receive the exception response and extract the message, instead of being treated like an Array of strings, it's treated as a single string in the format of: "[message 1, message 2]"
Is there a way in typescript to easily convert this String into an array of strings? I tried instantiating a new Array with the string like: new Array(errorResponse.error.message); but that didn't really work.
It should working for you:
var messages = message.substring(1, message.length-1).split(", ");
Fiddle with a function, which doing this is available here.
It works with JSON.Parse("[message 1, message 2]");

Parsing JSON array in Azure Logic App from base64 encoded string to use in For_each

I am trying to iterate through a JSON array which has been encoded to a string for the purpose of storing on a queue. However, I receive the following error message:
{"code":"ExpressionEvaluationFailed","message":"The execution of
template action 'For_each' failed: The result '[{\"Foo\":\"Bar\"}]' of
the evaluation of 'foreach' action expression
'#{json(decodeBase64(triggerBody()['ContentData']))}' is not a valid
array."}
The following is the string being parsed:
[{"Foo":"Bar"}]
I have no problems parsing a JSON string when it is not in an array, for example:
{"Foo":"Bar"}
This parses just fine when I am not using a For_each.
How do I get the logic app to read this as an array?
The issue here is that you are using string interpolation (where expressions are wrapped in #{ ... }) that evaluates to a string representation of the array. Hence evaluation of the 'foreach' expression fails.
You want the expression to be
#json(decodeBase64(triggerBody()['ContentData']))
json(decodeBase64(body('HTTP')?['$Content']))
enter image description here

Set UserSetting "canLOCKEnvelopes"

I'm trying to update the usersetting for my API user to not be able to lock the envelope. I'm using the Update user settings API but it doesn't like the first line in my request: please look at this request and tell me at least what the first tag should be:
"<UpdateMemberSettings xmlns=\"http://www.docusign.com/restapi\">"
Assuming you are using XML formatted requests bodies, here's what a sample request for this call would look like:
<userSettingsInformation xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<senderEmailNotifications>
<changedSigner>sample string 2</changedSigner>
<deliveryFailed>sample string 6</deliveryFailed>
<envelopeComplete>sample string 1</envelopeComplete>
<offlineSigningFailed>sample string 7</offlineSigningFailed>
<recipientViewed>sample string 5</recipientViewed>
<senderEnvelopeDeclined>sample string 3</senderEnvelopeDeclined>
<withdrawnConsent>sample string 4</withdrawnConsent>
</senderEmailNotifications>
<signerEmailNotifications>
<agentNotification>sample string 12</agentNotification>
<carbonCopyNotification>sample string 3</carbonCopyNotification>
<certifiedDeliveryNotification>sample string 4</certifiedDeliveryNotification>
<documentMarkupActivation>sample string 11</documentMarkupActivation>
<envelopeActivation>sample string 1</envelopeActivation>
<envelopeComplete>sample string 2</envelopeComplete>
<envelopeCorrected>sample string 7</envelopeCorrected>
<envelopeDeclined>sample string 5</envelopeDeclined>
<envelopeVoided>sample string 6</envelopeVoided>
<faxReceived>sample string 10</faxReceived>
<offlineSigningFailed>sample string 13</offlineSigningFailed>
<purgeDocuments>sample string 9</purgeDocuments>
<reassignedSigner>sample string 8</reassignedSigner>
</signerEmailNotifications>
<userSettings>
<nameValue>
<name>sample string 1</name>
<value>sample string 2</value>
</nameValue>
</userSettings>
</userSettingsInformation>
Note, you can use the REST API Operations link to see all potential request bodies for all the calls in the API:
https://www.docusign.net/restapi/help

Get real bool value from YamlStream

I use YamlDotnet to parse a yaml stream to a dictionary of string object via the YamlStream.
The YamlMappingType, YamlSequenceNode and YamlScalarNode are used in order to convert the value to a dictionary, a list or a string.
But I need to get a real boolean value instead of the string equivalent, and for that I use
bool.TryParse(value.ToString(), out valueBool)
value veing a YamlNode.
Is there a better way to do that?
Perhaps another child type of YamlNode?
EDIT:
I don't know the content of the YAML file, I just want to get a dictionary with his values.
Instead of doing the parsing manually, you should use the Deserializer class, which will convert a YAML document into an object graph.
var deserializer = new Deserializer();
var parsed = deserializer.Deserialize<...>(input);
You can see a working example here

convert string to datetime in ado.net

I am trying to save data into my database using a vb form. I am using a datetimepicker to insert the date into my database. Here's an example
saveCommand.Parameters.AddWithValue("A_BOOKDATE", abookdatePicker1.Text).DbType = DbType.DateTime
In my database i set its attribute to time ,now the thing is i used the same line of code on another database and it worked but this one is giving this error
'Failed to convert parameter value from string to datetime'
How do i convert this string to datetime.
Many Thanks
Use DateTimePicker.Value instead of DateTimePicker.Text:
saveCommand.Parameters.AddWithValue("A_BOOKDATE", abookdatePicker1.Value) _
.DbType = DbType.DateTime
(If you ever actually have to convert a string to a DateTime, use DateTime.TryParseExact or DateTime.ParseExact, but in this case it's better not to use the string representation at all.)
You could also try to use
Convert.ToDateTime Method (String) (this one will return a datatime object or throw and exception)
DateTime.TryParse Method (String, DateTime) (this one returns the datetime as an output parameter, returns null on failure)

Resources