Can you add new statements (like print, raise, with) to Python's syntax?
Say, to allow..
mystatement "Something"
Or,
new_if True:
print "example"
Not so much if you should, but rather if it's possible (short of modifying the python interpreters code)
...
What is the purpose of the colon before a block in Python?
Example:
if n == 0:
print "The end"
...
I'm a little confused by some PHP syntax I've come across. Here is an example:
$k = $this->_tbl_key;
if( $this->$k)
{
$ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
}
else
{
$ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key );
}
My question is basically what does $this...
Is there support in Ruby for (for lack of a better word) non-escaped (verbatim) strings?
Like in C#:
@"c:\Program Files\"
...or in Tcl:
{c:\Program Files\}
...
I've seen this in a few places
function(){ return +new Date; }
And I can see that it is returning a timestamp rather than a date object, but I can't find any documentation on what the plus sign is doing.
Can anyone explain?
...
Using logparser you can pass on parameters to the query you'd like to run such as:
logparser file:query.sql?logs=somewhere\*.log -o:Sql -server:databaseserver
-database:database -createtable:ON -i:IISW3C
-iCheckPoint:somewhere\query.lpc -transactionRowCount:200
Now I want to pass a second parameter to the sql query but it doesn...
At a previous employer, we were writing binary messages that had to go "over the wire" to other computers. Each message had a standard header something like:
class Header
{
int type;
int payloadLength;
};
All of the data was contiguous (header, immediately followed by data). We wanted to get to the payload given that we had ...
I have a simple query like this:
select * from mytable where id > 8
I want to make the 8 a variable. There's some syntax like
declare @myvar int
myvar = 8
but I don't know the exact syntax.
What is it?
Thanks!
...
I can't find a definitive answer. Since C# 2.0 you've been able to declare
int? i = 125;
as shorthand for
Nullable<int> i = Nullable<int>(123);
I recall reading somewhere that VB.NET did not allow this shortcut. But low and behold, I tried it in VS 2008 today and it works.
Does anyone know whether it's been this way since .NET 2...
Today someone asked me what was wrong with their source code. It was obvious. "Use double equals in place of that single equal in that if statement. Um, i think..." As i remember some languages actually take a single equals for comparison. Since i sometimes forget or mix up the syntax details among the several languages i use, i step...
Double out = otherTypes.someMethod(c, c2);
assertEquals((Double)-1.0D, out);
I get error "Double cannot be resolved" (the Double in assertEquals), is there any way to hack around it except extracting variable?
Is this bug in Java or just very usefull feature that wont be fix?
...
I'm looking for syntatic examples or common techniques for doing regular expression style transformations on words instead of characters, given a procedural language.
For example, to trace copying, one would want to create a document with similar meaning but with different word choices.
I'd like to be able to concisely define these po...
I have heard that closures could be introduced in the next Java standard that is scheduled to be released somewhere around next summer.
What would this syntax look like?
I read somewhere that introducing closures in java is a bigger change than generic was in java 5. Is this true? pros and cons?
(By now we definitely know that closur...
for example, I have the following code (generated, not written)
if(node.getId() != null)
{
node.getId().apply(this);
}
{
List<PExp> copy = new ArrayList<PExp>(node.getArgs());
for(PExp e : copy)
{
e.apply(this);
}
}
outAMethodExp(node);
What do those extra curly...
Recently I've been seeing a lot of this:
<a href='http://widget-site-example.com/example.html'>
<img src='http://widget-site-example.com/ross.jpg' alt='Ross's Widget' />
</a>
Is it even valid to use single quotes in HTML? As I've highlighted above it's also problematic because you have to escape apostrophes.
...
Can someone explain what this means?
int (*data[2])[2];
...
In Peter Seibel's Practical Common Lisp, he gives this example:
(do ((nums nil) (i 1 (1+ i)))
((> i 10) (nreverse nums))
(push i nums))
I can see how it works, using nums inside the loop but not giving it a step-form. Why would you put nums in the variable-definition rather than do this:
(let (nums) (do ((i 1 (+ i 1)))
...
Has anyone ever seen the storage class auto explicitly in use in c/c++? If so, in what situation?
...
Is there some way I can define String[int] to avoid using String.CharAt(int)?
...
So I've got a Ruby method like this:
def something(variable, &block)
....
end
And I want to call it like this:
something 'hello' { do_it }
Except that isn't working for me, I'm getting a syntax error. If I do this instead, it works:
something 'hello' do
do_it
end
Except there I'm kind of missing the nice look of it being on ...