<?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>Digital Adventures of Cyril Pauya</title>
	<atom:link href="http://blog.mrpau.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mrpau.com</link>
	<description>A programmer, husband, and father.</description>
	<lastBuildDate>Fri, 13 Sep 2013 07:03:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>django send email</title>
		<link>http://blog.mrpau.com/2013/09/django-send-email/</link>
		<comments>http://blog.mrpau.com/2013/09/django-send-email/#comments</comments>
		<pubDate>Tue, 03 Sep 2013 07:01:44 +0000</pubDate>
		<dc:creator>Richard Amodia</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=983</guid>
		<description><![CDATA[Mail is sent using the SMTP host and port specified in the EMAIL_HOST and EMAIL_PORT settings. The EMAIL_HOST_USER and EMAIL_HOST_PASSWORD settings, if set, are used to authenticate to the SMTP server, and the EMAIL_USE_TLS and EMAIL_USE_SSL settings control whether a secure connection is used. add this code to setting.py as your email account ALLOWED_HOSTS = [...]]]></description>
			<content:encoded><![CDATA[<p>Mail is sent using the SMTP host and port specified in the EMAIL_HOST and EMAIL_PORT settings. The EMAIL_HOST_USER and EMAIL_HOST_PASSWORD settings, if set, are used to authenticate to the SMTP server, and the EMAIL_USE_TLS and EMAIL_USE_SSL settings control whether a secure connection is used.</p>
<p>add this code to setting.py as your email account</p>
<blockquote><p>ALLOWED_HOSTS = []<br />
EMAIL_USE_TLS = True<br />
EMAIL_HOST = &#8216;smtp.example.com&#8217;<br />
EMAIL_HOST_USER = &#8216;test@example.com&#8217;<br />
EMAIL_HOST_PASSWORD = r&#8217;example&#8217;<br />
EMAIL_PORT = 587<br />
DEFAULT_FROM_EMAIL = &#8216;My Company &#8216;<br />
SERVER_EMAIL = &#8216;webmas&#8230;@example.com&#8217;</p></blockquote>
<p>views.py</p>
<pre>from django.template.loader import render_to_string

def send_email(request):
    message = render_to_string(email.html)

    send_mail('Subject here', message, 'from@example.com',
    ['to@example.com'], fail_silently=False)</pre>
<p>reference:<a href="https://docs.djangoproject.com/en/dev/topics/email/"> https://docs.djangoproject.com/en/dev/topics/email/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2013/09/django-send-email/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>django create Function to delete all session</title>
		<link>http://blog.mrpau.com/2013/08/django-create-function-to-delete-all-session/</link>
		<comments>http://blog.mrpau.com/2013/08/django-create-function-to-delete-all-session/#comments</comments>
		<pubDate>Fri, 23 Aug 2013 06:59:18 +0000</pubDate>
		<dc:creator>Richard Amodia</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=802</guid>
		<description><![CDATA[definition: session stores data on the server side and abstracts the sending and receiving of cookies, Delete the current session data from the session and regenerate the session key value that is sent back to the user in the cookie. purpose: This is used if you want to ensure that the previous session data can’t [...]]]></description>
			<content:encoded><![CDATA[<p>definition: session stores data on the server side and abstracts the sending and receiving of cookies, Delete the current session data from the session and regenerate the session key value that is sent back to the user in the cookie.</p>
<p>purpose: This is used if you want to ensure that the previous session data can’t be accessed again from the user’s browser.</p>
<p>views.py</p>
<pre>def delete_session(request):
    # session to be deleted
    session = request.session
    del session['session1']
    del session['session2']
    del session['session3']
    del session['session4']
    del session['session5']</pre>
<p>*use the &#8220;&#8221;delete_session(request)&#8221;" Function name to delete session.</p>
<p>*I have an example below on how to use the created delete_session function.</p>
<pre>def final_session(request):
    # function name
    delete_session(request)

    template = 'final_session.html'
    context = {}
    return render(request, template, context)</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2013/08/django-create-function-to-delete-all-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RIP Steve Jobs</title>
		<link>http://blog.mrpau.com/2011/10/rip-steve-jobs/</link>
		<comments>http://blog.mrpau.com/2011/10/rip-steve-jobs/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 13:04:21 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=779</guid>
		<description><![CDATA[I say good-bye to a great visionary, one of my idols in the computer industry. http://www.telegraph.co.uk/technology/steve-jobs/8810743/Steve-Jobs-tributes-to-the-Apple-co-founder.html Rest in Peace Steve Jobs. Thank you for making the world a better place to live in.]]></description>
			<content:encoded><![CDATA[<p>I say good-bye to a great visionary, one of my idols in the computer industry.</p>
<p><a href="http://www.telegraph.co.uk/technology/steve-jobs/8810743/Steve-Jobs-tributes-to-the-Apple-co-founder.html">http://www.telegraph.co.uk/technology/steve-jobs/8810743/Steve-Jobs-tributes-to-the-Apple-co-founder.html</a></p>
<p><strong>Rest in Peace Steve Jobs.</strong>  Thank you for making the world a better place to live in.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2011/10/rip-steve-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to display contents of file in Ubuntu terminal</title>
		<link>http://blog.mrpau.com/2011/02/how-to-display-contents-of-file-in-ubuntu-terminal/</link>
		<comments>http://blog.mrpau.com/2011/02/how-to-display-contents-of-file-in-ubuntu-terminal/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 13:06:44 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=776</guid>
		<description><![CDATA[I always forget how to do this so I&#8217;m putting it here for my own reminder. When you are on Ubuntu&#8217;s terminal or shell, this is the command on how to display the contents of a file in Ubuntu: $ cat file.txt Pretty easy huh!]]></description>
			<content:encoded><![CDATA[<p>I always forget how to do this so I&#8217;m putting it here for my own reminder.</p>
<p>When you are on Ubuntu&#8217;s terminal or shell, this is the command on how to display the contents of a file in Ubuntu:</p>
<blockquote><p>$ cat file.txt</p></blockquote>
<p>Pretty easy huh!<br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2011/02/how-to-display-contents-of-file-in-ubuntu-terminal/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>Screen your way on Ubuntu Linux</title>
		<link>http://blog.mrpau.com/2010/10/screen-your-way-o-ubuntu-linux/</link>
		<comments>http://blog.mrpau.com/2010/10/screen-your-way-o-ubuntu-linux/#comments</comments>
		<pubDate>Sat, 30 Oct 2010 16:23:04 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=760</guid>
		<description><![CDATA[We have plenty of experience deploying Django applications to remote servers, mostly on Webfaction. But the latest server we deployed to was a Debian Lenny VPS server. Since Ubuntu was of a Debian family, it&#8217;s been quite easy. The problem is if you have a reliable internet connection to the server half-way around the globe. [...]]]></description>
			<content:encoded><![CDATA[<p>We have plenty of experience deploying Django applications to remote servers, mostly on <a href="http://www.webfaction.com/?affiliate=cpauya">Webfaction</a>.  But the latest server we deployed to was a Debian Lenny VPS server.  Since Ubuntu was of a Debian family, it&#8217;s been quite easy.  The problem is if you have a reliable internet connection to the server half-way around the globe.</p>
<p>I&#8217;m on a mobile broadband internet connection since we moved to Davao City.  That means I got an unreliable internet connection.  So typing &#8220;tail -f /var/log/apache2/error.log&#8221; would take a few seconds to echo on your shell.  Now imagine having to type that every time you make changes to your Apache configuration files?<br />
<span id="more-760"></span><br />
To alleviate the latency issue, there&#8217;s a very nifty command called <a href="https://help.ubuntu.com/community/Screen">screen</a> &#8211; a terminal multiplexer, which allows a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session (such as when using SSH).<br />
<br />
It&#8217;s pretty cool to use specially on a remote server because you can simulate multiple sessions in just one remote SSH session.  Enough of that, anyone can read the <a href="https://help.ubuntu.com/community/Screen">GNU Screen version</a> if they want to.</p>
<p>Here are some practical screen commands for you (C means Ctrl):<br />
$ screen -ls == see lists of screens<br />
$ screen == create new screen session<br />
$ screen -r
<process id> == re-attach to a detached screen<br />
$ C-D == close screen session<br />
$ C-a c == add window to current screen<br />
$ C-a d == detach from screen (process still continues)<br />
$ C-a n == next window on screen<br />
$ C-a p == previous window on screen<br />
$ C-a &#8221; == list of windows on screen<br />
$ C-a 0 == go to first window<br />
$ C-a 1 == go to second window<br />
$ C-a 0..9 == go to n window</p>
<p>And here are some practical screen uses:<br />
window 1 == $ tail -f /var/log/apache2/error.log<br />
window 2 == $ tail -f /var/log/apache2/access.log<br />
window 3 == <current django/pinax path for $ ./manage.py stuff><br />
window 4 == </etc/apache2/ folder for debugging apache><br />
window 5 == <whatever you wish></p>
<p>You can then do a &#8220;C-a 1&#8243; to see if you got errors in Apache, then do &#8220;C-a 4&#8243; to fix the Apache conf&#8230; pretty cool eh?</p>
<p>Here&#8217;s where it gets even better:  You can do a &#8220;C-a d&#8221; to detach from the current screen session, quit your SSH session, and go home.  Then using another computer, after some time, on another location or galaxy maybe, you can launch a new SSH session to your server, do a &#8220;screen -ls&#8221; to see list of detached screen sessions, &#8220;screen -r <screen process id>&#8221; to attach to your previous screen session, then do a &#8220;C-a 1&#8243; to see if your Apache has errors.  </p>
<p>Now that&#8217;s saving yourself a lot of time typing&#8230; pretty neat eh? <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Go ahead and screen your way on Ubuntu Linux.  Hey, it&#8217;s on your local Ubuntu box&#8217;s shell, not only on servers.</p>
<p>Tip: In Ubuntu, there&#8217;s a very verbose and more beautiful <a href="https://launchpad.net/byobu">byobu</a> command.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2010/10/screen-your-way-o-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Halalan 2010 &#8211; First Automated National Elections in the Philippines</title>
		<link>http://blog.mrpau.com/2010/05/halalan-2010/</link>
		<comments>http://blog.mrpau.com/2010/05/halalan-2010/#comments</comments>
		<pubDate>Mon, 10 May 2010 03:55:41 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[Politics]]></category>
		<category><![CDATA[elections]]></category>
		<category><![CDATA[halalan-2010]]></category>
		<category><![CDATA[midsayap]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=710</guid>
		<description><![CDATA[I just finished voting in the Halalan 2010 &#8211; the First Automated National Elections in the Philippines.  It was an exciting experience for me as a Filipino, although as a programmer and a techie guy, I do have some apprehensions. My Halalan 2010 Experience &#8211; May 10, 2010 Here&#8217;s the timeline for My Halalan 2010 [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished voting in the Halalan 2010 &#8211; the First Automated National Elections in the Philippines.  It was an exciting experience for me as a Filipino, although as a programmer and a techie guy, I do have some apprehensions.<br />
<span id="more-710"></span><br />
<strong>My Halalan 2010 Experience &#8211; May 10, 2010</strong></p>
<p>Here&#8217;s the timeline for My Halalan 2010 Experience, the closest approximation of my time spent while voting:</p>
<table border="0">
<tbody>
<tr>
<td width=120px>Time</td>
<td>Activity</td>
</tr>
<tr>
<td>7:15am</td>
<td>Anticipating traffic with other voters, we (mother and sister) went early.</td>
</tr>
<tr>
<td>7:20am &#8211; 7:30am</td>
<td>Looked for our assigned Precinct and verified our number in the list of voters.</td>
</tr>
<tr>
<td>7:30am &#8211; 7:40am</td>
<td>Finished arguing with the person assigned in giving out numbers and finally got our color-coded number.</td>
</tr>
<tr>
<td>7:40am &#8211; 8:00am</td>
<td>Waiting and Queue area.  Had to wait for our color to be called.</td>
</tr>
<tr>
<td>8:00am &#8211; 8:32am</td>
<td>People are now flocking up.  Took some pictures to spend away time.</td>
</tr>
<tr>
<td>8:33am &#8211; 8:46am</td>
<td>Voted for Halalan 2010 &#8211; First Automated National Elections in the Philippines</td>
</tr>
<tr>
<td>8:47am</td>
<td>Home!</td>
</tr>
<tr>
<td>TOTAL Time Spent</td>
<td>1 hour and 32 minutes (1:32) Beat that! hehe</td>
</tr>
</tbody>
</table>
<p><strong>Halalan 2010 Highlights</strong></p>
<ol>
<li> <strong>Color Coding Queue System</strong>
<p>As we arrived, the assigned person giving the numbers (let&#8217;s call him Mr. Number-Giver), is sitting down giving out color-coded numbers to people.  No queue, no announcement on where to go, I had to ask a few of my ka-barangays from whom they got their numbers.</p>
<p>When I asked for a number, Mr. Number-Giver said &#8220;<em>mamaya na, tapusin muna natin ang first batch</em>&#8220;.  (I knew later that there were 7 colors, with 15 numbers each, so 75 persons per batch.)</p>
<p>I looked around and noticed that people are now flocking to Mr. Number-Giver and I don&#8217;t have all day to join in the hoard, so I asked him:</p>
<p>Me:  <em>In an hour or so, there will be more voters who will ask for numbers.  How would you know if we arrived earlier than them?</em> (I was trying to influence him to put us on queue).<br />
Mr. Number-Giver:  <em>Ah, I am familiar with your faces, I will know.</em><br />
Me:  <em>That&#8217;s not good, make a system.  Put us on queue then give us the numbers.</em><br />
Mr. Number-Giver:  <em>I am just following orders from our chairman inside, just wait until the first batch is done.</em><br />
Me:  <em>That&#8217;s not fair, let&#8217;s make a queue then you can follow the orders.  Make a system or else we will be in chaos.</em><br />
<em>&#8230; blah&#8230; blah&#8230; blah&#8230;</em></p>
<p>In short, I got what I wanted.  The other voters who heard made a queue then Mr. Number-Giver was forced to hand-out the numbers for the next batch.</p>
<p>My mother is a senior citizen, my sister is 8-month pregnant.  Imagine my gripe when we need to hoard for a number when in fact we arrived early?</p>
<p>Highlight questions:</p>
<ul>
<li>Why would you put a batch of voters (15 voters x 7 colors) when a queue with numbers would have sufficed?  Ever heard of First-Come-First-Serve?  No need for the damned colors!</li>
<li>Prioritize senior citizens and pregnant voters. (which they did after one lola asked instead of going on queue)</li>
<li>I don&#8217;t understand the batching.  Why put voters in a batch?  When there is already an available seat, let the next voter in.  Saves time.</li>
</ul>
</li>
<li><strong>Precinct Count Optical Scan (PCOS) machine</strong>
<p>The PCOS machine was designed to read your ballot.  Being a voter, I want it not only to read my ballot but DISPLAY MY CHOICES on the SCREEN.  Being a programmer, I know that is NOT a HARD Thing TO DO.</p>
<p>You would ask what about secrecy of my vote?  It would be displayed for others to see.  I don&#8217;t care!  Show me my votes as read and verified by the PCOS machine, then I will be a really impressed and satisfied voter.  I would feed my ballot to the PCOS machine anyway.</p>
<p>How assured am I as the voter that it was indeed my choice that the PCOS machine has read?  hahaha</p>
<p>Way ahead of me, there was a ballot that cannot be read by the PCOS machine although when double-checked by the BEI and the voter himself, all choices were valid.  So to really test the machine, I over-shaded my choice of my President beyond the oval lines.  I also over-shaded a few other candidates.  </p>
<p>I personally feed my ballot, anticipating that it will be spit out.  Surprise! It was verified and registered! bwahahaha</p>
<p><em><strong>Disclaimer</strong>: I am not trying to waste my vote here, I am a voter who is concerned of the integrity of the PCOS machine.  If the voter way ahead of me had a ballot which when checked was okay, surely my ballot should NOT be okay because I overshaded a few choices, right?  Think about it.  (Maybe the ballot format of the voter was different than mine?  Then we definitely should be concerned!)</em></p>
<p>Highlight questions:</p>
<ul>
<li>Again, How assured am I as the voter that it was indeed my choice that the PCOS machine has read?</li>
<li>For example, my ballot was not accepted by the PCOS machine, and when verified by BEI all is okay (shade and number of choices), do I get another ballot where I could cast the same choices?</li>
</ul>
</li>
<li><strong>Halalan 2010 Pictures</strong>
<p>Here are some pictures I took with my cellphone (not high-res but good enough hehe) while waiting on queue for the First Automated National Elections in the Philippines.  Taken at Dilangalen National High School, Poblacion 1, Midsayap, Cotabato, Philippines. <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-1/' title='halalan-2010-cyril-1'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-1-150x120.jpg" class="attachment-thumbnail" alt="entrance to the voting area" title="halalan-2010-cyril-1" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-2/' title='halalan-2010-cyril-2'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-2-150x120.jpg" class="attachment-thumbnail" alt="outside the waiting area" title="halalan-2010-cyril-2" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-3/' title='halalan-2010-cyril-3'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-3-150x120.jpg" class="attachment-thumbnail" alt="the queue area (mr. number-giver not visible coz sitting in-front of the frowning woman)" title="halalan-2010-cyril-3" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-4/' title='halalan-2010-cyril-4'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-4-150x120.jpg" class="attachment-thumbnail" alt="on queue with my color-coded number" title="halalan-2010-cyril-4" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-5/' title='halalan-2010-cyril-5'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-5-150x120.jpg" class="attachment-thumbnail" alt="on voters queue" title="halalan-2010-cyril-5" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-6/' title='halalan-2010-cyril-6'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-6-150x120.jpg" class="attachment-thumbnail" alt="inside the voting area 1" title="halalan-2010-cyril-6" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-7/' title='halalan-2010-cyril-7'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-7-150x120.jpg" class="attachment-thumbnail" alt="inside the voting area 2" title="halalan-2010-cyril-7" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-8/' title='halalan-2010-cyril-8'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-8-150x120.jpg" class="attachment-thumbnail" alt="pcos machine" title="halalan-2010-cyril-8" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-9/' title='halalan-2010-cyril-9'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-9-150x120.jpg" class="attachment-thumbnail" alt="smartmatic supplies" title="halalan-2010-cyril-9" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-10/' title='halalan-2010-cyril-10'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-10-150x120.jpg" class="attachment-thumbnail" alt="outside our voting area (see the hoard?)" title="halalan-2010-cyril-10" /></a>
<a href='http://blog.mrpau.com/2010/05/halalan-2010/halalan-2010-cyril-11/' title='halalan-2010-cyril-11'><img width="150" height="120" src="http://blog.mrpau.com/wp-content/uploads/2010/05/halalan-2010-cyril-11-150x120.jpg" class="attachment-thumbnail" alt="outside our voting area (that&#039;s the number queue, an hour after we took our numbers)" title="halalan-2010-cyril-11" /></a>

<p><em>I tried taking some pictures of my ballot inside the voting area but I was prohibited by a member of the BEI&#8230; oh well. <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
</li>
</ol>
<p>Moral of the story?  Nothing beats being an early bird.  I expect the queue to be a lot longer now, 3 hours after we voted.  </p>
<p>It&#8217;s already noon-time but weather is good for the Halalan 2010 here in Midsayap, dark clouds but no rain&#8230; yet. <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Update as of 2010-05-10 12:45pm &#8211; started raining na hehe</p>
<p>Surprisingly, there was no blackout&#8230; yet hehe.  I&#8217;ve been keeping tabs of the semi-random daily blackouts here in Midsayap since March 2010 where it usually happens three times daily from Monday to Friday and randomly during weekends.  No more blackouts, please.  Update as of 2010-05-10 4:10pm &#8211; sufferred first blackout of the day from 2:55pm to 4:06pm&#8230; waah!</p>
<p>I hope the next Automated Elections here in the Philippines should be more organized and could satisfy my tech apprehensions. hehe</p>
<p>To my fellow Filipinos, how was your Halalan 2010 experience?  Have you voted yet? <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2010/05/halalan-2010/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Mercurial GUI Client on Ubuntu</title>
		<link>http://blog.mrpau.com/2010/04/mercurial-gui-client-on-ubuntu/</link>
		<comments>http://blog.mrpau.com/2010/04/mercurial-gui-client-on-ubuntu/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 08:27:56 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[9.10]]></category>
		<category><![CDATA[gui-client]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[karmic-koala]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=685</guid>
		<description><![CDATA[There are a lot of options for a Mercurial GUI client on Ubuntu but I preferred to use TortoiseHg so that I could use it with Nautilus &#8211; Ubuntu&#8217;s file manager. TortoiseHg however is not in the Ubuntu Karmic Koala repositories.  Another challenge is that TortoiseHg 1.0.1 requires Mercurial 1.5 but Ubuntu Karmic only has [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of <a title="Other Tools for Mercurial" href="http://mercurial.selenic.com/wiki/OtherTools" target="_blank">options for a Mercurial GUI client</a> on Ubuntu but I preferred to use <a title="TortoiseHg" href="http://tortoisehg.bitbucket.org/">TortoiseHg</a> so that I could use it with Nautilus &#8211; Ubuntu&#8217;s file manager.</p>
<p>TortoiseHg however is not in the Ubuntu Karmic Koala repositories.  Another challenge is that TortoiseHg 1.0.1 requires Mercurial 1.5 but Ubuntu Karmic only has Mercurial 1.3 on the repositories.  Of course I want the newer versions. <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here are the steps I did to install TortoiseHg, my preferred Mercurial GUI client on Ubuntu Karmic Koala 9.10:<br />
<span id="more-685"></span></p>
<ol>
<li>Add the following PPAs to your Software Sources
<ol>
<li>Goto System -&gt; Administration -&gt; Software Sources<a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-software-sources-before-mercurial-and-tortoisehg.png"><img class="aligncenter size-medium wp-image-687" title="ubuntu-software-sources-before-mercurial-and-tortoisehg" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-software-sources-before-mercurial-and-tortoisehg-300x278.png" alt="ubuntu-software-sources-before-mercurial-and-tortoisehg" width="300" height="278" /></a></li>
<li>Click the Add button then paste the following on the APT line
<ul>
<li>
<pre>deb http://ppa.launchpad.net/mercurial-ppa/releases/ubuntu karmic main</pre>
</li>
<li>(refer to Mercurial PPA - <a title="Mercurial PPA" href="https://launchpad.net/~mercurial-ppa/+archive/releases">https://launchpad.net/~mercurial-ppa/+archive/releases</a>)<a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-add-software-source.png"><img class="aligncenter size-medium wp-image-689" title="ubuntu-add-software-source" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-add-software-source-300x154.png" alt="ubuntu-add-software-source" width="300" height="154" /></a></li>
</ul>
</li>
<li>Click the Add Source button</li>
<li>Click the Add button then paste the following on the APT line
<ul>
<li>
<pre>deb http://ppa.launchpad.net/tortoisehg-ppa/releases/ubuntu karmic main</pre>
</li>
<li>(refer to TortoiseHg PPA - <a title="TortoiseHg PPA" href="https://launchpad.net/~tortoisehg-ppa/+archive/releases">https://launchpad.net/~tortoisehg-ppa/+archive/releases</a>)</li>
</ul>
</li>
<li>Click the Add Source button</li>
<li>Your Software Sources should now reflect the newly added PPAs.<a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-software-sources.png"><img class="aligncenter size-medium wp-image-686" title="ubuntu-software-sources" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-software-sources-300x278.png" alt="ubuntu-software-sources" width="300" height="278" /></a></li>
<li>Click the Close button.</li>
<li>You will be asked to reload the information about available software, click on the Reload button.<a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-confirm-update-software-sources.png"><img class="aligncenter size-medium wp-image-690" title="ubuntu-confirm-update-software-sources" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-confirm-update-software-sources-300x153.png" alt="ubuntu-confirm-update-software-sources" width="300" height="153" /></a></li>
<li>Wait until the software sources update is finished.</li>
<li>Finally, to install TortoiseHg on Ubuntu, type this in the shell:
<pre>$ sudo apt-get install tortoisehg</pre>
<p>After that is done, Nautilus needs to be reloaded to reflect the context menu.  You may logout then log back in or just type this in the shell to quit all Nautilus instances:</p>
<pre>$ nautilus -q</pre>
<blockquote><p>Thanks to Jesumer for pointing this out.</p></blockquote>
</li>
<li>You may then launch Nautilus and right-click on a folder/file.  Your context menu should now show TortoiseHG as a menu item:
<div id="attachment_693" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-nautilus-tortoisehg-menu.png"><img class="size-medium wp-image-693" title="ubuntu-nautilus-tortoisehg-menu" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-nautilus-tortoisehg-menu-300x102.png" alt="ubuntu-nautilus-tortoisehg-menu" width="300" height="102" /></a><p class="wp-caption-text">Context Menu on a directory not yet on Mercurial repository.</p></div>
<div id="attachment_705" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-nautilus-tortoisehg-menu-2.png"><img class="size-medium wp-image-705" title="ubuntu-nautilus-tortoisehg-menu-2" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-nautilus-tortoisehg-menu-2-300x296.png" alt="Context Menu on a directory already on Mercurial repository." width="300" height="296" /></a><p class="wp-caption-text">Context Menu on a directory already on Mercurial repository.</p></div></li>
</ol>
</li>
</ol>
<p>Congratulations!  You have just installed TortoiseHg on your Ubuntu Karmic box.</p>
<p><a href="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-tortoisehg.png"><img class="aligncenter size-medium wp-image-695" title="ubuntu-tortoisehg" src="http://blog.mrpau.com/wp-content/uploads/2010/04/ubuntu-tortoisehg-300x208.png" alt="ubuntu-tortoisehg" width="300" height="208" /></a></p>
<p>Here are my references on myListBoard.com.</p>
<ul>
<li><a title="myListBoard.com - Mercurial GUI Client on Ubuntu" href="http://mylistboard.com/users/cy/lists/306/" target="_blank">Mercurial GUI Client on Ubuntu</a></li>
</ul>
<p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2010/04/mercurial-gui-client-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>How to Install Agilo on Trac at Webfaction</title>
		<link>http://blog.mrpau.com/2009/12/how-to-install-agilo-on-trac-at-webfaction/</link>
		<comments>http://blog.mrpau.com/2009/12/how-to-install-agilo-on-trac-at-webfaction/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 09:11:38 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[Project Management]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[agilo]]></category>
		<category><![CDATA[scrum]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[webfaction]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=663</guid>
		<description><![CDATA[Here are the steps I did to successfully install Agilo for Scrum (open-source version) in my Trac site at Webfaction.com: download agilo-source-latest.tar.gz create a python2.4 egg version of Agilo Open.  Since I don&#8217;t have Python 2.4 in my Ubuntu 9.04 laptop I tried installing.  However, it gives an error when compiling agilo it gives a &#8220;setuptools [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the steps I did to successfully install <a title="Agilo for Scrum" href="http://www.agile42.com/cms/pages/agilo" target="_blank">Agilo for Scrum (open-source version)</a> in my <a title="The Trac Project" href="http://trac.edgewall.org/" target="_blank">Trac</a> site at <a title="Webfaction.com" href="http://www.webfaction.com/?affiliate=cpauya" target="_blank">Webfaction.com</a>:<br />
<span id="more-663"></span></p>
<ol>
<li>download <a title="Latest Agilo Open" href="http://www.agile42.com/cms/download/agilo-source-latest.tar.gz" target="_blank">agilo-source-latest.tar.gz</a></li>
<li>create a python2.4 egg version of Agilo Open.  Since I don&#8217;t have Python 2.4 in my Ubuntu 9.04 laptop I tried installing.  However, it gives an error when compiling agilo it gives a &#8220;setuptools not installed&#8221; error, I dropped the process and did the following instead:
<ol>
<li>copy agilo-source-latest.tar.gz to your webfaction account</li>
<li>extract Agilo in a temporary folder</li>
<pre>tar xvf agilo-source-latest.tar.gz</pre>
<li>cd to the extracted Agilo directory</li>
<li>compile in python2.4</li>
<pre>python2.4 setup.py bdist_egg</pre>
<li>copy the Agilo egg file from the dist folder into your local disk</li>
</ol>
</li>
<li>install agilo to trac refer to <a href="http://www.agile42.com/cms/pages/download-install/" target="_blank">http://www.agile42.com/cms/pages/download-install/</a>
<ol>
<li>upload Agilo egg in your Trac site&#8217;s plugins</li>
<li>login to your Webfaction shell</li>
<li>edit trac.ini at (trac-project-dir)/conf/trac.ini</li>
<li>look for the [components] section &#8211; in my case I added it because it does not exist yet
<pre>[components]
agilo.* = enabled
# the following lines are only required to use Agilo Pro
agilo_common.* = enabled
agilo_pro.* = enabled</pre>
</li>
<li>upgrade trac so that the agilo tables will be created in the Trac database</li>
<pre>(trac-project-dir)/bin/trac-admin . upgrade</pre>
</ol>
</li>
<li>upgrade Genshi from 0.5 to 0.5.1
<ol>
<li>download from <a title="Genshi-0.5.1 for Python2.4" href="http://ftp.edgewall.com/pub/genshi/Genshi-0.5.1-py2.4-linux-i686.egg" target="_blank">Genshi-0.5.1-py2.4-linux-x86_64.egg</a></li>
<li>upload Genshi egg in your Trac site&#8217;s plugins</li>
</ol>
</li>
<li>reload your Trac site and Agilo Open must have been enabled</li>
</ol>
<p>IMPORTANT:</p>
<p>* when in doubt, enable logging in your Trac site and read the log at (trac-project-dir)/log/trac.log &#8211; this is how I fixed my problems with  Genshi 0.5.1 dependency of Agilo Open 0.8.4</p>
<p>Here are some caveats on my Trac setup:</p>
<ul>
<li>it uses Python 2.4;</li>
<li>it uses Trac 0.11.4;</li>
<li>it uses Genshi 0.5;</li>
</ul>
<p>Sources:</p>
<ul>
<li><a title="Latest Agilo Open" href="http://www.agile42.com/cms/download/agilo-source-latest.tar.gz" target="_blank">agilo-source-latest.tar.gz</a></li>
<li><a title="Genshi-0.5.1 for Python2.4" href="http://ftp.edgewall.com/pub/genshi/Genshi-0.5.1-py2.4-linux-i686.egg" target="_blank">Genshi-0.5.1-py2.4-linux-x86_64.egg</a></li>
</ul>
<p>References:</p>
<ul>
<li><a title="Agilo for Scrum" href="http://www.agile42.com/cms/pages/agilo" target="_blank">http://www.agile42.com/cms/pages/agilo</a></li>
<li><a title="Download and Install Agilo for Scrum" href="http://www.agile42.com/cms/pages/download-install/" target="_blank">http://www.agile42.com/cms/pages/download-install/</a></li>
<li><a href="http://wiki.webfaction.com/wiki/TracPlugins" target="_blank">http://wiki.webfaction.com/wiki/TracPlugins</a></li>
<li><a href="http://forum.webfaction.com/viewtopic.php?id=91" target="_blank">http://forum.webfaction.com/viewtopic.php?id=91</a></li>
</ul>
<p><br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2009/12/how-to-install-agilo-on-trac-at-webfaction/feed/</wfw:commentRss>
		<slash:comments>86</slash:comments>
		</item>
		<item>
		<title>Fix for JPEG upload problem in Django in virtualenv</title>
		<link>http://blog.mrpau.com/2009/12/fix-for-jpeg-upload-problem-in-django-in-virtualenv/</link>
		<comments>http://blog.mrpau.com/2009/12/fix-for-jpeg-upload-problem-in-django-in-virtualenv/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 18:16:20 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[fixes]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[virtualenv]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=626</guid>
		<description><![CDATA[I have been busy modifying Django&#8216;s models for a project to include a field for uploading an image and was testing the model using Django&#8217;s Admin interface when I suddenly got this error: Upload a valid image. The file you uploaded was either not an image or a corrupted image. Here&#8217;s a screenshot (click on [...]]]></description>
			<content:encoded><![CDATA[<p>I have been busy modifying <a title="Django - The web framework for perfectionists with deadlines." href="http://www.djangoproject.com/" target="_blank">Django</a>&#8216;s models for a project to include a field for uploading an image and was testing the model using Django&#8217;s Admin interface when I suddenly got this error:</p>
<blockquote><p>Upload a valid image. The file you uploaded was either not an image or a corrupted image.</p></blockquote>
<p><span id="more-626"></span><br />
Here&#8217;s a screenshot (click on it for a larger view):</p>
<p><a href="http://blog.mrpau.com/wp-content/uploads/2009/12/django-upload-jpeg-problem.png"><img class="aligncenter size-medium wp-image-637" title="django-upload-jpeg-problem" src="http://blog.mrpau.com/wp-content/uploads/2009/12/django-upload-jpeg-problem-300x180.png" alt="django-upload-jpeg-problem" width="300" height="180" /></a></p>
<p>This has worked before so I was stumped to find out it&#8217;s giving me a red flag now.</p>
<p>Django is using <a title="Python Imaging Library" href="http://www.pythonware.com/products/pil/" target="_blank">Python Imaging Library</a> or PIL for images so understandably the culprit may be on this level.  I tested PIL in Python&#8217;s shell using these commands:</p>
<pre>$ python
&gt;&gt;&gt; from PIL import Image
&gt;&gt;&gt; img = Image.open("/home/cyril/Pictures/Anatomy.jpg")
&gt;&gt;&gt; img.verify()
&gt;&gt;&gt; img.size
(1600,1200)</pre>
<p>Clearly, nothing is wrong with my PIL installation.</p>
<p>I began searching the net and found the following fix: <a title="Fixing – PIL IOError: decoder jpeg not available" href="http://www.answermysearches.com/fixing-pil-ioerror-decoder-jpeg-not-available/320/" target="_blank">Fixing – PIL IOError: decoder jpeg not available.</a> Obviously, the author&#8217;s problems are similar to mine but he wasn&#8217;t using Django, only Python.</p>
<p>Since I have been <a title="Use multiple Django versions for development" href="http://blog.mrpau.com/2009/09/use-multiple-django-versions-for-development/">using virtualenv to sandbox my Django projects</a>, I have a similar but different approach.</p>
<p>Here are the steps I took to fix this problem:</p>
<ol>
<li>I removed PIL by deleting the PIL folder and the PIL.pth file from my project&#8217;s virtualenv path.</li>
<li>I then installed the JPEG library using:
<pre>$ <code>sudo aptitude install libjpeg libjpeg-dev</code></pre>
</li>
<li>I then re-installed PIL on my project using:
<pre>$ pip install -E ../projectname/ -r requirements.txt</pre>
</li>
</ol>
<p>After this, I have successfully uploaded a .jpg file in Django&#8217;s admin interface.</p>
<blockquote><p>This fix is useful if you are using virtualenv to sandbox your Django projects like me.  Here is <a title="Use multiple Django versions for development" href="http://blog.mrpau.com/2009/09/use-multiple-django-versions-for-development/">my post on how to do this</a>.  If you are not using virtualenv, just do the above steps but re-install PIL as you normally do using <a title="Download, build, install, upgrade, and uninstall Python packages -- easily!" href="http://pypi.python.org/pypi/setuptools" target="_blank">easy_install</a> or <a title="pip installs packages. Python packages. An easy_install replacement" href="http://pypi.python.org/pypi/pip" target="_blank">pip</a>.</p></blockquote>
<p>A note of advice when installing PIL.  Read the PIL Setup Summary displayed after the installation.</p>
<p>This PIL Setup Summary says there is No JPEG support (click on it for a larger view):</p>
<p><a href="http://blog.mrpau.com/wp-content/uploads/2009/12/pil-install-without-jpeg-library-1.png"><img class="aligncenter size-medium wp-image-631" title="pil-install-without-jpeg-library-1" src="http://blog.mrpau.com/wp-content/uploads/2009/12/pil-install-without-jpeg-library-1-299x142.png" alt="pil-install-without-jpeg-library-1" width="299" height="142" /></a>While this PIL Setup Summary says there is JPEG support (click on it for a larger view):</p>
<p><a href="http://blog.mrpau.com/wp-content/uploads/2009/12/pil-install-with-jpeg-library-1.png"><img class="aligncenter size-medium wp-image-632" title="pil-install-with-jpeg-library-1" src="http://blog.mrpau.com/wp-content/uploads/2009/12/pil-install-with-jpeg-library-1-300x142.png" alt="pil-install-with-jpeg-library-1" width="300" height="142" /></a></p>
<p>I must have missed that during my virtualenv installation which caused me hours of gasping agony (as if being constricted by a python). <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Thankfully I found the fix.  Kudos to Greg Pinero for posting it.</p>
<p>Happy Coding!</p>
<p>List of related articles on myListBoard.com:</p>
<ul>
<li><a title="myListBoard.com - fixes for jpeg upload problem in django" href="http://mylistboard.com/users/cy/lists/fixes-for-jpeg-upload-problem-in-django/" target="_blank">fixes for jpeg upload problem in django</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2009/12/fix-for-jpeg-upload-problem-in-django-in-virtualenv/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Django in Production</title>
		<link>http://blog.mrpau.com/2009/10/django-in-production/</link>
		<comments>http://blog.mrpau.com/2009/10/django-in-production/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 18:34:40 +0000</pubDate>
		<dc:creator>Cyril Pauya</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://blog.mrpau.com/?p=613</guid>
		<description><![CDATA[Here are some quick tips when moving your Django site into production. Q: How to determine if site is in local or production setup? A: Create a production.py in your production site.  In your settings.py, add the following lines: try: import production PRODUCTION = True except ImportError: PRODUCTION = False Wherever in your code, you [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some quick tips when moving your Django site into production.<br />
<span id="more-613"></span><br />
Q: How to determine if site is in local or production setup?<br />
A: Create a production.py in your production site.   In your settings.py, add the following lines:</p>
<pre>try:
    import production
    PRODUCTION = True
except ImportError:
    PRODUCTION = False</pre>
<p>Wherever in your code, you can do the following:</p>
<pre>from django.conf import settings
...
if settings.PRODUCTION:
    # code for production...
else:
    # code for local...</pre>
<p>Neat eh? <img src='http://blog.mrpau.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mrpau.com/2009/10/django-in-production/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
