Mathieu Tozer's Dev Blog

Cocoa, the development of Words, and other software projects (including those dang assessment tasks).




Words: Milestone. Dict Protocol Word Lookup


E-mail this post



Remember me (?)



All personal information that you provide here will be governed by the Privacy Policy of Blogger.com. More...



After yesterday's productivity, today has seemed rather disappointing. What I have to remember is that even though I might not get on screen progress done, what I'm learning from my mistakes will help me program better in the future.

For example, I've learnt one lesson today - the less C++ there is my life that happier I think I'll be!

You see, there's this free program to access dict protocol compatible servers written in C, and there was a convenient wrapper to it written in C++. I tried to link it into my Lookup app, but it threw nasty errors at me for hours. Maybe I don't know the mechanics of it yet, and there is a simple way to do it. Anyway I realised that the C++ wrapper around the C code was actually what I should probably be rewriting for my own app in Objective-C.

Many hours, castings, photographs with Lord Mayor John So later...
@ 10.19pm

Bingo!

bingo!.jpg

Another milestone! I now have my DictProtocolDictionary instance importing definitions right into the object from somewhere in Alaska I believe. Should only be short work to extract the data from the struct it's currently residing in, and plop it into the definitions array controller to be shown in the table view.

bugGone.jpg
Done! Of course it's not perfect. There are multiple rows displayed in the table, and I'm going to have to parse the definitions for those that are meaningful, and take out things like procunciation, and word type in some handy variables. And give the dictionary server and dictionary database itself credit for the service.

Next I think I should create an interface which allows the user to specify which dict server and which dictionary on that server they wish to query.

Actually there still is some work to be done with the DictProtocolDictionary class. I haven't implemented all of the code that the C++ wrapper did that I was wrangling with on the tram this morning.

All this stuff is really starting to make sense now, and I'm loving it! You come across something tricky and you apply yourself for a few minutes, debug, think some more, realise something, then come up with something beautiful like this:

Definition *newDefinition = [[Definition alloc] initWith:[NSString stringWithCString:(theDefinition[idx]->ld_answord)] andDefinition:[NSString stringWithCString:(theDefinition[idx]->ld_ansdef)]];

Mwah! Bellissimo!

I start back at Uni tomorrow, and with any luck something from this blog will become my final year project and I will be able to spend even more time developing.


0 Responses to “Words: Milestone. Dict Protocol Word Lookup”

Leave a Reply

      Convert to boldConvert to italicConvert to link

 


+RSS | dev blog | Portfolio

About me

My status

Previous posts

  • my del.icio.us
  • my flickr