syntax

Scala syntax - pass string to object

While playing around with regexps in Scala I wrote something like this: scala> val y = "Foo" y: java.lang.String = Foo scala> y "Bar" scala> As you can see, the second statement is just silently accepted. Is this legal a legal statement, and if so, what does it do? Or is it a bug in the parser and there should be an error message? ...

Why do people defend the regex syntax?

There is a similar question going around, but it just got the same old answers that people always give about Regex syntax, but that's not the point here, so please try to not knee jerk the same old answers about regex syntax. Try to be a little more original and personal about it this time. Regex syntax is very VERY compact, almost too ...

How do I force keywords to automatically capitalize in the VIM editor?

Does anybody know how to edit a syntax file for VIM so that keywords are capitalized automatically? I need to do this to keep my coding style consistent with the rest of the developers in my team. I'm using VIm version 7.2 (actually gVIM) and the syntax file I'm using is the Progress.vim file (installed automatically with VIM under the ...

Is forgetting the syntax normal?

I often find myself forgetting the syntax of any programming language I learn. I first learned C then C++ then PHP and Java. If I'm asked to program in C now, I think I can't do it. Being a programmer how imprtant it is to remember the syntax of every programs you learn? Am I the only one who is experiencing this (if yes then I'm dumb) o...

How do you connect to multiple MySQL databases on a single webpage?

I have information spread out across a few databases and want to put all the information onto one webpage using PHP. I was wondering how I can connect to multiple databases on a single PHP webpage. I know how to connect to a single database using: $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect...

Lambdas in Boo?

How do you deal with lambdas in boo? Is "callable" the same thing? How do you define a method that takes a lambda as a parameter? ...

auto_increment causing errors with CREATE TABLE

I have been using netbeans as a tool for my java, and i have a problem. I read this tutorial and then i tried to create a table using this SQL: CREATE TABLE CUSTOMERS ( ID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, FIRST_NAME VARCHAR(20), LAST_NAME VARCHAR(30), ADDRESS VARCHAR(30), CITY VARCHAR(30), STATE_ VARC...

Cross platform, multi-syntax highlighting editor

Is there an editor that is: Available for at least windows and linux Highlights multiple syntaxes in the same document. (Ala Dreamweaver) Tabbed interface All the editors I tried highlighted by file extension only which isn't fine grained enough. At the very least it needs to distinguish scripting from html, css and javascript in the...

What is the full "for" loop syntax in C (and others in case they are compatible) ?

I have seen some very weird for loops when reading other people's code. I have been trying to search for a full syntax explanation for the for loop in C but it is very hard because the word "for" appears in unrelated sentences making the search almost impossible to Google effectively. This question came to my mind after reading this thr...

Avoid entering double quotes from start & ending of a string

Hi, In a database, I have a string that contains "default" written in it. I just want to replace that default with 0. I have something like: select * from tblname where test = 'default' I do not want quotes in the replacement for "default". I want select * from tblname where test = 0 is there any way to do this? ...

What simple syntax can be used for rich text?

I want in an application with a simple text input, enriched with some marks to include formatting or semantic labeling. I want the syntax as easy as possible and I want to include self-defined labels. Example: [bold]Stackoverflow[/bold] is a [tag]good[/tag] resource for programmers. Tables would be needed too. HTML/XML and LaTeX are m...

Assign default value to a datacolumn in a select statement.

Hi, I want to assign default values to a column in my select sql query so that if the value of that column is null I get that default value in my recordset. Is there anyway to do this? Example: select col1 (some default value) from tblname; ...

Using foreach (...) syntax while also incrementing an index variable inside the loop

When looking at C# code, I often see patterns like this: DataType[] items = GetSomeItems(); OtherDataType[] itemProps = new OtherDataType[items.Length]; int i = 0; foreach (DataType item in items) { // Do some stuff with item, then finally itemProps[i] = item.Prop; i++; } The for-loop iterates over the objects in items, b...

SQL: What's the difference between HAVING and WHERE?

I must be googling in the wrong way or I'm having a stupid moment in time. What's the difference between HAVING and WHERE in an SQL SELECT statement? EDIT: I've marked Steven's answer as the correct one as it contained the key bit of information on the link: When GROUP BY is not used, HAVING behaves like a WHERE clause The situat...

What does the '=>' syntax in C# mean?

I just came over this syntax in some of the questions in this forum, but Google and any other searchengine tends to block out anything but letters and number in the search so it is impossible to search out "=>". So can anyone tell me what it is and how it is used? ...

Using C# and gppg, how would I construct an abstract syntax tree?

Is there a way to do this almost out-of-the-box? I could go and write a big method that would use the collected tokens to figure out which leaves should be put in which branches and in the end populate a TreeNode object, but since gppg already handled everything by using supplied regular expressions, I was wondering if there's an easier...

Syntax for creating View delegate in Objective-C

I am trying to create a delegate protocol for a custom UIView. Here is my first attempt: @protocol FunViewDelegate @optional - (void) funViewDidInitialize:(FunView *)funView; @end @interface FunView : UIView { @private } @property(nonatomic, assign) id<FunViewDelegate> delegate; @end This doesn't work because the FunView inter...

How would I create a syntax tree using gppg?

What would be the easiest way of accomplishing this, assuming I'm already able to use gppg for syntax analysis? I don't know how to check which non-terminating symbols a parser had to go through in order to set the token in its rightful place (or, failing that, report an error). Any help would be greatly appreciated! ...

LaTeX package to do syntax highlighting of code in various languages

I am looking for a LaTeX package that does syntax highlighting on code. For example, right now I use the verbatim block to write code: \begin{verbatim} <html> <head> <title>Hello</title> </head> <body>Hello</body> </html> \end{verbatim} And this works fine to display the code on my document. But...

How to do an attribute selection for "(this) attribute starting with a #"

Maybe it's the really late night I had but I can't figure this one out. First the html: <div> <a href="#internal">Internal Link</a> <a href="http://external.com"&gt;External Link</a> <a href="#internal2">Internal Link2</a> </div> in order to do something on the page instead of going to the link I need to filter it based on if it conta...