For quick tasks where I only use an instantiated object once, I am aware that I can do the following:
int FooBarResult = (new Foo()).Bar();
I say this is perfectly acceptable with non-disposable objects and more readable than the alternative:
Foo MyOnceUsedFoo = new Foo();
int FooBarResult = MyOnceUsedFoo.Bar();
Which do you use, a...
Hi, I'm wondering if it's possible to use inline assembly with the intel syntax in c, using tcc (not gcc)
thanks
...
I just started learning Java at school for cse142, but I've known a bit of programming so am considerably ahead of the class and have been trying my own little projects. Normally if I run into a problem I just work around it because I figure I just haven't learned that yet, but this one bugs me enough to make a whole thread about it.
I ...
I have read several of the post about Objective-C method syntax but I guess I don't understand multiple names for a method.
I'm trying to create a method called getBusStops with NSString and NSTimeInterval parameters and a return type of NSMutableArray. This is how I have constructed the method but it obviously gets errors at runtime:
...
Is it possible to name variables in a Java-like manner in PHP, such as by removing the need for a $ sign each time? If so, how can I enable the setting which does this?
...
Several times I've seen ReSharper generate code that looks like this:
delegate void myHandler(int i);
myHandler myHandlerContainer;
...
foreach (Delegate @delegate in myHandlerContainer.GetInvocationList())
{...}
Does the '@' in @delegate give that variable any special semantic meaning?
Or is it just a convention I didn't encounter be...
I've been following a tutorial "McGugan - Beginning Game Development with Python and Pygame (Apress, 2007)" and in the code at around chapter five involving object movement I keep getting invalid syntax alerts on '-' being used in the code. It isn't up to date but I would've thought a subtract wouldn't be changed in any updates due to it...
So the idea behind an array and a function are very similar from a black-box perspective. You pass in the input value(s) and retrieve the output value. So is it better to keep array syntax and function syntax the same or is it better to have differences?
e.g.
print array[0]
print func(0)
versus
print array(0)
print f...
I've written a little program to download images to different folders from the web. I want to create a quick and dirty batch file syntax and was wondering what the best delimiter would be for the different variables.
The variables might include urls, folder paths, filenames and some custom messages.
So are there any characters that can...
Other being able to sanity check values in a setter is there a more underlying reason to prefer properties to public variables?
...
I'm implementing a programming language and I'm considering the following syntax:
@NamespaceX
{
+@ClassY <> : BaseTypeA
{
+@NestedClassW<>
{
}
+@MethodZ() : ReturnTypeC
{
//".?" is a null-coallescing member access operator
@varD : ClassY = predicateP ? objectQ.?PropertyS
...
In JavaScript, it doesn't seem to matter whether you use single quotes or double quotes when writing strings. However, some programming languages treat them differently.
Is one more reliable than the other across multiple programming languages? Are there any pros or cons using one rather than the other (apart from when apostrophes or qu...
In every other programming language I use on a regular basis, it is simple to operate on the return value of a function without declaring a new variable to hold the function result.
In PHP, however, this does not appear to be so simple:
<?php
function foobar(){
return preg_split('/\s+/', 'zero one two three four five');
}
// can ...
For example, the following selects a division with id="2":
row = $("body").find("#2");
How do I do something like this:
row_id = 5;
row = $("body").find(row_id);
The above syntax produces an error. I checked the jQuery documentation and answers here without success.
...
Hi guys, i hope that everyone here know the php 'variable variable' syntax:
$color = 'red';
$red = 'yes, im red';
echo $$color;
//output: 'yes, im red';
but my problem is: how this syntax is named?
i'm trying to find the reference on php.net, with no results (i wanna know if this feature will be kept in php6, the others attributes, et...
I've got a bunch of variables being pulled from form ID's before being sent in a query string to a PHP. However, as one input is a checkbox I'm trying to get AJAX to set the variables value according to whether it's checked or not. i.e..
if (document.getElementById('bold').checked) { var bold = "true";
}
else { var bold = "false"; }...
For some reason, my queries screw up when I write to a column of type "text". Here is an example:
Describe messages;
Format is: Field Type Null Key Default
id int(11) NO PRI NULL auto_increment
title varchar(255) YES NULL
body text YES NULL
to text YES NULL
content_type varchar(255) YES NULL
is_sms tinyint(1) YES ...
Can someone explain the usage of the dollar sign here..
var updateProgressDiv = $get('updateProgressDiv');
scroll down to the functions..
http://mattberseth.com/blog/2007/05/ajaxnet_example_using_an_updat.html
...
I don't understand the following part of the Python docs:
http://docs.python.org/reference/expressions.html#slicings
Is this referring to list slicing ( x=[1,2,3,4]; x[0:2] )..? Particularly the parts referring to ellipsis..
slice_item ::= expression | proper_slice | ellipsis
The conversion of a slice item that is an expre...
In a LINQ to SQL statement I've got a column name in the database that's also a C# keyword (void). How do I get the compiler to treat this as an object property and not the keyword?
I could re-write this in with the method notation, sure, but there's got to be a way to give the compiler a hint here...
var p = from c in mytable
...