Are elseif and else if completely synonymous?
Does Zend have an accepted "standard" on which one to use?
I personally greatly dislike seeing elseif in the code. Just use else if like every other language, right? But I just need to know if they're synonymous and the PHP manual isn't the easiest to search.
...
Hey SO, I recently had two phone interviews for a Junior C++ Engineer position; the first was a general screening interview, the second a more technical one. So far the company has made it clear that while they do want you to be familiar with OOP, specifically knowing a ton of C++ is not required, for example if you mainly did Java, that...
Say I want a call to be run, and if it fails, it's no big deal; the program can continue without a problem. (I know that this is generally bad practice, but imagine a hypothetical, quick one-off script, and not a large project)
The way I've been taught to do this was:
begin
thing_to_try
rescue
# awkward blank rescue block
end
next...
This one has always puzzled me, but i'm guessing there is a very sensible explanation of why it happens.
When you have a collection initializer the compiler allows a trailing comma, e.g.
new Dictionary<string, string>
{
{ "Foo", "Bar "},
};
and
new List<string>
{
"Foo",
};
Anyone know why this trailing comma is allowed ...
Hi,
There is a field say XYZ with value as either TRUE or FALSE.
i am searching as following
+Contents:risk +XYZ:TRUE
is it legal to search like that? i tried but it showed me results with FALSE value too.
What was more amazing is that i searched by +XYZ:[TRUE TO TRUE] and it worked.
can some one tell me what exactly is my mistak...
I would like to do exactly what "google code prettifier" (syntax highlighting of code snippets in a web page) does, but on serverside using java.
Any ideas?
...
Why is it that in most programming languages it is required to have a semicolon after statements but not after things like if elseif and else.
Do the compilers all look out for newlines? If that's true then why wouldn't they do that for all statements?
Am I missing something? It really doesn't make sense to me...
...
Hello,
Consider the interface:
type IVector =
abstract Item : int -> float
Now, let us define the class:
type DenseVector(size : int) =
let mutable data = Array.zeroCreate size
interface IVector with
member this.Item with get n = data.[n]
What about supply a method to mutate the n-th entry of the dense vect...
It does not look very good for me to always repeat a line-long tuple definition every time I need it. Can I just name it and use as a type name? Would be nice to name its fields also instead of using ._1, ._2 etc.
...
Visual C++ 2010 accepts:
std::vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
for each (auto i in v)
std::cout << i << std::endl;
Is this a C++0x feature or a Microsoft extension? According to Wikipedia, the syntax of C++0x's for-each loop different:
int myint[] = {1,2,3,4,5};
for (int& i: myint)
{
std::cout <<...
With NetBeans (v. 6.9.1) I cannot get syntax highlighting for the Boost library, i.e. all stuff present in Boost is not recognised. However the project is built correctly.
I already set the paths in: NetBeans > Preferences > C/C++ > Code Assistance > C++ Compiler.
Here I added the /usr/local/include path.
The Boost headers are in /usr/...
In C99 there are variable-length arrays, and there can be static qualifiers (and type qualifiers) in parameter array declarators:
void f(int i, int *a);
void f(int i, int a[]);
void f(int i, int a[i]);
void f(int i, int a[*]); // Only allowed in function prototypes.
void f(int i, int a[static i]);
Since array function paramete...
Hi I am trying to show tables with names not like a pattern by mysql is throws an error:
SHOW TABLES NOT LIKE "tree%";
returns:
#1064 - 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 'NOT LIKE "tree%"' at line 1
What is the right syntax?
Thank...
In the following code how to test for if the type is url or if the type is an image
for dictionaries in d_dict:
type = dictionaries.get('type')
if (type starts with http or https):
logging.debug("type is url")
else if type ends with .jpg or .png or .gif
logging.debug("type is image")
else:
logging.debug("invali...
Is this the correct syntax for a prepared statement in java:
INSERT INTO table (id, version, data)
VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE
data = IF(version > values(version), data, values(data)),
version = IF(version > values(version), version, values(version))
I am looking for the best way to insert or update millions ...
I'm tired of this dictionary idiom:
Dictionary<Guid,Contact> Contacts;
//...
if (!Contacts.ContainsKey(id))
{
contact = new Contact();
Contacts[id] = contact;
}
else
{
contact = Contacts[id];
}
It would be nice if there was a syntax tha...
I saw this
i >= 5
but I also saw this
i => 5
What's the difference?
...
Hey everyone, sorry for the newbie question, but I'm just starting to learn the C programming language. I've written this simple piece of code that converts the USD to Euros. Only problem is that once the input of the USD is inputed, the program just hangs. I'm using a while loop to ask the user whether or not they want to redo the op...
Hello i have structures declared in the same Header file that need eachother.
struct A; // ignored by the compiler
struct B{
A _iNeedA; //Compiler error Here
};
struct A {
B _iNeedB;
};
this work normally
class A;
class B{
A _iNeedA;
};
class A {
B _iNeedB;
};
// everything is good
Thank you very much!
...
I'm looking for a semantic or language construct that will simplify some of my if statements. If I have an if statement with an or, where I 'choose' between two values, I'd like to have that chosen variable available later on in the code.
I'll write this in pseudo-code:
if ( x or y ) {
function(z);
}
Where z is the value of x o...