<?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>alex chiang: web 6.0 &#187; geek</title>
	<atom:link href="http://www.chizang.net/alex/blog/category/geek/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chizang.net/alex/blog</link>
	<description>infinite spew</description>
	<lastBuildDate>Wed, 08 Feb 2012 04:06:08 +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>improved support for vodafone usb modems in ubuntu precise</title>
		<link>http://www.chizang.net/alex/blog/2012/02/07/improved-support-for-vodafone-usb-modems-in-ubuntu-precise/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=improved-support-for-vodafone-usb-modems-in-ubuntu-precise</link>
		<comments>http://www.chizang.net/alex/blog/2012/02/07/improved-support-for-vodafone-usb-modems-in-ubuntu-precise/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 04:06:08 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=3156</guid>
		<description><![CDATA[san francisco santacon, 2011 I&#8217;m happy to announce that a few packages I&#8217;ve been working on over the past year have finally landed in Ubuntu Precise[1]. If you have a 3G USB modem, and it currently doesn&#8217;t work well (or at all) in Debian or Ubuntu, you should check this list of modems[2]. If it [...]]]></description>
			<content:encoded><![CDATA[<p><center><img src="https://lh6.googleusercontent.com/-uEFGBZ3SBdQ/TzHumyBxWnI/AAAAAAAADO8/abt-c7LnbqE/s640/IMG_20111210_125620.jpg"><br /><i>san francisco santacon, 2011</i></center></p>
<p>I&#8217;m happy to announce that a few packages I&#8217;ve been working on over the past year have finally landed in Ubuntu Precise[1].</p>
<p>If you have a 3G USB modem, and it currently doesn&#8217;t work well (or at all) in Debian or Ubuntu, you should <a href="https://github.com/andrewbird/wader/blob/master/SUPPORTED_DEVICES">check this list</a> of modems[2]. If it listed, then you may be a candidate to try an alternative 3G networking stack.</p>
<pre>
$ sudo apt-get install wader-core
</pre>
<p>This command will remove ModemManager and install wader-core. It should be an entirely transparent operation to you, except that after you reboot, your modem should appear as a connection option in the network manager applet.</p>
<p>Yay!</p>
<p>###<br />
1: naturally, I was a good boy and uploaded the packages to Debian unstable first<br />
2: this list is predominantly composed of Vodafone-branded modems, but there are others in there as well.</p>
<p>Thanks to the Debian python team for mentoring me and to <a href="http://qa.debian.org/developer.php?login=ahs3%40debian.org">Al Stone</a> and <a href="http://dannf.org/">dann frazier</a> for even more mentoring in addition to sponsoring me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2012/02/07/improved-support-for-vodafone-usb-modems-in-ubuntu-precise/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>google plus photos, flickr, wordpress</title>
		<link>http://www.chizang.net/alex/blog/2012/01/03/google-plus-photos-flickr-wordpress/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-plus-photos-flickr-wordpress</link>
		<comments>http://www.chizang.net/alex/blog/2012/01/03/google-plus-photos-flickr-wordpress/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 22:30:07 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[dreck]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[photo]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=3106</guid>
		<description><![CDATA[I&#8217;m giving up on social networks. Between G+, Flickr, Twitter, Path, LinkedIn, and whatever else, it&#8217;s just too damn hard to manage them all. It feels like work, which is exactly opposite the point of being connected to my friends. Whither Facebook? No, sorry. They don&#8217;t give you control over your own stuff. When computer [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px;"><img alt="" src="https://lh3.googleusercontent.com/-vJyLoviKnzA/TwNhMSNeQJI/AAAAAAAACyY/RSlgRftaqVE/s512/IMG_1164.jpg" title="wtf?" width="341" height="512" /></div>
<p>I&#8217;m giving up on social networks. Between G+, Flickr, Twitter, Path, LinkedIn, and whatever else, it&#8217;s just too damn hard to manage them all. It feels like work, which is exactly opposite the point of being connected to my friends.</p>
<p>Whither Facebook? No, sorry. <b>They don&#8217;t give you control over your own stuff.</b> When computer nerds talk about &#8220;bla bla bla privacy&#8221;, just replace it all with the following question &#8212; <i>do you have control over your stuff?</i> Facebook doesn&#8217;t give it to you, at least not as of today, in the amount that you deserve. So no matter how much other shiny stuff Facebook might tempt you with, it&#8217;s not worth it because you&#8217;re lending them your things without the promise you can get them back. If they change in the future, great &#8212; I&#8217;ll happily change my mind. But until then, they can go fuck off.</p>
<p>So, what to do about photos? Because every superfluous service ditched is a step closer to sanity. After wasting two hours of my life, I&#8217;ve discovered it is possible to use Google Plus Photos to mostly replace Flickr for my primary use case, which is hosting images for my WordPress blog.</p>
<p>Why Google Plus?</p>
<ul>
<li>Lots of storage space. And it&#8217;s free too, which is a bonus. (I pay for Flickr Pro currently; it&#8217;s been worth it, but I&#8217;m just getting fatigued. Sorry, Flickr!)
<li>You get to choose who sees your photos.
<li>You can download all your photos in a batch. You can let others do so too. This is great if you want to take your ball and go home if Google makes you mad, and it also allows Auntie Susana to grab all your photos to make a calendar or mug or whatever with.
<li>You can embed the photos in your blog.
<li>It&#8217;s super duper easy to upload photos from your phone. In fact, you can turn on automatic uploads from your phone.
<li>You can specify a Creative Commons license for your photos. This is important to people like me who care about the open flow of information and data.
<li>You can get stats via Google Analytics.
</ul>
<p>So what&#8217;s the catch?</p>
<p>The catch is that you can&#8217;t actually do those things from the Google Plus interface today. You need to actually go into Picasa Web to manage your photos and.</p>
<p>With Picasa Web, you can:</p>
<ul>
<li>arrange the photos in an album in the order you want
<li>set a cover photo for the album
<li>grab the link to an individual photo to embed elsewhere, like a blog
<li>set up analytics tracking
</ul>
<p>Don&#8217;t even bother trying to figure out how to do those things in Google Plus Photos. You can&#8217;t, at least not today. Luckily, Picasa Web does see all the photos you&#8217;ve uploaded into Google Plus; you can manage them in Picasa, then flip back over to G+ to share with your circles if you want.</p>
<p>Feature for feature, Flickr Pro is moderately better. But in the bigger picture of &#8220;too damn many social networks&#8221;, something&#8217;s gotta give. Again, I&#8217;m sorry Flickr. I loved you for a while, and will always remember you fondly. But it&#8217;s time to consolidate and simplify.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2012/01/03/google-plus-photos-flickr-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flashing cyanogen onto htc evo 4g</title>
		<link>http://www.chizang.net/alex/blog/2011/12/03/flashing-cyanogen-onto-htc-evo-4g/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flashing-cyanogen-onto-htc-evo-4g</link>
		<comments>http://www.chizang.net/alex/blog/2011/12/03/flashing-cyanogen-onto-htc-evo-4g/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 03:27:24 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=3079</guid>
		<description><![CDATA[I&#8217;ve resisted hacking my phone for a long time because, well, I want it to be a phone and not yet another computer for me to manage. But the latest nonsense with the piece of shitCarrier IQ virus is unbearable and pushed me over the edge. For my normal friends who don&#8217;t keep up with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve resisted hacking my phone for a long time because, well, I want it to be a phone and not yet another computer for me to manage. But the latest nonsense with the piece of shit<a href="http://www.engadget.com/2011/12/01/carrier-iq-what-it-is-what-it-isnt-and-what-you-need-to/">Carrier IQ virus</a> is unbearable and pushed me over the edge.</p>
<p>For my normal friends who don&#8217;t keep up with understandably nerdy topics such as this, the summary is that:</p>
<ul>
<li>many smartphones include a nasty piece of code called Carrier IQ that can track all your SMS, your calls, your every keystroke, and upload that to your wireless provider
<li>Carrier IQ is on both Android and Apple phones, although reportedly it has been removed from recent iOS builds
<li>Carrier IQ is confirmed to be on Sprint and AT&#038;T Android phones
</ul>
<p><b>It is completely unclear what data is being recorded and sent back to Big Brother.</b> You just have to trust Sprint when they claim they are being responsible stewards of your data.</p>
<p>Excuse me while I shit dysenteric diarrhea (and sprinkle in extra amoebas for dramatic effect) into a gallon-size freezer-safe Ziploc bag and mail it to my good friends in Overland Park, KS.</p>
<p>I mean, the unremovable, botched abortion apps they force onto you, such as the NASCAR wart, the crashy Sprint TV dung pile, the oozing pus of a football app, were bad enough, but at least you could mostly ignore them (except when you got mysterious random notifications that the Sprint TV app crashed again without you ever touching it).</p>
<p>And to lump another piece of garbage like Carrier IQ in there&#8230; I would pretend to be shocked that a cellular carrier would show such a level of disrespect for its customers, but why bother.</p>
<p>Anyhow, enough of the ranting. Here&#8217;s how to completely re-install your phone with something called CyanogenMod which is Android without the crap. Let&#8217;s not delude ourselves &#8212; using a cell phone means you&#8217;re sending data to Big Brother, but at least with CyanogenMod, you can get a bit of a choice in what you send.</p>
<p><font color="red">Update</font>: Slate asks <a href="http://www.slate.com/articles/technology/technology/2011/12/carrier_iq_it_s_totally_rational_to_worry_that_our_phones_are_tracking_everything_we_do_.html">if you should even care</a> and Manjoo comes to the same conclusion: it&#8217;s the lack of transparency that rankles.</p>
<p><font color="red">Update 2:</font>: Dan Rosenberg <a href="http://vulnfactory.org/blog/2011/12/05/carrieriq-the-real-story/">does more research</a> on what CIQ can and cannot do. Great analysis, but as he notes, it only applies to one handset (Samsung Epic 4G Touch) on one carrier (unnamed). Carriers can apparently make CIQ do different things, so who knows what was happening on my HTC Evo 4G on Sprint? We simply don&#8217;t know. To reiterate: it&#8217;s the lack of transparency that alarms me.</p>
<p>Anyhow&#8230; These instructions assume Linux.</p>
<ol>
<li>Download and run <a href="http://revolutionary.io/">revolutionary</a>. Be sure to run it with sudo, else your phone will reboot into fastboot (as expected) but your computer will just sit there waiting for something (unexpectedly). When revolutionary (on the PC side) prompts you whether you want to install ClockWorkMod, say yes.
<li>revolutionary will automatically complete on the PC side, and your phone will be sitting there with a white screen and some menu options. On your PC, download <a href="http://downloads.androidsu.com/superuser/Superuser-3.0.7-efgh-signed.zip">the Superuser app</a>. Do not unzip it; just leave it there for now.
<li>On your phone use the volume key to navigate to the &#8220;bootloader&#8221; menu item, then select &#8220;recovery&#8221;. Your phone will reboot into the ClockWorkMod screen, which has a dark background.
<li>In the ClockWorkMod menu, select the &#8220;mounts &#038; storage&#8221; menu item, then &#8220;mount USB&#8221;. This will make your phone appear as a drive on your PC
<li>Copy the Superuser zip file from above onto your phone. You can just drop it into the root directory, you don&#8217;t need to put it into a folder.
<li>Unmount the phone from the PC
<li>On the phone, go back to the top level menu, and then select &#8220;install zip from sdcard&#8221;. With some intelligent guessing, you should eventually be able to select the Superuser zip file on the phone; select it and install it.
<li>After this is complete, you can reboot your phone.
</ol>
<p>You have now gained root on your phone, which gives you special magical powers. It is time to use your new magical powers to install CyanogenMod. But first, back your phone up. Some recommended apps are:</p>
<ul>
<li>Titanium Backup
<li>SMS Backup &#038; Restore
<li>Call Backup &#038; Restore
</ul>
<p>I also had my phone set to sync all my contacts with my Google account.</p>
<p>Once you&#8217;re reasonably confident you have your data backed up, you&#8217;re ready to install CyanogenMod. This will obviously wipe out your entire phone and void your warranty, but hey you don&#8217;t have to be annoyed at the infuriatingly uninstallable NASCAR app on your phone anymore.</p>
<ol>
<li>Install CyanogenMod on your phone. You can find it in the Market.
<li>Download <a href="http://wiki.cyanogenmod.com/wiki/Latest_Version#HTC_Evo_4G">latest image</a> onto your PC
<li>Copy the zip file onto your sdcard again, by mounting your phone in your PC
<li>Launch the CyanogenMod app, and find the zip file.
<li>After some intelligent menu guessing, your phone should reboot and install CyanogenMod.
<li>Important: be sure to select &#8220;wipe data/factory reset&#8221; and &#8220;wipe cache&#8221; in the install, else your phone will hang on reboot
</ol>
<p>You&#8217;re done. Hopefully you can restore your data from backups.</p>
<p>After playing with it for an afternoon, Cyanogen is actually a lot nicer than the HTC Sense interface.</p>
<p>And, you get USB internet tethering for free. Woo!</p>
<p>If you run into errors, ask for help in either #revolutionary or #cyanogenmod on freenode. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/12/03/flashing-cyanogen-onto-htc-evo-4g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>this is the mission i signed up for</title>
		<link>http://www.chizang.net/alex/blog/2011/10/23/this-is-the-mission-i-signed-up-for/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=this-is-the-mission-i-signed-up-for</link>
		<comments>http://www.chizang.net/alex/blog/2011/10/23/this-is-the-mission-i-signed-up-for/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 05:13:19 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=3062</guid>
		<description><![CDATA[Last January through April, I pretty much fell off the face of the earth, in real life as well as online. For those that asked, I alluded to some long hours at work, but of course couldn&#8217;t say much publicly. Well, we finally launched, and I&#8217;m quite proud of all our team accomplished. Without question, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.chizang.net/alex/blog/wp-content/uploads/2011/10/canonical-home-voda-640.png" alt="" title="canonical-home-voda-640" width="640" height="400" class="alignnone size-full wp-image-3063" /></p>
<p>Last January through April, I pretty much fell off the face of the earth, in real life as well as online. For those that asked, I alluded to some long hours at work, but of course couldn&#8217;t say much publicly.</p>
<p>Well, we finally launched, and I&#8217;m quite proud of all our team accomplished.</p>
<p><img src="http://www.chizang.net/alex/blog/wp-content/uploads/2011/10/voda-engadget-640.png" alt="" title="voda-engadget-640" width="640" height="400" class="alignnone size-full wp-image-3064" /></p>
<p>Without question, this was the hardest project I&#8217;ve taken on in my career to date. But I was part of a great team, and we pulled together to ship.</p>
<p>We&#8217;re bringing free, open software to the world. This is the mission I signed up for.</p>
<p><img src="http://www.chizang.net/alex/blog/wp-content/uploads/2011/10/voda-hn-640.png" alt="" title="voda-hn-640" width="640" height="400" class="alignnone size-full wp-image-3066" /></p>
<p>Some links for your reading pleasure, take with a grain of salt:</p>
<ul>
<li><a href="http://www.vodacom.com/news_article.php?articleID=1068&#038;pid=press_group">Vodacom press release</a>
<li><a href="http://www.omgubuntu.co.uk/2011/10/the-ubuntu-powered-vodafone-webbook-launches-tomorrow">OMG! Ubuntu mentions it</a>
<li><a href="http://www.engadget.com/2011/10/19/vodafone-brings-arm-and-ubuntu-together-for-south-african-webboo/">TechCrunch adds commentary</a>
<li><a href="http://www.engadget.com/2011/10/19/vodafone-brings-arm-and-ubuntu-together-for-south-african-webboo/">Engadget rehash</a>
<li><a href="http://www.tomshardware.com/news/webbook-vodafone-netbook-ubuntu-ARM,13763.html">Tom&#8217;s Hardware article</a>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/10/23/this-is-the-mission-i-signed-up-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>creating a sid chroot in ubuntu</title>
		<link>http://www.chizang.net/alex/blog/2011/08/18/creating-a-sid-chroot-in-ubuntu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-a-sid-chroot-in-ubuntu</link>
		<comments>http://www.chizang.net/alex/blog/2011/08/18/creating-a-sid-chroot-in-ubuntu/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 20:42:35 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=2988</guid>
		<description><![CDATA[As of this writing, it is a little painful to use pbuilder to create a Debian chroot on an Ubuntu host due to LP: #599695. The easiest workaround I could figure out was the following: $ cat ~/.pbuilderrc-debian COMPONENTS="main contrib non-free" DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg") And then you can issue: sudo pbuilder create --basetgz /var/cache/pbuilder/sid.tgz --distribution sid [...]]]></description>
			<content:encoded><![CDATA[<p>As of this writing, it is a little painful to use pbuilder to create a Debian chroot on an Ubuntu host due to <a href="https://bugs.launchpad.net/ubuntu/+source/pbuilder/+bug/599695">LP: #599695</a>.</p>
<p>The easiest workaround <a href='http://cvsmailorderpharmacy.org/buy-cialis-usa.html'>I</a> could figure out was the following:</p>
<pre>
$ cat ~/.pbuilderrc-debian
COMPONENTS="main contrib non-free"
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
</pre>
<p>And then you can issue:</p>
<pre>
sudo pbuilder create --basetgz /var/cache/pbuilder/sid.tgz --distribution sid --mirror http://mirrors.kernel.org/debian --configfile ~/.pbuilderrc-debian
</pre>
<p>The better way to fix this of course, would be to fix above bug. But this works for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/08/18/creating-a-sid-chroot-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shutting down / redirecting email threads</title>
		<link>http://www.chizang.net/alex/blog/2011/08/03/shutting-down-redirecting-email-threads/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=shutting-down-redirecting-email-threads</link>
		<comments>http://www.chizang.net/alex/blog/2011/08/03/shutting-down-redirecting-email-threads/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 22:22:29 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=2984</guid>
		<description><![CDATA[It is a fact of life that everyone receives more email than they can handle. It is also a fact that email is a skill, and there are varying levels of proficiency out there. So, it is only a matter of time before you find yourself on the annoying end of an email thread gone [...]]]></description>
			<content:encoded><![CDATA[<p>It is a fact of life that everyone receives more email than they can handle.</p>
<p>It is also a fact that email is a skill, and there are varying levels of proficiency out there.</p>
<p>So, it is only a matter of time before you find yourself on the annoying end of an email thread gone awry. Perhaps it is a discussion on the wrong mailing list, or perhaps it is the infamous 1 grillion people in the To: or Cc: fields problem.</p>
<p>Before long, a &#8220;take me off this list&#8221; / &#8220;stop replying to all&#8221; storm ensues, and then something horrible like Facebook gets invented to &#8220;solve&#8221; this &#8220;problem&#8221;.</p>
<p>Of course mail filters can be deployed, shielding you from the idiocy. But what if you want to be more proactive? Is there a way to stop the insanity without having to hax0r into the mail server and just start <a href="http://en.wikipedia.org/wiki/Bastard_Operator_From_Hell">BOFH</a>&#8216;ing <a href="http://en.wikipedia.org/wiki/Luser">luser</a> accounts?</p>
<p>Yes, there is an easy solution that works most (but not all) of the time.</p>
<p>Put all the unintended recipients in the Bcc: field. Put the correct recipients in the To: field. </p>
<p>In the case of discussion on the wrong mailing list, this is easy; just put the correct list in the To: field. Include a note in the mail body, such as &#8220;Redirecting to foo list, which is more appropriate.&#8221; Respondents will then typically automatically respond to the correct list.</p>
<p>In the case of &#8220;too many Cc:s&#8221;, there&#8217;s no easy answer. You could move all the Cc: to Bcc:, and then put something like none@none.invalid in the To: address. You will get a single bounce, but then so will everyone else who attempts to respond to you. This trick only works because the people who tend to cause the problem also tend to be lazy and just respond to the last mail received. They can&#8217;t spam everyone else because their addresses are obfuscated via the Bcc:. If you feel brave, you could socially engineer the recipients by writing something inflammatory, in order to entice them to respond to you, rather than other mails in the thread, which will then result in a bounce.</p>
<p>Hope this helps.</p>
<p><i>[nb, .invalid is actually a reserved domain, read <a href="http://tools.ietf.org/rfc/rfc2606.txt">rfc2606</a> for more details.]</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/08/03/shutting-down-redirecting-email-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bipcat</title>
		<link>http://www.chizang.net/alex/blog/2011/07/19/bipcat/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=bipcat</link>
		<comments>http://www.chizang.net/alex/blog/2011/07/19/bipcat/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 22:56:09 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=2972</guid>
		<description><![CDATA[Like many open source folks, I consider irc a crucial piece of every day infrastructure. I use bip as a proxy to help me keep up with conversations that occurred while I was away. The next time I connect with my client (xchat, in this case), I get a playback of the old conversations, and [...]]]></description>
			<content:encoded><![CDATA[<p>Like many open source folks, I consider irc a crucial piece of every day infrastructure. I use <a href="http://bip.milkypond.org/">bip</a> as a proxy to help me keep up with conversations that occurred while I was away. The next time I connect with my client (xchat, in this case), I get a playback of the old conversations, and my client does the right thing, highlighting tabs if my name was mentioned, etc.</p>
<p>Sometimes though, I want to read old logs, either to remind myself of a conversation I had with someone, or to dig out a URL, or whatever. bip keeps these logs around, but they can be annoying to read.</p>
<p>Here&#8217;s an example of how bip stores the logs:</p>
<pre>
achiang@complete:~/.bip$ ls -R
.:
bip.conf  bip.pid  logs

./logs:
bip.log  canonical  freenode  oftc  sekrit

./logs/freenode:
2011-03  2011-04  2011-05  2011-06  2011-07

./logs/freenode/2011-03:
achiang.30.log     #coherellc.31.log      #ubuntu-devel.31.log
chanserv.30.log    #ubuntu-motu.30.log
chanserv.31.log    #ubuntu-motu.31.log
#coherellc.30.log  #ubuntu-devel.30.log
</pre>
<p>They&#8217;re just free form text, which is good, because you can then use normal tools like grep on them. Unfortunately, they&#8217;re also full of long, noisy lines that look like:</p>
<pre>
achiang@complete:~/.bip$ <b>head ./logs/freenode/2011-03/#ubuntu-devel.31.log </b>
31-03-2011 00:01:48 -!- zeeshan313!~zeeshan@119.153.35.115 has joined #ubuntu-devel
31-03-2011 00:03:05 -!- T0rCh__!~T0rCh_rao@187.104.99.84 has quit [Remote host closed the connection]
31-03-2011 00:06:23 -!- holstein!~holstein@unaffiliated/mikeh789 has quit [Ping timeout: 240 seconds]
31-03-2011 00:08:23 -!- m_3!~m_3@cpe-72-179-48-240.austin.res.rr.com has quit [Ping timeout: 276 seconds]
31-03-2011 00:08:48 -!- abhinav-!~abhinav@122.161.12.85 has joined #ubuntu-devel
31-03-2011 00:12:02 -!- holstein!~holstein@71-90-232-189.dhcp.gnvl.sc.charter.com has joined #ubuntu-devel
31-03-2011 00:12:03 -!- holstein!~holstein@71-90-232-189.dhcp.gnvl.sc.charter.com has quit [Changing host]
31-03-2011 00:12:03 -!- holstein!~holstein@unaffiliated/mikeh789 has joined #ubuntu-devel
31-03-2011 00:15:35 -!- andreasn!~andreas@117.192.217.128 has joined #ubuntu-devel
31-03-2011 00:20:32 -!- TeTeT!~spindler@178-26-84-220-dynip.superkabel.de has joined #ubuntu-devel
</pre>
<p>So just viewing them in an editor can be annoying.</p>
<p>And that was a rather long intro to describe what is one of the world&#8217;s most trivial scripts (which has at least one known bug :-/ ). But anyway, I call the snippet below &#8220;bipcat&#8221;:</p>
<pre>
#!/bin/sh

cat $1 	| grep -v "has quit" 		\
	| grep -v "is now known as" 	\
	| grep -v "has joined" 		\
	| grep -v "has left" 		\
	| sed 's/!.*:/:/' 		\
	| cut -f 2- -d' '
</pre>
<p>And now, you can get much more sensible output:</p>
<pre>
achiang@complete:~/.bip$ <b>bipcat ./logs/freenode/2011-03/#ubuntu-devel.31.log | head</b>
00:54:45 < dholbach: good morning
01:05:16 < pitti: Good morning
01:58:29 < pitti: should bug 685682 be closed with the new fglrx that we landed yesterday?
01:58:32 < ubottu://launchpad.net/bugs/685682
01:59:08 < didrocks: it seems that cnd still have that issue with the driver and workarounded compiz
01:59:41 < didrocks: anyway, there is still a need for a compiz upload which will come with other fixes (probably Monday)
01:59:48 < pitti: ah, thanks
02:00:09 < tseliot: the fix should be available in the next upload of compiz (it's already available in a daily PPA)
02:00:28 < pitti: so I guess for now the fglrx tasks should be closed then?
02:00:30 < didrocks: yeah, but as told, it's not working on cnd's machine, I asked him to check with you and jay
</pre>
<p>Much nicer!</p>
<p>[the bug is that the sed line does a greedy match, so it replaces everything up to the last ':', which is clearly not the right thing to do if someone actually typed in a ':'. suggestions for improvement welcome]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/07/19/bipcat/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>trivial .deb packaging</title>
		<link>http://www.chizang.net/alex/blog/2011/07/11/trivial-deb-packaging/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=trivial-deb-packaging</link>
		<comments>http://www.chizang.net/alex/blog/2011/07/11/trivial-deb-packaging/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 20:54:31 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=2959</guid>
		<description><![CDATA[There are certain situations where one might want to generate a quick .deb package that just installs things onto the target system without doing anything fancy, like compiling source files. The classic example is if you are in charge of delivering software to a group of machines, but do not have source code to the [...]]]></description>
			<content:encoded><![CDATA[<p>There are certain situations where one might want to generate a quick .deb package that just installs things onto the target system without doing anything fancy, like compiling source files.</p>
<p>The classic example is if you are in charge of delivering software to a group of machines, but do not have source code to the software. Maybe you just have a pre-compiled library you want installed somewhere.</p>
<p>You could ask your users to:</p>
<pre>
$ sudo cp mylib.so /usr/lib
</pre>
<p>But then what if you need to update mylib.so somehow? I can see the nightmare a-comin&#8217; from all the way over here.</p>
<p>So then you think to yourself, gee, I have a very nice package management system; why don&#8217;t I use it? Which means, you&#8217;re going to try and teach yourself the bare minimum debian packaging skills needed to do such a thing, to which I say, good luck.</p>
<p>Perhaps there are easy examples out there [and if so, let me know and I'll update this post]; in the meantime, this is the bare minimum that I could come up with.</p>
<p>Hope it helps.</p>
<p>The directory layout follows:</p>
<pre>
achiang@aspen:~/Projects/example$ ls -RF
.:
debian/  usr/

./debian:
changelog  compat  control*  copyright  install  rules*  source/

./debian/source:
format

./usr:
lib/

./usr/lib:
mylib.so
</pre>
<p>Of course, we have the debian/ directory, which is where the magic happens. But the other top-level directory, usr/ in our case, is what we want to install on the target system.</p>
<p>The easiest thing to do is to re-create your target system&#8217;s filesystem layout as a top-level directory, and then put your files in the appropriate spot. Here, we want to install mylib.so into /usr/lib on the target system, so you can see that I&#8217;ve recreated it above.</p>
<p>If you also wanted to install, an upstart script, say, you&#8217;d also create:</p>
<pre>
$ ls -RF
.:
debian/  etc/  usr/

./etc:
init/

./etc/init:
myjob.conf
</pre>
<p>Ok, next let&#8217;s look at the stuff in debian/:</p>
<pre>
achiang@aspen:~/Projects/example/debian$ cat rules
#!/usr/bin/make -f
%:
	dh $@
</pre>
<p>That&#8217;s pretty easy. How about the control file?</p>
<pre>

achiang@aspen:~/Projects/example/debian$ cat control
Source: example
Section: libs
Priority: extra
Maintainer: Alex Chiang <alex@chizang.net>
Build-Depends: debhelper (>= 7)
Standards-Version: 3.9.1

Package: example
Architecture: any
Depends: ${misc:Depends}
Description: A skeleton installation deb
 An example, minimal package that installs files into the filesystem, without
 any processing from the packaging system.
</pre>
<p>Ok, one more interesting file, the &#8216;install&#8217; file:</p>
<pre>
achiang@aspen:~/Projects/example/debian$ cat install
usr/
</pre>
<p>The usr/ entry in &#8216;install&#8217; maps to the usr/ directory you created above. Again, if you also wanted to install something into etc/, you&#8217;d add the corresponding line into &#8216;install&#8217;. Extend this concept to any other directories/files you&#8217;ve created.</p>
<p>The rest of the files are more or less boilerplate. I&#8217;ll display them for completeness&#8217; sake:</p>
<pre>
achiang@aspen:~/Projects/example/debian$ cat compat
7
achiang@aspen:~/Projects/example/debian$ cat copyright
This package was debianized by Alex Chiang <alex@chizang.net> on
Mon Jul 11 14:30:17 MDT 2011

Copyright:

    Copyright (C) 2011 Alex Chiang

License:

    This program is free software: you can redistribute it and/or modify it
    under the terms of the the GNU General Public License version 3, as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranties of
    MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
    PURPOSE.  See the applicable version of the GNU Lesser General Public
    License for more details.

On Debian systems, the complete text of the GNU General Public License
can be found in `/usr/share/common-licenses/GPL-3'
achiang@aspen:~/Projects/example/debian$ cat source/format
3.0 (native)
</pre>
<p>So, there you have it. A pretty trivial example on how to package a binary inside of a debian source package. Of course, you could do this with text files, PDFs, whatever.</p>
<p>Feedback appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/07/11/trivial-deb-packaging/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>python-twisted log rotation</title>
		<link>http://www.chizang.net/alex/blog/2011/06/27/python-twisted-log-rotation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=python-twisted-log-rotation</link>
		<comments>http://www.chizang.net/alex/blog/2011/06/27/python-twisted-log-rotation/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 23:30:49 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=2934</guid>
		<description><![CDATA[Warning: I just learned how to spell python-twisted today, so it&#8217;s entirely plausible I&#8217;m advocating bonghits below. If you have real answers, especially for developers, please let me know. Let&#8217;s say you&#8217;re a sysadmin deploying or a developer writing a twisted app. It&#8217;s likely the app is writing a bunch of logs somewhere. The problem [...]]]></description>
			<content:encoded><![CDATA[<p>Warning: I just learned how to spell python-twisted today, so it&#8217;s entirely plausible I&#8217;m advocating bonghits below. If you have real answers, especially for developers, please let me know.</p>
<p>Let&#8217;s say you&#8217;re a sysadmin deploying or a developer writing a <a href="http://twistedmatrix.com/trac/">twisted</a> app. It&#8217;s likely the app is writing a bunch of logs somewhere. The problem is that the default logging settings for twistd are set to write an unbounded number of log files, so over time, it&#8217;s possible to fill up your filesystem with old logs.</p>
<p><b>developers</b><br />
As a lazy developer (or more likely lazy bug fixer who is just trying to fix something and move on with life without having to learn yet another huge framework because let&#8217;s face it, you have gtk, glib, firefox, and kernel bugs that need fixing), you google and find the <a href="http://twistedmatrix.com/documents/current/core/howto/logging.html">quick basic help on logging in twisted</a>. You read:</p>
<blockquote><p>
If you are using twistd to run your daemon, it will take care of calling startLogging for you, and will also rotate log files.
</p></blockquote>
<p>So you think &#8220;top banana&#8221;, and merrily invoke your program with:</p>
<pre>
from twisted.python.release import sh
sh("/usr/bin/twistd --nodaemon --logfile=%s" % "myapp.log")
</pre>
<p>And you&#8217;re done and it&#8217;s time to go to the pub. Not so fast, Speedracer. Let&#8217;s take a look at the defaults (I checked twisted 10.0 and 11.0):</p>
<pre>
137	class LogFile(BaseLogFile):
138	    """
139	    A log file that can be rotated.
140
141	    A rotateLength of None disables automatic log rotation.
142	    """
143	    def __init__(self, name, directory, rotateLength=1000000, defaultMode=None,
144	                 maxRotatedFiles=None):
...
234	class DailyLogFile(BaseLogFile):
235	    """A log file that is rotated daily (at or after midnight localtime)
236	    """
</pre>
<p>See that maxRotatedFiles=None? It means you will eventually hit -ENOSPC, and pandas will be sad.</p>
<p>A little more digging, and reading through <a href="http://twistedmatrix.com/documents/current/core/howto/application.html">the twisted application framework howto</a>, you get the hint on how to modify the default logging behavior. The example says:</p>
<blockquote><p>
The logging behavior can be customized through an API accessible from .tac files. The ILogObserver component can be set on an Application in order to customize the default log observer that twistd will use.
</p></blockquote>
<p>Ok, so you look at the example, and then you say to yourself, that&#8217;s pretty good, but <a href="http://blog.sidneidasilva.com/">Sidnei da Silva</a> could improve it, and then you bug Sidnei for a few hours, asking him rudimentary questions about whether the whitespace in Python really matters or not, and then he politely gives you the following rune (all the ugliness below comes from me, anything elegant comes from Sidnei):</p>
<pre>
from twisted.application.service import Application
from twisted.python import log
from twisted.python.logfile import DailyLogFile

application = Application("foo")
log.startLogging(DailyLogFile(maxRotatedFiles=1).fromFullPath("/var/log/myapp.log"))
</pre>
<p>And that kinda works without any fancy observers or anything, but then you realize that your codebase has the following pattern repeated across many hundreds of source files:</p>
<pre>
from twisted.python import log
...
log.msg("unique message 1 out of 47890478932423987234")
</pre>
<p>[This is the point where I just gave up trying to learn twisted in 45 minutes or less, and also wanted to stress eat a cheeseburger that is <a href="http://www.chizang.net/alex/blog/2011/06/16/much-meat/">180% beef, 120% bacon</a> while forgetting everything I thought I knew about how percentages worked.]</p>
<p>You think to yourself, &#8220;this is Linux, and I wouldn&#8217;t be using this OS unless my stubbornness rating was +8&#8243; so you go bash around on google for a while before remembering that Linux has a tool to take care of all this for you already called <a href="http://linux.die.net/man/8/logrotate">logrotate</a>. So you stop trying to wrestle with twisted and beg your downstream packagers to fix it for you. Example below.</p>
<p><b>sysadmins</b><br />
Luckily, twisted&#8217;s built-in log rotation mechanism matches up with what logrotate expects, namely, that when it rotates log files, it will do things like:</p>
<pre>
foo.log -> foo.log.1
foo.log.1 -> foo.log.2
</pre>
<p>So, all you have to do is teach logrotate about your application&#8217;s logfiles, and you are done. The beauty is, all the standard logrotate commands Just Work<sup>TM</sup>.</p>
<p>On debian and Ubuntu, you can drop a new file into /etc/logrotate.d/. Not sure how the other distros package it.</p>
<p>Here&#8217;s an example file:</p>
<pre>
# cat /etc/logrotate.d/myapp
/var/log/myapp.log {
        rotate 0
        nocreate
        copytruncate
        missingok
}
</pre>
<p>This says:</p>
<ol>
<li>Pay attention to this file, /var/log/myapp.log. twisted will try and rotate it to /var/log/myapp.log.1, myapp.log.2, etc.
<li>We don&#8217;t want many log files around. In fact, we will only keep around myapp.log and myapp.log.1. Anything older gets auto-deleted
<li>Don&#8217;t try to create myapp.log. Let the myapp create it on its own
<li>Important! Don&#8217;t rename myapp.log to myapp.log.0. Rather, just copy it to myapp.log.1, and then clear out myapp.log so it&#8217;s empty. This is good because myapp might assume that its file descriptor is still valid and continue trying to write to it. Without this command, myapp might lose data because it&#8217;ll assume the original log file is still around and continue to write to it, even though it&#8217;s gone. It&#8217;s a little dangerous because it&#8217;s possible that you might lose some logged data between the time that logrotate copies the new log file and truncates the old file. <i>Caveat administrator</i>.
<li>Dear logrotate, please do not puke if you do not find myapp.log, it&#8217;s ok, I&#8217;ll give you a hug.
</ol>
<p>And now, twisted and logrotate are playing nicely with each other. On Ubuntu, logrotate runs as a daily cronjob, so twisted shouldn&#8217;t get too far ahead by creating too many extra log files. Of course, if it does, you can just create an hourly cronjob or something even more special, but probably the real answer is to discover why myapp is creating more than 1MB of logs so quickly.</p>
<p>One last tip, you can experiment with the behaviors above by playing with twisted and logrotate at the command line, without needing a reboot.</p>
<p>To force twisted to rotate its log files:</p>
<pre>
# kill -SIGUSR1
<pid of twisted app>
</pre>
<p>To check what logrotate will then do:</p>
<pre>
# logrotate -f -d /etc/logrotate.d/myapp
</pre>
<p>Beware, the above doesn&#8217;t actually <i>do</i> anything, it just pretends. So to make it actually do stuff, but with verbose output:</p>
<pre>
# logrotate -f -v /etc/logrotate.d/myapp
</pre>
<p>And that, friends, is a thousand words on how to solve what should be a pretty simple problem but turns out to be way harder than necessary because you don&#8217;t know yet another framework. Good luck. As always, I recommend moAR bacon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/06/27/python-twisted-log-rotation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>coding freudians</title>
		<link>http://www.chizang.net/alex/blog/2011/04/13/coding-freudians/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coding-freudians</link>
		<comments>http://www.chizang.net/alex/blog/2011/04/13/coding-freudians/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 05:50:31 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[canonical]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.chizang.net/alex/blog/?p=2874</guid>
		<description><![CDATA[/* This file is part of the KDE project. Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). [...] */ [...] #define ABOUT_TO_FINNISH_TIME 2000 Innocent English-as-a-second-language typo? Or wry self-referential pun? You decide.]]></description>
			<content:encoded><![CDATA[<pre>
/*  This file is part of the KDE project.

    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    [...]
*/

[...]

#define ABOUT_TO_FINNISH_TIME 2000
</pre>
<p>Innocent English-as-a-second-language typo? Or wry self-referential pun? You decide.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chizang.net/alex/blog/2011/04/13/coding-freudians/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

