Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 61/448 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • Why do some people prefer "T const&" over "const T&"?

    - by Michael Aaron Safyan
    So, I realize that const T& and T const& are identical and both mean a reference to a const T. In both cases, the reference is also constant (references cannot be reassigned, unlike pointers). I've observed, in my somewhat limited experience, that most C++ programmers use const T&, but I have come across a few people who use T const&. Is this just a personal preference? Why is one chosen over the other?

    Read the article

  • JQuery Syntax Problem?

    - by Michael Smith
    I am using JQuery to insert divs into a page but i cant seem to get the quotation marks correctly setup. For example the code below works fine: var newDiv_1 = '<div id="event_1"><b>Hello World 01</b></div>'; $('#mon_Events').append(newDiv_1); But when i try to use variable in place of the normal text, i doesnt seem to work: var eventname = 1; var newDiv_1 = '<div id="event_' . eventName . '"><b>Hello World 01</b></div>'; $('#mon_Events').append(newDiv_1); How do i use variable inside this statement?

    Read the article

  • Simple question about C++ constant syntax

    - by WilliamLou
    Here is some code copied from Thinking in C++ Vol1 Chapter 10. #include <iostream> using namespace std; int x = 100; class WithStatic { static int x; static int y; public: void print() const { cout << "WithStatic::x = " << x << endl; cout << "WithStatic::y = " << y << endl; } }; what's the meaning of const for the function print()? Thanks!

    Read the article

  • Perl - getting a value from a hash where the key has a dot

    - by imerez
    I have a hash in Perl which has been dumped into from some legacy code the name of the key has now changed from simply reqHdrs to reqHdrs.bla $rec->{reqHdrs.bla} My problem is now I cant seem to access this field from the hash any ideas? The following is my error Download Script Output: Bareword "reqHdrs" not allowed while "strict subs" in use

    Read the article

  • Javascript/JQuery if statement

    - by Samuurai
    This is probably pretty simple, but I can't figure out how to do it: I have this code: $.post("/admin/contract", { 'mark_paid' : true, 'id' : id }, In pseudo code, how can I do this: $.post("/admin/contract", { 'mark_paid' : true, 'id' : id, if(is_set(dont_email)) {print 'dont_email' : true} },

    Read the article

  • Which is the correct way to use PDO in PHP?

    - by Runner
    One from here: $sth->execute(array(':calories' => $calories, ':colour' => $colour)); The other from here: /*** reassign the variables again ***/ $data = array('animal_id'=>4, 'animal_name' => 'bruce'); /*** execute the prepared statement ***/ $stmt->execute($data); My question is: :key or key ? Sorry I don't have the PHP environment here.

    Read the article

  • SQL SERVER FOR XML SYNTAX

    - by Raj73
    How can I get an output as follows using FOR XML / sql query. I am not sure how I can get the Column Values as Elements instead of the tables' column Names. I am using sql server 2005 I HAVE TABLE SCEMA AS FOLLOWS CREATE TABLE PARENT ( PID INT, PNAME VARCHAR(20) ) CREATE TABLE CHILD ( PID INT, CID INT, CNAME VARCHAR(20) ) CREATE TABLE CHILDVALUE ( CID INT, CVALUE VARCHAR(20) ) INSERT INTO PARENT VALUES (1, 'SALES1') INSERT INTO PARENT VALUES (2, 'SALES2') INSERT INTO CHILD VALUES (1, 1, 'FOR01') INSERT INTO CHILD VALUES (1, 2, 'FOR02') INSERT INTO CHILD VALUES (2, 3, 'FOR03') INSERT INTO CHILD VALUES (2, 4, 'FOR04') INSERT INTO CHILDVALUE VALUES (1, '250000') INSERT INTO CHILDVALUE VALUES (2, '400000') INSERT INTO CHILDVALUE VALUES (3, '500000') INSERT INTO CHILDVALUE VALUES (4, '800000') The Output I am looking for is as follows <SALE1> <FOR01>250000</FOR01> <FOR02>400000</FOR02> </SALE1> <SALE2> <FOR03>500000</FOR03> <FOR04>800000</FOR04> </SALE2>

    Read the article

  • error C2146: syntax error : missing ';' before identifier 'g_App'

    - by numerical25
    I wish c++, was a little more specific on the messages they give. The following error is being thrown in the document below main.h #ifndef main_h #define main_h //includes #include <windows.h> #include <commctrl.h> #include <d3d9.h> #include <fstream> #include "capplication.h" //constants #define TITLE "D3D Tut 01: Create Window" #define WINDOW_X 350 #define WINDOW_Y 320 //Button ID's #define ID_START 1 #define ID_CANCEL 2 //globals extern CApplication g_App; //function prototypes LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM); #endif The only header file that could possible throw this error is the capplication.h. given below capplication.h #ifndef capplication_h #define capplication_h #include"main.h" class CApplication { public: CApplication(void); ~CApplication(void); void InitWindow(void); void SaveSettings(void); void LoadSettings(void); void KillWindow(void); inline bool GetWindowStatus(void) { return m_bRunningWindow; } inline HWND GetWindowHandle(void) { return m_hWindow; } inline void SetWindowStatus(bool bRunningWindow) { m_bRunningWindow = bRunningWindow; } private: bool m_bRunningWindow; HWND m_hWindow, m_hBtnStart, m_hBtnCancel, m_hLblResolution, m_hCbResolution, m_hLblBackBuffer, m_hCbBackBuffer, m_hLblDepthStencil, m_hCbDepthStencil, m_hLblVertexProcessing, m_hCbVertexProcessing, m_hLblMultiSampling, m_hCbMultiSampling, m_hLblAnisotropy, m_hCbAnisotropy; DWORD m_dwWidth, m_dwHeight, m_dwVertexProcessing, m_dwAnisotropy; D3DFORMAT m_ColorFormat, m_DepthStencilFormat; D3DMULTISAMPLE_TYPE m_MultiSampling; }; #endif Besides that, the only suspicious thing I see is fstream given in the first code. I did have it as fstream.h But VC++ was not recognizing it so I was told to remove the h and I did. now I am down to this error. and I have no clue what it could be. Possibly something obvious

    Read the article

  • mysql_connect()

    - by Jacksta
    I am trying to connect to mysql and am getting an error. I put my servers ip address in and used port 3306 whihch post should be used? <?php $connection = mysql_connect("serer.ip:port", "user", "pass") or die(mysql_error()); if ($connection) {$msg = "success";} ?> <html> <head> </head> <body> <? echo "$msg"; ?> </body> </html> Here is the error its producing Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'server1.myserver.com' (using password: YES) in /home/admin/domains/mydomain.com.au/public_html/db_connect.php on line 3 Access denied for user 'admin'@'server1.myserver.com' (using password: YES)

    Read the article

  • rails multiple outer joins syntax

    - by Craig McGuff
    I have the following models user has_many :leave_balances leave_balance belongs_to :user belongs_to :leave_type leave_type has_many :leave_balances I want to output a table format showing user names and their balance by leave type. Not every user can have every balance i.e. outer joins required. I'd like to see something like this: Employee Annual Leave Sick Leave Bob 10 Fred 9 Sara 12 15 I am unsure how to get this out as a single statement? I am thinking something like User.joins(:leave_balances).joins(:leave_type)

    Read the article

  • gedit underscore as a word_character

    - by dreftymac
    Is it possible to configure gedit to treat the underscore character as a word character? Currently, it appears that the editor treats "two_words" as two separate words when selecting, instead of a single word as in many other mainstream text editors.

    Read the article

  • Javascript Illegal Token Error

    - by Pete Herbert Penito
    Forgive me if this is a simple problem but I can't seem to find why this code: function create_content(c) { var html = "<div id='header'>"+c+"</div>"; if(c == "links") { var ul = "<ul><li><a href='http://www.mylink.com'>My Link 1</a></li> <li><a href='http://www.mylink2.co.uk'>My Link 2</a></li></ul>"; html = html + ul; } return(html); } Is giving me this error in Chrome (win): Uncaught SyntaxError: Unexpected token ILLEGAL On the line that starts with "var ul = " Any advice would help thanks!

    Read the article

  • Syntax for documenting JSON structure

    - by Roman A. Taycher
    So I'm trying to document the format of the json returned by an api I am writing against and I'd like to know if there is any popular format for the documentation of json structure. Note I'm not trying to to test or validate anything, I'm just using this for documentation. Also some ways to add comments to non-constants(items always returned w/ the same value) would be nice. This the not totally thought out scheme I'm currently using: Plain names refer to identifiers or types. Some types have type-comment Strings that appear to be constant(always returned for that type of request) strings are "str" Constant Numbers would be just the number Constant null is null Booleans are true/false for constant booleans or Boolean otherwise [a,b,c] are lists with 3 items a,b,c [... ...] is a list of repeating elements of some types/constants/patterns {a:A,b:B,c:c} and {... ...} is the same for a dictionary. example: story := [header,footer] header := {"data":realHeader,"kind":"Listing"} realHeader := {"after": null, "before": null, "children": [{"data": realRealHeader, "kind": "t3"}], "modhash": ""} footer := {"data":AlmostComments,"kind":"Listing"} AlmostComments := {"data": {"after": null, "before": null, "children": comments, "modhash": ""}, "kind": "t1"} comments := [...{"data":comment, "kind":"t1"}...] realRealHeader := {"author": string, "clicked": boolean, "created": int, "created_utc": int, "domain": "code.reddit.com", "downs": int, "hidden": boolean, "id": string-id, "is_self": boolean, "levenshtein": null, "likes": null, "media": null, "media_embed": { }, "name": string-id, "num_comments": int, "over_18": false, "permalink": string-urlLinkToStoryStartingFrom/r, "saved": false, "score": int, "selftext": string, "selftext_html": string-html, "subreddit": string-subredditname, "subreddit_id": string-id, "thumbnail": "", "title": string, "ups": int, "url": "http://code.reddit.com/" } comments := { "author": string, "body": string-body_html-wout-html, "body_html": string-html-formated, "created": int, "created_utc": int, "downs": int, "id": string-id, "levenshtein": null, "likes": null, "link_id": string-id, "name": string-id", "parent_id": string-id, "replies": AlmostComments or null, "subreddit": string-subredditname, "subreddit_id": string-id, "ups": int }

    Read the article

  • What's wrong with my logic (Java syntax)

    - by soda
    I'm trying to make a simple program that picks a random number and takes input from the user. The program should tell the user if the guess was hot (-/+ 5 units) or cold, but I never reach the else condition. Here's the section of code: public static void giveHint (int guess) { int min = guess - 5; int max = guess + 5; if ((guess > min) && (guess < max)) { System.out.println("Hot.."); } else { System.out.println("Cold.."); } }

    Read the article

  • Surely a foolish error, but I can't see it

    - by dnagirl
    I have a form (greatly simplified): <form action='http://example.com/' method='post' name='event_form'> <input type='text' name='foo' value='3'/> <input type='submit' name='event_submit' value='Edit'/> </form> And I have a class "EventForm" to process the form. The main method, process() looks like this: public function process($submitname=false){ $success=false; if ($submitname && isset($_POST[$submitname])){ //PROBLEM: isset($_POST[$submitname] is always FALSE for some reason if($success=$this->ruler->validate()){//check that dependancies are honoured and data types are correct if($success=$this->map_fields()){//divide input data into Event, Schedule_Element and Temporal_Expression(s) $success=$this->eventholder->save(); } } } else {//get the record from the db based on event_id or schedule_element_id foreach($this->gets as $var){//list of acceptable $_GET keys if(isset($_GET[$var])){ if($success= $this->__set($var,$_GET[$var])) break; } } } $this->action=(empty($this->eventholder->event_id))? ADD : EDIT; return $success; } When the form is submitted, this happens: $form->process('event_submit'); For some reason though, isset($_POST['event_submit']) always evaluates to FALSE. Can anyone see why?

    Read the article

  • Ruby - model.rb:20: syntax error, unexpected keyword_end, expecting $end

    - by Yasir Adnan
    I don't understand what's wrong with my code. model.rb require 'Gemfile' DataMapper.setup(:default, 'mysql://root:password@localhost/rengine') Class User include DataMapper::Resource property :id, Serial # An auto-increment integer key property :email, String, format: :email_address property :username, String, required: true property :password, String , length: 10..255, required: true property :created_at, DateTime property :updated_at, DateTime #User can have mutiple posts has n, :posts end Class Post include DataMapper::Resource property :id, Serial # An auto-increment integer key property :title, String, required: true property :body, Text, required: true property :created_at, DateTime property :updated_at, DateTime #Posts belongs to a USer belongs_to :user end DataMapper.auto_upgrade! I didn't able to figure out. What's problem is here??

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >