Skip to content
David Richardson edited this page Feb 17, 2020 · 17 revisions

Overview

Collection of patterns/approaches/recipes for Cappuccino.

In many cases you can find what you want by looking through cocoadev.com. Cappuccino “CP” classes will tend to be very similar to Cocoa “NS” classes.

Communicating with your webserver

Cocoadev resource:
http://cocoadev.com/index.pl?NSURLConnection

From #cappuccino,


cratuki: Pilky: An example of something I was thinking about was communication
between UI and the server. I’d guess that this doesn’t really relate to cocoa – is
that fair? But for many things, maybe we could just link to stuff on cocoadev.
Pilky: communication between a “UI” and a server is pretty easy in cocoa
Pilky: it’s pretty much what one of my apps does (though it does cache it)
Pilky: just look up anything to do with NSURLConnection
Pilky: from what I understand, if you treat the Obj-J app as a desktop app
communicating with a web server then it should work fine

Thread about using CPUrlConnection and CPJSObjectCreateFromJSON

Ruby on Rails

There are two great options for working with Rails as a back-end:

CouchDB

This feels like a natural fit and is something to look into. http://couchdb.apache.org

Geoffrey Grosenbach (topfunky) has started a class for directly interacting with CouchDB.

Coalescing updates

If you want to have some update run only on the next iteration of the runloop, you can add it by sending a performSelector:target:argument:order:modes: message to the current runloop. If you use some kind of ‘dirty’ flag you can easily make sure it only runs as often as needed.

Note that a new iteration of the runloop doesn’t mean anything as far as the browsers builtin detection for unresponsive scripts is concerned so if you are running into unresponsive script errors, this technique will not fix them.