<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>New WebSite http://iwebthereforeiam.com</title>
    <link rel="alternate" type="text/html" href="http://iwebthereforeiam.com/" />
    <link rel="self" type="application/atom+xml" href="http://iwebthereforeiam.com/atom.xml" />
    <id>tag:iwebthereforeiam.com,2012-10-02://4</id>
    <updated>2010-03-22T15:19:21Z</updated>
    
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 5.2</generator>

<entry>
    <title>Actual powers of Congress - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2010/03/actual-powers-of-congress.html" />
    <id>tag:www.iwebthereforeiam.com,2010:/iwebthereforeiam//1.1576</id>

    <published>2010-03-22T15:11:55Z</published>
    <updated>2010-03-22T15:19:21Z</updated>

    <summary>Here are the things that Congress is actually empowered to do. Congressional actions outside this list are actually unconstitutional:: The Congress shall have power to lay and collect taxes, duties, imposts and excises, to pay the debts and provide for...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>Here are the things that <a href="http://topics.law.cornell.edu/constitution/articlei">Congress is actually empowered to do</a>. Congressional actions outside this list are actually unconstitutional:</p>:

<blockquote class="quote"><p>The Congress shall have power to lay and collect taxes, duties, imposts and excises, to pay the debts and provide for the common defense and general welfare of the United States; but all duties, imposts and excises shall be uniform throughout the United States;<p></p>

To borrow money on the credit of the United States;<p></p>

To regulate commerce with foreign nations, and among the several states, and with the Indian tribes;<p></p>

To establish a uniform rule of naturalization, and uniform laws on the subject of bankruptcies throughout the United States;<p></p>

To coin money, regulate the value thereof, and of foreign coin, and fix the standard of weights and measures;<p></p>

To provide for the punishment of counterfeiting the securities and current coin of the United States;<p></p>

To establish post offices and post roads;<p></p>

To promote the progress of science and useful arts, by securing for limited times to authors and inventors the exclusive right to their respective writings and discoveries;<p></p>

To constitute tribunals inferior to the Supreme Court;<p></p>

To define and punish piracies and felonies committed on the high seas, and offenses against the law of nations;<p></p>

To declare war, grant letters of marque and reprisal, and make rules concerning captures on land and water;<p></p>

To raise and support armies, but no appropriation of money to that use shall be for a longer term than two years;<p></p>

To provide and maintain a navy;<p></p>

To make rules for the government and regulation of the land and naval forces;<p></p>

To provide for calling forth the militia to execute the laws of the union, suppress insurrections and repel invasions;<p></p>

To provide for organizing, arming, and disciplining, the militia, and for governing such part of them as may be employed in the service of the United States, reserving to the states respectively, the appointment of the officers, and the authority of training the militia according to the discipline prescribed by Congress;<p></p>

To exercise exclusive legislation in all cases whatsoever, over such District (not exceeding ten miles square) as may, by cession of particular states, and the acceptance of Congress, become the seat of the government of the United States, and to exercise like authority over all places purchased by the consent of the legislature of the state in which the same shall be, for the erection of forts, magazines, arsenals, dockyards, and other needful buildings;--And<p></p>

To make all laws which shall be necessary and proper for carrying into execution the foregoing powers, and all other powers vested by this Constitution in the government of the United States, or in any department or officer thereof.</p></blockquote>]]>
        
    </content>
</entry>

<entry>
    <title>Amazon books - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2010/02/amazon-books.html" />
    <id>tag:www.iwebthereforeiam.com,2010:/iwebthereforeiam//1.1575</id>

    <published>2010-02-22T17:52:40Z</published>
    <updated>2010-02-22T17:53:19Z</updated>

    <summary>I&apos;ve set up a seller account on Amazon. Buy my books!...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>I've set up a seller account on Amazon. <a href="http://www.amazon.com/shops/A1G3CW0EO9UFS9">Buy my books!</a></p>
]]>
        
    </content>
</entry>

<entry>
    <title>Microsoft 7 RC testers must pave machines - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2010/02/microsoft-7-rc-testers-must-pave-machines.html" />
    <id>tag:www.iwebthereforeiam.com,2010:/iwebthereforeiam//1.1574</id>

    <published>2010-02-16T17:58:58Z</published>
    <updated>2010-02-16T18:05:35Z</updated>

    <summary>I&apos;m as much of a Microsoft fanboy as the next, but this recent email to Windows 7 RC users put me off a bit: It&apos;s time to upgrade from the Windows 7 Release Candidate While most people who tested Windows...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term="Microsoft" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>I'm as much of a Microsoft fanboy as the next, but this recent email to Windows 7 RC users put me off a bit:</p>

