syntax

Objective-C 2.0 is not working in GNUstep

[GNUStep installers] gnustep-system-0.24.2-setup.exe gnustep-core-0.25.0-setup.exe gnustep-devel-1.1.1-setup.exe gnustep-cairo-0.22.1-setup.exe I installed them to windows 7. But, it is not able to use Objective-C 2.0 syntax. Example, @property, @synthesize, assign, and so on. And, I want to use CFSocket, but CoreFoundation was not su...

Should functions not be the parameter?

let sub (a:float[]) (b:float[])= [| for i = 0 to Array.length a - 1 do yield a.[i]-b.[i] |] let fx t = [0..t] let x=sub (fx t) (fx t) Above compiles OK. But the same causes an error when I replace the function call with a method invocation: type type_f = delegate of float -> float[] let mutable f =new type_f(fun t->[|0..t|]) l...

C# Object Initialiser - Reference to the new instance

Hi all, Can I somehow get a reference to the instance I am creating using object initialiser var x = new TestClass { Id = 1, SomeProperty = SomeMethod(this) } "this" should point to the new TestClass instance I'm creating. But it obviously refers the the instance of the class i...

How to print a short type in NSLog?

print the string is using [NSString stringWithFormat:@"%@", @"String"]; if I want to print integer, I just use %i, what should I do to print a short type? thank you. ...

Can you tell the differences between <%= %>, <%# %> and <%$ %> asp.net expressions?

Hi, Can you briefly list the differences between <%= %>, <%# %> and <%$ %> by giving a simple example maybe that requires only one of those expressions to be used? Thanks ...

C# #if / #ifdef syntax doesn't compile, why ?

Why does the below code not compile (snippet) ? public enum ApplicationType : int { CONSOLE = 1, WINDOWS_FORMS = 2, ASP_NET = 3, WINDOWS_SERVICE = 4, MUTE = 5 } //#if( false) //#if (DEBUG && !VC_V7) #if( m_iApplicationType != ApplicationType.ASP_NET ) public class HttpContext { public...

Is it necessary to release the object?

Here is the code: -(void)myOwnMethod{ NSString *myString; myString = [[NSString alloc]init]; /* Some logic about the String */ [myString release]; //Do I need to release the myString Object? } As you can see, the myString object is only used in the method, do I need to release it? or it will auto relea...

Visual studio 2008 not catching a syntax error

Visual studio 2008 isn't catching syntax errors. for example: Tpc_feed(void); compiles fine. this: Tpc_feed(void);;;;;;; compiles fine, but this Tpc_feed(void) catches an error. Are the extra semi-colons not syntax errors? I'm on Windows 7 32 bit and VS C++ 2008 ...

Is there any short hand on formatting the String?

I am using objective c, and I got some variables like this: 1100 920 845 1439 But I want to change it to : 11:00 09:20 08:45 14:39 The problem is how can I fill the zero when I got three number only? I know the logic can be simple to do it I detect the string length, but is there any way to do it more effectually? Thank you. ...

Compact Java syntax for conditional arguments?

What is the best (most compact) way to hand this situation: One or more arguments to a method call depends on some condition, while the rest of the arguments are identical? For example-- you want to DeathRay mynewWpn = new DeathRay(particle.proton, chassisColor.BLACK, oem.ACME) if enemy_composition == nature.ANTIMATTER but Death...

Rationale behind static const member initialization syntax?

Hi All, I know how to initialize a static member, but I'm wondering, what is the rationale behind the syntax for this? I'd like to be able to just put the value in the class, a la: class A { static const int i = 3; }; I realise this could mean more rebuilding if I change the value since it's a change in the header - but in some cas...

PHP parse error in rss parse function

Hey, I have a client who needs a website urgently, but I have no access to information such as the control panel. PHP Version is 4.4 Which is a pain as I'm used to 5. The first problem is I keep getting: Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ')' in D:\hshome\*******\********\includes\functions.php on line ...

Subsonic Syntax Question (with GroupBy)

Is there a way to do this : SubSonic.Where filter = new SubSonic.Where(); filter.ColumnName = Region.Columns.Region; filter.Comparison = SubSonic.Comparison.IsNot; filter.ParameterValue = null; SubSonic.Aggregate orderBy = new SubSonic.Aggregate(Region.Columns.RegionName, SubSonic.AggregateFunction.GroupBy); RegionCollection regions =...

Invalid syntax problem with Python (running pygame)

I've been using The New Boston tutorial (http://www.youtube.com/watch?v=x9M3R6igH2E) on how to program with pygame and I keep getting an "invalid syntax" error on the print self.diff command. Only the self is highlighted. Here is the code (i've bolded the problem): class vector(object): def __init__(self, list1, list2): self.diff=(...

Objective C - what does & sign mean when used in objective c?

what does & sign mean when used in objective c for example? int i = 1; NSData *data = [NSData dataWithBytes:&i length:sizeof(i)]; ...

What is the correct syntax for calling an overloaded method using 'this()' in C#?

I may have this wrong, but I've seen the way of creating an overloaded method that calls itself in the definition. It's something like: public void myFunction(int a, int b) { //Some code here } public void myFunction(int a) : this (a, 10) { } This is not the correct syntax, I know, but I can't find the correct syntax anywhere for...

What does the $# construct mean in bash?(and in general I suppose)

I see foo() { if [[ $# -lt 1 ]]; then return 0 fi ... } What exactly is it comparing by using $# as it does there? ...

Syntax for ColdFusion Left() function

I have a SQL statement, in ColdFusion, and I want to limit the size of one field. Neither of the following appear to work (they don't give errors, they just don't limit the field). INSERT INTO ListItems VALUES ('#qGetListID.ID#', <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#listItems[i].itemID#" />, <cfqueryparam cfsqlt...

inserting blocks of text in haml

In my Jekyll blog I use the include tag to put the contents of a file into the document. However if I attempt to do this with a HAML based document the indentation of the included text is wrong. :preserve does not work because it requires indentation. Is there a way to specify a block of text without depending on indentation? %html %b...

Why do I need the `new` keyword for an instance of `Date` in JavaScript?

I understand the difference in behavior. Date() returns a String representing the current date, and new Date() returns an instance of the Date object whose methods I can call. But I don't know why. JavaScript is prototyped, so Date is a function and an object which has member functions (methods) which are also objects. But I haven't wri...