Posted by Ben Jackson
Thu, 13 Mar 2008 22:57:15 GMT
Laurent Sansonetti just released MacRuby 0.1 today.
MacRuby is another bridge from Ruby to Cocoa. You can think of it as an improved version of RubyCocoa, or as a Ruby 1.9 runtime implemented in Objective C.
Threading is now native, and objects fly between Objective C and Ruby seamlessly, since they're all implemented in the same base class hierarchy.
Check the source out from subversion and play around with it, it's a young project and needs your help.
Posted in Development | Tags cocoa, macruby, osx, ruby | 2 comments | no trackbacks
Posted by Ben Jackson
Thu, 14 Feb 2008 02:09:19 GMT
The short answer: don't use them. Ruby threads (at least before 1.9) are not OS native, and while there is a patch to the ruby interpreter included in Leopard's ruby to work around this issue, it's not 100%. It's all too easy for a thread to access memory after it's been garbage collected, and you, the developer, have to always remember to never call anything GUI-related from a separate thread, instead littering your code with calls to performSelectorOnMainThread:withObject:waitUntilDone anytime you need to update the user interface from a thread other than the main one.
So what's the best solution? Props to Eloy for tipping me off that it's better to rely on Cocoa's native asynchronous functions anytime you need to do something long-running like, say, detect a weblog's API. NSURLConnection and NSURLDownload are your best friends. They use native threads and are much more stable. Use them with respect and you'll be much further along on your way to a crash-free application.
One thing to note about NSURLConnection is that it encapsulates a single request only, and will not follow redirects, so make sure to check the response code in connection:didReceiveResponse.
Good luck and happy threading.
Posted in Development | Tags cocoa, gotchas, ruby, rubycocoa, threads | 2 comments | no trackbacks
Posted by Ben Jackson
Sun, 10 Feb 2008 19:39:00 GMT
By far one of the most frustrating things for me while developing Blogo was the fact that my old installation of typo would inexplicably throw 500 errors when posting new articles via the API. Needless to say, not being able to use my favorite blog editor on my own blog kept me from posting much during the last year.
After months of hemming and hawing, I finally sucked it up and upgraded to 5.0.2. For now the sidebar is stripped down (typo has abandoned the old sidebar engines and now uses plugins for better performance), but other than that my theme seems to have survived intact.
Stay tuned for a lot more posting, an upgrade to the theme (Deva, I'm looking in your direction) and a new version of Blogo coming out soon.
Posted in Development | Tags news, typo | no comments | no trackbacks
Posted by Ben Jackson
Sat, 15 Apr 2006 04:29:00 GMT
TextMate 1.5 is out, and it kicks Royal Ass. The new XML input mode is one of those things that you never even considered, but which becomes totally indispensable once you wrap your head around it. Basically, you can set a command to take as input an XML tree with all of your document's text wrapped in scope tags. In other words, you can re-use TextMate's syntax parser and manipulate the tree however you'd like. Once you're done, output the result without the tags, and you've got your original document back with your changes.
Read more...
Posted in Development, Distractions | no comments