syntax

Stuck with syntax in c - pointers

ok so if we have a char *hello - ands the string is "hello" and i do char *ptr ; ptr = hello; then ptr will be pointing at 'h', correct? Now i have just done an assignmnet in this and completed it using the following terms if i wanted to move the pointer to the next chatachter i would just do ptr++. If i wanted to use the value of...

Why can this kind of statement work in PHP?

$user->Phonenumbers[]->phonenumber = '123 123'; $user->Phonenumbers[]->phonenumber = '456 123'; $user->Phonenumbers[]->phonenumber = '123 777'; I've never seen this kind of syntax EDIT This seems more probably a feature,do you guys know how can I implement a feature like this? ...

Python class syntax - is this a good idea?

I'm tempted to define my Python classes like this: class MyClass(object): """my docstring""" msg = None a_variable = None some_dict = {} def __init__(self, msg): self.msg = msg Is declaring the object variables (msg, a_variable, etc) at the top, like Java good or bad or indifferent? I know it's unnecessar...

History of trailing comma in programming language grammars

Many programming languages allow trailing commas in their grammar following the last item in a list. Supposedly this was done to simplify automatic code generation, which is understandable. As an example, the following is a perfectly legal array initialization in Java (JLS 10.6 Array Initializers): int[] a = { 1, 2, 3, }; I'm curious...

What does this PHP syntax mean: $var1->$var2

New to PHP. Can someone please explain this syntax. $var1->$var2 //note the second $ Thanks ...

Search database returning results to gridview via sqldatareader

I am trying to create a search page, this allows the admin to search through the entries in the database by certain criteria, such as province (like state but diff country) Here is the code I have so far. The problem is that I am not getting any errors. But I am also not getting any results. The page just posts back and returns to the b...

how can I use curly braces in a mysql query?

I tried to do this: INSERT INTO test123 VALUES(Some text, 'More Text (and in braces.)'); but it doesn't work. The braces in the string 'More Text (and in braces.)' cause the syntax error. How can I make it work - I need mysql to accept the braces. ...

What is the meaning of a function parameter of type *& in C++ ?

After reading a description about swapping pointer addresses on Stackoverflow, I have a question about C++ syntax for references. If you have a function with the following signature: void swap(int*& a, int*& b) What is the meaning of int*& ? Is that the address of a pointer to an integer? And furthermore being that it is a pointer re...

What's this kind of syntax in PHP?

$test= <<<EOF .... EOF; Never see it before,what's it used for? ...

What is the usage of global:: keyword in C#?

What is the usage of global:: keyword in C#? When must we use this keyword? ...

SQL where field in vs. where field = with multiple ors?

Which of these is better to use in regard to performance? ...in regard to readability / understandability? ...in regard to accepted standards? SELECT * FROM Wherever WHERE Greeting IN ('hello', 'hi', 'hey') OR SELECT * FROM Wherever WHERE Greeting = 'hello' OR Greeting = 'hi' OR Greeting = 'hey' The first seems more intuitiv...

About Mercurial, .hgignore file and glob syntax

Is it possible, while using glob syntax for an .hgignore file, to recursively ignore certain files and folders, except one? Assuming that you have: a/ a/b a/c a/d Something like: syntax globe: a ^a/b This should ideally ignore c and d and keep b. I know this has been discussed in other SO questions, but it seems they're all using...

What does the >> symbol mean in Haskell.

I was reading the Guestbook example for Happstack and noticed the >> symbol which I didn't see before in the textbooks I studied to learn Haskell (for instance see line 23). What is it? Example I could not find it in Google because it ignores the >> totally (Bing does not but comes up with tons of non-related results). Thanks! ...

python switch by class name?

I am currently doing this, to do different things based on an object's type: actions = { SomeClass: lambda: obj.name AnotherClass: lambda: self.normalize(obj.identifier) ...[5 more of these]... } for a in actions.keys(): if isinstance(obj, a): return actions[a]() Is it possible ...

MySQL Update during CSV import question

Okay, so I have this CSV file of products and all the products have an ID number. I am going to import this CSV into an existing (empty) database table where the columns in the database are named the exact same name as the first-row columns in the CSV file. There is one extra column in the DB called URI. I need to build this during (o...

How to make Visual Studio to automatically include curly brackets in C# code?

After namespace, class, struct, enum, for, foreach, while, switch, do, using, unchecked and at the beginning of methods, shouldn't Visual Studio automatically include curly brackets? How to activate this feature? ...

Google App Engine: Upload data syntax?

I'm trying to use appcfg.py to upload to localhost/Google App Engine. I've basically been following these instructions word for word, but now I'm having trouble. Here is the command I'm trying: appcfg.py upload_data --app-id=appname --config_file="path\to\ItemLoader.py" --filename="path\to\data.csv" --kind=Item --url=http://localhost:8...

Why the c# compiler requires the break statement in switch construction?

Hi there, I'm having hard time understanding, why the compiler requires using break statement. It's not possible to miss it since the fall through is now allowed. I see the reason for the break in C or C++, but is it needed here. Why it's not a built-in behavior to break after a case is over ? Isn't it just a syntax with no semantic? ...

C++ Pointer in Function

Possible Duplicate: Whats your preferred pointer declaration style, and why? I know that technically all three ways below are valid, but is there any logical reason to do it one way or the other? I mean, lots of things in c++ are "technically valid" but that doesn't make them any less foolish. int* someFunction(int* input) {...

Syntastic for Vim: What are the required lines in ~/.vimrc? (PHP error checking)

I find the documents frustrating. What are the basic lines I need to add to my config file to get it working? ...