<blockquote class="quote"><h2>It's time to upgrade from the Windows 7 Release Candidate</h2>

<p>While most people who tested Windows 7 have now moved to the final version, some are still running the Release Candidate. If you haven't moved yet, it's time to replace the RC.</p>

<p>Starting on March 1, 2010 your PC will begin shutting down every two hours. Your work will not be saved during the shutdown.</p>

<p>The Windows 7 RC will fully expire on June 1, 2010. Your PC running the Windows 7 RC will continue shutting down every two hours and your files won't be saved during shutdown. In addition, your wallpaper will change to a solid black background with a persistent message on your desktop. You'll also get periodic notifications that Windows isn't genuine. That means your PC may no longer be able to obtain optional updates or downloads requiring genuine Windows validation.</p>

<p>To avoid interruption, please reinstall a prior version of Windows or move to Windows 7. In either case, <b>you'll need to do a custom (clean) install to replace the RC. As with any clean installation, you'll need to back up your data then reinstall your applications and restore the data.</b> For more details about replacing the RC, see the Knowledge Base article KB 971767. For more information, visit the Window 7 Forum.</p>

<p>Thanks again for helping us test Windows 7.</p>
</blockquote>

<p>When I installed Windows 7 RC, I had to re-install all my programs:</p>
<ul>
<li>Microsoft Office</li>
<li>all my development tools</li>
<li>my favorite text editor</li>
<li>screen capture application</li>
<li>WInSCP</li>
<li>Git+Mercurial+SVN</li>
<li>python (Django, Twisted, PIL, numpy, setup-tools+pip+virtualenv, fabric, nltk, etc.)</li>
<li>WinZip</li>
<li>Adobe *</li>
<li>Paint.NET</li>
<li>WinDirStat</li>
<li>a zillion other things.</li>
</ul>
<p>I was reluctant to do it. If I had known that installing this RC would require me to reinstall the universe twice, I'd never have put it on my machine. Thanks, Microsoft!</p>
]]>
        
    </content>
</entry>

<entry>
    <title>Double full full full - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2010/02/double-full-full-full.html" />
    <id>tag:www.iwebthereforeiam.com,2010:/iwebthereforeiam//1.1573</id>

    <published>2010-02-07T22:22:50Z</published>
    <updated>2010-02-07T22:25:03Z</updated>

    <summary>Awesome video from flixxy.com: United States Olympic Aerialist Ryan St. Onge and Science reporter Henry Fountain, break down the &quot;double full full full&quot;, a jump St. Onge may perform at the Winter Olympics 2010 in Vancouver. Flixxy video...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term="video" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>Awesome video from flixxy.com:</p>
<blockquote class="quote"><p>United States Olympic Aerialist Ryan St. Onge and Science reporter Henry Fountain, break down the "double full full full", a jump St. Onge may perform at the Winter Olympics 2010 in Vancouver. </p></blockquote>
<a href="http://www.flixxy.com/aerial-skiing-winter-olympics.htm">Flixxy video</a>

]]>
        
    </content>
</entry>

<entry>
    <title>OpenCandy - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2010/02/opencandy.html" />
    <id>tag:www.iwebthereforeiam.com,2010:/iwebthereforeiam//1.1572</id>

    <published>2010-02-07T22:14:02Z</published>
    <updated>2010-02-07T22:22:29Z</updated>

    <summary>I upgraded my copy of WinSCP &quot;(WinSCP is an open source free SFTP client and FTP client for Windows. Legacy SCP protocol is also supported. Its main function is safe copying of files between a local and a remote computer.&quot;)...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term="software" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>I upgraded my copy of <a href="http://www.winscp.com/">WinSCP</a> "(WinSCP is an open source free SFTP client and FTP client for Windows. Legacy SCP protocol is also supported. Its main function is safe copying of files between a local and a remote computer.") last night and during the installation, I was offered <a href="http://www.xobni.com">Xobni</a> to install, too. It looked cool, so I installed it. I upgraded at home and was offered <a href="http://www.wefi.com">WeFi</a>. I liked that so I installed it, too.</p>

