string

iPhone MoveMe Example - trouble with DisplayStrings

Hey, I'm starting to play a bit with iPhone applications and I downloaded the MoveMe example from the apple web page. I managed to run the app, however I do not get the strings displayed. I noticed that the DisplayStrings.strings file, although it exists in the app folder, does not appear as one of the resources. I tried adding it as...

What does data="@/some/path" mean in Python?

This is from some code I'm looking at... I think it's some sort of special format string that loads the file at the path into a binary string assigned to data, but I'm not sure as when I try to replicate it all I get is a standard string. Or is it actually a standard string and I'm reading too much into it? ...

C++ valgrind possible leaks on STL string

Hi, I do not see the reason of the leak below. #include <iostream> #include <cstdlib> int fail(const std::string str) { std::cerr<< str << std::endl; exit(1); } const std::string usage() { std::string a = "a"; return a; } int main() { fail(usage()); return 0; } Valgrind says: ==7238== 14 bytes in 1 bloc...

Does string exist check 20k times

I have an ITunes library XML file backup file - about 15 MB. I have 20K music files on my C drive and about 25K files on E drive under exactly similar folder structures. I am traversing the first location and going file by file and checking if the file exiss in the second location. That part works for me. Now, for all such duplicate f...

Where in the ruby doc is string.chars defined?

I've been learning ruby by solving project euler problems and in one solution to a problem I saw you could do something like "12341".chars.inject(1) { |prod, n| prod * n.to_i }. I've looked on the ruby doc but I can't find where String#chars is defined. Can anyone explain how that works? ...

unserialize() function does not work on a variable from the MySQL table on new server

We just switched our website over to a new server. There is a part of my PHP software that pulls out a serialized data value from the MySQL table, and puts it into a variable, and then it's supposed to unserialize(). I never had this issue on any other servers (and this exact code is used on many different servers..), but I'm getting an...

ActiveSupport Inflection library for Past Tense in Ruby?

Is there a past tense library for ruby, to convert words into the past tense? ...

array of C++ string types

These are my variables: const int sizeOfLicToCheckFor = 3; string licNameToCheckFor[ sizeOfLicToCheckFor ] = { "PROF", "PERS", "PREM" }; when I run my program licNameToCheckFor is only initialized with "PROF" and nothing else. What am I doing wrong? ...

Convert querystring to int in PHP

Working on my first PHP site (I'm mainly an ASP programmer), and I need to convert a querystring variable into a number I can then use to query a database. What's the best way to convert to a usable int (I tried intval() already but I keep getting 0 as a result) and also validate it (AKA no single quotes, blah blah) in PHP? Thanks in ad...

Is there any way to improve this function which replaces occurrences of substrings with another string in an malloc allocated string?

Hello. I'm very new to C and I decided to make a function called str_replace which replaces strings inside strings which have been made using malloc. It appears to work but can anyone find any room for improvements. Any advice will be appreciated. I'd like to know if people think finding the number of occurrences to calculate the new s...

Random word selection

Is there a way to get a random word from an online dictionary like dictionary.com, into a string for use in PHP. API's etc... Impossible or not? ...

How to detect where strings begin in Lua Bytecode? (using C#)

How to detect where strings begin in Lua Bytecode using C#? I would like to list all the strings in a Lua Bytecode file. ...

Simple string hashing function

I'm trying to hash a string into an integer for placing it in an array. However I do not know all too much about hashing functions, and that's why my current method is just adding all the ASCII numbers of the characters together and taking it mod the array size. Are there any simple faster/better methods? ...

change String[] into Vector<String>

How can I convert in the quickest way String[] to Vector<String>? ...

Why IndexOf returns always Zero?

Could someone point me why the IndexOf returns always zero in the following text? Dim Str as string = "<p><img class=floatLeft width="330"src="http://www.com"&gt;&lt;/p&gt;&lt;p&gt;" Dim Idx as integer = Str.IndexOf("<p>") Is there any other way, of getting the index? ...

Splitting and assigning a string with whitespace as the delimeter

Hello, I need help splitting this string, but i can't seem to come with the right way of doing it. Suppose I have two numbers on a line 12 101 I would like to take the first and assign it to variable, and then take the second and assign it to a variable, this may sounds easy, but for me i can't come up with the right way to do it? ...

How to detect if a file path is wrapped in " .. " with Python?

I read the ini file to open a file in python. The thing is that the file info is sometimes inside the "..", but sometimes it's not. For example, fileA = "/a/b/c.txt" fileB = /a/b/d.txt Is there easy way to detect if a string is wrapped in "..", and return the string inside the quotation? ...

Splitting strings in VB.Net

Hi all! I have this code: Dim StringParts As New List(Of String)(OriginalString.Split(New Char() {"\"c}, StringSplitOptions.RemoveEmptyEntries)) When run, StringParts always have one element, because StringSplitOptions.RemoveEmptyEntries = 1. How can I tell VB.Net to use the right function, and not understand StringSplitOptions.Remo...

Do we have an autochomp in Perl?

This is what my Perl code looks like for monitoring a Unix folder : #!/usr/bin/perl use strict; use warnings; use File::Spec::Functions; my $date = `date`; chomp $date; my $datef = `date +%Y%m%d%H%M.%S`; chomp $datef; my $pwd = `pwd`; chomp $pwd; my $cache = catfile($pwd, "cache"); my $monitor = catfile($pwd, "monme"); my $...

How to use java.String.format?

I am trying to use a .format method of a string. But if I place %1, %2 etc in the string, java.util.UnknownFormatConversionException is thrown pointing to a confusing Java source code piece: private void checkText(String s) { int idx; // If there are any '%' in the given string, we got a bad format // specifier. if ((idx = s.in...