= Cappuccino = Cappuccino is a framework which makes it easy to create advanced web apps. [[http://www.cappuccino-project.org/]] Objective-J is a powerful object-oriented language which compiles to run in the browser. == Get the code == Clone it using git: * cd ~ * mkdir gitCappuccino * cd gitCappuccino * git clone git://github.com/cappuccino/cappuccino.git * cd ~/gitCappuccino/cappuccino == Vim editor Objective-J plugin == Run the follwoing commands after fetching code from github: * mkdir -p ~/.vim/plugin * cd ~/gitCappuccino/cappuccino/Tools/Editors/Vim] * cp objj.vim ~/.vim/plugin == Emacs editor Objective-J plugin == * mkdir ~/cappuccinoEmacs * cd ~/gitCappuccino/cappuccino/Tools/Editors/Emacs] * cp *.el ~/cappuccinoEmacs/ * touch ~/.emacs * nano ~/.emac * (add-to-list 'load-path "~/cappuccinoEmacs") * (require 'objj-mode) == Init String, CPString == {{{#!highlight objectivej var str1 = [CPString initWithString: @""]; var str2 = [CPString initWithString: @""]; }}} == Mutable Array == {{{#!highlight objectivej @import var arrayX = [[CPMutableArray alloc] init]; }}} == Callbacks == {{{#!highlight objectivej @implementation TestObject : CPObject { } -(void)helloWorld{ CPLogConsole("Called hello world"); } //(...) @end //-------------------- var selectorHelloWorld = @selector(helloWorld) ; var signature = [self methodSignatureForSelector: aSelector]; var invocation = [CPInvocation invocationWithMethodSignature:signature]; [invocation setSelector: selectorHelloWorld]; [invocation invokeWithTarget: self]; //self -> instance of TestObject }}} {{{#!highlight objectivej @implementation TestObject : CPObject { } -(void)helloWorldMsg:(CPString) message p1:(int)intVal { CPLogConsole( message ); CPLogConsole( intVal ); } //(...) @end //-------------------- var selectorHelloWorldMsg = @selector(helloWorldMsg:p1:) ; var sig = [self methodSignatureForSelector: selectorHelloWorldMsg]; var invocation = [CPInvocation invocationWithMethodSignature:sig]; [invocation setSelector: selectorHelloWorldMsg]; [invocation setArgument:@"Message" atIndex:2 ]; //0-> self 1->_cmd [invocation setArgument: 1234 atIndex:3 ]; //0-> self 1->_cmd [invocation invokeWithTarget: self]; }}} == Dates == {{{#!highlight objectivej var datex = [CPDate dateWithTimeIntervalSince1970: dateInSeconds]; //set CPDate with seconds since 01-01-1970 UTC var strDate = [instanceCPDate description];// get string with date in format YYYY-MM-DD HH:MM:SS TZ±HHMM. }}}