<?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>Principia Labs &#187; webdev</title>
	<atom:link href="http://principialabs.com/tag/webdev/feed/" rel="self" type="application/rss+xml" />
	<link>http://principialabs.com</link>
	<description>design, build, test, iterate.</description>
	<lastBuildDate>Sun, 28 Mar 2010 16:38:22 +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 Command Reference</title>
		<link>http://principialabs.com/mysql-command-reference/</link>
		<comments>http://principialabs.com/mysql-command-reference/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 20:48:50 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://principialabs.com/mysql-command-reference/</guid>
		<description><![CDATA[Login to MySQL: ~$ mysql -u username -p Create a database: create database db_name; Delete a database: drop database db_name; List all databases: show databases; Select a database: use db_name; List tables of current database: show tables; List fields of a table: describe table_name; Table query structure: select * from table_name where id = "5" [...]]]></description>
			<content:encoded><![CDATA[<p>Login to MySQL:</p>

<p><pre>~$ mysql -u username -p</pre></p>

<p>Create a database:</p>

<p><pre>create database db_name;</pre></p>

<p><span id="more-30"></span></p>

<p>Delete a database:</p>

<p><pre>drop database db_name;</pre></p>

<p>List all databases:</p>

<p><pre>show databases;</pre></p>

<p>Select a database:</p>

<p><pre>use db_name;</pre></p>

<p>List tables of current database:</p>

<p><pre>show tables;</pre></p>

<p>List fields of a table:</p>

<p><pre>describe table_name;</pre></p>

<p>Table query structure:</p>

<p><pre>select * from table_name where id = "5" </pre></p>

<p>Export a MySQL Database:</p>

<p><pre>~$ mysqldump -u username -p db_name > FILE.sql </pre></p>

<p>Import a MySQL Database:</p>

<p><pre>~$ mysql -u username -p db_name &lt; FILE.sql </pre></p>
]]></content:encoded>
			<wfw:commentRss>http://principialabs.com/mysql-command-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pretty URLs: Enabling mod_rewrite on Ubuntu</title>
		<link>http://principialabs.com/pretty-urls-enabling-mod_rewrite-on-ubuntu/</link>
		<comments>http://principialabs.com/pretty-urls-enabling-mod_rewrite-on-ubuntu/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 19:40:56 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://principialabs.com/pretty-urls-enabling-mod_rewrite-on-ubuntu/</guid>
		<description><![CDATA[Pretty URLs are URLs that have meaning for human readers, rather than just being seemingly random jibberish only a web server could appreciate. The following is an example of a &#8220;pretty&#8221; URL: http://my.blog.com/archive/2007/10/pretty-urls Note that every part of the URL is relevant for a human reader. For comparison, here&#8217;s an example of an &#8220;ugly&#8221; URL: [...]]]></description>
			<content:encoded><![CDATA[<p>Pretty URLs are URLs that have meaning for human readers, rather than just being seemingly random jibberish only a web server could appreciate.  The following is an example of a &#8220;pretty&#8221; URL:</p>

<pre>

http://my.blog.com/archive/2007/10/pretty-urls

</pre>

<p>Note that every part of the URL is relevant for a human reader.  For comparison, here&#8217;s an example of an &#8220;ugly&#8221; URL:
<pre>

http://www.mysite.com/nuke/modules.php?name=Forums&amp;file=posting&amp;mode=quote&amp;p=14488&amp;sid=0293840293840577

</pre></p>

<p><span id="more-29"></span></p>

<p>To enable the mod_rewrite module in Apache2 on Ubuntu:</p>

<p>(1) Add the rewrite.load to /etc/apache2/mods-enabled/</p>

<pre><code>sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
</code></pre>

<p>(2) Edit the apache configuration for your virtual hosting (/var/www/):</p>

<pre><code>sudo nano /etc/apache2/sites-enabled/000-default
</code></pre>

<p>(3) Change the AllowOverride value to &#8220;All&#8221; for the document root directory:</p>

<pre><code>&lt;directory /var/www/&gt;
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
  # This directive allows us to have apache2's default start page
  # in /apache2-default/, but still have / go to the right place
  # Commented out for Ubuntu
  #RedirectMatch ^/$ /apache2-default/
&lt;/directory&gt;
</code></pre>

<p>(4) Restart the server:</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://principialabs.com/pretty-urls-enabling-mod_rewrite-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web Development on Ubuntu</title>
		<link>http://principialabs.com/web-development-on-ubuntu/</link>
		<comments>http://principialabs.com/web-development-on-ubuntu/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 19:31:03 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://principialabs.com/web-development-on-ubuntu/</guid>
		<description><![CDATA[If you want to build dynamic websites, one of the first things you&#8217;ll need to do is set up a development environment your local computer, so you can experiment and test new code without uploading everything to a remote web server. In a nutshell, this means LAMP &#8212; Linux, Apache, MySQL and PHP. With this [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to build dynamic websites, one of the first things you&#8217;ll need to do is set up a development environment your local computer, so you can experiment and test new code without uploading everything to a remote web server.  In a nutshell, this means LAMP &#8212; Linux, Apache, MySQL and PHP.</p>

<p>With this setup, you&#8217;ll be primed and ready to go to run popular content management software on your local box&#8211;like <a href="http://drupal.org/">Drupal</a>, <a href="http://www.joomla.org/">Joomla</a> or <a href="http://www.silverstripe.com/">Silverstripe</a>; start a <a href="http://wordpress.org/">WordPress</a> or <a href="http://www.textpattern.com/">Textpattern</a> blog; or even roll your own community site from scratch using a hot framework like <a href="http://www.cakephp.org/">CakePHP</a>.</p>

<p><span id="more-28"></span></p>

<p>(If you&#8217;re just getting started with web design, it&#8217;s a good idea to check out the tutorials at <a href="http://www.w3schools.com/">w3schools.com</a>, although you don&#8217;t have to know a single line of code to install a well-designed product like WordPress.)</p>

<p>This short tutorial assumes you&#8217;ve already installed some version of Ubuntu on your computer (&#8211;that takes care of the &#8220;Linux&#8221; part&#8211;), and leads you through installing an Apache web server, the PHP scripting language, and a MySQL database server.</p>

<p>(These instructions were tested on Kubuntu 7.10 &#8220;Gutsy.&#8221;)</p>

<p><strong>(1) Install everything.</strong>  Open a terminal and paste the following code, which will grab Apache, PHP, and MySQL all at once.  That was easy.</p>

<pre>
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server
</pre>

<p><strong>(2) Test Apache.</strong>  Once installed, the Apache web server should be running.  To find out for sure, open up a browser and enter <code>http://localhost/</code> in the URL field.  You should see something like this:</p>

<p><img src="/files/apache1.jpg" alt="Apache2" /></p>

<p>If you click on the <code>apache2-default/</code> folder, you should see a message that says, &#8220;It works!&#8221;  If instead of seeing the above, you get some sort of &#8220;Unable to connect&#8221; message, then the server is not running.</p>

<p>Try restarting Apache, then repeat step two:</p>

<pre>
sudo /etc/init.d/apache2 restart
</pre>

<p><strong>(3) Enable PHP.</strong> Open a terminal and paste the following code, which will enable support for the PHP module in Apache&#8217;s configuration file:</p>

<pre>
sudo ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/
</pre>

<p>Now, restart the Apache server (so the new module will take effect).</p>

<pre>
sudo /etc/init.d/apache2 restart
</pre>

<p><strong>(4) Learn PHP.  Quick.</strong>  Create your first PHP script to test that the new module works.  Open a terminal and paste the following code:</p>

<pre>
sudo nano /var/www/phpinfo.php
</pre>

<p>Whoa! What happened?  Never used <a href="http://www.nano-editor.org/docs.php">nano</a> before?  It&#8217;s a simple terminal-based text editor.  Check out the keyboard shortcut commands at the bottom of the screen.  You&#8217;ll figure it out.</p>

<p>Here&#8217;s the code to paste into nano:
<pre>
&lt;?php
  phpinfo();
?&gt;
</pre></p>

<p>Don&#8217;t forget to save the file using Ctrl-O and then exit with Ctrl-X.  Are we having <em>fun</em> yet?!</p>

<p><strong>(5) Test PHP.</strong>   Jump back over to the browser and reload the <code>localhost</code> page.  You should see your new <code>phpinfo.php</code> file in there.  Hey cool; we learned something: The Apache web root is located at <code>/var/www</code>, so any PHP files you save in there will be parsed by the server&#8217;s PHP engine.</p>

<p>Anyway, click on your new file.  You should see some variant of this:</p>

<p><img src="/files/php.jpg" alt="PHP" /></p>

<p>Great!  We&#8217;re in.</p>

<p><strong>(6) Test MySQL.</strong>  This should already be installed and running, if step one went as planned.  You should have already created a root username and password.  If that&#8217;s the case, then just open a terminal and type:</p>

<pre>
mysql -u root -p
</pre>

<p>You&#8217;ll be prompted for the password you created earlier, and then you should see something like this:</p>

<pre type="text">
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.0.45-Debian_1ubuntu3-log Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
</pre>

<p>Done!  That&#8217;s it.  You&#8217;re all set up.  Check out the <a href="/mysql-command-reference">MySQL Command Reference</a> for a few things to try in the monitor, if you like.  Now you&#8217;re ready to start building your first dynamic website.</p>

<p>Fortunately, that&#8217;s another tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://principialabs.com/web-development-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
