syntax

Boolean 'NOT' in T-SQL not working on 'bit' datatype?

Trying to perform a single boolean NOT operation, it appears that under MS SQL Server 2005, the following block does not work DECLARE @MyBoolean bit; SET @MyBoolean = 0; SET @MyBoolean = NOT @MyBoolean; SELECT @MyBoolean; Instead, I am getting more successful with DECLARE @MyBoolean bit; SET @MyBoolean = 0; SET @MyBoolean = 1 - @MyBo...

How do I abort the execution of a Python script?

Possible Duplicate: Terminating a Python script I have a simple Python script that I want to stop executing if a condition is met. For example: done = True if done: # quit/stop/exit else: # do other stuff Essentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of a func...

Mixed syntax for control structures generating syntax errors

I'm refactoring some PHP code and discovered that certain nested combinations of if () : and if () { generate syntax errors. Not that I would normally mix the two, but I like to do frequent syntax checks as I'm writing code and I kept getting a syntax error because of this. Example - generates syntax error: if ( $test == 1 ) :...

Why does my RSS feed duplicate some entries?

Hello, when reading my RSS feed with Thunderbird feed reader, some entries are duplicated. Google reader does not have the same problem. Here is the faulty feed http://plcoder.net/rss.php?rss=Blog There is a problem, but where? Regards, Cédric update : I add guid but the problem remain. Anothers feeds does not duplicate like mine, ...

In Python, what is the difference between '/' and '//' when used for division?

Is there a benefit to using one over the other? They both seem to return the same results. >>> 6/3 2 >>> 6//3 2 ...

How can I concatenate regex literals in Javascript?

Is it possible to do something like this? var pattern = /some regex segment/ + /* comment here */ /another segment/; Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise. ...

Java Generics Syntax for arrays

What data structure does the following declaration specify? List<ArrayList>[] myArray; I think it should declare an array where each element is a List (e.g., a LinkedList or an ArrayList) and require that each List contain ArrayList objects. My reasoning: List<String> someList; // A List of String objects List<ArrayLi...

What does the tilde (~) mean in C#?

Howdy, I am looking at some code and it has this statement: ~ConnectionManager() { Dispose(false); } The class implements the IDisposable interface, but I do not know if that is part of that the tilde(~) is used for. Thank you, Keith ...

Correct way to populate an Array with a Range in Ruby

I am working through a book which gives examples of Ranges being converted to equivalent arrays using their "to_a" methods When i run the code in irb I get the following warning warning: default `to_a' will be obsolete What is the the correct alternative to using to_a? are there alternate ways to populate an array with a Range? Ch...

Reference to static method in PHP?

In PHP, I am able to use a normal function as a variable without problem, but I haven't figured out how to use a static method. Am I just missing the right syntax, or is this not possible? (EDIT: the first suggested answer does not seem to work. I've extended my example to show the errors returned.) function foo1($a,$b) { return $a/$...

What is standard CLR XML for a concrete generic that is an array?

This is a simple issue of me not knowing proper Xml syntax. In castle windsor I can duplicate this line of code: IoC.Container.AddComponent<IInputRequestedDialog<string>, SealsInputDialog>("seals"); With this Xml: <component id="seals" service="MyApp.InputRequestedDialog`1[[System.String]], MyApp" type="MyApp.SealsInputDia...

What is the syntax to use a Select statement inside a PL/SQL Trigger?

This is what I currently have: CREATE OR REPLACE TRIGGER MYTRIGGER AFTER INSERT ON SOMETABLE FOR EACH ROW DECLARE v_emplid varchar2(10); BEGIN SELECT personnum into v_emplid FROM PERSON WHERE PERSONID = :new.EMPLOYEEID; dbms_output.put(v_emplid); /* INSERT INTO SOMEOTHERTABLE USING v_emplid and some of the other values...

How can I check the syntax of Python code in Emacs without actually executing it?

Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code? ...

How do you mark a struct template as friend ?

I have code like this: template <typename T, typename U> struct MyStruct { T aType; U anotherType; }; class IWantToBeFriendsWithMyStruct { friend struct MyStruct; //what is the correct syntax here ? }; What is the correct syntax to give friendship to the template ? ...

Are there any IDE's that support Python 3 syntax?

I recently saw an announcement and article outlining the release of the first Python 3.0 release candidate. I was wondering whether there were any commercial, free, open source etc. IDE's that support its syntax. ...

Are semantics and syntax the same?

I don't understand the meaning of semantic and the meaning of syntax! What are they? And what's the difference between things like "semantic website vs. normal website", "semantic social networking vs. normal social networking" etc... I don't get it! HELP! ...

Tool purely for Syntax Checking?

We have a proprietry system that we develop scripting code in. We currently do not have a developer environment (apart from Notepad++) and cannot debug or compile this code. We have to submit it to the vendor to insert the code into the test or live system. The language is essentially C like and has the same syntax. Basically we want a ...

What is the C# Using block and why should I use it?

What is the purpose of the Using block in C#? How is it different from a local variable? ...

How do I modify a MySQL column to allow NULL?

MySQL 5.0.45 What is the syntax to alter a table to allow a column to be null, alternately what's wrong with this: ALTER mytable MODIFY mycolumn varchar(255) null; I interpreted the manual as just run the above and it would recreate the column, this time allowing null. The server is telling me I have syntactical errors. I just don't...

Is there an actual difference in the 2 different ways of attaching event handlers in C#?

In C# is there any real difference (other than syntax) under the hood between: myButton.Click += new EventHandler(myMemberMethod); and myButton.Click += myMemberMethod; ? ...