<p>By now, I was intrigued. I checked up on <a href="http://www.opencandy.com/">OpenCandy</a>, the company that does the offers, and found that there is a network of companies that allow additional products to be pushed out during the installation of their products. It looks to me as if all of the products are pretty cool, but here are my favorites:</p>

<ul>
<li><a href="http://www.memeoconnect.com/">MemeoConnect</a>
</li><li><a href="http://www.primopdf.com/index.aspx">PrimoPDF</a>
</li><li><a href="http://www.techsmith.com/">TechSmith</a>
</li><li><a href="http://www.zumodrive.com/">ZumoDrive</a>
</li>
</ul>

]]>
        
    </content>
</entry>

<entry>
    <title>Russian tunnel of death - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2010/02/russian-tunnel-of-death.html" />
    <id>tag:www.iwebthereforeiam.com,2010:/iwebthereforeiam//1.1571</id>

    <published>2010-02-06T23:00:32Z</published>
    <updated>2010-02-06T23:05:14Z</updated>

    <summary>My friend Michael Chepovetsky forwarded me this video link from inside an underground roadway in Russia with this explanation: The 3150 meter Lefortovo Tunnel in Russia is the longest in-city tunnel in the world. It is nicknamed The Tunnel of...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term="video" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>My friend Michael Chepovetsky forwarded me <a href="http://www.chepovetsky.com/pr/mov/RussianTunnelofDeath.wmv">this video link</a> from inside an underground roadway in Russia with this explanation:</p>

<blockquote class="quote"><p>The 3150 meter Lefortovo Tunnel  in Russia is the longest in-city tunnel in the world. It is nicknamed <i>The Tunnel of Death</i>. See for yourself why. There is a river running over the tunnel and water leaks through in some areas. When the temperature reaches nearly 0°C (as it does during winter in Russia), and the road freezes. The result is the attached video which were taken during a single day with the tunnel's surveillance camera.</p>

<p>Congratulations to the dual-carriage bus driver - imagine the passengers in
the back! What a ride! The next time you complain about traffic, remember
this video... Russian Engineering!</p></blockquote>

<p>According to <a href="http://en.wikipedia.org/wiki/Lefortovo_tunnel">wikipedia</a>, the video is a compilation and not necessarily over a single day. Still.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Comment CAPTCHA compromised on Movable Type and WordPress? - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/12/comment-captcha-compromised-on-movable-type-and-wordpress.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1570</id>

    <published>2009-12-08T15:27:24Z</published>
    <updated>2009-12-08T15:31:03Z</updated>

    <summary>The number of google-able spam comments I have started to get on my blog in the past two weeks suggests that the CAPTCHA from Movable Type that I use is compromised; it looks as if there is an automatic way...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>The number of google-able spam comments I have started to get on my blog in the past two weeks suggests that the CAPTCHA from Movable Type that I use is compromised; it looks as if there is an automatic way to identify CAPTCHA images. And googling for these comments shows that many WordPress blogs are falling for this, too. I'd be interested to see comments (but not spam comments!) on this point.</p>
]]>
        
    </content>
</entry>

<entry>
    <title>Github subtree merge - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/12/github-subtree-merge.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1569</id>

    <published>2009-12-03T14:44:57Z</published>
    <updated>2011-06-08T20:59:47Z</updated>

    <summary>I had a GIT problem on GitHub. I had projects in a directory hierarchy like this: root/src/lang1/project1 root/src/lang1/project2 root/src/lang1/project3 ... that were in Git locally. Each was a separate Git repository. I then tried to (1) move the source to...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    <category term="git" label="git" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="github" label="github" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>I had a GIT problem on GitHub. I had projects in a directory hierarchy like this:</p>
<pre><blockquote class="prettyprint">    root/src/lang1/project1
    root/src/lang1/project2
    root/src/lang1/project3
    ...</blockquote></pre>
<p>that were in Git locally. Each was a separate Git repository. I then tried to (1) move the source to GitHub and (2) add other projects that were at the same level or higher:</p>
<pre><blockquote class="prettyprint">    root/src/lang2/project-x
    root/src/lang3/project-y
    root/release/...
    root/docs/...
    ...</blockquote></pre>
<p>And Git took my intentions the wrong way. Instead of a single hierarchical repository from root/ down, I then had all of the stuff in root/ down except the lang1/ directories were all islands which GitHub thought of as submodules. Except not quite. These projects did not display with subfolders -- they displayed with the submodule icon, but I couldn't get the source from GitHub via them.</p>

