In python 2.6, why is the following line valid?
my_line = 'foo' 'bar'
and if that is valid, why isn't the following:
my_list = 1 2
The first example is string concatenation, however, the following isn't valid either (thanks god):
foo = 'foo'
bar = 'bar'
foo_bar = foo bar
...
Possible Duplicates:
What is the difference between i++ and ++i in Java?
Is there a difference between x++ and ++x in java?
All in the question really, have seen many people say oh; why am i doing i++, dont i no ++i is quicker etc, but its just how i was taught
can anyone provide me with a reason why one is better than the ot...
n00b question. I am a C guy and I'm trying to understand some C++ code. I have the following function declaration:
int foo(const string &myname) {
cout << "called foo for: " << myname << endl;
return 0;
}
How does the function signature differ from the equivalent C:
int foo(const char *myname)
Is there a difference between usin...
Possible Duplicates:
Javascript === vs == : Does it matter which equal operator I use?
Javascript operator !==
Look at this commit
Is != same as !== in JavaScript?
[1]:
...
Mixing html and php is simple:
<? while($row): ?>
<p><?=$row['name'] ?></p>
<?php endwhile; ?>
But how could i store html like this into a php variable? (Purposed syntax, but doesn't work)
<? $html = ?>
<p>My HTML!!</p>
<? ; ?>
...
I am trying to insert data into my database, but keep getting error 1064. Which goes like this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Add, Username, TalkID) VALUES ( 'trial' , 'andy' , 2 )' at line 1
The error occurred in C:\ColdFusion8\www...
This code:
class Todo:
def addto(self, list_name="", text=""):
"""
Adds an item to the specified list.
"""
if list_name == "":
list_name = sys.argv[2]
text = ''.join(sys.argv[3:]
todo_list = TodoList(getListFilename(list_name))
produces a syntax error with the little arrow pointing to todo_list on the last line.
The...
I'm new to java, and this question struck me. When you instantiate an object, why do you specify the class twice?
OddEven number = new OddEven();
Why can't you just say number = new OddEven();? When I delcare a string, I only say String once:
String str = "abc";
Actually, my question is not "why do you do it this way" -- obviously...
I mean when I type 'select', it highlights 'select' with blue. When I
press 'Undo', the letter 't' disappears and 'selec' becomes black.
After 3 days googling...
I found this but it undoes a block code a time, not a letter:
'http://fifesoft.com/rsyntaxtextarea/TextAreaApplet.php'
This doesn't help.
'http://syntax.jedit.org/'
...and ...
Can somebody explain me why the small piece of code doesn't work?
This is the error what is given:
Parse error: syntax error, unexpected '=' in /var/www/g35003/
$img_attributes= style='max-height: 100px; max-width: 100px' . 'alt="'.$product['product_name'].'"';
...
I understand how to use a case statement to return different values:
SELECT CASE Color
WHEN 'Blue' THEN 'Water'
WHEN 'Black' THEN 'Oil'
WHEN 'Red' THEN 'Blood'
END
FROM dbo.Liquid
Is there a way to use it to control flow instead of IF-ELSE, i.e.
DECLARE @Color varchar()
SELECT @Color = Color FROM d...
I just wondered whether there is any good reason for or even an advantage in having to invoke Procs using proc.call(args) in Ruby, which makes higher-order function syntax much more verbose and less intuitive.
Why not just proc(args)? Why draw a distinction between functions, lambdas and blocks? Basically, it's all the same thing so why...
I have a small Ruby script where an array is initialized to hold a few strings
MyArray = ["string 1", "string 2" , "string 2" ]
The problem is that I have quite a few strings in the initialization list and I would like to break the line:
MyArray = [
"string 1"
,"string 2"
,"string 2"
]
...
I occasionally run into this type of syntax when looking through open source code and was wondering what it's for, or what it's even called for that matter.
I have crawled the internet many a times before but simple contrived examples never had it nor explained it.
It looks like this
class SomeIdentifier ClassName {
...
}
My quest...
I'm just trying to create my first mysql stored procedure and I'm trying to copy some examples almost directly from the documentation, but it isn't working:
mysql> delimiter //
mysql> CREATE PROCEDURE ghost.test (OUT param1 INT) INSERT into admins SELECT COUNT(*) FROM bans; END//
ERROR 1064 (42000): You have an error in your SQL syntax;...
I have a question about the first paramater in Objective-C
-(NSInteger) totalSeconds:(NSInteger)h minutes:(NSInteger)m seconds:(NSInteger)s;
I've noticed that it seems the first paramater is often 'pulled into' the message name itself and is not named.
[totalSeconds:9 minutes:59 seconds:59]
Is this kind of syntax acceptable:
-...
I have been looking through some code and I have seen several examples where the first element of a for cycle is omitted.
An example:
for ( ; hole*2 <= currentSize; hole = child)
What does this mean?
Thanks.
...
Hi,
I am new to R language. I have successfully loaded a query's resultset into a variable. Now I want to access the resultset data by column name and row number. And I need to verify if it is Null (it is shown as < NA > in result) then send a mail by bat file with php. My sample code is below.
library(RODBC)
newconn = odbcConnect("db...
Hi, I'm curious to know what the syntax " : " mean in php I've seen it a couple of times but I can't seem to explain it to myself. Can you also use it in a sentence....or i mean, sample code?
**edit:
sorry folks, I was referring to the ternary operator. Thanks for the other entries as well. I didn't know what to call it at first, apolo...
In C#, you can do something like this:
SomeClass someClass = new SomeClass () {
SomeProperty = someValue
};
What is this syntax called?
...