
<?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>Mental Pandiculation</title>
	<atom:link href="http://mentalpandiculation.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mentalpandiculation.com</link>
	<description>One Man's Attempt To Find Elegant Code Through Big Words</description>
	<lastBuildDate>Tue, 06 Jul 2010 14:22:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>When Decoupling Goes Bad</title>
		<link>http://mentalpandiculation.com/2010/07/when-decoupling-goes-bad/</link>
		<comments>http://mentalpandiculation.com/2010/07/when-decoupling-goes-bad/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 14:22:06 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[decoupling]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=293</guid>
		<description><![CDATA[I&#8217;m currently reading ASP.Net MVC 2 in Action and overall, the books seems solid. I can say this because I&#8217;ve read about 20 pages and agree with most of it. However, the 20 pages I&#8217;ve read do contain some advice that seems overdone at best and downright confusing to future developers at worst. The chapter [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently reading <a href="http://manning.com/palermo2/">ASP.Net MVC 2 in Action</a> and overall, the books seems solid.  I can say this because I&#8217;ve read about 20 pages and agree with most of it.  However, the 20 pages I&#8217;ve read do contain some advice that seems overdone at best and downright confusing to future developers at worst.  The chapter I&#8217;m reading is Data Access with NHibernate.  I&#8217;m working on an application that contains an ASP.Net web site backed by a PostgreSQL database.  Previously, all my applications used MSSQL and therefore were set up using Linq-to-SQL as a poor man&#8217;s ORM.  With PostgreSQL, that&#8217;s no longer an option so I&#8217;m in the process of learning NHibernate and Fluent NHibernate, a task that&#8217;s long overdue.</p>
<p>I hate learning a new technology by doing everything wrong the first time so I went looking for some best practices or architecture suggestions for setting up NHibernate.  This book had an entire chapter on that and so I dove right in.  Overall, it&#8217;s been very useful.  Heavy use of Dependency Injection and Inversion of Control nicely decouple the pieces of the app from each other.  However, the authors recommend something that seems a little extreme to me. </p>
<p>The example solution has a UI project which is the ASP.Net site, a Core project containing domain models and code, an Infrastructure project for things like data access and assorted test projects including an Integration Test project.  The authors point out that the only project that references the Infrastructure project is the Integration Test project.  Their rationale for this is that Infrastructure is necessarily fluid.  Because of this, you don&#8217;t want to couple the core or UI to it.  They set this up by using runtime DI to inject dependencies from the Infrastructure project into UI components.  Specifically, the data access repositories that certain controllers need are discovered at runtime using settings in the web.config.  They claim that this results in a completely decoupled application.</p>
<p>However, in order for this to work, the UI project needs to have access to the Infrastructure assemblies and config files.  Normally, this would happen via an explicit reference in Visual Studio which would result in the necessary files being copied into the UI project at compile time.  Because the UI project doesn&#8217;t have that reference, the authors have to get the files there another way.  Their solution is to use a post build step in the Infrastructure project to copy the necessary files.  To me, this only serves to make the reference implicit, something is likely to cause issues down the road. </p>
<p>The UI definitely has a dependency on the Infrastructure project.  It seems extreme to hide that dependency in a post build step instead of showing it explicitly in the project references of the website.  It&#8217;s one thing to write decoupled code that is easy to test and change.  It&#8217;s entirely another to force developers to jump through hoops and keep track of idiosyncrasies like implicit project references.  However, being a complete newbie to this form of architecture, maybe I&#8217;m missing something.  Is there a true reason for managing dependencies between projects in this manner?  If so, why not manage all of them in the same manner, do everything at runtime and copy all files via post build steps?  I think the answer is that there isn&#8217;t a real reason for this except for the purity of the architecture, something that should immediately be questioned for intrinsic use.  I&#8217;d love to hear any opinions from the experts out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/07/when-decoupling-goes-bad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python Development on Windows</title>
		<link>http://mentalpandiculation.com/2010/06/python-development-on-windows/</link>
		<comments>http://mentalpandiculation.com/2010/06/python-development-on-windows/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 16:56:24 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[windows programming]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=289</guid>
		<description><![CDATA[I&#8217;ve been rededicating myself to a Python project over the last couple of days and hence have been trying to get my Dell Windows 7 laptop set up for Python development again. It hasn&#8217;t been particularly easy. The things I&#8217;ve run into so far: 1. Python 2.6 happily runs on Windows 64bit whatever but not [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been rededicating myself to a Python project over the last couple of days and hence have been trying to get my Dell Windows 7 laptop set up for Python development again.  It hasn&#8217;t been particularly easy.  The things I&#8217;ve run into so far:</p>
<p>1.  Python 2.6 happily runs on Windows 64bit whatever but not all 3rd party libraries are so forward thinking.  Specifically, if you&#8217;ve got a project using PostgreSQL and SqlAlchemy, SqlAlchemy will complain about the Python driver psycopg2 on 64bit systems.  There are other drivers out there but my solution was just to rollback my 64bit installation of Python and reinstall a 32bit version.  That seems to be working fine though I haven&#8217;t gotten to the point of actually reading and writing data yet.</p>
<p>2.  PYTHONPATH on Windows via the registry doesn&#8217;t seem to work, at least on my Windows 7 64bit installation.  I have added the required registry keys per the documentation, rebooted 42 times and done the Guido van Rossum Purple Rain Remix dance with exactly zero results.  For now, I&#8217;m just creating an environment variable the old fashioned way.</p>
<p>3.  The real problem that led me to having to modify PYTHONPATH was that package imports just don&#8217;t seem to be working.  I&#8217;m sure this is me being the Python equivalent of Charlie in Flowers For Algernon.  I think in the past I must have had some magical setting or batch file that modified PYTHONPATH at startup or something but I wish my subpackage imports worked without having to resort to that.  </p>
<p>On the plus side, my first TDD test passed first time up so I&#8217;ve got that going for me, which is nice.  At least the code isn&#8217;t so stale that it doesn&#8217;t even function anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/06/python-development-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac Computers, Microsoft Keyboards and a Lost 3 Hours</title>
		<link>http://mentalpandiculation.com/2010/05/mac-computers-microsoft-keyboards-and-a-lost-3-hours/</link>
		<comments>http://mentalpandiculation.com/2010/05/mac-computers-microsoft-keyboards-and-a-lost-3-hours/#comments</comments>
		<pubDate>Wed, 12 May 2010 14:45:56 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Bad UI Design]]></category>
		<category><![CDATA[F Lock]]></category>
		<category><![CDATA[Function Keys]]></category>
		<category><![CDATA[mac dev]]></category>
		<category><![CDATA[Microsoft keyboards]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=287</guid>
		<description><![CDATA[I do my primary development at work on a Mac computer using a Microsoft Natural 4000 ergonomic keyboard. Because I&#8217;m predominantly a Microsoft .Net developer, function keys are reasonably integral to my day to day life, not just in the Visual Studio IDE but also in SqlYog, the MySQL client we use. Having to execute [...]]]></description>
			<content:encoded><![CDATA[<p>I do my primary development at work on a Mac computer using a Microsoft Natural 4000 ergonomic keyboard.  Because I&#8217;m predominantly a Microsoft .Net developer, function keys are reasonably integral to my day to day life, not just in the Visual Studio IDE but also in SqlYog, the MySQL client we use.  Having to execute queries or debugging steps using menus with the mouse drives me insane.  I&#8217;m no <a href="http://blog.perfecting.me/">shortcut master</a> but I know the main ones that I run into in my daily life.  So when the function keys stopped working in an expected way, I pretty much had to shut down work and fix it.  </p>
<p>For those following along at home, you can get function keys to work on a Mac by going to System Preferences -> Keyboard and then checking the &#8220;Use F1, F2, etc as standard function keys.&#8221;  I had done that early on and everything worked fine.  Suddenly, last Friday, those keys started opening up the Start menu in Parallels and Finder on the Mac.  Not good.  So I started digging around and didn&#8217;t really run into much on the interwebs.  I then decided to use my extensive Twitter network and luckily, with some long distance debugging, <a href="http://blog.davidohara.net/">David O&#8217;Hara</a> got me to the right solution which was to turn off the <a href="http://en.wikipedia.org/wiki/F-Lock">F Lock key</a> on the Microsoft keyboard.  </p>
<p>Somewhere along the way, I guess that I had managed to hit that key and what that did was disable function keys from the Microsoft keyboard&#8217;s perspective.  When that happened, the &#8220;Use F1, F2, etc. . .&#8221; checkbox in System Preferences disappeared because Mac OS thought the keyboard didn&#8217;t support it.  Even reinstalling the keyboard software didn&#8217;t help.  Once I hit that key (which is dangerously close to the Backspace key in my unbalanced UI design opinion), all bets were off.</p>
<p>So if you are having trouble with function keys on a Mac, try toggling the F Lock key and quietly curse whoever thought it was a good idea to have a key that changed the behavior of 12 other keys.  This is terrible UI design in my opinion, you should have to work to change something like that, i.e. put this in the control panel.  There are also ways to <a href="http://jtsang.mvps.org/flock.html">disable</a> it should you so choose.</p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/05/mac-computers-microsoft-keyboards-and-a-lost-3-hours/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>State and Identity</title>
		<link>http://mentalpandiculation.com/2010/05/state-and-identity/</link>
		<comments>http://mentalpandiculation.com/2010/05/state-and-identity/#comments</comments>
		<pubDate>Wed, 05 May 2010 14:19:48 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[thinking out loud]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=262</guid>
		<description><![CDATA[Thinking out loud here. I&#8217;ve been rededicating some of my attention to Clojure lately with some basic success. However, coming from a background of object oriented languages focused on imperative programming and mutable state, I&#8217;m having trouble really internalizing the concepts in Clojure. I recently read Rich Hickey&#8217;s essay Values and Change &#8211; Clojure&#8217;s Approach [...]]]></description>
			<content:encoded><![CDATA[<p>Thinking out loud here.  I&#8217;ve been rededicating some of my attention to <a href="http://clojure.org">Clojure</a> lately with some basic success.  However, coming from a background of object oriented languages focused on imperative programming and mutable state, I&#8217;m having trouble really internalizing the concepts in Clojure.  I recently read Rich Hickey&#8217;s essay <a href="http://clojure.org/state">Values and Change &#8211; Clojure&#8217;s Approach to Identity and State</a> and while I understand it from a very high level, the details seem to escape me in some significant way when I think about writing programs in a functional style using mostly immutable data.  </p>
<p>The real problem is that I don&#8217;t completely understand what I&#8217;m not understanding.  There is just a fuzzy, nagging feeling in the back of my brain that says &#8220;This can never work&#8221;, examples to the contrary notwithstanding.  As a C# developer, I&#8217;m used to just modifying anything as necessary in my programs, adding values to lists, modifying dictionaries, randomly changing object values just to screw with people.  Ok, maybe not that last part.  But with Clojure, the world is very, very different.  </p>
<pre class="brush: clojure;">Last login: Tue May  4 16:42:01 on ttys000
Bretts-Mac-Pro:~ admin$ clj
Clojure 1.1.0
user=&gt; (def mylist '(1 2 3))
#'user/mylist
user=&gt; mylist
(1 2 3)
user=&gt; (cons 4 mylist)
(4 1 2 3)
user=&gt; mylist
(1 2 3)
user=&gt;
</pre>
<p>Here, I create a list, show the list at the command line, cons another number to the list and then show that the original list is unchanged.  This takes some getting used to.  Rich recommends the following when coming from an OO language:</p>
<blockquote><p> In coming to Clojure from an OO language, you can use one of its persistent collections, e.g. maps, instead of objects. Use values as much as possible. And for those cases where your objects are truly modeling identities (far fewer cases than you might realize until you start thinking about it this way), you can use a Ref or Agent with e.g. a map as its state in order to model an identity with changing state. </p></blockquote>
<p>Conceptually, I can think of a map of maps to model the world but I&#8217;ll be damned if I can really accept it right now.  I understand the benefits behind the immutable data of Clojure but I look at my day to day programming tasks and just don&#8217;t see where it&#8217;s important.  Maybe that&#8217;s just a failure of my imagination.  I&#8217;m continuing to plug away on learning Clojure, trying to work my way into the Concurrency chapter of Stuart Halloway&#8217;s <em><a href="http://www.pragprog.com/titles/shcloj/programming-clojure">Programming Clojure</a></em> which has been excellent.  </p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/05/state-and-identity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Clojure Highlighting On WordPress</title>
		<link>http://mentalpandiculation.com/2010/05/clojure-highlighting-on-wordpress/</link>
		<comments>http://mentalpandiculation.com/2010/05/clojure-highlighting-on-wordpress/#comments</comments>
		<pubDate>Tue, 04 May 2010 16:24:20 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[syntax highlighting]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=276</guid>
		<description><![CDATA[I&#8217;ve spent the morning getting highlighting working with WordPress and thought it might be worth the writeup to detail my steps since there was one significant gotcha when using published information. I&#8217;m using the SyntaxHighlighter Evolved plugin which you can search for on the Plugins page of your WordPress installation. Install that plugin first. Once [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent the morning getting highlighting working with WordPress and thought it might be worth the writeup to detail my steps since there was one significant gotcha when using published information.</p>
<p>I&#8217;m using the <a href="http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/">SyntaxHighlighter Evolved</a> plugin which you can search for on the Plugins page of your WordPress installation.  Install that plugin first.</p>
<p>Once that&#8217;s done, you&#8217;ll need to <a href="http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/adding-a-new-brush-language/">follow the directions</a> for creating third party brushes for Syntax Highlighter.  Specifically, you&#8217;re going to need to create your own plugin, which is pretty simple to do.  Here&#8217;s what I did.</p>
<p>First, create a new folder in your plugins folder called clojurebrush.  In that folder, create a php file with the following code (feel free to change the details at the top):</p>
<pre class="brush: php;">&lt;?php
/*
Plugin Name: SyntaxHighlighter Evolved: Clojure Brush
Description: Adds support for the Clojure language to the SyntaxHighlighter Evolved plugin.
Author: Brett Bim
Version: 1.1.0
Author URI: http://yourblog.com/
*/

// SyntaxHighlighter Evolved doesn't do anything until early in the &quot;init&quot; hook, so best to wait until after that
add_action( 'init', 'syntaxhighlighter_clojure_regscript' );

// Tell SyntaxHighlighter Evolved about this new language/brush
add_filter( 'syntaxhighlighter_brushes', 'syntaxhighlighter_clojure_addlang' );

// Register the brush file with WordPress
function syntaxhighlighter_clojure_regscript() {
    wp_register_script( 'syntaxhighlighter-brush-clojure', plugins_url( 'shBrushClojure.js', __FILE__ ), array('syntaxhighlighter-core'));
}

// Filter SyntaxHighlighter Evolved's language array
function syntaxhighlighter_clojure_addlang( $brushes ) {
    $brushes['clojure'] = 'clojure';
    $brushes['clj'] = 'clojure';

    return $brushes;
}

?&gt;</pre>
<p>Note that this is the same file structure as the directions from the previous link with the exception of removing the version number from the wp_register_script() function call.  That&#8217;s the thing that ate up a good chunk of my morning.</p>
<p>Once that&#8217;s done, you&#8217;ll need the <a href="http://travis-whitton.blogspot.com/2009/06/syntaxhighlighter-for-clojure.html">JavaScript brush file for Clojure</a> from Travis Whitton.  Dump that into the clojurebrush folder that you created above.  Go to your Plugins in WordPress and activate your new plugin.  Once that&#8217;s done, you should have syntax highlighting in WordPress enabled.</p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/05/clojure-highlighting-on-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Firefox Styling Gotcha With ComponentArt TreeView</title>
		<link>http://mentalpandiculation.com/2010/04/firefox-styling-gotcha-with-componentart-treeview/</link>
		<comments>http://mentalpandiculation.com/2010/04/firefox-styling-gotcha-with-componentart-treeview/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 17:55:28 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[hiding controls]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=259</guid>
		<description><![CDATA[This was a fun one that I ran into today. I don&#8217;t think it&#8217;s specific to ComponentArt but that&#8217;s where I ran into it. We have a web form that has a couple of tables on it, used for switching back and forth between viewable controls. One of the tables contains a ComponentArt TreeView. Based [...]]]></description>
			<content:encoded><![CDATA[<p>This was a fun one that I ran into today.  I don&#8217;t think it&#8217;s specific to ComponentArt but that&#8217;s where I ran into it.  We have a web form that has a couple of tables on it, used for switching back and forth between viewable controls.  One of the tables contains a ComponentArt TreeView.  Based on user interaction, we would use JavaScript to change the applicable table&#8217;s styles to block or none, depending on whether we wanted it shown or not.  This worked great in all browsers but Firefox.  Firefox seemed to ignore all sizing on the table and instead would fit the table to the TreeView based on the contents.  We wanted the tables to stay 100% sized so having weird rendering problems in Firefox wasn&#8217;t acceptable.</p>
<p>Turns out, Firefox doesn&#8217;t like having tables&#8217; styles set to &#8220;block&#8221; as a way to make them visible, ala the 10th post in <a href="http://www.componentart.com/community/forums/p/6355/6355.aspx">this thread</a>.  So instead of doing this:</p>
<pre name="code" class="jscript">    function showCourseList()
		{
			document.getElementById('tblList').style.display = 'block';
			document.getElementById('tblTree').style.display = 'none';
			fixMoz();
		}</pre>
<p>I did this instead:</p>
<pre name="code" class="jscript">    function showCourseList()
		{
			document.getElementById('tblList').style.display = '';
			document.getElementById('tblTree').style.display = 'none';
			fixMoz();
		}</pre>
<p>This works not only in Firefox but all other major tested browsers which in my case is IE and Safari.  </p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/04/firefox-styling-gotcha-with-componentart-treeview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Writing Software To Show My Mom</title>
		<link>http://mentalpandiculation.com/2010/03/writing-software-to-show-my-mom/</link>
		<comments>http://mentalpandiculation.com/2010/03/writing-software-to-show-my-mom/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 05:11:24 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[navel gazing]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[shipping]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=256</guid>
		<description><![CDATA[I recently read Amy&#8217;s story at Year of Hustle and it really struck a chord with me. I&#8217;ve been writing software for going on 10 years now and I don&#8217;t have a single thing that I&#8217;ve done in my every day work life that I can point to as mine. I can&#8217;t tell my mom [...]]]></description>
			<content:encoded><![CDATA[<p>I recently read <a href="http://yearofhustle.com/amy">Amy&#8217;s story</a> at Year of Hustle and it really struck a chord with me.  I&#8217;ve been writing software for going on 10 years now and I don&#8217;t have a single thing that I&#8217;ve done in my every day work life that I can point to as mine.  I can&#8217;t tell my mom &#8220;go to this web site, I did that&#8221;.  That&#8217;s a lot of years of working to have everything behind some firewall.  Don&#8217;t get me wrong, I&#8217;ve got personal websites that run a variety of things for me but nothing beyond 5-10 users at particular times of the year.  I don&#8217;t have a central location for my work partially because it never occurred to me but mostly because I just don&#8217;t have that work to display.</p>
<p>Making that realization got me thinking.  I don&#8217;t much care for the feeling of 10 years of work that I can&#8217;t even refer to outside of a resume.  Frankly, it&#8217;s a little depressing.  So I&#8217;d like to make 2010 my year of hustle.  I&#8217;d like to actually ship something that someone uses, a piece of software that I can at least be proud of.  I&#8217;ve got a few ideas of things but one thing I struggle with is losing interest in a project.  It would be generous to say that I&#8217;m a habitual project starter.  I have shiny jangly disease and it manifests itself regularly.  Part of the problem is that I thrive on feedback.  I don&#8217;t need a lot of it but if I have to sit around working on something for a month with zero feedback, I&#8217;m going to lose interest.  That happens a lot in my personal projects.  So I&#8217;ve got to find a way around that.</p>
<p>One thing that would help is actually shipping pieces of something, something that could provide very definite and regular feedback.  One idea is to create a main portal for my digital presence on the web.  Currently, if you google me, you don&#8217;t even find this blog.  You also don&#8217;t find my regular blog or my photoblog.  I&#8217;d like to turn brettbim.com into a centralized portal for all my work, writing and photography.  I&#8217;ve started playing around with that idea but the learning curve for designing something useful is pretty high for me, given the fact that I think WordPress would be the way to go.  I have four WordPress blogs that get some level of regular attention so it seems like it would makes sense to use WordPress as the CMS for all my content.  Problem is, when God was handing out designing skills, I was at recess.  So I&#8217;ve got some learning there but then, I suppose that&#8217;s the point of having a year of hustle.</p>
<p>I have a few other very nebulous ideas that could be done in a year.  I need to spend some time fleshing them out.  I know I&#8217;m not particularly thrilled with how my work life has played out over the last 10 years.  Much of what I&#8217;ve done has been low on the creativity scale and that is a big drain.  I got into programming because it was a way to exercise my brain on a regular basis and exercise my need for creativity.  As it turns out, most programming in corporate environments does neither.  I&#8217;ve been lucky over the past few years to be in jobs that really stretched my mental capacity including my current job but the creativity always seems to be missing.  </p>
<p>I&#8217;m not really sure what a year of hustle will look like for me.  I think the best thing I could do would be to just start throwing stuff out there and see what sticks.  My life has been changing in quite a few ways lately so we might as well go full out.  I&#8217;d like to ship one thing this year at the very least.  We&#8217;ll set the bar low and see what happens.</p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/03/writing-software-to-show-my-mom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making CheckBoxList Play Nice With JavaScript</title>
		<link>http://mentalpandiculation.com/2010/03/making-checkboxlist-play-nice-with-javascript/</link>
		<comments>http://mentalpandiculation.com/2010/03/making-checkboxlist-play-nice-with-javascript/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 14:55:43 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=251</guid>
		<description><![CDATA[I&#8217;m working on a web page that allows the user to apply a variety of filters to a set of data. The old implementation involved a check box for each filter and then a ListBox with MultipleSelection set to true. The user would tick what ever filter they wanted to include and then select the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a web page that allows the user to apply a variety of filters to a set of data.  The old implementation involved a check box for each filter and then a ListBox with MultipleSelection set to true.  The user would tick what ever filter they wanted to include and then select the items out of the ListBox.  Every time the user makes a selection in one of the ListBoxes, we&#8217;re making an AJAX call to update the current filters.  That works great but the user has to do two things, first tell us that they want to use a particular filter using the appropriate CheckBox and then select items out of the ListBox, sometimes holding down the Shift or Control key to do multiple selection.  </p>
<p>We decided to change that to a CheckBoxList for each filter.  This removes one step and makes the UI a little more fluid.  However, it did cause one problem.  Previously, the ListBoxes were being loaded with data on PageLoad by just adding a new ListItem for each piece of data.  This works well because the ListItem can hold whatever value you want to key off of.  However, a CheckBoxList renders as a table of CheckBoxes, none of which have the ability to hold a piece of data to key off of.  </p>
<pre name="code" class="csharp">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            for(int x = 0; x < 3; x++)
            {
                MyListBox.Items.Add(new ListItem("my value is " + x, x.ToString()));
            }
        }
    }
</pre>
<p>That code rendered a ListBox that had source like this:</p>
<pre name="code" class="html">
<select size="4" name="Tabstrip1:StudentsTab:MyListBox" id="Tabstrip1_StudentsTab_MyListBox" OnClick="DoSomething();">
<option value="0">my value is 0</option>
<option value="1">my value is 1</option>
<option value="2">my value is 2</option>
</select>
</pre>
<p>From there, it was really easy to grab the value of any selections via JavaScript.  Unfortunately, as mentioned above, the CheckBoxList does not render that way.  Using the same code in the PageLoad ends up rendering this HTML:</p>
<pre name="code" class="html">
<table id="Tabstrip1_StudentsTab_MyCheckBoxList" OnClick="DoSomething();" border="0">
<tr>
<td>
<input id="Tabstrip1_StudentsTab_MyCheckBoxList_0" type="checkbox" name="Tabstrip1:StudentsTab:MyCheckBoxList:0" /><label for="Tabstrip1_StudentsTab_MyCheckBoxList_0">my value is 0</label></td>
</tr>
<tr>
<td>
<input id="Tabstrip1_StudentsTab_MyCheckBoxList_1" type="checkbox" name="Tabstrip1:StudentsTab:MyCheckBoxList:1" /><label for="Tabstrip1_StudentsTab_MyCheckBoxList_1">my value is 1</label></td>
</tr>
<tr>
<td>
<input id="Tabstrip1_StudentsTab_MyCheckBoxList_2" type="checkbox" name="Tabstrip1:StudentsTab:MyCheckBoxList:2" /><label for="Tabstrip1_StudentsTab_MyCheckBoxList_2">my value is 2</label></td>
</tr>
</table>
</pre>
<p>As you can see, none of the checkboxes have the value attribute.  There is now a label for each one but it has the Key of the ListItem and not the Value which isn't particularly helpful when you want to display one piece of data for the user but process another one based on their selection.  What to do?</p>
<p>As it turns out, you can add an attribute that gets rendered as a span around both the input and label elements.  In JavaScript, you can then grab an array of the inputs and an array of the span elements.  When one of the input boxes is found to be checked, you can get the corresponding span element's attribute and use it.  It looks a little something like this:</p>
<pre name="code" class="csharp">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            for(int x = 0; x < 3; x++)
            {
                ListItem li = new ListItem {Text = "my value is " + x, Value = x.ToString()};
                li.Attributes.Add("myspecialid", x.ToString());
                MyCheckBoxList.Items.Add(li);
            }
        }
    }
</pre>
<p>When the items are loaded into the ListItems, we add an attribute called "myspecialid".  It can be anything you want though it doesn't work if you pick a known attribute like id or value.  Once that's done, the HTML renders like this:</p>
<pre name="code" class="html">
<table id="Tabstrip1_StudentsTab_MyCheckBoxList" OnClick="DoSomething();" border="0">
<tr>
<td><span myspecialid="0">
<input id="Tabstrip1_StudentsTab_MyCheckBoxList_0" type="checkbox" name="Tabstrip1:StudentsTab:MyCheckBoxList:0" /><label for="Tabstrip1_StudentsTab_MyCheckBoxList_0">my value is 0</label></span></td>
</tr>
<tr>
<td><span myspecialid="1">
<input id="Tabstrip1_StudentsTab_MyCheckBoxList_1" type="checkbox" name="Tabstrip1:StudentsTab:MyCheckBoxList:1" /><label for="Tabstrip1_StudentsTab_MyCheckBoxList_1">my value is 1</label></span></td>
</tr>
<tr>
<td><span myspecialid="2">
<input id="Tabstrip1_StudentsTab_MyCheckBoxList_2" type="checkbox" name="Tabstrip1:StudentsTab:MyCheckBoxList:2" /><label for="Tabstrip1_StudentsTab_MyCheckBoxList_2">my value is 2</label></span></td>
</tr>
</table>
</pre>
<p>Our new attribute has been included in a span tag around the input element and the value we want to track is included there.  Now in JavaScript, we can do this:</p>
<pre name="code" class="javascript">
function DoSomething() {
    var tableBody = document.getElementById("Tabstrip1_StudentsTab_MyCheckBoxList");
    var inputArray = tableBody.getElementsByTagName("input");
    var spanArray = tableBody.getElementsByTagName("span");
    for (var x = 0; x < inputArray.length; x++) {
        if (inputArray[x].checked) {
            alert("The id I want is " + spanArray[x].getAttribute("myspecialid"));
        }
    }
    if (groupsSelected.length > 0) {
        __aspx.HandleMonitorGroupFilter(groupsSelected);
    }
}
</pre>
<p>We grab all the input and span elements in the table.  Then when we find a checkbox that is checked, we can grab the attribute we're interested in off of the appropriate span element using the getAttribute method.  This is slightly hackish in that the two arrays of elements have to be in the same order but that seems like a reasonably safe assumption to make.</p>
<p>Overall, it seems like a good way to make the UI more fluid while still retaining the ability to manipulate necessary data on the AJAX calls.  </p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/03/making-checkboxlist-play-nice-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google and Internet Explorer</title>
		<link>http://mentalpandiculation.com/2010/03/google-and-internet-explorer/</link>
		<comments>http://mentalpandiculation.com/2010/03/google-and-internet-explorer/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 13:32:34 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=249</guid>
		<description><![CDATA[Yesterday, the Gmail guys announced an improvement to Gmail related to popping windows out which makes multitasking easier. This is a pretty cool feature, one I think I subconsciously knew existed but never used. I run into this all the time when I&#8217;m writing a new message. Typically, I have to add more recipients but [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, the Gmail guys announced an improvement to Gmail related to <a href="http://gmailblog.blogspot.com/2010/03/fast-new-windows.html">popping windows out</a> which makes multitasking easier.  This is a pretty cool feature, one I think I subconsciously knew existed but never used.  I run into this all the time when I&#8217;m writing a new message.  Typically, I have to add more recipients but I can&#8217;t remember their emails and the autocomplete isn&#8217;t helping.  Also, I search my email a lot while writing a new message and before I&#8217;ve always had to save to draft, go search, then go back to the draft.  PITA.  So this feature is muy cool.  The whole reason for the post is that they have sped up the new window creation considerably.  This is also muy cool.</p>
<p>What does this have to do with Internet Explorer?  From the post:</p>
<blockquote><p>Unfortunately, we weren&#8217;t able to make this work in Internet Explorer, so to see the speed-up, you&#8217;ll need to be using Mozilla Firefox, Apple&#8217;s Safari, or Google Chrome. </p></blockquote>
<p>Not to go all conspiracy theorist on your ass but how hard do you think they really tried?  Can&#8217;t you just see the engineers sitting around the conference table discussing this when Bob says &#8220;Wouldn&#8217;t it be cool if we just didn&#8217;t implement this for IE?&#8221;  I just find it hard to believe that the geniuses at Google couldn&#8217;t come up with a way to make this work in IE.  Maybe there really are some technological limitations that my puny brain can&#8217;t possibly handle but it&#8217;s a way better story if they just didn&#8217;t bother to try.  Not that I&#8217;m complaining, I&#8217;d barely use IE if it was the last browser on earth after a nuclear holocaust.</p>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/03/google-and-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning MySql 45 Minutes at a Time</title>
		<link>http://mentalpandiculation.com/2010/02/learning-mysql-45-minutes-at-a-time/</link>
		<comments>http://mentalpandiculation.com/2010/02/learning-mysql-45-minutes-at-a-time/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 15:06:25 +0000</pubDate>
		<dc:creator>Niklaus Wirth's Ghost</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mac dev]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://mentalpandiculation.com/?p=245</guid>
		<description><![CDATA[This and all future MySql posts are really for my own record keeping so that when dumb things happen that take me 45 minutes to fix, I have a record of them for future such incidents. Today, for some reason, I couldn&#8217;t log in remotely to the MySql instance running on my Mac. This has [...]]]></description>
			<content:encoded><![CDATA[<p>This and all future MySql posts are really for my own record keeping so that when dumb things happen that take me 45 minutes to fix, I have a record of them for future such incidents.</p>
<p>Today, for some reason, I couldn&#8217;t log in remotely to the MySql instance running on my Mac.  This has been working just fine for the past month so needless to say, I had no idea what happened.  As it turned out, the IP address of my Parallels instance had changed, rendering all the entries in my user table pointless.  I had to update the user table with the new IP, restart the MySql instance and boom, up and running again.</p>
<p>Login from the terminal first: </p>
<pre name="code" class="sql">mysql -u root -p</pre>
<p>Then:</p>
<pre name="code" class="sql">USE mysql; 

select Host, User from user;

update user Set Host = 'NEW IP' where Host = 'OLD IP';

select Host, User from user;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mentalpandiculation.com/2010/02/learning-mysql-45-minutes-at-a-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
