<?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>Juggleware Developers&#039; Blog &#187; Mac</title>
	<atom:link href="http://www.juggleware.com/blog/tag/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.juggleware.com/blog</link>
	<description>news and random thoughts from your friendly neighborhood independent developers at juggleware, llc</description>
	<lastBuildDate>Thu, 15 Jul 2010 20:43:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>mySQL to SQLite cheatsheet for iPhone developers</title>
		<link>http://www.juggleware.com/blog/2009/09/mysql-to-sqlite-cheatsheet-for-iphone-developers/</link>
		<comments>http://www.juggleware.com/blog/2009/09/mysql-to-sqlite-cheatsheet-for-iphone-developers/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 17:17:26 +0000</pubDate>
		<dc:creator>alec</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[Core Data]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.juggleware.com/blog/?p=140</guid>
		<description><![CDATA[Although I started writing this as a cheat-sheet for myself (after many hours of struggling with this by trial-and-error), I figured it would be helpful for other iPhone developers who&#8217;d like to take a mySQL database online and migrate it &#8230; <a href="http://www.juggleware.com/blog/2009/09/mysql-to-sqlite-cheatsheet-for-iphone-developers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Although I started writing this as a cheat-sheet for myself (after many hours of struggling with this by trial-and-error), I figured it would be helpful for other iPhone developers who&#8217;d like to take a mySQL database online and migrate it to their current iPhone project. While other tutorials cover how to read the database into the application from the coding point-of-view, this is just to make sure you get your data uncompromised from your existing mySQL database into a new SQLite DB that your iPhone app can read.</p>
<p>First of all, here&#8217;s what I am currently using; I am including versions in case that&#8217;s relevant to your situation:</p>
<ul>
<li><a href="http://dev.mysql.com/">MySQL</a> 5.0.81</li>
<li>MySQL charset: UTF8-Unicode (utf8)</li>
<li>MySQL connection collation: utf8_unicode_ci</li>
<li><a href="http://www.phpmyadmin.net/home_page/index.php">phpMyAdmin</a> &#8211; 2.11.9.5</li>
<li><a href="http://sqlitebrowser.sourceforge.net/">SQLite Database Browser</a> 1.3 (includes 3.3.5 of the SQLite database engine)</li>
<li>iPhone Dev Kit &#8211; 3.0</li>
<li>XCode 3.1.3</li>
<li>SQLite 3 framework found at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libsqlite3.dylib</li>
</ul>
<p>You can try other solutions for importing the data into a SQLite format, but I&#8217;ve had the best luck with Mauricio Piacentini&#8217;s SQLite Database Browser. <a href="http://www.sqlite.org/cvstrac/wiki?p=ManagementTools">Other options</a> you might want to try include a <a href="https://addons.mozilla.org/en-US/firefox/addon/5817">Firefox plugin</a>.</p>
<p><strong>Here are the steps, using SQLite Database Browser:</strong></p>
<ol>
<li><a href="http://www.juggleware.com/blog/wp-content/uploads/2009/09/phpAdmin-SQLite_export.png"><img class="size-medium wp-image-143 alignright" title="phpAdmin-SQLite_export" src="http://www.juggleware.com/blog/wp-content/uploads/2009/09/phpAdmin-SQLite_export-300x250.png" alt="phpMyAdmin options for exporting to SQLite" width="300" height="250" /></a>log into phpMyAdmin, select your database and go to <strong>Database&gt; Export</strong>.</li>
<li>On the export tab, make sure all databases are selected, and the <strong>&#8220;SQL&#8221;</strong> radio button is selected.</li>
<li>Select <strong>ANSI</strong> from the pulldown for export compatibility.</li>
<li>Uncheck all options under <strong>Structure</strong> and <strong>Data</strong>, but leave each section checked.</li>
<li><strong>Save as file</strong> should be checked, and probably be via ZIP or GZIP, just in case.</li>
<li>Click the <strong>Go</strong> button to download your file.</li>
<li>Extract the file and open it up in your favorite text editor (I use <a href="http://barebones.com/products/bbedit/">BBEdit</a>).</li>
<li>Find the first <strong>CREATE TABLE</strong> line. We need to modify these by hand to simplify the table creation so that SQLite doesn&#8217;t get confused. For example, my file came down looking like this after the comment section ended:<br />
<code><br />
CREATE TABLE dictionary (<br />
id int(11) NOT NULL auto_increment,<br />
word varchar(100) NOT NULL,<br />
adjective tinyint(1) NOT NULL default '0' COMMENT 'is an adjective',<br />
noun tinyint(1) NOT NULL default '0' COMMENT 'is a noun ',<br />
intro tinyint(1) NOT NULL default '0' COMMENT 'is an intro',<br />
PRIMARY KEY  (id),<br />
UNIQUE KEY words (word)<br />
);<br />
</code></p>
<p>You&#8217;ll want to edit this to remove pretty much everything but the most basic information and normalize the data types to <a href="http://www.sqlite.org/datatype3.html">SQLite 3 Data Types</a>, which are <strong>TEXT, NUMERIC, INTEGER, REAL, or BLOB</strong>.  Your CREATE TABLE should look something like this:</p>
<p><code>CREATE TABLE dictionary(<br />
id  INTEGER PRIMARY KEY ASC,<br />
word TEXT,<br />
adjective  INTEGER,<br />
noun INTEGER,<br />
intro TEXT<br />
);</code></p>
<p>I was using id as a primary key so I&#8217;ve added &#8220;PRIMARY KEY ASC&#8221; after &#8220;id INTEGER&#8221;. (Primary Keys are aliases to row IDs in SQLite, if you have questions read <a href="http://www.sqlite.org/lang_createtable.html#rowid">this</a>.)</p>
<p>However, I&#8217;ve noticed that the SQLite Database browser exports SQL in the even more simplified format with no datatype specification as such, which also seemed to work for me and may work just as well for your needs:</p>
<p><code>CREATE TABLE dictionary (id, word, adjective, noun, intro);<br />
</code></li>
<li>Continue going through your text file and fix all CREATE TABLE lines as in #8, above.</li>
<li>Check your file text encoding. BBEdit may default to Western (Mac OS Roman), which worked for me, but if you have problems you may need to set it to Unicode, depending on your character set.</li>
<li>Check your file for suspicious characters that might cause the import to choke. Single quotation marks used as apostrophes show up as escaped by themselves; for example <code>you're</code> becomes <code>you''re</code>. This seemed to import fine as long as the other guidelines are followed. Here&#8217;s what an example INSERT should look like:
<p><code>INSERT INTO dictionary VALUES(305, 'ne''er-do-well', 0, 1, 0);<br />
</code></li>
<li>Check your line endings. BBEdit defaulted to Unix (LF) which worked for me.</li>
<li>Open up SQLite Database Browser, create a new database (.db) file, and import your SQL text file by selecting <strong>File&gt; Import&gt; Database From SQL File</strong> from the menu.</li>
<li>Check your data by clicking the <strong>Browse Data</strong> tab and make sure everything came in all right. If not, go back over the steps. Look for weird characters, text and line encoding issues, and syntax issues. The only two commands in your file should be CREATE TABLE and INSERT, although technically it should probably begin with <code>BEGIN TRANSACTION;</code> and end with <code>COMMIT;</code></li>
</ol>
<p>Again these steps were derived mostly by trial-and-error, so there may be issues particular to your DB that these guidelines didn&#8217;t solve. Please feel free to add any corrections, tips, and questions to the comments area. </p>
<p>Also, I know that with the iPhone OS 3.0, Core Data can take care of a lot of database functionality for you. I&#8217;d love to hear how people made the transition, and especially how anyone got a pre-existing SQL database into a Core Data store.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.juggleware.com/blog/2009/09/mysql-to-sqlite-cheatsheet-for-iphone-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freedom Time now available for your desktop!</title>
		<link>http://www.juggleware.com/blog/2008/11/freedom-time-now-available-for-your-desktop/</link>
		<comments>http://www.juggleware.com/blog/2008/11/freedom-time-now-available-for-your-desktop/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 23:26:58 +0000</pubDate>
		<dc:creator>alec</dc:creator>
				<category><![CDATA[Freedom Time]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[Bush]]></category>
		<category><![CDATA[censor]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[countdown]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[satire]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.juggleware.com/blog/?p=91</guid>
		<description><![CDATA[I made a promise to myself on November 3. If Obama wins, I&#8217;ll make a downloadable version of Freedom Time for Mac and Windows and let everyone download it. Well, as everyone in the galaxy knows, we now have two &#8230; <a href="http://www.juggleware.com/blog/2008/11/freedom-time-now-available-for-your-desktop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I made a promise to myself on November 3. If Obama wins, I&#8217;ll make a downloadable version of Freedom Time for Mac and Windows and let everyone download it.</p>
<p>Well, as everyone in the galaxy knows, we now have two reasons to celebrate at 12:00:00 GMT -0500 on January 20, 2009: good riddance to the worst president of all time, and hello to the first African-American president (and the first president I ever voted for with a smile on my face!)</p>
<p>You don&#8217;t even need to have an iPhone now to have a virtual iPhone on your desktop.</p>
<p>Watch the actual countdown on this page:</p>
<p><a href=" http://www.juggleware.com/iphone/freedomtime/"> http://www.juggleware.com/iphone/freedomtime/ </a></p>
<p>and download the version for your computer and keep it on.</p>
<p>Only 73 days left! TIME for a NEW leader!</p>
<p>Tip: click on the screen to hear the next Bush quote. (These are all actual audio quotes by Bush and are unedited.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.juggleware.com/blog/2008/11/freedom-time-now-available-for-your-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
