syntax

Some questions about special operators i've never seen in C++ code.

I have downloaded the Phoenix SDK June 2008 (Tools for compilers) and when I'm reading the code of the Hello sample, I really feel lost. public ref class Hello { //-------------------------------------------------------------------------- // // Description: // // Class Variables. // // Remarks: // // A normal compiler would have m...

Why is NULL undeclared?

I have a problem with this struct contructor when I try to compile this code: typedef struct Node { Node( int data ) // { this->data = data; previous = NULL; // Compiler indicates here next = NULL; } int data; Node* previous; Node* next; } NODE; when I come this error occurs: \linkedli...

JScript syntax verifier?

I'm new to JScript coming from a C++ world. I'm quite surprised that expressions are evaluated at run-time. What I mean is if I added a function and didn't provide its definition, the program would "crash" (in the debugger) when I run it. It's also funny how I can just type gibberish anywhere and only at run-time the debugger would com...

directly embedded subreport in jasper report

Hello, I am so close to having this work, I am trying to directly embed one jasper subreport into the main report xml of the other. You'd think this would be easy, but I can't find a single example on doing it. Everyone seems to use files or resources or whatever. I have one report working straight from a string and I want it to conta...

PHP + MySQL Error

Hello, here's the code: if ($_POST) {$content = stripslashes($_POST['content']); $by = $_SESSION['exp_user']['username']; $dt = date("F j, Y, g:i a"); mysql_query("UPDATE tbl_intmsg SET time = ".$dt.", by = ".$by." AND content = ".$content."") or die(mysql_error()); For which I recieve error: You have an error in your SQL syntax; ch...

Pass all arguments to another function

I have two functions like this: function mysql_safe_query($format) { $args = array_slice(func_get_args(),1); $args = array_map('mysql_safe_string',$args); $query = vsprintf($format,$args); $result = mysql_query($query); if($result === false) echo '<div class="mysql-error">',mysql_error(),'<br/>',$query,'</div>'; return $result; } ...

Do template specializations require template<> syntax?

I have a visitor class resembling this: struct Visitor { template <typename T> void operator()(T t) { ... } void operator()(bool b) { ... } }; Clearly, operator()(bool b) is intended to be a specialization of the preceding template function. However, it doesn't have the template<> syntax ...

Function template specialization format

What is the reason for the second brackets <> in the following function template: template<> void doh::operator()<>(int i) This came up in SO question where it was suggested that there are brackets missing after operator(), however I could not find the explanation. I understand the meaning if it was a type specialization (full specia...

JavaScript: immediate function invocation syntax

There is a JSLint option, one of The Good Parts in fact, that "[requires] parens around immediate invocations," meaning that the construction (function () { // ... })(); would instead need to be written as (function () { // ... }()); My question is this -- can anyone explain why this second form might be considered better? ...

What is the technical name of the syntactic feature "long foo = 12L;" style casting of harded-coded values in Java?

Today, I was trying to cast a hard-coded value into a short and S did not work. So, I went to search for it, but I realized that I do not even know what this feature of Java's syntax is called. Is there a name for it? If not, is there at least a list of all of the possible ways to cast hard-coded numeric values? Epilouge After getting ...

Are there any Ruby language features you avoid?

It seems to me like Ruby has a lot of syntactic flexibility, and many things may be written in several ways. Are there any language features/syntactic sugar/coding conventions that you avoid as a Ruby programmer for clarity? I am asking about things that you choose not to use on purpose, not stuff you still have to learn. If your answ...

Making YACC output an AST (token tree)

Is it possible to make YACC (or I'm my case MPPG) output an Abstract Syntax Tree (AST). All the stuff I'm reading suggests its simple to make YACC do this, but I'm struggling to see how you know when to move up a node in the tree as your building it. ...

How can I check the SQL syntax in a .sql file?

How can I check the SQL syntax in a .sql file? ...

Objective-C method syntax address of

I'm trying to create a method that takes several parameters using & (for address-of). What I'd like to do is have the method do some calculations and adjust the parameters so they can be used elsewhere. I've defined the method as: - (void) convertParameters: (double *)x: (double *)y: (double *)z: (double *)height: (double *)width: (do...

Intelligent Searching with wildcards (*) and word grouping in SQL Full-text Search

What's the best way implement MS SQL full-text search using all the normal things like wildcards and quotations. For example: If the search term the user inputs is Overdose of "Vitamin C" for child* I would like to treat "Vitamin C" as one phrase and would like to match "child" and "children" The documentation offers so many al...

Solr Query Syntax

Hi all, I just got started looking at using Solr as my search web service. I don't know whether Solr supports these query types: Startswith Exact Match Contain Doesn't Contain In the range Could anyone guide me how to implement those features in Solr? Cheers, Samnang ...

Why avoid increment ("++") and decrement ("--") operators in JavaScript?

I'm a big fan of Douglas Crockford's writing on JavaScript, particularly his book JavaScript: The Good Parts. It's made me a better JavaScript programmer and a better programmer in general. One of his tips for his jslint tool is this : ++ and -- The ++ (increment) and -- (decrement) operators have been known to contribute to bad...

PHP - How to get object from array when array is returned by a function?

Hi, how can I get a object from an array when this array is returned by a function? class Item { private $contents = array('id' => 1); public function getContents() { return $contents; } } $i = new Item(); $id = $i->getContents()['id']; // This is not valid? //I know this is possible, but I was looking for a 1 li...

Context-free grammar describing regular expressions?

I'm trying to write a regular expression engine. I'd like to write a recursive descent parser by hand. What would a context-free grammar without left recursion for the language of regular expressions (not the languages that can be described by regular expressions) look like? Would it be easiest to re-factor out the syntactic sugar, i.e. ...

SQL WHERE excluding records using AND and NOT

Here's a query I'm working on: SELECT TBL_SUB_KEY AS port , poe.[TBL_COMPANY] , poe.[TBL_DIVISION_1] FROM dbo.TMVKTAB AS poe WHERE ( TBL_NUMBER = '8A' ) AND ( TBL_SUB_KEY <> '' ) AND ( poe.[TBL_COMPANY] <> '011' AND poe.[TBL_DIVISION_1] <> '11' ) What I want returned are all ...