How can I encode strings on UTF-16BE format in PHP? For "Demo Message!!!" the encoded string should be '00440065006D006F0020004D00650073007300610067006'. Also, I need to encode Arabic characters to this format.
I'm wondering if it is possible to create a separate APK file which contains only language specific strings and somehow persuade my program to try to read the string resources first from that package's resource and then from the program's own resources... I would like to have a main program with 2-3 mayor laguages and the rest of the languages would go into a separate language pack. (This is to keep the main program size small as I have already 12 translations)
"([\"'])(?:\\\\?+.)*?\\1"
I came up to this regexp to match all quoted strings..
It seems to work great...
The problem is how to match the text that isnt inside quotes..
The inverse -negative somehow...
I read the documentation and
(?!(([\"'])(?:\\\\?+.)*?\\1))
doesnt work
Given a database table with lots of data in it, what is the best practice to remove noise text? I want to detect and remove strings like:
fghfghfghfg
qsdqsdqsd
rtyrtyrty
I'm using Java.
Hi
I have been trying to localize my iPhone app in two languages - english and german
I have created two folders en.lproj and de.lproj each containing Localizable.strings file for respective language. I have included these files in my resources folder, changed the encoding of these files to UTF-16.
I have tried cleaning the project and building it again, deleting folder at path: Library/Application Support/iPhone Simulator/User
But the problem is still there. Anybody having an idea please help.
This is my app:
If someone enters "C6H12O6+O2=CO2+H2O", then I have already written code to split the equation into terms, so in an ArrayList called rterms I have the strings:
C6H12O6
CO2
and in another ArrayList called pterms, I have:
CO2
H2O
I need to count the number of C's in each term of the reactants, so 6 for term 1, 0 for term 2, and then the H's and then O's. How would I do this? Any help is appreciated.
I have the following method :
public List<string> someMethod()
{
// populate list of strings
// dump them to csv file
//return to output
}
Question is: i dont want the user to wait for csv dump, which might take a while.
If i use a thread for csvdump, will it complete? before or after the return of output?
Writing some ruby code (not rails) and I need to handle something like this:
found 1 match
found 2 matches
I have rails installed so maybe I might be able to add a require clause at the top of the script, but does anyone know of a RUBY method that pluralizes strings? Is there a class I can require that can deal with this if the script isn't rails but I have rails installed?
Thanks in advance!
One of the downsides of web.config/app.config is that it's just Magic Strings everywhere, since it's just an XML file.
Interpreted languages like PHP or Ruby have the advantage that the configuration is just code that is executed. In .net, doing stuff in code requires a redeployment, which defeats the purpose.
Now, before I build my own web.config replacement based on Boo or PowerShell I wanted to know if there is an existing one?
Update
If you were forced to use a single char on a split method, which char would be the most reliable?
Definition of reliable: a split character that is not part of the individual sub strings being split.
Hello,
I'm looking for a special hash-function. Let's say I have a large list of strings, if I order them by their hash-values they should be ordered quasi randomly.
The most important point is: it must be super fast. I've tried md5 and sha1 and they're using to much cpu power.
Clashes are not a problem.
I'm using javascript, so it shouldn't be too complicated to implement.
I subclassed NSObject:
#import <Foundation/Foundation.h>
@interface STObject : NSObject {
NSString *message_type;
NSString *twitter_in_reply_to_screen_name;
}
@property(nonatomic, copy) NSString *message_type;
@property(nonatomic, copy) NSString *twitter_in_reply_to_screen_name;
@end
My implementation looks like:
#import "STObject.h"
@implementation STObject
@synthesize message_type, twitter_in_reply_to_screen_name;
@end
Do I need to create a dealloc method for my two properties where I release the strings?
I'm parsing Xml data which has entries like this:
<item name="UserText" type_name="gh_string" type_code="10"> </item>
I'm supposed to read the 6 spaces as a String, but both the InnerText and InnerXml values of the System.Xml.XmlNode are zero length Strings.
Is there any way I can get at this whitespace data in existing files and what do I need to do in the future to prevent this sort of screw up?
Hi, I have a web application where I would like to pull user settings from a database and store them for Global access. Would it make more sense to store the data in a Singleton, or a Session object? What's the difference between the two?
Is it better to store the data as an object reference or break it up into value type objects (ints and strings)?
Thanks!
DELETE FROM #tItem_ID
WHERE #tItem_ID.Item_ID NOT IN (SELECT DISTINCT Item_ID
FROM Item_Keyword
JOIN Keyword ON Item_Keyword.Keyword_ID = Keyword.Record_ID
WHERE Keyword LIKE @tmpKW)
The Keyword is %macaroni%. Both temp tables are 3300 items long. The inner select executes in under a second. All strings are nvarchar(249). All IDs are int.
Any ideas? I executed it (it's in a stored proc) for over 12 minutes without it finishing.
Hello,
i think the fullcalendar jquery-plugin is a really great solution.
i saw does the string for the title in the fullcalender plugin is escaped (htmlEscape). But i need to format some strings in the title for example bold text or colors, or small images?
the solution with another plugin (for example qTip, like in the examples) will not the right way for me.
is there anyway to format the title text?
Regards
flauschi
I'm writing an open source software that is licensed under the GPL. Now I'm offering that other users can translate the software, starting from an english translation I made by myself. What license or range of license may be best for translation of text strings, dialogs, etc.? As GPL is a software license, I thought about a Creative Commons license. The goal is so that all translations remain free and may be updated by other translators.
w3schools says that exceptions can be strings, integers, booleans, or objects, but the example given doesn't strike me as good practice, since exception type checking is done through string comparison. Is this the preferred method of exception handling in Javascript? Are there built-in exception types (like NullPointerException)? (if so, what are they, what kind of inheritance do they use, and are they preferred over other options?)
I'd like to merge 2 XML streams (strings) in Java, necessarily by XSLT (that I could change the transformation), but the problem is that the XMLs come as a string. There are many examples, but through the files.
Can this be done without saving them in files?
Thanks.
Hi,
I have a set of expressions representing some formula with some parameters inside. Like:
[parameter1] * [parameter2] * [multiplier]
And many others like this.
I want to use a regular expression so that I can get a list of strings (List<string>) which will have the following inside:
[paramter1]
[paramter2]
[multiplier]
I am not using regular expressions so often; if you have already used something like this I would appreciate if you can share.
Thanks!
test code:
void modify_it(char * mystuff)
{
char test[7] = "123456"; //last element is null i presume for c style strings here.
//static char test[] = "123123"; //when i do this i thought i should be able to gain access to this bit of memory when the function is destroyed but that does not seem to be the case.
//char * test = new char[7]; //this is also creating memory on stack and not the heap i reckon and gets destroyed once the function is done with.
strcpy_s(mystuff,7,test); //this does the job as long as memory for mystuff has been allocated outside the function.
mystuff = test; //this does not work. I know with c style strings you can't just do string assignments they have to be actually copied. in this case I was using this in conjunction with static char test thinking by having it as static the memory would not get destroyed and i can then simply point mystuff to test and be done with it. i would later have address the memory cleanup in the main function. but anyway this never worked.
}
int main(void)
{
char * mystuff = new char [7]; //allocate memory on heap where the pointer will point
cool(mystuff);
std::string test_case(mystuff);
std::cout<<test_case.c_str(); //this is the only way i know how to use cout by making it into a string c++ string.
delete [] mystuff;
return 0;
}
in the case, of a static array in the function why would it not work.
in the case, when i allocated memory using new in the function does it get created on the stack or heap?
in the case, i have string which needs to be copied into a char * form. everything i see usually requires const char* instead of just char*.
I know i could use reference to take care of this easy. Or char ** to send in the pointer and do it that way. But i just wanted to know if I could do it with just char *. Anyway your thoughts and comments plus any examples would be very helpful.
Hi
Both do the same thing. What is the most efficient way to compare two strings?
Equals() or Compare()? Are there any differences?
if (String.Equals(StringA, StringB, StringComparison.OrdinalIgnoreCase))
{
// Your code goes here
}
if (String.Compare(StringA, StringB, true) == 0)
{
// Your code goes here
}
I need to get all characters between '(' and ')' chars.
var str = "dfgdgdfg (aaa.bbb) sfd (c) fdsdfg ( ,ddd (eee) )";
In this example, I need to get 3 strings:
(aaa.bbb)
(c)
( ,ddd (eee) )
What pattern I have to write? Please, help.
I've tried fetching MySQL query results using mysql_fetch_row() mysql_result() and numeric values are being returned as strings. Is there any way to fetch the data as its datatype stored in the table?
The application will be querying many different queries so I will be unable to cast the values as the intended datatype on a 1 by 1 basis.