<p>The fix was quite easy once I'd contacted tech support at github and exchanged email with Tekkub. He recommended this <a href="http://help.github.com/subtree-merge/">URL</a> for a description of how to merge a subtree. I ended up with a script like this:</p>
<pre><blockquote class="prettyprint"># Put repository at
#    ../temp/DazUtility/DazUtilitySetup
# into subtree at
#     vb.net/DazUtility/DazUtilitySetup
git remote add -f A ../temp/DazUtility/DazUtilitySetup
git merge -s ours --no-commit A/master
git read-tree --prefix=vb.net/DazUtility/DazUtilitySetup A/master
git commit -m "Merge with DazUtilitySetup"
git push
git remote rm A</blockquote></pre>

<p>Using the <em>ours</em> strategy for the merge did not work with all my projects and I ended up using <em>resolve</em> in one case:</p>
<pre><blockquote class="prettyprint">git merge -s resolve --no-commit A/master</blockquote></pre>

<p>One final word: tech support at Github is awesome: fast and knowledgeable with great follow-up.</p>
]]>
        
    </content>
</entry>

<entry>
    <title>I am not much into reading... - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/12/i-am-not-much-into-reading.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1568</id>

    <published>2009-12-03T03:30:35Z</published>
    <updated>2009-12-03T15:19:21Z</updated>

    <summary>Okay, if you get this blog remark: Dude.. I am not much into reading, but somehow I got to read lots of articles on your blog. Its amazing how interesting it is for me to visit you very often. then...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    <category term="spam" label="spam" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>Okay, if you get this blog remark:</p>
<blockquote class="quote">Dude.. I am not much into reading, but somehow I got to read lots of articles on your blog. Its amazing how interesting it is for me to visit you very often.</blockquote>
<p>then you have <a href="http://www.google.com/#hl=en&q=%22I+am+not+much+into+reading%22">spam</a>.</p>

<br /><hr /><br />

<p>Update 2009-12-03: Similarly, if you get </p>
<blockquote class="quote">"Good post mate!! Keep 'em flowing!"</blockquote>
<p>then you have <a href="http://www.google.com/#hl=en&source=hp&q="Good+post+mate!!+Keep+'em+flowing!"">spam</a>. I guess comment spammers are going for generic remarks that look like they are paying attention to the blog's content as an alternative to, say, having a genuine interest in the blog's content.</p>
]]>
        
    </content>
</entry>

<entry>
    <title>My so-called life - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/11/my-so-called-life.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1567</id>

    <published>2009-11-14T02:43:25Z</published>
    <updated>2009-11-14T15:22:37Z</updated>

    <summary>Contract programming Translating VBA to VB.NET for use in a web-distributed Excel product; Access 2007 programming for managing the workflow of telemarketers in a company that re-sold telecomm services until they closed the telemarketing business. The first is actually cool,...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<ol><li>Contract programming
<p>Translating VBA to VB.NET for use in a web-distributed Excel product; Access 2007 programming for managing the workflow of telemarketers in a company that re-sold telecomm services until they closed the telemarketing business.
</p><p>
The first is actually cool, if you do any Windows work. For a start, the state of Excel and .NET integration is locked in 2005. You can't write VB.NET/C# UDFs that are called directly from an Excel cell. You have to expose the functions in a COM server, and the runtime burdens that imposes are annoying. For a start, calling Excel from the COM server is an order of magnitude slower than VBA within Excel, so I ended up re-implementing a lot of Excel functions in VB.NET: statistical functions, portfolio analytics, financial functions, etc.</p></li>

<li>Meetups and conferences
<p>Meetup.com provides a lot of opportunities to network. I go to NYC-Python, django-nyc, NYC .NET, and Alt.NET regularly.</p></li>

<li>Interviews, job searches
<p>I had a good interview this week and the company is making very encouraging noises. They've given me a programming assignment to complete this weekend.</p></li>

<li>Pro bono work
<p>Django programming for a micro-finance company that uses the Django admin to manage their volunteers.</p></li>

<li>Travel
<p>I was at DjangoCon in Portland in September followed by ten days in Spain. I have some family time coming up over Thanksgiving and Christmas.</p>
<p>Recent discovery: Tripit.com is great for keeping track of your travel. In particular, it is great for having a single point to track all your airmiles.</p></li>

