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.
What is meant by String Pool ?
What is difference between the following declarations :
String s="hello";
String s=new String("hello");
Is there any difference between the Storing of this two strings by JVM ?
I have a c++ project being developed in QT. The problem I'm running in to is I am wanting to have a single base class that all my property classes inherit from so that I can store them all together. Right now I have:
class AbstractProperty
{
public:
AbstractProperty(QString propertyName);
virtual QString toString() const = 0;
virtual QString getName() = 0;
virtual void fromString(QString str) = 0;
virtual int toInteger() = 0;
virtual bool operator==(const AbstractProperty &rightHand) = 0;
virtual bool operator!=(const AbstractProperty &rightHand) = 0;
virtual bool operator<(const AbstractProperty &rightHand) = 0;
virtual bool operator>(const AbstractProperty &rightHand) = 0;
virtual bool operator>=(const AbstractProperty &rightHand) = 0;
virtual bool operator<=(const AbstractProperty &rightHand) = 0;
protected:
QString name;
};
then I am implementing classes such as PropertyFloat and PropertyString and providing implementation for the comparator operators based on the assumption that only strings are being compared with strings and so on. However the problem with this is there would be no compiletime error thrown if i did
if(propertyfloat a < propertystring b)
however my implementation of the operators for each derived class relies on them both being the same derived class. So my problem is I cant figure out how to implement a property structure so that I can have them all inherit from some base type but code like what I have above would throw a compile time error.
Any ideas on how this can be done? For those familiar with QT I tried using also a implementation with QVariant however QVariant doesn't have operators < and defined in itself only in some of its derived classes so it didn't work out.
What my end goal is, is to be able to generically refer to properties. I have an element class that holds a hashmap of properties with string 'name' as key and the AbstractProperty as value. I want to be able to generically operate on the properties. i.e. if I want to get the max and min values of a property given its string name I have methods that are completely generic that will pull out the associated AbstactProperty from each element and find the max/min no matter what the type is. so properties although initially declared as PropertyFloat/PropertyString they will be held generically.
Hi, i am seriously struggling to get my head around regex.
I have a sring with "iPhone: 52.973053,-0.021447"
i want to extract the two numbers after the colon into two seperate strings so delimited by the comma.
Can anyone help me? Cheers
I have complex logic which is not possible (too slow) to run through PHP with Doctrine, so I need to create a stored procedure for this. The logic also includes inserting/updating records in a table using the Timestampable behavior. How do I preserve this behavior in the stored procedure?
I have a Flex/Actionscript 3 application that displays RSS feeds in a Text element. It strips out any HTML formatting present, but it's not handling HTML special entity codes properly -- it's rendering &mdash as the literal string instead of replacing it with an em-dash, etc. Is there any systematic way I can make it handle those codes properly, or am I going to need to manually replace those strings regex style?
I want to make my own GTK# Textbox, the textbox should draw the text and it's cursor on a special way.
However keyboard and mouse-handling is quite complex and is also influenced by for instance the operating system (for instance the use of dead keys)
Is there a way to build such a control without having to worry about keyboard input?
I assume I have to make a textbox control that inherits the original textbox control. How can I handle drawing requests and mouse movements?
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?
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.
Given a multimap<A,B> M what's a neat way to create a vector<B> of all values in M with a specific key.
e.g given a multimap how can I get a vector of all strings mapped to the value 123?
An answer is easy, looping from lower-upper bound, but is there a neat loop-free method?
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.
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!
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, im traversing through the registry, taking the values of the keys and storing them as strings. I have discovered there are many different types. Some of these types are causing my filestream writer to fail. Is it possible to convert all of the below into a string form. The actual data value is not important, just the ability to differentiate between different values.
DWORD
ExpandString
Binary (is this just the same as byte[] ?)
MultiString
Say I have http://www.mysite.com/I-Like-Cheeseburgers and I want that to point to Item with id 3. Sometime later, I change the name of the item, and now its http://www.mysite.com/I-Like-Hamburgers (and perhaps many more times). I want all these URLs to remain pointing to Item 3. Is it efficient to simply keep a table of [strings,item_ids] and do a lookup on this? Is there a better way?
If you know that you have to show tens of texts with a border,
would you decide for a
Label (which is much complex and resources consuming)
or a
TextBlock in a Border? .
The performance aspect is the one interesting for me now.
Thank you !
What is the most complex expression you've seen/used ?
and what's the limit on the length of the expression that can be used ? I seem to recall something to that effect a while back but can't locate it now !!
I'm looking to develop a CMS project based on UMBRACO but I also need to index the documents created and to offer search functionality therefore I would like to know if you have any suggestion for a lightweight search engine available in .net technology. The main requirement is to be simple and efficient (nothing complex like solr or sphinx ).
How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
Hi Thanks.
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it's an array of arrays (or list of lists).
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 know that C++ has the concept of objects but C doesn't. I also know that pretty much all there is to know about C fits into K & R but the C++ library is vastly more complex. There have got to be other big differences though.
What are the major differences between C and C++?
Hello,
I have a dataaccesslayer which uses Enterprice libraries.
Now I was wondering what is better?
Using stored procedures to create my sql or writing sql strings within the dataaccess classes?
Cheers,
M
Hi,
in a C++ program some string reads info from file, and in some part contains a "\r" character. I need to remove it, afte the read, in order to avoid problems. I thought about comparing strings character to character, I thought that "\r" would take two chars, but not, it is just one. how would i use a conditional ? if char[4]==`\r' ???
Thanks
P.D. How would the problem be solved in C?