Uri.Parse() is adding random characters inside the uri - flutter

When I try to create a Uri object using Uri.parse, I get %0D%0A added after `_countryCode` value
This is what gets logged
http://api.geonames.org/countryInfo?country=US%0D%0A&username=medcollapp
value of _countryCode is a string like US or IN.
_countryCode is not empty I made sure of it.
I have no idea how to fix this any help would be appreciated.

Related

origOptions error with string containing EXDATE of jakubroztocil/rrule

Currently I am using the library jakubroztocil/rrule
When I convert a string containing EXDATE to rrule the origOptions attribute I get is always an empty object. But if I leave it out, it returns true.
Ex:
DTSTART;TZID=Asia/Saigon:20220808T080000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;UNTIL=20220907T170000Z
With this string I get the correct result
DTSTART;TZID=Asia/Saigon:20220808T080000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO;UNTIL=20220907T170000Z\nEXDATE;TZID=Asia/Saigon:20220808T080000
With this string I get the wrong result
Looks like my problem will be something similar to #333
But I get nothing from it.
Thank u very much

How to correctly add a variable's value to parameters in Postman?

I'm learning Chrome Postman now and my issue now is:
I need to generate a new value of a parameter for each request.
So each request (I make a POST) must have a unique value of this parameter.
So far I thought to manage it with environment variables and I have done it like this:
I add a new environment variable with a unique value
I use this variable in the "value" field on a parameter
And it doesn't work - I get error 401 Authorization Required.
Seems that the error is not connected to the parameter at all but as soon as I change the parameter and manually input a unique data it works well!
So this will work for me:
Please suggest what I'm doing wrong here and advice how to do it right. Thanks!
Spent some more hours investigating I found my problem!
The problem is the value I put into a variable - it included ":" sign and this sign simply changed my URL.

Split location.href for multiple values?

I have a varient that finds the current url and splits it as follows:
var ehref = window.location.href.split('?',1);
This is then used to match the url with a navigation link href and give an ID to the page. My issue is that when our cookie pop up is closed, # is added to the url. Subsequently the page links are passed around between users with the # and the page ids do not work.
What is a simple way of splitting the url at a # as well? I am new to jquery, thus I understand the gist of what I'm 'reading,' but anything I've tried from researching the net has broken the page. I can replace the '?' With '#' but that doesn't really solve the issue.
Thanks!
If you want to get string after '#' you can write like this:
window.location.hash
in javascript ,see here
I have been searching for a way to split up a URL and replace with a new URL. as example, YouTube.com/ "user/video" and change it to YouTube.com/v/"video" so I would not have to sign in to watch a video that got restricted. But then needed to use the same code that would grab whatever string I want between two marks. So here we go!
Our goal: To isolate a part of a URL and use it within another URL!
The line of code will be broken up in sections for easy reading
The line of code will be for a web-link, clicked from the browser’s bookmark
Example URL
https: //duckduckgo.com/?q=School&t=h_&atb=v102-5_f&ia=web
The code:
javascript:var DDG=(window.location.href.split('?q=')[1]);DDG2=DDG.split('&t')[0];DD2G="https://www.google.com/search?q="+DDG2;window.location.assign(DD2G);
Variable name;
DDG = duckduckgo
DDG2 = duckduckgo2
DD2G = duckduckgo 2 google
The code break down:
javascript:var DDG=(window.location.href.split('?q=')[1]);
DDG2 = DDG.split('&t')[0];
DD2G="https://www.google.com/search?q="+DDG2;
window.location.assign(DD2G);
The first part of the code defines it as a JavaScript, we create a variable (var) with the name DDG
Var DDG
The next part we want the value to be what the current URL of the users browser and split that into sections
window.location.href.split
We want to find within the URL this string ‘?p=’ which indicates the search inquiry/s in duckduckgo
But I only want what comes after ‘?p=’ represented by [1], which will give our variable name DDG the value of this: School&t=h_&atb=v102-5_f&ia=web
We now want to split the new value we just gave to our DDG variable, so we do a split on that
DDG.split, and this time we only want everything before the ‘&=’ so we put [0] and assigned that result to a new variable we called DDG2
DDG2 = DDG.split(‘&t’)[0]
We now have a new variable with the value we wanted and we will use DDG2 to replace whatever we want in another URL!
DDG2 = School (this updates every time there is a new search.)
Now we want to replace the URL with our new URL + our variable name.
We make our final variable name DD2G with the value of: https:// www.google .com/search?q= but we want to add our value from DDG2
DD2G="https: //www.google.com/search?q="+DDG2;
Which would look like this (https: //www.google.com/search?q=School).
We now want to assign that to the browser and it will redirect to the new URL with the search term.
window.location.assign(DD2G);
= window.location.assign(“https: //www.google.com/search?q=” + (DDG2))
= window.location.assign(“https: //www.google.com/search?q=School”)
= https: //www.google.com/search?q=School //our new URL with our search term we started with from duckduckgo, without having to retype the inquiry.
So for your question, just replace the string between '' '?q=' with the first string you want the script to look for, then from that result, change the second string between'' '&t' with the second string you want it to look for.
I hope this helps!
if you want to test it out select all of this:
javascript:var DDG=(window.location.href.split('?q=')[1]);DDG2=DDG.split('&t')[0];DD2G="https://www.google.com/search?q="+DDG2;window.location.assign(DD2G);
and drag it to an empty space in your toolbar/bookmarks, in Firefox, I do not know if this works with other browsers, but if they support JavaScripts, it should work. Now navigate to DuckDuckgo.com and search for something, then click on that bookmarked with that code.

Is there a way in the AtTask API to get every project where a custom field is not null?

I want to search for a project where a custom field is not null. Something like this:
GET /attask/api/project/search?status_mod=notnull&&DE:Custom Field_mod=notnull
I see it's working for normal fields, but when I try this for a custom field it's crashing, when I extend the field with _mod.
I'm a bit late on this but have you tried something like this?
GET /attask/api/project/search?status_mod=notnull&DE:Custom Field=0&DE:Custom Field_mod=notnull?
You usually need to give it a value before you try to modify the value from what i understand.
You can use below request url
GET attask/api/project/search?apiKey=xxxxx&status_mod=notnull&categoryID_Mod=notnull
It will return all project which contains custom_fields(part of category)
GET attask/api/project/search?apiKey=xxxxx&status_mod=notnull&DE:Custom Field_Mod=notnull
you need to use "_Mod" (M in caps) with any custom_field which should be present on Workfront.

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.