syntax

Strange {} Syntax

private final String[] okFileExtensions = new String[] {"csv"}; Would someone please explain why {} is written after a String array decleration? Thanks. ...

What is the performance difference, if any, between if(!foo) and if(foo == false) in Java?

Logically, if(!foo) and if(foo == false) are equivalent. How are they represented in Java? Is there any difference between the two after compilation, either in the bytecode or in performance? I was unable to find an answer in the JLS, and searching brought up a lot of results about = vs. == typos and ==/equals() behavior. (In this ca...

what is the purpose of :: in c#

I Have seen double colons in generated code , I was wondering what its purpose is? ...

Can I do a static import of a private subclass?

I have an enum which is private, not to be exposed outside of the class. Is there anyway I can do a static import of that type, so that I don't have to type the enum type each time? Or is there a better way to write this? Example: package kip.test; import static kip.test.Test.MyEnum.*; //compile error public class Test { private s...

Boo Constructor Chaining

In C# when I want to chain constructors together I'd do this... public class OperationMacro : GeneratePropertyMacro { public OperationMacro() : base("Operation") { //Whatever else I need to do... } } What is the equivalent syntax in Boo? ...

Highlighting syntax in a html text editor

All, In a html textarea is it possible to hightlight c and cpp syntax.If do please indicated an example code for it. int main() Int should be highlighted in this case since it is a keyword. ...

Latex: Using Minted package - how do I make it wrap the text (linebreaks=true)

Im using the Pygments for a lot of things, and I'd like to also use this in my latex report. I found the package Minted which interacts with Pygments, but some of the comments and some of the code overflows the right margin. I have used lstlistings' breaklines=true in the past, but I don't see a way to get that functionality using the Mi...

Why the following python code works?

class Square: def __init__(self,start,stop): self.value = start - 1 self.stop = stop def __iter__(self): return self def next(self): if self.value == self.stop: raise StopIteration self...

Python If Statement with Multiple Conditions

Hi. Here is some code: if (message.value[0] == "/" or message.value[0] == "\"): do stuff. I'm sure it's a simple syntax error, but something is wrong with my if statement. Any ideas to help out a python newbie? Cheers ...

Similar language features to compare with Perl and Ruby __END__

Background Perl and Ruby have the __END__ and __DATA__ tokens that allow embedding of arbitrary data directly inside a source code file. Although this practice may not be well-advised for general-purpose programming use, it is pretty useful for "one-off" quick scripts for routine tasks. Question: What other programming languages sup...

Does a SSIS Execute SQL Task handle a MERGE statement?

I'm trying to execute a MERGE statement via a Execute SQL Task, as outlined in this article: http://technet.microsoft.com/en-us/library/cc280522.aspx My MERGE statement is quite simple (see below). I can execute the MERGE statement with no trouble in SSMS, but when I put it into an Execute SQL Task, it fails with this error: "Incorrect...

JAVA: if without curly brackets, and relation to continue

Hi, I have the following java code fragment while (condition1){ switch (someinteger){ case 1: if(condition2) continue; // other stuff here break; // other cases here } } All is fine. When I generate a class file and then decompile it using a free tool (JD-gui), I get back th...

Syntax highlight problem in Scintillua 2.01-1

There is syntax highlight for HTML and PHP in Scintilla/SciTE 2.01. But there's isn't syntax highlight for HTML and PHP (all others work) in Scintillua and Scite-st (Mitschell's Scite with snippets). anyone having this problems? ...

how to reference a yaml "setting" from elsewhere in the same yaml file?

I have the following yaml: paths: patha: /path/to/root/a pathb: /path/to/root/b pathc: /path/to/root/c How can i "normalise" this, by removing /path/to/root/ from the three paths, and have it as its own setting, something like: paths: root: /path/to/root/ patha: *root* + a pathb: *root* + b pathc: *root* + c Obviously...

Python syntax and legibility for sequential steps that are sub-items

I like Python's whitespace formatting and legibility. But can you, or is there a common/standard way of delimiting blocks of code that are not to be indented, ie do not belong in nested loops? I have two parts of a procedure that belong inside a main header. Something like step 2 has parts 2.1 and parts 2.2. Commenting so far I have so...

How to deserialize synchronizedMap and synchronizedList ?

This is probably just a question of syntax (and my inability to find it ;) Here's the collections to be (de)serialized: private Map<String, Terminal> terminals = Collections.synchronizedMap(new HashMap<String, Terminal>()); private List<Host> hosts = Collections.synchronizedList(new ArrayList<Host>()); Here goes serialization: Objec...

Is There a Syntax Shortcut for Multiple Initialization in C#?

Is there a way to do this: valueType x = 1, y = 1, z = 1; with less characters? e.g. When I have a large amount of state to initialize to the same starting value. Thanks! ...

entry point error for Main(string args)?

Hi My practice code using System; using System.Collections.Generic; using System.Text; namespace MyConApp { class Program { static void Main(string[] args) { string[] tmpString; tmpString = args; Console.WriteLine("Hello" + tmpString[0].ToString()); } } } Why T...

Which is standard for object in javascript?

{id:1,name:'test'} or {'id':1,'name':'test'} I've seen both of them used many times and now I'm confused! ...

How to compare values for last and second last entry in table?

I have a table in Oracle called quotes with two columns: date and value. I would like to compare values for last entry and second last entry in the table. In this example I would like to get dates for 13.1 and 11.1 in one line and the difference between the values for each date (10-5=5). Quotes Table: Date - Value 13.1.2010...