<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>TK Assembled</title>
	
	<link>http://blog.tkassembled.com</link>
	<description>Hopefully not just another Wordpress Blog.</description>
	<lastBuildDate>Thu, 14 Mar 2013 20:36:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/tkassembled" /><feedburner:info uri="tkassembled" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/tkassembled" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsalloy.com/?rss=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.newsalloy.com/subrss3.gif">Subscribe with NewsAlloy</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://download.attensa.com/app/get_attensa.html?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.attensa.com/blogs/attensa/WindowsLiveWriter/BadgeredintoBadges_10C02/attensa_feed_button5.gif">Subscribe with Attensa for Outlook</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.flurry.com/pushRssFeed.do?r=fb&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.flurry.com/images/flurry_rss_logo2.gif">Subscribe with Flurry</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Ftkassembled" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Quickly Creating Python and Django Projects with Buildout</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/R8y9txAzSs8/</link>
		<comments>http://blog.tkassembled.com/348/quickly-creating-python-and-django-projects-with-buildout/#comments</comments>
		<pubDate>Thu, 14 Mar 2013 20:36:28 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[buildout]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=348</guid>
		<description><![CDATA[Buildout is an awesome build management tool for Python projects, managing dependencies and featuring rich recipes for accomplishing advanced tasks. The main problem seems to be that documentation is lacking and/or terrible. Plus, project setup is painstaking and difficult to &#8230; <a href="http://blog.tkassembled.com/348/quickly-creating-python-and-django-projects-with-buildout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p><img class="alignleft size-full wp-image-349" style="float: left;" alt="Terminal" src="http://blog.tkassembled.com/u/2013/03/terminal.png" width="96" height="96" /><br />
<a href="http://buildout.org">Buildout</a> is an awesome build management tool for Python projects, managing dependencies and featuring rich recipes for accomplishing advanced tasks. The main problem seems to be that documentation is lacking and/or terrible. Plus, project setup is painstaking and difficult to get right. Since I have years of experience in Maven, where creating a buildable project takes (literally) seconds to accomplish, this initially made Buildout too much of a hurdle. However, that&#8217;s now changed, as I&#8217;ve recently released version 0.1.0 of <a href="https://github.com/rfkrocktk/buildout-starter">buildout-starter</a>, an installable Python script to make creating Python and Django projects with Buildout a snap.</p>
<p><span id="more-348"></span></p>
<h2>Installation</h2>
<p>First, we&#8217;ll need to install <a href="https://github.com/rfkrocktk/buildout-starter/">buildout-starter</a> which will automate everything for us. If you&#8217;re on a Linux variant or on OSX, make sure that <code>pip</code> or <code>easy_install</code> as well as Python are installed on your machine. On Windows, naturally it&#8217;s a bit harder, and you&#8217;ll have to install from source to get things rolling.</p>
<p>On Unix/Linux/OSX, either run this:</p>
<pre>sudo pip install buildout-starter</pre>
<p>&#8230;or this:</p>
<pre>sudo easy_install buildout-starter</pre>
<p>to install <code>buildout-starter</code> on your machine.</p>
<p>Now that it&#8217;s hopefully installed, we&#8217;ll be able to quickly throw together a project to generate a simple Python script.</p>
<h2>A Bare-Bones Python Project</h2>
<p>To generate a bare-bones Python project, simply run this from your favorite terminal:</p>
<pre>buildout-start myprojectname</pre>
<p>A new Buildout-ready project will be generated for you in the <code>myprojectname</code> directory.<br />
<h2>Git Repository Generation</h2>
<p>If you have Git installed and you&#8217;d like to automate the creation of a Git repository and a default <code>.gitignore</code> file, you can pass <code>--git</code> as a paramater to <code>buildout-start</code> like this:</p>
<pre>buildout-start --git myprojectname</pre>
<p>That will create your project as well as initialize a Git repository in it, saving you a few steps. It also creates a <code>.gitignore</code> file as mentioned above, ignoring all project build folders.</p>
<h2>Eclipse PyDev Integration/Support</h2>
<p>If you&#8217;re working in Eclipse with PyDev, you can also enable PyDev support at project creation time by passing the <code>--pydev</code> flag:</p>
<pre>buildout-start --pydev myprojectname</pre>
<p>This will generate an Eclipse <code>.project</code> and <code>.pydevproject</code> file in your project&#8217;s base directory, ready to integrate with Eclipse. Don&#8217;t forget to run <code>bin/buildout</code> after changing dependencies for these files to be updated with the right paths to their corresponding eggs.</p>
<h2>IPython Shell Support</h2>
<p>If you&#8217;re like me and prefer using the IPython shell instead of the default Python shell, as it provides many more features, you can easily add this to your project&#8217;s configuration at project creation time by passing the <code>--ipython</code> flag:</p>
<pre>buildout-start --ipython myprojectname</pre>
<p>In addition to the <code>bin/python</code> interpreter generated by default, you&#8217;ll also now have one at <code>bin/ipython</code> which, unsurprisingly, points to an IPython shell for your project.</p>
<h2>Django Project Generation</h2>
<p><code>buildout-starter</code> also features Django project generation, which saves even more time in configuration. Simply pass the <code>--django</code> flag to the script to generate a Django project as opposed to a bare-bones Python project:</p>
<pre>buildout-start --django myproject</pre>
<p>This will create everything needed for Django project development. We&#8217;ll discuss this a bit more in the next part of the tutorial.</p>
<h2>Custom Python-safe Package Names</h2>
<p>If your project name contains any non-alphanumeric characters, you&#8217;ll quickly realize that <code>buildout-starter</code> <q>sanitizes</q> them to get rid of non-Python identifier characters. Hyphens are converted to underscores, but everything else is wiped out. If you&#8217;d like to specify a custom sanitized project name, you can do so by passing the <code>-p</code> or <code>--package-name</code> flag with a sanitized project name:</p>
<pre>buildout-start -p myproject my-project</pre>
<p>By default, a project created with the name <code>my-project</code> would have its name sanitized to <code>my_project</code>. Since we don&#8217;t want that to happen (we&#8217;d rather get rid of the hyphen/underscore altogether), we pass the <code>-p</code> flag with a value of <code>myproject</code> to specify that we want the package name to be <code>myproject</code> instead of the generated <code>my_project</code>.</p>
<h2>Mix and Match Flags</h2>
<p>All flags specified above can be mixed and matched to generate a project as needed:</p>
<pre>buildout-start -p myproject --django --ipython --pydev --git my-project</pre>
<p>This will generate a project named <q>my-project</q> with a package name of <code>myproject</code>. The project will be a Django project, with PyDev support, and an IPython interpreter. Additionally, a Git repository will be initialized in the project directory. Awesome!</p>
<hr />
<p>In the next tutorial, we&#8217;ll discuss how to make and work with a simple Python project.</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/R8y9txAzSs8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/348/quickly-creating-python-and-django-projects-with-buildout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/348/quickly-creating-python-and-django-projects-with-buildout/</feedburner:origLink></item>
		<item>
		<title>Adding Icons to a Theme in Elementary Luna</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/PwEGcqHIP-Q/</link>
		<comments>http://blog.tkassembled.com/339/adding-icons-to-a-theme-in-elementary-luna/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 03:39:18 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[faenza]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[icons]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=339</guid>
		<description><![CDATA[Since I&#8217;m using Elementary Luna as my daily driver, I&#8217;m using it with a lot of apps not designed with it in mind. Rather, the Elementary icon set doesn&#8217;t include icons for these programs, such as Eclipse, NVIDIA X Server &#8230; <a href="http://blog.tkassembled.com/339/adding-icons-to-a-theme-in-elementary-luna/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p><img src="http://blog.tkassembled.com/u/2013/02/elementary-luna.png" alt="Elementary Luna Icon" width="131" height="130" class="alignleft size-full wp-image-340" style="float:left" />Since I&#8217;m using Elementary Luna as my <q>daily driver</q>, I&#8217;m using it with a lot of apps not designed with it in mind. Rather, the Elementary icon set doesn&#8217;t include icons for these programs, such as Eclipse, NVIDIA X Server Settings, Skype, etc. Luckily, a beautiful icon set called <a href="http://gnome-look.org/content/show.php/Faenza?content=128143">Faenza</a> does. By installing Faenza and <q>patching</q> our Elementary icon set with links to Faenza icons, we can fill in the gaps in our icon set.</p>
<p><span id="more-339"></span></p>
<p>First, make sure you&#8217;ve installed Faenza as root and that the command <code>ls /usr/share/icons/Faenza</code> doesn&#8217;t report a missing directory. Next, we&#8217;ll create directories to make sure that both sides have the right folders. This only needs to be done once:</p>
<pre>$ sudo mkdir /usr/share/icons/elementary/apps/{16,22,24,32,48,64,96,128,scalable}</pre>
<p>The above command might generate errors due to pre-existent directories, but that&#8217;s not a problem, we just want to make sure that they&#8217;re there for this next step. We&#8217;ll now create symbolic links to the icons, to save a little space on disk and avoid duplication of data:</p>
<pre>$ for size in 16 22 24 32 48 64 96 ; do 
    sudo ln -s /usr/share/icons/{Faenza,elementary}/apps/$size/skype.png
done
$ sudo ln -s /usr/share/icons/{Faenza,elementary}/apps/scalable/skype.svg</pre>
<p>Note the last line, which ends in <code>svg</code>, this is a scalable SVG vector rather than a baked PNG image.</p>
<p>Finally, we&#8217;ll rebuild GNOME&#8217;s icon cache, so that our theme will begin using the icons right away:</p>
<pre>$ sudo gtk-update-icon-cache -f /usr/share/icons/elementary</pre>
<p>With that, we&#8217;re all done and you should see your beautiful new icons. You might have to restart programs for things to start working as expected, but otherwise, everything should be in proper order <img src='http://blog.tkassembled.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/PwEGcqHIP-Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/339/adding-icons-to-a-theme-in-elementary-luna/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/339/adding-icons-to-a-theme-in-elementary-luna/</feedburner:origLink></item>
		<item>
		<title>Creating Long-Term Backups with Amazon Glacier on Linux</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/gQ5Fkv47usY/</link>
		<comments>http://blog.tkassembled.com/326/creating-long-term-backups-with-amazon-glacier-on-linux/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 03:41:25 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[glacier]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=326</guid>
		<description><![CDATA[If you haven&#8217;t heard about Amazon Glacier already, it&#8217;s definitely something to be excited about. Amazon Glacier is a service that makes it extremely affordable to store gigabytes upon gigabytes of data for the long term in the cloud. Your &#8230; <a href="http://blog.tkassembled.com/326/creating-long-term-backups-with-amazon-glacier-on-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p><img src="http://blog.tkassembled.com/u/2013/01/amazon_glacier-150x150.jpg" alt="Amazon Glacier Logo" width="150" height="150" class="alignleft size-thumbnail wp-image-327" style="float:left;"/>If you haven&#8217;t heard about <a href="http://aws.amazon.com/glacier/">Amazon Glacier</a> already, it&#8217;s definitely something to be excited about. Amazon Glacier is a service that makes it extremely affordable to store gigabytes upon gigabytes of data for the long term in the cloud. Your data is stored immediately, but retrieval requests take at least 4 hours to make your data available again for your downloading. Let&#8217;s back up a ton of files on Linux to Glacier.</p>
<p><span id="more-326"></span></p>
<p>For my purposes, I wanted to back up my entire music library, which is about 35 gigabytes of data. Due to the fact that Amazon doesn&#8217;t store folder structures, we&#8217;ll need to create archives of what we&#8217;d like to store. We&#8217;ll do that and split our archive into 200MB blocks out of convenience. I&#8217;m not currently aware of any per-file maximum size on Glacier, but it&#8217;s much easier to retry a 200MB upload rather than a 35GB one. Plus, this will make it much easier to script our uploads in a way that makes it easy to validate that our uploads completed properly. To zip up our music library, we&#8217;ll use <code>tar</code> and <code>split</code>, standard Linux utilities. I&#8217;ll be applying GZip compression to my tar archive, though this is not strictly necessary or even beneficial in our case, since most music files are already compressed using much more advanced algorithms than standard compression methods.</p>
<pre>$ BACKUP_TIME="$(date +%Y%m%d%H%M%S)"
$ tar cvzf - ~/Music | split --bytes=200MB - "music.backup.$BACKUP_TIME.tar.gz."</pre>
<p>What this will do is create a tar.gz archive split every 200MB into files looking like <code>"music.backup.20130120120503.tar.gz.aa"</code>. The date is generated before we do any real work, and the <code>aa</code> suffix will change on the archive count, so you&#8217;ll have archives ending in <code>aa</code>, <code>ab</code>, <code>ac</code>, etc. If you&#8217;re as paranoid as you should be, you&#8217;d now encrypt these archive using a GPG key, but that&#8217;s outside of the scope of this tutorial for now.</p>
<p>Now that we have our data, we&#8217;ll use a Python script library called <a href="https://github.com/uskudnik/amazon-glacier-cmd-interface">glacier-cmd</a> to upload our files and perform other operations on our Glacier vaults. Let&#8217;s get that library installed:</p>
<pre>$ sudo apt-get install python-setuptools git
$ git clone git://github.com/uskudnik/amazon-glacier-cmd-interface.git
$ cd amazon-glacier-cmd-interface
$ sudo python setup.py install</pre>
<p>Everything should now be installed for us to be able to start our backup process. All we need to do before we start uploading is to setup our configuration file and create our vault. First, create a file at <code>~/.glacier-cmd</code> filled with the following contents:</p>
<pre>[aws]
access_key=YOUR_AWS_ACCESS_KEY
access_secret=YOUR_AWS_ACCESS_SECRET

[glacier]
region=YOUR_AWS_REGION
logfile=~/.glacier-cmd.log
loglevel=INFO
output=print</pre>
<p>You&#8217;ll need to supply your AWS access/secret keys to proper variables as well as configure the AWS region. I&#8217;m in <code>us-west-1</code>, but you may wish to store your information in a different region.</p>
<p>Last step before uploading: create our Glacier vault. Choose a really awesome globally-unique vault name and create it like so:</p>
<pre>$ glacier-cmd mkvault "my-super-ridiculously-awesome-longterm-backup-solution"</pre>
<p>Provided that it completes properly, we&#8217;re in business. Now, let&#8217;s get onto the uploading. Since I&#8217;ve split my file into 200MB chunks, I&#8217;d like to upload them one at a time, moving completed uploads into another folder. For this, I&#8217;ve devised a pretty quick <code>find</code>/<code>while</code> loop to find my backup files, and run a series of commands on them.</p>
<pre>$ find . -maxdepth 1 -type f -name "music.backup.*.tar.gz.*" | sort | while read file ; do
    echo "Uploading $(basename "$file") to Amazon Glacier."
    glacier-cmd upload --description "$(basename "$file")" \
        my-super-ridiculously-awesome-longterm-backup-solution "$file" &#038;&#038; \
        mv "$file" "Completed Backups" 
done</pre>
<p>I use a <code>find</code> command to locate all files matching the <code>"music.backup.*.tar.gz"</code> pattern in the current directory only. I pass each found file to the <code>while</code> loop and it makes each file available as the <code>$file</code> variable in the loop. Before each file is uploaded, I echo a status message to let me know which file I&#8217;m currently uploading. I then do the actual upload using the <code>glacier-cmd</code> we installed before, setting the description of each uploaded file to the actual filename. If the upload completes without an issue, I then move the uploaded file into the &#8220;Completed Backups&#8221; folder so that I can know the file was uploaded successfully.</p>
<p>After your upload completes in a few days, you can use other commands of the <code>glacier-cmd</code> utility to query the status of your vault. Remember that inventories take about 4 hours or so, so don&#8217;t expect to get a directory listing back so quickly. Welcome to long-term backup with Glacier!</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/gQ5Fkv47usY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/326/creating-long-term-backups-with-amazon-glacier-on-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/326/creating-long-term-backups-with-amazon-glacier-on-linux/</feedburner:origLink></item>
		<item>
		<title>Quickly render text from the command line using Jinja2 and Django templating</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/IzYVkWKNOh0/</link>
		<comments>http://blog.tkassembled.com/317/quickly-render-text-from-the-command-line-using-jinja2-and-django-templating/#comments</comments>
		<pubDate>Thu, 17 Jan 2013 00:56:49 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[jinja2]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=317</guid>
		<description><![CDATA[Both Django and Jinja offer awesome string templating libraries. I wondered how difficult it would be to simply script some string templates for use in Bash scripts, and I found that it&#8217;s really not so hard at all. To start, &#8230; <a href="http://blog.tkassembled.com/317/quickly-render-text-from-the-command-line-using-jinja2-and-django-templating/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p><img src="http://blog.tkassembled.com/u/2013/01/django-icon-256-150x150.png" alt="Django Logo" width="150" height="150" class="alignleft size-thumbnail wp-image-318" />Both <a href="http://www.djangoproject.com/">Django</a> and <a href="http://jinja.pocoo.org/">Jinja</a> offer awesome string templating libraries. I wondered how difficult it would be to simply script some string templates for use in Bash scripts, and I found that it&#8217;s really not so hard at all.</p>
<p>To start, we&#8217;ll use Jinja, since I like it a bit better than Django and it seems to be faster and more lightweight. First, ensure that the Jinja2 library is installed on your system. Since I&#8217;m on a Debian/Ubuntu derivative, this is as easy as <code>sudo apt-get install python-jinja2</code>. Now, let&#8217;s template!</p>
<pre>$ python -c "import jinja2 ; print jinja2.Template(\"Hello, World\").render()"
Hello, World</pre>
<p>Let&#8217;s use a filter to convert the amount of bytes in one megabyte into a more readable value:</p>
<pre>$ python -c "import jinja2 ; print jinja.Template(\"{{ bytes|filesizeformat }}\").render(bytes=\"1500000\")"
1.5 MB</pre>
<p><small>Due to an issue in Jinja2 which hasn&#8217;t been largely released yet (as of 2012-01-16), the <code>filesizeformat</code> filter has an issue which will cause values to render as 0.0 MB instead of the expected result.</small></p>
<p>Awesome, now onto the same thing in Django. Make sure that Django is installed and continue:</p>
<pre>$ python -c "from django.template import Template,Context ; from django.conf import settings ; settings.configure() ; print Template(\"Hello, World\").render(Context())"
Hello, World</pre>
<p>As you can see, Django is a lot more verbose to get the same result. In any case, we&#8217;ll move on to formatting file sizes:</p>
<pre>$ python -c "from django.template import Template,Context ; from django.conf import settings ; settings.configure() ; print Template(\"{{ bytes|filesizeformat }}\").render(Context({\"bytes\":\"1572864\"}))"
1.5MB</pre>
<p>These simple examples should allow you to do some pretty rad stuff with command-line templating in Django and Jinja2.</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/IzYVkWKNOh0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/317/quickly-render-text-from-the-command-line-using-jinja2-and-django-templating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/317/quickly-render-text-from-the-command-line-using-jinja2-and-django-templating/</feedburner:origLink></item>
		<item>
		<title>A Better Magic Trackpad Experience in Linux</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/PhEziKIrYUA/</link>
		<comments>http://blog.tkassembled.com/308/a-better-magic-trackpad-experience-in-linux/#comments</comments>
		<pubDate>Wed, 19 Dec 2012 05:19:17 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[magic-trackpad]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=308</guid>
		<description><![CDATA[If you&#8217;re like me, you own a nice Apple Magic Trackpad. You&#8217;ve also paired it with your Linux box and it&#8217;s working great. However, it could probably work better. The defaults for the device are, in my opinion, pretty unresponsive &#8230; <a href="http://blog.tkassembled.com/308/a-better-magic-trackpad-experience-in-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p>If you&#8217;re like me, you own a nice Apple Magic Trackpad. You&#8217;ve also paired it with your Linux box and it&#8217;s working great. However, it could probably work better. The defaults for the device are, in my opinion, pretty unresponsive and at times really bizarre. Let&#8217;s walk through some hacks and fixes in order to get things working better.</p>
<p><span id="more-308"></span></p>
<p>First, there are two different ways of changing options for the trackpad. For now, we&#8217;ll default to using the command-line <code>synclient</code> tool in order to play around with values. Simply running <code>synclient</code> will list out all available options in additions to their present values. I like to back this file up before I make changes, so let&#8217;s do that now:</p>
<pre>$ synclient |&#038; tee ~/Downloads/synclient.backup</pre>
<p>Great. Now, let&#8217;s get started by setting some values that really should be set by default. When using multiple monitors or even just really wide monitors, trackpad movement is horizontally extremely sensitive but vertically, it&#8217;s incredible insensitive. (Meanie.) For this hack, let&#8217;s make it permanent because it&#8217;ll make everything better anyway and doesn&#8217;t really come with too many risks. For some reason, we can&#8217;t test this with <code>synclient</code>, but the rest of the hacks, we&#8217;ll be able to test just fine from the commandline. Let&#8217;s create an Xorg configuration file for the device. Create a new file called <code>/etc/X11/xorg.conf.d/60-apple-magic-trackpad.conf</code>. Open it in your favorite editor and add the following:</p>
<pre>Section "InputClass"
    Identifier "Apple Magic Trackpad"
    Driver "synaptics"
    
    MatchUSBID "05ac:030e"
    MatchIsTouchpad "on"

    Option "VertResolution" "75"
    Option "HorizResolution" "75"
EndSection</pre>
<p>Unfortunately, you&#8217;ll need to restart X in order to see changes, so log out and log back in again and now you&#8217;ll see your cursor move much more intuitively in all directions.</p>
<p>Now, let&#8217;s get on to the fun stuff.</p>
<h2>Fix right-click delay time</h2>
<p>I&#8217;ve had an issue where, when two-finger clicking (ie: right-clicking), the mouse-up event would trigger too quickly and send a single click, thus instantly selecting the first item in a right-click menu. In my browser, when trying to copy text or to open a link in a new tab, it would automatically select the first item in the right-click mouse, which happened to be &#8220;Back&#8221; and would send me to the previous page. Not fun. Not fun at all. To fix this, we can tweak a synaptics property called <code>EmulateMidButtonTime</code>. To apply the fix temporarily, do the following:</p>
<pre>$ synclient EmulateMidButtonTime=100</pre>
<p>Experiment with different values to make sure that you&#8217;ve got something that works first, then we&#8217;ll add this as an option to the Xorg configuration file mentioned above. Simply add the following line underneath the other <code>Option</code> directives before <code>EndSection</code>:</p>
<pre>Option "EmulateMidButtonTime" "100"</pre>
<h2>Increase Overall Sensitivity</h2>
<p>There are many properties that control sensitivity, but for now, we&#8217;ll tweak the <code>MinSpeed</code> and the <code>MaxSpeed</code> synaptics properties to increase the sensitivity. First, set the <code>MinSpeed</code> to something higher than it is by default. On my machine, I have this set to <code>1.75</code>. Set this temporarily using <code>synclient</code> like this:</p>
<pre>$ synclient MinSpeed=1.75</pre>
<p>Once you have <code>MinSpeed</code> at a value that you like, set <code>MaxSpeed</code> to a value a bit higher than <code>MinSpeed</code> to get the best experience.</p>
<pre>$ synclient MaxSpeed=2.0</pre>
<p>Finally, we&#8217;ll tweak another property that determines how fast the mouse speed will change between <code>MinSpeed</code> and <code>MaxSpeed</code>. Change this using the <code>AccelFactor</code> property:</p>
<pre>$ synclient AccelFactor=0.1</pre>
<p>Once you&#8217;re all set, add these as properties to your Xorg configuration file mentioned above:</p>
<pre>Option "MinSpeed" "1.75"
Option "MaxSpeed" "2.0"
Option "AccelFactor" "0.1"</pre>
<h2>Increase/Flip Vertical and Horizontal Scroll Sensitivity</h2>
<p>Tweaking the <code>VertScrollDelta</code> and <code>HorizScrollDelta</code> properties will control how fast you scroll. If you set these to negative values, you&#8217;ll also get what&#8217;s known as <q>natural scrolling</q> in OSX, or inverted scrolling. This will mean that as you drag two fingers up on the trackpad, you&#8217;ll scroll down, rather than up. In any case, the standard scrolling is too slow for me, so basically set these properties to positive values if you&#8217;re interested in increasing sensitivity without flipping axes:</p>
<pre>$ synclient VertScrollDelta=-100
$ synclient HorizScrollDelta=-100</pre>
<p>When you&#8217;re happy, again, just add these options to your Xorg configuration file before <code>EndSection</code>:</p>
<pre>Option "VertScrollDelta" "-100"
Option "HorizScrollDelta" "-100"</pre>
<h2>Conclusion</h2>
<p>In the end, my <code>/etc/X11/xorg.conf.d/60-apple-magic-trackpad.conf</code> file looks like this:</p>
<pre># Configuration for fine-tuning only the Apple Magic Trackpad.
Section "InputClass"
    Identifier "Apple Magic Trackpad"
    Driver "synaptics"

    # Match only the Apple Magic Trackpad
    MatchUSBID "05ac:030e"
    MatchIsTouchpad "on"

    # Set resolution tweaks for better response
    Option "VertResolution" "75"
    Option "HorizResolution" "75"

    # Set a timeout for multi finger click so accidental double-clicks don't
    # happen when right clicking and other gestures
    Option "EmulateMidButtonTime" "100"

    # Increase sensitivity
    Option "MinSpeed" "1.75"
    Option "MaxSpeed" "2.00"
    Option "AccelFactor" "0.1"

    # Scrolling   
    Option "VertScrollDelta" "-100"
    Option "HorizScrollDelta" "-100"
EndSection</pre>
<p>Enjoy!</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/PhEziKIrYUA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/308/a-better-magic-trackpad-experience-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/308/a-better-magic-trackpad-experience-in-linux/</feedburner:origLink></item>
		<item>
		<title>Patching btusb to enable compatibility with the BCM20702A0 chip</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/DC8liG7SDcM/</link>
		<comments>http://blog.tkassembled.com/301/patching-btusb-to-enable-compatibility-with-the-bcm20702a0-chip/#comments</comments>
		<pubDate>Thu, 13 Dec 2012 00:26:03 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=301</guid>
		<description><![CDATA[I just recently built a brand new machine and noticed that I wasn&#8217;t seeing my Bluetooth chip. After a bunch of digging, I found that my Broadcom combo chip which came with my ASUS Maximus V motherboard hosted both a &#8230; <a href="http://blog.tkassembled.com/301/patching-btusb-to-enable-compatibility-with-the-bcm20702a0-chip/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p><img src="http://blog.tkassembled.com/u/2012/01/preferences-system-bluetooth.png" alt="" title="Bluetooth Icon" width="96" height="96" class="alignleft size-full wp-image-278" />
<p>I just recently built a brand new machine and noticed that I wasn&#8217;t seeing my Bluetooth chip. After a bunch of digging, I found that my Broadcom combo chip which came with my ASUS Maximus V motherboard hosted both a BCM43228 WiFi module and a BCM20702A0 Bluetooth module. Stranger still is that the Bluetooth chip is actually an embedded USB device running on the PCI port.</p>
<p><span id="more-301"></span></p>
<p>In any case, due to Ubuntu/upstream kernel backports policy, it doesn&#8217;t look like a fix will be backported down to current versions of the Linux kernel and it seems that this patch won&#8217;t be included till kernel 3.8, which is a long way away as I sit here typing on kernel 3.2. After a bunch of hacking, I finally came up with a way to activate the card and use it, and have also came up with a DKMS module for the patch so that kernel updates won&#8217;t break the patch. This may void your warranty and I accept no responsibility for anything, at all, ever. This is written for Debian and Ubuntu derivatives, but may work on other distributions.</p>
<p>Before doing anything, verify that you have the same card as me before you go through any of this madness. Make sure that if you run <code>lsusb | grep "0b05:e042"</code>, you see some output. If you don&#8217;t, you&#8217;re don&#8217;t have the same card as me and this fix won&#8217;t help you at all.</p>
<p>First, download your build environment for building the Linux kernel.</p>
<pre>sudo apt-get install build-essential linux-headers-$(uname -r)
apt-get source linux-source 3.2.0</pre>
<p>Don&#8217;t run that second line as root. Note that I didn&#8217;t write <code>sudo apt-get source linux-source-3.2.0</code>. I wrote <code>apt-get source linux-3.2.0</code> and I meant it. It&#8217;s not a typo.</p>
<p>Now, cd into your new kernel source directory: <code>./linux-source-3.2.0</code>. We&#8217;re going to manually patch the <code>btusb</code> driver in order to enable support for our card. Open up <code>./drivers/bluetooth/btusb.c</code> in your favorite editor and find a line that looks like this:</p>
<pre>/* Broadcom BCM20702A0 */</pre>
<p>Immediately underneath that line, add the following line:</p>
<pre>{ USB_DEVICE(0x0b05, 0x17b5) }</pre>
<p>This will match your Bluetooth card&#8217;s hardware id.</p>
<p>Now, download the Bash scripts and DKMS configuration file from <a href="https://gist.github.com/4272952">this Gist</a> and put them in your current Linux kernel source directory. Make sure to <code>chmod +x *.sh</code> to enable the Bash scripts to run.</p>
<p>Finally, copy over everything in this directory to <code>/usr/src/btusb-0.6</code>. We&#8217;ll now test building the module. If everything went correctly, the following two commands will build and install the kernel module, restarting Bluetooth in the process, allowing you to see your beautiful Bluetooth card:</p>
<pre>sudo dkms build -m btusb -v 0.6
sudo dkms install -m btusb -v 0.6</pre>
<p>Now, enjoy your Bluetooth chip. Seriously.</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/DC8liG7SDcM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/301/patching-btusb-to-enable-compatibility-with-the-bcm20702a0-chip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/301/patching-btusb-to-enable-compatibility-with-the-bcm20702a0-chip/</feedburner:origLink></item>
		<item>
		<title>HTML5 Semantics</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/jcHHRyayP3I/</link>
		<comments>http://blog.tkassembled.com/292/html5-semantics/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 20:38:02 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[semantics]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=292</guid>
		<description><![CDATA[HTML5 Doctor just posted an excellent article complete with this chart for determining how best to use new HTML5 semantic tags such as &#60;article&#62;, &#60;section&#62;, etc. I&#8217;ve reencoded the orignal PDF as a PNG and attached it here. While semantics &#8230; <a href="http://blog.tkassembled.com/292/html5-semantics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p style="text-align:justify;"><a href="http://blog.tkassembled.com/u/2012/04/h5d-sectioning-flowchart.png"><img src="http://blog.tkassembled.com/u/2012/04/h5d-sectioning-flowchart-150x150.png" alt="" title="HTML5Doctor Semantics Flowchart" width="150" height="150" class="alignleft size-thumbnail wp-image-293" style="float:left;"/></a><a href="http://html5doctor.com/">HTML5 Doctor</a> just posted <a href="http://html5doctor.com/lets-talk-about-semantics/">an excellent article</a> complete with <a href="http://html5doctor.com/downloads/h5d-sectioning-flowchart.pdf">this chart</a> for determining how best to use new HTML5 semantic tags such as <code>&lt;article&gt;</code>, <code>&lt;section&gt;</code>, etc. I&#8217;ve reencoded the orignal PDF as a PNG and attached it <a href="http://blog.tkassembled.com/u/2012/04/h5d-sectioning-flowchart.png">here</a>. While semantics are hotly debated, this at the very least should serve as a good starting point for site layout in HTML5.</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/jcHHRyayP3I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/292/html5-semantics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/292/html5-semantics/</feedburner:origLink></item>
		<item>
		<title>Fix Bluetooth on a MacBook Pro 8,1/2/3 with B43</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/Do8cR2UKM4I/</link>
		<comments>http://blog.tkassembled.com/276/fix-bluetooth-on-a-macbook-pro-8123-with-b43/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 00:16:37 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[b43]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[macbook-pro]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=276</guid>
		<description><![CDATA[If you&#8217;ve been following the blog, you probably noticed that I recently had a lot of issues with Bluetooth on my MacBook Pro running Ubuntu, and then had them resolved by an awesome commenter. Apparently, if you disable Bluetooth coexistence &#8230; <a href="http://blog.tkassembled.com/276/fix-bluetooth-on-a-macbook-pro-8123-with-b43/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p><img style="float:left;margin:20px 10px 10px 0;" title="Bluetooth Icon" src="http://blog.tkassembled.com/u/2012/01/preferences-system-bluetooth.png" alt="" width="96" height="96" />
<p style="text-align: justify;">
If you&#8217;ve been following the blog, you probably noticed that I recently <a href="http://blog.tkassembled.com/188/macbook-pro-83-bluetooth-issues-on-linux/">had a lot of issues with Bluetooth on my MacBook Pro running Ubuntu</a>, and then <a href="http://blog.tkassembled.com/188/macbook-pro-83-bluetooth-issues-on-linux/#comment-362">had them resolved</a> by an awesome commenter. Apparently, if you <em>disable</em> Bluetooth coexistence protection in the B43 driver, then Bluetooth will be able to coexist with WiFi. I have no idea how this makes sense, so don&#8217;t ask <img src='http://blog.tkassembled.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align:justify;">I demonstrated how to do this with <code>modprobe</code>:</p>
<pre># remove b43
sudo modprobe -r b43
# reinsert b43, with the right settings
sudo modprobe b43 btcoex=0</pre>
<p style="text-align:justify;">Unfortunately, this doesn&#8217;t work permanently, as whenever you reboot, the B43 driver is loaded with the evil Bluetooth coexistence setting enabled (again, this means that Bluetooth will <em>not</em> work). Thus, we need a permanent solution! Pop open your favorite text editor as root and edit <code>/etc/modprobe.d/options</code> and append the following line:</p>
<pre>options b43 btcoex=0</pre>
<p style="text-align:justify;">Voila! Go ahead and reboot to test your settings. No more modprobing every time you boot!</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/Do8cR2UKM4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/276/fix-bluetooth-on-a-macbook-pro-8123-with-b43/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/276/fix-bluetooth-on-a-macbook-pro-8123-with-b43/</feedburner:origLink></item>
		<item>
		<title>Ubuntu 11.10 on a MacBook Pro 8,1/2/3</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/CSORvC2eghw/</link>
		<comments>http://blog.tkassembled.com/208/ubuntu-11-10-on-a-macbook-pro-8123/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 21:13:14 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[macbook-pro]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=208</guid>
		<description><![CDATA[Well, I&#8217;ve done it. I bought a brand spankin&#8217; new MacBook Pro 17&#8243; (model 8,3) for the express purpose of installing Linux on it. Yeah, I&#8217;m crazy. This is a log of all my troubles and travails over the last &#8230; <a href="http://blog.tkassembled.com/208/ubuntu-11-10-on-a-macbook-pro-8123/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-218" title="MacBook-Pro-Ubuntu-Header" src="http://blog.tkassembled.com/u/2012/01/MacBook-Pro-Ubuntu-Header.jpg" alt="" width="584" height="333" />Well, I&#8217;ve done it. I bought a brand spankin&#8217; new MacBook Pro 17&#8243; (model 8,3) <em>for the express purpose of installing Linux on it.</em> Yeah, I&#8217;m crazy. This is a log of all my troubles and travails over the last two weeks getting this thing up and running.</p>
<p><span id="more-208"></span></p>
<p style="text-align: justify;">Of course, I had to come up with rational justifications by which to actually allow myself to in any way support Apple:</p>
<ol>
<li><strong>The deplorable state of notebook hardware and build quality.</strong> Quite honestly, it&#8217;s a <em>joke</em> these days trying to find some awesome notebook hardware to run Linux on. There&#8217;s <a href="http://system76.com">System76</a> and the new Lenovo notebooks, but does anything really even come close in comparison to a MacBook Pro? Stylistically and functionally, this thing is brilliant, bar none.</li>
<li><strong>My work required me to have a super high-powered notebook for travel.</strong> At the time of writing, I&#8217;m getting ready for a business trip and after a number of bad experiences (read: terrible performance) trying to run TeamViewer, Skype, and Eclipse at once, my $500 Gateway notebook had reached the outer limits of its capabilities. It was time to go extreme.</li>
<li><strong>I didn&#8217;t buy it directly from Apple.</strong> I bought it through a reseller to try and take away the hit to my conscience. I&#8217;m kind of idealist when it comes to the way software should be done and I couldn&#8217;t disagree more with Apple&#8217;s closed policy.</li>
</ol>
<p style="text-align: justify;">With all of these <s>excuses</s> rationalizations in hand, I picked this thing up on a trip down to San Diego. I checked with a <a href="http://scottlinux.com/">friend</a> about compatibility, as he had already done much of the footwork of <a href="http://scottlinux.com/2011/06/05/install-linux-mint-11-on-macbook-pro-82/">installing Ubuntu on a MacBook Pro.</a> (Ok, he installed <a href="http://linuxmint.com">Mint</a> but at the end of the day, Mint&#8217;s still just a Ubuntu spin.) Armed with a little bit of information and quite a bit of willpower, I set out to accomplish the unthinkable: installing an open source operating system on a machine made for the highest levels of corporate, proprietary evil. It was time to begin.</p>
<h1>Hardware</h1>
<p style="text-align: justify;">For the record, I got a MacBook Pro with the following specs:</p>
<table>
<tbody>
<tr>
<th>Product Revision</th>
<td>8,3</td>
</tr>
<tr>
<th>Screen Size</th>
<td>17&#8243;</td>
</tr>
<tr>
<th>CPU Type</th>
<td>Intel(R) Core(TM) i7-2760QM</td>
</tr>
<tr>
<th>Core Count</th>
<td>4 physical, 4 virtual = 8 total</td>
</tr>
<tr>
<th>CPU Clock</th>
<td>2.4GHz</td>
</tr>
<tr>
<th>Max Turbo Clock</th>
<td>3.5GHz</td>
</tr>
<tr>
<th>Memory</th>
<td>4GB PCI-10600</td>
</tr>
<tr>
<th>Hard Disk</th>
<td>750GB at 5400RPM</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">Since I was already going all out, I thought I&#8217;d just go all the way with it and manually upgrade the RAM and hard disk:</p>
<table>
<tbody>
<tr>
<th>Memory</th>
<td>8GB PCI-10600</td>
</tr>
<tr>
<th>Hard Disk</th>
<td>Seagate Momentus XT Hybrid Drive, 750GB at 7200RPM</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">If you haven&#8217;t heard of the new hybrid drives, you should really <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16822148837">check them out.</a> Essentially, you have a fast 7200RPM traditional hard disk drive with an integrated solid state drive to make your writes and reads that much faster. They&#8217;re not <a href="http://www.codinghorror.com/blog/2011/05/the-hot-crazy-solid-state-drive-scale.html">pure SSD fast</a>, but it&#8217;s a heck of a lot faster than a 5400RPM drive or a regular 7200RPM hard disk drive. I have definitely noticed a striking performance increase. Again, it&#8217;s not an SSD, but it&#8217;s closer, without compromising on storage space.</p>
<p style="text-align: justify;">I purchased one with a glossy screen because I like the design; it looks beautiful, but is nearly impossible to work on. The glare is so bad, you might as well be programming in front of a mirror at times. The alternative, buying one with a matte screen, was not really an option for me, as the matte displays come with an ugly greyish border around the screen, rather than a sleek black border:</p>
<p><a href="http://blog.tkassembled.com/u/2012/01/mbp17_unbox07.jpg"><img class="aligncenter  wp-image-222" title="mbp17_unbox07" src="http://blog.tkassembled.com/u/2012/01/mbp17_unbox07.jpg" alt="" width="584" height="225" /></a></p>
<p style="text-align: justify;">It looks&#8230; terrible. Whoever thought of putting a grey border around the screen, when black looks SO cool? On the flip side of things, look at the glare from the glossy screen! AM I TAKING CRAZY PILLS?!?</p>
<p style="text-align: justify;">My solution was to buy <a href="http://www.powersupportusa.com/accessories/macbook-pro-17/anti-glare-film.html">one of these,</a> an anti-glare screen cover to allow me to keep my beautiful looking display design AND have a matte display:</p>
<p style="text-align: center;"><a href="http://www.powersupportusa.com/accessories/macbook-pro-17/anti-glare-film.html"><img class="aligncenter  wp-image-230" title="film_macbook_" src="http://blog.tkassembled.com/u/2012/01/film_macbook_.jpg" alt="" width="288" height="360" /></a></p>
<p style="text-align: justify;">Winning! The cover is kind of a pain to put on, but it works great once you get it just right. (If you have any dust anywhere in your home, it will magically stick to your screen while trying to put it on, forming bubbles: not good.) My wife is a total screen protector application master, and we were able to get it on with just about no spots! There&#8217;s a video on how to do it <a href="http://www.youtube.com/watch?v=VAGJnk8X8ZQ">here.</a></p>
<p style="text-align: justify;">Putting the RAM in <a href="http://support.apple.com/kb/ht1270#link6">wasn&#8217;t so hard</a>, though I was a bit paranoid as you can&#8217;t &#8220;undo&#8221; bricking hardware. It went along really nicely and was pretty straightforward.</p>
<p style="text-align: justify;">Installing the hard drive <a href="http://www.extremetech.com/computing/58220-upgrade-your-macbook-pros-hard-drive-2/10">was a little more difficult,</a> but again, not something that was a major deal-breaker. I employed some l337 hacks to copy over the contents of the preexisting drive, then installed it and it worked like a champ.</p>
<h1>Software/Configuration</h1>
<p style="text-align: justify;">Though I thought that hardware would be the main uncharted territory, configuring the operating systems, bootloader, and software was by far the most time consuming. It took me about a week straight to get this thing up to speed. I installed Linux Mint 12 at least once and Ubuntu 11.10 three times, I think, but in the end, I got it working.</p>
<p style="text-align: justify;">The biggest initial barrier to getting this thing running was the bootloader. Since Apple uses something called <a href="http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface">EFI</a> as a bootloader instead of BIOS, which is what you&#8217;re used to, getting things to install entails getting a better bootloader than the locked-down version that Apple has installed by default, which doesn&#8217;t let you do anything &#8220;dangerous&#8221; like have the ability to install other operating systems <img src='http://blog.tkassembled.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: justify;">What we need is a bootloader which will let us run OSX as well as boot into Linux and Windows if we want to. <a href="http://refit.sourceforge.net/">rEFIt</a> &#8220;fits&#8221; the bill, as it&#8217;s the main way of being able to do this. Unfortunately, due to changes in Mac&#8217;s new OSX Lion (10.7.x) operating system, rEFIt isn&#8217;t so easy to install anymore. I tried to auto-install it and it didn&#8217;t show up at all. I then tried to run one of their scripts to enable it always, and it still didn&#8217;t show up. Then I noticed that it wasn&#8217;t letting me log into OSX anymore. Great. Also, before I tried any of this, I realized that OSX wouldn&#8217;t let me use their &#8220;Disk Utility&#8221; program to resize my OSX partition. As I&#8217;m not really planning on using OSX, this was kind of a bummer.</p>
<p style="text-align: justify;">After I schlepped to the Apple Store and met with one of their &#8220;geniuses,&#8221; I was informed that by default, OSX Lion comes with another &#8220;Recovery Partition&#8221; which is hidden from Disk Utility, which was causing my disk resize operations to fail. Again, great. This is what you get when dealing with Apple. I had him reinstall Lion, as <em>it doesn&#8217;t come with any install media whatsoever</em>, as well as resize my OSX partition to be 100GB. He resized it to be 1000<sup>4</sup> bytes, which actually turns out to be around 93GB, but whatever. I almost couldn&#8217;t care less about OSX at this point. In any case, major fail in assuming that a kilobyte is 1000 bytes, etc.)</p>
<p style="text-align: justify;">I came home, made backups and tried to make a restore CD, though that didn&#8217;t really work, and tried again. I installed rEFIt <strong>manually</strong> and things worked great. I simply copied over the <code>efi/</code> folder in the tarball to the root of my OSX partition, then ran the <code>/efi/refit/enable.sh</code> script to enable it (as <code>root</code> of course). I rebooted and, lo and behold, rEFIt!</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-234" title="screen2" src="http://blog.tkassembled.com/u/2012/01/screen2.png" alt="" width="512" height="384" /></p>
<p style="text-align: justify;">Awesomeness! Now it was time to install Linux. Following <a href="http://scottlinux.com/2011/06/05/install-linux-mint-11-on-macbook-pro-82/">Scott&#8217;s guide to installing Linux on a MacBook Pro</a>, I installed Linux Mint 12 (amd64) to a 500GB ext4 partition. I also created a 4GB swap partition, and made sure to install the bootloader <em>not</em> to <code>/dev/sda</code> but instead to my Linux partition, <code>/dev/sda4</code>. Oh, it&#8217;s also important to note that in order to do this, I had to both create a CD/DVD of the install disc in addition to a USB startup disk with the same OS. Plug in the USB stick, insert the CD, and then try installing. Some weird bug, but it wasn&#8217;t too hard to overlook.</p>
<p style="text-align: justify;">Linux Mint installed without a hitch, though I was noticing some glitchiness in the UI, but I assumed it&#8217;d go away when running from the hard disk. It booted up great, and then things started quickly going downhill. Every so often, GNOME Shell or the compositor would flat-out restart. There were other glitchy things about it, but I eventually decided to install Ubuntu 11.10 stock to try and get a better experience.</p>
<p style="text-align: justify;">Ubuntu installed great and Unity, at least for a couple of minutes, was a sight for sore eyes. Things worked a lot better. I compiled the BCM4331 wireless driver and tried to do some major tweaks with the fglrx driver, then figured it&#8217;d probably be better to start from scratch. So I installed Ubuntu again.</p>
<p style="text-align: justify;">Having been through the process a couple times before, it got easier with time. Multitouch worked out of the box with Unity, and I could three-finger pinch to maximize/restore windows and three-finger drag to move windows around. Nice!</p>
<p style="text-align: justify;">As noted elsewhere, the main issue with running Linux on 8,X MacBook Pros is wireless driver support. You either have to wrap the Windows driver with <code>ndiswrapper</code> or compile the current open source driver yourself. I opted for the latter, and it <a href="http://homepage.uibk.ac.at/~c705283/archives/2011/09/04/linux_support_for_broadcom_4331_wireless_chip_macbook_pro_81/index.html">wasn&#8217;t so hard to compile and install.</a> It more or less works great, but there are two outstanding issues with it:</p>
<ol>
<li>It stays connected to the access point, but loses internet capabilities intermittently. This really stinks for long downloads and Skype calls.</li>
<li>It hardcore interferes with Bluetooth. High-bandwidth devices like headphones can hardly connect and if you can actually get them to, they won&#8217;t be clear and consistent. You also can&#8217;t scan for new devices while running the wireless driver. (I lost 4 days of my life to this, more later.)</li>
</ol>
<p>Apart from those issues, there are really only a few things that don&#8217;t work as planned:</p>
<ol>
<li>The trackpad dies every so often. You can still do multi-finger gestures, but moving the cursor fails.</li>
<li>You can only change screen brightness in OSX.</li>
<li>You can&#8217;t change trackpad sensitivity.</li>
<li>In order for things like animations to look smooth, you need to <a href="http://askubuntu.com/questions/39050/how-can-i-speed-up-unity-in-ubuntu-11-04-natty/39976#39976">do this</a>.</li>
<li>You <strong>desperately </strong>need to install a package to control your fans, lest your computer blow up.</li>
</ol>
<p style="text-align: justify;">Please, before you go any further, <a href="https://launchpad.net/~mactel-support/+archive/ppa/+sourcepub/2028802/+listing-archive-extra">download this package and install it</a> if you haven&#8217;t already and you&#8217;re reading this from a MacBook Pro on Ubuntu. Otherwise, your computer <em>will</em> overheat and blow up. Not a good move, bro.</p>
<h1 style="text-align: justify;">Compatibility Chart</h1>
<p style="text-align: justify;">I figured it&#8217;d probably be easier to visualize compatibility with the hardware and software with a nice table describing each item of importance.</p>
<table id="compatibility-chart">
<tbody>
<tr>
<th>Wireless</th>
<td style="vertical-align: middle;padding-left: 20px;padding-right: 20px;">3/5</td>
<td style="text-align: justify;">Like I said, you have to compile your own driver, which isn&#8217;t the easiest thing in the world. It&#8217;s not the hardest, either, but yeah. You also run into some pretty weird issues with Bluetooth, as described below, and you&#8217;ll probably drop your wireless connection now and again, but it works and it&#8217;s getting better as the developers work on it.</td>
</tr>
<tr>
<th>Bluetooth</th>
<td style="vertical-align:middle;padding-left: 20px;padding-right: 20px;">5/5</td>
<td style="text-align:justify;">Bluetooth works <em>great.</em> The only problem involving Bluetooth doesn&#8217;t even directly involve Bluetooth: the wireless driver and the interference it causes.</td>
</tr>
<tr>
<th>Display</th>
<td style="vertical-align:middle;padding-left:20px;padding-right:20px;">4/5</td>
<td style="text-align:justify">Display is pretty awesome, but with a few caveats. </p>
<ul>
<li>You can&#8217;t change the screen brightness from Ubuntu. It can only be changed from OSX. <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/881460">Bug report on Launchpad.</a> Interestingly enough, you <em>can</em>, however, read values from the light sensor near the camera from a terminal.</li>
<li>GPU switching doesn&#8217;t work. You&#8217;ll be running the more power-hungry ATI card all the time. <a href="http://wiki.cchtml.com/index.php/Ubuntu_Oneiric_Installation_Guide#Intel.2FATI_Hybrids">See a wiki on FGLRX support on Ubuntu 11.10.</a></li>
<li>ATI&#8217;s Catalyst Control Center is terrible.</li>
</ul>
<p>Apart from that, everything works great. External display via DisplayPort/Thunderbolt tested and working, and you can get all screen resolutions supported by the hardware. <br/>Some papercuts: when you lock the workspace or the screensaver activates or the display goes off due to inactivity, the keyboard backlight stays on. I&#8217;m not sure if this is a feature or a bug. Also, in order to get your desktop compositor framerate up to speed, you need to <a href="http://askubuntu.com/questions/39050/how-can-i-speed-up-unity-in-ubuntu-11-04-natty/39976#39976">do some CompizConfig hacks.</a> Otherwise, things are terribly choppy. <br/>There&#8217;s also a really weird bug apart from this that when dragging windows the normal way, often it&#8217;ll get really choppy as far as animation is concerned, but if you drag it with multitouch, it&#8217;ll be smooth as butter. I have no idea on this one.
</td>
</tr>
<tr>
<th>Keyboard</th>
<td style="vertical-align:middle;padding-left:20px;padding-right:20px;">4.9/5</td>
<td style="text-align:justify;">Everything basically works, but there&#8217;s one papercut: keyboard backlight buttons work, but they can&#8217;t be held down to change keyboard backlight, you have to keep hitting it in order to change things, which can get annoying. As noted above, the keyboard backlight stays on even when the display shuts off due to inactivity.</td>
</tr>
<tr>
<th>Touchpad</th>
<td style="vertical-align:middle;padding-left:20px;padding-right:20px;">3/5</td>
<td style="text-align:justify">This one&#8217;s kind of touchy. So multitouch works great for the limited actions you can do with it. You can three-finger drag windows, three-finger pinch maximize/restore windows, four-finger tap to open the Unity launcher, four-finger drag to show or hide the Unity bar. Major problems: </p>
<ul>
<li>The touchpad dies every so often and you&#8217;re forced to use a mouse. It&#8217;ll still do multitouch gestures, but it fails to do single-finger gestures. Reboot to fix it: lame.</li>
<li>You&#8217;ll often hit the touchpad and move the mouse when typing. This is entirely a software bug: disable the touchpad for a certain amount of time when keys are hit. You can just disable the touchpad altogether and use a mouse, but that&#8217;s a really lame workaround.</li>
</ul>
</td>
</tr>
<tr>
<th>Suspend/Hibernate</th>
<td style="vertical-align:middle;padding-left:20px;padding-right:20px;">5/5</td>
<td style="text-align:justify">Works great.</td>
</tr>
<tr>
<th>Camera/Microphone</th>
<td style="vertical-align:middle;padding-left:20px;padding-right:20px;">4.5/5</td>
<td style="text-align:justify">Both basically work great. I have noticed, however, that when using Cheese effects, the camera color gets way out of wack. Think entire video in bright pink.</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">In the end, it&#8217;s basically awesome running Ubuntu on a MacBook Pro. This thing is wicked fast and a pleasure to code on. I&#8217;ve been able to encode 1080p HD video at around 60 frames per second. I can run Windows in VirtualBox wicked fast. Hopefully, I&#8217;ll be able to find the time to follow up on this post with an installation guide.</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/CSORvC2eghw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/208/ubuntu-11-10-on-a-macbook-pro-8123/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/208/ubuntu-11-10-on-a-macbook-pro-8123/</feedburner:origLink></item>
		<item>
		<title>MacBook Pro 8,1/8,2/8,3 Bluetooth Issues on Linux</title>
		<link>http://feedproxy.google.com/~r/tkassembled/~3/oRWsMiZJC_E/</link>
		<comments>http://blog.tkassembled.com/188/macbook-pro-83-bluetooth-issues-on-linux/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 04:12:09 +0000</pubDate>
		<dc:creator>TK Kocheran</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[b43]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[macbook-pro]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://blog.tkassembled.com/?p=188</guid>
		<description><![CDATA[Oh, by the way, I just got a shiny new MacBook Pro to run Linux on! Hooray! It&#8217;s an awesome machine, but I just wanted to post this bug to the general public to save people the 3 days I&#8217;ve &#8230; <a href="http://blog.tkassembled.com/188/macbook-pro-83-bluetooth-issues-on-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[
<p style="text-align: justify;">
<img style="float:left;margin:20px 10px 10px 0;" title="Bluetooth Icon" src="http://blog.tkassembled.com/u/2012/01/preferences-system-bluetooth.png" alt="" width="96" height="96"><br />
Oh, by the way, I just got a shiny new MacBook Pro to run Linux on! Hooray! It&#8217;s an awesome machine, but I just wanted to post this bug to the general public to save people the 3 days I&#8217;ve spent trying to figure it out.</p>
<p style="text-align: justify;">Essentially, what it boils down to is this: the b43 Linux driver that you&#8217;ve compiled and installed interferes hardcore with the adjacent Bluetooth chip on your MacBook.</p>
<p style="text-align: justify;">Let&#8217;s do a little test to demonstrate. While connected to a WiFi network with b43, put a Bluetooth device into pairing mode near your machine. Make sure the <code>bluez</code> package is installed. Next, run the following:</p>
<pre>$ hcitool scan
Scanning...</pre>
<p style="text-align: justify;">You&#8217;ll probably see it say <code>Scanning...</code> and then&#8230; nothing. It won&#8217;t see your device. Period.</p>
<p style="text-align: justify;">Let&#8217;s continue with our experiment. Unload the b43 module with <code>sudo rmmod b43</code>. Your internet will go down if you&#8217;re on WiFi. Now, run <code>hcitool scan</code> again.</p>
<pre>$ hcitool scan
Scanning...
    XX:XX:XX:XX:XX:XX    Nexus One</pre>
<p style="text-align: justify;">Aha! Found you! So, it seems that the problem is with the driver itself. This is kind of a bummer, to say the least, but hopefully they&#8217;ll have it patched soon. Until then, <code>sudo modprobe b43</code> and continue on, weary warrior.</p>
<p><small>For the record and for Google, I&#8217;m running a 2011 MacBook Pro 8,3 with Ubuntu 11.10 Oneiric Ocelot 64bit/amd64.</small></p>
<h2>Update: A Working Workaround!</h2>
<p style="text-align: justify;">As noted by Benoit in the comments below, you can actually get things working with a little workaround. First, unload the <code>b43</code> driver from the kernel:</p>
<pre>$ sudo rmmod b43</pre>
<p style="text-align: justify;">Next, reload the module, turning Bluetooth coexistence support <em>off:</em></p>
<pre>$ sudo modprobe b43 btcoex=0</pre>
<p style="text-align: justify;">As counterintuitive as it seems, it works! Hooray! I&#8217;m now able to listen to music with my Bluetooth headphones <em>and</em> use the built in B4331 wireless card in my MacBook at the same time!!! The only issue I&#8217;ve encountered is that when you&#8217;re spiking and getting really high upload/download rates, you&#8217;ll notice that Bluetooth audio skips a bit. Luckily, this is a pretty minimal problem and doesn&#8217;t prevent you from using your Bluetooth or your B4331 WiFi card in your MacBook Pro.</p>

<img src="http://feeds.feedburner.com/~r/tkassembled/~4/oRWsMiZJC_E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.tkassembled.com/188/macbook-pro-83-bluetooth-issues-on-linux/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://blog.tkassembled.com/188/macbook-pro-83-bluetooth-issues-on-linux/</feedburner:origLink></item>
	</channel>
</rss>
