syntax

How to break out of 2 loops without a flag variable in C#?

As a trivial example lets say I have the following grid and I am looking for a particular cells value. When found I no longer need to process the loops. foreach(DataGridViewRow row in grid.Rows) { foreach(DataGridViewCell cell in row.Cells) { if(cell.Value == myValue) { //Do Something useful ...

How can I use a multiline value for an HTML tag attribute? (i.e. how do I escape newline?)

How do I include a newline in an HTML tag attribute? For example: <a href="somepage.html" onclick="javascript: foo('This is a multiline string. This is the part after the newline.')">some link</a> Edit: Sorry, bad example, what if the tag happened to not be in javascript, say: <sometag someattr="This is a multiline string. This is...

F# Assign Value to Class Member In Method

I'm playing around with F# in VS 2010 and i can't quite figure out how to assign a value to a member in a class. type SampleGame = class inherit Game override Game.Initialize() = spriteBatch <- new SpriteBatch(this.GraphicsDevice) base.Initialize() val mutable spriteBatch : SpriteBatch end I tho...

Loop in PLT Scheme

Hi, How can I implement loop in plt-scheme like in java- for(int i=0;i<10;){ for(int j=0;j<3;){ System.out.println(""+j); j++; } System.out.println(""+i); i++; } Thanks in advance. ...

How can I write a newline in a string in ColdFusion?

Currently I'm putting newlines in strings through one of these two methods: <cfset someStr="This is line 1" & Chr(10) & "This is line 2" & Chr(10) & "This is line 3" /> OR <cfset NL=Chr(10) /> <cfset someStr="This is line 1#NL#This is line 2#NL#This is line 3" /> Is there anything more like the Java/C++ way? Something more like th...

MySQL multi-level parent selection/join question

Hi, I have a hopefully simple MySQL query question which is eluding me at late at night. I'm trying to do a SELECT which counts the number of instances of a set of data (orders) and groups those instances by a value which exists in a parent a couple levels above the order itself. For example: CREATE TABLE `so_test`.`categories` ( ...

f# Method Definition Syntax

I have a method (static in this case) and i can't quite figure out the exact syntax for defining it. static member FindPath : Queue<Node> startNode : Node endNode : Node nodes : List<Node> = //this method will call two other to be constructed methods and return a //queue that is the return value of one of them return new Q...

What is the origin of '.' meaning the current directory?

In what OS did the use of the '.' first mean 'the current directory' ? ...

PHP parse error when referencing a string

I have the following constant defined in my PHP script: define("MODULE_PATH", "D:\\modules\\"); Whenever I try and assign the constant to a variable or as a function argument, I get a PHP parse error (with no explanation). var $jim = MODULE_PATH; var $fh = fopen(MODULE_PATH . "module1.xml"); Both above lines throw the parse erro...

What would be a better name for Javascript's "this"?

I'm coming from a Java background, with its class-based inheritance model, trying to get my head around Javascript's prototype-based inheritance model. Part of what is throwing me off, I think is that I have Java's meaning of "this" solidly in mind - and Javascript's "this" is a very different beast. I understand that Javascript's "thi...

Syntax Question: "Exit Sub" or "Return" in VB.Net Sub Routines

Both seem to accomplish the same thing--exit a subroutine. Is there any difference in how they work under the covers? I.e. Private Sub exitNow() Exit Sub End Sub or Private Sub exitNow() Return End Sub ...

How do I forward declare a delegate in C++/CLI?

How? The following did not work: delegate MyDelegate; ref class MyDelegate; delegate void MyDelegate; The following works for declaration: public delegate void MyDelegate(Object ^sender, MyArgs ^args); But using it as a forward declaration gives me error C3756: 'MyNameSpace::MyDelegate': delegate definition conflicts with an exi...

SQL - Query by Date Range

Hello, I have an order header table called "OrderH". In this table there is a column called "OrderDate". I am trying to retrieve the orders with a date within a certain range. I thought that I could accomplish this with the "between" keyword but I am not having any luck. This is this SQL I have been fidgiting with: select * from ...

Scala - which characters can I omit

In Scala, why can I omit the dot and brakets in T m 0 (instead of T.m(0)): scala> object T { def m(i:Int) = 0 == i } defined module T scala> T m 0 res19: Boolean = true But why can't I omit the brakets in n(0): scala> def n(i:Int) = 0 == i n: (Int)Boolean scala> n 0 <console>:1: error: ';' expected but integer literal found. ...

How can I call javascript functions and pass values from xaml/silverlight?

I'm creating silverlight without visual studio. I just have raw html, xaml, and js (javascript). What I want to do is pass values from the xaml to the javascript. I can call and activate javascript functions from xaml. See below. The canvas element has a mouse left button up event that callls LandOnSpace in the javascript. But ho...

Good online C++ syntax reference?

Do you know of a precise and concise online C++ syntax reference? Please provide the link... ...

What can go in the parentheses of a Java for loop?

My question is about the Java for statement, e.g. for (int i = 0; i < 10; ++i) {/* stuff */} What I don't understand is precisely how much code / what kind of code I can put in the parentheses (i.e. where I have int i = 0; i < 10; ++i in my example)- I don't really understand the language used to describe it here: http://java.sun.co...

What is diff Between Ref And Out??

Possible Duplicate: Whats the difference between the 'ref' and 'out' keywords? What is the difference between ref and out? I am confused about when to use ref and out. So please explain how to use ref and out, and in which situations. ...

NameError: global name 'has_no_changeset' is not defined

OK - Python newbie here - I assume I am doing something really stupid, could you please tell me what it is so we can all get on with our lives? I get the error NameError: global name 'has_no_changeset' is not defined in the line 55 (where I try calling the function has_no_changeset). from genshi.builder import tag from trac.core impor...

Unix 'find' + 'grep' syntax vs. awk

I was using this line to find the phrase, 'B206' within files in the directory I was in and all of its sub directories. find . -exec grep -s "B206" '{}' \; -print It crashes when it tries to read certain files and actually changes the title bar in putty to a bunch of weird characters For example, it crashes all the time when it hits ...