<?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>In Re:</title>
	<atom:link href="http://inre.dundeemt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://inre.dundeemt.com</link>
	<description>(Because some things just can&#039;t go unsaid)</description>
	<lastBuildDate>Thu, 01 Dec 2011 07:38:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A date with JSON?</title>
		<link>http://inre.dundeemt.com/2011-12-01/a-date-with-json/</link>
		<comments>http://inre.dundeemt.com/2011-12-01/a-date-with-json/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 07:22:34 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/?p=73</guid>
		<description><![CDATA[I&#8217;ve run in to this situation a few times and end up having to query my gBrain for the answer. When using json as a transport from python to html/javascript, I frequently end up needing to move date and time data. However, the builtin json module is not happy when you ask it to serialize <a href='http://inre.dundeemt.com/2011-12-01/a-date-with-json/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve run in to this situation a few times and end up having to query my <a href="https://www.google.com/" target="_blank">gBrain</a> for the answer.  When using json as a transport from python to html/javascript, I frequently end up needing to move date and time data.  However, the builtin <a href="http://docs.python.org/library/json.html" target="_blank">json module</a> is not happy when you ask it to serialize a date/time object.</p>
<pre class="brush: python; title: ; wrap-lines: true; notranslate">
&gt;&gt;&gt; json.dumps(datetime.datetime.now())
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/lib/python2.6/json/__init__.py&quot;, line 230, in dumps
    return _default_encoder.encode(obj)
  File &quot;/usr/lib/python2.6/json/encoder.py&quot;, line 367, in encode
    chunks = list(self.iterencode(o))
  File &quot;/usr/lib/python2.6/json/encoder.py&quot;, line 317, in _iterencode
    for chunk in self._iterencode_default(o, markers):
  File &quot;/usr/lib/python2.6/json/encoder.py&quot;, line 323, in _iterencode_default
    newobj = self.default(o)
  File &quot;/usr/lib/python2.6/json/encoder.py&quot;, line 344, in default
    raise TypeError(repr(o) + &quot; is not JSON serializable&quot;)
TypeError: datetime.datetime(2011, 12, 1, 0, 50, 53, 152215) is not JSON serializable
</pre>
<p>So this means we need to figure out a work around.  The trick is to let the json module know what it should do with a date/time object while leaving the rest of it in place.  So, no replacing the default handler.</p>
<p>What we need to do is subclass the JSONEncoder and override the default method</p>
<pre class="brush: python; title: ; notranslate">
class JSONEncoder(json.JSONEncoder):
    def default(self, obj):
        if hasattr(obj, 'isoformat'): #handles both date and datetime objects
            return obj.isoformat()
        else:
            return json.JSONEncoder.default(self, obj)
</pre>
<p>Using the <a href="http://docs.python.org/library/functions.html#hasattr" target="_blank">hasattr</a> and looking for &#8216;isoformat&#8217; method will allow this to handle both date objects and datetime objects.  So all that is left to demonstrate is how to put it together with the json.dumps method.</p>
<pre class="brush: python; title: ; notranslate">
&gt;&gt;&gt; json.dumps(datetime.datetime.now(), cls=JSONEncoder)
'&quot;2011-12-01T00:58:34.479929&quot;'
</pre>
<p>Ok, so now you have this ISO formatted string containing date information, how do you get that converted to a javascript date object once it has been transmitted across the abyss and now resides in a javscript callback function?</p>
<pre class="brush: jscript; title: ; notranslate">
var d = new Date(&quot;2011-12-01T00:58:34.479929&quot;);
</pre>
<p>Happy Data Slinging!</p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2011-12-01/a-date-with-json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting more out of android.py</title>
		<link>http://inre.dundeemt.com/2011-11-29/getting-more-out-of-android-py/</link>
		<comments>http://inre.dundeemt.com/2011-11-29/getting-more-out-of-android-py/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 05:49:03 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/?p=61</guid>
		<description><![CDATA[So, I&#8217;m hacking on a Python for Android project, which is built over top of the SL4A project. I&#8217;m currently using the remote method of development where you fire up an interpreter and share it in public mode. Then you import android.py and instantiate an instance of Android with IP and Port information of your <a href='http://inre.dundeemt.com/2011-11-29/getting-more-out-of-android-py/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;m hacking on a Python for Android project, which is built over top of the SL4A project.  I&#8217;m currently using the remote method of development where you fire up an interpreter and share it in public mode.  Then you import android.py and instantiate an instance of Android with IP and Port information of your public server.  You can then hack in your favorite editor on a laptop instead of using a thumb-board or other.  It looks like this:</p>
<pre class="brush: python; title: ; notranslate">
import android  # The SL4A android.py module should be on your sys.path.

ip = '192.168.x.xxxx'
port = 35766
droid = android.Android((ip, port))
</pre>
<p>What happens is the __getattr__ method of the Android object uses magic to change droid.getenvironment() into an RPC call to the public server and then return the result back as a named tuple.  Nice.  Being the nosey bugger that I tend to be, I modified the code to add a debug param to the __init__ method, that when set, would print out what was being sent out over RPC and then the raw tuple results.   A snippet of the modification goes like this:</p>
<pre class="brush: python; title: ; notranslate">
  def __getattr__(self, name):
    def rpc_call(*args):
      if self._debug:
          print &quot;droid.%s%s&quot; % (name, str(args))
      res = self._rpc(name, *args)
      if self._debug:
          print &quot;\t%s&quot; % str(res)
      return res
    return rpc_call
</pre>
<p>You can easily see where I put my &#8220;if self._debug&#8221; logic in place.  Now if I use my modified android.py I can turn on the debug flag and get some 411 on the magic that is going on.  It ends up looking like this:</p>
<pre class="brush: plain; title: ; notranslate">
droid.eventWait(3000,)
	Result(id=28, result=None, error=None)
droid.eventWait(3000,)
	Result(id=29, result={u'data': u'@end', u'name': u'dmt:fromClient.speak', u'time': 1322542655069000L}, error=None)
droid.wakeLockRelease()
	Result(id=30, result=None, error=None)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2011-11-29/getting-more-out-of-android-py/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SL4A, Python, webViewShow &#8211; a faster dev mode</title>
		<link>http://inre.dundeemt.com/2011-11-26/sl4a-python-webviewshow-a-faster-dev-mode/</link>
		<comments>http://inre.dundeemt.com/2011-11-26/sl4a-python-webviewshow-a-faster-dev-mode/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 06:13:10 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/?p=46</guid>
		<description><![CDATA[While I was playing around with Python for Andoid, I was using the webViewShow method to load an interactive html page and set up message passing both from html/js -> python and from python -> html/js Part of this requires that I knock out and hack some html/js code. However, I am using the Remote <a href='http://inre.dundeemt.com/2011-11-26/sl4a-python-webviewshow-a-faster-dev-mode/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>While I was playing around with <a href="http://code.google.com/p/python-for-android/">Python for Andoid</a>, I was using the <a href="http://code.google.com/p/android-scripting/wiki/UsingWebView">webViewShow method</a> to load an interactive html page and set up message passing both from </p>
<p>  <strong>html/js -> python</strong> </p>
<p>and from </p>
<p>  <strong>python -> html/js</strong> </p>
<p>Part of this requires that I knock out and hack some html/js code.  However, I am using the <a href="http://code.google.com/p/android-scripting/wiki/RemoteControl">Remote method with a public server</a> on my android device, since I am too lazy to set up eclipse and a full blown android dev env.  The example code they show, uses an html file located on the sdcard of the device.  Of course this brings its own problems, since now I have to mount, edit, unmount between each hack cycle.  Ick.  Well I could just tell it to load the html from an off device server, but being lazy ( I think I mentioned that already. ) I didn&#8217;t want to rsync back and forth to my remote server, set up directories, etc.  Also, I didn&#8217;t want to set up a Django install just to serve a hacky html script. </p>
<p>So I think to myself, man there has to be some light-weight way to serve this up locally while I&#8217;m hacking.  So I think, hey CherryPy, but then I remember <a href="http://edna.sourceforge.net/">Edna</a> and it hits me, I can serve static pages out of a directory with just python.  A little google-fu and <a href="http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python">this page</a> appears, giving just the needed incantation.</p>
<pre class="brush: python; title: ; notranslate"> python -m SimpleHTTPServer 8080</pre>
<p>Which happily serves everything out of the directories below it on the specified port (8080 in this case).  I make a little adjustment in to my webViewShow and change it from file:///  to http://my-dev-ip:8080/thefile.html and all is good with the world.  As I hack, changes to the html are pulled and served immediately.</p>
<p>Did I mention, <strong>Python Rocks!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2011-11-26/sl4a-python-webviewshow-a-faster-dev-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obituary for netbooks off the mark</title>
		<link>http://inre.dundeemt.com/2008-11-23/obituary-for-netbooks-off-the-mark/</link>
		<comments>http://inre.dundeemt.com/2008-11-23/obituary-for-netbooks-off-the-mark/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 22:48:36 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[netbook]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/2008-11-23/obituary-for-netbooks-off-the-mark/</guid>
		<description><![CDATA[InRe: Jason Chen on why the netbook market is dead in three years &#124; T3 magazine Jason&#8217;s reasons for netbook&#8217;s demise, underpowered for Windows and underoutfitted for Windows, while true to a degree, are not going to be the reasons for any so called demise of the netbook market.&#160; What he is really talking about <a href='http://inre.dundeemt.com/2008-11-23/obituary-for-netbooks-off-the-mark/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>InRe: <a href="http://www.t3.com/news/jason-chen-on-why-the-netbook-market-is-dead-in-three-years?=37342">Jason Chen on why the netbook market is dead in three years | T3 magazine</a></p>
<p>Jason&#8217;s reasons for netbook&#8217;s demise, underpowered for Windows and underoutfitted for Windows, while true to a degree, are not going to be the reasons for any so called demise of the netbook market.&nbsp; What he is really talking about is a failure of Windows, both XP and Vista.&nbsp; Netbooks are not small laptops just as miniature golf is not golf in miniature.&nbsp; They are a different class of device, bigger than a phone but smaller than a laptop.&nbsp; Trying to run windows on a netbook is as frustrating as a phone with windows mobile.&nbsp; Microsoft is becoming less relevant in the fastest growing market segment.</p>
<p>While I agree that what we now call netbooks (screen &lt; 10 inches) may dissappear in three years it won&#8217;t be because of consumer apathy but because the device platform will become wildly popular and manufacturers will struggle to differentiate themselves.&nbsp; Jason goes on to compare netbooks with tablet PCs but that analogy is false.&nbsp; There have only been a handful of tablet PC platforms, where as the market is exploding with netbook devices. </p>
<p>His closing statement about price and weight is exactly what will sustain the market.&nbsp; At a price of 1/3 to 1/4 of a full featured light weight laptop, more people can afford to have both a laptop and a netbook.&nbsp; If they were to buy the MacBook Air or X360 they would have to live with the tradeoffs they bring.&nbsp; A netbook/laptop combo comes in 1/4 less the cost.</p>
<p>
<blockquote></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-11-23/obituary-for-netbooks-off-the-mark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CrossOver Chromium vs. Firefox 3 &#8211; Javascript performance results</title>
		<link>http://inre.dundeemt.com/2008-09-15/crossover-chromium-vs-firefox-3-javascript-performance-results-2/</link>
		<comments>http://inre.dundeemt.com/2008-09-15/crossover-chromium-vs-firefox-3-javascript-performance-results-2/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 03:04:55 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/2008-09-15/crossover-chromium-vs-firefox-3-javascript-performance-results-2/</guid>
		<description><![CDATA[An interesting thing happened on my way to the web today. While reading through my rss feeds, I came across a story about CrossOver doing a Proof of Concept port of Chromium to CX. Interesting since the mighty &#8220;g&#8221; can&#8217;t seem to get it together for Linux. I&#8217;ve already downloaded and played with Chromium at <a href='http://inre.dundeemt.com/2008-09-15/crossover-chromium-vs-firefox-3-javascript-performance-results-2/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>An interesting thing happened on my way to the web today.  While reading through my rss feeds, I came across a story about CrossOver doing a <a href="http://www.codeweavers.com/services/ports/chromium/">Proof of Concept port of Chromium to CX</a>.  Interesting since the mighty &#8220;g&#8221; can&#8217;t seem to get it together for Linux.  I&#8217;ve already downloaded and played with Chromium at work on my XP box and was impressed with the speed.  It seemed much snappier than FF3.</p>
<p>So being an overly curious bugger, I downloaded the deb pkg for Ubuntu32.  Yeah, it looks pretty rough &#8212; but what the hey, it&#8217;s a PoC right?  So, I thought maybe a little speed test is called for, so I <a href="http://www.google.com/search?q=javascript+test">googled &#8220;javascript test&#8221;</a> and my cloud brain returned, &#8220;<a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html">Sunspider JavaScript Benchmark</a>&#8220;.</p>
<p>So I fired it up in the cxChromium port and then it the standard FF3 on Ubuntu.  Here is what I saw for <a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?%7B%223d-cube%22:%5B44,37,43,38,43%5D,%223d-morph%22:%5B64,61,56,61,56%5D,%223d-raytrace%22:%5B50,45,44,46,45%5D,%22access-binary-trees%22:%5B7,9,9,8,8%5D,%22access-fannkuch%22:%5B36,36,55,36,36%5D,%22access-nbody%22:%5B37,38,48,36,44%5D,%22access-nsieve%22:%5B25,22,22,22,23%5D,%22bitops-3bit-bits-in-byte%22:%5B7,7,7,7,7%5D,%22bitops-bits-in-byte%22:%5B14,14,14,15,15%5D,%22bitops-bitwise-and%22:%5B24,22,25,23,23%5D,%22bitops-nsieve-bits%22:%5B33,33,38,33,39%5D,%22controlflow-recursive%22:%5B5,5,5,4,5%5D,%22crypto-aes%22:%5B25,25,24,28,25%5D,%22crypto-md5%22:%5B23,23,25,22,22%5D,%22crypto-sha1%22:%5B22,22,21,21,22%5D,%22date-format-tofte%22:%5B257,250,242,248,244%5D,%22date-format-xparb%22:%5B139,169,137,134,137%5D,%22math-cordic%22:%5B82,80,93,85,100%5D,%22math-partial-sums%22:%5B45,47,45,47,46%5D,%22math-spectral-norm%22:%5B17,17,17,18,17%5D,%22regexp-dna%22:%5B395,386,385,387,391%5D,%22string-base64%22:%5B99,93,79,95,81%5D,%22string-fasta%22:%5B69,64,64,63,65%5D,%22string-tagcloud%22:%5B171,227,162,167,164%5D,%22string-unpack-code%22:%5B220,215,212,214,243%5D,%22string-validate-input%22:%5B95,91,95,95,94%5D%7D">cxChromium</a>.   I then swing over with FF3 and get <a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?%7B%223d-cube%22:%5B206,208,203,205,204%5D,%223d-morph%22:%5B177,175,176,176,175%5D,%223d-raytrace%22:%5B188,190,180,183,183%5D,%22access-binary-trees%22:%5B78,75,75,75,74%5D,%22access-fannkuch%22:%5B271,275,274,275,270%5D,%22access-nbody%22:%5B217,243,227,219,215%5D,%22access-nsieve%22:%5B86,113,91,85,86%5D,%22bitops-3bit-bits-in-byte%22:%5B87,92,91,91,87%5D,%22bitops-bits-in-byte%22:%5B103,110,107,102,102%5D,%22bitops-bitwise-and%22:%5B129,121,122,124,122%5D,%22bitops-nsieve-bits%22:%5B139,141,141,150,141%5D,%22controlflow-recursive%22:%5B57,57,57,57,57%5D,%22crypto-aes%22:%5B107,108,108,104,107%5D,%22crypto-md5%22:%5B87,87,88,88,87%5D,%22crypto-sha1%22:%5B87,91,92,89,92%5D,%22date-format-tofte%22:%5B314,316,315,310,311%5D,%22date-format-xparb%22:%5B202,199,199,203,200%5D,%22math-cordic%22:%5B226,229,228,227,228%5D,%22math-partial-sums%22:%5B231,242,232,213,241%5D,%22math-spectral-norm%22:%5B98,99,99,102,99%5D,%22regexp-dna%22:%5B363,415,409,413,408%5D,%22string-base64%22:%5B163,169,166,164,168%5D,%22string-fasta%22:%5B278,279,279,275,279%5D,%22string-tagcloud%22:%5B227,234,234,225,234%5D,%22string-unpack-code%22:%5B472,494,524,531,476%5D,%22string-validate-input%22:%5B179,177,173,177,162%5D%7D">these results</a>.&nbsp;&nbsp; Javascript in FF3 is 2.44x slower than cxChromium.&nbsp; Man oh Man, is the v8 javascript engine a hummer.</p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-09-15/crossover-chromium-vs-firefox-3-javascript-performance-results-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google App Engine &#8212; Auto-Increment vs. UUIDs</title>
		<link>http://inre.dundeemt.com/2008-04-27/google-app-engine-auto-increment-vs-uuids/</link>
		<comments>http://inre.dundeemt.com/2008-04-27/google-app-engine-auto-increment-vs-uuids/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 15:45:42 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/?p=40</guid>
		<description><![CDATA[App Engine is a pretty dramatic thought departure for lots of programmers who are used to writing an app that runs on a single server and access a single database.&#160; Case in point, there has been a recurring topic of auto-increment fields on the&#160; App Engine list &#8212; people trying to implement their own version <a href='http://inre.dundeemt.com/2008-04-27/google-app-engine-auto-increment-vs-uuids/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>App Engine is a pretty dramatic thought departure for lots of programmers who are used to writing an app that runs on a single server and access a single database.&nbsp; Case in point, there has been a recurring topic of auto-increment fields on the&nbsp; <a target="_blank" href="http://groups.google.com/group/google-appengine/topics">App Engine list</a> &#8212; people trying to implement their own version of it since it is not a native datastore type.</p>
<p>Using an auto-increment field is not the way to go.&nbsp; It is viable when you only have 1 database but the datastore for your app is going to/can be <a target="_blank" href="http://code.google.com/appengine/docs/gettingstarted/usingdatastore.html">replicated</a> out to other machines.&nbsp; This would mean that their exists times, when <b>datastore&#8217; != datastore&#8221;</b> &#8212; over time datastore&#8217; would be sync&#8217;d with datastore&#8221; so that datastore&#8217; == datastore&#8221;&nbsp;&nbsp; &#8212; this would lead one to believe that there will be times when the idea of an auto-increment field will not be synchronizable or that the result of the synchronization would be less than satisfactory.&nbsp; My belief that auto-increment fields are the wrong idea in this environment is strengthened by the fact that they are not offered as an intrinsic datatype.</p>
<p>The way to go, in my opinion, is to use UUIDs. (see links below)<br />
&nbsp; <a target="_blank" href="http://docs.python.org/lib/module-uuid.html">http://docs.python.org/lib/module-uuid.html</a><br />
&nbsp; <a target="_blank" href="http://www.faqs.org/rfcs/rfc4122.html">http://www.faqs.org/rfcs/rfc4122.html<br />
</a></p>
<p>Other Thoughts on the topic:</p>
<ul>
<li>data access is very expensive, using a UUID should be faster</li>
<li>UUID1 or UUID4 would be the types to consider</li>
<li>UUID1 is preferable as it would introduce some machine significance which should make the chances for a collision to be even more remote than for a UUID4 (random)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-04-27/google-app-engine-auto-increment-vs-uuids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greedy Coin Changer</title>
		<link>http://inre.dundeemt.com/2008-04-26/greedy-coin-changer/</link>
		<comments>http://inre.dundeemt.com/2008-04-26/greedy-coin-changer/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 17:44:16 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/2008-04-26/greedy-coin-changer/</guid>
		<description><![CDATA[Noah Gift over on O&#8217;Reilly OnLamp Blog has an article on building a greedy coin changer. That is, given a value, say 71 cents, calculate the fewest coins needed to make the amount. He had listed a number of solutions, but I felt I could do it a bit more pythonic. The benefits of this <a href='http://inre.dundeemt.com/2008-04-26/greedy-coin-changer/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Noah Gift over on <a target="_blank" href="http://www.oreillynet.com/onlamp/blog/2008/04/python_greedy_coin_changer_alg.html">O&#8217;Reilly OnLamp Blog</a> has an article on building a greedy coin changer. That is, given a value, say 71 cents, calculate the fewest coins needed to make the amount.  He had listed a number of solutions, but I felt I could do it a bit more pythonic. <img src='http://inre.dundeemt.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/env python
&quot;&quot;&quot;implement a greedy coin changer, returning the
fewest coins to make the change requested.&quot;&quot;&quot;
#coin_list can be expanded to include silver dollars
# and 50 cent pieces by just expanding the coin list
# to [100,50,25,10,5,1] the reulting answer
#structure will modify itself to reflect 

coin_list = [25,10,5,1]
change_requested = .71
remaining = change_requested * 100
change_returned = []    #result structure

for coin in coin_list:
    num_coins,remaining =  divmod(remaining,coin)
    change_returned.append(int(num_coins))

print change_returned
print remaining
</pre>
<p>The benefits of this version, are no conditional logic is needed, the coin structure can be modified and the answer will modify itself accordingly.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-0248134143928603";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-04-26/greedy-coin-changer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google App Engine &#8212; Runs on Python</title>
		<link>http://inre.dundeemt.com/2008-04-08/google-app-engine-runs-on-python/</link>
		<comments>http://inre.dundeemt.com/2008-04-08/google-app-engine-runs-on-python/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 03:23:56 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/2008-04-08/google-app-engine-runs-on-python/</guid>
		<description><![CDATA[Now this is truly an interesting development. Google&#8217;s just announced App Engine is sure to super-charge the Python community and convert a number of disillusioned developers of other languages in to Pythonistas. There have been lots of interesting comments floating in the blogosphere about what this could mean. I think it is a great opportunity <a href='http://inre.dundeemt.com/2008-04-08/google-app-engine-runs-on-python/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Now this is truly an interesting development.  Google&#8217;s <a target="_blank" href="http://googleblog.blogspot.com/2008/04/developers-start-your-engines.html">just announced</a> <a target="_blank" href="http://code.google.com/appengine/">App Engine </a>is sure to super-charge the Python community and convert a <img style="max-width: 800px; float: right; margin-top: 10px; margin-bottom: 10px; margin-left: 10px;" src="http://code.google.com/appengine/images/appengine_lowres.jpg" /> number of disillusioned developers of other languages in to Pythonistas.    There have been lots of interesting comments floating in the blogosphere about what this could mean.</p>
<p>I think it is a great opportunity on a smaller scale than anyone might imagine.  Sure, this could serve as the platform for the next <em>YouTube</em> type social-2.x site, but what I think this really means, is that Google is rounding out the <a target="_blank" href="http://www.google.com/a/help/intl/en/index.html">Google Apps for Domains</a> by giving the ability to create something more than a <em>brochure-ware</em> style site offered by their current <a target="_blank" href="http://www.google.com/a/help/intl/en/users/sites.html">Sites for Google Apps</a>.</p>
<p>Many are looking for Google to use this as an opportunity to expand advertising revenue, and that is certainly possible for widely popular webX.x sites but what they really needed is another tool/knife to hold to the competition&#8217;s throats.  Looking at the tea leaves in the bottom of my glass, I see something more akin to a <a target="_blank" href="http://www.microsoft.com/sharepoint/default.mspx">SharePoint</a> attack;  Going after the <b>S</b> in <b>SMB</b> market.</p>
<p>App Engine allows for authenticating users via Google system, how much longer until we can interact with other Google services in a similar fashion?? Calendaring, GTalk, etc &#8212; I&#8217;m not talking mashups, something much more refined.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-04-08/google-app-engine-runs-on-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating Checklists with nose</title>
		<link>http://inre.dundeemt.com/2008-01-22/automating-checklists-with-nose/</link>
		<comments>http://inre.dundeemt.com/2008-01-22/automating-checklists-with-nose/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 02:29:45 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Business]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/2008-01-22/automating-checklists-with-nose/</guid>
		<description><![CDATA[Grig has an interesting post today about enforcing checklists via nose, Agile Testing: Joel on checklists&#160; Now that is an interesting idea.&#160; I do lots of PCI compliance testing and documenting the tests and procedures is par for the course.&#160; Automating those procedures goes a long way in helping out in this regard. Dora, handles <a href='http://inre.dundeemt.com/2008-01-22/automating-checklists-with-nose/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Grig has an interesting post today about enforcing checklists via <a href="http://somethingaboutorange.com/mrl/projects/nose/">nose</a>, <a href="http://agiletesting.blogspot.com/2008/01/joel-on-checklists.html">Agile Testing: Joel on checklists</a>&nbsp;  Now that is an interesting idea.&nbsp; I do lots of PCI compliance testing and documenting the tests and procedures is par for the course.&nbsp; Automating those procedures goes a long way in helping out in this regard. Dora, handles scheduling, running and reporting which makes life nice, but I&#8217;ve got a variety of scripts and it would be nice to unify them in overall architecture.&nbsp; Using nose could do just that.</p>
<p>Interesting things/thoughts happen when your programmers are sys-admins too.&nbsp; This idea of translating the framework we use for testing code to testing systems has a number of interesting dimensions to it.&nbsp; Just like <a href="http://www.altonbrown.com/">Alton Brown</a>, I insist that my tools multi-task too.</p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-01-22/automating-checklists-with-nose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acknowledging the Elephant in Development</title>
		<link>http://inre.dundeemt.com/2008-01-22/acknowledging-the-elephant-in-development/</link>
		<comments>http://inre.dundeemt.com/2008-01-22/acknowledging-the-elephant-in-development/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 05:41:14 +0000</pubDate>
		<dc:creator>JeffH</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://inre.dundeemt.com/2008-01-22/acknowledging-the-elephant-in-development/</guid>
		<description><![CDATA[There is a great article over on SnapLogic,&#160; SnapLogic Blog Squishy design with Python: Designing in code The gist of the article is that when developing APIs are never as complete as we want them when we are developing a new system and if you are using a static language you&#8217;ve got lots of ramifications <a href='http://inre.dundeemt.com/2008-01-22/acknowledging-the-elephant-in-development/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>There is a great article over on SnapLogic,&nbsp; <a href="http://blog.snaplogic.org/?p=135">SnapLogic Blog  Squishy design with Python: Designing in code</a></p>
<p>The gist of the article is that when developing APIs are never as complete as we want them when we are developing a new system and if you are using a static language you&#8217;ve got lots of ramifications to consider and code to rework when you have to expand an API.&nbsp; However, dynamic languages have a real advantage here and they go on to give a very real example and how they dealt with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://inre.dundeemt.com/2008-01-22/acknowledging-the-elephant-in-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

