<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Language and Computation</title>
	<atom:link href="http://omlog.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://omlog.wordpress.com</link>
	<description>Academia, Linguistics, Programming, and Personal stuff</description>
	<lastBuildDate>Thu, 12 Nov 2009 16:58:52 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='omlog.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/917cbe660078eb237d18a172ca969b9c?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Language and Computation</title>
		<link>http://omlog.wordpress.com</link>
	</image>
			<item>
		<title>Sentence Disambiguation &#8211; Modality to the Rescue!</title>
		<link>http://omlog.wordpress.com/2009/11/12/sentence-disambiguation-modality-to-the-rescue/</link>
		<comments>http://omlog.wordpress.com/2009/11/12/sentence-disambiguation-modality-to-the-rescue/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 16:56:08 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[linguistics]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=120</guid>
		<description><![CDATA[I&#8217;m currently reading a new book on iPhone development, iPhone Advanced Projects by Apress. I will probably talk about that book in a later post, but today I will just focus on one sentence I came across on page 212:
I also adore the capability that I have to flag articles from folks I follow on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=120&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m currently reading a new book on iPhone development, <a href="http://www.amazon.co.uk/gp/product/1430224037?ie=UTF8&amp;tag=phrasysnlp-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=1430224037">iPhone Advanced Projects</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=phrasysnlp-21&amp;l=as2&amp;o=2&amp;a=1430224037" width="1" height="1" border="0" alt="" style="border:none!important;margin:0!important;" /> by Apress. I will probably talk about that book in a later post, but today I will just focus on one sentence I came across on page 212:</p>
<p><em>I also adore the capability that I have to flag articles from folks I follow on Twitter and save them to Instapaper.</em></p>
<p>This sentence has (at least) two readings, which are probably only obvious to a linguist (and who else would care?); I highlight the differences by adding commas:</p>
<ol>
<li>I adore the capability, that I have to flag articles&#8230;</li>
<li>I adore the capability that I have, to flag articles&#8230;</li>
</ol>
<p>In the first case you adore the capability.  And the capability is that you have to do something (flag articles).  Sounds rather odd, doesn&#8217;t it?  The second case is more clear-cut and easy to understand: you can flag articles, and that&#8217;s the capability you have and adore.</p>
<p>So in terms of <a href="https://arts-ccr-002.bham.ac.uk/ccr/patgram/">pattern grammar</a>, you&#8217;re either looking at <strong>N that</strong> or <strong>N <em>to</em>-inf</strong> with <em>capability</em>.   If you consult the <a href="http://www.amazon.co.uk/gp/product/1424008255?ie=UTF8&amp;tag=phrasysnlp-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=1424008255">Cobuild Dictionary</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=phrasysnlp-21&amp;l=as2&amp;o=2&amp;a=1424008255" width="1" height="1" border="0" alt="" style="border:none!important;margin:0!important;" />, you&#8217;ll find that <em>capability</em>  only occurs with the second pattern, the to-infinitive, so that you can rule out the first reading.</p>
<p>Another possibility would be to look at it in terms of <a href="http://en.wikipedia.org/wiki/English_modal_auxiliary_verb">modality</a>: here we could argue that <em>capability</em> prospects a modality of ability, but <em>have to</em> expresses obligation; the two don&#8217;t go together.  Hence the first reading sounds odd, as a capability does not usually force you to do anything, but rather enables you.  It could, however, be used to signal sarcasm or irony, as in (the obviously made up) <em>I really like that my new computer gives me the capability to have to save my work every five minutes.</em>  This is clearly an odd sentence, suggesting that modality works along similar lines as <a href="http://en.wikipedia.org/wiki/Discourse_prosody">discourse prosody</a> as described by Louw (1993) [for the full reference follow the previous link].</p>
<p>Here we have discussed two ways of disambiguating a sentence, one based on grammatical properties (or typical environments), and one on a non-syntactic phenomenon (modality).  Pattern grammar allows us to identify what the typical usage would be, whereas modality explains to us why the first reading is at odds with the corresponding words. Now all we need is a &#8216;pattern grammar&#8217; for modality!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=120&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/11/12/sentence-disambiguation-modality-to-the-rescue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>

		<media:content url="http://www.assoc-amazon.co.uk/e/ir?t=phrasysnlp-21&#38;l=as2&#38;o=2&#38;a=1430224037" medium="image" />

		<media:content url="http://www.assoc-amazon.co.uk/e/ir?t=phrasysnlp-21&#38;l=as2&#38;o=2&#38;a=1424008255" medium="image" />
	</item>
		<item>
		<title>Converting AMR to MP3</title>
		<link>http://omlog.wordpress.com/2009/10/29/converting-amr-to-mp3/</link>
		<comments>http://omlog.wordpress.com/2009/10/29/converting-amr-to-mp3/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 17:41:55 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=118</guid>
		<description><![CDATA[For a teaching project, students were required to audio record a group discussion meeting.  For this they could either use a digital recorder, or any other recording equipment they had available.  One group used a mobile phone, and we managed to transfer the audio file from the phone to my MacBook using Bluetooth.
Initially [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=118&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For a teaching project, students were required to audio record a group discussion meeting.  For this they could either use a digital recorder, or any other recording equipment they had available.  One group used a mobile phone, and we managed to transfer the audio file from the phone to my MacBook using Bluetooth.</p>
<p>Initially I was surprised at the small size of the file: 4.5 MB for a recording of about 50 mins.  The quality is of course poor, but <a href="http://en.wikipedia.org/wiki/Adaptive_multi-rate_compression">AMR</a> does a pretty good job of keeping it small. The equivalent MP3 file comes in at 22.5 MB.</p>
<p>But there was a problem: dealing with AMR files.  I cannot load it into my version of Audacity to convert it to MP3, but perhaps there&#8217;s a plug-in somewhere.  I was not able to immediately find one.  Then I found that Quicktime can play back AMR files, and save them in other formats, but for that you need to fork out money to get the Pro version.  I then tried out iMovie, and managed to import the file as the sound track of a yet to complete movie.  Attempts to extract the audio were fruitless; but then I accidentally noticed that the sound track was referred to as &#8216;aiff&#8217; file.  I opened the movie project package, and, hey presto, there was an aiff file.  iMovie had converted it during the import.</p>
<p>So now I could import that into Audacity, and export from there to MP3.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=118&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/10/29/converting-amr-to-mp3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>What&#8217;s a UITextEffectsWindow? And why is it receiving messages?</title>
		<link>http://omlog.wordpress.com/2009/09/17/whats-a-uitexteffectswindow-and-why-is-it-receiving-messages/</link>
		<comments>http://omlog.wordpress.com/2009/09/17/whats-a-uitexteffectswindow-and-why-is-it-receiving-messages/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 09:10:39 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=116</guid>
		<description><![CDATA[I just spent several hours (or at least it felt like several hours!) in frustration, searching a trivial bug.  I&#8217;ve been testing a quick&#8217;n'easy prototype screen with an UIImageView and four UIButtons.  The buttons are linked via an action to a view controller.  And every time I press a button, my app [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=116&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just spent several hours (or at least it felt like several hours!) in frustration, searching a trivial bug.  I&#8217;ve been testing a quick&#8217;n'easy prototype screen with an UIImageView and four UIButtons.  The buttons are linked via an action to a view controller.  And every time I press a button, my app conks out complaining that -[UITextEffectsWindow buttonPressed:] was an unrecognised selector.  I checked the memory address, and it said it was my view controller, just before that exception was thrown.</p>
<p>I was ready to put the blame on some mistakes with Interface Builder, until I came across the solution (indirectly) in a blog: here the problem described related to properties, and the difference between &#8220;vc = &#8230;&#8221; and &#8220;self.vc = &#8220;.  I had another look at my code and quickly found the offending line: I had the view controller as a local variable in the app delegates viewDidLoad method, and I autoreleased it.  In other words, by the time the button was pressed the view controller no longer existed, and hence I got that weird error message.</p>
<p>This was not helped by the fact that UITextEffectsWindow is not mentioned in the documentation anywhere, as it seems to be an internal UIKit class, but at least it appears to be consistent.</p>
<p>So, if your button presses send messages to UITextEffectsWindow, make sure to check that your view controller is still alive!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=116&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/09/17/whats-a-uitexteffectswindow-and-why-is-it-receiving-messages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>Application Promiscuity</title>
		<link>http://omlog.wordpress.com/2009/09/07/application-promiscuity/</link>
		<comments>http://omlog.wordpress.com/2009/09/07/application-promiscuity/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 12:17:22 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=114</guid>
		<description><![CDATA[I was getting a bit bored with the slow progress on my Esperanto dictionary app, and over the holidays I started work on a few other ideas I had.  One was a Maths-drill program for kids, as the ones that are already out there (at least the ones I tried) don&#8217;t seem to be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=114&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was getting a bit bored with the slow progress on my Esperanto dictionary app, and over the holidays I started work on a few other ideas I had.  One was a Maths-drill program for kids, as the ones that are already out there (at least the ones I tried) don&#8217;t seem to be ideal (nothing ever is ideal, though!).  So I tried writing another app so our kids could play and practice their maths skills.</p>
<p>That app is almost done, just the artwork and sound effects are missing.  At the moment it looks pretty rubbish (but looks aren&#8217;t that important as long as it works and doesn&#8217;t crash!), and the sound effects are nicked from somewhere, so I have to replace them with free ones.  Again, the purpose was to try things out.</p>
<p>That app was quite fun, and also easy to do.  More on that later&#8230;</p>
<p>The next app is one that supports teaching and learning students&#8217; names.  This makes use of a navigation controller, which is slow going.  I&#8217;m picking up loads of experience in Objective-C quirks along the way.  For example: avoid using NSNumbers as the keys in a dictionary if you want to save it using writeToFile later on&#8230;</p>
<p>Overall it&#8217;s very exciting, and the iPhone is a fun platform.  It&#8217;s really great to see your own stuff amongst all those polished apps, and provides great motivation to do better.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=114&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/09/07/application-promiscuity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>NSData Naughtiness</title>
		<link>http://omlog.wordpress.com/2009/07/13/nsdata-naughtiness/</link>
		<comments>http://omlog.wordpress.com/2009/07/13/nsdata-naughtiness/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 15:40:08 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=112</guid>
		<description><![CDATA[Well, this is not exactly NSData&#8217;s fault, but I ran into a problem (for the second time; the first time I bypassed it with a short-cut) when reading text data from a file.
Occasionally there was random garbage at the end of a line, which I could not understand.  Incidentally, I was reading a number [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=112&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well, this is not exactly NSData&#8217;s fault, but I ran into a problem (for the second time; the first time I bypassed it with a short-cut) when reading text data from a file.</p>
<p>Occasionally there was random garbage at the end of a line, which I could not understand.  Incidentally, I was reading a number of full files in one go each into an NSData instance, and converted that into an NSString with the correct encoding; this I would then tokenise and add to another file.  So the garbage was actually at the end of each <em>file</em>.  I then found that I can directly initialise an NSString with the contents of a file, and the problem disappeared.</p>
<p>Now I want to produce concordance lines, and I jump into the middle of the file to read a stretch.  First I run into trouble with the encoding: as the data is UTF8-encoded, a random jump can end up in the middle of a multi-byte character. NSString does not like that&#8230; but here I can just test for that and skip the initial bytes.  The same problem obviously also happens at the end, where the final multi-byte character could be incomplete.  Again, truncation seems the easy way out.</p>
<p>But I also then had the issue with the occasional random garbage again!  NSData seems to be at fault, and this time I can&#8217;t bypass it, as NSString can only read a full file.  Quick websearch, and the solution crops up (in an aside) on <a href="http://stackoverflow.com/questions/550405/convert-nsdata-bytes-to-nsstring">stackoverflow.com</a>: the data that NSData returns from the -bytes method is not zero-terminated, but NSString&#8217;s -stringWithUTF8String expects that, hence the random garbage of the unterminated data.  In a way I&#8217;m surprised that it actually worked most of the time!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=112&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/07/13/nsdata-naughtiness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>Dictionary Dangers</title>
		<link>http://omlog.wordpress.com/2009/07/09/dictionary-dangers/</link>
		<comments>http://omlog.wordpress.com/2009/07/09/dictionary-dangers/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 10:44:40 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=108</guid>
		<description><![CDATA[I just spotted a bug that cost me several hours yesterday, without having a clue what was going on.  I&#8217;m currently working on a program which indexes texts, and as I encounter words, I add them to a NSMutableDictionary with their positions in the text.  All was working well, until I tested it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=108&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just spotted a bug that cost me several hours yesterday, without having a clue what was going on.  I&#8217;m currently working on a program which indexes texts, and as I encounter words, I add them to a NSMutableDictionary with their positions in the text.  All was working well, until I tested it on a bunch of texts, and it failed with some obscure message about key-value coding.  I then added some NSLog messages, and discovered that the token it failed on was the at sign, @.</p>
<p>Today I had another look at the documentation of NSMutableDictionary, and especially the method valueForKey: where the problem seemed to occur.  And there it was: &#8220;<em>If key does not start with “@”, invokes objectForKey:. If key does start with “@”, strips the “@” and invokes [super valueForKey:] with the rest of the key.</em>&#8221;  Suddenly it dawned on me: I was using the wrong method.  Instead of <strong>value</strong>ForKey: I should have used <strong>object</strong>ForKey: &#8211; the plain @-sign is discarded, and leaves an empty key (which did of course make the error message less comprehensible, as I couldn&#8217;t really tell it was <em>empty</em>).</p>
<p>Quick change in the code, and it works.  Problem solved!</p>
<p>Lesson learned: always pay close attention to the available methods, and make sure it is the one you want, even if the one you&#8217;re using sounds like it&#8217;s the right one.  And read the docs carefully!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=108&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/07/09/dictionary-dangers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>Making Progress!</title>
		<link>http://omlog.wordpress.com/2009/06/26/making-progress/</link>
		<comments>http://omlog.wordpress.com/2009/06/26/making-progress/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 22:19:00 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=105</guid>
		<description><![CDATA[DAY 11 and the pace is picking up.  I managed to sort out two of the four tabs of the app, one including a table display of Esperanto/English dictionary entries (with the proper Esperanto diacritics), and the other one being a live-search on the English gloss entries.  This one even pops up an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=105&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>DAY 11</strong> and the pace is picking up.  I managed to sort out two of the four tabs of the app, one including a table display of Esperanto/English dictionary entries (with the proper Esperanto diacritics), and the other one being a live-search on the English gloss entries.  This one even pops up an automatic keyboard when first selected; the tab bar controller sends it a message when it has been activated. I even managed to answer a question on stackoverflow.com on that issue.</p>
<p>I also found somewhere a hint on how to automatically shrink the label size if the text is too long, wrote a converter from the Esperanto x-notation to unicode, etc.  Really pleased!  Both of these will appear here later.</p>
<p>One thing I don&#8217;t like too much is writing all the UITableViewDelegate methods when using a table.  Quite a lot of boiler-plate code, but then, it is quite powerful.  I just couldn&#8217;t be bothered writing yet another set of those methods for the final tab, the info view part.  But there is nothing technically difficult with it.  Objective-C is also getting easier and easier, and the auto-completion feature and API doc integration of XCode really helps.  Though I think for serious code I will still use vile&#8230;</p>
<p>That leaves pretty much only the core part of the app: the Esperanto morphological analyser.  I will implement this as a finite state machine, and working with Cocoa has given me the idea to implement it using delegates; an abstract hull which calls methods on the delegates whenever it needs to retrieve data, or match something.  I have the feeling that this is pretty similar to Erlang&#8217;s OTP frameworks.</p>
<p>It is a really rewarding experience to see your own app on the iPhone.  If only I was better at designing the tab bar icons!  And I can already foresee one objection: one of the tabs has a star icon, the star being the Esperanto symbol.  I think I need to change that, as the star is reserved for the &#8216;favourites&#8217; meaning, and I don&#8217;t think Apple would appreciate the use of a star (even if it looks slightly slimmer) with another meaning.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=105&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/06/26/making-progress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>More problems solved</title>
		<link>http://omlog.wordpress.com/2009/06/24/more-problems-solved/</link>
		<comments>http://omlog.wordpress.com/2009/06/24/more-problems-solved/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 00:03:46 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=102</guid>
		<description><![CDATA[DAY 10, second part.  I was really annoyed by those database errors, and built in assertions to check for the size of the file, and whether the file existed at all.  I think sqlite creates a database if the file doesn&#8217;t exist, and on subsequent runs the database is then empty and failure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=102&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>DAY 10</strong>, second part.  I was really annoyed by those database errors, and built in assertions to check for the size of the file, and whether the file existed at all.  I think sqlite <em>creates</em> a database if the file doesn&#8217;t exist, and on subsequent runs the database is then empty and failure happens.</p>
<p>Then I had the nice situation where the program worked in the simulator, but not on the device (I wanted to check the speed on the actual phone).  Again, first the file doesn&#8217;t exist, and then it&#8217;s empty.  XCode didn&#8217;t seem to copy the file over.  Finally it dawned on me, as I was searching for mentions of problems with copying files into the documents folder: my database file was not in the documents folder, it was within the application bundle.  I thought about copying it over when the app first starts, but then, why bother?  It&#8217;s a read-only database, so all I needed to do was to change the path in the db init code, using the application bundle instead of the documents folder, and hey presto, success!</p>
<p>I guess the problem was that I looked at the sample code for db stuff in the iPhone development book.  Here a database is created in the documents folder, and I assumed that would be where my db should reside.  Confusing, but finally sorted.  Now I can go to sleep in peace!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=102&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/06/24/more-problems-solved/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>Every character is important</title>
		<link>http://omlog.wordpress.com/2009/06/23/every-character-is-important/</link>
		<comments>http://omlog.wordpress.com/2009/06/23/every-character-is-important/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 22:02:16 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/2009/06/23/every-character-is-important/</guid>
		<description><![CDATA[DAY 10, and a little bit of progress.  I found one error, which was about to drive me mad, until I more or less by accident stumbled over the solution on stackoverflow.com; in answering a slightly different question, Rob Napier commented on a bug in the way NSLog() was used.
NSLog(@"Returning %@ rows", [nodes count]);
Here, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=100&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>DAY 10</strong>, and a little bit of progress.  I found one error, which was about to drive me mad, until I more or less by accident stumbled over the solution on stackoverflow.com; in answering a slightly different question, Rob Napier commented on a bug in the way NSLog() was used.<br />
<code>NSLog(@"Returning %@ rows", [nodes count]);</code><br />
Here, the -count method returns an int, but the %@ symbol expects an object.  Result: a bus error.  You need to use %d instead.  And here was I, thinking how great it is not to bother with the old printf format codes, using the %@ way instead.  I hate the primitive type/object distinction!</p>
<p>I then also found that I had created two superimposed Table Views (did I mention that I don&#8217;t really like Interface Builder after all?), so that my table got overwritten and looked all wrong.  Now I&#8217;m struggling with getting the table to start at the first entry, not the 35th (indexPath seems to start counting sections at 1, rather than 0), and all of a sudden my database won&#8217;t work.</p>
<p>Preparing a straightforward SQL statement suddenly fails.  I did not change that part of the code, the database file is still the same as it used to be before the error occurred, and I did tell XCode to do a full clean.  Still, the error remains.</p>
<p>Grmph.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=100&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/06/23/every-character-is-important/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
		<item>
		<title>Tab Bar Errors</title>
		<link>http://omlog.wordpress.com/2009/06/22/tab-bar-errors/</link>
		<comments>http://omlog.wordpress.com/2009/06/22/tab-bar-errors/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 16:32:00 +0000</pubDate>
		<dc:creator>ojmason</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://omlog.wordpress.com/?p=97</guid>
		<description><![CDATA[DAY 9 and more frustration.  My ViewControllers didn&#8217;t seem to be called, and NSLog messages I put in didn&#8217;t appear on the console.  And the whole thing crashed without me knowing what was going on.
Having another look at my iPhone development book, I realised the first mistake: the TabBar Controller wasn&#8217;t aware of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=97&subd=omlog&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>DAY 9</strong> and more frustration.  My ViewControllers didn&#8217;t seem to be called, and NSLog messages I put in didn&#8217;t appear on the console.  And the whole thing crashed without me knowing what was going on.</p>
<p>Having another look at my iPhone development book, I realised the first mistake: the TabBar Controller wasn&#8217;t aware of which controllers to call up for the various tabs, something you need to set up in Interface Builder.  Still don&#8217;t really like that way of doing things, as the fact you&#8217;ve done it (or not, as the case may be!) is not easily transparent.</p>
<p>After completing the tab bar attributes, the log messages suddenly turned up, which was good, and it also doesn&#8217;t crash.  Well, at least not where it used to crash.  Now it crashes in the loop where I read stuff out of the SQLITE database, and it crashes after the <em>second</em> iteration.  Wonder what the cause is.  Probably memory management.  Mixing Objective-C and plain C makes things a bit confusing.  And I don&#8217;t like that NSString is an object you need to allocate, but NSInteger is basically just an alias for int, so a primitive data type rather than an object.</p>
<p>Anyway, more bug hunting coming up.  It all feels terribly slow, but then I&#8217;m only spending a few hours every couple of weeks on it at the moment.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/omlog.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/omlog.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/omlog.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/omlog.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/omlog.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/omlog.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/omlog.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/omlog.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/omlog.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/omlog.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=omlog.wordpress.com&blog=2985839&post=97&subd=omlog&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://omlog.wordpress.com/2009/06/22/tab-bar-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b3e5e6b5ecd2707930a109a46c0cfafe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ojmason</media:title>
		</media:content>
	</item>
	</channel>
</rss>