<?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>The Lost Notebook</title>
	<atom:link href="http://funinc.org/feed" rel="self" type="application/rss+xml" />
	<link>http://funinc.org</link>
	<description>Things that I tend to forget</description>
	<lastBuildDate>Sat, 31 Mar 2012 18:21:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Kitten Sitter</title>
		<link>http://funinc.org/20120320/kitten-sitter</link>
		<comments>http://funinc.org/20120320/kitten-sitter#comments</comments>
		<pubDate>Tue, 20 Mar 2012 07:02:04 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Cat]]></category>
		<category><![CDATA[babysitter]]></category>
		<category><![CDATA[gigi]]></category>
		<category><![CDATA[kitten]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=348</guid>
		<description><![CDATA[Gigi (giselle) the tortoiseshell cat that adopted us a few months ago delivered her load of 4 beautiful kittens a few days ago. She came inside, called out for my wife Pia. When Pia did not reply, she searched for her and climbed on to her lap. After a couple of minutes, Pia was feeling [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://t.co/zCJ6nsL2" target="_blank">Gigi</a> (<a href="http://en.wikipedia.org/wiki/Giselle_%28Disney%29#Cast" target="_blank">giselle</a>) the <a href="http://en.wikipedia.org/wiki/Tortoiseshell_cat" target="_blank">tortoiseshell cat</a> that adopted us a few months ago delivered her load of 4 beautiful kittens a few days ago. She came inside, called out for my wife Pia. When Pia did not reply, she searched for her and climbed on to her lap. After a couple of minutes, Pia was feeling the cat&#8217;s belly as we were noticing some movements there the last few days, and she noticed something was starting to ooze out of her.<br />
We took her outside, put her on a mat and witnessed as she started to deliver the little ones. We shamelessly videoed the whole event (that I&#8217;m not going to publish). The kittens have different colors (as expected). And Gigi is taking good care of them.<br />
<div class="wp-caption alignnone" style="width: 610px"><img alt="" src="https://p.twimg.com/AoQssn5CAAAKZds.jpg" title="Gigi and kittens" width="600" height="360" /><p class="wp-caption-text">Gigi and kittens</p></div></p>
<p>Now you should know that cat have different temperaments and attitudes. Some are vocal and very talkative (like our <a href="http://pic.twitter.com/o8NslPxx" target="_blank">Garo</a>). Others are shy and reserved. Others are aloof, etc..<br />
Gigi is like nothing I have seen before. She is clearly the strongest of the bunch as all the other cats in the neighborhood (males and females alike) move out of her way and step back when she hisses at them. And her hiss is barely noticeable. She&#8217;s very calm and steady. On the other hand she&#8217;s very warm with people. She will rub on anyone&#8217;s feet. Will not balk away if you try to pet her. And will gladly climb into any welcoming lap. She doesn&#8217;t vocalize much and before she gave birth we rarely heard her voice except for the casual &#8220;beep&#8221; (half a <a href="http://en.wikipedia.org/wiki/Beep,_beep_%28sound%29" target="_blank">&#8220;beep-beep&#8221;</a>) if someone steps on her tail because she&#8217;s always laying behind our feet when we&#8217;re in the kitchen!<br />
Now Gigi is not litter trained. Mainly because she takes care of business (and sleeps) outside. But since the kittens came, we decided to keep them inside (closed porch). Gigi is happy with the arrangement since she doesn&#8217;t have to fend for her litter. Garo comes in for feeding on that same porch a couple of times every day, but he&#8217;s a pushover and she doesn&#8217;t worry about him much. We even closed the small opening he used to enter, so he now stands outside and yells for someone to open for him. So, when Gigi wants to eliminate, she has to go outside. She could simply leave, but we noticed that before leaving she comes looking for us. Every single time, before going outside, she comes looking for either one of us and starts taking loudly. We know we have to do something because she never speaks otherwise, and she&#8217;s never loud! When we follow her to the porch and stand next to the kittens, she rubs her head on our feet once and then steps out. She makes sure that the kittens are asleep before she leaves. And she only stays out for a few minutes each time. She trusts us to handle the kittens: no hissing or any sort of complaint when we do that, but she licks them thouroughly after we put them back. So I&#8217;m guessing that she wants us to kittensit for her while she&#8217;s away! Have you ever seen such a behaviour?</p>
<p>Update: after exactly 7 days, gigi was very vocal again. She was going out more and after a few trips, she came back and started taking her kittens one by one to hide them in the bush across the street. Pia was not too happy with that. </p>
<p>Another update: Xena came back after 2 days of absence. She delivered her litter somewhere in the neighbourhood. She is coming to feed more often now and is back to her playful and hyperactive self. </p>
<p>Yet another update: it&#8217;s been about a week since we noticed Xena&#8217;s delivery. She was very noisy today, even more than usual. And she was exploring the house. At about 6pm, I was taking a nap when I heard a scream. Pia was screaming (joyfully as I learned later) because Xena was carrying one of her kittens in her mouth and she took it straight into our living room. She went though the whole ritual 5 times (telling us she was going, drinking some water our milk, then going to get a kitten). I&#8217;m writing this update now sitting on the floor next to them. She is tired, but purring loudly. And the 5 are taking turns at feeding. bliss&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20120320/kitten-sitter/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy Mail Sender Authentication Using SPF</title>
		<link>http://funinc.org/20120316/easy-mail-sender-authentication-using-spf</link>
		<comments>http://funinc.org/20120316/easy-mail-sender-authentication-using-spf#comments</comments>
		<pubDate>Fri, 16 Mar 2012 08:36:59 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[sender policy]]></category>
		<category><![CDATA[spf]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=344</guid>
		<description><![CDATA[There are different wayt to authenticate emails as being legit. One of the easiest to implement is SPF. Basically what you need to do is add an SPF record to your domain&#8217;s DNS zone. But since most DNS control panels do not have this record, you can simply add it as a TXT record. The [...]]]></description>
			<content:encoded><![CDATA[<p>There are different wayt to authenticate emails as being legit. One of the easiest to implement is <a href="http://en.wikipedia.org/wiki/Sender_Policy_Framework" target="_blank">SPF</a>.</p>
<p>Basically what you need to do is add an SPF record to your domain&#8217;s DNS zone. But since most DNS control panels do not have this record, you can simply add it as a TXT record.<br />
<a href="http://www.openspf.org/" target="_blank">The OpenSPF site</a> provides the <a href="http://www.openspf.org/SPF_Record_Syntax" target="_blank">syntax</a> used to identify the resources on your network or otherwise that are allowed to send email on behalf of your domain. But I always find it easier to use a simple form to generate that record. Below are a few helpful sites that offer such a form/wizard:</p>
<ul>
<li><a href="http://wizard.easyspf.com/" title="EasyDNS - EasySPF" target="_blank">EasyDNS &#8211; EasySPF</a></li>
<li><a href="http://www.mailradar.com/spf/" title="Mail Radar SPF Wizard" target="_blank">Mail Radar SPF Wizard</a></li>
<li><a href="http://www.mtgsy.net/dns/spfwizard.php" title="Cloudfloor DNS" target="_blank">Cloudfloor DNS</a></li>
<li>let me know if you find others you like&#8230;</li>
</ul>
<p>I know <a href="http://support.google.com/a/bin/answer.py?hl=en&#038;answer=33786" target="_blank">GMail checks</a> the SPF records. Yahoo Mail prefer <a href="http://www.dkim.org/" target="_blank">DKIM</a>. For more info about DKIM and setting that up check this <a href="http://www.brandonchecketts.com/archives/getting-dkimproxy-installed-and-configured" title="Getting DKIMProxy Installed and Configured" target="_blank">old post by Brandon Checketts.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20120316/easy-mail-sender-authentication-using-spf/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Match SSL Certificate to Key and CSR</title>
		<link>http://funinc.org/20120315/match-ssl-certificate-to-key-and-csr</link>
		<comments>http://funinc.org/20120315/match-ssl-certificate-to-key-and-csr#comments</comments>
		<pubDate>Thu, 15 Mar 2012 08:46:03 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[oneliner]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=342</guid>
		<description><![CDATA[Renewing an SSL certificate is usually straight forward. But sometimes you&#8217;re not sure which CSR to use. Or if you need to generate a new CSR, which SSL key. Here are the commands I use to verify the certificate related files: openssl x509 -noout -modulus -in mydomain.crt &#124; openssl md5 openssl rsa -noout -modulus -in [...]]]></description>
			<content:encoded><![CDATA[<p>Renewing an SSL certificate is usually straight forward. But sometimes you&#8217;re not sure which CSR to use. Or if you need to generate a new CSR, which SSL key. Here are the commands I use to verify the certificate related files:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">openssl x509 -noout -modulus -<span class="kw1">in</span> mydomain.crt | openssl md5</div>
</li>
<li class="li1">
<div class="de1">openssl rsa -noout -modulus -<span class="kw1">in</span> mydomain.key | openssl md5</div>
</li>
<li class="li1">
<div class="de1">openssl req -noout -modulus -<span class="kw1">in</span> mydomain.csr | openssl md5</div>
</li>
</ol>
</div>
<p>The MD5 hash should match.<br />
You could use a bash script to search a directory for a specific MD5 hash. For example: </p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">for</span> f <span class="kw1">in</span> $<span class="br0">&#40;</span><span class="kw2">ls</span> <span class="re1">$SOMEDIR</span><span class="br0">&#41;</span>; <span class="kw1">do</span> <span class="kw3">echo</span> <span class="re1">$f</span>; openssl x509 -noout -modulus -<span class="kw1">in</span> <span class="re1">$SOMEDIR</span><span class="re1">$f</span> | openssl md5 | <span class="kw2">grep</span> <span class="st0">&quot;MYMD5HASH&quot;</span>; <span class="kw1">done</span></div>
</li>
</ol>
</div>
<p>I guess the above could use some work <img src='http://funinc.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><ins datetime="2012-03-15T08:29:20+00:00">for the CLI-phobics check out <a href="https://www.sslshopper.com/certificate-key-matcher.html" title="Key Matcher" target="_blank">this certificate key matcher</a></ins></p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20120315/match-ssl-certificate-to-key-and-csr/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feral Felines</title>
		<link>http://funinc.org/20120120/feral-felines</link>
		<comments>http://funinc.org/20120120/feral-felines#comments</comments>
		<pubDate>Fri, 20 Jan 2012 14:38:40 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Cat]]></category>
		<category><![CDATA[Mood]]></category>
		<category><![CDATA[Pets]]></category>
		<category><![CDATA[cats]]></category>
		<category><![CDATA[feral]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=336</guid>
		<description><![CDATA[There&#8217;s always been plenty of cats in our neighborhood. And they all stroll up and down the same trail facing my office window almost daily when the sun is up. But recently they decided to come closer and into our lives. We had recently lost our cat &#8220;The Boss&#8221;, and had plenty of cat food [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s always been plenty of cats in our neighborhood. And they all stroll up and down the same trail facing my office window almost daily when the sun is up. But recently they decided to come closer and into our lives. <span id="more-336"></span></p>
<p>We had recently lost our cat &#8220;The Boss&#8221;, and had plenty of cat food left over. So my wife started feeding one of the cats that was bold enough to stop and &#8220;chat&#8221; with us while passing by.<br />
He came back again for more and we took his picture. Comparing that to an older picture we had of &#8220;the boss&#8221; conversing with another cat from behind closed windows we knew that was not the first time this particular cat was at our door (and windows). We had thought it was a female previously. And &#8220;the boss&#8221; was bold enough to chase away other cats that ventured near his balcony, so we never saw that cat again while he was with us.<br />
Soon after, my wife was leaving food for &#8220;Garfield the red&#8221; on the balcony every night, and we always found the bowl empty in the morning. Garo (for short), was also visiting during the day, and screaming for attention (and food) whenever he saw us. But we suspected he wasn&#8217;t the only one eating our food.<br />
One day, we saw the one I always called &#8220;hag&#8221; passing by. But instead of taking the trail down the wall facing the office and to the street, she went straight to the balcony and to the bowl of food! Yeap, Garo had competition.<br />
And it was real competition for our affections, as Giselle was so cuddly and human-friendly you wouldn&#8217;t believe it was a feral cat. She spent her time rubbing against my wife&#8217;s feet. When Pia sat down she would come and sleep in her lap. And she was never too hungry or preoccupied to let us pet her and check her for flees.<br />
It was mating season, so we heard plenty of screams night and day. That was normal. Then one day, Garo came with a huge cut on his forehead, next to his right ear. He allowed me to put some betadine on the wound. We were worried, but he&#8217;s doing fine now except for a bald spot where the wound used to be. We also treated both cats with tick repellant.<br />
Giselle was now spending most of her time on our balcony, leaving only for a few hours every day. On one night, we heard her calling out in her small voice (as opposed to Garo&#8217;s howling cries) to someone we couldn&#8217;t see outside. We came out to see another female of the same size, coming in from the outside. This one we called Xena after a few days because she always annouces her entrance with the same war cry that Xena the warrior pricess used when attacking enemies!<br />
Xena and Giselle were now inseparable. They even defended &#8220;their&#8221; place against all other intruding cats. Even Garo was sent crying when he tried to come in for a bite.<br />
The story continues, with lots of interaction and new cats coming in from the wild daily. Giselle went out one day and did not come back, we&#8217;re not sure where she is. Garo is sleeping on the balcony now. Him and Xena tolerate each other. The stealthy Gerard and his black and white side-kick are venturing nearer now, but Xena still slaps them silly when they try to trespass!<br />
I&#8217;m posting just a few pics, let me know if you like them.<br />
<embed type="application/x-shockwave-flash" src="https://picasaweb.google.com/s/c/bin/slideshow.swf" width="600" height="400" flashvars="host=picasaweb.google.com&#038;hl=en_US&#038;feat=flashalbum&#038;RGB=0x000000&#038;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fabdallah.deeb%2Falbumid%2F5699712736184950737%3Falt%3Drss%26kind%3Dphoto%26hl%3Den_US" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20120120/feral-felines/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Reverse Proxy + SSH Reverse Tunnel</title>
		<link>http://funinc.org/20111229/apache-reverse-proxy-ssh-reverse-tunnel</link>
		<comments>http://funinc.org/20111229/apache-reverse-proxy-ssh-reverse-tunnel#comments</comments>
		<pubDate>Thu, 29 Dec 2011 14:17:34 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[reverse proxy]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tunnel]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=328</guid>
		<description><![CDATA[Disclaimer: This setup is just a bit crazy, and I wouldn&#8217;t recommend it for a production site. Works for me. I needed to allow some clients to test a web app I&#8217;m working on. But I didn&#8217;t want to deploy the code to a server for now for different reasons (mainly memory constraints). So the [...]]]></description>
			<content:encoded><![CDATA[<p><small><em>Disclaimer: This setup is just a bit crazy, and I wouldn&#8217;t recommend it for a production site. Works for me.</em></small><br />
I needed to allow some clients to test a web app I&#8217;m working on. But I didn&#8217;t want to deploy the code to a server for now for different reasons (mainly memory constraints). So the solution was to setup a reverse proxy using apache to my local machine. Check out the code after the break <span id="more-328"></span><br />
Here&#8217;s the <code>VirtualHost</code> I created: </p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;VirtualHost</span> *:<span class="nu0">80</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ServerName proj312.grat.in</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ProxyPass / http://home-ip:18000/</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ProxyPassReverse / http://home-ip:18000/</div>
</li>
<li class="li2">
<div class="de2"><span class="sc3"><span class="re1">&lt;/VirtualHost<span class="re2">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>The problem is that my home-ip is not fixed. A Dynamic DNS setup is the fix that comes to mind first. But, I thought I would try something else: <code>Reverse SSH Tunnel</code><br />
I used the recipe and explanations in <a href="http://toic.org/blog/2009/01/18/reverse-ssh-port-forwarding/" title="reverse-ssh-port-forwarding" target="_blank">this article</a>. Mostly, all I needed to do was the following:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">ssh</span> -fNR <span class="nu0">18000</span>:localhost:<span class="nu0">8000</span> myserver</div>
</li>
</ol>
</div>
<p>Where the 18000 is the port on the server, and 8000 is the port on the home machine. No harm in using the same port numbers, btw.</p>
<p>I then changed the <code>VirtualHost</code> configuration in apache on the server to read: </p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;VirtualHost</span> *:<span class="nu0">80</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ServerName proj312.grat.in</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ProxyPass / http://127.0.0.1:18000/</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; ProxyPassReverse / http://127.0.0.1:18000/</div>
</li>
<li class="li2">
<div class="de2"><span class="sc3"><span class="re1">&lt;/VirtualHost<span class="re2">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>Restart apache on the server and all falls in place perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20111229/apache-reverse-proxy-ssh-reverse-tunnel/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Suspend Ubuntu Desktop</title>
		<link>http://funinc.org/20111227/suspend-ubuntu-desktop</link>
		<comments>http://funinc.org/20111227/suspend-ubuntu-desktop#comments</comments>
		<pubDate>Tue, 27 Dec 2011 12:06:25 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[connectbot]]></category>
		<category><![CDATA[electricity]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[lebanon]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[suspend]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=323</guid>
		<description><![CDATA[Simple command line: pm-suspend An interesting alternative would be: pm-suspend-hybrid From the man page: pm-suspend-hybrid Hybrid-suspend is the process where the system does everything it needs to hibernate, but suspends instead of shutting down. This means that your computer can wake up quicker than for normal hibernation if you do not run out of power, [...]]]></description>
			<content:encoded><![CDATA[<p>Simple command line: <code>pm-suspend</code><br />
An interesting alternative would be: <code>pm-suspend-hybrid</code></p>
<p><span id="more-323"></span></p>
<p>From the man page:</p>
<blockquote><p><strong>pm-suspend-hybrid</strong><br />
           Hybrid-suspend is the process where the system does everything it needs to hibernate, but suspends instead of shutting down. This means that your computer can<br />
           wake up quicker than for normal hibernation if you do not run out of power, and you can resume even if you run out of power. s2both(8) is an hybrid-suspend<br />
           implementation.</p>
</blockquote>
<p>Background story: Electricity problems in Lebanon, and old UPS, causing me plenty of headaches. So I needed a quick way to suspend/hibernate the desktop without loosing all my volatile settings and open files. I added a shortcut for a <a href="http://code.google.com/p/connectbot/">ConnectBot</a> host configuration on my android phone that runs this command on the desktop (remotely): <code>sudo pm-suspend-hybrid</code><br />
This way if the backup generator starts in time or not, everything is back up and running in under <del datetime="2011-12-27T12:14:51+00:00">45s</del>12s (just clocked it!).</p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20111227/suspend-ubuntu-desktop/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick SSH Tunnel using Putty</title>
		<link>http://funinc.org/20111221/quick-ssh-tunnel-using-putty</link>
		<comments>http://funinc.org/20111221/quick-ssh-tunnel-using-putty#comments</comments>
		<pubDate>Wed, 21 Dec 2011 13:27:56 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=314</guid>
		<description><![CDATA[Two easy steps to create a tunnel from a remote server port to your localhost. It&#8217;s handy if you&#8217;re trying to connect to a mysql, jboss, etc. installation bound to localhost only (for better security. Check out the screenshots after the break 1- Add the remote server&#8217;s information (Session) 2- Add the tunnel information (Connection [...]]]></description>
			<content:encoded><![CDATA[<p>Two easy steps to create a tunnel from a remote server port to your localhost. It&#8217;s handy if you&#8217;re trying to connect to a mysql, jboss, etc. installation bound to localhost only (for better security. Check out the screenshots after the break<span id="more-314"></span></p>
<p>1- Add the remote server&#8217;s information (Session)<br />
<a href="http://funinc.org/wp-content/uploads/putty-cfg-1.png"><img src="http://funinc.org/wp-content/uploads/putty-cfg-1-300x288.png" alt="" title="putty-cfg-1" width="300" height="288" class="alignnone size-medium wp-image-315" /></a></p>
<p>2- Add the tunnel information (Connection &#8211; SSH &#8211; Tunnels)<br />
<a href="http://funinc.org/wp-content/uploads/putty-cfg-2.png"><img src="http://funinc.org/wp-content/uploads/putty-cfg-2-300x288.png" alt="" title="putty-cfg-2" width="300" height="288" class="alignnone size-medium wp-image-316" /></a><br />
You need to edit the Source port and Destination then click the &#8220;Add&#8221; button. </p>
<p>This should be enough. Either go back to the &#8220;Session&#8221; screen and save the configuration for later. Or simply click &#8220;Open&#8221; to get started. </p>
<p>Creating an SSH tunnel or forwarding ports is pretty easy when you&#8217;re on a Linux machine. Simply type the following in the shell:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">ssh</span> -fLN <span class="nu0">8080</span>:<span class="nu0">127.0</span><span class="nu0">.0</span><span class="nu0">.1</span>:<span class="nu0">8080</span> myserver.tld</div>
</li>
</ol>
</div>
<p>Where the first 8080 is the local port and the second 8080 is the port on the server.</p>
<p>Practically, let&#8217;s say you have a <a href="http://glassfish.java.net" target="_blank">glassfish</a> installation on your server at 10.0.10.15. You cannot access the admin port 8484 on that server as it&#8217;s by default bound to localhost only. So, you can create a tunnel using the following command and access the glassfish admin site as if it&#8217;s on the local machine at <code>http://127.0.0.1:8484/</code>:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">ssh</span> -fLN <span class="nu0">8484</span>:<span class="nu0">127.0</span><span class="nu0">.0</span><span class="nu0">.1</span>:<span class="nu0">8484</span> <span class="nu0">10.0</span><span class="nu0">.10</span><span class="nu0">.15</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20111221/quick-ssh-tunnel-using-putty/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Class-Based Generic Views</title>
		<link>http://funinc.org/20111220/django-class-based-generic-views</link>
		<comments>http://funinc.org/20111220/django-class-based-generic-views#comments</comments>
		<pubDate>Tue, 20 Dec 2011 14:09:59 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[class-based]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[generic views]]></category>
		<category><![CDATA[jqm]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquerymobile]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=306</guid>
		<description><![CDATA[After working with Paypouy on a quick project using the php-based, shared-hosting-friendly CodeIgniter, I&#8217;m back to the more familiar waters of Python/Django. I was asked to create a small organizer/calendar type app for a client to be used mainly from a smart phone. The app seemed very straight forward, so I thought I&#8217;d rely on [...]]]></description>
			<content:encoded><![CDATA[<p>After working with Paypouy on a quick project using the php-based, <a href="http://moodeef.com" target="_blank">shared-hosting</a>-friendly <a href="http://codeigniter.com" title="CodeIgniter" target="_blank">CodeIgniter</a>, I&#8217;m back to the more familiar waters of Python/Django.</p>
<p>I was asked to create a small organizer/calendar type app for a client to be used mainly from a smart phone. The app seemed very straight forward, so I thought I&#8217;d rely on the <a href="https://docs.djangoproject.com/en/dev/topics/class-based-views/" target="_blank">generic views</a> for most of the work.</p>
<p>Check out some of the code after the break <span id="more-306"></span><br />
Here&#8217;s a bit of code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co1"># urls.py</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">from</span> django.<span class="me1">conf</span>.<span class="me1">urls</span> <span class="kw1">import</span> patterns, include, url</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">from</span> django.<span class="me1">views</span>.<span class="me1">generic</span> <span class="kw1">import</span> ListView, DetailView</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">from</span> app.<span class="me1">views</span> <span class="kw1">import</span> \</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; CalendarView, DeleteCalView, UpdateCalView, CreateCalView</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">urlpatterns = patterns<span class="br0">&#40;</span><span class="st0">&#8221;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/create/$&#8217;</span>, CreateCalView.<span class="me1">as_view</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, name=<span class="st0">&quot;cal_create&quot;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/(?P&lt;slug&gt;[0-9]+)/$&#8217;</span>, DetailView.<span class="me1">as_view</span><span class="br0">&#40;</span>model=Presentation, slug_field=<span class="st0">&#8216;number&#8217;</span><span class="br0">&#41;</span>, name=<span class="st0">&#8216;presentation&#8217;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/$&#8217;</span>, ListView.<span class="me1">as_view</span><span class="br0">&#40;</span>model=Presentation, context_object_name=<span class="st0">&#8216;presentation&#8217;</span><span class="br0">&#41;</span>, name=<span class="st0">&#8216;presentation_list&#8217;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/upcoming/$&#8217;</span>, CalendarView.<span class="me1">as_view</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="br0">&#123;</span><span class="st0">&#8216;as&#8217;</span>: <span class="st0">&#8216;upcoming&#8217;</span><span class="br0">&#125;</span>, name=<span class="st0">&#8216;upcoming&#8217;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/presented/$&#8217;</span>, CalendarView.<span class="me1">as_view</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="br0">&#123;</span><span class="st0">&#8216;as&#8217;</span>: <span class="st0">&#8216;presented&#8217;</span><span class="br0">&#125;</span>, name=<span class="st0">&#8216;presented&#8217;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/unconfirmed/$&#8217;</span>, CalendarView.<span class="me1">as_view</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="br0">&#123;</span><span class="st0">&#8216;as&#8217;</span>: <span class="st0">&#8216;unconfirmed&#8217;</span><span class="br0">&#125;</span>, name=<span class="st0">&#8216;unconfirmed&#8217;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/confirm/(?P&lt;pk&gt;[0-9]+)/$&#8217;</span>, UpdateCalView.<span class="me1">as_view</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="br0">&#123;</span><span class="st0">&#8216;as&#8217;</span>: <span class="st0">&#8216;confirm&#8217;</span><span class="br0">&#125;</span>, name=<span class="st0">&quot;cal_confirm&quot;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/delete/(?P&lt;pk&gt;[0-9]+)/$&#8217;</span>, DeleteCalView.<span class="me1">as_view</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, name=<span class="st0">&quot;cal_del&quot;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<p>and some code from the Views:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="co1"># views.py</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> CalendarView<span class="br0">&#40;</span>ListView<span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; template_name = <span class="st0">&quot;calendar/calendar.html&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="kw1">def</span> get_queryset<span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; called_as = <span class="kw2">self</span>.<span class="me1">kwargs</span><span class="br0">&#91;</span><span class="st0">&#8216;as&#8217;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as <span class="kw1">in</span> <span class="br0">&#91;</span><span class="st0">&quot;home&quot;</span>, <span class="st0">&quot;upcoming&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> Calendar.<span class="me1">objects</span>.<span class="me1">order_by</span><span class="br0">&#40;</span><span class="st0">&#8216;scheduled_on&#8217;</span><span class="br0">&#41;</span>.<span class="kw2">filter</span><span class="br0">&#40;</span>scheduled_on__gt=<span class="kw3">datetime</span>.<span class="me1">now</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as==<span class="st0">&quot;presented&quot;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> Calendar.<span class="me1">objects</span>.<span class="me1">order_by</span><span class="br0">&#40;</span><span class="st0">&#8216;scheduled_on&#8217;</span><span class="br0">&#41;</span>.<span class="kw2">filter</span><span class="br0">&#40;</span>scheduled_on__lt=<span class="kw3">datetime</span>.<span class="me1">now</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, status=<span class="st0">&quot;P&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as==<span class="st0">&quot;unconfirmed&quot;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> Calendar.<span class="me1">objects</span>.<span class="me1">order_by</span><span class="br0">&#40;</span><span class="st0">&#8216;scheduled_on&#8217;</span><span class="br0">&#41;</span>.<span class="kw2">filter</span><span class="br0">&#40;</span>scheduled_on__gt=<span class="kw3">datetime</span>.<span class="me1">now</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, status=<span class="st0">&quot;R&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> get_context_data<span class="br0">&#40;</span><span class="kw2">self</span>, **kwargs<span class="br0">&#41;</span>:</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; called_as = <span class="kw2">self</span>.<span class="me1">kwargs</span><span class="br0">&#91;</span><span class="st0">&#8216;as&#8217;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; context = <span class="kw2">super</span><span class="br0">&#40;</span>CalendarView, <span class="kw2">self</span><span class="br0">&#41;</span>.<span class="me1">get_context_data</span><span class="br0">&#40;</span>**kwargs<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as <span class="kw1">in</span> <span class="br0">&#91;</span><span class="st0">&quot;home&quot;</span>, <span class="st0">&quot;upcoming&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context<span class="br0">&#91;</span><span class="st0">&#8216;title&#8217;</span><span class="br0">&#93;</span> = <span class="st0">&quot;Upcoming Presentations&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as==<span class="st0">&quot;presented&quot;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context<span class="br0">&#91;</span><span class="st0">&#8216;title&#8217;</span><span class="br0">&#93;</span> = <span class="st0">&quot;Done&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as==<span class="st0">&quot;unconfirmed&quot;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context<span class="br0">&#91;</span><span class="st0">&#8216;title&#8217;</span><span class="br0">&#93;</span> = <span class="st0">&quot;Unconfirmed Presentations&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context<span class="br0">&#91;</span><span class="st0">&#8216;actions&#8217;</span><span class="br0">&#93;</span> = <span class="br0">&#91;</span><span class="st0">&#8216;confirm&#8217;</span>, <span class="st0">&#8216;delete&#8217;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> context</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> DeleteCalView<span class="br0">&#40;</span>DeleteView<span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; model = Calendar</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; template_name = <span class="st0">&quot;calendar/delete.html&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; success_url = <span class="st0">&quot;/&quot;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> UpdateCalView<span class="br0">&#40;</span>UpdateView<span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; model = Calendar</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; template_name = <span class="st0">&quot;calendar/update.html&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; success_url = <span class="st0">&quot;/&quot;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> get_context_data<span class="br0">&#40;</span><span class="kw2">self</span>, **kwargs<span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; called_as = <span class="kw2">self</span>.<span class="me1">kwargs</span><span class="br0">&#91;</span><span class="st0">&#8216;as&#8217;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; context = <span class="kw2">super</span><span class="br0">&#40;</span>UpdateCalView, <span class="kw2">self</span><span class="br0">&#41;</span>.<span class="me1">get_context_data</span><span class="br0">&#40;</span>**kwargs<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>called_as==<span class="st0">&quot;confirm&quot;</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context<span class="br0">&#91;</span><span class="st0">&#8216;confirm_form&#8217;</span><span class="br0">&#93;</span> = <span class="kw2">True</span> &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> context</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> CreateCalView<span class="br0">&#40;</span>CreateView<span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; model = Calendar</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; template_name = <span class="st0">&quot;calendar/update.html&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; success_url = <span class="st0">&quot;/&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">def</span> get_initial<span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; initial = <span class="kw2">super</span><span class="br0">&#40;</span>CreateView, <span class="kw2">self</span><span class="br0">&#41;</span>.<span class="me1">get_initial</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; initial = initial.<span class="kw3">copy</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; initial<span class="br0">&#91;</span><span class="st0">&#8216;status&#8217;</span><span class="br0">&#93;</span> = <span class="st0">&#8216;R&#8217;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> initial</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>I should mention that most of the code in the views.py could simply be removed and the equivalent added in the urls.py file. For example:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">class</span> DeleteCalView<span class="br0">&#40;</span>DeleteView<span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; model = Calendar</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; template_name = <span class="st0">&quot;calendar/delete.html&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; success_url = <span class="st0">&quot;/&quot;</span> </div>
</li>
</ol>
</div>
<p>could be replaced by editing the line in urls.py: </p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">url<span class="br0">&#40;</span>r<span class="st0">&#8216;^calendar/delete/(?P&lt;pk&gt;[0-9]+)/$&#8217;</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; DeleteView.<span class="me1">as_view</span><span class="br0">&#40;</span>model=Calendar, template_name=<span class="st0">&quot;calendar/delete.html&quot;</span>, success_url=<span class="st0">&quot;/&quot;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; name=<span class="st0">&quot;cal_del&quot;</span><span class="br0">&#41;</span>,</div>
</li>
</ol>
</div>
<p>Note also that you can simply use the default <strong>template_name</strong> instead of adding your own (less code!).</p>
<p>Since the app would mostly be used from smart phones, I used <a href="http://jquerymobile.com" title="jQueryMobile" target="_blank">jQueryMobile</a> for most of the template work (and its <a href="http://dev.jtsage.com/jQM-DateBox/" title="JQM DateBox" target="_blank">DateBox plugin</a>. Here&#8217;s a bit of code from that:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&lt;!&#8211; base.html&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;head&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;link rel=&quot;stylesheet&quot; href=&quot;/s/css/jquery.mobile-1.0.min.css&quot; /&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;link rel=&quot;stylesheet&quot; href=&quot;/s/css/jquery.mobile.datebox.min.css&quot; /&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &lt;script src=&quot;/s/js/jquery-1.7.1.min.js&quot; &gt;&lt;/script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;script src=&quot;/s/js/jquery.mobile-1.0.min.js&quot; &gt;&lt;/script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;script src=&quot;/s/js/jquery.mobile.datebox.min.js&quot; &gt;&lt;/script&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &lt;/head&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &lt;body&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div data-role=&quot;page&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div data-role=&quot;header&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% block header %}{% endblock %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div data-role=&quot;navbar&quot;&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;{% url home %}&quot; data-icon=&quot;home&quot;&gt;Calendar&lt;/a&gt;&lt;/li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;{% url cal_create %}&quot; data-icon=&quot;plus&quot; data-rel=&quot;dialog&quot;&gt;Add&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div data-role=&quot;content&quot;&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% block content %}{% endblock %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &lt;/body&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>and the listing:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">{% extends &quot;base.html&quot; %}
</div>
</li>
<li class="li1">
<div class="de1">{% block header %}&lt;h2&gt;{{ title|default:&quot;Presentations&quot; }}&lt;/h2&gt;{% endblock %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">{% block content %}
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &lt;div data-role=&quot;controlgroup&quot; data-type=&quot;horizontal&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;a href=&quot;{% url presented %}&quot; data-role=&quot;button&quot;&gt;Presented&lt;/a&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;a href=&quot;{% url upcoming %}&quot; data-role=&quot;button&quot;&gt;Upcoming&lt;/a&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &lt;a href=&quot;{% url unconfirmed %}&quot; data-role=&quot;button&quot;&gt;Unconfirmed&lt;/a&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &lt;/div&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-filter=&quot;true&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; {% regroup object_list by presented_on|date:&quot;F&quot; as objects_by_month %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; {% for o in objects_by_month %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li data-role=&quot;list-divider&quot;&gt;{{ o.grouper }}&lt;/li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% for c in o.list %}
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;a href=&quot;{% url cal_confirm c.pk %}&quot; data-rel=&quot;dialog&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;{{ c.scheduled_on }}&lt;/p&gt;&lt;h3&gt;{{ c.title }}&lt;/h3&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;{{ c.speaker }}&lt;/p&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/a&gt;
</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% endfor %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; {% endfor %}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &lt;/ul&gt;
</div>
</li>
<li class="li1">
<div class="de1">{% endblock %}</div>
</li>
</ol>
</div>
<p>It&#8217;s good to be back. And the project was fun and apparently very useful. In the spirit of agile development, the first iteration took about 3 hours to complete. I am still waiting for feedback to get started on the next one (should be related to hooking Google Calendar to the app).</p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20111220/django-class-based-generic-views/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safely Rebooting RimuHosting VPS (via API)</title>
		<link>http://funinc.org/20111026/safely-rebooting-rimuhosting-vps-via-api</link>
		<comments>http://funinc.org/20111026/safely-rebooting-rimuhosting-vps-via-api#comments</comments>
		<pubDate>Wed, 26 Oct 2011 10:18:07 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=300</guid>
		<description><![CDATA[First, get the API keys from the control panel at https://rimuhosting.com/cp/apikeys.jsp The documentation for the API can be found here So to reboot, I use the following script: #!/bin/bash APIKEY=00000000000000000000000000 VPSOID=0000000 VPSNAME=whatever curl -H &#34;Content-Type: application/json&#34; -H &#34;Accept: application/json&#34; -H &#34;Authorization: rimuhosting apikey=$APIKEY&#34; -X PUT -d &#8216;{&#34;reboot_request&#34;: {&#34;running_state&#34;: &#34;RESTARTING&#34;}}&#8217; https://rimuhosting.com/r/orders/order-$VPSOID-$VPSNAME/vps/running-state That seems to be much [...]]]></description>
			<content:encoded><![CDATA[<p>First, get the API keys from the control panel at https://rimuhosting.com/cp/apikeys.jsp<br />
<a href="https://rimuhosting.com/cp/apikeys.jsp"><img src="http://funinc.org/wp-content/uploads/rimu-api-keys-234x300.png" alt="API Keys page" title="API Keys page" width="234" height="300" class="alignnone size-medium wp-image-301" /></a></p>
<p>The documentation for the API can be found <a href="http://apidocs.rimuhosting.com" title="RimuHosting API docs" target="_blank">here</a></p>
<p>So to reboot, I use the following script:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re3">#!/bin/bash </span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">APIKEY=</span><span class="nu0">00000000000000000000000000</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">VPSOID=</span><span class="nu0">0000000</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re2">VPSNAME=</span>whatever</div>
</li>
<li class="li2">
<div class="de2">curl -H <span class="st0">&quot;Content-Type: application/json&quot;</span> -H <span class="st0">&quot;Accept: application/json&quot;</span> -H <span class="st0">&quot;Authorization: rimuhosting apikey=$APIKEY&quot;</span> -X PUT -d <span class="st0">&#8216;{&quot;reboot_request&quot;: {&quot;running_state&quot;: &quot;RESTARTING&quot;}}&#8217;</span> https://rimuhosting.com/r/orders/order-<span class="re1">$VPSOID</span>-<span class="re1">$VPSNAME</span>/vps/running-state</div>
</li>
</ol>
</div>
<p>That seems to be much safer than running: <code>sudo reboot</code> </p>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20111026/safely-rebooting-rimuhosting-vps-via-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using ePubLib for Android</title>
		<link>http://funinc.org/20111012/using-epublib-for-android</link>
		<comments>http://funinc.org/20111012/using-epublib-for-android#comments</comments>
		<pubDate>Wed, 12 Oct 2011 09:01:15 +0000</pubDate>
		<dc:creator>abdallah</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[epub]]></category>
		<category><![CDATA[epublib]]></category>
		<category><![CDATA[esd]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[scriptures]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://funinc.org/?p=299</guid>
		<description><![CDATA[I&#8217;m rewriting the Examine the Scriptures Daily android app. With the ESD files published as ePub files it&#8217;s easier to get the data now, and it will allow more languages to be supported without the hassle of converting from WTLib. Here&#8217;s the code snippet I&#8217;m using to read the ePub book. The library I&#8217;m using [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m rewriting the <a href="http://funinc.org/20110707/daily-scriptures-android.moo/" title="Daily Scriptures Android App">Examine the Scriptures Daily</a> android app. With the ESD files published as <a href="http://www.jw.org/index.html?option=QrYQCsVrGlBBX" title="JW.ORG :: Digital Publications">ePub</a> files it&#8217;s easier to get the data now, and it will allow more languages to be supported without the hassle of converting from WTLib.</p>
<p>Here&#8217;s the code snippet I&#8217;m using to read the ePub book. The library I&#8217;m using is <a href="http://www.siegmann.nl/epublib/android" title="ePubLib for Android">ePubLib</a>, and I&#8217;m displaying the page in a standard WebView:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> &nbsp; &nbsp;<span class="co1">// Load the book and get a specific date</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; AssetManager assetManager = getAssets<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">try</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// find InputStream for book</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AInputStream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">InputStream</span></a> epubInputStream = assetManager.<span class="me1">open</span><span class="br0">&#40;</span><span class="st0">&quot;es12_E.epub&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load Book from inputStream</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">book</span> = <span class="br0">&#40;</span><span class="kw2">new</span> EpubReader<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">readEpub</span><span class="br0">&#40;</span>epubInputStream<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; getSpecificdate<span class="br0">&#40;</span><span class="st0">&quot;2012-12-1&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw2">catch</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AIOException+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">IOException</span></a> e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; Log.<span class="me1">e</span><span class="br0">&#40;</span><span class="st0">&quot;epublib&quot;</span>, e.<span class="me1">getMessage</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw4">void</span> getSpecificdate<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> day<span class="br0">&#41;</span> <span class="br0">&#123;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ADate+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Date</span></a> d; </div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> dayOfMonth;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> monthOfYear;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ACalendar+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Calendar</span></a> cal = <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ACalendar+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Calendar</span></a>.<span class="me1">getInstance</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">try</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d = dateFormat.<span class="me1">parse</span><span class="br0">&#40;</span>day<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cal.<span class="me1">setTime</span><span class="br0">&#40;</span>d<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> hrefDate = hrefFormat.<span class="me1">format</span><span class="br0">&#40;</span>d<span class="br0">&#41;</span>.<span class="me1">toUpperCase</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dayOfMonth=cal.<span class="me1">get</span><span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ACalendar+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Calendar</span></a>.<span class="me1">DAY_OF_MONTH</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; monthOfYear=cal.<span class="me1">get</span><span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ACalendar+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Calendar</span></a>.<span class="me1">MONTH</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hrefDate += <span class="br0">&#40;</span>dayOfMonth==<span class="nu0">1</span><span class="br0">&#41;</span> ? <span class="st0">&quot;.xhtml&quot;</span> : <span class="st0">&quot;-split&quot;</span>+dayOfMonth+<span class="st0">&quot;.xhtml&quot;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hrefDate = dblzero.<span class="me1">format</span><span class="br0">&#40;</span>monthOfYear<span class="nu0">+4</span><span class="br0">&#41;</span>+hrefDate.<span class="me1">substring</span><span class="br0">&#40;</span><span class="nu0">2</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Here&#8217;s the part you&#8217;re looking for</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Resource r = <span class="kw2">this</span>.<span class="me1">book</span>.<span class="me1">getResources</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getByHref</span><span class="br0">&#40;</span>hrefDate<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WebView wv = <span class="br0">&#40;</span>WebView<span class="br0">&#41;</span> findViewById<span class="br0">&#40;</span>R.<span class="me1">id</span>.<span class="me1">webView1</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> data = <span class="kw2">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#40;</span> r.<span class="me1">getData</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wv.<span class="me1">loadDataWithBaseURL</span><span class="br0">&#40;</span><span class="st0">&quot;file:///android_asset/&quot;</span>, data, <span class="st0">&quot;text/html&quot;</span>, <span class="st0">&quot;utf-8&quot;</span>, <span class="kw2">null</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw2">catch</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AParseException+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">ParseException</span></a> e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.<span class="me1">printStackTrace</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://funinc.org/20111012/using-epublib-for-android/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

