<?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>Mixu&#039;s tech blog &#187; How-to</title>
	<atom:link href="http://blog.mixu.net/category/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mixu.net</link>
	<description>When I read what I write I learn what I think</description>
	<lastBuildDate>Mon, 26 Jul 2010 12:03:17 +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>Setting up SPF, SenderID and DKIM on Centos 5.3 using sendmail</title>
		<link>http://blog.mixu.net/2009/11/03/setting-up-spf-senderid-and-dkim-on-centos-5-3-using-sendmail/</link>
		<comments>http://blog.mixu.net/2009/11/03/setting-up-spf-senderid-and-dkim-on-centos-5-3-using-sendmail/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 10:52:51 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=510</guid>
		<description><![CDATA[The biggest four email providers Gmail, AOL, Hotmail and Yahoo (in this order according to Comscore) all implement some form of anti-spam techniques. The main technologies are reverse DNS checking, SPF, SenderID, Domainkeys and DKIM. I will discuss all of these here and provide my tips on setting up SPF, SenderID and DKIM. Please keep in mind [...]]]></description>
			<content:encoded><![CDATA[<p>The biggest four email providers Gmail, AOL, Hotmail and Yahoo (in this order <a href="http://www.informationweek.com/news/internet/google/showArticle.jhtml?articleID=219400298">according to Comscore</a>) all implement some form of anti-spam techniques.</p>
<p>The main technologies are reverse DNS checking, SPF, SenderID, Domainkeys and DKIM. I will discuss all of these here and provide my tips on setting up SPF, SenderID and DKIM. Please keep in mind that I am not an expert on email servers &#8211; but I hope this helps someone! It took me about half a day to figure this all out, so it is probably worth doing to improve your email delivery rates.</p>
<p><a href="http://zohrob.com/posts/entrepreneurs-guide-to-email-delivery-part-2.html">This blog entry from Dave Zohrom provides a nice discussion of sending email to a general audience</a> (part 2 of a 3-post series).</p>
<h2>Introduction</h2>
<p><strong>SPF or Sender Policy Framework</strong></p>
<p>SPF is easy to setup. It uses DNS TXT records to allow the email providers to check which servers are authorized to send email for a particular domain. The SPF project has done a great<strong> </strong>job at making this simple to setup. Just <a href="http://www.openspf.org/">go to their homepage</a> and use the setup wizard to generate the appropriate TXT records (the text field underneath &#8220;Deploying SPF&#8221;). Then change the values in your DNS records.</p>
<p>One thing to note is that if you have multiple servers and send email from a server with a different hostname (e.g. &#8220;mail.example.com&#8221;), you need to setup a record for that server as well. See <a href="http://www.openspf.org/FAQ/Common_mistakes">the common mistakes page on the SPF site</a>. Also, if you have hostnames that are not supposed to send mail, you ought to indicate this as well.</p>
<p>Another thing is that if you are using Google Apps for Your Domain to send email, then you will need to have to add &#8220;include:aspmx.googlemail.com&#8221; to also allow mail from Google to validate. See <a href="http://www.google.com/support/a/bin/answer.py?hl=en&amp;answer=33786">this answer for more</a>.</p>
<p><strong>SenderID from Microsoft</strong></p>
<p>SenderID is a variant of SPF, which for most practical cases is the same as SPF. Just setup SPF and this should produce a validation pass for SenderID as well. The semantics of the validation are a bit different,  but this does not seem to be a major practical problem. See testing tips below to make sure that this is also true in your case.</p>
<p><strong>DomainKeys</strong></p>
<p>DomainKeys is an older version of DKIM (DomainKeys Identified Mail) developed by Yahoo. Despite having very similar names, these ARE NOT the same!</p>
<p>Both DomainKeys and DKIM store public key information in DNS records and sign the message headers of every email sent. The recipient can then verify the signature.</p>
<p>DomainKeys was deprecated in 2007, but some email providers may still be using it. However, <a href="http://blog.deliverability.com/2009/09/franck-martin-on-the-future-of-dkim-and-domainbased-reputation-.html">these are a shrinking minority </a>and Yahoo does support the newer DKIM. <span style="background-color: #ffffff;">Because of this I did not add DomainKeys support but opted only to use DKIM.</span></p>
<p><span style="background-color: #ffffff;">You can add it to sendmail or Postfix using the dk-milter project code, but the unofficial RPM release <a href="http://www.topdog-software.com/oss/dk-milter/">is not maintained anymore</a>, which means you will need to install it from source (<a href="http://sourceforge.net/projects/dk-milter/">available via SourceForge</a>).</span></p>
<p><span style="background-color: #ffffff;"><strong>DKIM, or DomainKeys Identified Mail</strong></span></p>
<p><span style="background-color: #ffffff;">DKIM on the other hand seems to be gaining momentum. It is used by Gmail, Yahoo and AOL and many others, and also works by publishing public keys via DNS TXT records and by signing the emails at the email server.</span></p>
<p><span style="background-color: #ffffff;">To setup DKIM, you need an additional filter which takes the completed email and adds the DKIM signature to the email prior to sending it out.</span></p>
<p><span style="background-color: #ffffff;">Postfix and sendmail support &#8220;<a href="http://en.wikipedia.org/wiki/Milter">milters</a>&#8220;, which is apparently short for &#8220;mail filter&#8221;. There is a DKIM-milter package available for Centos at the EPEL repositories (see <a href="http://wiki.centos.org/AdditionalResources/Repositories">Centos page for 3rd party repos</a>).</span></p>
<h2><span style="background-color: #ffffff;">Setting up DKIM-milter with sendmail</span></h2>
<p><span style="background-color: #ffffff;">For Postfix, <a href="http://allaboutlamp.com/2009/09/setup-dkim-for-postfix-in-fedora-using-dkim-milter/">use these instructions from All About LAMP</a>. If you want to use sendmail as I did, here are my additional tips:</span></p>
<p><span style="background-color: #ffffff;"><strong>Steps 1-7 as in the linked tutorial.</strong></span></p>
<p><span style="background-color: #ffffff;"><strong>Step 8. Configure dkim-milter</strong></span></p>
<p><span style="background-color: #ffffff;">Open configuration file /etc/mail/dkim-milter/dkim-filter.conf and use the following configuration:</span></p>
<pre>Canonicalization simple
Domain example.com
KeyFile /some/path/to/whatever-your-keyfile-was
Selector name-of-the-selector
SignatureAlgorithm rsa-sha256
Socket inet:8891@localhost
Syslog Yes
Userid dkim-milter</pre>
<p>NOTE: you will be configuring dkim-milter to use the loopback interface instead of a socket file. I was unable to get dkim-milter to work via the socket file with sendmail. If you get it working, let me know.</p>
<p>You may also want to setup the following:</p>
<pre>SubDomains Yes
SyslogSuccess Yes
X-Header Yes</pre>
<p><span style="background-color: #ffffff;">The X-Header and Syslog options are useful for debugging. See the config file, each option should be documented there.</span></p>
<p><strong>Step 9. Change the default init.d script to use the loopback interface</strong></p>
<p><span style="background-color: #ffffff;">The default init script uses a socket, this needs to be changed. Open /etc/init.d/dkim-milter and change/comment the line:</span></p>
<pre>SOCKET=local:/var/run/${name}/${name}.sock</pre>
<p>to:</p>
<pre>SOCKET=inet:8891@localhost</pre>
<p><span style="background-color: #ffffff;"><strong>Step 10. Configure sendmail to use dkim-milter</strong></span></p>
<p>First a few reminders about sendmail configuration, remember that:</p>
<p>1. Sendmail comments DO NOT USE # as the comment, instead &#8220;dnl&#8221;  (<a href="http://www.sendmail.org/m4/intro_m4.html">delete through newline</a>) at beginning of the line is used to comment lines out.<br />
2. Sendmail configuration is built from the *.mc script files using the M4 macro processor.<br />
3. You need to install the sendmail-cf package for dependencies and install the m4 macro processor separately.<br />
4. In the configuration, the opening quote is a grave accent ` and the closing quote is a straight quote &#8216;.</p>
<p>To configure sendmail, open the &#8220;/etc/mail/submit.mc&#8221; file (which contains the settings for message sending; in older sendmail versions this config was in sendmail.mc).</p>
<p><strong>10.1 Edit submit.mc by adding the following entry to it:</strong></p>
<pre>INPUT_MAIL_FILTER(`dk-filter', `S=inet:8891@localhost')dnl</pre>
<p>(for example just before &#8220;FEATURE(`msp&#8217;, `[127.0.0.1]&#8216;)dnl&#8221;). Make sure that there are no <span style="background-color: #ffffff; font-family: Calibri; font-size: 15px;">define(`confINPUT_MAIL_FILTERS&#8217;, `&#8230;&#8217;)dnl lines after this; if there are, you will need to add dkim-milter manually to the INPUT_MAIL_FILTERS list.</span></p>
<p><strong>10.2 Build and install a new submit.cf:</strong></p>
<pre>m4 /etc/mail/submit.mc &gt; submit.cf</pre>
<p>Tip: use m4 -d /etc/mail/submit.mc to debug first.</p>
<p><strong>10.3 Restart sendmail</strong></p>
<pre>service sendmail restart</pre>
<h2>Testing tips</h2>
<p><strong>Some possible errors:</strong></p>
<ol>
<li><span style="background-color: #ffffff;">Errors getting the sendmail configuration generated: Check whether the dependencies (m4 and sendmail-cf) are installed and paths are correct.</span></li>
<li><span style="background-color: #ffffff;">Errors starting sendmail: Make sure you replaced the correct files (submit.mc to submit.cf and sendmail.mc to sendmail.cf) and if you modified sendmail.mc in addition to submit.mc, make sure you have regenerated both.</span></li>
<li><span style="background-color: #ffffff;">Errors starting dkim-milter: check the permissions on the key file</span></li>
<li><span style="background-color: #ffffff;">Sendmail seems to ignore the dkim-milter, no X-dkim-milter header is in the mail even after you enabled the X-Header option in dkim-filter.conf: </span>
<ol>
<li><span style="background-color: #ffffff;">Check /var/log/maillog.</span></li>
<li><span style="background-color: #ffffff;">Sendmail seems to default to ignoring the milter if it cannot connect to it. This was the problem I ran into when using sockets; after switching to the loopback interface everything started working.</span></li>
<li><span style="background-color: #ffffff;">Also, check whether your mail is sent from a recipient for whom mail is supposed to be signed! If you haven&#8217;t setup your hostname, then this may lead to email not being signed (eg. hostname -F hostname plus /etc/hosts plus /etc/sysconfig/network).  See, for example <a href="http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers#_Toc109364456">this tutorial for configuring sendmail</a>.</span></li>
<li><span style="background-color: #ffffff;">Also, check if you need to configure masquerading for Sendmail, see <a href="http://www.sendmail.org/m4/masquerading_relaying.html">http://www.sendmail.org/m4/masquerading_relaying.html</a></span></li>
</ol>
</li>
</ol>
<p><strong>Sending email from the console using only sendmail</strong></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11.0pt;">Create a file with the following content:</p>
<pre>To: "Recipient name" &lt;john.doe@example.com&gt;
<span style="background-color: #ffffff;">From: "Sender name" &lt;admin@example.com&gt;
Reply-To: admin@example.com
Subject: Hello world
This is the content of the message, end it with a line containing only a period as sendmail expects this.
.</span></pre>
<p>Then cat the file and pipe to sendmail -t:</p>
<pre>cat message.txt |sendmail -t</pre>
<p><strong>Checking all of the technologies mentioned above</strong></p>
<p>Port25.com offers a free service which check SPF, SenderID, DomainKeys and DKIM: <span style="background-color: #ffffff;"><a href="http://port25.com/domainkeys/">http://port25.com/domainkeys/</a></span></p>
<p><span style="background-color: #ffffff;">Quote: </span></p>
<ul>
<li><em>If you wish to receive the results at the address in the &#8220;mail_from,&#8221; the sample message should be sent to </em><a style="text-decoration: underline; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; color: #56759b;" href="mailto:check-auth@verifier.port25.com"><em>check-auth@verifier.port25.com</em></a><em>. </em></li>
<li><em>If you wish to receive the results at the address in the &#8220;from&#8221; header, the sample message should be sent to </em><a style="text-decoration: underline; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; color: #56759b;" href="mailto:check-auth2@verifier.port25.com"><em>check-auth2@verifier.port25.com</em></a><em>.</em></li>
</ul>
<p><em>A reply email will be sent back to you with an analysis of the message&#8217;s authentication status. The report will perform the following checks: SPF, SenderID, DomainKeys, DKIM and SpamAssassin.</em></p>
<p><strong>Additional resources:</strong></p>
<p><a href="http://allaboutlamp.com/2009/09/setup-dkim-for-postfix-in-fedora-using-dkim-milter/">How to Setup DKIM for Postfix in Fedora using dkim-milter</a></p>
<p><a href="http://allaboutlamp.com/2009/09/how-to-prevent-web-server-emails-from-being-marked-as-spam/">How to Prevent Web Server Emails from being Marked as SPAM</a></p>
<p><a href="http://domainkeys.sourceforge.net/"> DomainKey Implementor&#8217;s Tools and Library for email servers &amp; clients</a></p>
<p><a href="http://www.elandsys.com/resources/sendmail/dkim.html">Sendmail DKIM</a></p>
<p><a href="http://palma-seo.com/setting-dkim-spf-domainkeys-dns-bind">Setting up DKIM, SPF, Domainkeys DNS, Regular DNS on CentOS 5.3 at Pacificrack.com</a></p>
<p><a href="http://blog.nataprawira.com/tech/2009/08/15/how-to-manually-install-dkim-filter-with-sendmail/">How to manually install DKIM-Filter with Sendmail</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/11/03/setting-up-spf-senderid-and-dkim-on-centos-5-3-using-sendmail/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Picking the right nonfiction book</title>
		<link>http://blog.mixu.net/2009/11/02/picking-the-right-nonfiction-book/</link>
		<comments>http://blog.mixu.net/2009/11/02/picking-the-right-nonfiction-book/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 01:29:43 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[How-to]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=485</guid>
		<description><![CDATA[When it comes to reading, I&#8217;m spoiled! I notice I am getting more and more picky when it comes to ordering books from Amazon, which makes finding books that seem worth reading much harder to find. Over the years I&#8217;ve read quite a pile of books particularly related to programming, general business, entrepreneurship and software [...]]]></description>
			<content:encoded><![CDATA[<p>When it comes to reading, I&#8217;m spoiled! I notice I am getting more and more picky when it comes to ordering books from Amazon, which makes finding books that seem worth reading much harder to find.</p>
<p>Over the years I&#8217;ve read quite a pile of books particularly related to programming, general business, entrepreneurship and software engineering. Now that I am reading up on new topics such as organizational development, lean methods and statistical research methods I am having real trouble finding books I would consider reading just based on the table of contents and Amazon reviews. This is probably a good thing, since the most efficient way to get information is to only read good books.</p>
<p>Here are a couple of guidelines for picking good non-fiction books:</p>
<ol>
<li><strong>Number of reviews.</strong> If there is only a small number of reviews, there is a risk that those reviews are written by the author or his/her friends. A book with more reviews is more credible, as is a book which has had more editions.</li>
<li><strong>Distribution of reviews. </strong>If the reviews are split between 5-star and 1-star reviews, the 5-star reviews are most likely fake. This is an absolutely disgusting practice, but unfortunately common.</li>
<li><strong>Credentials of the authors.</strong> If the authors are practitioners and not scientists, make sure they do not work for a consultancy. I have unfortunately 1-2 books that I did not check adequately and ended up getting a useless brochure book.</li>
<li><strong>The table of contents.</strong>
<ol>
<li><strong>What is the starting point of the discussion? </strong>This defines the prerequisite knowledge that you are expected to have. Reading a book which is for beginners is incredible boring, while reading an advanced book as a beginner is frustrating.Evaluate whether you have the prerequisite knowledge and could read the first few chapters without getting bored to tears. Remember that most popular business books are written for an audience that reads just a few books per year &#8211; this pretty much makes them too repetitive if you read more than that.</li>
<li><strong>What is the emphasis of the book? </strong>Is it oriented towards: a) practice or b) checklists, c) proper theory or d) undergraduate students textbook? (See below for more)</li>
<li><strong>How many pages are dedicated towards each topic? </strong>Don&#8217;t expect anything good from a book that has a 200 pages and cover 200 topics: that&#8217;s just one tiny page per topic.Good books don&#8217;t cover everything with the same small amount of pages, because everything is not equally important in real life.</li>
</ol>
</li>
<li><strong>The actual content of the reviews.</strong> Don&#8217;t bother with 5- or 4-star reviews, they will just tell you the book is good. Read the 1-star and 3-star reviews.See if the 1-star reviews seem to be justified or are just a result of the reviewer being an idiot (e.g. &#8220;Haven&#8217;t received book from Amazon&#8221; or &#8220;This book is too difficult&#8221; -reviews).3-star reviews are usually the best, since the author did like some aspects but did not like others. Pay attention to reviews that say that a book is too basic or simple. If this is said more than once, you probably don&#8217;t want to read that book &#8211; American writing in particular is already very verbose and too many books are written where a five-page article would do, hence reviews which state that the book is too simple should be taken very seriously.</li>
<li><strong>Number of and affiliation of authors. </strong>If all the authors are from the same institution or organization, the book is probably of lower quality. A huge warning sign is a &#8220;collection&#8221; book that has multiple chapters on different topics by the same authors, all from the same decade. This indicates that the authors have not bothered to contact the people who are at the top of their respective fields; articles which are all from the same decade are likely to be just a random set of articles which were written for the book rather than the result of good editorial work.</li>
<li><strong>Order of topics. </strong>Scientific collection books usually order the chapters so that the better and more widely applicable material is at the front of the book, and the more specialized and less interesting material is at the end. It is safe to assume that if the chapter that seems decent for your purpose is at the end of the book, you are better off finding a more specialized book.</li>
</ol>
<p><strong>Four classes of books:</strong></p>
<p>I would put books in four broad categories, two of which are useful and two are useless:</p>
<ol>
<li>Practical books</li>
<li>Academic books</li>
<li>Ego-booster books</li>
<li>Motivational books</li>
</ol>
<p><strong>Practical books: experience-based vs checklist books</strong></p>
<p>Practical books are in my opinion divisible into two categories: advice from practitioners and advice from people who like to write checklists. That is, you have books that are based on the experiences of a practitioner, and then you have books that are written by people who have not actually done that much but wanted to write a book and ended up writing a checklist &#8211; a list of things that might be of use without really emphasizing what is important.</p>
<p>Try to get a feel of the book from the preview (if you can&#8217;t, don&#8217;t buy it!), search for a couple of phrases that interest you. Does the author know what they are doing, or are they just collecting information from other people? Sometimes a &#8220;checklist book&#8221; is not bad &#8211; when you just need the basics and can&#8217;t be bothered to collect all the information. However, usually the experience-based book is better.</p>
<p><strong>Academic books: theory vs textbook</strong></p>
<p>When it comes to academic books, the two main types are proper theory books and textbooks. The more I have seen and read textbooks, the less I like them. Generally speaking they try to cover everything and end up saying nothing.</p>
<p>If you care about the topic, don&#8217;t get a textbook. Instead, get a proper collection of influential articles if it exists (ex. Oxford Handbook of X). You will perhaps not be fully prepared for everything you read, but you will learn something useful. Unlike after reading a textbook, where you just have fuzzy awareness of the fact that &#8220;all kinds of things happen&#8221; in a particular field.</p>
<p><strong>Ego-booster books: academic and practical</strong></p>
<p>There is also another category of books which are basically books written for the author&#8217;s ego. Some books are not written to be read, they are written either to impress others or to act as marketing tools.</p>
<p>The academic substitute for having a nice car sometimes seems to be writing an obtuse treatise which is downright hostile towards the reader, while consultancies in particular are guilty of writing books in which the answer to every question is &#8220;hire our consultancy&#8221;. The academic ego book is harder to spot, so pay attention when previewing the book.</p>
<p><strong>Motivational books: feeling good doesn&#8217;t make it so</strong></p>
<p>Finally, there is a category of fiction books which pretend to be non-fiction books. The motivational books may be a fun read at times, and are usually the most popular books in their category.</p>
<p>However, they are fiction for your entertainment. Feeling good is nice, but that does not change the fact that there are people who are knowledgeable, talented and well-connected doing whatever the book is about, and that feeling good does not make you knowledgeable, talented or well-connected.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/11/02/picking-the-right-nonfiction-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to setup a LAN DNS server using MaraDNS under Windows 7</title>
		<link>http://blog.mixu.net/2009/10/14/how-to-setup-a-lan-dns-server-using-maradns-under-windows-7/</link>
		<comments>http://blog.mixu.net/2009/10/14/how-to-setup-a-lan-dns-server-using-maradns-under-windows-7/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 10:39:59 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=472</guid>
		<description><![CDATA[Are you tired of using 192.168.0.x to refer to the computers within your LAN? Setting up a DNS server and getting domain names for your local computers is surprisingly easy &#8211; even on Windows. 0. Preliminary setup: make sure each computer gets a constant IP address Before setting up the DNS server, you need to [...]]]></description>
			<content:encoded><![CDATA[<p>Are you tired of using 192.168.0.x to refer to the computers within your LAN? Setting up a DNS server and getting domain names for your local computers is surprisingly easy &#8211; even on Windows.</p>
<p><strong>0. Preliminary setup: make sure each computer gets a constant IP address</strong></p>
<p><em>Before setting up the DNS server, you need to ensure that each computer or virtual machine gets a fixed IP address. Otherwise the IP address of the computer may change on each reboot.</em></p>
<p>This should be done on your router, which is usually located either at 192.168.0.1 or 192.168.1.1 (check your current local IP address by running the Command Prompt and &#8220;ipconfig&#8221;, which shows your current IP address). Check your router manual on instructions how to log in, most routers have a HTTP-based configuration system which can be accessed when connected to the router.</p>
<p>In my case (I have a Asus RT-N11), the address was 192.168.1.1. Make sure that the computers you want to setup IPs for are connected, then find the &#8220;Status&#8221; or &#8220;DHCP Leases&#8221; listing on the router web interface. This listing will contain the MAC addresses for each host. Here is mine:</p>
<pre>Host Name       MAC Address       IP Address      Lease
--------------------------------------------------------------
HOST1        00-11-22-33-F0-AC 192.168.1.5     60016 secs.
HOST2        00-11-33-44-F2-2C 192.168.1.6     85074 secs.</pre>
<p>A <a href="http://en.wikipedia.org/wiki/MAC_address">MAC address </a>is a unique identifier given to each network adapter. It allows you to setup fixed IPs.</p>
<p>Find the router functionality which allows you to &#8220;Assign IP Addresses Manually&#8221;. This should enable you to specify a MAC address and a corresponding fixed IP address. Do this for each of the network adapters you wish to have a fixed IP address. On the Asus RT-N11 this was under &#8220;IP Config&#8221; -&gt; &#8220;DHCP Server&#8221;.</p>
<p>Add a MAC address &lt;-&gt; IP address pair for each computer.</p>
<p><strong>1. Get MaraDNS </strong></p>
<p>MaraDNS is a free, lightweight and relatively easy-to-configure DNS server for Windows and Linux. <a href="http://www.maradns.org/download.html">Download it from here </a>and unzip it to some folder.</p>
<p><strong>2. Configure MaraDNS</strong></p>
<p>Open &#8220;secret.txt&#8221; and change the value to something else (random characters).</p>
<p>The MaraDNS configuration is in the &#8220;mararc&#8221; file in the same directory. <a href="http://en.wikipedia.org/wiki/Name_server">DNS servers </a>have two sets of functionality. They can function as a &#8220;Authoritative name server&#8221; or a &#8220;Recursive/caching name server&#8221;.</p>
<p>Authoritative name servers specify IP addresses for domain names. Recursive name servers store information from authoritative name servers and pass on queries in a recursive manner.</p>
<p>We will be configuring both authoritative and recursive functionality in MaraDNS.</p>
<p><strong>2.1 Authoritative configuration</strong></p>
<p>We will configure the server to provide authoritative names of the LAN domain names. Pick any domain, I chose &#8220;local.com&#8221; (note though that you will not be able to access the actual &#8220;local.com&#8221; website if you pick an existing domain name).</p>
<p>Add configuration lines to &#8220;mararc&#8221; like these:</p>
<pre>csv2 = {}
csv2["local.com."] = "db.lan.txt"</pre>
<p>Where <em>local.com </em>is the domain name you picked, and <em>db.lan.txt</em> is the name of the second configuration file which we will be creating next (change it if you want to name the second configuration file).</p>
<p>Create a new file named &#8220;db.lan.txt&#8221; in the same directory as MaraDNS.</p>
<p>For each of the computers you want to resolve to a name, add a line to &#8220;db.lan.txt&#8221;. For example, for two machines, one &#8220;dev.local.com&#8221; and the other &#8220;blog.local.com&#8221;, add the following lines:</p>
<pre>dev.%       192.168.1.4 ~
blog.%        192.168.1.6 ~</pre>
<p>Done!</p>
<p><strong>2.2 Recursive configuration</strong></p>
<p>We will setup MaraDNS to ask your default name servers for all other domains so that you can resolve all other domain names to their correct IP addresses.</p>
<p>Find out your ISP&#8217;s DNS server addresses. These are likely to be listed either on the Router status page, or by checking the details on your network adapter.</p>
<p>Now add your ISP&#8217;s DNS servers as upstream servers in &#8220;mararc&#8221;:</p>
<pre>upstream_servers = {}
upstream_servers["."] = "xxx.xxx.xxx.xxx, yyy.yyy.yyy.yyy"</pre>
<p>Where <em>xxx.xxx.xxx.xxx</em> and <em>yyy.yyy.yyy.yyy </em>are your ISP&#8217;s DNS servers.</p>
<p>Done!</p>
<p><strong>3. Run MaraDNS and test it using askmara.exe</strong></p>
<p>Double-click &#8220;runmara.bat&#8221; , and leave the server running.</p>
<p>Open a command prompt, navigate to the MaraDNS directory and try running:</p>
<pre>askmara.exe Agoogle.com.</pre>
<p>and</p>
<pre>askmara.exe Ablog.local.com.</pre>
<p>You should get replies like this:</p>
<pre># Querying the server with the IP 127.0.0.1
# Question: Agoogle.com.
google.com. +300 a 74.125.67.100
google.com. +300 a 74.125.53.100
google.com. +300 a 74.125.45.100
# NS replies:
# AR replies:</pre>
<p>and:</p>
<pre># Querying the server with the IP 127.0.0.1
# Question: Ablog.local.com.
blog.local.com. +86400 a 192.168.1.6
# NS replies:
#local.com. +86400 ns synth-ip-7f000001.local.com.
# AR replies:
#synth-ip-7f000001.local.com. +86400 a 127.0.0.1</pre>
<p>If you get problems with the first query, you messed up the recursive DNS settings (are your ISP DNS server addresses correct?), and if you get an error with the second query, you messed up the authoritative settings.</p>
<p><strong>4. Change MaraDNS to reply to queries from your LAN</strong></p>
<p>Shutdown the MaraDNS window, and change the first two lines of &#8220;mararc&#8221; to something like:</p>
<pre>ipv4_bind_addresses = "192.168.1.2
recursive_acl = "192.168.1.0/24"</pre>
<p>Where 192.168.1.2 is the IP address of the computer on which the server will be running and the &#8220;192.168.1&#8243; part of recursive_acl is the same as on your network (might be 192.168.0.0/24).</p>
<p>Start MaraDNS again, and leave it running.</p>
<p><strong>5. Setup your router to hand out your new DNS server</strong></p>
<p>Open your router&#8217;s web interface and find the DHCP server settings. There should be an option to set up a DNS server. Write the IP address of the computer on which the DNS server will be running.</p>
<p>For each of your computers, disconnect the network (e.g. by disabling and enabling it in Windows, or by using &#8220;ifconfig eth0 down&#8221;/&#8221;ifconfig eth0 up&#8221; on Linux).</p>
<p>That&#8217;s it, you should now be able to refer to your LAN computers by their domain names.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/10/14/how-to-setup-a-lan-dns-server-using-maradns-under-windows-7/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PhpDocumentor 1.4.3 gotchas</title>
		<link>http://blog.mixu.net/2009/09/09/phpdocumentor-1-4-3-gotchas/</link>
		<comments>http://blog.mixu.net/2009/09/09/phpdocumentor-1-4-3-gotchas/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 05:35:52 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=429</guid>
		<description><![CDATA[Here are three minor gotchas: To ignore a directory, use -i path/relative/to/the/src/root/ with a &#8220;/&#8221; at the end (or &#8220;\&#8221; for Windows). You MUST have that trailing slash, otherwise the directive is treated differently (filename match) To ignore multiple directories, you cannot use multiple -i -directives. If you do, they will overwrite one another, and [...]]]></description>
			<content:encoded><![CDATA[<p>Here are three minor gotchas:</p>
<ol>
<li> To ignore a directory, use -i path/relative/to/the/src/root/ with a &#8220;/&#8221; at the end (or &#8220;\&#8221; for Windows). You <strong>MUST have that trailing slash,</strong> otherwise the directive is treated differently (filename match)</li>
<li>To ignore multiple directories, <strong>you cannot use multiple -i -directives</strong>. If you do, they will overwrite one another, and only the last one will be applied. Instead, <strong>use a comma </strong>to separate the paths: -i first/path/,second/path/</li>
<li>If you happen to use 1.4.3 and use the &#8221;HTML:frames:earthli&#8221; template, you will notice that the images and css files won&#8217;t load because they are missing one character at the end for some reason. Solution: rename or copy the template from a previous version to &#8220;./PhpDocumentor/Converters/HTML/frames/earthli&#8221;.</li>
</ol>
<p>Really, this is simple but the documentation is rather unclear as to how this works (particularly the point about the significance of the last slash character). I found some comments in the bug tracker which helped me find the correct syntax (<a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1780827&amp;group_id=11194&amp;atid=111194">here</a>). Both of these things are implied in documentation, but I figure writing this might save someone else some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/09/09/phpdocumentor-1-4-3-gotchas/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Semantic CSS naming best practices</title>
		<link>http://blog.mixu.net/2009/08/12/semantic-css-naming-best-practices/</link>
		<comments>http://blog.mixu.net/2009/08/12/semantic-css-naming-best-practices/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:15:24 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=372</guid>
		<description><![CDATA[I went through a number of articles as well as my own CSS files, and here are my suggestions for semantic CSS layouts (names of ID&#8217;s and classes) as an image. There is an article that could be written on the information, but I can&#8217;t be bothered. View the full-size version here.]]></description>
			<content:encoded><![CDATA[<p>I went through a number of articles as well as my own CSS files, and here are my suggestions for semantic CSS layouts (names of ID&#8217;s and classes) as an image.</p>
<p><a href="http://blog.mixu.net/files/2009/08/semantic-css-conventions.png"><img src="http://blog.mixu.net/files/2009/08/semantic-css-conventions.png" alt="semantic-css-conventions" title="semantic-css-conventions" width="600" height="462" class="alignnone size-full wp-image-373" /><br />
</a><br />
There is an article that could be written on the information, but I can&#8217;t be bothered. <a href="http://blog.mixu.net/files/2009/08/semantic-css-conventions.png">View the full-size version here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/08/12/semantic-css-naming-best-practices/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to install trac, mercurial and trac-mercurial on Fedora Core 10</title>
		<link>http://blog.mixu.net/2009/05/27/how-to-install-trac-mercurial-and-trac-mercurial-on-fedora-core-10/</link>
		<comments>http://blog.mixu.net/2009/05/27/how-to-install-trac-mercurial-and-trac-mercurial-on-fedora-core-10/#comments</comments>
		<pubDate>Wed, 27 May 2009 05:23:15 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=94</guid>
		<description><![CDATA[Here is a quick, up-to-date (as of 05/2009) guide to installing and troubleshooting trac, mercurial and trac-mercurial on FC10. I started with a fresh VM install for this guide. 1. Get the dependencies and tools yum install wget yum install python mercurial trac trac-mercurial yum install python-devel python-setuptools python-genshi python-docutils python-pygments mod_python 2. Get easy_install [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick, up-to-date (as of 05/2009) guide to installing and troubleshooting trac, mercurial and trac-mercurial on FC10. I started with a fresh VM install for this guide.</p>
<p><strong>1. Get the dependencies and tools</strong></p>
<p><code>yum install wget<br />
yum install python mercurial trac trac-mercurial<br />
yum install python-devel python-setuptools python-genshi python-docutils python-pygments mod_python<br />
</code></p>
<p><strong>2. Get easy_install to work on FC10</strong></p>
<p><code>wget http://peak.telecommunity.com/dist/ez_setup.py</code></p>
<p>Here is the first (minor) pitfall. You need to force the update of easy_install. If you only run &#8220;python ez_setup.py&#8221;, then you will not get the easy_install command (bash will not recognize it). Run:</p>
<p><code>python ez_setup.py -U setuptools</code></p>
<p><strong>3. Install the mercurial plugin</strong></p>
<p><em>From: http://trac.edgewall.org/wiki/MultipleRepositorySupport</em></p>
<p>Check out the mercurial plugin:<br />
<code>svn co http://svn.edgewall.com/repos/trac/sandbox/mercurial-plugin-0.12 </code></p>
<p>Build the mercurial plugin. From within the checked-out directory, build the egg file (it will end up in the dist subdirectory):</p>
<p><code>python setup.py bdist_egg</code></p>
<p>Check out the multirepos branch:</p>
<p><code>svn co http://svn.edgewall.com/repos/trac/sandbox/multirepos</code></p>
<p>Install the multirepos version of trac (from within the multirepos directory, as root):</p>
<p><code>python setup.py install</code></p>
<p><strong>4. Get the development branch of Genshi</strong></p>
<p>Here you will run into the error &#8220;No local packages or download links found for Genshi&gt;=0.6dev-r960&#8243;. To fix this, you need to force an update of Genshi to the latest dev version:</p>
<p><code>easy_install -U "Genshi==dev"</code></p>
<p><strong>5. Create your trac environment directory</strong></p>
<p>For example:</p>
<p><code>trac-admin /path/to/trac/myproject initenv<br />
chown -R apache:apache /path/to/trac/myproject</code></p>
<p><strong>6. Setup Apache for Trac</strong></p>
<p><code>nano etc/httpd/conf/httpd.conf</code></p>
<p>Add something like:</p>
<p><code>&lt;Location "/trac"&gt;<br />
SetHandler mod_python<br />
PythonInterpreter main_interpreter<br />
PythonHandler trac.web.modpython_frontend<br />
PythonOption TracEnvParentDir /path/to/trac<br />
PythonOption TracUriRoot /trac<br />
&lt;/Location&gt;<br />
</code></p>
<p>And if you haven&#8217;t added mod_python already:</p>
<p><code>LoadModule python_module modules/mod_python.so</code></p>
<p><strong>7. Continue with the setup</strong></p>
<p><em>From: http://trac.edgewall.org/wiki/MultipleRepositorySupport</em></p>
<p>Copy the mercurial plugin egg file to the &lt;trac-env&gt;/plugins directory. Make sure the following is somewhere in &lt;trac-env&gt;/conf/trac.ini, adding all the desired repositories to the [repositories] section:<br />
<code>[components]<br />
tracext.hg.* = enabled[repositories]<br />
my_repo_a.dir = path_to_a_repository</p>
<p>[trac]<br />
repository_dir = path_to_default_repository<br />
repository_type = hg</p>
<p>Note that when the repository .type is not specified, the value of [trac] repository_type is used.</p>
<p></code></p>
<p><strong>8. Restart apache and test</strong></p>
<p><code>service httpd restart</code></p>
<p>Navigate to http://localhost/trac .</p>
<p><strong>Some possible errors</strong></p>
<p>If you get something like:</p>
<pre>Available Projects</pre>
<pre>    * attachments: Error
      ([Errno 2] No such file or directory:
'/path/to/trac/env/attachments/VERSION')</pre>
<p>Check your <em>TracEnvParentDir</em> in httpd.conf, it is probably incorrect. (And restart apache.)</p>
<p>If you get the error:</p>
<pre>"Unsupported version control system "hg": Can't find an appropriate component, maybe the corresponding plugin was not enabled? "</pre>
<p>Check if you copied the TracMercurial-0.12.0.6dev_r7902-py2.5.egg file to the correct location. (And restart apache.)</p>
<p><strong>References:</strong></p>
<p>http://trac.edgewall.org/wiki/TracOnFedoraCore</p>
<p>http://trac.edgewall.org/wiki/TracMercurial</p>
<p>http://trac.edgewall.org/wiki/TracModPython</p>
<p>http://trac.edgewall.org/wiki/MultipleRepositorySupport</p>
<p>http://www.smallroomsoftware.com/articles/2008/2/14/trac-0-11-installation-on-centos-fedora</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/05/27/how-to-install-trac-mercurial-and-trac-mercurial-on-fedora-core-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a book review site from your Amazon book review RSS feed</title>
		<link>http://blog.mixu.net/2009/05/10/creating-a-book-review-site-from-your-amazon-book-review-rss-feed/</link>
		<comments>http://blog.mixu.net/2009/05/10/creating-a-book-review-site-from-your-amazon-book-review-rss-feed/#comments</comments>
		<pubDate>Sun, 10 May 2009 05:26:14 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/2009/05/47/</guid>
		<description><![CDATA[I figured the first thing to do in order to get my book reviews online was to set up the functionality to get them from Amazon and display them on my site. This way I can write reviews on Amazon and have them automatically added to my own site. Amazon offers an RSS feed of [...]]]></description>
			<content:encoded><![CDATA[<p>I figured the first thing to do in order to get my book reviews online was to set up the functionality to get them from Amazon and display them on my site. This way I can write reviews on Amazon and have them automatically added to my own site.</p>
<p>Amazon offers an RSS feed of your reviews under your profile, see the link in the &#8220;Public Reviews Written by You&#8221; heading on &#8220;Your Profile&#8221;. What we will do is use this RSS to create a new site. </p>
<p><b>Get Simplepie (and CodeIgniter, if you want to)</b></p>
<p>I am going to set up the site using the <a href="http://codeigniter.com/">CodeIgniter </a>MVC framework and the <a href="http://simplepie.org/">SimplePie </a>RSS reader library. You don&#8217;t really need to use CodeIgniter, but I wanted to give it a try. First download SimplePie and move the simplepie.inc file under /application/libraries and rename it to &#8220;simplepie.php&#8221;. Set up CodeIgniter as instructed in the user guide.</p>
<p><b>Controller code</b></p>
<p>In your controller: </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #000088;">$start</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$length</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'simplepie'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">simplepie</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_cache_location</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./system/cache'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// amazon uses class and id attributes in their review, which are useful for styling the content inside CDATA - so allow those two, and the rest is default.</span>
      <span style="color: #000088;">$attribs</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">simplepie</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">strip_attributes</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// unset class and id</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_search</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attribs</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attribs</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_search</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attribs</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attribs</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">simplepie</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">strip_attributes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attribs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// change this to your Amazon book review RSS feed address</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">simplepie</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_feed_url</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.amazon.com/rss/people/A31F72N3CBFDG2/reviews/ref=cm_rss_member_rev_manlink'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">simplepie</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'feed'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">simplepie</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'start'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$start</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'length'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$length</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show_rss'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><b>View code</b></p>
<p>After that, create the view (show_rss in my case). Create code to process the feed. I used the pagination code from the SimplePie documentation as the basis so that you can have separate pages for the items:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$feed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_items</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$start</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$feed2</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_feed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;latest-post&quot;&gt; 
            &lt;h1 class=&quot;title&quot;&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_permalink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_title</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;&lt;/h1&gt; 
            &lt;p class=&quot;meta&quot;&gt;Source: &lt;a href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$feed2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_permalink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$feed2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_title</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt; | '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'j M Y, g:i a'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt; 
            &lt;div class=&quot;entry&quot;&gt; 
              &lt;p&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_content</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;
              &lt;span class=&quot;comments&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'j M Y, g:i a'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Let's do our paging controls</span>
  <span style="color: #000088;">$next</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$start</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$length</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$prev</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$start</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$length</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Create the NEXT link</span>
  <span style="color: #000088;">$nextlink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$next</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;Next &amp;raquo;&lt;/a&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$next</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$nextlink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Next &amp;raquo;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Create the PREVIOUS link</span>
  <span style="color: #000088;">$prevlink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$prev</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;&amp;laquo; Previous&lt;/a&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$prev</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$start</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$prevlink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$next</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;&amp;laquo; Previous&lt;/a&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$prev</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$prevlink</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&amp;laquo; Previous'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Normalize the numbering for humans</span>
  <span style="color: #000088;">$begin</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$start</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$end</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$next</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$max</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$next</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;latest-post&quot;&gt; 
  &lt;p&gt;Showing '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$begin</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;ndash;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$end</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' out of '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$max</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' | '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$prevlink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' | '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$nextlink</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' | &lt;a href=&quot;'</span> <span style="color: #339933;">.</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$start</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'5'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;5&lt;/a&gt;, &lt;a href=&quot;'</span> <span style="color: #339933;">.</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$start</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'10'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;10&lt;/a&gt;, or &lt;a href=&quot;'</span> <span style="color: #339933;">.</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$start</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'20'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;20&lt;/a&gt; at a time.&lt;/p&gt;
  &lt;/div&gt;'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><b>CSS stylesheet</b></p>
<p>Finally, add a stylesheet. I used one from <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>. I also made the following minor tweaks:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&nbsp;
span<span style="color: #6666ff;">.amzRssByline</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Adds newline before the by line in reviews */</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
div<span style="color: #6666ff;">.entry</span> img <span style="color: #00AA00;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Floats the review picture */</span>
 <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
 <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
&nbsp;
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #6666ff;">.entry</span> table div <span style="color: #00AA00;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Adds a margin after the review heading */</span>
 <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Here is the result: <a href="http://books.mixu.net/">http://books.mixu.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/05/10/creating-a-book-review-site-from-your-amazon-book-review-rss-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to watch Hulu videos via SSH tunneling</title>
		<link>http://blog.mixu.net/2009/05/05/how-to-watch-hulu-videos-via-ssh-tunneling/</link>
		<comments>http://blog.mixu.net/2009/05/05/how-to-watch-hulu-videos-via-ssh-tunneling/#comments</comments>
		<pubDate>Tue, 05 May 2009 11:11:15 +0000</pubDate>
		<dc:creator>Mikito Takada</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.mixu.net/?p=35</guid>
		<description><![CDATA[Update 2 (Oct 2009): Since this is reasonably popular content, here are some additional findings: First, Flash does not always use the same settings as your browser &#8211; try the proxy settings in Internet Explorer/Chrome. These seem to work better. The vast majority of problems are a result of Flash using different settings than your browser, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center; "><img class="size-full wp-image-36 aligncenter" title="hulu" src="http://blog.mixu.net/files/2009/05/hulu.png" alt="hulu" width="586" height="242" /></p>
<p><strong>Update 2 (Oct 2009):</strong> Since this is reasonably popular content, here are some additional findings:</p>
<p>First, Flash does not always use the same settings as your browser &#8211; try the proxy settings in Internet Explorer/Chrome. These seem to work better. The vast majority of problems are a result of Flash using different settings than your browser, revealing your actual IP to Hulu.</p>
<p>Second, if this does not work you can always use <a href="http://www.proxifier.com/">Proxifier </a>(commercial product with 30 days trial), a TCP wrapper which forces all connections on the computer to use a particular proxy. This can be used in conjunction with a Hulu downloader, such as <a href="http://lifehacker.com/5310467/hulu-video-downloader-saves-your-favorite-shows-for-offline-enjoyment">Hulu Video Downloader</a> to download the videos.</p>
<p><strong><em>Update:</em></strong><em> Still works </em><a href="http://www.techcrunch.com/2009/05/06/control-freaks-hulu-now-blocks-anonymous-proxies-too/"><em>even after Hulu tightened their geofiltering</em></a><em>. As long as one isn&#8217;t using a mainstream service like Hotspot Shield, I doubt Hulu will be able to fully block this since they are in essence removing access from legitimate US computers. Probably the best thing would be to have a server set up in a legitimate, large institution such a US university or have a home-based server on a consumer ISP in the US. Both would make it hard to block the IP without causing legitimate users to be blocked as well. Then again, for me this is more of an interesting thing to do rather than a necessity. Mileage may vary depending on how proactive Hulu gets, in the end all anyone needs is one non-blocked legitimate IP address in the US.</em></p>
<p>If you haven&#8217;t heard of <a href="http://en.wikipedia.org/wiki/Hulu">Hulu</a>, it&#8217;s basically a website like YouTube but with full episodes of recent TV series &#8211; legal and with short commercials inserted into the video streams. For instance, the HBO show <a href="http://en.wikipedia.org/wiki/C.S.I.">CSI </a>is available on the site very soon after it has been shown in the US and you can watch it directly as streaming video. There is one caveat &#8211; the website blocks non-US viewers from watching any of the videos. So, no luck for us Finns.</p>
<p>However, this is rather easy to get around if you happen to have a server based in the US with SSH access. What you need to do is set up a SSH tunnel to your US server, then instruct your web browser to connect via that tunnel. This will cause all connections to Hulu to go through your US server, and will make it possible to watch Hulu videos.</p>
<p><strong>Setting up using the SSH command/PuTTy</strong></p>
<p>SSH allows you to connect securely to the server and create a secure tunnel from your computer to the US-based server. You can set up a local SSH client program to do this.</p>
<pre>ssh -D 8080 -p 22 -f -N username@yourserver.com</pre>
<p>As the SSH manual page states the -D option:</p>
<pre>-D port. Specifies a local "dynamic" application-level port forwarding.
 This works by allocating a socket to listen to port on the local side, 
<span style="background-color: #ffffff;">and whenever a connection is made to this port, the connection is
forwarded over the secure channel, and the application protocol is then
used to determine where to connect to from the remote machine.  Currently
the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.</span></pre>
<p>You can also do this in Windows using the PuTTy SSH client. Look under Connection -&gt; SSH -&gt; Tunnels. Add a dynamic port forward, use port 8080 and no need to specify the destination.</p>
<p><strong>Setting Firefox to use the tunnel</strong></p>
<p>Then set up Firefox to use the local SOCKS server (localhost:8080). The relevant settings can be found under Tools -&gt; Options -&gt; Advanced -&gt; Network -&gt; Settings &#8230; -&gt; Manual proxy configuration.</p>
<p><strong>Testing</strong></p>
<p>This works very nicely, because you are now connecting from an US IP. To verify this, open up Internet Explorer and check <a href="http://www.whatsmyip.org/">http://www.whatsmyip.org/</a> and do the same in Firefox. You should see two different IP addresses. Just remember that any videos you watch will be transferred twice (from a bandwidth usage perspective) &#8211; once to your US server and then back. A single video is only about a hundred megabytes or so, so this not particularly bad for the convinience though.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mixu.net/2009/05/05/how-to-watch-hulu-videos-via-ssh-tunneling/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
