<?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>Anorgan&#039;s blog about stuff</title> <atom:link href="http://blog.anorgan.com/feed/" rel="self" type="application/rss+xml" /><link>http://blog.anorgan.com</link> <description></description> <lastBuildDate>Tue, 01 May 2012 15:12:20 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Development environment</title><link>http://blog.anorgan.com/2012/05/01/development-environment/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=development-environment</link> <comments>http://blog.anorgan.com/2012/05/01/development-environment/#comments</comments> <pubDate>Tue, 01 May 2012 15:08:25 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Web]]></category><guid
isPermaLink="false">http://blog.anorgan.com/?p=319</guid> <description><![CDATA[This is a quick post on how to set up your own DNS server with...]]></description> <content:encoded><![CDATA[<p>This is a quick post on how to set up your own DNS server with custom <a
title="Top Level Domain" href="http://en.wikipedia.org/wiki/Top-level_domain" target="_blank">TLD</a>so you can easily and more quickly get started on your next project. I am doing my programming on the Linux machine (Ubuntu to be Precise <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). The idea behind this set-up is to evade the need to ever modify your <code>/etc/hosts</code> file. Also, there is a possibility to even skip the creating of Apache VirtualHost directive and restarting the web server. Onward with the How-To.</p><h2>Disclaimers:</h2><ul><li>I use Ubuntu, so substitute <code>apt-get</code> with <code>yum</code> or what ever you use</li><li>Anywhere you see the IP 192.168.1.253, replace with your own</li><li>I haven&#8217;t set up any forwarders in <code>named.conf.options</code></li></ul><h2>Install and configure DNS (BIND9)</h2><pre>sudo apt-get install bind9</pre><h3>Edit these files</h3><p><strong>/etc/bind/named.conf.local:</strong></p><pre>zone "dev" {
    type master;
    file "/etc/bind/db.dev";
};

zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/db.192.168.1";
};</pre><p><strong>/etc/bind/db.dev</strong></p><pre>$TTL	604800
@		IN		SOA		dev. root.dev. (
	             2012042301		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@		IN		NS	dev.
@		IN		A	192.168.1.253
*.dev.	14400 	IN 		A	192.168.1.253</pre><p><strong>/etc/bind/db.192.168.1:</strong></p><pre>$TTL	604800
@		IN		SOA		dev. root.dev. (
	     2012042301		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@		IN		NS		dev.
253		IN 		PTR		dev.</pre><p><em>Be careful to replace 253 in your files for your own last IP octet. Also, the filename should reflect your IP.</em></p><h2>DNS servers setup&#8230;</h2><p><a
href="http://blog.anorgan.com/wp-content/uploads/2012/05/networking.png"><img
class="alignleft size-full wp-image-327" title="Networking" src="http://blog.anorgan.com/wp-content/uploads/2012/05/networking.png" alt="" width="449" height="351" /></a>Ok, now that we got this set up, we need to tell our system to use the local DNS server before going for the ISP and beyond. To achieve this, use Networking manager in Ubuntu, here&#8217;s how mine looks like. The final goal is for the <code>/etc/resolv.conf</code> too read: <code>nameserver 127.0.0.1</code>.</p><h2 class="clear">&#8230;and finishing up</h2><p>Now that everything is set up, restart bind:</p><pre>sudo /etc/init.d/bind9 restart</pre><p>Test your setup by pinging anything.dev. If you get the response from your server, all is working great.</p><h2>Apache Virtual Document Root</h2><p>If your projects have similar / identical directory structure (i.e. <code>public</code> directory for publicly available files) than you can go a step further and setup the Apache Virtual Document Root. In doing so, you will be able to create a new directory in your projects root and have it magically turned up by calling http://newdirectory.dev.</p><pre>&lt;IfModule vhost_alias_module&gt;
    &lt;VirtualHost *&gt;
        UseCanonicalName Off
        VirtualDocumentRoot "/path/to/projects/%1/public"

        ServerName projects.dev
        ServerAlias *.dev

        SetEnv APPLICATION_ENV development
    &lt;/VirtualHost&gt;
&lt;/IfModule&gt;

# Enable mod_vhost_alias apache module
sudo a2enmod vhost_alias
# Restart server
sudo /etc/init.d/apache2 restart</pre><p>I don&#8217;t have this enabled for myself, but it does work, although not well tested. For further info on this topic, check the following links:</p><ul><li><a
title="Apache Module mod_vhost_alias" href="http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html" target="_blank">http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html</a></li><li>For Mac OS X, follow this example: <a
href="http://css.dzone.com/articles/drop-folder-directory-and-have" target="_blank">http://css.dzone.com/articles/drop-folder-directory-and-have</a></li></ul><p>P.S. Yes, I got carried away while creating the featured image <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2012/05/01/development-environment/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Comment driven development</title><link>http://blog.anorgan.com/2012/04/15/comment-driven-development/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=comment-driven-development</link> <comments>http://blog.anorgan.com/2012/04/15/comment-driven-development/#comments</comments> <pubDate>Sun, 15 Apr 2012 08:24:47 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web]]></category><guid
isPermaLink="false">http://blog.anorgan.com/?p=241</guid> <description><![CDATA[There is quite a handful of programming techniques out there; TDD, BDD, YAGNI, DRY to name a...]]></description> <content:encoded><![CDATA[<p>There is quite a handful of programming techniques out there; <a
title="Test-driven development" href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank">TDD</a>, <a
title="Behaviour-driven development" href="http://en.wikipedia.org/wiki/Behavior_driven_development" target="_blank">BDD</a>, <a
title="You ain't gonna need it" href="http://en.wikipedia.org/wiki/You_ain%27t_gonna_need_it" target="_blank">YAGNI</a>, <a
title="Don't repeat yourself" href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" target="_blank">DRY</a> to name a few. This post will be about something many people might already be doing but don&#8217;t know it has a name: <a
title="Comment driven development" href="http://en.wikipedia.org/wiki/Comment_programming" target="_blank">Comment-driven development</a> or comment programming.</p><p>CDD is helpful for:</p><ul><li>prototyping,</li><li>spitting out your thoughts in code editor, so you don&#8217;t forget anything later (good for brainstorming sessions),</li><li>explaining what needs to be done if someone else is going to be writing the code itself,</li><li>commenting the code <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Comments could remain, so your code is documented from the get-go</li></ul><p>I often start the new PHP file or class or even method with the layout in comments. Here&#8217;s an example:</p><pre class="brush: php">// Get the needed models
// Collect todo items
// Get lists that the todo items belong to
// Send to View</pre><p>Ok, everything is clear. After the real code sets in it looks like this:</p><pre class="brush: php">public function someAction()
{
    // Get the needed models
    $todoTable  = new TodoTable();
    $listTable  = new ListTable();

    // Collect todo items
    $todos      = $todoTable-&gt;findByAuthor($author);

    // Get lists that the todo items belong to
    foreach ($todos as &amp;$todo) {
        $todo['lists'] = $listTable-&gt;find($todo['list_id']);
    }

    // Send to View
    DIC::get('View')-&gt;todos = $todos;
}</pre><p>As you can see, the comments can stay in place. Even for this simple example, it is good practice to document your code.</p><p>The Wikipedia article states:</p><blockquote><p>In comment programming the comment tags are not used to describe what a certain piece of code is doing, but rather to stop some parts of the code from being executed. The aim is to have the commented code at the developer&#8217;s disposal at any time he might need it.</p></blockquote><p>And later on:</p><blockquote><p>However, comment programming is used instead of a real implementation. The idea is that many functions can be written like this, and then the design can be reworked and revisited without having to refactor a lot of source code.</p></blockquote><p>So, Wikipedia article is somewhat contradictory to itself. The aspect of comment programming I am writing about here is the &#8220;comments instead of a real implementation&#8221; part.</p><p>Do you write your code with comments first approach? Do you use some other technique?</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2012/04/15/comment-driven-development/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>MySQL Workbench 5.2.35 on Ubuntu 11.10 64bit (Oneiric Ocelot)</title><link>http://blog.anorgan.com/2011/10/19/mysql-workbench-5-2-35-on-ubuntu-11-10-64bit-oneiric-ocelot/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-workbench-5-2-35-on-ubuntu-11-10-64bit-oneiric-ocelot</link> <comments>http://blog.anorgan.com/2011/10/19/mysql-workbench-5-2-35-on-ubuntu-11-10-64bit-oneiric-ocelot/#comments</comments> <pubDate>Wed, 19 Oct 2011 07:43:48 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Web]]></category> <category><![CDATA[MySQL Workbench]]></category> <category><![CDATA[Ubuntu]]></category><guid
isPermaLink="false">http://blog.anorgan.com/?p=273</guid> <description><![CDATA[Well, if no one is gonna do it, you have to do it yourself. I...]]></description> <content:encoded><![CDATA[<p>Well, if no one is gonna do it, you have to do it yourself. I had the need for latest MySQL Workbench &#8211; 5.2.35, but I also upgraded to the latest Ubuntu, the Oneiric Ocelot (11.10). As with most of new things, I couldn&#8217;t get it to work out of the box, so little compiling session was in order. If you need the package, you can download the deb. It is for 64bit (amd64) architecture. This is the first time I have created a deb package, so I apologize in advance if I didn&#8217;t follow some basic rules.</p><blockquote><p><a
href="http://blog.anorgan.com/wp-content/uploads/2011/10/mysql_workbench_ubuntu11.10_x86_64.zip">MySQL Workbench 5.2.35 for Ubuntu 11.10 (64bit)</a></p></blockquote><p>&nbsp;</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2011/10/19/mysql-workbench-5-2-35-on-ubuntu-11-10-64bit-oneiric-ocelot/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Custom file input can&#8217;t be that hard?</title><link>http://blog.anorgan.com/2010/02/07/custom-file-input-cant-be-that-hard/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=custom-file-input-cant-be-that-hard</link> <comments>http://blog.anorgan.com/2010/02/07/custom-file-input-cant-be-that-hard/#comments</comments> <pubDate>Sun, 07 Feb 2010 00:07:10 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Web]]></category> <category><![CDATA[browse button]]></category> <category><![CDATA[css]]></category> <category><![CDATA[input field]]></category> <category><![CDATA[javascript]]></category><guid
isPermaLink="false">http://blog.anorgan.com/?p=244</guid> <description><![CDATA[Ok, this is a quick post. I wanted to style the input for file upload,...]]></description> <content:encoded><![CDATA[<p>Ok, this is a quick post. I wanted to style the input for file upload, and spent some time fine tuning. In order to have this for future use, I made a tutorial for myself <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . If you need to style file input, see my demonstration on how to fake <a
href="http://blog.anorgan.com/tutorials/fake_file_input.html">file type input</a> or download the file. This is in no way final or tested. If you have suggestions, please leave a comment.</p><blockquote><p><a
href="http://blog.anorgan.com/wp-content/uploads/2010/02/fake_file_input.zip">Fake file input</a></p></blockquote> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2010/02/07/custom-file-input-cant-be-that-hard/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Test projects viewer</title><link>http://blog.anorgan.com/2009/04/05/test-projects-viewer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=test-projects-viewer</link> <comments>http://blog.anorgan.com/2009/04/05/test-projects-viewer/#comments</comments> <pubDate>Sun, 05 Apr 2009 21:58:14 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[bind9]]></category> <category><![CDATA[DNS]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[subdomain]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[wildcard]]></category><guid
isPermaLink="false">http://blog.anorgan.com/?p=202</guid> <description><![CDATA[I have a couple of test projects in my test directory. This is where I...]]></description> <content:encoded><![CDATA[<p>I have a couple of test projects in my test directory. This is where I usually put the latest wordpress, phpBB or any other script or web software I would like to test out or develop and play with. Until recently I had to access those by writing the virtual host path (www.test.local) and then append the directory name (in.eg. /drupal). I got tired of it, and coded a nifty little &#8220;browser&#8221; which displays all of the directories and files. Combined with the DNS wildcards, you can have unlimited virtual domains without having to configure them in vhosts, setting the /etc/hosts and restarting apache server. I have included this in the zip file found at the end of this post.</p><p>We are using bind dns server to resolve everything that comes to the &#8220;test&#8221; domain to your machines IP address. After that, Apache takes care of the rest. And what he does is kinda cool. The .htaccess file has a set of rules to test weather the index.php exists in the requested directory (via subdomain), and if it does, he redirects us to that directory. If the index.php doesn&#8217;t exist, our &#8220;main&#8221; index.php shows the contents of that directory, so you can select any other file and run it. Let&#8217;s start.</p><p><span
id="more-202"></span>Setting up your DNS server under Ubuntu is best described <a
title="Ubuntu DNS bind" href="http://rustykruffle.com/tech-stuff/ubuntu/how-i-got-networking-and-dns-to-work-in-ubuntu-intrepid/" target="_blank">here</a>. I will only display contents of my files, so you know what to do. My hostname (/etc/hostname) is &#8220;ubuntu&#8221; and IP address of my machine is 192.168.253, so when ever you see one of those, change to your settings. To install bind, use synaptic (search for bind9), to start, stop or restart bind, pass those commands to /etc/init.d/bind9, i.e. &#8220;/etc/init.d/bind9 stop&#8221;. To edit the files I used vi, and I also had to be root, so I ran sudo -i to become one.</p><p><strong>/etc/hosts</strong></p><blockquote><p><code> 192.168.1.253 ubuntu<br
/> 192.168.1.253 www.test.local test.local </code></p></blockquote><p><strong>/etc/bind/named.conf.local</strong></p><blockquote><p><code>acl "local" {<br
/> 192.168.1.0/24;<br
/> 127.0.0.1;<br
/> };<br
/> zone "test" {<br
/> type master;<br
/> file "/etc/bind/zones/db.test";<br
/> allow-query { local; };<br
/> notify no;<br
/> };<br
/> // For reverse DNS<br
/> zone "1.168.192.in-addr.arpa" {<br
/> type master;<br
/> file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";<br
/> allow-query { local; };<br
/> };</code></p></blockquote><p><strong>/etc/bind/named.conf.options</strong></p><blockquote><p><code><br
/> options {<br
/> directory "/var/cache/bind";<br
/> forwarders {<br
/> 192.168.1.254;<br
/> };<br
/> auth-nxdomain no;    # conform to RFC1035<br
/> listen-on-v6 { any; };<br
/> };</code></p></blockquote><p><strong>/etc/bind/zones/db.test</strong></p><blockquote><p><code>$ORIGIN .<br
/> $TTL 86400 ; 1 day<br
/> test IN SOA test. (<br
/> 200904031 ; serial number (todays date appnded with '1')<br
/> 10800 ; refresh (3 hours)<br
/> 3600 ; retry (1 hour)<br
/> 604800 ; expire (1 week)<br
/> 86400 ; minimum (1 day)<br
/> )<br
/> $ORIGIN test.<br
/> @ NS ubuntu<br
/> ubuntu A 192.168.1.253 ;This is the hostname &amp; ip of my computer<br
/> test CNAME ubuntu<br
/> *.test CNAME ubuntu</code></p></blockquote><p><strong>/etc/bind/zones/rev.1.168.192.in-addr.arpa</strong></p><blockquote><p><code>$ORIGIN .<br
/> $TTL 86400 ; 1 day<br
/> 1.168.192.in-addr.arpa IN SOA test. (<br
/> 200904031 ; serial number (today's date appended with '1')<br
/> 28800 ; refresh (8 hours)<br
/> 14400 ; retry (4 hours)<br
/> 3024000 ; expire (5 weeks)<br
/> 86400 ; minimum (1 day)<br
/> )<br
/> $ORIGIN 1.168.192.in-addr.arpa.<br
/> @ NS ubuntu<br
/> 253 PTR ubuntu ;The 253 is the last octet of my machines ip address</code></p></blockquote><p>After the bind has been set up, restart it, and test it. You should make a virtual host that points to www.test.test. Now, if you type anything else as subdomain, you should get the test.test page again. Try with something.test.test, or anythingelse.test.test.  For apache setup i have &#8220;NameVirtualHost 192.168.1.253&#8243; in the main config and use</p><blockquote><p><code><br
/> ServerName      test.test<br
/> ServerAlias     *.test.test<br
/> DocumentRoot    "/path/to/test"<br
/> </code></p></blockquote><p>for every subdomain i need.</p><p>We now have our environment set up, and need the contents of the test directory displayed. For that we use the index.php to list the directories and files. The directories are linked to be the subdomains. Now, if you do get to the directory which does not include index.php, it&#8217;s contents will be displayed, and you will be able to click the file you want to run. This is handled by .htaccess. If you type the wrong subdomain, you will get a notice about missing directory. I still didn&#8217;t get directories with uppercase letters or dots to display, but this is enough.</p><p>I also did a brief search for the theme, and used one to display the content, so it has the feeling of a finished project, not my usual html without the css or even parts of html without the html, head and body parts <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Somehow I couldn&#8217;t justify using smarty here <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , so i did str_replace to modify the content of the template. Here is the download link so you can put it in the /test dir and see all your projects. Tell me what you think of it.</p><blockquote><p><a
href="http://blog.anorgan.com/wp-content/uploads/2009/04/test_environment.zip">Test environment viewer</a></p></blockquote> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2009/04/05/test-projects-viewer/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>I got the (mt) hosting</title><link>http://blog.anorgan.com/2009/03/08/i-got-the-mt-hosting/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=i-got-the-mt-hosting</link> <comments>http://blog.anorgan.com/2009/03/08/i-got-the-mt-hosting/#comments</comments> <pubDate>Sat, 07 Mar 2009 22:18:40 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Miscellaneous]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[(gs)]]></category> <category><![CDATA[(mt)]]></category> <category><![CDATA[Grid-service]]></category> <category><![CDATA[hosting]]></category> <category><![CDATA[mediatemple]]></category><guid
isPermaLink="false">http://blog.anorgan.com.s63292.gridserver.com/?p=157</guid> <description><![CDATA[I&#8217;ve seen a lot of hosting servers. Really a lot, I&#8217;m a developer. 99% of...]]></description> <content:encoded><![CDATA[<p>I&#8217;ve seen a lot of hosting servers. Really a lot, I&#8217;m a developer. 99% of the time, they had <a
href="http://www.cpanel.net/" target="_blank">cpanel</a>, 99% of the time, one couldn&#8217;t optimize and setup his hosting place to meet his needs. That&#8217;s not because of the cpanel, of course, but because of the hosting company. My appetite for features and freedom of configuration got bigger over the years, so I got myself the  (gs) Grid-service hosting plan on Mediatemple. Upon sighting the /etc directory in my root, I got excited.</p><p><span
id="more-157"></span>The account center is pretty clean an intuitive, although it took me a while make it feel at home after cpanel&#8217;s interface. Adding domains and sub-domains is easy, good thing is that the wild card domains are set up by default. PHP4 is turned on by default, one has to switch to PHP5 if he wants to &#8211; weird decision by mediatemple guys, but nothing to be alarmed by. You can set users for your whole grid service or only one domain, and ftp and ssh permissions are allowed per user. So, if you are reselling your (gs), your clients can have their email and ftp accounts separately, not knowing of the other sites you host. Nicely done, but I would opt for the (dv) Dedicated Virtual if you are serious about reselling.</p><p>I&#8217;ve setup my environment the way i want it and got subversion up and running. Setting the svn up is really easy and i encourage everyone to use it if they can. Saves the trouble of uploading over FTP and you always have the undo option at your fingertips. The server has ImageMagick installed, but sadly no ffmpeg or flvtool. Well, they have to justify buying the (dv) plan.</p><p>I still am not running any high traffic sites, so can&#8217;t comment on the GPU usage, but after setting up my <a
title="HomeBudget" href="http://homebudget.anorgan.com/" target="_blank">HomeBudget</a>, blog and some other sites, I&#8217;ve spent 1 GPU. With 1000 GPU per month, i would conclude that it should be enough. I did a google search about mediatemples GPU usage, and some guys report they are burning 1000+ on their blogs (with claims of over 2000 page hits). Just to be safe, I&#8217;ll monitor my usage from time to time.</p><p>Anyway, this ffmpeg got me a bit upset, so I&#8217;m asking: what would you like to have on your hosting preinstalled? We&#8217;re talking about shared hosting.</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2009/03/08/i-got-the-mt-hosting/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Not enough time</title><link>http://blog.anorgan.com/2008/11/08/not-enough-time/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=not-enough-time</link> <comments>http://blog.anorgan.com/2008/11/08/not-enough-time/#comments</comments> <pubDate>Sat, 08 Nov 2008 01:36:21 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Miscellaneous]]></category><guid
isPermaLink="false">http://www.anorgan.com/blog/?p=151</guid> <description><![CDATA[5 or so years ago I wanted to make an audio amplifier. This year I...]]></description> <content:encoded><![CDATA[<p>5 or so years ago I wanted to make an audio amplifier. This year I finaly came around to doing that, only to be stopped, again, because of my schedule. We never have enough time. A day could have 48 hours, you&#8217;ll still be late for something, would forget to do some things you had to do. I don&#8217;t know. Where&#8217;s the catch? Do less?</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2008/11/08/not-enough-time/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Ubuntu + Palm = Something Completely Useless</title><link>http://blog.anorgan.com/2008/07/20/ubuntu-palm-something-completely-useless/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ubuntu-palm-something-completely-useless</link> <comments>http://blog.anorgan.com/2008/07/20/ubuntu-palm-something-completely-useless/#comments</comments> <pubDate>Sun, 20 Jul 2008 18:27:23 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Miscellaneous]]></category> <category><![CDATA[CPU]]></category> <category><![CDATA[LCD]]></category> <category><![CDATA[memory]]></category> <category><![CDATA[Palm]]></category><guid
isPermaLink="false">http://www.anorgan.com/blog/?p=99</guid> <description><![CDATA[&#160; If you, like me, own a Palm III and also use Linux for your...]]></description> <content:encoded><![CDATA[<p>&nbsp;</p><div
id="attachment_100" class="wp-caption alignleft" style="width: 310px"><a
class="thickbox" href="http://blog.anorgan.com/wp-content/uploads/2008/07/_7205264.jpg"><img
class="size-medium wp-image-100" title="Palm showing my CPU usage" src="http://blog.anorgan.com/wp-content/uploads/2008/07/_7205264-300x237.jpg" alt="Palm showing my CPU usage" width="300" height="237" /></a><p
class="wp-caption-text">Palm showing my CPU usage</p></div><p>If you, like me, own a Palm III and also use Linux for your OS, then you are a complete geek. My excuse of owning a Palm is that my friend gave it to me, what&#8217;s yours? But that&#8217;s not the point of this post. The point of it is to show what ELSE is Palm good for. It is hard to take notes, people look at you as a complete stranger, you can&#8217;t connect it to the internet (it&#8217;s Palm IIIc we&#8217;re talking about), there&#8217;s no GPS, so what&#8217;s it good for? Well, let&#8217;s assume you have a program and want to see the CPU and memory usage while you <span
style="text-decoration: line-through;">play</span> use your program. One way to do that is to load System Monitor. But that&#8217;s not geeky enough. No, that&#8217;s for people who still have a life, not to mention a girlfriend. For us, über-geeks, with no life, external display is the way to go. And Palm is a really good looking external display <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Let&#8217;s start.</p><p><span
id="more-99"></span></p><h1>Things you need:</h1><ol><li>Palm (I have Palm IIIc, you can use some other Palm, or even an LCD system)</li><li>Linux <img
src='http://blog.anorgan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></li><li>Program for Palm to emulate the LCD display. I used PalmOrb (<a
href="http://palmorb.sourceforge.net/" target="_blank">http://palmorb.sourceforge.net/</a>)</li><li>Program for displaying system information from your Linux on a LCD. I used LCDproc (<a
href="http://lcdproc.org/" target="_blank">http://lcdproc.org/</a>)</li></ol><h1>Procedure for deleting your life</h1><p>First you have to be able to connect your Palm to your ttyS0 (that&#8217;s serial port). If it&#8217;s not ttyS0, than its one of the above ports (S1, S2, &#8230;). For other purposes it is recommended to have /dev/palm as device so do:</p><p><code>sudo ln -s /dev/ttyS0 /dev/palm</code></p><p>This links ttyS0 to “virtual” palm device.</p><h2>Installing and patching LCDproc</h2><p>Install LCDproc via synaptic. Download (don&#8217;t install) LCDproc and edit server/drivers/MtxOrb.c file, uncomment the line “memset(p-&gt;backingstore, 0xFE, (p-&gt;width * p-&gt;height));” in MtxOrb_clear. Compile it. In terminal, while in the directory, type:</p><p><code>./configure<br
/> make</code></p><p>Now, replace the compiled MtxOrb.so in /usr/lib/lcdproc with this one in server/drivers (cp server/drivers/MtxOrb.so /usr/lib/lcdproc/MtxOrb.so). Ok, you have installed the LCDproc and patched it.</p><h2>Configuration</h2><p>Configure the LCDd.conf in /etc and edit the following:</p><p><em>in [server] section edit:</em></p><p><code>Driver=MtxOrb<br
/> DriverPath=/usr/lib/lcdproc/</code></p><p><em>in [MtxORB] section edit:</em></p><p><code>Device=/dev/pilot<br
/> Size=20x4<br
/> Type=lkd<br
/> Speed=19200</code></p><h2>Starting up</h2><p>On your connected Palm, start PalmOrb. Start LCD deamon:</p><p><code>/etc/init.d/LCDd start</code></p><p>Initiate the deamon to start showing status on the LCD:</p><p><code>lcdproc</code></p><p>Now you should have your system information on you Palm. There are differences for some distros, but you should know how to change the settings for your system, and if you have USB connection, this <a
href="http://web.aanet.com.au/~auric/?q=node/10" target="_blank">post</a> shows the settings for USB. Ok, that&#8217;s it. You are officially a member of have-no-life people!</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2008/07/20/ubuntu-palm-something-completely-useless/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How I Learned to Stop using Windows and Love the Linux</title><link>http://blog.anorgan.com/2008/07/03/how-i-learned-to-stop-using-windows-and-love-the-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-i-learned-to-stop-using-windows-and-love-the-linux</link> <comments>http://blog.anorgan.com/2008/07/03/how-i-learned-to-stop-using-windows-and-love-the-linux/#comments</comments> <pubDate>Thu, 03 Jul 2008 21:25:24 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Miscellaneous]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[Windows]]></category><guid
isPermaLink="false">http://www.anorgan.com/blog/?p=88</guid> <description><![CDATA[AT THE BEGINNING: WINDOWS Ok, not windows, I have used DOS 6.2, great OS. Move...]]></description> <content:encoded><![CDATA[<h1>AT THE BEGINNING: WINDOWS</h1><p>Ok, not windows, I have used DOS 6.2, great OS. Move to dir, type command, play game. That&#8217;s it. Then installed Win 3.1. Lol. Nice windows. Now what? Windows 95 came out, and I thought “Great, now we&#8217;ll have the abilities of DOS and nice interface of Windows”. Errrr. Soon the 98 came out, and the ME. Nope, not there yet. With XP things changed. It worked, was stable (kinda), but ever so often, I had to reinstall my system. Then Vista came out, and after installing it, I was content. Not all programs worked, but that&#8217;s normal. I hoped for it to be more compatible, more lightweight.</p><p>Past month I decided to let go of the MS operating systems, and go for Linux. Linux always intrigued me. I downloaded my first “flawor”, Red Hat 9, a couple of years ago. Downloaded, burned, installed. Didn&#8217;t recognize all my hardware, installing new software was a pain in the ass, and finding good software that was alternative to windows platform was hard. I learned to compile stuff, search for dependencies, uninstall, this, that, but that was not something a normal kid would go for. No games. Sorry. Fedora came out. Ok, nice. A couple more encounters with Linux (System rescue cd was a good find) couldn&#8217;t convince me to turn over to open-source. Well, Microsoft did. Vista is just too hungry for RAM. And I don&#8217;t wanna buy more RAM. I think 1 gig is enough (if you&#8217;re not gaming). The latest <a
href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> was downloaded, burned and ready for install.</p><p><span
id="more-88"></span></p><h1>LINUX</h1><p>I did a backup of the system partition, formated the drive (well, actually Ubuntu did that) and installed the famous Linux distribution. Everything went well, but the GRUB didn&#8217;t want to install. One test with  System rescue disk and it&#8217;s testdisk showed the partitions, and after rewriting the partition table (oh, yes, windows fucked it up) everything was fine. The amount of time it took me to setup my system was surprising. All the necessary programs were installed, and the rest that were missing were easy to install: open up synaptic, search for software, click apply. That&#8217;s it. No restart, no going through pointless wizzard, no questions like “Are you sure u want to install?”, and so on. As I&#8217;m developing web sites, I installed the necessary server applications like apache web server, php, mysql with 3 clicks. Went to synaptic, selected the web server package, clicked apply. After the setup of the virtual servers, and configuration of the databases, I was able to access my sites. This all can literally be done in about an hour.</p><h1>STABILITY</h1><p>Using compiz fusion, cairo-dock, pidgin, indexer, Thunderbird that is always active on my desktop nr.2, and all the rest of services/demons that are active, plus OpenOffice Writer, the system monitor shows 327 mb ram in use and 20% CPU. Oh, remembered about apache server with MySql. Try that in windows. Compiz can sometime render the windows black. Then I go to reload window manager, and everything is fine again. Not nice, but maybe a bug that will be corrected in the future. No crashes so far (I managed to crash it once, when running Photoshop CS2 using <a
href="http://www.codeweavers.com/products/cxlinux/" target="_blank">crossover linux</a>, but no problems  after that).</p><h1>GAMES</h1><p>Well, this is more of a problem with the industry than with the Linux, there are not a lot of games natively supporting Linux. You can run Unreal, and a couple of others. With Wine/Crossover linux, you can run windows games, like WOW.</p><h1>WORKFLOW</h1><p>A LOT better. Everything is fast, programs load fast, compiz is not only eye-candy, it helps with using the OS. The restarting of the PC after installing some programs is history. You DO need to use the console for advanced stuff, but in during “normal” work terminal is unnecessary.</p><h1>CONCLUSION</h1><p>It still is a bit early for me to make a good conclusion, but so far i have no bigger objections. My girlfriend uses my PC often to check her CDs, browse the web and the like. She almost didn&#8217;t notice it was completely different OS. I&#8217;ll try to update this post after a certain period of time, when I&#8217;ll have more experience.</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2008/07/03/how-i-learned-to-stop-using-windows-and-love-the-linux/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>PHP and template engines (and some other stuff)</title><link>http://blog.anorgan.com/2008/06/28/php-and-template-engines-and-some-other-stuff/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-and-template-engines-and-some-other-stuff</link> <comments>http://blog.anorgan.com/2008/06/28/php-and-template-engines-and-some-other-stuff/#comments</comments> <pubDate>Sat, 28 Jun 2008 15:19:52 +0000</pubDate> <dc:creator>Anorgan</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[MVC]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[smarty]]></category> <category><![CDATA[template]]></category> <category><![CDATA[Web]]></category><guid
isPermaLink="false">http://www.anorgan.com/blog/?p=23</guid> <description><![CDATA[I’m developing web sites for quite some time now, started when i was… Young? Yellow?...]]></description> <content:encoded><![CDATA[<p>I’m developing web sites for quite some time now, started when i was… Young? Yellow? Well, started a long time a go in a galaxy… AARGH! Can’t get Star Wars out of my life! Anyway. In the beginning i was using the good old php mess approach:</p><pre class="brush: php">echo 'ul';
foreach($array as $item) {
    echo '&lt;li&gt;Some $item here&lt;/li&gt;';
}
echo '&lt;ul&gt;';</pre><p>And so on. For onepagers this was enough. So i stumbled accross <a
href="http://mambo-foundation.org/" target="_blank">mambo</a> (former <a
href="http://www.joomla.org/" target="_blank">Joomla</a>) and saw the raw power of cms and, well for me, good coding. K, let&#8217;s make ourselves a content management system. But how? What do we need? The neccesary ingridients where these:</p><ul><li><a
href="http://www.apache.org/" target="_blank">Apache</a> with <a
href="http://www.php.net/" target="_blank">php</a> (obvious)</li><li><a
href="http://www.mysql.com/" target="_blank">MySQL</a> database (oh, what&#8217;s this database thing for?)</li><li>foresight</li></ul><p>What’s the most important? No, wrong, not coffee. Foresight! Without analyzing and planning the outcome can’t be good. I started to code. Heavily. Took a good number of different approaches, all ended bit dull and like they couldn’t take on serious tasks.</p><p><span
id="more-23"></span></p><p>Why this intro? So you can better relate to me. I AM one of you, coders. We all started like this. One learns trough he’s own mistakes. What have I learned? Let’s take this a bit further. There is no good CMS without know-how, so these are the things one has to be familiar with:</p><ul><li>apache web server and its .htaccess or http.conf files and configurations. Hence the readable links, good caching, security…</li><li><a
href="http://www.ubuntu.com/" target="_blank">Linux</a>, yes, you need a bit of knowledge of that OS and it&#8217;s abilities. Good start is to install it on an empty partition or run it virtualized with <a
href="http://www.vmware.com/" target="_blank">VMWare</a>. When you get to know it, you can do marvels like putting a cache directory into system memory with tmpfs, and so on</li><li>php programming language, with good knowledge of object oriented programming (OOP). This just simplifies things, realy.</li><li>usage of a template engine (oh, we&#8217;re getting on to a topic here, let&#8217;s have a beer!). I prefer <a
href="http://www.smarty.net/" target="_blank">Smarty</a>, some say it&#8217;s too big, too complicated, too **insert your reason here**. I found that I can do my sites faster with it, so i use it</li><li>mysql database. This could be the hardest and most time consuming, but it&#8217;s well worth it. It includes database designing and SQL programming</li><li>benchmarking and debugging is also a part of the process. I use bit of <a
href="http://xdebug.org/" target="_blank">xdebug</a>, <a
href="http://www.zend.com/" target="_blank">zend platform</a>, smarty debug console, my own debug console for page creation time and sql execution times</li></ul><p>Ok, this is a handful, but any of the above items should be tackled at some point of the learning curve. If we are trying to code and produce scalable sites that can do the task right, we should be familiar with the MVC architecture. It comes down to having a database to store our data, php code to process that data and template to show that data. The upper code with all this in mind would be:</p><h2>DATABASE:</h2><p>1. item 1<br
/> 2. item 2<br
/> 3. item 3<br
/> 4. &#8230;</p><h2>PHP and SQL:</h2><pre class="brush: php">$data = $db-&gt;fetch('SELECT item FROM table');
$t-&gt;assign('data', $data);</pre><h2>TEMPLATE:</h2><pre class="brush: php">&lt;h1&gt;Our items&lt;/h1&gt;&lt;ul&gt;
{section name=item loop=$data}&lt;li&gt;{$data[item]}&lt;/li&gt;
{/section}&lt;/ul&gt;</pre><p>Here we use a database abstraction layer class ($db) and are free of repeating the same change accross our code should we change database, etc. The template is free for editing by the designer, and the coder can still work on his code. Now we have everything separated, and one process can be changed regardless of the other.</p><p>One question pops up when we see {section}. It’s smarties way of saying “loop array $data and present data in the following way”. So, why should our designer be bothered with foreaches and if-then-elses? Answer lies in the following lines:</p><pre class="brush: php">{section name=item loop=$data}
&lt;li {if $smarty.section.item.first}class="first"{/if}&gt;{$data[item]|upper}&lt;/li&gt;
{/section}</pre><p>Designer just realized that the data presented is not right. Items should be uppercase and the first &lt;li&gt; should have class=”first”. Instead of yelling to the programmer “give me uppercased items!!!”, the designer has the power to modify, mold the data. Php guy is working on the control segment as we speak, he is half through the form processing code, which takes the order or whatnot, and the designer is at liberty to change the appearance of the data. He will choose to truncate long text, format date to display only day and month, maybe put {sectionelse} No data to display {/section} if $data array is empty, and he will never need to bother the programmer for those tasks.</p><p>If the caching is turned on, the php code and database calls will never even be executed, because the content is already rendered in some static file (which resides in our cache directory happily mounted to memory with tmpfs)</p><p>As we can see, this architecture helps alot, but it can be moved further. What if you need to present this data a couple of times across your site? It would be good if we could somehow include this block anytime we need it. And so we can, with {include file=”items.tpl”}. Anywhere we need this data (on the homepage, in the cart…) we just include this bit of a line. Saves time, eh? Now for the bad part.</p><h1>Drawbacks</h1><p>Template engines are good things to have, but they slow execution of the page. Smarty renders php code out of the template, and for that needs some processing time. He renders only once, and the rendered template benefits from the usage of some opcode cache module like <a
href="http://eaccelerator.net/" target="_blank">eAccellerator</a>, <a
href="http://www.zend.com/en/products/guard/optimizer/" target="_blank">Zend Optimizer</a> and such.</p><p>There is also the need to learn new language, smarty’s template language. It’s not that hard, and there is a lot of <a
href="http://www.smarty.net/manual/en/" target="_blank">documentation</a> on the net for it. When you get accustomed to your template engines language, and start coding, the html starts to look really ugly. That’s really up to you to decide weather you want to have all the foreaches and if/then/elses in the php, parse them, and send them to the template. There is also <a
href="http://phptal.motion-twin.com/" target="_blank">PHPTal</a> template engine, whose code is really simple and intuitive.</p><h1>Conclusion</h1><p>Once you take the MVC road, there is no turning back. You will never go back to having all the code and html in one file. Your next stop is maybe using some frameworks to get the job done even faster (<a
href="http://www.symfony-project.org/" target="_blank">symfony</a>, <a
href="http://www.akelos.org/" target="_blank">akelos</a>, <a
href="http://framework.zend.com/" target="_blank">zend framework</a>&#8230;), or building your own classes for your application.</p><p>Keep coding!</p> ]]></content:encoded> <wfw:commentRss>http://blog.anorgan.com/2008/06/28/php-and-template-engines-and-some-other-stuff/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: blog.anorgan.com @ 2012-05-21 01:19:33 -->
