Fql access error in C# .net? - asp.net

I am trying to access the following info using FQL in c# .However am getting an HTTP bad request error
string Frnds = api.Get("/fql?q=SELECT+uid+name+username+locale+affiliations+timezone+birthday+sex+proxied_email+current_location+FROM+user+WHERE+uid=me()");
Is there some problem with my query , It seems to look fine to me ?

Have you tried separating each field name with a comma (,) then urlencoding it
you can test out your query here - please note in the following link I added in ","
https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20uid%2C%20name%2C%20username%2C%20locale%2C%20affiliations%2C%20timezone%2C%20birthday%2C%20sex%2C%20proxied_email%20%2Ccurrent_location%20FROM%20user%20WHERE%20uid%3Dme%28%29
your query can't parse the fields correctly
https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20uid%20name%20username%20locale%20affiliations%20timezone%20birthday%20sex%20proxied_email%20current_location%20FROM%20user%20WHERE%20uid%3Dme%28%29

Related

Firebase Realtime DB "orderBy must be a valid JSON encoded path"

I'm writing a REST query for an app but I'm suddenly experiencing an error I've never gotten before. When I try to sort responses by their timestamp I get the error:
error: "orderBy must be a valid JSON encoded path"
My URL looks like https://{db url}.firebaseio.com/users/{user id}/surveys.json?auth={auth token}
My rules are set up like this:
And database is structured like this:
If I add ?orderBy="timestamp" the error shows up.
I am using correct quotation marks in query and have data indexed by timestamp in my rules. What could be happening here? Why would this suddenly no longer work after using it for a long time?
If you are using curl then
curl 'https://{db url}.firebaseio.com/users/{user id}/surveys.json?auth={auth token}&orderBy="timestamp"'
for fetch url :
https://{db url}.firebaseio.com/users/{user id}/surveys.json?auth={auth token}&orderBy="timestamp"

How to handle special characters (such as "&") in Convert Query Params to XML of datapower

I am new to datapower, so I am sorry its silly question.
I have create one flow in datapower whose request and response type is Non-XML.
when I try to post an XML to my flow I am getting following error.
Convert HTTP produced invalid XML: mismatched tag, expected employed_by at offset
here is the sample request XML :-
...
<emp_status type="employed" />
<employed_by>abc & company</employed_by>
<work_phone_no>XXXXX</work_phone_no>
<years_employed>10</years_employed>
<months_employed>10</months_employed>
...
but If I remove & from the request XML then my flow works fine.
If it is query string then &-sign is %26 and not &!
If it is non-xml you are going for I'd recommend using GatewayScript instead for all parsing!

Adding IP Address to Email Validation RegEx

I am using the RegEx "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*#[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+[.])*(\.[a-zA-Z]{2,17})$"to validate Email but my lead want to validate as per the Microsoft standard. SO i need to follow
http://msdn.microsoft.com/en-us/library/01escwtf(v=vs.100).aspx
In that everything working fine as per the standard but still i am facing the issues with
Valid: js#internal#proseware.com
Valid: j_9#[129.126.118.1]
the above mentioned mail ID is still returning as invalid. I tried using the regex used in that page
^(?("")(""[^""]+?""#)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])#))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$
but i am getting the error in the server page. Though I pasted the expression inside the validation Expression it can't able to accept the characters.
Note : am using ASP.Net validators for validating the email.
Description
To match both of those email addresses in your sample text, I think I would rewrite your expression like this:
[A-Z0-9._%#+-]+#(?:[A-Z0-9.-]+\.[A-Z]{2,4}|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])
If you're looking to use this to validate a string which may contain only an email then you can add the start/end of string anchors ^ and $.
Example
Live Demo
Sample Text
Valid: js#internal#proseware.com Valid: j_9#[129.126.118.1]
Matches
[0][0] = js#internal#proseware.com
[1][0] = j_9#[129.126.118.1]

Can I use request.querystring as a SQL query's parameter in ASP.NET?

In ASP.NET I want to make a query on request.querystring but it seems not work.
1.var search = Convert.ToString(Request.QueryString["search"]);
2.var query= db.product2s.SqlQuery("select * from product2s where tm ='{0}'",search);
In the webpage I set search="F112130601" ,on the serverside I can see that value request.querystring["search"] is "F112130601",but the server response no record result.
However if I change the code to below line, I can get response when I view the webpage there is some record results from the server.
1.var search="F112130601";
2.var query= db.product2s.SqlQuery("select * from product2s where tm ='{0}'",search);
I'm sory.I make a mistake with my query.
the problem is i should not use "" around product code,
http://test.com/home/product?search="F112130601"
when i use below code to access the server i get record
http://test.com/home/product?search=F112130601
thanks for all of your help.

Sparql Query at endpoint

I want to run the following sparql query at an endpoint:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?name WHERE{?person foaf:name ?name.FILTER regex(str(?name), "+ns+","i")}
I'm coding in C# on Visual Studio, and would send this query to the endpoint. It should check the results without any case-senstivity, but writing the query this way gives an error in visual studio. How do I correct it?
Update (based on author's clarification that "i" is where the problem lies):
You need to properly escape the " symbol so that it gets included in the SPARQL query string. Currently the ["] before [i] signals the end of the text string. No wonder you get an error message.
See MSDN: String literals for escaping rules:
either " escape as \" or make the string a C# verbatim literal and escape as ""
Check DotNetRdf documentation for Querying with SPARQL examples.
It shows both how to run SPARQL queries (using DotNetRdf) and how to inject variable values into queries (what you are trying to do with "+ns+" and "i").
Also:
answers.semanticweb.com is a good place to ask Semantic Web / RDF / SPARQL questions
please describe the error you are getting (what Ren asked in comments above)

Resources