Search Results

Search found 6186 results on 248 pages for 'syntax'.

Page 20/248 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • syntax error in python:

    - by pecker
    Hello, I'm learning python. It gives syntax error in this script. I'm unable to figure out. import exceptions class FOUND(Exception): pass x = [1,2,3,4,56,73,29,35,12,32,63,12,76,75,89] while True: test = int(raw_input('Enter integer to be checked in list:')) try: count = -1 for y in x: count += 1 if y == test: raise FOUND except ValueError,e: print "Not a valid integer (%d)"%(e) except FOUND: print "Found (%d) at (%d)"%(test,count) else: print "Not found ,Appending (%d) to list at location (%d)"%(test,count+1) x.append(test) finally: print "The List:" print x print " " Invalid syntax & it highlights comma in this line: 'except ValueError,e:'

    Read the article

  • scala syntax highlighting in bluefish

    - by Synesso
    Scala comes packaged with bluefish syntax config in misc/scala-tool-support/bluefish/ I have attempted to configure this, as per the README, but there is no effect. cp ~/.bluefish/highlighting ~/.bluefish/highlighting_ cat ~/.bluefish/highlighting_ /opt/scala/scala-2.7.7.final/misc/scala-tool-support/bluefish/highlighting > ~/.bluefish/highlighting I have ensured highlighting is turned on in the bluefish config. I have not used bluefish before and am trying it for the first time because there is syntax highlighting support for it. The README says any file I open that has a .scala extension will have the scala highlighting applied. Instead I see no highlighting.

    Read the article

  • HAML-like syntax for non-HTML documents?

    - by Peter
    I love using HAML for HTML documents. It has clean syntax that's much more attractive than ERB. It works perfectly for HTML documents. What about for non-HTML? Such as, for example, an email or text document with certain automatically-substituted components? I've been falling back to ERB, but don't like the heavy syntax compared to HAML. Is there any way to use HAML for ordinary documents without having divs and html elements appear when % and . start a line? Or is there some alternative to both HAML and ERB that I should investigate?

    Read the article

  • SQLAlchemy declarative syntax with autoload in Pylons

    - by Juliusz Gonera
    I would like to use autoload to use an existings database. I know how to do it without declarative syntax (model/_init_.py): def init_model(engine): """Call me before using any of the tables or classes in the model""" t_events = Table('events', Base.metadata, schema='events', autoload=True, autoload_with=engine) orm.mapper(Event, t_events) Session.configure(bind=engine) class Event(object): pass This works fine, but I would like to use declarative syntax: class Event(Base): __tablename__ = 'events' __table_args__ = {'schema': 'events', 'autoload': True} Unfortunately, this way I get: sqlalchemy.exc.UnboundExecutionError: No engine is bound to this Table's MetaData. Pass an engine to the Table via autoload_with=<someengine>, or associate the MetaData with an engine via metadata.bind=<someengine> The problem here is that I don't know where to get the engine from (to use it in autoload_with) at the stage of importing the model (it's available in init_model()). I tried adding meta.Base.metadata.bind(engine) to environment.py but it doesn't work. Anyone has found some elegant solution?

    Read the article

  • C++: Templates for static functions?

    - by Rosarch
    I have a static Utils class. I want certain methods to be templated, but not the entire class. How do I do this? This fails: #pragma once #include <string> using std::string; class Utils { private: template<class InputIterator, class Predicate> static set<char> findAll_if_rec(InputIterator begin, InputIterator end, Predicate pred, set<char> result); public: static void PrintLine(const string& line, int tabLevel = 0); static string getTabs(int tabLevel); template<class InputIterator, class Predicate> static set<char> Utils::findAll_if(InputIterator begin, InputIterator end, Predicate pred); }; Error: utils.h(10): error C2143: syntax error : missing ';' before '<' utils.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int utils.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int utils.h(10): error C2238: unexpected token(s) preceding ';' utils.h(10): error C2988: unrecognizable template declaration/definition utils.h(10): error C2059: syntax error : '<' What am I doing wrong? What is the correct syntax for this? Incidentally, I'd like to templatize the return value, too. So instead of: template<class InputIterator, class Predicate> static set<char> findAll_if_rec(InputIterator begin, InputIterator end, Predicate pred, set<char> result); I'd have: template<class return_t, class InputIterator, class Predicate> static return_t findAll_if_rec(InputIterator begin, InputIterator end, Predicate pred, set<char> result); How would I specify that: 1) return_t must be a set of some sort 2) InputIterator must be an iterator 3) InputIterator's type must work with return_t's type. Thanks.

    Read the article

  • Flash error 1084: "Syntax error"

    - by Elliot Broomhall
    Hi I'm getting two error messages in Flash when using actionscropt 3.0 "Topbar,Layer 'Action Layer',Frame 1,line 12 1084: syntax error: expection semicolon before add. "Topbar,Layer 'Action Layer',Frame 1,line 12 1084: syntax error: expection rightbrace before semicolon Here is my code could anyone give some insight to what is actually happening thanks and help on rectifying the issue thanks. clip = Number(random(7)) + 1; while (Number(clip) <= 7) { clip = Number(clip) + 1; Scale = Number(random(80)) + 1; setProperty("/star", _x, Number(random(800)) + 10); setProperty("/star", _rotation, Number(random(330)) + 50); setProperty("/star", _xscale, Scale); setProperty("/star", _yscale, Scale); setProperty("/star", _y, Number(random(800)) + 50); n = Number(n) + 1; bn = "star" add n; duplicateMovieClip("star", bn, n); set(bn add ":n", n); } // end while clip = "0";

    Read the article

  • SQLite subquery syntax/error/difference from MySQL

    - by Rudie
    I was under the impression this is valid SQLite syntax: SELECT *, (SELECT amount AS target FROM target_money WHERE start_year <= p.bill_year AND start_month <= p.bill_month ORDER BY start_year ASC, start_month ASC LIMIT 1) AS target FROM payments AS p; But I guess it's not, because SQLite returns this error: no such column: p.bill_year What's wrong with how I refer to p.bill_year? Yes, I am positive table payments hosts a column bill_year. Am I crazy or is this just valid SQL syntax? It would work in MySQL wouldn't it?? I don't have any other SQL present so I can't test others, but I thought SQLite was quite standardlike.

    Read the article

  • Where to put conditionals in ANSI-syntax SQL queries

    - by RenderIn
    What's the difference between these two queries? I've been resistant to jumping on the ANSI-syntax bandwagon because I have not been able to unravel various syntactical ambiguities. Is 1) returning the product of the join and only then filtering out those joined records which have weight = 500? And is 2) filtering out those prior to the join? Is 2 bad syntax? Why might I use that? 1: SELECT SOMETHING FROM FOO INNER JOIN BAR ON FOO.NAME = BAR.NAME WHERE BAR.WEIGHT < 500 2: SELECT SOMETHING FROM FOO INNER JOIN BAR ON FOO.NAME = BAR.NAME AND BAR.WEIGHT < 500

    Read the article

  • Syntax Error with MySQL 5.1 Server

    - by Mr.Z
    I am trying to connect to a server remotely using the command line client window. I am using MySQL 5.1 and I do not know why I am getting syntax error. If you can help me, that would be much appreciated. username as user password as pass hostname as example.com I have tried: mysql> -u user -h example.com -p ; mysql> -h example.com -u user -p ; I have looked at the reference manual and other verisons of remote connection with Server 5.1 but I can't see the syntax error.

    Read the article

  • Oracle (Old?) Joins - A tool for conversion?

    - by Grasper
    I have been porting oracle selects, and I have been running across a lot of queries like so: SELECT e.last_name, d.department_name FROM employees e, departments d WHERE e.department_id(+) = d.department_id; ...and: SELECT last_name, d.department_id FROM employees e, departments d WHERE e.department_id = d.department_id(+); Are there any guides/tutorials for converting all of the variants of the (+) syntax? What is that syntax even called (so I can scour google)? Even better.. Is there a tool that will do this conversion for me? When was this standard phased out? Any info is appreciated.

    Read the article

  • #ifndef syntax for include guards in C++

    - by PhADDinTraining
    I'm currently studying for a CS course's final exam and I've run into a minor (maybe major?) issue regarding the syntax of C++ #ifndef. I've looked at the syntax for #infndef when using it as an #include guard, and most on the web seem to say: #ifndef HEADER_H #include "header.h" ... #endif But my class's tutorial slides show examples as: #ifndef __HEADER_H__ #include "header.h" ... #endif I was wondering what (if any) the difference was between the two. The exam will most likely ask me to write an #include guard, and I know conventional wisdom is to just go with what the prof / tutor says, but if there's a difference during compilation I'd like to know. Thanks all!

    Read the article

  • Eclipse: Double semi-colon on an import

    - by smp7d
    Using Eclipse, if I have an extra semicolon on an import line (not the last import line), I see a syntax error in the IDE. However, this compiles fine outside of the IDE (Maven in this case). Example: import java.util.ArrayList;; //notice extra semicolon import java.util.List; Does anyone else see this behavior? Why is this showing as a syntax error? I am working with someone who keeps pushing these this to source control and it is irritating me (they clearly aren't using Eclipse). Full disclosure... I am using SpringSource Tool Suite 2.8.0.

    Read the article

  • Shell Scripting For loop Syntax Error

    - by NewShellScripter
    Hello, I am trying to make a simple shell script to ping a source but I am getting bash-2.03$ ./test.sh google.com 10 .5 /home/users/me 16 256 ./test.sh: line 35: syntax error near unexpected token `((' ./test.sh: line 35: `for (( i = 1 ; i <= $totalArguments ; i++ ))' This is the code: #!/bin/bash ip=$1 count=$2 interval=$3 outputDirectory=$4 shift; shift; shift; shift; totalArguments=$# for (( i = 1 ; i <= $totalArguments ; i++ )) do ping -c $count -i $interval -s ${!i} $ip >> $outputDirectory/${!i}results.txt done Can someone tell me what I am doing wrong with the for loop syntax? Thanks!

    Read the article

  • Correct syntax for matching a string inside a variable against an array

    - by Jamex
    Hi, I have a variable, $var, that contains a string of characters, this is a dynamic variable that contains the values from inputs. $var could be 'abc', or $var could be 'blu', I want to match the string inside variable against an array, and return all the matches. $array = array("blue", "red", "green"); What is the correct syntax for writing the code in php, my rough code is below $match = preg_grep($var, $array); (incorrect syntax of course) I tried to put quotes and escape slashes, but so far no luck. Any suggestion? TIA

    Read the article

  • Syntax Highlighting in a ListBox

    - by ph0enix
    Hi all, I've searched the web and I can't seem to find anything that will work for me. I've seen plenty of discussion, and even some fairly extensible open-source tools, for code editors that provide line numbers and syntax highlighting. Here's my dilemma... I'm working on a "digital code review" project in C#.NET that allows users to specify source files, add them to a particular session, and other users can make comments and line references to the files being reviewed. Basic requirements: Must be written in C#.NET I don't need to be able to edit the text in the text box Users need to be able to select a line (or multiple lines), to make line references. It seems to me that I need some fancy implementation of a ListBox control (not a drop-down list) that has some OwnerDraw capabilities to add line numbers and syntax highlighting. Unfortunately, I haven't had any luck putting it together myself, and I can't seem to find a control that's already been written or a reference on how I might be able to accomplish this. Any suggestions??

    Read the article

  • 42000 Syntax error in query when executing prepared statement

    - by Griff McGriff
    I have been pulling my hair out trying to swap my current script over to PDO. I have simplified the MySQL query for this example, but the error remains even with this version. $sql = 'SELECT * FROM :table WHERE lastUpdate > :appDate'; try{ $db = connect(); $stmt = $db->prepare($sql); $stmt->bindParam(':table', $table); $stmt->bindParam(':appDate', $appDate); foreach($tablesToCheck as $table){ $stmt->execute(); $resultset[] = $stmt->fetchAll(); } } catch(PDOException $e){ print 'Error!: '.$e->getMessage().'<br/>'; }//End try catch $stmt-errorInfo() returns: ( [0] => 42000 [1] => 1064 [2] => 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 ''GroupName' WHERE lastUpdate > NULL' at line 1 )

    Read the article

  • What is your favorite colorscheme FOR PROGRAMMING in Vim?

    - by ThomasGHenry
    I think this is a relevant question for programmers and I'd like to hear other people's answers because some syntax highlighting color schemes are better on the eyes than others. This can affect productivity as much as ergonomic keyboards or anything else on here. It's about comfort and productivity. So, I'm curious. Do you find some color schemes better adapted for some languages over others? At the other end of the spectrum, I think coding without syntax highlight is awful and slow going. Does anyone work better like this? Thanks! EDIT: so we'll try it as a community wiki. Similar Question

    Read the article

  • Shell script syntax error: unexpected end of line

    - by user1557674
    I wrote a simple shell script to check for the existence of a xml file and if it exists, then rename an old xml file to be backup and then move the new xml file to where the old xml file was stored. #!/bin/sh oldFile="/Documents/sampleFolder/sampleFile.xml" newFile="/Documents/sampleFile.xml" backupFileName="/Documents/sampleFolder/sampleFile2.backup" oldFileLocation="/Documents/sampleFolder" if [ -f "$newFile" ] ; then echo "File found" #Rename old file mv $oldFile $backupFileName #move new file to old file's location mv $newFile $oldFileLocation else echo "File not found, do nothing" fi However, every time I try to run the script, I get 4 command not found messages and a syntax error: unexpected end of file. Any suggestions on why I get these command not found errors or the unexpected end of file? I double checked that I closed all my double quotes, I have code highlight :) EDIT: output from running script: : command not found: : command not found: : command not found1: : command not found6: replaceXML.sh: line 26: syntax error: unexpected end of file

    Read the article

  • Can the template parameters of a constructor be explicitly specified?

    - by sth
    A constructor of a class can be a template function. At the point where such a constructor is called, the compiler usually looks at the arguments given to the constructor and determines the used template parameters from them. Is there also some syntax to specify the template parameters explicitly? A contrived example: struct A { template<typename T> A() {} }; Is there a way to instantiate this class? What is the syntax to explicitly specify the constructor's template parameters? My use case would be a problem were the compiler doesn't seem to find the correct templated constructor. Explicitly specifying the template parameters would probably generate more useful error messages or even resolve the problem.

    Read the article

  • Multisystem Script won't work! "Syntax error:redirection unexpected" Worked 2 days ago?

    - by user74005
    this is my first question. I use Multisystem all of the time and have installed it on both Kubuntu and Ubuntu and have used it with no issues. I wiped my hard drive to try some new OSs I'm now using the exact same OS (Ubuntu 12.05) I used to load my USB stick to begin with and now I'm getting this ridiculous syntax error. I know the script is correct, I'm following the exact same steps I used to get to this point and I'm getting different results ?!?! I'm very confused by this. I have no clue how to begin addressing this issue. I get the same syntax error on Kubuntu now too, which did have multisystem installed. I run "sh install-depot-multisystem.sh" and get "Syntax error:redirection unexpected", this worked literally 2 days ago. The only thing that has changed is my face has grown some more facial hair and my head hurts from bangin it against the wall over this issue. The OS is exactly the same, the script is the same; but now it won't install. I'm lost and really hoping someone can help. Append Just to append to this a bit https://lists.ubuntu.com/archives/ub...er/000264.html I needed to do a chmod 777 on the script, I'm still getting a syntax error on Kubuntu...but it did install successfully. I'll mark this as resovled! Thanks anyway, I'll try to spruse up on my Linux skills.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >