syntax

Using a std::set in a class?

I am trying to combine using a std::set and a class, like this: #include <set> class cmdline { public: cmdline(); ~cmdline(); private: set<int> flags; // this is line 14 }; but, it doesn't like the set flags; part: cmdline.hpp:14: error: ISO C++ forbids declaration of 'set' with no type cmdline.hpp:1...

In regex, what does \w* mean?

In Python. r^[\w*]$ whats that mean? ...

How to use ? and ?: and : in REGEX for Python?

I understand that * = "zero or more" ? = "zero or more" ...what's the difference? Also, ?: << my book uses this, it says its a "subtlety" but I don't know what exactly these do! ...

What does "FunctionName(bool() args)" mean in C#?

Can someone tell me what FunctionName(bool() args) means in C#? ...

Variable number of parameters in function in C++

How I can have variable number of parameters in my function in C++. Analog in C#: public void Foo(params int[] a) { for (int i = 0; i < a.Length; i++) Console.WriteLine(a[i]); } public void UseFoo() { Foo(); Foo(1); Foo(1, 2); } Analog in Java: public void Foo(int... a) { for (int i = 0; i < a.length; i+...

Blogger template: Style blog post based on label

Hello, I'm trying to change the style of a blog post (for instance change the title color), based on the labels associated to the post. I'm a bit new to the templating, so I though I would be going to add a class with the label in the title <h3> element, and then add my CSS rules. So I found this which would generate a proper list of ...

why can't we define a variable inside a while loop?

we can do: using (Stream s ..) and: for (int i ...) why can't we as well do something like: while ((int i = NextNum()) > 0) {..} i find it very useful and sensible. ...

Why is the 'Use of "shift" without parentheses is ambiguous' warning issued by Perl?

Does anyone know what parsing or precedence decisions resulted in the warning 'Use of "shift" without parentheses is ambiguous' being issued for code like: shift . 'some string'; # and not (shift) . 'some string'; # or shift() . 'some string'; Is this intentional to make certain syntactic constructs easier? Or is it merely an artif...

C function syntax, parameter types declared after parameter list

I'm relatively new to C. I've come across a form of function syntax I've never seen before, where the parameter types are defined after that parameter list. Can someone explain to me how it is different than the typical C function syntax? Example: int main (argc, argv) int argc; char *argv[]; { return(0); } ...

Can you take a reference of a builtin function in Perl?

What syntax, if any, is able to take a reference of a builtin like shift? $shift_ref = $your_magic_syntax_here; The same way you could to a user defined sub: sub test { ... } $test_ref = \&test; I've tried the following, which all don't work: \&shift \&CORE::shift \&{'shift'} \&{'CORE::shift'} Your answer can include XS if need...

Jquery .live works but not with .datepicker

Thanks for looking, all sincerely helpful answers are up-voted. I have some date input fields that are there when the page loads and a bunch that get generated dynamically. Instead of calling .datepicker() on that class each time a new instance is generated, I'm using .live, but it doesn't seem to be working. Any idea why? $("input[name...

<?php vs <? ...Does it matter?

Possible Duplicate: Are PHP short tags acceptable to use? <?php //Some code ?> or <? //Some code ?> I know the first way is the proper way but PHP code isn't validated. So, besides it saving extra typing & bytes, does it matter? update Thanks for the replies... I had no idea they were called short tags (hence why...

How can I simplify this jquery/javascript

I'm trying to improve my jquery/javascript syntax. Is there a better way to write this? if (ok) var mymsg = '<p id="ok-box">' + "You're good to go" + '</p>'; }else { var mymsg = '<p id="not-ok-box">' + "Error" + '</p>'; } I was thinking if jquery/javascript had a similar syntax to the following PHP syntax, ...

Running a query without GROUP BY and aggregation functions

Let's say that you are limited to use only this syntax (you can't use aggregation functions like MAX or MIN, and neither you can't use GROUP BY clauses; please don't ask me why): {SQL query} ::= SELECT [DISTINCT | ALL] [TOP {integer}] {select_list} FROM {table_reference} [WHERE {search_con...

ANSI vs. non-ANSI SQL JOIN syntax

I have my business-logic in ~7000 lines of T-SQL stored procedures, and most of them has next JOIN syntax: SELECT A.A, B.B, C.C FROM aaa AS A, bbb AS B, ccc AS C WHERE A.B = B.ID AND B.C = C.ID AND C.ID = @param Will I get performance growth if I will replace such query with this: SELECT A.A, B.B, C.C FROM aaa AS A JOIN bbb AS B ...

Html Encoded Code Expressions

In ASP.NET 4.0 should I use new syntax <%: expression %> or 2.0 <%= HttpUtility.HtmlEncode(expression) %> ...

Is it possible to insert multiple rows at a time in an SQLite database?

In MySQL you can insert multiple rows like this: INSERT INTO 'tablename' ('column1', 'column2') VALUES ('data1', 'data2'), ('data1', 'data2'), ('data1', 'data2'), ('data1', 'data2'); However, I am getting an error when I try to do something like this. Is it possible to insert multiple rows at a time in an SQLite databa...

Tricky C# syntax for out function parameter

I'm familiar with using out to pass in a simple data type for manipulation, but I can't seem to figure out how to pass in this Queue<> without causing a compile error. Any ideas? Code: Queue<SqlCommand> insertScriptQueue = new Queue<SqlCommand>(); private void UpdateDefaultIndicator(int newDefaultViewID, ...

What is difference in several styles for proc syntax in tcl?

Hello, May I know how sytanx of proc affets on its working. in context of -Memory consumption -Argument passing -scope of proc (local/global) proc dosomething {} { #code here } proc dosomething { } { #code here } proc dosomething { #code here } proc dosomething args { #code here } proc ::dosomething {} { #co...

How to implement syntax highlight like SO?

Best to be implemented in javascript. And easy to use. ...