Monday, October 26, 2009

Links to Cocoa Projects



I have 4 or 5 Cocoa projects at the version 0.1 stage. I'll be posting about them (briefly) and putting up links to a download page hosted at my .mac pages. There will be a link to the zipped files of the project (build directory removed), as well as a dmg holding the application, built to run under Snow Leopard. These links should last as long as I pay Apple the $100 every February.

When I finish that, I'm going back to Bioinformatics.

These projects have some functionality, and no back-breaking bugs that I know of. I hope someone else finds them useful. The first one is a reference browser called PubmedHelper. It's a document-based application which allows the user to build and navigate a database of Pubmed references.



References can be added in two ways. First, there is an auxiliary window with a WebView that is pointed at Pubmed---activated by a toolbar item. Then, if an article is selected in the browser, the app parses it and shows the pmid, title, etc. in the main window. There is another toolbar item to add it to the database. The second method is to import an XML file. You can build a set of up to 500 references on the Clipboard at Pubmed. Download the XML to a file, the app can parse that file and import the references. The data is saved to disk in plist format, so it could be easily processed further by the user for some other purpose.

The most likely source of bugs is in parsing Genbank's XML. I've tested it some, notably with 500 references from the Clipboard. Please let me know if you can break it.

Navigation is via forward and back buttons in the toolbar, but there is also a stepper as well as a custom control that allows a quick jump around in the database. I like this control a lot.

Useful example code in the project includes:

• showing a WebView (don't forget to link to the WebKit!)
• parsing XML by the event-based NSXMLParser
• parsing XML by using the NSXMLDocument class
• composing a URL to fetch data for a PMID from Pubmed

Enjoy. Feedback welcomed.