I'm trying to make my program faster, so I'm profiling it. Right now the top reason is:
566 1.780 0.003 1.780 0.003 (built-in method decode)
What is this exactly? I never call 'decode' anywhere in my code. It reads text files, but I don't believe they are unicode-encoded.
...
I am having issues with pspell when searching for numeric values I end up with a blank white page and a segmentation fault in the server logs:
[Fri Aug 21 10:08:43 2009] [notice] child pid 30064 exit signal Segmentation fault (11)
When searching for a string everything works as expected. Below is the code I am using
$pspell_link = ps...
if statement looks too awkward, because i need a possibility to increase the number of constatnts.
Sorry for leading you into delusion by that "constant" instead of what i meant.
...
Hello, I know that using single quotes around a string in PHP is faster than using the double quotes because PHP doesn't need to check for variable presence in the single quoted string. My question is which will perform better:
A) A double quoted string with variables present:
echo "foo bar $baz";
or
B) Single quoted with a concaten...
hi guys,
I have variable named s in javascript.It contains value as '40&lngDesignID=1'.I want to split it with & and want to get 40 and lngDesignID=1.How can i do that in javascript?Can anybody help?
...
Hello all,
I had a question regarding the split function used in Visual Basic. As of now I have written a function that brings in a string value. The string value returned will probably look like this "List1;List2; Field1,Field2". My goal is to use the split function for this string to put all the lists in one array and to put the field...
MSDN provides a digit placeholder example:
1234.5678 ("#####") -> 1235
I found this confusing (I expected 1234 or something), so I wrote this snippet in C# to test it:
Console.WriteLine(String.Format("{0:#}", 1234.5678));
Console.WriteLine(String.Format("{0:#####}", 1234.5678));
Console.WriteLine(String.Format("{0:#}", "1234.5678"));
Co...
Hello everyone.
What is the best literal delimiter in Python adn why? Single ' or double "? And most important, why?
I'm a begginer in Python and i'm trying to stick with just one. I know that in PHP, for example " is preferred, because PHP does not try to search for the 'string' variable. Is the same case in Python?
...
Is there a succinct way (i.e. not a for loop) to create a string of a specified length? Doesn't matter what is in the string.
...
I'm converting the header files of a C library to D modules, and was wondering how I should handle C strings.
Using DMD 1, this works:
void f(char* s); // Definition for C library's function.
But using DMD 2 (which I personally use, but I would like the modules to work for both) strings are const, so to get the same code using the m...
I found this answer about wrapping strings using parens extremely useful, but is there a way in Vim to make this happen automatically? I want to be within a string, typing away, and have Vim just put parens around my string and wrap it as necessary. For me, this would be a gigantic time saver as I spend so much time just wrapping long ...
I'm wondering what's people using to correctly capitalize english strings since ''capitalize'' won't do the job:
(capitalize "can't")
=> "Can'T"
Although writing this function is trivial, I'm wondering if there's a preferred built-in way to do it.
...
How do you compile integer data in Postgres by PHP?
My integers are string as the following show by var_dump ( $_SESSION )
'logged_in' => int 1
'user_id' => string '9' (length=1) // should be int
'a_moderator' => string '0' (length=1) // should be int
I compile the values by the following code which ...
Often when iterating through a string (or any enumerable object), we are not only interested in the current value, but also the position (index). To accomplish this by using string::iterator we have to maintain a separate index:
string str ("Test string");
string::iterator it;
int index = 0;
for ( it = str.begin() ; it < str.end...
Is there any efficient mass string concatenation method in Python (like StringBuilder in C# or StringBuffer in Java)? I found following methods here:
Simple concatenation using '+'
Using UserString from MutableString module
Using character array and the array module
Using string list and join method
Using cStringIO from StringIO module...
I'm wondering if there is a way I can pass in a string (varchar) to a (custom) function in MySQL and then have it output the string ordered alphabetically. I am unsure of how you would actually reorder the string.
IN : dbca
OUT: abcd
...
I've got myself a project where I have to determine if a string contains set string.
Example:
What I'm looking for "website.com"
What is might look like "jsngsowebsite.comadfjubj"
So far my own endevours have yielded this:
titletxt = document.getElementById('title');
titlecheck=titletxt.IndexOf("website.com");
if (titlecheck>=0)...
I need to extract a single variable number from a string. The string always looks like this:
javascript:change(5);
with the variable being 5.
How can I isolate it? Many thanks in advance.
...
Hello, I'm making a program that, for reasons not needed to be explained, requires a float to be converted into a string to be counted with len(). However, str(float(x)) results in x being rounded when converted to a string, which throws the entire thing off. Does anyone know of a fix for it?
Here's the code being used if you want to kno...
I have large text files 140k or larger full of paragraphs of text and need to insert a sentence in to this file at random intervals only if the file contains more then 200 words.
The sentence I need to insert randomly throughout the larger document is 10 words long.
I have full control over the server running my LAMP site so I can use...