syntax

Does java have a using clause?

I've seen reference in some C# posted questions to a "using" clause. Does java have the equivalent? ...

Any Java libraries out there that validate SQL syntax?

I'm not sure if this even exists or not, so I figured I would tap the wisdom of others.. I was wondering if there are any Java libraries out there that can be used to validate a SQL query's syntax. I know that there are many deviations from common SQL spec, so it would probably only work against something like SQL:2006, but that would ...

VB.Net function that returns string only returns single character

The other day I was working on project, and ran into a weird bug. I called a function, and it was only returning the first character from the string which it should have been returning. After trying a hundred different things, refactoring my code, stepping through the code in the debugger many times, and even having a co-worker look into...

What you think about default pass-by-reference semantics on C++?

EDIT: This question is more about language engineering than C++ itself. I used C++ as an example to show what I wanted, mostly because I use it daily. I didn't want to know how it works on C++ but open a discussion on how it could be done. That's not the way it works right now, that's the way I wish it could be done, and that would brea...

Oracle sql query, concatenate fileds with CASE section

Hi, I'm currently generating SQL insert statements from more than one tables, and in the generated data I need to use a CASE statement, like this: select 'INSERT INTO TABLE1 (f1, f2, f3, f4 ...) values (' ||t.f1||',' ||CASE WHEN t.f2 > 0 THEN '1' ELSE '0' END CASE from table2 t , table...

How do I calculate number of days betwen two dates using Python?

If I have two dates (ex. '8/18/2008' and '9/26/2008') what is the best way to get the difference measured in days? ...

Sqlite update field if it contains

Given a database field named "widget_ids", containing data like "67/797/124/" or "45/", where the numbers are slash separated widget_ids... how would you make an update statement with SQL that would say: "if the widget_ids of the row with id X contains the text "somenumber/" do nothing, otherwise append "somenumber/" to it's current valu...

C# keyword usage virtual+override vs. new

What is the difference between declaring a method in a base type "virtual" and then overriding it in a child type using the "override" keyword as opposed to simply using the "new" keyword when declaring the matching method in the child type? ...

Syntax highlighting code with Javascript

What Javascript libraries can you recommend for syntax highlighting <code> blocks in HTML? (One suggestion per answer please). ...

What are your language "hangups"?

I've read some of the recent language vs. language questions with interest... Perl vs. Python, Python vs. Java, Can one language be better than another? One thing I've noticed is that a lot of us have very superficial reasons for disliking languages. We notice these things at first glance and they turn us off. We shun what are probabl...

Parenthesis surrounding return values

Quite often in ANSI C code I can see parenthesis sorrounding a single return value. Like this:- int foo(int x) { if (x) return (-1); else return (0); } Why use () around the return value in those cases? Any ideas? I can see no reason for that. ...

What is your (least) favorite syntax gotcha?

You know the ones that make you go WTH and are easily spotted by a coworker just passing by? Please keep it one gotcha per answer to simplify voting. ...

Informix SQL Syntax - Nest Count, Sum, Round

Let me apologize in advance for the simplicity of this question (I heard Jeff's podcast and his concern that the quality of the questions will be "dumbed down"), but I'm stuck. I'm using AquaData to hit my Informix DB. There are quirky little nuances between MS SQL and Informix SQL. Anyway, I'm trying to do a simple nested expression ...

Can you control whether a variable's type is dynamic or static in VB9?

I would like to use VB9 but am not sure what syntax to use to say that I want a variable to be statically typed as in C#'s: var foo = new Whatever(); In previous versions of VB: Dim foo = New Whatever() created a dynamically typed variable. Is there a way to get static typing without actually writing the type in VB9? ...

What is the command line syntax to delete files in Perforce?

I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line? ...

Looking for a Complete Delphi (object pascal) syntax

I need a complete Object Pascal syntax (preferably Delphi 2009). Some of the syntax is given by the help files, but not all information is provided. So I started collecting loose bits of information. Recently I added these to a more or less complete syntax description (EBNF like). Although it looks extensive, there are still bugs and I'...

How do I check syntax in bash without running the script?

Is it possible to check a bash script syntax without executing it? Using Perl, I can run perl -c 'script name', is there any equivalent command for bash scripts? Thanks. ...

PL/SQL: How to execute an SP which preforms a DML and has a return value?

I have a stored procedure with the following header: FUNCTION SaveShipment (p_user_id IN INTEGER, p_transaction_id IN INTEGER, p_vehicle_code IN VARCHAR2 DEFAULT NULL, p_seals IN VARCHAR2 DEFAULT NULL) RETURN INTEGER; And I am having trouble running it from TOAD's Editor. I cannot run it as part of a select from dual statement becaus...

Combined post-operators?

We're all familiar with the pre- and post-increment operators, e.g. c++; // c = c + 1 ++c; // ditto and the "combined operators" which extend this principle: c += 5; // c = c + 5 s .= ", world"; // s = s . ", world"; e.g. PHP I've often had a need for a 'post-combined operator', which would allow: s =. "Hello "; // ...

How can I check if at least one of two subexpressions in a regular expression match?

I am trying to match floating-point decimal numbers with a regular expression. There may or may not be a number before the decimal, and the decimal may or may not be present, and if it is present it may or may not have digits after it. (For this application, a leading +/- or a trailing "E123" is not allowed). I have written this regex...