Documenting Cocoa code with Doxygen

Montag, der 6. Oktober 2008, 14:05 Uhr von Ullrich

As some of you might know, I have a strong Java background. Documenting my code just feels natural to me. That’s why I was wondering about how to document the code I write in XCode. I found a post on MacDevCenter which describes how to use Doxygen to generate Javadoc like documentations out of Objective-C code. Since this post is quite old (2004) and I want to draw some more attention on the possibilities of documentation in XCode, I’m going to refresh the steps necessary to setup Doxygen for XCode.

First of all you’ll need to get the OS X version of Doxygen from doxygen.org. Doxygen comes in a dmg image. Just copy the Doxygen application into your Application folder.

Den Rest des Eintrags lesen »

Geschrieben in: Coding | Tags: Schlagwörter:
0 Trackbacks | 1 Kommentar »

Wasting time with JAXB, ANT and APT

Donnerstag, der 3. Juli 2008, 17:56 Uhr von Ullrich

Hello,

I just wasted 2 days finding a damn problem with the mentioned combination. What i tried to do ist: Using JAXB from within a APT AnnotationProcessor from within ANT.

Now to the problem:

From within my processor i could access the classes in the jaxb jar files (jaxb-api.jar and jaxb-impl.jar) but when i tried to unmarshal some XML file, i got a ClassNotFoundException. See http://pastie.org/227136

I tried thousands of things to fix this. Passing the classpath in multiple ways. Even passing a new bootstrap classpath, but non worked.

After lots of try and error, some conversations on #java@freenode (http://pastie.org/227143) and a look at the JAXB sources i found the solution in passing the classloader of the calling class when instantiating the context:

String contextPath = ObjectFactory.class.getPackage().getName();
JAXBContext c = JAXBContext.newInstance(contextPath, MyClass.class.getClassLoader());

Hope this could help someone and save some time :)

Geschrieben in: Coding | Tags: Schlagwörter:,
0 Trackbacks | Keine Kommentare »

Putting the Discogs API on Rails – ActiveDiscogs

Sonntag, der 15. Juni 2008, 19:40 Uhr von Ullrich

I had a look inside ActiveResource as it is part of Rails since version 2.1, and tried to use it to access the Discogs API. It turned out to be a bit difficult and required a bit more coding than accessing a regular Rails RESTful API.

That’s the reason why i created a Rails Plugin which supports the basic tasks for now (getting releases, artists and labels). Future versions will support searching and caching and a bit more.

The project goes by the name of ActiveDiscogs and is available on http://activediscogs.rubyforge.org/

Feel free to join and play with it :)

Ah, before i forget: To install just use

script/plugin install svn://rubyforge.org/var/svn/activediscogs

Geschrieben in: Coding | Tags: Schlagwörter:,
0 Trackbacks | 1 Kommentar »

My Methods – Rails Object extension

Donnerstag, der 29. Mai 2008, 09:43 Uhr von Ullrich

This post is in English as the whole Coding category will be.

What’s this all about.

Ryan wrote on his blog about a ruby snippet he came up with a friend. His code snippet won’t be that useful for ruby on rails starters since his example only gives half of the solution.

So here’s the rest :)

Create file app/overrides/object.rb

class Object
  def self.my_methods
    methods - (superclass ? superclass.methods : [])
  end
  def my_methods
    methods - (self.class.superclass ? self.class.superclass.new.methods : [])
  end
end

Also create app/overrides/all.rb containing just

Dir[ File.dirname( __FILE__ ) + "/**/*.rb" ].each { |file| require( file ) }

This file now needs to be included in the environment.rb

require "#{RAILS_ROOT}/app/overrides/all"

This should do the trick. Now get out there and code, code, code!

Geschrieben in: Coding | Tags: Schlagwörter:
0 Trackbacks | 2 Kommentare »