Hi everyone!
Is it possible to save loop results to a string?
$sql = "SELECT SUBSTR(a.`title`, 1,1) FROM articles a WHERE a.`tag` = 'human_resources'";
$results = db_query($sql);
while ($fields = db_fetch_array($results)) {
foreach($fields as $key => $value) {
echo $value;
}
}
The code above outputs titles of art...
I have following data:
Dictionary<string,string> dctParameters = new Dictionary(){
{"a",var1},{"b",var2},{"c",var3},....
}
I want to join the "dctParameters" into a querystring.
What's the fastest / best among the following ways? Can you think you of a better way to do this?
1st method:
StringBuilder data = new StringBuilder();
st...
I want to send function names from a weak embedded system to the host computer for debugging purpose. Since the two are connected by RS232, which is short on bandwidth, I don't want to send the function's name literally. There are some 15 chars long function names, and I sometimes want to send those names at a pretty high rate.
The solu...
Hello everyone,
I am using VSTS 2008 + C# + .Net 3.0. I have two input strings, I think they are different. But the following C# code thinks they are the same, and throws System.Data.ConstraintException, says Column Name is contrained to be unique, but value already exists. Any ideas what is wrong?
Here is my code and my input strings,...
Hello all,
This is mainly a performance questions. I have a master list of all users existing in a String array AllUids. I also have a list of all end dated users existing in a String array EndUids.
I am working in Java and my goal is to remove any users that exist in the end dated array from the master list AllUids. I know PHP has a f...
hi there,
this doesn't make any sense to me. must be wrong or painfully obvious.
after slicing and dicing, i got 2 vars with the following values in vb.net:
strTag = "<#<span class=SpellE>vermittler_person_Name</span>>"
tmp = "<#<span class=SpellE>vermittler_person_Name</span>>"
comparing the vars gives a false:
strT...
I want to Convert an int to a specific type and then return a string whose format depends on the type I converted it to.
I have a property that returns a Type object, and another that I want to return a string whose format depends on the Type.
Why doesn't the compiler like the code in HexString below?
Is there another equally brief way...
I'm looking for a simple commons method or operator that allows me to repeat some String n times. I know I could write this using a for loop, but I wish to avoid for loops whenever necessary and a simple direct method should exist somewhere.
String str = "abc";
String repeated = str.repeat(3);
repeated.equals("abcabcabc");
Related to...
I have a function that works great in Actionscript 2, except it can only replace one character. I need it to behave more like str_replace in PHP and replace an array of characters.
Here is the code I have now, it simply replaces a space ( ) with a hyphen (-) in a String.
function str_replace(str){
return str.split(" ").join("-");
}...
I was looking through the /etc/bash_completion script found in some Debian packages. I was interested in using the code that looks through a specific directory (/etc/bash_completion.d/ by default) and sources every file in that directory.
Unfortunately, trying to run the script causes errors under the Mac OS X version of bash. The line...
Hi all,
I would like to strip everything in a string before a - and leave what's after that. For example:
15.11-101
I want to strip 15.11 and leave 101. I've tried a few different things, but can't seem to get it working, if anyone could help me out, that'd be fantastic :)
Cheers
Leanne
...
I read call stack in Magento, but they are unreadable due to string shortage, eg:
include('/var/www/oneste...')
How can I see full string, in this case full path?
...
I'm just getting started with Groovy/Grails
I noticed the error messages you get when you validate a form look like this:
Property [{0}] of class [{1}] cannot be blank
For example this code to dump the errors to the console
s.errors.allErrors.each
{
println it.defaultMessage
}
Now, it.arguments ...
I have failed to find documentation for the operator % as it is used on strings in Python. Does someone know where that documentation is?
...
Hi guys!
Situation: I need a tiny button, with some text on it.
Problem: The button seems to think displaying empty space near its edges is more important than displaying my Text.
I can't for the life of me figure out how to remove that blank stuff at the edges. Any help is greatly appreciated!
Thanks in advance.
-MonsterMaw
...
My JS saves some string data to JSON using "stringify()", but observing the outputted JSON string I see a lot of strange chars (out of keyspace), such as NULLs and other bad chars. Now I don't have a list of these "bad" chars so how can I strip them out of my string data?
...
I need to search all of my codebase for "Url" and replace it with "URL". If I search for Url in Visual Studio I also get all my variables with "Url" in it.
Anyone have a Regex I can use to only find Url within a quoted string e.g. "Use this Url:"?
Edit
I was looking looking for a quick and dirty way to find designer text and hard cod...
Hello everyone.
Rather simple question.
Where should I store error,exception, user messages?
By far, I always declared local strings inside the function where it is going to be invoked and did not bother.
e.g.
SomeClass::function1(...)
{
std::string str1("message1");
std::string str2("message2");
std::string str3("message3");
...
// so...
Any difference between the two, int terms of speed/performance?
$sql = "SELECT * "
. "FROM `myTable` "
. "WHERE `id` = 4";
$sql = "SELECT *
FROM `myTable`
WHERE `id` = 4";
...
Hello,
I've been going through Sun Microsystem's Java Tutorial and got some questions while reading the following:
I/O from the Command Line: The Console Object
"Second, readPassword returns a character array, not a String, so the password can be
overwritten, removing it from memory as soon as it is no longer needed."
My questions ar...