<li>Show-and-tell dates
<p>I've recently concluded that having projects to show is way more important than a resume. No one gets my resume. Taking my laptop to meet friends and Meetup.com-types for coffee is a fairly productive networking technique.</p></li>
</ol>
]]>
        
    </content>
</entry>

<entry>
    <title>Stupefying Django error - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/10/stupefying-django-error.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1564</id>

    <published>2009-10-29T20:10:59Z</published>
    <updated>2009-10-29T20:21:03Z</updated>

    <summary>Wow. I spent a lot of time on this this afternoon. I had a Django application with an admin interface. Every time I tried to create an object with no foreign keys, I got this error on the save: Traceback...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term="Django" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="programming" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="python" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>Wow. I spent a lot of time on this this afternoon. I had a Django application with an admin interface. Every time I tried to create an object with no foreign keys, I got this error on the save:</p>

<pre class="prettyprint">
Traceback (most recent call last):

  File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 279, in run
    self.result = application(self.environ, self.start_response)

  File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 651, in __call__
    return self.application(environ, start_response)

  File "C:\Python26\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
    response = self.get_response(request)

  File "C:\Python26\lib\site-packages\django\core\handlers\base.py", line 134, in get_response
    return self.handle_uncaught_exception(request, resolver, exc_info)

  File "C:\Python26\lib\site-packages\django\core\handlers\base.py", line 154, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)

  File "C:\Python26\lib\site-packages\django\views\debug.py", line 40, in technical_500_response
    html = reporter.get_traceback_html()

  File "C:\Python26\lib\site-packages\django\views\debug.py", line 86, in get_traceback_html
    frames = self.get_traceback_frames()

  File "C:\Python26\lib\site-packages\django\views\debug.py", line 205, in get_traceback_frames
    pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)

  File "C:\Python26\lib\site-packages\django\views\debug.py", line 186, in _get_lines_from_file
    context_line = source[lineno].strip('\n')

IndexError: list index out of range
</pre>

<p>Totally mysterious: there is not a line of my code in the trace stack and I have no idea what file it is trying to index into. I really made no progress on this until I tried the shell:</p>

<pre class="prettyprint">
&gt;&gt;&gt; from django_league.league.models import *
&gt;&gt;&gt; Sport.objects.create(sport_name='Hockey')
__unicode__
Traceback (most recent call last):
  File "lgt;console&gt;", line 1, in lgt;module&gt;
  File "C:\Python26\lib\site-packages\django\db\models\base.py", line 328, in __
repr__
    u = unicode(self)
  File "C:\Users\hughdbrown\Documents\django\django_league\..\django_league\leag
ue\models.py", line 17, in __unicode__
    return u"%s" % (sport_name, )
NameError: global name 'sport_name' is not defined
</pre>

<p>Now we're getting somewhere, I thought. I have a function of mine in scope. The problem was that I had defined my __unicode__ method without using <em>self</em> in the code:</p>

<pre class="prettyprint">
class Sport(models.Model):    
    sport_name = models.CharField(max_length=20)
    def __unicode__(self):
        return u"%s" % (<strong>self.</strong>sport_name, )

    @models.permalink
    def get_absolute_url(self):
        return ('sport', None, {'object_id' : self.id})

    class Meta:
        ordering = ['sport_name']
</pre>

<p>So fixing it was pretty easy once I knew that.</p>
]]>
        
    </content>
</entry>

<entry>
    <title>DataVision sucks - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/10/datavision-sucks.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1563</id>

    <published>2009-10-23T18:34:05Z</published>
    <updated>2009-11-06T02:39:52Z</updated>

    <summary>So the Windows 7 upgrade that I reported yesterday gets better. DataVision, the store in New York I bought the upgrade from, is totally unwilling to provide a refund or to take an exchange on the product because I opened...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>So the Windows 7 upgrade that I reported yesterday gets better. <a href="http://www.datavis.com/">DataVision</a>, the store in New York I bought the upgrade from, is totally unwilling to provide a refund or to take an exchange on the product <strong>because I opened the package.</strong> I don't know of any way to determine that an operating system will not install on your machine without actually, you know, running the installation. Their recommendation? Take it up with Microsoft. Microsoft, understandably, says, "Waaaah? We didn't sell you this. Talk to DataVision."</p>

