<?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/"
	>

<channel>
	<title>Karl Kraft &#187; Karl Kraft</title>
	<atom:link href="http://www.karlkraft.com/index.php/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.karlkraft.com</link>
	<description>Just a 2 bit programmer in a 64 bit world</description>
	<lastBuildDate>Wed, 18 Jan 2012 16:01:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Mysql SVN Repository Access</title>
		<link>http://www.karlkraft.com/index.php/2012/01/18/mysql-svn-repository-access/</link>
		<comments>http://www.karlkraft.com/index.php/2012/01/18/mysql-svn-repository-access/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 15:39:48 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=176</guid>
		<description><![CDATA[My source code for the Mysql Objective-C connector is now available via Subversion. You can grab the latest version at https://svn.karlkraft.com/mysql_connector/trunk The current trunk is in production use so the trunk is seldom broken. This update now requires ARC. Previous builds are available in https://svn.karlkraft.com/mysql_connector/versions]]></description>
			<content:encoded><![CDATA[<p>My source code for the Mysql Objective-C connector is now available via Subversion.  You can grab the latest version at https://svn.karlkraft.com/mysql_connector/trunk</p>
<p>The current trunk is in production use so the trunk is seldom broken.  This update now requires ARC.  Previous builds are available in https://svn.karlkraft.com/mysql_connector/versions</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2012/01/18/mysql-svn-repository-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I am the sole original author of NFMake&#8230;</title>
		<link>http://www.karlkraft.com/index.php/2011/10/09/i-am-the-sole-original-author-of-nfmake/</link>
		<comments>http://www.karlkraft.com/index.php/2011/10/09/i-am-the-sole-original-author-of-nfmake/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 19:00:00 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=171</guid>
		<description><![CDATA[I am the sole original author of NFMake, which currently appears on the GNU source code repository, and is marked &#8220;Copyright (C) 1999 Free Software Foundation, Inc.&#8221;. The only problem is that I never worked for the FSF, and I certainly never assigned the copyright to them. They claim ownership, copyright and the right to [...]]]></description>
			<content:encoded><![CDATA[<p>I am the sole original author of NFMake, which currently appears on the GNU source code repository, and is marked &#8220;Copyright (C) 1999 Free Software Foundation, Inc.&#8221;.  The only problem is that I never worked for the FSF, and I certainly never assigned the copyright to them.</p>
<p>They claim ownership, copyright and the right to license my source code as they see fit.</p>
<p>For a group so focused on open source, you think they would know better.<span id="more-171"></span>Recently, famous <a href="http://www.youtube.com/watch?v=I25UeVXrEHQ">toe cheese eater</a> and lead  zealot of the FSF, Richard Stallman, made what some might consider comments of poor taste regarding the death of Steve Jobs.  </p>
<p>I must admit once upon a time I shared the ideals of the FSF, but lately, not so much..</p>
<h2>About NFMake</h2>
<p>From the moment I laid eyes on a NeXT computer, I knew it was different.  Anyone lucky enough to use a NeXT computer, or later NeXTStep or OpenStep probably felt the same way.  </p>
<p>Those who declare themselves proponents of free software did what they most often do when confronted with something magnificent;  They set about to copy without any innovation.  They created a project called GNUStep designed to mimic OpenStep.  They couldn&#8217;t even come up with an original name.</p>
<p>I confess to falling prey to this siren song.  I had spent a decade programming in Objective-C and I wasn&#8217;t really quite sure if anything I wrote would be any more relevant than software I had written in AppleSoft, UCSD Pascal, or Turbo Pascal.</p>
<p>So I laid a plan to ensure I could take my Objective-C programs and compile them on a GNUStep target.  Loathing makefiles, I created NFMake, a tool that would read the NeXT formatted Project Builder file format and build the same project on GNUStep.</p>
<p>The original source as I first released it<br />
<a href="http://www.karlkraft.com/wp-content/uploads/2011/10/nfmake.tar.gz" title="nfmake.tar.gz" alt="Source Code">is available for you to peruse.</a></p>
<p>You will notice that nowhere in my original tarball do the initials GNU, FSF or GPL appear.</p>
<p>I last used NFMake when I was building software for the Palm platform.  Eventually I abandoned it as GNUStep stalled, Palm died, an Apple released OSX and incredible tools like Xcode.</p>
<h2>Copyright Who ?!?</h2>
<p>If you do a Google search for NFMake, you can find it <a href="http://svn.gna.org/viewcvs/gnustep/tools/nfmake/?pathrev=23729">hosted on &#8220;gna&#8221;,</a> the gnu project repository.</p>
<p>The difference is that almost every source file has had a header tacked on that starts with:</p>
<p><code><br />
/* <br />
   Copyright (C) 1999 Free Software Foundation, Inc.</p>
<p></code></p>
<p>NFMake was not a work for hire (at least not hired by FSF), and the copyright was never assigned to them or anyone else.  </p>
<p>Equally interesting is that the source is listed as LGPLv2, but at some point someone decided they could relicense it GPLv3, a license that I despise.</p>
<p>Whatever the reason, it should have never been done.</p>
<p>If you have ever released your source, you may want to take this moment to make sure the FSF isn&#8217;t claiming ownership of your work as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2011/10/09/i-am-the-sole-original-author-of-nfmake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Here&#8217;s to the Crazy Ones</title>
		<link>http://www.karlkraft.com/index.php/2011/10/06/heres-to-the-crazy-ones/</link>
		<comments>http://www.karlkraft.com/index.php/2011/10/06/heres-to-the-crazy-ones/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 13:01:50 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=166</guid>
		<description><![CDATA[I don&#8217;t normally post links to random stuff I see on the net, but this was is particularly fitting. The famous Apple commercial, but narrated by Steve Jobs instead of by Richard Dreyfus.]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t normally post links to random stuff I see on the net, but this was is particularly fitting.</p>
<p>The <a href="http://www.youtube.com/watch?v=8rwsuXHA7RA&#038;feature=player_embedded">famous Apple commercial</a>, but narrated by Steve Jobs instead of by Richard Dreyfus.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2011/10/06/heres-to-the-crazy-ones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql for iPhone and OSX &#8211; Version 2.0</title>
		<link>http://www.karlkraft.com/index.php/2011/06/07/mysql-for-iphone-and-osx-version-2-0/</link>
		<comments>http://www.karlkraft.com/index.php/2011/06/07/mysql-for-iphone-and-osx-version-2-0/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 20:15:22 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=162</guid>
		<description><![CDATA[It has been a while since I released an update to my MysqlConnector but I wanted to get this and a few other things out before WWDC, but it didn&#8217;t happen. The zip file weighs in at about 11 MB. Most updates will require no changes. Things will just work better. MysqlConnection supports an idle [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I released an update to my MysqlConnector but I wanted to get this and a few other things out before WWDC, but it didn&#8217;t happen.  <span id="more-162"></span><a href="http://www.karlkraft.com/wp-content/uploads/2011/06/MysqlConnector_2.0.zip" title="MysqlConnector_2.0.zip" alt="">The zip file</a>  weighs in at about 11 MB.</p>
<p>Most updates will require no changes.  Things will just work better.</p>
<p>MysqlConnection supports an idle loop that sends a periodic request to the MySQL server to keep the connection alive.  However this wasn&#8217;t protected in multi threaded programs and could crash.</p>
<p>MysqlFetch was creating the name of the field on each row iteration.  On large selects this resulted in a large amount of duplicated memory being allocated.</p>
<p>MysqlFetch now supports the DECIMAL type.</p>
<p>MysqlFetch now deals with negative LONG and LONGLONG values. Corrected the size of these types on 64 bit compiles to match the MySQL definition.  Also fixed the use of TINY, FLOAT and DOUBLE.  Thanks to Bill Allen for contributing this code.</p>
<p>Added support for connecting to multiple servers in a failover pattern.  Connection are now created with a MysqlServer instance or array of the same.  This will require a code change, and you will need to add MysqlServer to your project.</p>
<p>Fixed some debug messages.  Two of them had bad formatting, and one was still using NSLog.</p>
<p>Added a method to check status of autocommit.</p>
<p>Add ability to ignore mysql error when a record is inserted that matches a previously inserted records unique value for 1 or more columns. I have to admit that I ended up not using this code, so it is of dubious value.</p>
<p>The length of data passed to mysql_stmt_prepare needs to be expressed in byte length, not character length.   Thanks to Coupez Julien for pointing this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2011/06/07/mysql-for-iphone-and-osx-version-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Memorial Day Story</title>
		<link>http://www.karlkraft.com/index.php/2011/05/30/a-memorial-day-story/</link>
		<comments>http://www.karlkraft.com/index.php/2011/05/30/a-memorial-day-story/#comments</comments>
		<pubDate>Mon, 30 May 2011 20:27:49 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=160</guid>
		<description><![CDATA[I haven&#8217;t posted in a while because I&#8217;ve been busy getting ready for WWDC, and suffering a bit of writers block. To get things flowing again, I&#8217;m going to take a moment to tell you a Memorial Day story. In December of 1987 I went on a school trip to Washington DC. As part of [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t posted in a while because I&#8217;ve been busy getting ready for WWDC, and suffering a bit of writers block.  To get things flowing again, I&#8217;m going to take a moment to tell you a Memorial Day story.</p>
<p><span id="more-160"></span>In December of 1987 I went on a <a href="http://www.closeup.org/">school trip to Washington DC</a>.  As part of that trip we visited the <a href="http://en.wikipedia.org/wiki/Vietnam_Veterans_Memorial">Vietnam Veterans Memorial</a>. While there we learned all sorts of facts about the angle of reflection, how the memorial came to be, and dozens of other things that are now only a dim recollection.</p>
<p>What I do remember is that as our bus of high school students disembarked, the group I was with came upon a man who reeked of booze, and had on his back the clothes he probably lived in every day.  Everyone in the group walked around him and avoided any interaction. But something about him seemed irregular for an average homeless man.  I also really had no interest in the memorial. It is a list of 50,000+ people that I have never met.</p>
<p>He looked like he was looking for something, and muttering under his breath about &#8220;finding&#8221;.  I must admit that my thought was that he had lost his shopping cart of belongings.  Deciding that interacting with this homeless drunk was going to be a more worthy use of my time than looking at granite, I asked him what he was looking for in the hopes that I could help him find it.</p>
<p>He said he was looking for his friend.  So I looked around for a similarly dressed drunk homeless man in the hopes that I could point him on the way.  Seeing none nearby,  I asked where he had last seen his friend in the hopes that I could point him in the right direction. I can&#8217;t recall the words, but with the words he spoke it was made clear that the last time he had seen his friend was in Vietnam.</p>
<p>The I understood.  He wasn&#8217;t looking for a person. He was looking for a name.</p>
<p>Trying to find a name by reading them one at a time is difficult, although I did try for a minute.  I then recalled that a few minutes earlier when listening to facts about the wall, that we were told about a stand on one end that had a alphabetical list of names since the names on the wall are in order of death.</p>
<p>It took a bit of convincing to get my new companion to go to the book, since he knew the name was somewhere on the wall, but at least now I understood what he was trying to find.  The index on the pedestal was in the form of a phone book.  Unlike the wall it lists the service, the rank, and a few other details also lost to memory.  </p>
<p>The details he had were few, he had only a common last name, his rank, and the year he died. </p>
<p>The year was off by one.  His friend received a posthumous promotion.  </p>
<p>We walked down to the eastern panel listed in the index, and found the name.  He broke down in tears, and I went to a nearby kiosk that sold kits for making name impressions.  I helped him make an impression of the name, and left him there. </p>
<p>One of my pet peeves is the confusion of Memorial Day and Veterans Day, but I can never forget.</p>
<p>Memorial Day is for the war dead, the names on the wall.</p>
<p>Veterans Day is for those still alive with memories of the dead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2011/05/30/a-memorial-day-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The iPad killer has arrived</title>
		<link>http://www.karlkraft.com/index.php/2010/11/01/the-ipad-killer-has-arrived/</link>
		<comments>http://www.karlkraft.com/index.php/2010/11/01/the-ipad-killer-has-arrived/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 22:49:06 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=155</guid>
		<description><![CDATA[So a review of the latest iPad killer had arrived on TechRadar.com.  Now I am a believer that each product should stand alone, so it would be unfair to just compare it to the iPad.  While pixels, megahertz, and megabytes can be counted, they are seldom the true measure of the device, so I read [...]]]></description>
			<content:encoded><![CDATA[<p>So a review of the latest iPad killer had arrived on <a href="http://www.techradar.com/reviews/pc-mac/laptops-portable-pcs/laptops-and-netbooks/samsung-galaxy-tab-903545/review?artc_pg=1&amp;utm_source=DARING+FIREBALL%24%7B++http%3A%2F%2Ffeeds.feedburner.com%2Fdaringfireball%2FIZKt%7D&amp;utm_medium=twitter&amp;utm_campaign=Feed%3A+%24%7B++http%3A%2F%2Ffeeds.feedburner.com%2Fdaringfireball%2FIZKt%7D+%28%24%7BDaringFireball%7D%29&amp;utm_content=%24cengizadabag%40gmail.com%7D">TechRadar.com</a>.  Now I am a believer that each product should stand alone, so it would be unfair to just compare it to the iPad.  While pixels, megahertz, and megabytes can be counted, they are seldom the true measure of the device, so I read through the entire review to find why it deserves the three stars.   As I read, I highlighted the key phrases that described each feature So hear is the section by section summary, and came to the following conclusion about the three stars.</p>
<p><span id="more-155"></span>The first star was because it was an Android tablet, and there aren&#8217;t many of those. </p>
<p>The second star is because it isn&#8217;t an iPad.</p>
<p>The third star is because it runs pseudo flash.  Everyone keep talking about flash support for mobile devices, but when you get down to the nitty and the gritty, it always seems to mostly be there, and usually just for playing videos off YouTube.  As shown in the review, BBC flash doesn&#8217;t work.</p>
<p>As for all the negatives mentioned, they don&#8217;t detract from the score at all.</p>
<p><strong>﻿Keeping up appearances &#8211; </strong><em>﻿feels adequately sturdy and tough</em></p>
<p><strong>﻿Screen &#8211; </strong><em>﻿However, the 7-inch display we have here is just a fairly standard TFT LCD. It&#8217;s bright and colourful enough</em></p>
<p><strong>﻿Connectivity &#8211; </strong><em>﻿ not available in non-3G guise </em></p>
<p><strong>﻿Storage &#8211; </strong><em>﻿ 512MB of RAM &#8230;. de facto amount for these kind of portable devices </em></p>
<p><strong>﻿Performance and Battery Life &#8211; </strong><em>﻿ not slick at all &#8230;. Scrolling down your average website is quite juddery &#8230;. Pinch-to-zoom is also a laggy affair </em></p>
<p><strong>﻿Accelerometer &#8211; </strong><em>﻿ we found it constantly tilting the screen in ways we didn&#8217;t want it to &#8230;. increasingly frustrating experience </em></p>
<p><strong>﻿Multitasking &#8211; </strong><em>﻿ did not suffer too much in this department </em></p>
<p><strong>﻿Maps &#8211; </strong><em>﻿ obvious lag, which is disappointing </em></p>
<p><strong>﻿Battery Life &#8211; </strong><em>﻿ We charged it to full capacity, and it was begging for more juice after about four hours of sporadic testing &#8230;. device gets extremely hot after watching videos or browsing the web for an hour &#8230;. doesn&#8217;t do a good enough job of harnessing its power in an efficient manor </em></p>
<p><strong>﻿Software not optimised? &#8211; </strong><em>﻿ Google itself admits that the OS is not optimised for tablets yet &#8230;. Froyo is not optimised for use on tablets &#8230;. it&#8217;s just not a finished piece of software in terms of tablet optimisation &#8230;. graphics and text within them can look a bit blurry </em></p>
<p><strong>﻿Screen (Performance) &#8211; </strong><em>﻿ the absence of an AMOLED display is a bit of a let-down, particularly at this premium price </em></p>
<p><strong>﻿Indoors &#8211; </strong><em>﻿ Cartoons and Pixar-style 3D animations look best, while the screen does a less good job at handling darker colours </em></p>
<p><strong>﻿Outdoors &#8211; </strong><em>﻿massive pain &#8230;. literally impossible to see anything on it at all &#8230;. screen makes life pretty difficult<br />
</em></p>
<p><strong>﻿Responsiveness &#8211; </strong><em>﻿ not a fun device to use </em></p>
<p><strong>﻿Usability (Keyboard) &#8211; </strong><em>﻿ keyboard is not exactly what you&#8217;d call &#8216;comfortable&#8217; to use. Typing quickly is not easy at all </em></p>
<p><strong>﻿Flash support &#8211; </strong><em>﻿ no noticeable performance issues here, it just works </em></p>
<p><strong>﻿Multi-tasking &#8211; </strong><em>﻿ Android 2.2 supports multitasking, and thus so does the Samsung Galaxy Tab </em></p>
<p><strong>﻿Copy and paste &#8211; </strong><em>﻿ Copy and paste features are included </em></p>
<p><strong>﻿Email and extras &#8211; </strong><em>﻿ We heart Android here at TechRadar </em></p>
<p><strong>﻿Camera &#8211; </strong><em>﻿ To say the Samsung Galaxy Tab&#8217;s camera is mediocre would be to put it bluntly &#8230;. quite awkward to take snaps with &#8230;. hard to get a proper grip on the device and to then hold it still &#8230;. Images lack detail in all areas &#8230;. most photographs looking quite washed out &#8230;. Colours look faded rather than vivid &#8230;. The camera struggled to deal with both bright and dark conditions </em></p>
<p><strong>Video Recording &#8211; </strong><em>﻿There&#8217;s no HD recording &#8230;.  results were still mostly disappointing &#8230;. handling of motion isn&#8217;t too bad &#8230;. quality isn&#8217;t great &#8230;. Colours are washed out &#8230;. contrast is quite poor &#8230;. Galaxy Tab&#8217;s video quality is not great</em></p>
<p><strong>﻿Media &#8211; </strong><em>﻿ it&#8217;s limited to which codecs and support Google has added to the OS &#8230;. some of our files worked while others didn&#8217;t </em></p>
<p><strong>﻿Youtube &#8211; </strong><em>﻿ browsers will always try to take you away from the 720p versions of videos even if you use the direct URL </em></p>
<p><strong>﻿BBC Video &#8211; </strong><em>﻿some browsers, we were told that our &#8216;phone&#8217; does not support iPlayer yet &#8230;. main browser &#8230;. it&#8217;s a bit tricky to get videos playing well &#8230;. It&#8217;s a fiddly experience<br />
</em></p>
<p><strong>﻿Verdict &#8211; </strong><em>﻿ massive identity problem &#8230;. most bipolar gadget we&#8217;ve ever tested &#8230;. Is it a phone? No &#8230;. Is it a tablet? Again, no &#8230;. sluggish web browsing is very frustrating &#8230;. screen is also quite disappointing &#8230;. camera, too, is fairly poor &#8230;. you expect all the features to be top-notch&#8230; But they&#8217;re not &#8230;. If portability and Android are your main concern, the Galaxy Tab is certainly a handy gadget to have in your geeky arsenal<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2010/11/01/the-ipad-killer-has-arrived/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql for iPhone and OSX</title>
		<link>http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/</link>
		<comments>http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 08:07:03 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=149</guid>
		<description><![CDATA[A while back I posted an Objective-C library for accessing MySQL, but it was limited to working on Desktop OSX, and had no support for running on the iPhone or iPad.  This release fixes that. Download ﻿Objc_Mysql_iPhone_OSX_1.0.zip (7.3 MB), while you read the rest.   Support for iOS I had been hoping that with the announcement [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/">while back</a> I posted an Objective-C library for accessing MySQL, but it was limited to working on Desktop OSX, and had no support for running on the iPhone or iPad.  This release fixes that.</p>
<p>Download ﻿<a title="Objc_Mysql_iPhone_OSX_1.0.zip" href="http://www.karlkraft.com/wp-content/uploads/2010/09/Objc_Mysql_iPhone_OSX_1.0.zip">Objc_Mysql_iPhone_OSX_1.0.zip</a> (7.3 MB), while you read the rest.</p>
<p><span id="more-149"></span>
<p> </p>
<p><span style="font-size: 18px; font-weight: bold;">Support for iOS</span></p>
<p>I had been hoping that with the announcement of new devices and versions of iOS, that Apple might add garbage collection to the iOS platform, but this appears to not be happening.  So the time was right to bite the bullet and clean this up so it worked on iOS.</p>
<p>﻿Before you jump with both feet into using MySQL on iOS, let me point out a few reasons you may not want to use this as a solution.</p>
<p>If you are planning on submitting an application with this library to the AppStore, there is no guarantee that it will be accepted by Apple.  While I use this library on a daily basis for my code, I don&#8217;t have any plans to submit anything to the Apple Store using this library, for the reasons I will outline shortly.  So an AppStore submission that uses this library will be on the bleeding edge.</p>
<p>While MySQL is popular, it is not designed to be a forward facing internet accessible application.  All of my MySQL deployments are hidden behind firewalls with limited access.    If you use this to allow people to access a public MySQL database, you are asking for trouble, both in terms of load handling and security.  Keep in mind that AppStore apps are not encrypted, only signed.  So extracting the username, password and host from your binary is a trivial exercise.</p>
<p>You may find this useful however for in house iOS applications, which is where I am using it.</p>
<p><span style="font-size: 18px; font-weight: bold;">Features, functionality and bug fixes﻿</span></p>
<h2><span style="font-weight: normal; font-size: medium;">In adition to the major new feature of iOS support, this version has several bug fixes, plus some added functionality.</span></h2>
<p> </p>
<p>﻿This version features 6 architectures in a single static library.  The architectures are  armv6 and armv7 for iOS, and ppc, ppc64, i386, and x86_64 for desktop OSX.  While this increases the download size, only the architectures matching your target will be included in your final product.  So if you are building for iPhone 4 only, then only armv7 will be included.  If you are building for Snow Leopard on 64 bit, then only x86_64 will be included.</p>
<p>The iPhone versions should work on 3.0 all the way up to 4.1.</p>
<p>Since the iPhone does not have garbage collection, I had to #ifdef some code to get it working correctly there.  While it has not been tested extensively, the most common cases have been tested with Instruments, and there are no leaks.</p>
<p> </p>
<p>Since the most common case for non garbage collected environments is the iPhone, the default size for blobs is is 10K on those platforms and 1M in garbage collected environments.  Blobs under those sizes are grabbed in a single pass, blobs larger than that take a second pass, which is slower, but transparently done after the initial fetch.  Of course, since source is included, you can change that if you have special needs.</p>
<p>MysqlFetchField will now identify which fields are part of the primary key.</p>
<p>Even though the classes were garbage collected, the underlying MySQL ANSI-C connector was not, and there were some bugs related to memory allocation that have been cleaned up.</p>
<p>MysqlConnection now supports strict mode.  In strict mode, if you insert data that is too long for a field it will throw an exception instead of being silently truncated.</p>
<p>While this code is in day to day use in dozens of projects, it by no means is bug free.  Caveat emptor.  In particular, since iOS does not support NSCalendarDate I needed to move to NSDateComponents.  As a result, when invalid dates like &#8217;0000-00-00 00:00:00&#8242; are fetched, they will be munged into something else. (although it appears consistent)</p>
<p> </p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Panic people in line for the iPhone 4G</title>
		<link>http://www.karlkraft.com/index.php/2010/06/24/how-to-panic-people-in-line-for-the-iphone-4g/</link>
		<comments>http://www.karlkraft.com/index.php/2010/06/24/how-to-panic-people-in-line-for-the-iphone-4g/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 14:20:16 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=145</guid>
		<description><![CDATA[I arrived at the Apple store at The Domain in Austin this morning about 6:30.  The lines were so long there was no point in trying to get into line quickly, so I decided to spend a few minutes counting the number of people in line. As I went down the lines counting, I could [...]]]></description>
			<content:encoded><![CDATA[<p>I arrived at the Apple store at The Domain in Austin this morning about 6:30.  The lines were so long there was no point in trying to get into line quickly, so I decided to spend a few minutes counting the number of people in line.</p>
<p><span id="more-145"></span>
<p>As I went down the lines counting, I could not believe the amount of stress that I induced in those being counted.  People quickly began to worry about whether they were too far back in line to get a phone, or even if they were in the right line.  I was stopped about every 25 people asking what their number in line was. I had to explain over and over that I wasn&#8217;t counting for any purpose.</p>
<p>For the record, by the time 7 AM rolled around there were 700 total people in the two lines.  During that time I&#8217;m sure the line grew, because I started with the no-reservation line first, and then proceeded to the reserved line, which wound around the building in a different direction.  Between 7AM and 7:20, another 82 people showed up in the reserved line behind me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2010/06/24/how-to-panic-people-in-line-for-the-iphone-4g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql and Objective-C</title>
		<link>http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/</link>
		<comments>http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 02:02:15 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=137</guid>
		<description><![CDATA[In honor of Objective-C becoming a top-ten language, I&#8217;ve decided to share a library of source code I created to access MySQL. Update: A newer post has a version of this library that works on the iPhone as well. Over the past 2 years I&#8217;ve worked on a small bit of glue to make selects, [...]]]></description>
			<content:encoded><![CDATA[<p>In honor of <a href="http://apple.slashdot.org/story/10/06/02/1930209/Objective-C-Enters-Top-Ten-In-Language-Popularity">Objective-C becoming a top-ten language</a>, I&#8217;ve decided to share a library of source code I created to access MySQL.</p>
<p><span id="more-137"></span>
<p><em>Update: A <a href="http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/">newer post</a> has a version of this library that works on the iPhone as well.</em></p>
<p>Over the past 2 years I&#8217;ve worked on a small bit of glue to make selects, updates, inserts and deletes work easily from Objective-C.  This includes support for converting MySQL types to Cocoa types, working correctly with garbage collection, and support for reading and writing large blobs.</p>
<p>It is possible to do all these things with the generic MySQL C connector, and if your needs are simple that can be a quick way to access a MySQL databases, since all C libraries can easily be called from Objective-C.  However, once you start dealing with more advanced topics, the C connector can become burdensome.</p>
<p>If you are working on intel platforms only, you should grab the intel only version.  This supports both 32 and 64 bit intel platforms, using version 6.0.2 of the MySQL C Connector.</p>
<p><a href="http://www.karlkraft.com/wp-content/uploads/2010/06/ObjC_mysql_intel.zip">ObjC_mysql_intel.zip﻿</a> 5.5 MB &#8211; 32/64 bit</p>
<p>I still have some client programs running on PPC boxes, but MySQL has dropped support for PPC based OSX﻿ in the most recent versions of the mysql_connector.  So I have an older version that I occasionally update, although not as often as the intel only version.  This version uses an older version (5.0.51a) of the MySQL C connector, and supports both 32 bit PPC and Intel platforms.</p>
<p><a title="ObjC_mysql_ppc.zip" href="http://www.karlkraft.com/wp-content/uploads/2010/06/ObjC_mysql_ppc.zip">ObjC_mysql_ppc.zip</a> ﻿2.3 MB &#8211; 32 bit intel and PPC.</p>
<p>Both versions use an identical syntax and are for the most part interchangeable.</p>
<p>﻿Both require that garbage collection be enabled in your application.  This means this version won&#8217;t support versions of iPhone OS that don&#8217;t include garbage collection. Which is pretty much all of them, as of the writing of this post.</p>
<p>Both include the headers and a static library for the MySQL C connector.</p>
<p>While I have used these libraries to process well over half a billion rows of MySQL data, they are not by any means guaranteed to be free of bugs.  The most recent fix was a leak in MysqlUpdate.  If you are interested in getting updates, subscribe to the <a href="http://www.karlkraft.com/index.php/category/mysql/feed/">MySQL Category Feed</a>, or <a href="mailto:karl@karlkraft.com?subject=MySQL SVN Access Request">email me</a> for access to the subversion repository for the project.</p>
<h1 style="font-size: 2em;">Adding to Your Project</h1>
<p>Once you have extracted the zip, add everything inside to your project.  The static mysql library will be linked into your application, and the headers and all the necessary bits to compile should just fall into place.</p>
<h3>Forming the connection</h3>
<p>You connect by creating an instance of MysqlConnection.  The best method for starting is</p>
<p> </p>
<pre>+ (MysqlConnection *)connectToHost:(NSString *)host
                              user:(NSString *)user
                          password:(NSString *)password
                            schema:(NSString *)schema
                             flags:(unsigned long)flags;
</pre>
<p>The best option for flags is MYSQL_DEFAULT_CONNECTION_FLAGS﻿</p>
<p>If you are connecting to a MySQL server that will kick you if inactive, call the method</p>
<pre>-[MysqlConnection startIdle]</pre>
<p>to start a low impact periodic select that will run once every 60 seconds.  Four additional methods add support for transactions</p>
<h3>Performing Selects</h3>
<p>Selects are pretty straight forward. Use MysqlFetch, and pass a SQL select command.  You can then look at the results property to get an array of dictionaries.  Each dictionary represents a single row.  They key will be the name of each column, and the value will be the Objective-C type that matches the column. If you aren&#8217;t sure of the names of the fields, you can look at the fields an fieldNames properties for more details.</p>
<pre>Example:
MysqlConnection *connection = [MysqlConnection connectToHost:@"serverName"
                                                        user:@"aUserName"
                                                    password:@"aPassword"
                                                      schema:@"myForumName"
                                                       flags:MYSQL_DEFAULT_CONNECTION_FLAGS];
MysqlFetch *userFetch = [MysqlFetch fetchWithCommand:@"select U_Number,U_Username from w3t_Users"
                                        onConnection:connection];
QLog(@"There are %d members",[userFetch.results count]);
for (NSDictionary *userRow in userFetch.results) {
  NSNumber *userNumber = [userRow objectForKey:@"U_Number"];
  NSString *userName = [userRow objectForKey:U_Username"];
  NSLog("%@ %@",userNumber,userName);
}
</pre>
<h3>Performing Deletes</h3>
<p>Deletes, inserts, and updates are very similar.  To perform a delete:</p>
<pre>MysqlDelete *deleteCommand = [MysqlDelete deleteWithConnection:connection];
delete.tableName=@"w3t_Users";
delete.qualifier=[NSDictionary dictionaryWithObject:@"3" andKey:@"U_Number"];
[deleteCommand execute];
</pre>
<p>You can then look at the affectedRows property to find out how many rows were deleted.</p>
<h3>Performing Inserts</h3>
<p>Inserts allow you to insert NSString, NSNumber, NSData, and NSNull.  All other classes are converted using their -description method.  The insert code uses bindings instead of composing a SQL string, so you don&#8217;t need to worry about escaping special characters, or filtering user input.</p>
<pre>MysqlInsert *insertCommand = [MysqlInsert insertWithConnection:connection];
insertCommand.table =@"w3t_Users";
NSData *picture = [NSData dataWithContentsOfFile:@"sample.png"];
NSString *password=@";'!#";
insertCommand.rowData=[NSDictionary dictionaryWithObjectsAndKeys:@"Karl Kraft",@"U_Username",
                                                          picture,@"U_UserImage"
                                                          password,@"UserPassword"
                                                          nil];
[insertCommand execute];
</pre>
<p>After the insert, you can get the auto increment rowid by using the rowid property on your MysqlInsert instance.</p>
<h3>Performing Updates</h3>
<p>Once you have mastered delete and insert, updates are a simple cross of the two.  Specify a qualifier, like you would for deletion, but rowData like you would use for an insert.  Only the specified fields in the rowData are modified.  Again you can pass NSString, NSNumber, NSData, and NSNull, and the values are inserted using bindings so that you don&#8217;t need to provide odd escapes.</p>
<p> </p>
<pre>MysqlUpdate *updateCommand = [MysqlInsert insertWithConnection:connection];
updateCommand.table =@"w3t_Users";
updateCommand.qualifier=[NSDictionary dictionaryWithObject:@"3" andKey:@"U_Number"];
NSData *picture = [NSData dataWithContentsOfFile:@"sample.png"];
NSString *password=@";'!#";
updateCommand.rowData=[NSDictionary dictionaryWithObjectsAndKeys:@"Karl Kraft",@"U_Username",
                                                          picture,@"U_UserImage"
                                                          password,@"UserPassword"
                                                          nil];
[updateCommand execute];
</pre>
<p>Like delete you can query the affectedRows property to find out how many records were updated.</p>
<h3>Catching exceptions</h3>
<p>Any exceptions while performing the mysql commands are thrown as MysqlException or a subclass of MysqlException.  Common reasons for exceptions being throw are:</p>
<ul>
<li>Unable to connect to the database, or wrong username / password </li>
<li>Commit or rollback fails </li>
<li>Unsupported field type in a MysqlFetch </li>
<li>Unqualified delete or update commands </li>
<li>Any underlying mysql error </li>
</ul>
<h3>MYSQL_LOGGING</h3>
<p>As a final useful trick you can define MYSQL_LOGGING in the CFLAGS of your project, or in a common header file, and useful debugging information will be generated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPad day one?</title>
		<link>http://www.karlkraft.com/index.php/2010/02/02/ipad-day-one/</link>
		<comments>http://www.karlkraft.com/index.php/2010/02/02/ipad-day-one/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 16:08:20 +0000</pubDate>
		<dc:creator>Karl Kraft</dc:creator>
				<category><![CDATA[Flotsam and Jetsam]]></category>

		<guid isPermaLink="false">http://www.karlkraft.com/?p=134</guid>
		<description><![CDATA[In a recent blog post, Marco Arment asked about the timing of iPad deployment. This is my response. Either I’m missing something, the initial iPad apps are going to suck, or we haven’t yet been told that iPad-native apps won’t be available for some period of time after the iPad’s launch. You are missing something. [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.marco.org/366130089">recent blog post</a>, Marco Arment asked about the timing of iPad deployment.  This is my response.</p>
<p><em>Either I’m missing something, the initial iPad apps are going to suck, or we haven’t yet been told that iPad-native apps won’t be available for some period of time after the iPad’s launch.</em></p>
<p>You are missing something.</p>
<p><span id="more-134"></span><em>The problem, of course, is that before day one, we won’t have iPads ourselves for development and testing. This wasn’t a problem for iPhone development: by the time the SDK was released, we had all been using iPhones for many months. We knew how iPhone apps should look and behave, and we could test our apps on our iPhones during development for three months before anyone could sell apps to customers.</em></p>
<p>No, <strong>we</strong> didn&#8217;t.  You might have, but thousands of others were left out in the cold, unwelcome to develop for the iPhone.  Apple tightly controlled who they allowed in, and many didn&#8217;t get developer keys until months after the App Store was opened for business.  Yes, <strong>we</strong> could develop on the simulator, but not on the phone itself.  This preferential treatment continued with the release of later beta SDKs and Firmwares. The entire time this was going on Apple was very coy about what they were doing.</p>
<p>You have based your 3 possibilities on a bed of false assumptions.</p>
<p><strong>You have assumed that you can go to the local Apple Retail store, buy an iPad and install software.</strong></p>
<p>This is not supported in the current SDK.  At this point you can&#8217;t even compile code to the A4.</p>
<p>Apple hasn&#8217;t said when it will be supported.</p>
<p>Most importantly there is no guarantee that your current developer certificate will allow you to cryptographically sign and install software on the iPad at all.</p>
<p>Your certificate may work for iPhone and iPod touch only.</p>
<p>Apple may require a separate enrollment fee to get a iPad certificate.</p>
<p>Apple may limit iPad certificates to a select few developers.  This limitation may be temporary or permanent.</p>
<p><strong>You have assumed that Apple will accept iPad apps from you sometime on or before &#8220;day 1&#8243;.</strong></p>
<p>Apple has made no such commitment.  </p>
<p>They have committed to their future iPad users that iPad specific apps will be ready on day 1, but they haven&#8217;t committed to any developers (AFAIK) that they can submit them.  </p>
<p>When it comes to the AppStore, Apple is not a matchmaker helping developers connect to users in a frictionless manner.  It sure seems that way and as an indie developer I like the AppStore, but it is what it is, which is Apples playground.</p>
<p><strong>You have assumed that there is a submission queue.</strong></p>
<p>Developers like data structures like FIFO, and lots of them refer to the &#8220;submission queue&#8221; but I have never seen documentation from Apple that submissions are handled in a first come first served manner.  Anecdotal evidence seems to indicate that the are several submission piles, and they are serviced at different rates.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.karlkraft.com/index.php/2010/02/02/ipad-day-one/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

