<?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>Brian Lyttle</title>
	<atom:link href="http://brianlyttle.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://brianlyttle.com</link>
	<description>What happens when the code just stops</description>
	<lastBuildDate>Sun, 09 Oct 2011 04:30:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Python interpreter tab completion on OS X</title>
		<link>http://brianlyttle.com/2011/10/python-interpreter-tab-completion-on-os-x/</link>
		<comments>http://brianlyttle.com/2011/10/python-interpreter-tab-completion-on-os-x/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 04:28:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=386</guid>
		<description><![CDATA[This is mainly for me own reference, but it is probably something that other people will find useful. If you attempt to use the rlcompleter module on the Mac you&#8217;ll find that tab completion does not work correctly. Apparently this is because Apple ship a neutered version of readline. To get completion working you have [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This is mainly for me own reference, but it is probably something that other people will find useful. If you attempt to use the <a href="http://docs.python.org/library/rlcompleter.html">rlcompleter</a> module on the Mac you&#8217;ll find that tab completion does not work correctly. Apparently this is because Apple ship a neutered version of readline.</p>
<p>To get completion working you have to use a different argument to readline.parse_and_bind(). The base example uses:</p>
<pre>readline.parse_and_bind("tab: complete")</pre>
<p>Change that line to: </p>
<pre>readline.parse_and_bind ("bind ^I rl_complete")</pre>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/10/python-interpreter-tab-completion-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Old but interesting news</title>
		<link>http://brianlyttle.com/2011/09/old-but-interesting-news/</link>
		<comments>http://brianlyttle.com/2011/09/old-but-interesting-news/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 01:38:30 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[search engine optimization]]></category>
		<category><![CDATA[sem]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=365</guid>
		<description><![CDATA[I&#8217;ve spent a fairly big chunk of my professional career building public websites for a number of clients. One of the things that comes up again and again is search engine optimisation. Surprisingly there is very little coverage of this is in business and marketing journals. Patrick Reid wanted to start raise awareness, and needed [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;ve spent a fairly big chunk of my professional career building public websites for a number of clients. One of the things that comes up again and again is search engine optimisation.</p>
<p>Surprisingly there is very little coverage of this is in business and marketing journals. <a href="http://www.isensa.com/about_us/">Patrick Reid</a> wanted to start raise awareness, and needed my technical help in preparing a paper. We finished it up earlier this year and it was published in the <a href="http://www.senatehall.com/strategic-management">Journal of Strategic Management Education</a>.</p>
<blockquote style="font-size:0.9em;">
<p>Corporate Communications in the FTSE 100: Evidence using Search Engines<br />
JSME Vol 7: Issue 1, 2011<br />
Patrick Reid (Greenwich School of Management, UK), Brian Lyttle (LiquidHub, Inc., USA)</p>
<p>Search engines have become an essential tool for information seekers on the world wide web. This makes it critical that company websites are optimised to achieve the highest possible ranking across the major search engines, in particular Google, ensuring maximum exposure and subsequent awareness. This paper identifies key factors in search engine optimisation and then analyses a sample of the largest 10 firms listed on the London Stock Exchange.</p>
<p>The findings reveal a lack of adoption of best practices which will impact on their search rankings. The paper also discusses tradeoffs inherent in search engine optimisation and draws out key implications for managers and academics.</p>
</blockquote>
<p>The full paper is available from the <a href="http://www.senatehall.com/strategic-management?article=409">Senate Hall</a> site.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/09/old-but-interesting-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scrapy dependency problems with lxml</title>
		<link>http://brianlyttle.com/2011/09/scrapy-dependency-problems-with-lxml/</link>
		<comments>http://brianlyttle.com/2011/09/scrapy-dependency-problems-with-lxml/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 19:31:17 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[lxml]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scrapy]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=355</guid>
		<description><![CDATA[Following the recent PhillyPUG meetup I was trying to install scrapy on an old MacBook Pro running OS X 10.6 (Snow Leopard) and ran into a number of problems with the lxml dependency. This is the parser used to extract data from pages that scrapy downloads so you are not going to get very far [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Following the recent <a href="http://www.meetup.com/phillypug/events/31432902/">PhillyPUG</a> meetup I was trying to install <a href="http://scrapy.org/">scrapy</a> on an old MacBook Pro running OS X 10.6 (Snow Leopard) and ran into a  number of problems with the <a href="http://lxml.de/">lxml</a> dependency. This is the parser used to extract data from pages that scrapy downloads so you are not going to get very far without it.</p>
<p>It seems that the compilation problems experienced when installing with <em>pip</em> result from an attempt to build a universal binary. If you have Xcode 4 installed then you lose some of this capability and need to make sure that the correct architecture is specified.</p>
<h3>Architecture Fix</h3>
<p>Setting the architecture is something you can do in your bash profile, executing it under a new bash ensures that the build script picks it up.</p>
<pre>
sudo bash
export ARCHFLAGS='-arch i386 -arch x86_64'
pip install lxml # test it
pip install scrapy --upgrade # fix the failed scrapy install
</pre>
<h3>Original Error</h3>
<pre>
brianly$ sudo pip install lxml --upgrade
Downloading/unpacking lxml
  Downloading lxml-2.3.tar.gz (3.2Mb): 3.2Mb downloaded
  Running setup.py egg_info for package lxml
    Building lxml version 2.3.
    Building without Cython.
    Using build configuration of libxslt 1.1.24
    warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
  Found existing installation: lxml 2.2.2
    Uninstalling lxml:
      Successfully uninstalled lxml
  Running setup.py install for lxml
    Building lxml version 2.3.
    Building without Cython.
    Using build configuration of libxslt 1.1.24
    building 'lxml.etree' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.6-universal-2.6/src/lxml/lxml.etree.o -w -flat_namespace
    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
    Installed assemblers are:
    /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
    /usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
    src/lxml/lxml.etree.c:161594: fatal error: error writing to -: Broken pipe
    compilation terminated.
    lipo: can't open input file: /var/tmp//ccYr9GpX.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/brianly/dev/github/pyconscrape/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-axeEA7-record/install-record.txt:
    Building lxml version 2.3.

Building without Cython.

Using build configuration of libxslt 1.1.24

running install

running build

running build_py

creating build

creating build/lib.macosx-10.6-universal-2.6

creating build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/__init__.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/_elementpath.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/builder.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/cssselect.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/doctestcompare.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/ElementInclude.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/sax.py -> build/lib.macosx-10.6-universal-2.6/lxml

copying src/lxml/usedoctest.py -> build/lib.macosx-10.6-universal-2.6/lxml

creating build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/__init__.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_dictmixin.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/builder.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/clean.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/defs.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/diff.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/formfill.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/html5parser.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/soupparser.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.6-universal-2.6/lxml/html

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron

copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/rng

copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/rng

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl

copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl

creating build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.6-universal-2.6/lxml/isoschematron/resources/xsl/iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

creating build/temp.macosx-10.6-universal-2.6

creating build/temp.macosx-10.6-universal-2.6/src

creating build/temp.macosx-10.6-universal-2.6/src/lxml

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.6-universal-2.6/src/lxml/lxml.etree.o -w -flat_namespace

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed

Installed assemblers are:

/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64

/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

src/lxml/lxml.etree.c:161594: fatal error: error writing to -: Broken pipe

compilation terminated.

lipo: can't open input file: /var/tmp//ccYr9GpX.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
  Rolling back uninstall of lxml
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/basecommand.py", line 126, in main
    self.run(options, args)
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/commands/install.py", line 228, in run
    requirement_set.install(install_options, global_options)
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 1104, in install
    requirement.rollback_uninstall()
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 487, in rollback_uninstall
    self.uninstalled.rollback()
  File "/Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg/pip/req.py", line 1417, in rollback
    pth.rollback()
AttributeError: 'str' object has no attribute 'rollback'

Storing complete log in /Users/brianly/.pip/pip.log
</pre>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/09/scrapy-dependency-problems-with-lxml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting by ID (or primary key) with Fluent NHibernate</title>
		<link>http://brianlyttle.com/2011/04/delet-by-id-fluent-nh/</link>
		<comments>http://brianlyttle.com/2011/04/delet-by-id-fluent-nh/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 15:02:44 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[fluent-nhibernate]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=333</guid>
		<description><![CDATA[I wasn&#8217;t a big fan of so-called Fluent Interfaces but my fondness is growing as I use Fluent NHibernate on an ASP.NET MVC project. When I started on my project I checked out the repository pattern example from Google Code to see how this was being implemented. The supplied repository interface provided the following interface: [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I wasn&#8217;t a big fan of so-called <a href="http://en.wikipedia.org/wiki/Fluent_interface">Fluent Interfaces</a> but my fondness is growing as I use <a href="http://fluentnhibernate.org/">Fluent NHibernate</a> on an ASP.NET MVC project. When I started on my project I checked out the <a href="http://nhibernate-repository-example.googlecode.com/svn/trunk/RepositoryExample/">repository pattern example</a> from Google Code to see how this was being implemented. The supplied repository interface provided the following interface:</p>
<pre>
public interface IRepository<T>
{
    T Get(object id);
    void Save(T value);
    void Update(T value);
    void Delete(T value);
    IList<T> GetAll();
}
</pre>
<p>Looks great apart from the fact that you need to pass an entity to the Delete() method, which would in turn result in iteration over a large number of objects if I had to do a lot of deletes. If I received an integer with an ID from an ASP.NET MVC controller I&#8217;d have to retrieve the object before sending it to the Delete() method. This is not very efficient. </p>
<p>To remedy this problem I added an additional Delete() method to the interface taking an object ID as the only parameter:</p>
<pre>
public void Delete<TEntity>(object id)
{
    using (var session = sessionFactory.OpenSession())
    using (var transaction = session.BeginTransaction())
    {
        var queryString = string.Format("delete {0} where id = :id", typeof(TEntity));
        session.CreateQuery(queryString)
               .SetParameter("id", id)
               .ExecuteUpdate();

        transaction.Commit();
    }
}
</pre>
<p>This is a very simple method that will generate more efficient SQL under the covers for deletion of objects from the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/04/delet-by-id-fluent-nh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom ASP.NET MVC ActionResult classes</title>
		<link>http://brianlyttle.com/2011/04/custom-asp-net-mvc-actionresult/</link>
		<comments>http://brianlyttle.com/2011/04/custom-asp-net-mvc-actionresult/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 02:11:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=325</guid>
		<description><![CDATA[ASP.NET MVC provides a way for developers to extend and create custom ActionResults for controllers. Normally you return a view from a controller and the runtime goes off and hunts down the appropriate view based on the name of your action. This make sense for normal web pages but sometimes you need to build something [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>ASP.NET MVC provides a way for developers to extend and create custom <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.actionresult.aspx">ActionResults</a> for controllers. Normally you return a view from a controller and the runtime goes off and hunts down the appropriate view based on the name of your action. This make sense for normal web pages but sometimes you need to build something in code or you don&#8217;t want to write a view for it. In this case you can extend ActionResult, set a content type, and render the result to the output stream.</p>
<pre>
public OpenLayersActionResult MapData()
{
    var myPoints = new List<MapPoint>();

    var p = new MapPoint
                {
                    Title = "Title for point on the map",
                    Icon = "marker.png",
                    IconSize = "21,25",
                    LatLon = "12.9715987,77.5945627",
                    Description = "This is the long description for a point on the map"
    };

    myPoints.Add(p);

    return new OpenLayersActionResult { Points = myPoints };
}
</pre>
<p>Over on GitHub you can find some <a href="https://github.com/brianly/Killaloo.Web.Mvc">sample ActionResult classes</a> including one that replicates the built-in <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.jsonresult.aspx">JsonResult</a>. The one that will probably be most useful to someone is the <a href="https://github.com/brianly/Killaloo.Web.Mvc/blob/master/OpenLayersActionResult.cs">OpenLayersActionResult</a> which simplifies generation of layer data. I&#8217;m digging through various projects and building out that library with other helper code from various projects so keep an eye out for more snippets.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/04/custom-asp-net-mvc-actionresult/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Google App Engine with Python</title>
		<link>http://brianlyttle.com/2011/04/appengine-with-python-talk/</link>
		<comments>http://brianlyttle.com/2011/04/appengine-with-python-talk/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 00:28:16 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[codecamp]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[googleappengine]]></category>
		<category><![CDATA[talk]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=315</guid>
		<description><![CDATA[Thanks to everyone who attended my talk. I hope it was useful! If you haven&#8217;t done so already please complete an evaluation form. I&#8217;ve uploaded the presentation to SlideShare and you can download a PDF from my site too. The code sample I used during the presentation is available on BitBucket, and I&#8217;m going to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Thanks to everyone who attended my talk. I hope it was useful! If you haven&#8217;t done so already please <a href="http://codecamp.phillydotnet.org/2011-1/Lists/Evaluation/Item/newifs.aspx?source=/2011-1/sitepages/thankyou.aspx">complete an evaluation form</a>.</p>
<p>I&#8217;ve uploaded the presentation to <a href="http://www.slideshare.net/blytt/introduction-to-google-app-engine-with-python">SlideShare</a> and you can <a href="GoogleAppEngineIntroPythonCodeCamp2011.pdf">download a PDF</a> from my site too. The <a href="http://hg.killaloo.org/bookmarkz/src">code sample</a> I used during the presentation is available on BitBucket, and I&#8217;m going to be making various improvements to it over the coming weeks.</p>
<div style="width:425px" id="__ss_7581355"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/blytt/introduction-to-google-app-engine-with-python" title="Introduction to Google App Engine with Python">Introduction to Google App Engine with Python</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/7581355" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/blytt">blytt</a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/04/appengine-with-python-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Python Imaging on Windows 64-bit (AMD64) Python</title>
		<link>http://brianlyttle.com/2011/03/installing-python-imaging-on-64bit-windows/</link>
		<comments>http://brianlyttle.com/2011/03/installing-python-imaging-on-64bit-windows/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 19:31:49 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[imaging]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=309</guid>
		<description><![CDATA[If you want need a 64-bit version of this module for Google App Engine, or another project, you can run into a couple of issues. Sticking to 32-bit versions of Python and PIL avoids these issues so that may be the best direction for newbies. The downloads on the PIL site are for 32-bit versions [...]]]></description>
			<content:encoded><![CDATA[<p></p><p align="left">If you want need a 64-bit version of this module for <a href="http://code.google.com/appengine/">Google App Engine</a>, or another project, you can run into a couple of issues. Sticking to 32-bit versions of Python and PIL avoids these issues so that may be the best direction for newbies. </p>
<p>The <a href="http://www.pythonware.com/products/pil/">downloads on the PIL site</a> are for 32-bit versions of Python which means that you hit runtime issues as soon as the Python script files attempt to load the 32-bit libraries into 64-bit Python. Annoyingly the installer is unaware of the architecture for the Python installation it finds and will leave you with a broken PIL install. Just uninstall it from Control Panel. My first thought was to try an build from the sources but I figured someone has run into this problem.</p>
<p align="left">After some searching I <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/">found a site</a> which offers pre-built versions of many Python modules for 64-bit architectures including PIL. If you are in any way concerned about performance, or security a better solution might be to build from source or use versions from a company offering supported versions.</p>
<p align="left">I downloaded the version for Python 2.5 and then discovered that it would not install. What is interesting is that the 32-bit installer was able to find my 64-bit Python, but the 64-bit installer was unable to find it. </p>
<p>After some more searching it turns out that the installer takes it’s cue from a key in the registry and the Registry virtualization in Windows x64 was confusing it. To resolve the issue I had to export the “HKLM\SOFTWARE\Wow6432Node\Python\PythonCore\2.5” key, remove the “Wow6432Node\” string using a text editor, and re-import the key so that it was at “HKLM\SOFTWARE\Python\PythonCore\2.5”.</p>
<p>After doing this the 64-bit installer for PIL detected my Python installation and I was up and running. </p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/03/installing-python-imaging-on-64bit-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the most out of PyCon</title>
		<link>http://brianlyttle.com/2011/03/getting-the-most-out-of-pycon/</link>
		<comments>http://brianlyttle.com/2011/03/getting-the-most-out-of-pycon/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 04:33:26 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[pycon]]></category>
		<category><![CDATA[pycon2010]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=296</guid>
		<description><![CDATA[Van Lindberg recently tweeted a link to some tips on how to attend a conference. The advice in that article is pretty sound for a business person looking to build up their network to find sales opportunities, but it doesn&#8217;t cover any PyCon-specifics. After a little thinking I&#8217;ve come up with my own list of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Van Lindberg recently tweeted <ahref="http://twitter.com/VanL/status/41217905408344064">a link</a> to some tips on <a href="http://swombat.com/2011/2/25/kevin-mcdonagh-how-to-attend-a-conference">how to attend a conference</a>. The advice in that article is pretty sound for a business person looking to build up their network to find sales opportunities, but it doesn&#8217;t cover any PyCon-specifics.</p>
<p>After a little thinking I&#8217;ve come up with my own list of tips for new PyCon attendees:</p>
<h3>Attend some open space sessions</h3>
<p><a href="http://www.flickr.com/photos/brianly/3395569416/in/set-72157615936113009/"><img src="/images/cassandra.jpg" alt="" class="portrait_r" /></a><a href="http://us.pycon.org/2010/openspace/">Open spaces</a> are now    happening at a lot of conferences but the PyCon ones    have been the best I&#8217;ve seen. These are ad hoc discussions on a common topic    with participants joining and leaving whenever they want. These sessions are a    lot of fun and you&#8217;ll make a lot of friends in the process. Even if you aren&#8217;t    the most talkative person, or know little about a subject, you are free to just    hang out and listen.</p>
<p>Whilst there is a page on the PyCon website for    these sessions, it is normally best to check the boards outside the rooms    assigned to open space use. You should also monitor the <ahref="https://convore.com/pycon-2011/">Convore backchannel</a> and <a href="http://twitter.com/#search?q=%23pycon">#pycon</a> on Twitter.</p>
<p>If you don&#8217;t see any open space sessions related to your favourite topic just post a session in one of the available time slots. In almost all    cases some likeminded individuals will turn up.</p>
<p><a href="http://www.flickr.com/photos/brianly/3395568732/in/set-72157615936113009/"><img src="/images/openspace-board-closeup.jpg" alt="" class="portrait" /></a>Scheduled talks are normally recorded for viewing later so I&#8217;d recommend    that you try to decide ahead of time which talks are must see, and which ones    could be skipped. That way you can make the most of the open space sessions as    some of these will overlap with scheduled talks, especially on Saturday and    Sunday.</p>
<h3>Help the PyCon staff</h3>
<p>Putting on a conference PyCon is an enormous    effort. They are often looking for runners and other helpers. Spending a little    time helping out introduces you to many interesting people and you&#8217;ll probably    learn a bit too about how conferences run.</p>
<p>Follow <a href="http://twitter.com/pyconvolunteers">@pyconvolunteers</a>,    talk to the organisers, and lurk on the <ahref="http://mail.python.org/mailman/listinfo/pycon-organizers">pycon-organizer</a> mailing list.</p>
<h3>Check out the    lightning talks</h3>
<p>These are very short talks on a variety of Python-related subjects scheduled    at the beginning and end of conference days. If you have something to say to    the community they are a good way to let people know about your project or    passion. For everyone else they are a good way to find out about lesser known    projects, and they are often quite humorous.</p>
<h3>Go off track</h3>
<p>PyCon like many other conferences has tracks with    related content and there are <ahref="http://us.pycon.org/2011/blog/2011/02/28/10-python-conferences-happening-pycon-2011-part-1/">10    virtual tracks </a>for 2011. These are really helpful for finding things that    you are likely to be interested in, but sometimes it is good to check out    something a little bit different. </p>
<p>In particular, veteran PyCon speakers like Alex Martelli, David Beazley, and Raymond Hettinger fill rooms    each year and are always worth watching.</p>
<h3>Chat with    presenters</h3>
<p><a href="http://www.flickr.com/photos/brianly/3395569320/in/set-72157615936113009/"><img class="portrait_r" src="/images/michael-foord.jpg" alt=""/></a>On the topic of presenters there are a lot of opportunities to talk to    presenters at PyCon, either right after a talk, or    later at the conference. If you have questions on their area of expertise or    feedback on their talk it is worth taking some time to talk to them.</p>
<h3>Spend time on    things that are valuable to you</h3>
<p>Sometimes you&#8217;ll end up in a talk or open space session that isn&#8217;t exactly    what you expected. It is best if you go to something more to your taste than    waste your time on a talk that is too basic or not as described. Sometimes this    can be a little difficult if a session is packed with people, but you can do    things to make your exit a little bit more comfortable.</p>
<p>First of all if you have an inkling that you are going to want to leave a    talk don&#8217;t pick a seat in the middle of a row. Instead sit somewhere that that    has easier access to the exit at the back of the room. If there are video    cameras in the talk you might not want to be &quot;the dude that left in the    middle of a talk&quot;. In reality you will likely not be noticed as the    cameras are directed at the speaker.</p>
<p>Second, make sure to pack up your laptop and other things in your bag before    exiting. It&#8217;s kind of annoying to get clobbered with a laptop as someone exits    past you. The same thing goes for anyone sitting in the row. Don&#8217;t make    unnecessary obstacles for anyone that gets out. Move your power cord and move    closer to power strips rather than pulling them out of place.</p>
<h3>Find a group for    dinner in Atlanta</h3>
<p>Watch the <a href="https://convore.com/pycon-2011/">Convore</a> and <a href="http://twitter.com/#search?q=%23pycon">Twitter</a> for information    on groups who are going out for the evening in Atlanta. In many cases an open    space session will continue over dinner!</p>
<h3>Don&#8217;t have too good    a time at night</h3>
<p>It is way too easy to have a good time on Friday and Saturday nights, but    don&#8217;t stay out too late or get too hammered. This seems like a bit silly but you    need quite a bit of energy to make it all the way through a conference like PyCon.</p>
<p>I&#8217;m sure there are many things that I&#8217;ve missed here. Please post other tips    on Twitter under the <a href="http://twitter.com/#search?q=%23pycon">#pycon</a> hash tag, on your blog, or post a comment below    for others to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/03/getting-the-most-out-of-pycon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the WTL CListBox class</title>
		<link>http://brianlyttle.com/2011/02/using-the-wtl-clistbox-class/</link>
		<comments>http://brianlyttle.com/2011/02/using-the-wtl-clistbox-class/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 05:09:39 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[WTL]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/?p=283</guid>
		<description><![CDATA[Working with Win32 listbox controls is fairly simple but the code can be quite convoluted and get tedious after a while. I decided to use the WTL library to simplify some listbox handling code but it wasn&#8217;t initially obvious how to do this. Hopefully this blog post will help someone else understand the basics. Manual [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Working with Win32 listbox controls is fairly simple but the code can be quite convoluted and get tedious after a while. I decided to use the WTL library to simplify some listbox handling code but it wasn&#8217;t initially obvious how to do this. Hopefully this blog post will help someone else understand the basics.</p>
<h3>Manual message processing</h3>
<p>The majority of Win32 programming involves working with messages of various types that are basically #defines in header files. The Listbox control responds to messages like these:</p>
<ul>
<li>LB_GETCURSEL (get the selected item)</li>
<li>LB_DELETESTRING (delete a string)</li>
<li>LB_INSERTSTRING (add a string)</li>
</ul>
<p>..but you also have to make sure you use the correct WPARAM and LPARAMs.</p>
<p>The resulting code for adding an item to a Listbox looks like this:</p>
<pre>TCHAR szBuffer[80] = {0};
UINT chars = GetDlgItemText(IDC_EDIT1, szBuffer, 80);
SendDlgItemMessage(IDC_LIST1, LB_INSERTSTRING, (WPARAM) 0, (LPARAM)szBuffer);</pre>
<p>As you can see this requires a lot of work that I’ve grown tired of with years of C# coding.</p>
<h3>Simplifying with WTL</h3>
<p>It is best to thinking of simplification here with a view to the long term. You are writing C++ so this is not as straightforward as WinForms or WPF.</p>
<p>First of all you need to create a member variable in your window class. I&#8217;m assuming you have installed the WTL AppWizard into Visual Studio and have created a Dialog application, but the steps are similar for other types of window. The code looks something like this:</p>
<pre>class CMainDlg : public CDialogImpl&lt;CMainDlg&gt;, public CUpdateUI&lt;CMainDlg&gt;, public CMessageFilter, public CIdleHandler
{
private:
    CListBox m_ListBox;
public:
    enum { IDD = IDD_MAINDLG };
....</pre>
<p>As you can see we have private called m_ListBox that we can reference elsewhere. Next an instance of CListBox needs to be attached to a Listbox that has been added to your dialog resource file. You do this in the OnInitDialog() method:</p>
<pre>LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&amp; /*bHandled*/)
{
    m_ListBox.Attach(GetDlgItem(IDC_LIST1));
....</pre>
<p>The IDC_LIST1 parameter is the name defined in my resource file and messages are now being routed between the instance variable and the actual control.</p>
<p>Now in the event handling code it is possible to call the AddString() method without having to worry about message types:</p>
<pre>LRESULT OnAddItem(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL&amp; /*bHandled*/)
{
    TCHAR szBuffer[80] = {0};
    UINT chars = GetDlgItemText(IDC_EDIT1, szBuffer, 80);
    m_ListBox.AddString(szBuffer);
    return 0;
}</pre>
<p>This is a rather naïve example as I’m not taking advantage of WTL for the Edit control, but that’ll be the subject of a future blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/02/using-the-wtl-clistbox-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing VMware ESX 4.1 from a USB flash drive on unsupported hardware</title>
		<link>http://brianlyttle.com/2011/01/installing-vmware-esx-4-1-from-a-usb-flash-drive-on-unsupported-hardware/</link>
		<comments>http://brianlyttle.com/2011/01/installing-vmware-esx-4-1-from-a-usb-flash-drive-on-unsupported-hardware/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 03:56:54 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://brianlyttle.com/2011/01/installing-vmware-esx-4-1-from-a-usb-flash-drive-on-unsupported-hardware/</guid>
		<description><![CDATA[I recently replaced my aging Dell PowerEdge 830 server with a newer custom desktop and needed to migrate a number of old virtual machines. For the last few years I’ve been a happy user of VMware Server running atop Ubuntu Server and I figured it would be easiest to stick with that configuration. So off [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I recently replaced my aging Dell PowerEdge 830 server with a newer custom desktop and needed to migrate a number of old virtual machines. For the last few years I’ve been a happy user of VMware Server running atop Ubuntu Server and I figured it would be easiest to stick with that configuration.</p>
<p>So off I went with the usual Ubuntu 10.10 install and popped over to vmware.com to grab the latest virtualisation bits. It was then that I noticed that VMware Server (formerly GSX Server) is no longer being updated and users are recommended to upgrade to VMware ESXi. </p>
<p>From what I knew about the ESX product it had very specific requirements for installation, only supporting high end storage and a limited selection of NICs. It would seem that I needed to look at some of the Linux VM options like KVM or Xen, but it would be a pain to convert VMs over and it wouldn’t be straightforward to run these on my other computers.</p>
<h4>Sticking with VMware</h4>
<p align="left">I went to Google and did a little research on installation of the latest VMware server version on unsupported hardware. VMware offer <a href="http://en.wikipedia.org/wiki/VMware_ESX">ESXi</a>, a free Hypervisor, which is the base for their VSphere products. This is the recommended upgrade path for VMware Server users. You just register on their site and receive a free serial number. </p>
<p>Hypervisors like ESXi run directly on the hardware rather than on top of an operating system. This results in better performance and hardware utilisation.</p>
<h4>A failed installation</h4>
<p>The installer is supplied as an ISO image which is designed to work on supported hardware. As I found out, getting this to work well on unsupported hardware was problematic. </p>
<p align="left">First of all I ran into a failure from what looks like a virtual disk driver (“vmkctl.HostCtlException Unable to load module /usr/lib/vmware/vkmod/vmfs3: Failure”). Whilst browsing many clueless forum responses I noticed a reply that mentioned Realtek network adaptors being a problem. Many motherboards including the <a href="http://www.gigabyte.com/products/product-page.aspx?pid=3316#ov">Gigabyte GA-EP43T-USB3</a> in my machine use this brand of NIC, but VMware favour Intel cards. To find out if network card halted the installer I dropped into the BIOS setup and disabled the onboard network card. </p>
<p>On the next boot the ESXi installer let me pick a hard disk for the install but then blew up with a media error. It turns out that the installer has problems with your garden variety of DVD drive and people have more success with installation from USB flash drives.</p>
<p>I now had 2 problems: one with hardware (the NIC) and the other with software (the installer). I needed a new NIC and was able to pick up an <a rel="nofollow" href="http://www.amazon.com/gp/product/B000BMVM7C/ref=oss_productbrianlyttleco-20" >Intel Pro/1000 PT Server card</a> on Amazon with quick delivery. This was easy to install and it worked on first boot so I only had to get a USB installer working.</p>
<h4>Creating a USB installation disk</h4>
<p align="left">My Google searches had taken me over to the <a href="http://www.vm-help.com/forum/">vm-help.com forum</a>, and I found a lot of useful <a href="http://www.vm-help.com/forum/viewtopic.php?f=12&amp;t=4">custom installation</a> and <a href="http://vm-help.com/esx40i/customize_oem_tgz.php">hardware/driver support</a> information.</p>
<p align="left">The first method I tried was a custom bash script called <a href="http://code.google.com/p/mkesxiaio/">mkesxaio</a> which enabled me to create an installation of VMware on a USB drive, but failed to create an installer. It was cool to be able to run ESXI directly from Flash memory as many people will want to do, but I wanted a solution that was safe from my cat. This bootable version did let me validate the performance of the new Intel NIC.</p>
<p align="left">So it was back to Googling for other recommendations on creating a boot disk. I finally found a <a href="http://www.ivobeerens.nl/?p=699">reasonable one</a> by&#160; <a href="http://www.ivobeerens.nl">Ivo Beerens</a> but I didn’t want to mess with Syslinux. Instead I used the weirdly named <a href="http://unetbootin.sourceforge.net/">UNetbootin</a> to install the VMware ESXi ISO image to my USB drive. This meant I could follow Ivo’s later steps to configure the drive.</p>
<p align="left"><img src="http://brianlyttle.com/images/unetbootin.jpg" /></p>
<p align="left">The installer wants to validate some configuration that it expects on the CD so it is important to follow the directions around creation of a mod.tgz that sets the mtools_skip_check variable. Otherwise you have to drop to the shell each time you want to run the installation. </p>
<p align="left"><a href="http://linux902.tripod.com/s1-kickstart2-file.html">Kickstart</a> files are used to automatically start the installation and I wasn’t able to find a configuration that let me boot the regular installer. It is very important that you have drives in the computer that do not have important data. The ks.cfg file contains a line specifying the drive to install to that is dependent on which SATA connection you are using. In short make sure the drive you want to use for the installation is the first drive, or modify the script.</p>
<p align="left">At this point I had a USB installation disk that would automatically boot, provision ESXi, and then reboot to a fully working installation.</p>
<h4 align="left">Final configuration</h4>
<p align="left">After installation I was able to access the console to verify network connectivity and enable some useful settings:</p>
<ul>
<li>
<div align="left">SSH remote access</div>
</li>
<li>
<div align="left">Local troubleshooting mode</div>
</li>
</ul>
<p>When I connected the IP address assigned to the machine I was presented with a the default server information and links to the <a href="http://vsphereclient.vmware.com/vsphereclient/2/5/8/9/0/2/VMware-viclient-all-4.1.0-258902.exe">vSphere client</a>.</p>
<p align="left"><img src="http://brianlyttle.com/images/vmware-esxi-41-main-sm.png" /></p>
<p align="left">After a bit more work than I expected I now have a newer more powerful VMware environment for testing new tools, that will support newer guests like Windows Server 2008 R2. After a little bedding in time I’m going to migrate my existing VMs and get rid of the old Dell.</p>
]]></content:encoded>
			<wfw:commentRss>http://brianlyttle.com/2011/01/installing-vmware-esx-4-1-from-a-usb-flash-drive-on-unsupported-hardware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