<p>The stance of the manager, Joey (212 689 1111 x1746), is three-fold:</p>
<ul>
<li>You always have to reinstall your programs when you upgrade the operating system<br />Patently untrue. Not true with any previous Microsoft OS I've used and not true for any Linux OS I've tried. Some people will say anything not to have to refund money.</li>
<li>We don't refund money</li>
<li>We don't take back opened software<br />
I have no idea how I would have known the installation would fail (or require reinstalling all programs) without opening the package.</li>
</ul>

<p>So I have a suggestion of my own: don't do business with DataVision.</p>

<br /><hr /><br />

<p>Update 2009-10-23: Maybe I should have known better. If you look for <a href="http://maps.google.com/maps/place?cid=8991819621108373082&q=computer%2Bstore%2Blocations%2Bnew%2Byork&hl=en&view=feature&mcsrc=detailed_reviews&num=10&start=0">ratings of DataVision on the web</a>, it's pretty consistently rated one of the worst places to get computer service in New York City.</p>

<blockquote>"They truly have the worst customer service in the world" ... "Located in midtown Manhattan, this computer store leaves much to be desired" ... "ABSOLUTELY HORRIBLE CUSTOMER SERVICE!" ... "The prices are pretty good" ... "Awful. I wouldnt shop there again" ... "Very helpful"</blockquote>

<br /><hr /><br />

<p>Update 2009-11-05: Wahoo! I am number one on <a href="http://www.google.com/#hl=en&q=datavision+sucks">google for the phrase 'DataVision sucks'</a>! Now there is some talented branding!</p>
]]>
        
    </content>
</entry>

<entry>
    <title>Introducing Windows 7.  Your PC, simplified. - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/10/introducing-windows-7-your-pc-simplified.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1562</id>

    <published>2009-10-22T23:28:13Z</published>
    <updated>2009-10-23T18:21:44Z</updated>

    <summary>I tried out the Windows 7 Beta earlier this year. I had that sinking feeling in my gut when I realized that I would have to reinstall all my programs in order to move from Windows XP sp2 to WIndows...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term="Microsoft" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>I tried out the Windows 7 Beta earlier this year. I had that sinking feeling in my gut when I realized that I would have to reinstall all my programs in order to move from Windows XP sp2 to WIndows 7 Beta. Apparently, the directory structures were not the same so the programs would not run. Or something. I sucked it up and installed a raft of development tools so that I could have the new OS. At least I was only going to have to do this once.</p>

<p>So when I ran the upgrade installation program for Windows 7 Professional, I was surprised to get this message:</p>

<blockquote>Windows 7 Ultimate cannot be upgraded to Windows 7 Professional. You can choose to install a new copy of Windows 7 Professional instead, but this is different from an upgrade, and does not keep your files, settings, and programs. <strong>You'll need to reinstall any programs using the original installation discs or files.</strong> To save your files before installing Windows, back them up to an external location such as a CD, DVD, or external hard drive. To install a new copy of Windows 7 Professional, click the Back button in the upper left-hand corner, and select "Custom (advanced)".[EMphasis added]</blockquote>

<p>So what do you think: should moving from Windows 7 Ultimate (beta) to Windows 7 Professional (release) require reinstallation of every non-operating system program on my machine? Would you go ahead or just return the upgrade package and wait until Microsoft gets its act together?</p>
]]>
        
    </content>
</entry>

<entry>
    <title>MoreLinq - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/10/morelinq.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1561</id>

    <published>2009-10-22T16:01:30Z</published>
    <updated>2009-10-22T16:08:34Z</updated>

    <summary>Recently, I wanted a way to iterate over two sequences in LINQ the same way you do in functional languages like python. It&apos;s most commonly called zip() and it works like this: seq = [fn(a1, b1) for a1, b1 in...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term=".NET" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="programming" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>Recently, I wanted a way to iterate over two sequences in LINQ the same way you do in functional languages like python. It's most commonly called zip() and it works like this:</p>

<pre class="prettyprint">seq = [fn(a1, b1) for a1, b1 in zip(a, b)]</pre>

<p>This applies a function fn() to each pair of variables pulled from a and b together. There is no direct way to do this in LINQ 3.5, but I came across <a href="http://code.google.com/p/morelinq/">MoreLinq</a> which has an implementation of zip() and many other useful functions.</p>]]>
        
    </content>
</entry>

