string

Help creating md5 in php

I am trying to create an md5 value in php using the instruction given. I can't seem to get it right and would like you help understanding the instructions and the code. This is what the instructions say: The md5 is constructed by performing an MD5 calculation on a string built up by concatenating these fields. Specifically the MD5 has...

Can't get rid of this warning?

I'm getting this warning "Format not a string literal and no format arguments? Any ideas? -(BOOL)isFirstPointReached{ NSString *firstPoint = [NSString stringWithFormat:[pointsToFillArray objectAtIndex:0]]; NSString *lastPoint = [NSString stringWithFormat:[pointsToFillArray lastObject]]; if([firstPoint isEqualToString:lastP...

How do I sort an ArrayList lexicographically?

I am trying to sort an ArrayList of Strings that represent card values. So, some cards contain letters ("King") and some contain Strings containing only a number ("7"). I know to use Collections.sort, but it only sorts Strings that contain letters. How do I get the ArrayList to be sorted by number as well as alphabetically? Edit: Sorry,...

Ruby on Rails- :symbols, @iVars and "strings" - oh my!

New to Rails and trying to get my head around when/why to use :symbols, @ivars , "strings" within the framework. I think I understand the differences between them conceptually only one :symbol instance per project one @ivar per instance multiple "strings" - as they are created whenever referenced (?) Feel free to correct me! The ma...

Problem initialing a unicode string

Hey All. Atm im working with native API calls and i have to get RtlInitUnicodeString to work. The way i use: const WCHAR wcMutex[] = L"String1"; UNICODE_STRING unicodeMutexBuffer; RtlInitUnicodeString(&unicodeMutexBuffer,wcMutex); now my problem the project doesnt compile , i get this error: Error argument of type "UNICODE_ST...

C++: Best way to copy a section of WCHAR[] into a wstringstream?

I have a WCHAR[], a wstringstream, and an arbitrary section of the WCHAR[] that I want to copy into the wstringstream. What is the best way to do this? It seems that there must be a better way than this: for (int i = start; i < start + length; i++) { wszStringStream << wchr[i]; } ...

Objective-C stringWithFormat misses an argument?

When I run this code: - (NSString *)description{ return [NSString stringWithFormat:@"(FROG idle:%i animating:%i rect:%@ position:%@ tongue:%@)", self.idleTime, self.animating, NSStringFromCGRect(self.rect), ...

What is a good idea for a list of strings?

I simply want to build an RPG and make it as neat as possible, I wish to define a pile of strings which I may want to edit later, so I tried something like this: enum {MSG_INIT = "Welcome to ...", MSG_FOO = "bar"}; But I just get errors, such as that MSG_INIT is not an integer! Why must it not be a string, are that what enums are only...

how to confine to write a string in specific list ,on google-app-engine

class FirstModel(db.Model): p = db.StringProperty({option:['aa','bb','cc']}) the error is : NameError: name 'option' is not defined what should i do ,thanks ...

Reduce text length to fit cell width in a smart manner

Hello, I am in project where we are building a simple web calendar using Java EE technologies. We define a table where every row is an employee, and every column represents an hour interval. The table width and column widths are adjustable. In every cell we have a text retrieved from a database, indicating what the employee is doing ...

How to convert all characters to their html entity equivalent using PHP

I want to convert this [email protected] to &#104;&#101;&#108;&#108;&#111;&#064;&#100;&#111;&#109;&#097;&#105;&#110;&#046;&#099;&#111;&#109; I have tried: url_encode($string) this provides the same string I entered, returned with the @ symbol converted to %40 also tried: htmlentities($string) this provides the same string righ...

Regex to match a Java method signature

I am having this particular requirement where a method has to be identified by different regular expressions for different components. For example, there need to be a regex for return parameter, one for method name, one for argument type and one for argument name. I was able to come up with an expression till this step as follows - ([^,...

Copying a large stream to String - Java

I am writing a StringOutputStream class in Java because I need the pre-Base64-encoded data from an OutputStream to go to a String. I need this as a String because I am going to be putting it into a W3C XML Document. Everything would be fine, but I'm dealing with (relatively) large objects. The resulting object turns out to be about 25 M...

C++: vector to stringstream

I want to know if it is possible to transform a std::vector to a std::stringstream using generic programming and how can one accomplish such a thing? ...

How do I not include part of a regular expression

I'm pretty new to using regexes and I can figure out how I would go about extracted a specific number from a string. Suppose the string was any amount of whitespace or random text and somewhere within it is this, "Value: $1000.00." In order to retrieve that value I am currently using this: string value = Convert.ToString(Regex.Match(B...

case sensitive string replacement in Python

I need to replace a string in case sensitive way. For example abc -> def Abc -> Def aBc -> dEf abC -> deF What can I do this with Python? ...

String help! Process isn't starting, probably because the argument string is kind of messed up.

Hi all. I have the following code: ProcessStartInfo si = new ProcessStartInfo("./Resources/pdftk.exe", executionstring); Process myproc = Process.Start(si); In my watch window, while debugging, I see this: What I would actually type at a command prompt is: pdftk.exe "C:\test.pdf" unpack_files output "C:\TEMP" dont_ask However, ...

Efficient determination of which strings in an array are substrings of the others?

In C#, Say you have an array of strings, which contain only characters '0' and '1': string[] input = { "0101", "101", "11", "010101011" }; And you'd like to build a function: public void IdentifySubstrings(string[] input) { ... } That will produce the following: "0101 is a substring of 010101011" "101 is a substring of 0101" "101 ...

Complex string split in Java

Consider the following String : 5|12345|value1|value2|value3|value4+5|777|value1|value2|value3|value4?5|777|value1|value2|value3|value4+ Here is how I want to split string, split it with + so I get this result : myArray[0] = "5|12345|value1|value2|value3|value4"; myArray[1] = "5|777|value1|value2|value3|value4?5|777|value1|value2|va...

C++: Assign L"" string to WCHAR[]?

I have a WCHAR[]: WCHAR foo[200]; I want to copy values into it: if (condition) { foo = L"bar"; } else { foo = L"odp"; } What is the best way to do this? ...