<?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>Up Till 3</title>
	<atom:link href="http://www.uptill3.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.uptill3.com</link>
	<description>3am is when the world is most interesting.</description>
	<lastBuildDate>Sat, 19 Jun 2010 08:17:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Zipping up OOXML files</title>
		<link>http://www.uptill3.com/2010/06/19/zipping-up-ooxml-files/</link>
		<comments>http://www.uptill3.com/2010/06/19/zipping-up-ooxml-files/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 08:17:06 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.uptill3.com/?p=180</guid>
		<description><![CDATA[For future records, when creating OOXML files from scratch, make sure to use the &#8216;-D&#8217; option to not store directory entries in the ZIP archive.  This makes the Office apps choke (at least on OS X).

Here&#8217;s an example of an Excel created XLSX file:
Monstar:n adam$ unzip -l finances
Archive:  finances
  Length   [...]]]></description>
			<content:encoded><![CDATA[<p>For future records, when creating OOXML files from scratch, make sure to use the &#8216;-D&#8217; option to not store directory entries in the ZIP archive.  This makes the Office apps choke (at least on OS X).<br />
<span id="more-180"></span><br />
Here&#8217;s an example of an Excel created XLSX file:<br />
<code>Monstar:n adam$ unzip -l finances<br />
Archive:  finances<br />
  Length     Date   Time    Name<br />
 --------    ----   ----    ----<br />
     1432  01-01-80 00:00   [Content_Types].xml<br />
      588  01-01-80 00:00   _rels/.rels<br />
      972  01-01-80 00:00   xl/_rels/workbook.xml.rels<br />
      828  01-01-80 00:00   xl/workbook.xml<br />
     5547  01-01-80 00:00   xl/styles.xml<br />
     6646  01-01-80 00:00   xl/worksheets/sheet2.xml<br />
     7562  01-01-80 00:00   xl/theme/theme1.xml<br />
    22807  01-01-80 00:00   xl/worksheets/sheet1.xml<br />
     5595  01-01-80 00:00   xl/sharedStrings.xml<br />
     2375  01-01-80 00:00   xl/calcChain.xml<br />
      615  01-01-80 00:00   docProps/core.xml<br />
      829  01-01-80 00:00   docProps/app.xml<br />
 --------                   -------<br />
    55796                   12 files</p>
<p></code><br />
To recreate that after editting, use the following command:<br />
<code>Monstar:n adam$ zip -rD finances.xlsx *<br />
  adding: [Content_Types].xml (deflated 75%)<br />
  adding: _rels/.rels (deflated 60%)<br />
  adding: docProps/app.xml (deflated 52%)<br />
  adding: docProps/core.xml (deflated 49%)<br />
  adding: xl/_rels/workbook.xml.rels (deflated 73%)<br />
  adding: xl/calcChain.xml (deflated 77%)<br />
  adding: xl/sharedStrings.xml (deflated 86%)<br />
  adding: xl/styles.xml (deflated 85%)<br />
  adding: xl/theme/theme1.xml (deflated 79%)<br />
  adding: xl/workbook.xml (deflated 46%)<br />
  adding: xl/worksheets/sheet1.xml (deflated 82%)<br />
  adding: xl/worksheets/sheet2.xml (deflated 76%)<br />
</code></p>
<p>This will yield a file like:<br />
<code><br />
Monstar:n adam$ unzip -l finances.xlsx<br />
Archive:  finances.xlsx<br />
  Length     Date   Time    Name<br />
 --------    ----   ----    ----<br />
     1432  01-01-80 00:00   [Content_Types].xml<br />
      588  01-01-80 00:00   _rels/.rels<br />
      829  01-01-80 00:00   docProps/app.xml<br />
      615  01-01-80 00:00   docProps/core.xml<br />
      972  01-01-80 00:00   xl/_rels/workbook.xml.rels<br />
     2375  01-01-80 00:00   xl/calcChain.xml<br />
     5595  01-01-80 00:00   xl/sharedStrings.xml<br />
     5547  01-01-80 00:00   xl/styles.xml<br />
     7562  01-01-80 00:00   xl/theme/theme1.xml<br />
      828  01-01-80 00:00   xl/workbook.xml<br />
    22807  01-01-80 00:00   xl/worksheets/sheet1.xml<br />
     6646  01-01-80 00:00   xl/worksheets/sheet2.xml<br />
 --------                   -------<br />
    55796                   12 files</p>
<p></code><br />
If you skip the &#8216;-D&#8217; option, you end up with a zip file that looks like this:<br />
<code><br />
Monstar:n adam$ unzip -l finances2.xlsx<br />
Archive:  finances2.xlsx<br />
  Length     Date   Time    Name<br />
 --------    ----   ----    ----<br />
     1432  01-01-80 00:00   [Content_Types].xml<br />
        0  06-19-10 04:05   _rels/<br />
      588  01-01-80 00:00   _rels/.rels<br />
        0  06-19-10 04:05   docProps/<br />
      829  01-01-80 00:00   docProps/app.xml<br />
      615  01-01-80 00:00   docProps/core.xml<br />
    16222  06-19-10 04:13   finances<br />
    13477  06-19-10 04:08   finances.xlsx<br />
        0  06-19-10 04:05   xl/<br />
        0  06-19-10 04:05   xl/_rels/<br />
      972  01-01-80 00:00   xl/_rels/workbook.xml.rels<br />
     2375  01-01-80 00:00   xl/calcChain.xml<br />
     5595  01-01-80 00:00   xl/sharedStrings.xml<br />
     5547  01-01-80 00:00   xl/styles.xml<br />
        0  06-19-10 04:05   xl/theme/<br />
     7562  01-01-80 00:00   xl/theme/theme1.xml<br />
      828  01-01-80 00:00   xl/workbook.xml<br />
        0  06-19-10 04:05   xl/worksheets/<br />
    22807  01-01-80 00:00   xl/worksheets/sheet1.xml<br />
     6646  01-01-80 00:00   xl/worksheets/sheet2.xml<br />
 --------                   -------<br />
    85495                   20 files<br />
</code><br />
All of those &#8216;0&#8242; length directory entries make Excel puke.</p>
<p>
Additionally, note that you have to add the file extension &#8216;.xlsx&#8217; (or appropriate for your OOXML file type) in order for Office to open the file after you&#8217;ve created it (even though the Office created files don&#8217;t have extensions by default).  I think there is a way to add metadata that determines the MIME type, and would solve this problem, but that may be a OS X Office problem only.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uptill3.com/2010/06/19/zipping-up-ooxml-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon EC2 Pricing Analysis</title>
		<link>http://www.uptill3.com/2010/06/03/amazon-ec2-pricing-analysis/</link>
		<comments>http://www.uptill3.com/2010/06/03/amazon-ec2-pricing-analysis/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 01:39:49 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.uptill3.com/?p=153</guid>
		<description><![CDATA[This is part 1 of a 4 part series on EC2.
Part 1 &#8211; EC2 Background
What is EC2?
EC2, or &#8216;Elastic Compute Cloud&#8217; is a primary component of AWS (&#8216;Amazon Web Services&#8217;).  EC2 is Amazon&#8217;s market offering for cloud computing.  EC2 allows individuals and organizations the ability to run a full instance of their favorite version of [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part 1 of a 4 part series on EC2.</em></p>
<h1>Part 1 &#8211; EC2 Background</h1>
<h2>What is EC2?</h2>
<p>EC2, or &#8216;Elastic Compute Cloud&#8217; is a primary component of AWS (&#8216;Amazon Web Services&#8217;).  EC2 is Amazon&#8217;s market offering for cloud computing.  EC2 allows individuals and organizations the ability to run a full instance of their favorite version of Linux or Windows on Amazon&#8217;s gear &#8211; the same gear, ostensibly, that runs Amazon.com itself.  Users are given the opportunity to host their systems, applications, and files in Amazon&#8217;s data centers, on Amazon&#8217;s bandwidth and Internet connectivity, and run everything on Amazon&#8217;s server hardware (including redundant storage, power, etc.).<br />
<span id="more-153"></span></p>
<h2>What is an AMI?</h2>
<p>EC2 is primarily competing with the colocation and shared hosting providers.  Users that pick EC2 typically do so because of the previously mentioned platform benefits, as well as it&#8217;s extreme flexibility in deployment capabilities.  Unlike traditional colocation or shared hosting, where putting 30 new servers into production is an arduous, expensive task &#8211; possibly involving paying remote help for racking, configuring all the gear, burning in all of the equipment, etc., EC2 uses an entirely virtual setup.  <a href="http://www.uptill3.com/wp-content/uploads/2010/06/AMI.png"><img class="alignright size-full wp-image-169" title="AMI" src="http://www.uptill3.com/wp-content/uploads/2010/06/AMI.png" alt="An AMI can spawn many instances." width="298" height="296" /></a>Bringing up 300 new servers (called &#8216;instances&#8217;) is no more difficult or time consuming than deploying 1.  This is accomplished by way of what Amazon calls an <a title="Amazon AMI documentation" href="http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=171">AMI</a>, or &#8216;Amazon Machine Image&#8217;.  AMIs are basically special instances of disk images that are copied and booted on demand by the EC2 system.  If you are familiar with VMWare, it is much like the VMDK files used &#8211; except it is cloned and booted, rather than run directly (this is what gives you the flexibility to stand up multiple instances all in one go).</p>
<h2>Who uses EC2?</h2>
<p>What companies and individuals would use EC2?  A number of high profile websites, including the<a title="The New York Times" href="http://www.nytimes.com/"> New York Times</a>, <a title="reddit.com" href="http://www.reddit.com">Reddit.com</a>, and <a title="SmugMug" href="http://www.smugmug.com/">SmugMug</a> utilize EC2 for a variety of reasons.  Some companies chose to use EC2 for expanding their data-crunching needs (the New York Times <a title="NYT use of EC2 for data crunching" href="http://open.blogs.nytimes.com/2008/05/21/the-new-york-times-archives-amazon-web-services-timesmachine/">does this</a>), while others host their entire site on it (Reddit.com <a title="Reddit moved to the cloud in 2009" href="http://blog.reddit.com/2009/11/moving-to-cloud.html">does this</a>).  Another significant user of AWS are individual developers or small teams &#8211; the overhead and initial cost to get a server up and running, while retaining full control of it, are extremely minimal &#8211; a few hours of work to prep an AMI (or, no time at all to use an AMI from the <a title="Browse Amazon AMI library by provider." href="http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=200">AMI library</a>!), and a cost of pennies an hour in most cases.</p>
<h2>EC2 Limitations</h2>
<p>EC2 is not without it&#8217;s limitations however &#8211; operating system choice is limited, as are some network services (such as email &#8211; EC2 is <a title="EC2/AWS RBL status" href="http://blog.commtouch.com/cafe/miscellaneous/spamhaus-unblocks-mail-from-amazon-ec2-–-sort-of/">on many RBLs</a>, unfortunately).  Despite being on Amazon&#8217;s highly redundant cloud, there are still outages (<a title="Outage at NoVa datacenter" href="http://searchcloudcomputing.techtarget.com/news/article/0,289142,sid201_gci1378426,00.html">including some fairly long ones</a>) &#8211; nobody is perfect.</p>
<div>
<p>To work around such limitations, and to leverage an extended amount of reliability and Amazon engineering there are 2 major concepts that must be understood &#8211; regions and availability zones.</p>
<h2>Regions</h2>
<p>Regions are basically exactly what they sound like &#8211;  a specific geographic region used by Amazon to host EC2.  Amazon currently offers EC2 hosting in 4 regions around the world &#8211; Northern Virginia, Northern California, Northern Ireland, and Asia Pacific (Singapore).<a href="http://www.uptill3.com/wp-content/uploads/2010/06/Regions.png"><img class="alignright size-full wp-image-170" title="Regions" src="http://www.uptill3.com/wp-content/uploads/2010/06/Regions.png" alt="EC2 is available in 4 regions world wide" width="362" height="222" /></a></p>
<h2>Availability Zones</h2>
<p>Within these regions, there are different availability zones.  Availability zones allow users to run instances in the same region, but on physically diverse infrastructure &#8211; separate diesel generators, power racks, disk storage, etc.  This allows for users to work around potential outages and problems, by leveraging Amazon&#8217;s large scale data center engineering, and provides another big benefit over colocation or shared hosting (how easy is it to guarantee 2 of your servers with one provider are on different generators?).</p>
<h2>AWS API</h2>
<p>Amazon allows you to fully utilize all of this flexibility and capability via their <a title="AWS API EC2 Tools" href="http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=88&amp;externalID=351">AWS API</a>.  This is a SOAP based web service that provides all management functionality &#8211; everything from starting new instances to changing security keys.  The use of the API allows many otherwise time consuming and arduous system administration tasks to be completely automated.</p>
<p>Part 2 will continue on with an overview of the EC2 pricing model &#8211; what a specific server instance will cost you is not quite as straight forward as it could be.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.uptill3.com/2010/06/03/amazon-ec2-pricing-analysis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Sneak Peak</title>
		<link>http://www.uptill3.com/2010/04/20/a-sneak-peak/</link>
		<comments>http://www.uptill3.com/2010/04/20/a-sneak-peak/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 06:58:37 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.uptill3.com/?p=133</guid>
		<description><![CDATA[I&#8217;m working on an extensive post about the market dynamics and pricing of Amazon&#8217;s AWS EC2 Spot Instance market.  Here&#8217;s a sneak peak:

]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on an extensive post about the market dynamics and pricing of Amazon&#8217;s AWS EC2 Spot Instance market.  Here&#8217;s a sneak peak:</p>
<p><a href="http://www.uptill3.com/wp-content/uploads/2010/04/ec2-prices-sneakpeak.png"><img class="alignnone size-full wp-image-138" title="EC2 Price Analysis Sneak Peak" src="http://www.uptill3.com/wp-content/uploads/2010/04/ec2-prices-sneakpeak.png" alt="" width="424" height="276" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uptill3.com/2010/04/20/a-sneak-peak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Forensics Sans iPhone</title>
		<link>http://www.uptill3.com/2010/04/20/iphone-forensics-sans-iphone/</link>
		<comments>http://www.uptill3.com/2010/04/20/iphone-forensics-sans-iphone/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 06:27:36 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone security]]></category>

		<guid isPermaLink="false">http://www.uptill3.com/?p=123</guid>
		<description><![CDATA[This is a presentation I developed and gave at HRGeeks ][, on March 14.  The bulk of this was original research.
Grab the PDF here.
iPhone forensics, without the iPhone
		
]]></description>
			<content:encoded><![CDATA[<p>This is a presentation I developed and gave at HRGeeks ][, on March 14.  The bulk of this was original research.</p>
<p>Grab the PDF <a href="http://www.uptill3.com/static/iphone_forensics.pdf">here.</a></p>
<p><strong><a title="iPhone forensics, without the iPhone" href="http://www.slideshare.net/hrgeeks/iphone-forensics-without-the-iphone">iPhone forensics, without the iPhone</a></strong>
<p>		<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=iphoneforensics-100320001916-phpapp02&amp;stripped_title=iphone-forensics-without-the-iphone" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=iphoneforensics-100320001916-phpapp02&amp;stripped_title=iphone-forensics-without-the-iphone" allowscriptaccess="always" allowfullscreen="true"></embed></object></p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uptill3.com/2010/04/20/iphone-forensics-sans-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python MySQLdb snippet</title>
		<link>http://www.uptill3.com/2008/01/15/python-mysqldb-snippet/</link>
		<comments>http://www.uptill3.com/2008/01/15/python-mysqldb-snippet/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 06:10:51 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.uptill3.com/2008/01/15/python-mysqldb-snippet/</guid>
		<description><![CDATA[So, for the past few weeks, I&#8217;ve been hacking around with Python&#8217;s MySQLdb DBAPI v2 driver.  After getting so used to mysqli in PHP, the move to MySQLdb was a mixed bag &#8211; some things are awesome, others not so much. 
 First the awesome &#8211; it&#8217;s so much cleaner to do safe, simple [...]]]></description>
			<content:encoded><![CDATA[<p>So, for the past few weeks, I&#8217;ve been hacking around with <a href="http://www.python.org">Python&#8217;s</a> <a href="http://mysql-python.sourceforge.net/">MySQLdb DBAPI v2 driver</a>.  After getting so used to <a href="http://us3.php.net/manual/en/ref.mysqli.php">mysqli</a> in PHP, the move to MySQLdb was a mixed bag &#8211; some things are awesome, others not so much. </p>
<p> First the awesome &#8211; it&#8217;s so much cleaner to do safe, simple queries with python&#8217;s dbapi, than with the PHP mysqli stuff.  Just call <code class="prettyprint">cursor.execute(query, arguments)</code> and pass in your SQL and it&#8217;s arguments, and all the escaping and safety stuff is taken care of behind the scenes.  No ugly hacks to check to see if something is a digit or a string and to properly escape/format the final query for you. In addition to that, connecting and setting the character set and forcing the driver to use unicode is all just 2 little options passed in the <code class="prettyprint">connect()</code> method.</p>
<p> Now, the not so awesome &#8211; I really liked <code class="prettyprint"><a href="http://us3.php.net/mysqli_fetch_assoc">mysqli_fetch_assoc()</a></code> for returning data from the database in a easy to use form &#8211; an associate array (in case it wasn&#8217;t obvious!).  <a href="http://www.python.org/dev/peps/pep-0249/">DBAPI </a>drivers for python do not provide such a feature out of the box &#8211; your data comes back as a tuple, rather than a dict.  While this makes some sense, the lack of a way to get a dict back seems to be rather un-pythonic.  It violates the &#8216;Explicit is better than implicit&#8217; and &#8216;Beautiful is better than ugly&#8217;  <a href="http://www.python.org/dev/peps/pep-0020/">Zen of Python aphorisms</a>.  It requires implicit accessing of your data, as you must use tuple slices/subscripts instead of keywords to the dict, and that requires ugly numbers dropped into the otherwise easily readable code. </p>
<p> In an effort to save myself some trouble, here&#8217;s a quick way to emulate the fetch_assoc functionality, built in to a generator function so it can be used easily in &#8216;for&#8217; statements and the like:</p>
<pre class="prettyprint">
#!/usr/bin/env python
# Requires a version of python that supports generator functions (2.3+)
import  MySQLdb

connection = MySQLdb.connect(host="localhost", user="username", passwd="passwd", db="myInstance", use_unicode=True, charset="utf8")
cursor = connection.cursor()
def query(query, args):
        numRows = cursor.execute(query, args)
        tries = 0
        dbKeys = cursor.description
        row = {}
        while tries < numRows:
                tries = tries + 1
                dbRow = cursor.fetchone()
                for item, key in zip(dbRow, dbKeys):
                        row[key[0]] = item
                yield row

sql = """SELECT foo, bar FROM baz WHERE id = %(id)s"""
args = {'id':'adam'}

for rows in query(sql, args):
        print rows
</pre>
<p>That outputs:</p>
<pre class="prettyprint">
	{'foo': u'fooValue', 'bar':'barValue'}
	{'foo': u'fooValue2', 'bar':'barValue2'}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.uptill3.com/2008/01/15/python-mysqldb-snippet/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
