syntax

typedef declaration syntax

Some days ago I looked at boost sources and found interesting typedef. There is a code from "boost\detail\none_t.hpp": namespace boost { namespace detail { struct none_helper{}; typedef int none_helper::*none_t ; } // namespace detail } // namespace boost I didn't see syntax like that earlier and can't explain the sense of that....

GRANT with database name wildcard in MySQL?

I want to create a user 'projectA' that has the same permissions to every database named 'projectA_%' I know its possible but MySQL doesn't like my syntax: grant all on 'projectA\_%'.* to 'projectA'@'%'; Reference: http://dev.mysql.com/doc/refman/5.1/en/grant.html ...

Best way to represent Bit Arrays in C#??

Hi all, I am currently building a DHCPMessage class in c#. RFC is available here : http://www.faqs.org/rfcs/rfc2131.html Pseudo public object DHCPMessage { bool[8] op; bool[8] htype; bool[8] hlen; bool[8] hops; bool[32] xid; bool[16] secs; bool[16] flags; bool[32] ciaddr; bool[32] yiaddr; bool[...

Representing dependencies file syntax

I'm looking for a simple way to represent simple dependencies in a file. Preferably I'd like to use some format with a syntax already defined (e.g. JSON, YAML, etc). I'm leaning towards graphviz's dot syntax digraph { A -> B; A -> C; B -> D; } Are there any other ways to do this? This will be for user's to write simple d...

Why are Hexadecimal Prefixed as 0x?

Why are Hexadecimal Prefixed as 0x and not anything else? I understand the usage of prefix but I dont understand the significance of 0x. ...

SQL Select syntax error

hi guys thanks for your help yesterday. I am now trying to incorporate the query from yesterday into an existing query so I can show the highest itemcode's reporting group in the existing query..but I have a syntax error somewhere at my Select statement. ERROR: Keyword SELECT not expected. I have tried putting brackets at every possibl...

Script tag in XHTML

Hi, This might sound like a reaaaally dumb question but... why do browsers have a fit with this syntax: <script type='text/javascript' src="/path/to/my.js" /> and want this instead <script type='text/javascript' src="/path/to/my.js"></script> Seems the first construct should be valid since there's no inner content to the tag.. ?...

How can I read from a method that returns a filehandle in Perl?

I have an object with a method that returns a filehandle, and I want to read from that handle. The following doesn't work, because the right angle bracket of the method call is interpreted as the closing angle bracket of the input reader: my $input = <$object->get_handle()>; That gets parsed as: my $input = ( < $object- > ) get_handl...

What should be the correct javascript syntac in this case?

I have a code that is a mmix of html and js. I cannot get it correct. location.description + '<br><a href="javascript:void(0);" onclick="showStreet;">ShowStreet </a><br>'+ location.lat + '<br> + location.lng Can anyone help me with it? ...

Global declarations are illegal in Verilog 2001 syntax!

I have written something small in verilog: `define LW 6'b100011 `define SW 6'b101011 parameter [3:0] i_fetch = 4'b0001, decode_rr = 4'b0010, mem_addr = 4'b0100, alu_exec = 4'b1000; and i am getting this error: Error: test.v(5): (vlog-2155) Global declarations are illegal in Verilog 2001 syntax. What I am doing wrong...

How to check PHP filecode syntax in PHP?

Hi, I am in a need of running the PHP parser for PHP code inside PHP. I am on Windows, and I have tried system("C:\\Program Files (x86)\\PHP\\php.exe -l \"C:/Program Files (x86)/Apache/htdocs/a.php\"", $output); var_dump($output); without luck. The parameter -l should check for correct PHP syntax, and throw errors if some problems ex...

iPhone: Expected '{' before '(' token.

Hi there, I'm currently developing an iPhone application, and when it comes to compiling, I have the aforementioned error. Here's the block of code it's on: -(void)tableView(UITableView *)tableView{ didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NextViewController *nextController = [[NextViewController alloc] ...

Which is the correct way to use PDO in PHP?

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 environm...

variables in batch scripts

I'm trying to set up a batch file to automatically deploy a php app to a web server. Basically, what I want is an entirely automated process: I would just give it a revision number from the repository and it would then export the files, upload via ftp and then update deployment info at the repo host (codebase). However, I'm starting ...

Why JavaScript Statement "ga = ga || []" Works?

Below javascript statements will cause error, if ga is not declared. if (ga) { alert(ga); } The error is: ga is not defined It looks undeclared variable cannot be recognized in bool expression. So, why below statement works? var ga = ga || []; To me, the ga is treated as bool value before "||". If it is false, expression afte...

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

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($...

.htaccess: RewriteCond syntax?

I'm using Drupal 6. Typically, when the user requests a URL for which Drupal has no response, it uses index.php as the error document. However, I'd like to suspend this behavior for a specific URL. How can I do this? RewriteCond %{REQUEST_FILENAME} !=fail RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d ...

SQL syntax Newbie student

Describe the output of the following SQL query: select custId, name from customer where region = "New York" UNION select cust.custId, cust.name from customer cust where cust.custId IN (select cust_order.custId from customer_order cust_order, company_employee comp_emp where cust_order.salesEmpId = comp_emp.empId AND comp_emp.name = 'DAN...

Retrieving data from enumerated JSON sub arrays in Javascript without getJSON

I'm new to JSON and ajax, but i'm trying to access data in an array where the items are enumerated in a sub array within another sub array. I run into problems with I try to access something like data.items[0].details.specs[1].name data.items[0].details.specs[1].id data.items[0].details.specs[2].name data.items[0].details.specs[2].id et...

Python syntax error: can't assign to operator in module but works in interpreter

I have a string a and I would like to split it in half depending on its length, so I have a-front = len(a) / 2 + len(a) % 2 this works fine in the interpreter but when i run the module from the command line python gives me a SyntaxError: can't assign to operator. What could be the issue here. ...