i have a dictionary when i pass it over simplejson.dumps(dict) the json output has put some sort of encoding on a string url?
"link": "http:\/\/www.mydomain.com"
How can i stop this?
Im using app engine simplejson.
In Python 2.x, using backticks to get decimal string from int object is Horrible?
Because backticks are repr(), not str()? I have noticed that when I answering this question.
In Python source, they have same function in Python source, intobject.c
(reprfunc)int_to_decimal_string, /* tp_repr */
....
(reprfunc)int_to_decimal_string, /* tp_str */
What do you think?
(?P<id>\d*)(/(?P<title>.*))?
Most of the time,we use regex to match something,but how to generate the matching string if we have id and title already?
Example,if id=4 and title='hello world',the result should be:
4/hello world
But if we only have id=4,it should be:
4
Because as the regex indicates,title is optional.
Two answers both misunderstood...
There is no preg_match yet
I cannot use strtolower as it affects all char. Should I use some sort of regular expression ?
I'm getting a string which is a product code, I want to use this product code as a search key in a different palce with the first letter made lowercase.
I've noticed that if you sent a query string routevalue through asp.net mvc you end up with all whitespaces urlencoded into "%20". What is the best way of overriding this formatting as I would like whitespace to be converted into the "+" sign?
I was thinking of perhaps using a custom Route object or a class that derives from IRouteHandler but would appreciate any advice you might have.
Hopefully there's a simple solution to this. I'm setting up a redirect for old search listings, but I don't want any of the query string to carry over.
The current rule is:
redirect 301 /blog http://newdomain.com
But this would redirect the following:
http://www.olddomain.com/blog/2009/11/article-name-etc
To this:
http://newdomain.com/2009/11/article-name-etc
When I just want:
http://newdomain.com
Can this be done in the simple 301 redirect, or will I have to write a mod_rewrite rule?
Hi everyone,
I'm using the new Telerik Rad Control and I would to use the GridView included.
But my problem is I recover with a webservice a List<List<String>> object and I would like to show it into my Datagridview.
I try to make a Grid.ItemSource = e.result but nothing appears ;-(
What's the problem ?
Thanks a lot.
Narglix
Should I create private static final String = "Some exception message" or leave it inside the code? Is there any performance issues? I have a lot of exception cases. Texts are mostly different in any particular case. Wary about performance and memory issues
Specifically, I'm trying to use a string to arbitrairly filter the ORM. I've tried exec and eval solutions, but I'm running into walls. The code below doesn't work, but it's the best way I know how to explain where I'm trying to go
from gblocks.models import Image
f = 'image__endswith="jpg"' # Would be scripted in another area, but passed as text <user input>
d = Image.objects.filter(f)
#for the non-django pythonistas:
d = Image.objects.filter(image__endswith="jpg")
# would be the non-dynamic equivalent.
how to pass string to a url in java. i want to download an image from a web server. before downloading a image i want to pass some values to that image then after that i want to download the image. can someone help me. in Java SE application
Here's a phrase I have to make translateable:
Poll ends in 2 hours 23 minutes
This string must have the main phrase and 'hour' and 'minute' in singular and plural forms.
{% blocktrans %}Poll ends in {{ poll.expire_hours }} ??? {{ poll.expire_minutes }} ???{% endblocktrans %}
What do I put then instead of ??? ?
How can I search a dynamic array of char in Delphi 6 for a sub-string and get back an index to a match, not a pointer? I've seen functions in Delphi 6 that do this for strings but not for dynamic char arrays. There is a function called SearchBuf but that function returns a PChar pointer to the match location when what I need is the array index of the match.
Thanks.
. I get this error: "Cannot convert lambda expression to type 'string' because it is not a delegate type" - keyword select become underlined in blue Can you please advice.
Employee emp = new Employee();
comHandledBySQt.DataSource = from x in emp.GetDataFromTable("1")
select new { x.Id, Name = x.FirstName + " " + x.LastName };
comHandledBySQt.DisplayMember = "Name";
comHandledBySQt.ValueMember = "Id";
Above code should displays drop list of employees first name and last name in a combo box
Is it safe to do connection.createStatement().executeQuery(String query);, or should each java.sql.Statement object be created and closed by "hand" on every use, even if the connection is closed in a finally block?
If multiple queries are executed in one method by one connection it would use much less code if instantiating and closing each statement wasn't strictly necessary.
I have a method that needs to get my Connection String from the connection.connection_string property on hibernate.cfg.xml file.
I've tried use NHibernate.Cfg.Environment.ConnectionString, but it didn't work.
How can I get this?
Thank you.
At the moment I have a regular expression that looks like this:
^(cat|dog|bird){1}(cat|dog|bird)?(cat|dog|bird)?$
It matches at least 1, and at most 3 instances of a long list of words and makes the matching words for each group available via the corresponding variable.
Is there a way to revise this so that I can return the result for each word in the string without specifying the number of groups beforehand?
^(cat|dog|bird)+$
works but only returns the last match separately , because there is only one group.
Example: I want to do this:
METHODNAME(5) {
// do something
}
which results in:
- (void)animationStep5 {
// do something
}
Is there any way to do this? Basically, what I need is a way to generate a real source code string before the program is compiled, so the compiler does see - (void)animationStep5...
Or maybe there's something different than a macro, which can help here to auto-generate method names (not at run-time)?
Hi,
I am trying to develop a PHP class which would enable me to get the query string appended into a url and process it according to the variables passed. How can this be done?
Eg
www.example.com?var1=a&var2=b&var3=c
now I want to get '?var1=a&var2=b&var3=c' section and process it based on the variables.
Thanks
I can use __LINE__ as a method parameter just fine, but I would like an easy way to use it in a function that uses strings.
For instance say I have this:
11 string myTest()
12 {
13 if(!testCondition)
14 return logError("testcondition failed");
15 }
And I want the result of the function to be:
"myTest line 14: testcondition failed"
How can I write logError? Does it have to be some monstrosity of a macro?
I'm attempting to create an NSArray with a grouping of string literals, however I get the compile error "Initializer element is not constant".
NSArray *currencies = [NSArray arrayWithObjects:@"Dollar", @"Euro", @"Pound", nil];
Could someone point out what I'm doing wrong, and possibly explain the error message?
Hello all,
I am not sure if its possible but I would like to create some sort of function where you pass in a string such as "yellow" or "green" and it returns its hex code or the range of hex codes that greens or yellows fit into.
Is this possible in PHP? If not possible, I am willing to try anything else that can do this!
Thanks all