ANID2 returns null - windows-phone-8

I try to get the ANID2 in my Windows Phone 8 app.
But it always returns null.
My code is:
object anid;
DeviceExtendedProperties.TryGetValue("ANID2", out anid);
if I try GetValue instead of TryGetValue("ANID2")
I get the following Exception:
Specified argument was out of the range of valid values.
The Capability "ID_CAP_IDENTITY_USER" is set

My mistake was that I used "DeviceExtendedProperties" for ANID2. But you have to use UserExtendedProperties.GetValue("ANID2")

Related

Query on JSON response returns, Parse exception Unexpected end of input

Good day,
Hope you are well.
I am trying to use the Vincere API, and trying to query the response to only return where private_job:0. I am using Postman to test the API.
When I use the below request, doing my best to follow the instructions on the Documentation:
https://domain.vincere.io/api/v2/job/search/fl=job_title,private_job;sort=published_date asc?q=private_job:0
I get the following response:
"Parse exception Unexpected end of input, expected term_char, ws0, term or term_end (line 1, pos 14):\nprivate_job:0\n ^\n"
If I remove ?q=private_job:0, I get a valid response.
I am clearly doing something wrong. Please assist.
in query parameter the key name is q ,
q=private_job:0
but in documentation it says instead of q it should be fq
https://domain.vincere.io/api/v2/job/search/fl=job_title,private_job;sort=published_date asc?fq=private_job:0
Also if you are using special character q=private_job:0 # , then give the value in the query parameter session of postman it will url encode it automatically for you
This stumped me as well, turns out my issue was twofold.
Firstly, this error refers to their URL parser expecting to see the end character %23, so your query string needs to end with that.
Secondly, I was attempting to query the job_type and using the actual string value ie. job_type:PERMANENT%23. This actually needs to be the enum value (1 in this case).

MySQL: User Defined Function Used in WHERE x IN (...) Not working

I have a stored procedure in MySQL that takes a single parameter that can consist of 1 or more values. I want to be able to filter by these values, so I created a function that can take a string and a delimiter parameter
my_func('val1,val2,val3',',')
and it returns a string
'val1','val2','val3'
. I am then calling this function in the where clause such as
WHERE x IN (my_func('val1,val2,val3',','))
But this is not working. It does not give any error, but it keeps running without ever returning anything. I have tested the function individually and it works fine and returns in less than a second. The query I am trying to run it in is a test query that is very basic. Replacing the function with a regular string such as
WHERE x IN ('val1','val2','val3')
works perfectly fine and returns in just a couple seconds. Is what I am trying to do even possible? Thanks!
IN requires the argument to be a literal list, it doesn't re-parse the string. Use FIND_IN_SET:
WHERE FIND_IN_SET(x, 'val1,val2,val3'))

How to check null or empty JSON data in windows phone 8

How to check null or empty JSON data in windows phone 8.
I got below result by webclient "e.Result"
Example : {"OverTimeResult":[null]}
Example : {"OverTimeResult":[]}
if you want to check e.Result, then use
string.IsNullOrEmpty(e.Result)
if you want to check OverTimeResult, you shoud parse the json first (see this for example: http://james.newtonking.com/json

Getting Error message from linq to entity query.

I keep receiving the error
"LINQ to Entities does not recognize the method 'System.String get_Item(Int32)' method, and this method cannot be translated into a store expression"
on the following line in my code
var Reviewer = repository.reviewers.FirstOrDefault(t => t.ReviewerName == formCollection[3]);
formCollection[3] is a string returned from a drop down I have contained within a form. The query seems to work O.K. until it returns the value from the database. What can I do to fix this?
OK, I was trying to do too much at once, when I finally thought about it and put formCollection[3] into a string variable and then used the string variable in the linq query everything worked out ok.

Error: Sequence contains more than one element

I am getting the following error on production server. It works well on localhost.
Error: Sequence contains more than one element
That is an InvalidOperationException thrown by the Single method.
This method is supposed to return only one element, and your query is returning more than one, you have to check the criteria you use on your query.
It will also throw an exception if it doesn't find an element. You can use SingleOrDefault() method to return null (or default value, i.e. 0 for int) if there are no records.
If you are expecting multiple elements but just one the first one, you can use First instead of Single or FirstOrDefault.