syntax

weird array syntax

I'm trying to figure how a function I've been given works -- or rather doesn't work. The problematic areas include array notation like this: $small[$end[$i]{0}] I think the idea is to append "0" to the value of $end[$i] and use that for the index of $small. But it doesn't work in PHP5.3. Is this a deprecated syntax and is it trying t...

Sqlite table constraint - unique on multiple columns

I can find syntax "charts" on this on the sqlite website, but no examples and my code is crashing. I have other tables with unique constraints on a single column, but I want to add a constraint to the table on two columns. This is what I have that is causing a SQLiteException with the message "syntax error". CREATE TABLE name (column ...

Initializing PHP class property declarations with simple expressions yields syntax error

According to the PHP docs, one can initialize properties in classes with the following restriction: "This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated." I'm trying...

How do I understand the 3 lines batch script?

ECHO @ECHO OFF ^& (IF EXIST "%%~dp0%~n1.swf" (DEL "%%~dp0%~n1.swf")) ^& %mxmlcPath% %opts% -file-specs "%%~dp0%~nx1" ^& (IF EXIST "%%~dp0%~n1.swf" (CALL "%%~dp0%~n1.swf") ELSE (PAUSE)) > "%~dpn1.bat" REM Immediately execute the generated bat @ECHO on CALL "%~dpn1.bat" It's really a mess for me(like ECHO @ECHO OFF,what's that intended f...

What is ".foo{}" in the beggining of a stylesheet?

Hello people, this is my first question, so i do not know if i am doing it ok... I would like to know what is the meaning of ".foo{}" It is placed at the beggining of a css stylesheet i have been modifying. Regards. tomano ...

MATLAB: How does the syntax (:) work?

Given the following example: >> I=[2 1 3;3 2 4] I = 2 1 3 3 2 4 >> I(:) ans = 2 3 1 2 3 4 >> I(1:2) ans = 2 3 Why does I(:) return a column vector while I(1:2) returns a shorter row vector? ...

How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?

Have you ever taken a look under the hood at the JQuery 1.4 source code and noticed how it's encapsulated in the following way: (function( window, undefined ) { //All the JQuery code here ... })(window); I've read an article on JavaScript Namespacing and another one called "An Important Pair of Parens," so I know some about wha...

MySQL National Stock Numbers (NSN) for identification of assets

In MySQL are there any restrictions (and/or) practical reasons against using a numbering system similiar to the National Stock Number format as follows 3728-01-234-5678 (this format includes the use of the hyphen between groups of characters within the structure) Would this require the use of a specific engine like InnoDB A newbie stu...

JavaScript: When should I use a semicolon after curly braces?

Many times I've seen a semicolon used after a function declaration, or after the anonymous "return" function of a Module Pattern script. When is it appropriate to use a semicolon after curly braces? ...

Programming terms - field, member, properties (C#)

Hi, I was trying to find meaning of this terms but especially due to language barrier I was not able to understand what they are used for. I assume that "field" is variable (object too?) in the class while "property" is just an object that returns specific value and cannot contain methods etc. By "member" I understand any object that is ...

When would you put a semicolon after a method closing brace?

I've been programming in Java for a while, and I've just come across this syntax for the first time: public Object getSomething(){return something;}; What's interesting me is the final semicolon. It doesn't seem to be causing a compiler error, and as far as I know isn't generating runtime errors, so it seems to be valid syntax. When ...

Is Odersky serious with "bills !*&^%~ code!" ?

In his book programming in scala (Chapter 5 Section 5.9 Pg 93) Odersky mentioned this expression "bills !*&^%~ code!" In the footnote on same page: "By now you should be able to figure out that given this code,the Scala compiler would invoke (bills.!*&^%~(code)).!()." That's a bit to cryptic for me, could someone explain what's go...

Call methods on native Javascript types without wrapping with ()

In Javascript, we can call methods on string literals directly without enclosing it within round brackets. But not for other types such as numbers, or functions. It is a syntax error, but is there a reason as to why the Javascript lexer needs these other types to be enclosed in round brackets? For example, if we extend Number, String, a...

How do you create a generic method in a class?

Hello, I am really trying to follow the DRY principle. I have a sub that looks like this? Private Sub DoSupplyModel OutputLine("ITEM SUMMARIES") Dim ItemSumms As New SupplyModel.ItemSummaries(_currentSupplyModel, _excelRows) ItemSumms.FillRows() OutputLine("") OutputLine("NUMBERED INVENTORIES")...

In a C function declaration, what does "..." as the last parameter do?

Often I see a function declared like this: void Feeder(char *buff, ...) what does "..." mean? ...

Delphi syntax for a table indexed on two or more fields

I have a Table indexed on field1 and on field2. How do I specify, in the TTable component, that both indexes are active. I tried: IndexFieldNames := 'FIELD1, FIELD2'; It didn't work. ...

Is there any performance difference between a SQL "IN" statement versus using "OR"?

Thought I would ask the knowledgeable StackOverflow community a question that was on my mind today and I can't seem to find an answer. Is there any performance difference or advantage between an "IN" or using "OR"? Ie. Is SELECT type FROM types WHERE typecat IN ('abc', 'def') better than SELECT type FROM types WHERE typecat = 'abc' ...

How do Java public/private and static modifiers affect multiple variables declared on one line?

Are the following equivalent? private static boolean readAllFiles = false,readAllDirs = false; private static boolean readAllFiles = false; private static boolean readAllDirs = false; And if so, do they still have the same modifiers with different values? private static boolean readAllFiles = false,readAllDirs = true; ...

Predicate<int> match question

Hi, I do not understand how following code works. Specifically, I do not understand using of "return i<3". I would expect return i IF its < than 3. I always though that return just returns value. I could not even find what syntax is it. Second question, it seems to me like using anonymous method (delegate(int i)) but could be possible t...

Python - is there a "don't care" symbol for tuple assignments?

Given a string "VAR=value" I want to split it (only) at the first '=' sign (< value > may contain more '=' signs), something like this: var, sep, value = "VAR=value".partition('=') Is there a way to NOT declare a variable 'sep'? Like this (just made up the syntax): var, -, value = "VAR=value".partition('=') Just for completeness, I...