syntax

Code-Golf: one line PHP syntax

Explanation PHP has some holes in its' syntax and occasionally in development a programmer will step in them. This can lead to much frustration as these syntax holes seem to exist for no reason. For example, one can't easily create an array and access an arbitrary element of that array on the same line (func1()[100] is not valid PHP syn...

F# constructor syntax - overiding and augmenting new

I have a non-disposable class with Open/Close syntax that I'd like to be able to use, so I'm trying to inherit from it, and work the Open into the new and the Close into Dispose. The second part is ok, but I can't work out how to do the Open: type DisposableOpenCloseClass(openargs) = inherit OpenCloseClass() //do this.Open(open...

Right rotate of tree in Haskell: how is it work?

I don't know haskell syntax, but I know some FP concepts (like algebraic data types, pattern matching, higher-order functions ect). Can someone explain please, what does this code mean: data Tree ? = Leaf ? | Fork ? (Tree ?) (Tree ?) rotateR tree = case tree of Fork q (Fork p a b) c -> Fork p a (Fork q b c) As I understand, first ...

What is tagged structure initialization syntax?

struct file_operations scull_fops = { .owner = THIS_MODULE, .llseek = scull_llseek, .read = scull_read, .write = scull_write, .ioctl = scull_ioctl, .open = scull_open, .release = scull_release, }; This declaration uses the standard C tagged structure initialization syntax. Can someone elaborate? ...

What is the role of the data types inside of < > in Java?

Possible Duplicate: Java Generics To be more specific, whats the role of the <String> in the following line of code? private List<String> item = new ArrayList<String>(); ...

C# XMLWriter + prevent "/" "<" "<" chars

Hello, I have a xmlWriter and want to write String which containt chars of "/" "<" ">" (which are part of the xml syntax and break the xml code). Here is my c# code: public Boolean Initialize(String path) { Boolean result = true; XmlWriterSettings settings = new XmlWriterSettings(); settings.CheckCh...

why is there different syntax same outcome?

Why is there different syntax same outcome? For example # Example 1 if($myCondition == true) : #my code here endif; if($myCondition == true) { #my code here } # Example 2 foreach($films as $film) : #my code here endforeach; foreach($films as $film) { #my code here } Also I have been using <?= for ages now and I n...

C++: Syntax error C2061: Unexpected identifier

What's wrong with this line of code? bar foo(vector ftw); It produces error C2061: syntax error: identifier 'vector' ...

Universal syntax file format?

Hey as a project to improve my programing skills I've begun programing a nice code editor in python to teach myself project management, version control, and gui programming. I was wanting to utilize syntax files made for other programs so I could have a large collection already. I was wondering if there was any kind of universal syntax f...

What's wrong with my markdown syntax? Broken in stackoverflow and bluecloth...

I just wrote some markdown and it doesn't seem to render correctly. Is it legal syntax to have an ordered list, followed by newlines, then followed by an unordered list? Or is this a bug in bluecloth? For example: 1. One 2. Two 3. Three * Apple * Banana * Carrot Bluecloth creates a single <ul> and nests apple, banana and carrot as ...

Perl throws an error message about syntax

So, building off a question about string matching (this thread), I am working on implementing that info in solution 3 into a working solution to the problem I am working on. However, I am getting errors, specifically about this line of the below function: next if @$args->{search_in} !~ /@$cur[1]/; syntax error at ./db_index.pl line 16...

In xpath why can I use greater-than symbol > but not less-than <

Using c#3 compiled transforms the following seems to work just fine... <xsl:choose> <xsl:when test="$valA > $valB"> <xsl:value-of select="$maxUnder" /> </xsl:when> <xsl:when test="$valA &lt; $valC"> <xsl:value-of select="$maxOver" /> </xsl:when> </xsl:choose> However if i dare use a < in place of &lt; i...

OCaml delimiters and scopes

Hello! I'm learning OCaml and although I have years of experience with imperative programming languages (C, C++, Java) I'm getting some problems with delimiters between declarations or expressions in OCaml syntax. Basically I understood that I have to use ; to concatenate expressions and the value returned by the sequence will be the ...

what does calling ´this´ outside of a jquery plugin refer to

Hi, I am using the liveTwitter plugin The problem is that I need to stop the plugin from hitting the Twitter api. According to the documentation I need to do this $("#tab1 .container_twitter_status").each(function(){ this.twitter.stop(); }); Already, the each does not make sense on an id (the author uses $(´#twittersearch´) ) and w...

Is there a reason why SASS, a CSS generator, needs to reject lines such as margin:10px ? (no space after colon)

I need to change all the CSS into SASS... and find that margin:10px working in CSS and failing in SASS somewhat disturbing... It is easy to miss one and you don't what you are missing (what is not working in the final CSS but you don't know) Pretty much I am grep for /:\S/ (colon by followed by a non-whitespace) to see if there are ...

C++: Unknown pointer size when forward declaring (error C2036)

In a header file, I have forward declared two members of a namespace: namespace Foo { struct Odp typedef std::vector<Odp> ODPVEC; }; class Bar { public: Foo::ODPVEC baz; // C2036 }; The error generated by the compiler is: error C2036: 'Foo::Odp *': unknown size I'm guessing this is an issue with forward declaring Odp....

writing "%d" in a printf C

Hey, What is the correct syntax for this code: is it: printf("printf(\"\%d\",%s);", some_var); or printf("printf(\"%%d\",%s);", some_var); Or something else? ...

How do you override operator == when using interfaces instead of actual types?

I have some code like this: How should I implement the operator == so that it will be called when the variables are of interface IMyClass? public class MyClass : IMyClass { public static bool operator ==(MyClass a, MyClass b) { if (ReferenceEquals(a, b)) return true; if ((Object)a == null || (Object...

On asp:Table Control how do we create a thead ?

From an MSDN article on the subject, we can see that we create a TableHeaderRowthat contains TableHeaderCells. But they add the table header like this: myTable.Row.AddAt(0, headerRow); which outputs the HTML: <table id="Table1" ... > <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Co...

Multi-line code in PHP interactive shell

I'm learning to use the PHP interactive shell, but I'm having trouble with multi-line code. Using backslashes like in the UNIX shells doesn't seem to work. What am I doing wrong ? php > function test(){\ php { echo "test";\ php { }\ php > test(); PHP Parse error: syntax error, unexpected T_ECHO, expecting T_STRING in php shell code on...