<?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>Open Source Web Thoughts &#187; linux</title>
	<atom:link href="http://blog.dewaldbotha.co.za/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dewaldbotha.co.za</link>
	<description></description>
	<lastBuildDate>Fri, 25 Nov 2011 09:17:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>MySQL data dumps done right.</title>
		<link>http://blog.dewaldbotha.co.za/2009/04/08/mysql-data-dumps-done-right/</link>
		<comments>http://blog.dewaldbotha.co.za/2009/04/08/mysql-data-dumps-done-right/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 11:17:19 +0000</pubDate>
		<dc:creator>dewaldbotha</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[data only]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[procedures]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[triggers]]></category>

		<guid isPermaLink="false">http://blog.dewaldbotha.co.za/2009-04-08/mysql-data-dumps-done-right/</guid>
		<description><![CDATA[To dump data in MySQL command line is one of the easiest things to do.  All you have to do is follow these 3 easy steps in your linux command line: 1.  Dump the schema only.  This will  not contain any data, procedures or triggers, but only create info.  This will allow you to easily <a href="http://blog.dewaldbotha.co.za/2009/04/08/mysql-data-dumps-done-right/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>To dump data in MySQL command line is one of the easiest things to do.  All you have to do is follow these 3 easy steps in your linux command line:</p>
<p>1.  <strong>Dump the schema only</strong>.  This will  not contain any data, procedures or triggers, but only create info.  This will allow you to easily import your original schema later on.</p>
<pre lang="php">
mysqldump -uroot -proot -d --skip-triggers myDatabase > myDatabase_schema.sql</pre>
<p>The -u specifies your username, and must be followed by your username e.g. -uroot.  This is the same with your password, -proot.</p>
<p>The -d tells mysqldump to not dump any data in the schema and the &#8211;skip-triggers will skip all triggers and procedures.</p>
<p>The myDabase is the name of your database and the > myDatabase_schema.sql is where you want to dump it.</p>
<p>2.  <strong>Dump the triggers/procedures</strong>.  This will only contain the triggers and procedures contained within your database.</p>
<pre lang="php">
mysqldump -uroot -proot -d --no-create-info myDatabase > myDatabase_triggers_procs.sql</pre>
<p>Here we have a &#8211;no-create-info to tell mysqldump that no create statements must be allowed, thus eliminating any schema sql and again the -d parameter to skip all data.</p>
<p>3. <strong> Dump the data only</strong> without triggers and create statements.</p>
<pre lang="php">
mysqldump -uroot -proot --skip-triggers --no-create-info myDatabase > myDatabase_base_data.sql</pre>
<p>Finally we can dump the data only.  The &#8211;skip-triggers skips all triggers and procedures, whils the &#8211;no-create-info skips sql create statements.</p>
<p><strong>This will allow you to have 3 different sql files:</strong></p>
<ul>
<li>myDatabase_schema.sql (only contains the schema)</li>
<li>myDatabase_triggers_procs.sql (only contains triggers/procs)</li>
<li>myDatabase_base_data.sql (only contains data)</li>
</ul>
<h3>Now to import.</h3>
<p>This is fairly trivial.</p>
<p>All you have to remember is to <strong>import your data in a sequence</strong>.</p>
<p>First the schema, then the triggers and procedures and then finally the base data.  The schema will create your tables, the triggers and procs can then be added to your tables and finally the tables can be populated with data.</p>
<p><strong>1.  Import schema</strong></p>
<pre lang="php">
mysql -uroot -proot myDatabase < myDatabase_schema.sql</pre>
<p><strong>2.  Import triggers/procs</strong></p>
<pre lang="php">
mysql -uroot -proot myDatabase < myDatabase_triggers.sql</pre>
<p><strong>3.  Import base data</strong></p>
<pre lang="php">
mysql -uroot -proot myDatabase < myDatabase_base_data.sql</pre>
<p>And your done. <img src='http://blog.dewaldbotha.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dewaldbotha.co.za/2009/04/08/mysql-data-dumps-done-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the down-low on mobile device detection</title>
		<link>http://blog.dewaldbotha.co.za/2009/02/19/the-down-low-on-mobile-device-detection/</link>
		<comments>http://blog.dewaldbotha.co.za/2009/02/19/the-down-low-on-mobile-device-detection/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 14:28:09 +0000</pubDate>
		<dc:creator>dewaldbotha</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[devicealtas]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[mobile device detection]]></category>
		<category><![CDATA[php alternative cache]]></category>
		<category><![CDATA[php apc]]></category>
		<category><![CDATA[wurfl]]></category>

		<guid isPermaLink="false">http://blog.dewaldbotha.co.za/2009-02-19/the-down-low-on-mobile-device-detection/</guid>
		<description><![CDATA[so &#8211; you say you want to detect which mobile devices hit your site? &#8211; in the past, this has been a bit of an issue, but lately &#8211; with really nice projects available out there such as WURFL or DeviceAtlas, you are able to concentrate harder on other issues, instead of having to write <a href="http://blog.dewaldbotha.co.za/2009/02/19/the-down-low-on-mobile-device-detection/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>so &#8211; you say you want to detect which mobile devices hit your site? &#8211; in the past, this has been a bit of an issue, but lately &#8211; with really nice projects available out there such as <a href="http://wurfl.sourceforge.net/" title="WURFL" target="_blank">WURFL</a> or <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a>, you are able to concentrate harder on other issues, instead of having to write a complete library of your own.</p>
<p>so for this, i&#8217;ve decided on <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a>.  just head on over to <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a> and open a developers account &#8211; you will get a one year developer&#8217;s license to play around to see how cool it is.</p>
<p>after registering &#8211; click on the <a href="http://deviceatlas.com/downloads" title="download DeviceAtlas" target="_blank">downloads</a> link &#8211; then go to the php example and download the source files.  after de-tar-and-un-zipping the file, just extract the contents.  at the moment all we are really interested in, is the <em><strong>Mobi/Mtld/DA </strong></em>directory and its contents &#8211; also create a <em><strong>json</strong></em> directory and drop the <em><strong>Sample.jso</strong></em>n file inside.</p>
<p>dump everything into a web directory somewhere. <img src='http://blog.dewaldbotha.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span id="more-16"></span>create a <em><strong>deviceatlas.php</strong></em> file in the working directory root and put the following inside.</p>
<pre lang="php">//includes the DeviceAtlas API

include 'Mobi/Mtld/DA/Api.php';//fetch the previously populated apc cache instance into a variable

$tree = apc_fetch('tree');

//Get the properties from a variable containing a JSON tree loaded from cache

$properties = Mobi_Mtld_DA_Api::getProperties($tree, $_SERVER['HTTP_USER_AGENT']);

//Output the phone properties for your viewing pleasure

print_r($properties);</pre>
<p>&#8216;hhmmm, that&#8217;s it?&#8217;, you might ask, and if you were clever you would have noticed something strange in the code above.</p>
<p>yip, that is pretty much it &#8211; but you also need caching.  the <em><strong>apc_fetch(&#8216;tree&#8217;)</strong></em> command in the code above actually fetches the json file already dumped into a &#8216;tree&#8217; cache instance in <a href="http://www.php.net/manual/en/intro.apc.php" title="PHP APC Cache" target="_blank">PHP APC</a> (Alternative PHP Cache).</p>
<p>why <a href="http://www.php.net/manual/en/intro.apc.php" title="PHP APC Cache" target="_blank">PHP APC</a>, you may also ask.  well, besides using the overstated <a href="http://www.danga.com/memcached/" title="Memcached" target="_blank">memcached</a> (<a href="http://www.phpbuilder.com/board/archive/index.php/t-10346692.html" title="Memcache vs APC" target="_blank">you might want to read this</a>), there are some methods to the madness.  with <a href="http://www.php.net/manual/en/intro.apc.php" title="PHP APC Cache" target="_blank">PHP APC</a>, the cache is shared on a server.  it might not be accessible from other servers, but this is not really a con in my mind.</p>
<p>if you wish to scale your application later one and add another server, there is going to be some issues, you might say &#8211; but there will also be issues if you have millions of users hit one central instance of <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a>.  so, having one instance of <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a> per server might not be too much of an issue.  also when it comes to updating the json file, you might want to consider the <a href="http://en.wikipedia.org/wiki/Single_point_of_failure" title="Single Point of Failure" target="_blank">single point of failure</a> issue of just having one server.</p>
<p>so have a couple of servers, and just write some scripts to update the single instances of <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a>, rather than updating one, already busy server which still needs a cache update.</p>
<p>but, back to business.</p>
<p>first you have to install <a href="http://www.php.net/manual/en/intro.apc.php" title="PHP APC Cache" target="_blank">PHP APC</a>.  i found <a href="http://www.howtoforge.com/apc-php5-apache2-debian-etch" title="Apc Installation guide" target="_blank">this handy guide</a> on the net, which helped me install it on my <a href="http://en.wikipedia.org/wiki/Debian" title="Debian" target="_blank">debian</a> system and integrate it with <a href="http://en.wikipedia.org/wiki/Apache_server" title="Apache" target="_blank">apache</a> and <a href="http://en.wikipedia.org/wiki/Php5" title="PHP 5" target="_blank">php5</a> &#8211; there is also a guide at the bottom for <a href="http://en.wikipedia.org/wiki/Red_hat" title="Red Hat" target="_blank">fedora</a> based machines, so don&#8217;t fret my <a href="http://en.wikipedia.org/wiki/Linux" title="Linux" target="_blank">linux</a> loving friends <img src='http://blog.dewaldbotha.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>you can create a php script to run the following &#8211; which should cache your <a href="http://deviceatlas.com/" title="DeviceAtlas" target="_blank">DeviceAtlas</a> tree into <a href="http://www.php.net/manual/en/intro.apc.php" title="PHP APC Cache" target="_blank">PHP APC</a>.</p>
<pre lang="php">//ads the sample json data from DeviceAtlas

apc_add('tree', Mobi_Mtld_DA_Api::getTreeFromFile("json/Sample.json"));</pre>
<p>from the first code example, the output might look something like this (depending on your phone)</p>
<p>Array<br />
(<br />
[wmv] =&gt; 0<br />
[vendor] =&gt; Nokia<br />
[mobileDevice] =&gt; 1<br />
[memoryLimitMarkup] =&gt; 357000<br />
[memoryLimitDownload] =&gt; 61440<br />
[midiMonophonic] =&gt; 1<br />
[midiPolyphonic] =&gt; 1<br />
[mpeg4] =&gt; 1<br />
[3gpp] =&gt; 1<br />
[drmOmaForwardLock] =&gt; 1<br />
[drmOmaCombinedDelivery] =&gt; 1<br />
[drmOmaSeparateDelivery] =&gt; 1<br />
[markup.xhtmlMp10] =&gt; 1<br />
[markup.xhtmlBasic10] =&gt; 1<br />
[image.Jpg] =&gt; 1<br />
[image.Png] =&gt; 1<br />
[amr] =&gt; 1<br />
[mp3] =&gt; 1<br />
[aac] =&gt; 1<br />
[h263Type0InVideo] =&gt; 1<br />
[gprs] =&gt; 1<br />
[edge] =&gt; 1<br />
[image.Gif87] =&gt; 1<br />
[uriSchemeTel] =&gt; 0<br />
[qcelp] =&gt; 0<br />
[hsdpa] =&gt; 0<br />
[amrInVideo] =&gt; 1<br />
[3gpp2] =&gt; 0<br />
[displayColorDepth] =&gt; 18<br />
[model] =&gt; N70<br />
[https] =&gt; 1<br />
[image.Gif89a] =&gt; 0<br />
[umts] =&gt; 0<br />
[displayWidth] =&gt; 176<br />
[displayHeight] =&gt; 208<br />
[markup.xhtmlMp11] =&gt; 0<br />
[markup.xhtmlMp12] =&gt; 0<br />
[csd] =&gt; 0<br />
[hscsd] =&gt; 0<br />
[id] =&gt; 204255<br />
[_matched] =&gt; NokiaN70<br />
[_unmatched] =&gt; -1/5.0609.2.0.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.1.13.0<br />
)</p>
<p><a href="http://deviceatlas.com/properties" title="DeviceAtlas properties" target="_blank">you can view the attribute explanations here </a></p>
<p>now you can use the phone&#8217;s specific properties to your advantage.  you also might want to look at the <a href="https://addons.mozilla.org/en-US/firefox/addon/59" title="User agent switcher" target="_blank">user agent switcher add-on</a> for firefox for testing purposes.</p>
<p>that&#8217;s it.  now every once in a while you can just update the json file, delete the current cache (<a href="http://www.php.net/manual/en/function.apc-delete.php" title="APC Delete Cache" target="_blank">http://www.php.net/manual/en/function.apc-delete.php</a>) and bob&#8217;s your device detecting, apc caching uncle.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dewaldbotha.co.za/2009/02/19/the-down-low-on-mobile-device-detection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>putting the &#8216;errrrrrr&#8217; in erlang</title>
		<link>http://blog.dewaldbotha.co.za/2008/12/10/putting-the-errrrrrr-in-erlang/</link>
		<comments>http://blog.dewaldbotha.co.za/2008/12/10/putting-the-errrrrrr-in-erlang/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 07:17:49 +0000</pubDate>
		<dc:creator>dewaldbotha</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[yaws]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lyme]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.dewaldbotha.co.za/2008-12-10/putting-the-errrrrrr-in-erlang/</guid>
		<description><![CDATA[so for a while i&#8217;ve been trying to do a small something, anything in erlang.  got myself pragmatic programming in erlang, setup yaws on my ubuntu machine and downloaded an erlang web framework called erlyweb that seemed to glow with potential. so, its been about 2 weeks, my fascination with erlang was as short lived <a href="http://blog.dewaldbotha.co.za/2008/12/10/putting-the-errrrrrr-in-erlang/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>so for a while i&#8217;ve been trying to do a small something, anything in erlang.  got myself <a href="http://oreilly.com/catalog/9781934356005/" title="Pragmatic Erlang" target="_blank">pragmatic programming in erlang</a>, setup <a href="http://yaws.hyber.org/" title="Yaws" target="_blank">yaws</a> on my ubuntu machine and downloaded an erlang web framework called <a href="http://erlyweb.org/" title="Erlyweb" target="_blank">erlyweb</a> that seemed to glow with potential.</p>
<p>so, its been about 2 weeks, my fascination with erlang was as short lived as a teenage holiday romance.  <a href="http://www.sics.se/~joe/apachevsyaws.html" title="Yaws and Erlang" target="_blank">the concurrent language</a> which would probably topple all others if the overheads weren&#8217;t so much.  erlang has a huge learning curve, don&#8217;t think just cause you dabble in a bit of ruby you will pick up this language in one go</p>
<p>i&#8217;m sure it will take a few years of dedication to get the best of this beast.  as for the yaws server i couldn&#8217;t find much fault.  and according to tests this is a solid winner.  erlyweb was a bit of a hickup.  from version incompatibilities to the dreaded &#8216;//&#8217; in the url (i think i might have gotten the sour deal of the experience).</p>
<p>so for now my quest to conquer erlang seem a bit like an empty dream, but my quest continues&#8230;.<a href="http://github.com/rklophaus/nitrogen/wikis" title="Nitrogen" target="_blank">with nitrogen</a>&#8230;some day</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dewaldbotha.co.za/2008/12/10/putting-the-errrrrrr-in-erlang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lyme, a stack of scalability</title>
		<link>http://blog.dewaldbotha.co.za/2008/11/25/lyme-a-stack-of-scalability/</link>
		<comments>http://blog.dewaldbotha.co.za/2008/11/25/lyme-a-stack-of-scalability/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 13:13:43 +0000</pubDate>
		<dc:creator>dewaldbotha</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[yaws]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lyme]]></category>

		<guid isPermaLink="false">http://blog.dewaldbotha.co.za/2008-11-25/lyme-a-stack-of-scalability/</guid>
		<description><![CDATA[so last week i&#8217;ve been to a conference in good ol&#8217; silicon valley - a lot of focus on scalability and performance.  that being said &#8211; i&#8217;ve decided to be proactive and try out a stack i&#8217;m totally unfamiliar with, but apparently with great potential. lyme &#8211; linux, yaws, mysql, erlang linux - the tried <a href="http://blog.dewaldbotha.co.za/2008/11/25/lyme-a-stack-of-scalability/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>so last week i&#8217;ve been to a conference in good ol&#8217; silicon valley -</p>
<p>a lot of focus on scalability and performance.  that being said &#8211; i&#8217;ve decided to be proactive and try out a stack i&#8217;m totally unfamiliar with, but apparently with great potential.</p>
<h3><strong>lyme</strong> &#8211; linux, yaws, mysql, erlang</h3>
<p><strong><a href="http://www.linux.org/" title="Linux" target="_blank">linux</a> </strong>- the tried and tested platform, open-source, and where all good things start.</p>
<p><strong><a href="http://yaws.hyber.org/" title="yaws" target="_blank">yaws</a> </strong>- <strong>y</strong>et <strong>a</strong>nother <strong>w</strong>eb <strong>s</strong>erver written in erlang, supposedly <a href="http://www.sics.se/~joe/apachevsyaws.html" title="performance test" target="_blank">outperforms apache with throughput and parallel sessions</a>.</p>
<p><a href="http://www.mysql.com/" title="mysql" target="_blank"><strong>mysql</strong></a> &#8211; i&#8217;m just a big fan, what can i say</p>
<p><strong><a href="http://www.erlang.org/" title="erlang" target="_blank">erlang</a> </strong>-  the language, created as a general purpose, concurrent language</p>
<p>so finally i got my <strong>lyme</strong> stack running on my machine &#8211; so now for the tedious process of evaluating it, and maybe do something like a simple user-to-user subscription service.  like the friends features of facebook <img src='http://blog.dewaldbotha.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>i&#8217;ll keep you informed with my findings, with a couple of code examples and a walkthrough of my experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dewaldbotha.co.za/2008/11/25/lyme-a-stack-of-scalability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

