Hi,
I've noticed that Visual Studio 2008 is placing square brackets around column names in sql. Do the brackets offer any advantage? When I hand code T-SQL I've never bothered with them.
Example:
Visual Studio:
SELECT [column1], [column2] etc...
My own way:
SELECT column1, column2 etc...
...
I have a long line of code that I want to break up among multiple lines. What do I use and what is the syntax?
For example, adding a bunch of strings:
e = 'a' + 'b' + 'c' + 'd'
have it like this:
e = 'a' + 'b'
+ 'c' + 'd'
...
Multiple approaches exist to write your unit tests when using Rhino Mocks:
The Standard Syntax
Record/Replay Syntax
The Fluent Syntax
What is the ideal and most frictionless way?
...
I know how to test an object to see if it is of a type, using the IS keyword e.g.
if (foo is bar)
{
//do something here
}
but how do you test for it not being "bar"?, I can't seem to find a keyword that works with IS to test for a negative result.
BTW - I have a horrible feeling this is soooo obvious, so apologies in advance...
...
I have the following Java 6 code:
Query q = em.createNativeQuery(
"select T.* " +
"from Trip T join Itinerary I on (T.itinerary_id=I.id) " +
"where I.launchDate between :start and :end " +
"or ADDDATE(I.launchDate, I.equipmentPullDayOfTrip) between :start and :end",
"TripResults" );
q.se...
For example:
This is main body of my content. I have a
footnote link for this line [1]. Then, I have some more
content. Some of it is interesting and it
has some footnotes as well [2].
[1] Here is my first footnote.
[2] Another footnote.
So, if I click on the "[1]" link it directs the web page to the first footnote ...
In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?
...
is it uppercased C:\ or lowercased c:\ ?
We tried to come up with a conclusion, only argument is that that MS displays uppercase (C:)
Its not what is technically correct, its a matter of arguments choosing what to use when creating config file or hardcode other path info's e.g in a deployment script.
...
In other words may one use /<tag[^>]*>.*?<\/tag>/ regex to match the tag html element which does not contain nested tag elements?
For example (lt.html):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>greater than sign in attribute value</title>
</head>
<body>...
I'm trying to understand someone else's Perl code without knowing much Perl myself. I would appreciate your help.
I've encountered a Perl function along these lines:
MyFunction($arg1,$arg2__size,$arg3)
Is there a meaning to the double-underscore syntax in $arg2, or is it just part of the name of the second argument?
...
I always miss python's built-in doc strings when working in other languages. I know this may seem odd, but it allows me to cut down significantly on excess comments while still providing a clean description of my code and any interfaces therein.
What Language Feature Can You Just Not Live Without?
If someone were building a new lang...
I am reading a .Net book, and in one of the code examples there is a class definition with this field:
private DateTime? startdate
What does "DateTime?" mean?
...
In Java, one can declare a variable parameterised by an "unknown" generic type, which looks like this:
Foo<?> x;
Is there an equivalent construct to this question-mark, in C#?
...
For example, the standard division symbol '/' rounds to zero:
>>> 4 / 100
0
However, I want it to return 0.04. What do I use?
...
Here is a fairly common problem. We have an array of arrays. We'd like to call some function for every combination of elements from the different arrays. Conceptually we'd like to do something like this:
for my $x (1, 2) {
for my $y ('a', 'b') {
for my $z ('A', 'B') {
print "$x $y $z\n";
}
}
}
except that we don't...
I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy.
It's possible that I've been eating the funny mushrooms by accident, but if I'm not, can someone please point out the previous po...
I mostly use lambda functions but sometimes use nested functions that seem to provide the same behavior.
Here are some trivial examples where they functionally do the same thing if either were found within another function:
Lambda function
>>> a = lambda x : 1 + x
>>> a(5)
6
Nested function
>>> def b(x): return 1 + x
>>> b(5)
6
...
In C# I could easily write the following:
string stringValue = string.IsNullOrEmpty( otherString ) ? defaultString : otherString;
Is there a quick way of doing the same thing in Python or am I stuck with an 'if' statement?
...
I decide to learn more about vim and its syntax highlighting.
Using examples for others, I am creating my own syntax file for Markdown. I have seen mkd.vim and it has this problem too.
My issue is between list items and code block highlighting.
Code Block definition:
first line is blank
second line begins with at least 4 spaces or 1 t...
The following method does not work because the inner block declares a variable of the same name as one in the outer block. Apparently variables belong to the method or class in which they are declared, not to the block in which they are declared, so I therefore can't write a short little temporary block for debugging that happens to push...