<entry>
    <title>VB.NET code to implement Excel Rank() - iwebthereforeiam</title>
    <link rel="alternate" type="text/html" href="http://www.iwebthereforeiam.com/iwebthereforeiam/2009/10/vbnet-code-to-implement-excel-rank.html" />
    <id>tag:www.iwebthereforeiam.com,2009:/iwebthereforeiam//1.1560</id>

    <published>2009-10-13T17:13:20Z</published>
    <updated>2010-03-04T17:52:16Z</updated>

    <summary>Recently, I had to implement the Excel function Rank() for a project. I came up with this templatized LINQ code: Public Class ReversedComparer(Of T As IComparable) Implements IComparer(Of T) Public Function Compare(ByVal x As T, ByVal y As T) As...</summary>
    <author>
        <name>Hugh Brown</name>
        
    </author>
    
        <category term=".NET" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="programming" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="python" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.iwebthereforeiam.com/iwebthereforeiam/">
        <![CDATA[<p>Recently, I had to implement the Excel function Rank() for a project. I came up with this templatized LINQ code:</p>

<pre class="prettyprint">
Public Class ReversedComparer(Of T As IComparable)
    Implements IComparer(Of T)
    Public Function Compare(ByVal x As T, ByVal y As T) As Integer _
    Implements System.Collections.Generic.IComparer(Of T).Compare
       Return -x.CompareTo(y)
    End Function
End Class

Private Shared Function BinarySearch(Of T As IComparable)(ByRef x() As T, _
                                     ByVal val As T, _
                                     ByVal comparer As IComparer(Of T)) As Integer
    Dim lo As Integer = 0, hi As Integer = x.Count - 1
    While lo <= hi
        Dim mid As Integer = (hi + lo) \ 2
        If comparer.Compare(val, x(mid)) <> 1 Then
            hi = mid - 1
        Else
            lo = mid + 1
        End If
    End While
    Return CInt(If(comparer.Compare(x(lo), val) = 0, lo, -1))
End Function

Public Shared Function Rank(ByRef X() As Double) As Integer()
    Dim sorted() As Double = (From xx In X Order By xx Descending Select xx).ToArray()
     Dim comparer As IComparer(Of Double) = New ReversedComparer(Of Double)
     Return X.Select(Function(val) 1 + BinarySearch(Of Double)(sorted, val, comparer)).ToArray()
End Function
</pre>

<p>And it's pretty good as far as it goes. It takes a copy of the data in reverse-sorted order and then does a binary search to find the 0-based position in the array for each element in the original array. And that's fine, but I wanted to implement something more like my python code:</p>

<pre class="prettyprint">
import collections
def rank(arr):
	"""
	>>> a = list(range(10))
	>>> print rank(a)
	[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
	>>> b = list(range(10))
	>>> b.reverse()
	>>> print rank(b)
	[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
	>>> c = [5] * 10
	>>> print rank(c)
	[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
	>>> d = ([5] * 5) + ([1] * 5)
	>>> d
	[5, 5, 5, 5, 5, 1, 1, 1, 1, 1]
	>>> print rank(d)
	[1, 1, 1, 1, 1, 6, 6, 6, 6, 6]
	"""
	d = collections.defaultdict(list)
	for i, v in enumerate(arr):
		d[v].append(i)
	result = [0] * len(arr)
	i = 1
	for k in sorted(d, reverse = True):
		for j in d[k]:
			result[j] = i
		i += len(d[k])
	return result

if __name__ == '__main__':
	import doctest
	doctest.testmod()
 </pre>

<p>So I worked through the LINQ issues using the LinqPad interpreter and came up with this:</p>

<pre class="prettyprint">
Function Rank(Of T)(Byref x() as T) as Integer()
    Dim original_pos = x.Select(Function(xx, index) New With {.Val = xx, .Index = index}) _
             .ToLookup(Function(xxx) xxx.Val)
    Dim keys = original_pos.OrderByDescending(Function(yy) yy.Key)    
    Dim result(x.Count-1) as Integer
    Dim i as Integer = 1
    For Each item in keys
        For Each v in item
            result(v.Index) = i
        Next
        i = i + item.Count
    Next
    Return result
End Function
</pre>

<p>And I think that's pretty good code: templatized LINQ code that uses lambda functions and implements the algorithm as quickly as I know how.</p>
]]>
        
    </content>
</entry>

</feed>
