syntax-error

What's wrong with this c++ code?

My C++ is a bit rusty so... #include<list> typedef list<int> foo; that gives me the oh so nice error message: test.cpp:2: syntax error before `;' token What the heck can I even Google for in that... ...

Python Eval: What's wrong with this code?

I'm trying to write a very simple Python utility for personal use that counts the number of lines in a text file for which a predicate specified at the command line is true. Here's the code: import sys pred = sys.argv[2] if sys.argv[1] == "stdin" : handle = sys.stdin else : handle = open(sys.argv[1]) result = 0 for line in han...

How to make this Python program compile?

I have this Python code: import re s = "aa67bc54c9" for t, n in re.findall(r"([a-z]+)([0-9]+)", s) And I get this error message when I try to run it: File "<stdin>", line 1 for t, n in re.findall(r"([a-z]+)([0-9]+)", s) ^ SyntaxError: invalid syntax How can I solve this? I ...

Why won't this ISQL command run through Perl's DBI?

A while back I was looking for a way to insert values into a text field through isql and eventually found some load command that worked out for me. It doesn't work when I try to execute it from Perl. I get a syntax error. I have tried two separate methods and both are not working so far. I have the SQL statement variable print out at...

Can't Delete Function Call

This question is just out of general curiosity. I've just noticed it when working on my current project (surprisingly I haven't came across before today). Take this code: List = ["hi","stack","over","flow","how","you","doing"] del List(len(List)-1) Error: SyntaxError: can't delete function call I don't understand why you aren't al...

Why does SQLite complain about the syntax of my prepared statement?

I'm having trouble getting a prepared statement in sqlite3 to work. I'm working with Perl and the Perl DBD framework. Below is the code I use: #This is a function I have defined sub query($@){ my $st = $db->prepare(shift); $st->execute(@_); } #And it is used like so query("UPDATE rooms SET name = ?, SET capacity = ? WHERE id = ...

SQL Syntax error on table update

Hello all, Why is that I'm getting a syntax error on the following SQL statement under sqlite? Error reads: SQL Error: near "SET": syntax error UPDATE nova SET Nome = (select Nome from assessores where nova.ID = assessores.ID), SET Morada = (select Morada from assessores where nova.ID = assessores.ID), SET E...

MySQL transaction query help

This problem is baffling me: BEGIN; INSERT INTO sub_users(user_id, email) SELECT user_id FROM users WHERE email='[email protected]', '$email'; COMMIT; Normally, I have multiple statements in that transactions, but I've removed those for clarity. I get this error: #1064 - You have an error in your SQL syntax; check the manual that...

Why is my if statement not firing?

I have the following Objective-c Function - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger section = [indexPath section]; NSUInteger row = [indexPath row]; NSString *key = [keys objectAtIndex:section]; NSArray *nameSection = [mysearchdata objectForKey:key]; static...

SQL Syntax Error - PHP/MySQL

Can anyone tell me what's going on here. I'm not sure why this code is not working and throwing the following error: You have an error in your SQL syntax, check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND role != 7 AND role != 4' at line 3 $sql = 'SELECT * FROM tblusers INNER...

please tell me why "else" is a syntax error here.

import java.util.Scanner; public class SW { /** * @param args */ public static void main(String[] args) { int length; int width; int number; int perimeter; int area; Scanner input = new Scanner( System.in ); System.out.println("1. Dimensions of the rectangle"); System.out.println("2. Perimeter of the rectangle"); System.out...

Cakephp generating xml error - blank space

Hi, I am trying to generate a dynamic xml document in CakePHP to output to the browser. Here is my controller code: Configure::write ('debug', 0); $this->layout = null; header('Content-type: text/xml'); echo "<?xml version=\"1.0\"?>"; View is something like this: <abc> something </abc> The output is probably as expected: <?...

PHP syntax error T_ENCAPSED_AND_WHITESPACE

hello all! i'm starting to work with php basics and i have some problem understanding how mix code with strings. I found a great and useful style to print string blocks but i don't know the name and i'm not able to find examples. the code below return me the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expect...

SubSonic 2.2 SqlQuery object generates very different sql for WHERE...IN statement for SQL Server 2008 and SQL Server 2005

Does anybody have an idea why SubSonic 2.2 SubSonic.SqlQuery object would be generating very different sql for the same C# code when running against SQL Server 2005 or SQL Server 2008? I have a site that's been running for a while on SubSonic 2.2/SQL Server 2005. I just upgraded the DB to mssql 2008 and am encountering the following er...

PHP Parse Error; Drupal6 Deployment

I had a Drupal installation at www.example.com/test. Now, it's ready to go live, and I am trying to move it to www.example.com. I changed the line in sites/default/settings.php to: $base_url = 'http://www.example.com/'; // NO trailing slash! When I navigate to my index.php, I get all sorts of parse errors, like this: Parse error: sy...

How do I find the compilation error in this Perl statement?

I have this code: my $orig_file_size = -s $file ; Is throwing an error: syntax error at ftp_4 line 33, near "$orig_file_size)" Execution of ftp_4 aborted due to compilation errors. Here is some more code: my $host ='hpp411'; my $user ='sonalg'; my $pw ='Unix11!'; my $file ='ftp_example.p_1'; my $path ='/enbusers3.p411/vdx/...

Why is this Haskell incorrect?

I have a Haskell file which looks like this: longest::[Integer]->[Integer]->[Integer] max a b = if length a > length b then a else b llfs::[Integer]->Integer llfs li = length(foldl longest group(li)) llfs([1, 2, 3, 3, 4, 5, 1, 1, 1]) Which should print out the result of the function call at the end, however when I run the file I get...

Python: Invalid Syntax with test data using Pyparser

Using pyparser, I am trying to create a very simple parser for the S-Expression language. I have written a very small grammar. Here is my code: from pyparsing import * alphaword = Word(alphas) integer = Word(nums) sexp = Forward() LPAREN = Suppress("(") RPAREN = Suppress(")") sexp << ( alphaword | integer | ( LPAREN + ZeroOr...

How do I fix the perl syntax error "missing right curly or square bracket" using VIM?

Compiling (or executing) a perl program with unmatched array braces ("[ ]") or scope brackets ("{ }") causes the "missing right curly or square bracket" syntax error. Perl often reports the source as your last code line ("at EOF"), which could be far removed from the actual missing piece. Example perl error message: Missing right curly...

Bash Scripting " [!: not found " errors, and how to write an or statement [Solved]

[Solved] See post by Dave Kirby. EDIT: Here is my updated code: #!/bin/sh files=`ls` if [ $# -ne 1 -o -f $1 ] then echo "Usage: $0 <directory>" exit 1 fi if [ ! -e $1 ] then echo "$1 not found" exit 1 elif [ -d $1 ] then cd $1 for f in $files do if [ ! -d "$f" ] then if [ ! -...