<?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>Sophomore Dev</title>
	<atom:link href="http://www.sophomoredev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sophomoredev.com</link>
	<description>Keeping track of what I learn so hopefully no one else has to.</description>
	<lastBuildDate>Sat, 27 Mar 2010 20:28:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Introducing YUI Effects, Data Storage and Lightbox</title>
		<link>http://www.sophomoredev.com/2010/03/introducing-yui-effects-data-storage-and-lightbox/</link>
		<comments>http://www.sophomoredev.com/2010/03/introducing-yui-effects-data-storage-and-lightbox/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 02:36:45 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[YUI]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui3]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=72</guid>
		<description><![CDATA[Phew! Just finished building out documentation and examples for my first ever YUI 3 gallery contributions.  The motivation for all three is roughly the same &#8212; take existing, popular, awesome JavaScript packages built on other JavaScript libraries and bring them to YUI.  So the three I decided on include two that I&#8217;ve always wished YUI [...]]]></description>
			<content:encoded><![CDATA[<p>Phew! Just finished building out documentation and examples for my first ever <a href="http://developer.yahoo.com/yui/3/">YUI 3</a> gallery contributions.  The motivation for all three is roughly the same &#8212; take existing, popular, awesome JavaScript packages built on other JavaScript libraries and bring them to YUI.  So the three I decided on include two that I&#8217;ve always wished YUI had and one more that I wanted to play with (Lightbox).</p>
<p>And I&#8217;m happy to say all three are ready to go.  Here&#8217;s a quick break down of what&#8217;s being released.  You can go to <a href="http://projects.sophomoredev.com">http://projects.sophomoredev.com</a> for information about all three.</p>
<h3>Effects</h3>
<p><a href="http://projects.sophomoredev.com/yui-gallery-effects/">http://projects.sophomoredev.com/yui-gallery-effects/</a></p>
<p>I&#8217;ve always loved how you can quickly add slick animations in jQuery and other JavaScript library with a simple <code>$("#elephant").fade()</code> and other similar commands.  Now YUI 3&#8242;s Anim module can definitely handle a simple fade and a bunch more, but the code you have to write is a little verbose.  The &#8220;gallery-effects&#8221; module is meant to provide a simple framework and  API for using the YUI 3 Anim utility that will allow you to quickly and  easily animate nodes.  You&#8217;ll see that the framework and API are derived  from Scriptaculous (heck, even the examples are taken from their  documentation).  The goal is to make animation with YUI as easy, if not  easier, than with other JavaScript libraries.</p>
<p>In addition, I&#8217;ve tested this thoroughly on all Grade-A browser so it will &#8220;just work&#8221;</p>
<h3>Lightbox</h3>
<p><a href="http://projects.sophomoredev.com/yui-gallery-lightbox/">http://projects.sophomoredev.com/yui-gallery-lightbox/</a></p>
<p><a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox</a> and it&#8217;s numerous <a href="http://www.google.com/#q=lightbox+modifications">spin-offs</a> and in use all over the Web.  YUI 3 has great support for overlays and the widget framework is great, but no Lightbox yet.  So I&#8217;ve taken care of that with a literal port of Lightbox to YUI and plans to make it more flexible going forward (think non-image content, slideshow support, etc.).  Although if you&#8217;re looking for immediate slideshow support, there are some great module already available in the <a href="http://yuilibrary.com/gallery/">YUI 3 Gallery</a>.</p>
<h3>Data Storage</h3>
<p><a href="http://projects.sophomoredev.com/yui-gallery-data-storage/">http://projects.sophomoredev.com/yui-gallery-data-storage/</a></p>
<p>Finally, although you never feel like you&#8217;ll need it, I&#8217;ve been constantly wishing YUI had support for data storage on individual nodes ala jQuery.  It feels like every jQuery plugin I look at uses it in some way and it&#8217;s just an awesome convenience.  Well no more, I&#8217;ve ported it to YUI so it can be used natively with Y.Node instances and any old JavaScript object.  Also, the YUI 3 Node class has begun to introduce support for this already, so all I really had to do was build on top of that.</p>
<p>Anyway, that&#8217;s all for today.  Definitely let me know if you have questions, issues, whatever.  I&#8217;ll document any progress on these modules as I go.  Also, if anyone has any suggestions for the best way to document code with examples, I&#8217;m all ears.  I felt it was a pretty painful exercise for this project, but I could just be complaining since my bracket was busted while I was documenting. <img src='http://www.sophomoredev.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2010/03/introducing-yui-effects-data-storage-and-lightbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating my first complete Django project on Snow Leopard</title>
		<link>http://www.sophomoredev.com/2010/01/creating-my-first-complete-django-project-on-snow-leopard/</link>
		<comments>http://www.sophomoredev.com/2010/01/creating-my-first-complete-django-project-on-snow-leopard/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 19:37:58 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[snow leopard]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=56</guid>
		<description><![CDATA[Surely there were going to be some issues getting Django working on my Mac (I mean aren&#8217;t there are always some problems?), so I decided to crack open a text document and keep track of the things that happened so that in the future when I do this, I don&#8217;t run into any problems. Just [...]]]></description>
			<content:encoded><![CDATA[<p>Surely there were going to be some issues getting Django working on my Mac (I mean aren&#8217;t there are always some problems?), so I decided to crack open a text document and keep track of the things that happened so that in the future when I do this, I don&#8217;t run into any problems.</p>
<p>Just as a bit of context, I&#8217;ve been playing with Google App Engine recently and it&#8217;s been my first attempt at writing Python code.  Python and Django?  Love &#8216;em.  App Engine?  Eh, good at what it does, but I don&#8217;t really like working in Google&#8217;s sandbox.  It just feels so restrictive.  So for my next project I decided to skip the App Engine bit and try to build a site still using Django, but with a MySQL backend.  Because of my work with App Engine, I already had installed Django and obviously Python 2.6 and 2.6 come with a standard Snow Leopard install, so I had those as well.</p>
<p>So from there I set off.  The first thing I knew I would need was MySQL.  I&#8217;ve used MySQL before, but since doing a clean install of Snow Leopard a few months ago, I hadn&#8217;t put it back on, so first to handle that.</p>
<p>Finding the binary installer for Snow Leopard was easy, but here I made a mistake.  I figured I&#8217;d install the 32-bit version which ended up causing me some headaches.  What I didn&#8217;t realize is that Snow Leopard installs most programs as 64-bit if your machine is 64-bit.  How do you find out if your Mac is 64-bit or not?  See this short <a href="http://www.sophomoredev.com/2010/01/how-to-tell-if-you-mac-has-a-32-bit-or-64-bit-processor/">post</a> on how to tell from simply looking at your processor.  So I mistakenly installed the 32-bit version and was on my way.</p>
<p>The next thing you need to do is install a MySQL Python adapter.  The source for that is <a href="http://sourceforge.net/projects/mysql-python/">here</a>.  I chose to sudo python setup.py build/install, but you could use easy_install if you want.  Once I installed, I tried to import the MySQLdb package and got the following error:</p>
<pre>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 13, in
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
</pre>
<p>This <a href="http://websaucesoftware.com/blog/?p=461">post</a> and others indicated it was related to the build architecture of Python and MySQL. Bah, so this is when I realized I needed to go back and install the 64-bit version of MySQL.  Okay, so I downloaded the 64-bit installer and ran that.  (See further below how that worked, but not completely and I eventually did a clean install.)</p>
<p>Then I ran the following to try to re-install the MySQLdb adapter stuff:</p>
<pre>cd MySQL-python-1.2.3c1
ARCHFLAGS='-arch x86_64' python setup.py build
ARCHFLAGS='-arch x86_64' python setup.py install
</pre>
<p>No dice, still not working.  Poking through the comments of the post above, I came across <a href="http://cd34.com/blog/programming/python/mysql-python-and-snow-leopard/comment-page-1/#comment-600">this</a> indicating that re-building doesn&#8217;t actually do it from scratch and you need to go into the build directory and manually rm *.  Once I did that, then I was in business &#8212; the import MySQLdb statement now worked.</p>
<p>Following the Django <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/">tutorial</a>, I created by app, code-named &#8220;sanddollar.&#8221; So far so good until I got to:</p>
<pre>python mange.py syncdb</pre>
<p>and crossed my fingers.  Forgot to create the database, but after that I still have a problem.  I&#8217;m getting an error related to MySQL being able to create/write to a file:</p>
<pre>File "build/bdist.macosx-10.6-universal/egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
_mysql_exceptions.InternalError: (1, "Can't create/write to file '/usr/local/mysql/data/sanddollar/auth_permission.MYI' (Errcode: 2)")</pre>
<p>This was a tough one.  It spawned <a href="http://stackoverflow.com/questions/2084760/running-syncdb-on-django-project-not-working">this Stack Overflow question</a>, but after some poking around I noticed that despite the fact I was able to create databases through the MySQL Workbench, they weren&#8217;t creating new database directories under the mysql/data folder.  My suspicion was that multiple installs on MySQL had gotten MySQL in a messed up state.  Solution: remove all traces of MySQL and then do a clean install.</p>
<p>This sounds pretty straightforward, but it wasn&#8217;t.  In the end, it took two sources (<a href="http://akrabat.com/computing/uninstalling-mysql-on-mac-os-x-leopard/">here</a> and <a href="http://www.silverscripting.com/blog/2009/09/04/removing-mysql-on-snow-leopard/">here</a>) to get all the instructions for wiping MySQL where the second set of instructions is specific to Snow Leopard.  Alright, once I had done that, I used the same .pkg installer to install the 64-bit version of MySQL one more time.</p>
<p>Then I tried to connect to MySQL, and I get the following error:</p>
<pre>ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)</pre>
<p>Fairly straightforward fix.  No idea where the actual mysql.sock file is, but because I could connect via MySQL Workbench over TCP, someone in the IRC channel tipped me off to run:</p>
<pre>SELECT @@socket</pre>
<p>which outputted the location of the mysql.sock file.  In my case, it was located at /var/lib/mysql/mysql.sock.  So then I ran the following from a bash shell:</p>
<pre>$sudo ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock</pre>
<p>and voila, now I can connect from Terminal.  Almost there.  I created a new user for the &#8220;sanddollar&#8221; database named &#8220;sanddollar&#8221; and granted the user privileges for basic CRUD operations at host 127.0.0.1 (for some reason localhost wouldn&#8217;t work).  Tried to connect through Terminal, worked great. Then tried the syncdb command again and this time paydirt.</p>
<p>Final thoughts: 32-bit/64-bit is complicated, more complicated than it feels like it should be.  This makes working with Snow Leopard as a development environment a pain.  However, I learned about the &#8220;file [filename]&#8221; unix command to determine the architecture of programs.  No idea what it means but opened it up on Stack Overflow with this <a href="http://stackoverflow.com/questions/2088569/how-do-i-force-python-to-be-32-bit-on-snow-leopard-and-other-32-bit-64-bit-questi">question</a>. In the end, not too bad for getting things started.  Feels like it could be simpler, but less than a day isn&#8217;t that bad, so onwards!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2010/01/creating-my-first-complete-django-project-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to tell if you Mac has a 32-bit or 64-bit processor?</title>
		<link>http://www.sophomoredev.com/2010/01/how-to-tell-if-you-mac-has-a-32-bit-or-64-bit-processor/</link>
		<comments>http://www.sophomoredev.com/2010/01/how-to-tell-if-you-mac-has-a-32-bit-or-64-bit-processor/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 16:21:46 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[processor]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=63</guid>
		<description><![CDATA[Wow, I&#8217;ve been looking for this for a while, but finally an easy solution. The documentation is actually just on the Apple website. Basically, you just need to check the name of your processor and you&#8217;re done. http://support.apple.com/kb/HT3696]]></description>
			<content:encoded><![CDATA[<p>Wow, I&#8217;ve been looking for this for a while, but finally an easy solution.  The documentation is actually just on the Apple website. Basically, you just need to check the name of your processor and you&#8217;re done. http://support.apple.com/kb/HT3696</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2010/01/how-to-tell-if-you-mac-has-a-32-bit-or-64-bit-processor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>YUI selectors and the Prototype library aren&#8217;t going to play nicely in Internet Explorer.</title>
		<link>http://www.sophomoredev.com/2009/12/yui-selectors-and-the-prototype-library-arent-going-to-play-nicely-in-internet-explorer/</link>
		<comments>http://www.sophomoredev.com/2009/12/yui-selectors-and-the-prototype-library-arent-going-to-play-nicely-in-internet-explorer/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 18:19:51 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=51</guid>
		<description><![CDATA[Here at APT, our chosen Javascript library is YUI and we&#8217;re aggressively working on integrating more of our pages to use YUI 3 mainly because we love the syntax of the Node utility and accessing elements via CSS selectors.  However, YUI doesn&#8217;t solve all of our problems.  For instance, we want to have really great [...]]]></description>
			<content:encoded><![CDATA[<p>Here at APT, our chosen Javascript library is <a href="http://developer.yahoo.com/yui/">YUI</a> and we&#8217;re aggressively working on integrating more of our pages to use <a href="http://developer.yahoo.com/yui/3/">YUI 3</a> mainly because we love the syntax of the Node utility and accessing elements via CSS selectors.  However, YUI doesn&#8217;t solve all of our problems.  For instance, we want to have really great charts, but the YUI charting library isn&#8217;t functional enough for some of the stuff we want to do.  So instead, we&#8217;ve chosen to go with the <a href="http://solutoire.com/flotr/">Flotr</a> library, which is built on top of <a href="http://prototypejs.org/">Prototype</a>.  This means on some pages we have both YUI and Prototype includes and just the past week we found out that they don&#8217;t always play nicely.</p>
<p>Consider the following page which includes both and then simple tries to style a number of elements on the page via an ID and class selector:</p>
<pre>&lt;!doctype html&gt;
&lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;
        &lt;ul id="list"&gt;
            &lt;li class="element"&gt;1&lt;/li&gt;
            &lt;li class="element"&gt;2&lt;/li&gt;
            &lt;li class="element"&gt;3&lt;/li&gt;
            &lt;li class="element"&gt;4&lt;/li&gt;
            &lt;li class="element"&gt;5&lt;/li&gt;
            &lt;li class="element"&gt;6&lt;/li&gt;
        &lt;/ul&gt;
        &lt;script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"&gt;&lt;/script&gt;
        &lt;script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"&gt;&lt;/script&gt;
        &lt;script type="text/javascript"&gt;
            YUI({ filter : "raw"}).use("node", "event", function(Y) {
                Y.on("domready", function() {
                    Y.all("#list .element").setStyle("border", "solid 1px red");
                });
            })
        &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre>
<p>This seems simple enough, but if you try this in any version of Internet Explorer, it won&#8217;t work.  After digging through the YUI code and using the fantastic step-debugger that is part of the IE 8 Development Tools, I figured out that the problem was that Prototype adds the getElementsByClassName method to the document object if it doesn&#8217;t exist and YUI uses the existence of that method as a proxy for whether that browser implements getElementsByClassName for both the document object and HTMLElement instances.  So in this case, that check doesn&#8217;t quite work.</p>
<p>For now I&#8217;ve added &#8220;&amp;&amp; document.documentElement.getElementsByClassName&#8221; to that check in our local copy of YUI and filed a <a href="http://yuilibrary.com/projects/yui3/ticket/2528487">ticket</a> against this issue.  Use this as an example that you need to careful when combining third party JavaScript libraries.  No guarantees they&#8217;ll play nice together.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/12/yui-selectors-and-the-prototype-library-arent-going-to-play-nicely-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why can&#8217;t my Google App Engine app find the PIL module?</title>
		<link>http://www.sophomoredev.com/2009/12/why-cant-my-google-app-engine-app-find-the-pil-module/</link>
		<comments>http://www.sophomoredev.com/2009/12/why-cant-my-google-app-engine-app-find-the-pil-module/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 23:35:38 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=49</guid>
		<description><![CDATA[Specifically, I got the following error: Exception Type: ImportError Exception Value: No module named PIL Exception Location: /Library/Python/2.6/site-packages/django/forms/fields.py in clean, line 495 Python Executable: /usr/bin/python2.6 Python Version: 2.6.1 Python Path: [..., '/Library/Python/2.6/site-packages', '/Library/Python/2.6/site-packages/PIL'] Hmmm, a little stuck at this point. It&#8217;s clearly in my python path.  So I turned to my favorite programming resource, Stack [...]]]></description>
			<content:encoded><![CDATA[<p>Specifically, I got the following error:</p>
<p><code><br />
Exception Type: ImportError<br />
Exception Value: No module named PIL<br />
Exception Location:     /Library/Python/2.6/site-packages/django/forms/fields.py in clean, line 495<br />
Python Executable: /usr/bin/python2.6<br />
Python Version: 2.6.1<br />
Python Path: [..., '/Library/Python/2.6/site-packages', '/Library/Python/2.6/site-packages/PIL']<br />
</code></p>
<p>Hmmm, a little stuck at this point.  It&#8217;s clearly in my python path.  So I turned to my favorite programming resource, <a href="http://www.stackoverflow.com">Stack Overflow</a>, and posted <a href="http://stackoverflow.com/questions/1894875/django-form-in-google-app-engine-unable-to-find-module-pil">this question</a>.  Well, as it turns out there&#8217;s one thing I should&#8217;ve known and another more subtle detail.  The first, obvious thing was that of course if PIL is installed in my Python site packages, of course Google App Engine (GAE) can&#8217;t access it.  Maybe it could in my environment, but of course in production, I&#8217;m in a sandbox, so that&#8217;s definitely not going to work!  The second revelation was that PIL won&#8217;t work because it&#8217;s a C-based library and everything in GAE must be entirely Python.  So to remedy this, the GAE folks added an <a href="http://code.google.com/appengine/docs/python/images/">Images API</a>.  This all makes perfect sense now, not sure why I didn&#8217;t see this immediately.</p>
<p>Anyway, problem solved.  The annoying bit here of course is that I wasn&#8217;t going to use PIL directly, but rather through the Django forms stuff.  Alas, that won&#8217;t work.  This is something I&#8217;m finding frustrating about GAE &#8212; namely, that I see cool stuff in Django and then can&#8217;t quite use it.  I guess that&#8217;s the price you (or I) pay for using GAE.  They can&#8217;t support everything, so I have to work within the supported subset.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/12/why-cant-my-google-app-engine-app-find-the-pil-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why does Internet explorer not get my JavaScript or CSS file but all other browsers do?</title>
		<link>http://www.sophomoredev.com/2009/12/why-does-internet-explorer-not-get-my-javascript-or-css-file-but-all-other-browsers-do/</link>
		<comments>http://www.sophomoredev.com/2009/12/why-does-internet-explorer-not-get-my-javascript-or-css-file-but-all-other-browsers-do/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 01:45:31 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=47</guid>
		<description><![CDATA[I ran into a very irritating problem today, which fortunately ended up not being too terrible because I remembered that there was an issue with IE and too many tags in the &#60;head&#62; section.  Essentially, I believe the bug is summed up in this Microsoft support post titled: &#8220;All style tags after the first 30 [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a very irritating problem today, which fortunately ended up not being too terrible because I remembered that there was an issue with IE and too many tags in the &lt;head&gt; section.  Essentially, I believe the <a href="http://support.microsoft.com/kb/262161">bug</a> is summed up in this Microsoft support post titled: &#8220;All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer.&#8221;  That&#8217;s true.  In my particular case it wasn&#8217;t that CSS wasn&#8217;t being applied, but rather than &lt;script&gt; tags in the head section were not being downloaded causing JavaScript errors downstream.  From Microsoft&#8217;s explanation of their bug, this would seem like it&#8217;s unrelated, but for whatever reason when I removed some of the CSS files, suddenly my JavaScript error disappeared.  Without going into a lot of specifics, I was using the <a href="http://developer.yahoo.com/yui/3/">YUI 3</a> loading framework to get base files while including the code that I wanted to extend their classes.  The error I received was along the lines of &#8220;Object does not support this method or property,&#8221; because, the YUI classes had not been fetched/interpreted/etc.  So if you run into this problem and you&#8217;re out of ideas, check your page&#8217;s &lt;head&gt; tag and see how many &lt;script&gt; and &lt;link&gt; tags you have in there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/12/why-does-internet-explorer-not-get-my-javascript-or-css-file-but-all-other-browsers-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is the Eclipse shortcut to change the end of line delimiter?</title>
		<link>http://www.sophomoredev.com/2009/11/what-is-the-eclipse-shortcut-to-change-the-end-of-line-delimiter/</link>
		<comments>http://www.sophomoredev.com/2009/11/what-is-the-eclipse-shortcut-to-change-the-end-of-line-delimiter/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 06:32:51 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[Dev Tools]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[line delimiters]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=45</guid>
		<description><![CDATA[Okay, we&#8217;ve all been there. And, honestly, if you haven&#8217;t, you should get out a bit. You&#8217;re writing code on one platform, but that code came from another developer who wrote it on another platform (or better yet, maybe it&#8217;s met for a production environment built on another platform). In my case, it&#8217;s getting code [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, we&#8217;ve all been there.  And, honestly, if you haven&#8217;t, you should get out a bit.  You&#8217;re writing code on one platform, but that code came from another developer who wrote it on another platform (or better yet, maybe it&#8217;s met for a production environment built on another platform).  In my case, it&#8217;s getting code from someone who&#8217;s been working on a Windows box and tweaking it to run on my Mac.  Inevitably you get the fun end of line (EOL) character mismatch.  The problem is pretty straightforward, but how do you fix it?</p>
<p>Well, I use Eclipse and I&#8217;m sure others out there do as well, so here&#8217;s how to figure it out in Eclipse.  First, use Ctrl+3 to pull up Eclipse search.  I had no idea this existed, but man it&#8217;s awesome.  More info on this awesome search <a href="http://eclipsenuggets.blogspot.com/2007/05/quick-access-ctrl3-is-bliss-are-you-one.html">here</a>.  It supports searching across Perspectives, Commands, Menus and more as well as the camel case search many of us have come to love from Ctrl+Shift+R. I searched for &#8220;delimiter&#8221; and it pulled up three commands that will take care of the line delimiters for the big three &#8211; Windows, Mac and Unix.  Okay, that&#8217;s fine, but I want a shortcut.  No problem.  Just go to into the Preferences and look in General &gt; Keys.  Again, I typed delimiter, highlighted the appropriate command.  I chose a short cut of Ctrl+Shift+D for delimiter, but obviously pick whatever you want.</p>
<p>Hopefully that little insight is helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/11/what-is-the-eclipse-shortcut-to-change-the-end-of-line-delimiter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why does Internet Explorer set the value of a variable I didn&#8217;t define?</title>
		<link>http://www.sophomoredev.com/2009/10/why-does-internet-explorer-set-the-value-of-some-variables-that-i-didnt-define/</link>
		<comments>http://www.sophomoredev.com/2009/10/why-does-internet-explorer-set-the-value-of-some-variables-that-i-didnt-define/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 20:36:33 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=33</guid>
		<description><![CDATA[Wow, this is ridiculous.  Take the following snippet and throw it in a static HTML page somewhere.  Clearly it uses very poor coding style, but look at the results in Internet Explorer versus Firefox.  What on earth is IE doing?  If someone can explain that to me, I&#8217;d be very grateful. !DOCTYPE HTML PUBLIC "-//W3C//DTD [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, this is ridiculous.  Take the following snippet and throw it in a static HTML page somewhere.  Clearly it uses very poor coding style, but look at the results in Internet Explorer versus Firefox.  What on earth is IE doing?  If someone can explain that to me, I&#8217;d be very grateful.</p>
<p><code>!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;I can't believe this happens...&lt;/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
&lt;p id="bialecki"&gt;This is the "bialecki" paragraph element.&lt;/p&gt;<br />
&lt;p&gt;Check out the source.&lt;/p&gt;</p>
<p>&lt;script type="text/javascript"&gt;<br />
try {<br />
alert(bialecki.id);<br />
alert(bialecki.className);<br />
} catch (e) {<br />
alert("No, I don't define random variables.");<br />
}</p>
<p>try {<br />
// Try the following with and without the var.  Wow, IE, wow...</p>
<p>bialecki = 3;<br />
// var bialecki = 3;</p>
<p>alert("bialecki = " + bialecki)<br />
} catch (e) {<br />
alert("Error!")<br />
}<br />
&lt;/script&gt;<br />
&lt;/body&gt;</code></p>
<p>The only other point is that if you &#8220;var&#8221; scope the variable, everything is fine and it behaves as expected, even though it&#8217;s still scoping the variable to the global/window scope.  So what&#8217;s the point? Always use the &#8220;var&#8221; keyword even if you&#8217;re not going to scope your variables.  Although you should do that too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/10/why-does-internet-explorer-set-the-value-of-some-variables-that-i-didnt-define/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>With YUI 3, how do I get the HTMLElement from a Node instance?</title>
		<link>http://www.sophomoredev.com/2009/09/with-yui-3-how-do-i-get-the-htmlelement-from-a-node-instance/</link>
		<comments>http://www.sophomoredev.com/2009/09/with-yui-3-how-do-i-get-the-htmlelement-from-a-node-instance/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 02:26:46 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[YUI]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui3]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=31</guid>
		<description><![CDATA[Alright, today&#8217;s post is short, but man this took me at least 30 minutes to figure out and I only realized it after joining the YUI 3 discussion group and searching for it.  There is a method Y.Node.getDOMNode.  Just that simple.  For some reason finding the documentation for static methods in the YUI documentation is [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, today&#8217;s post is short, but man this took me at least 30 minutes to figure out and I only realized it after joining the YUI 3 discussion group and searching for it.  There is a method <a href="http://developer.yahoo.com/yui/3/api/Node.html#method_Node.getDOMNode">Y.Node.getDOMNode</a>.  Just that simple.  For some reason finding the documentation for static methods in the YUI documentation is always really hard.  I wish there was a way to see them separately.  Anyways, that&#8217;s all for today.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/09/with-yui-3-how-do-i-get-the-htmlelement-from-a-node-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploring YUI 3: What is Y.bind?</title>
		<link>http://www.sophomoredev.com/2009/09/exploring-yui-3-what-is-y-bind/</link>
		<comments>http://www.sophomoredev.com/2009/09/exploring-yui-3-what-is-y-bind/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 15:10:18 +0000</pubDate>
		<dc:creator>bialecki</dc:creator>
				<category><![CDATA[YUI]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui3]]></category>

		<guid isPermaLink="false">http://www.sophomoredev.com/?p=27</guid>
		<description><![CDATA[Wow, it&#8217;s been almost seven months since I posted anything here.  But now I&#8217;m going to try to get this blog kick-started.  Here at Applied Predictive Technologies (APT), we&#8217;ve been spending some time lately thinking through which JavaScript libraries we should be using since our current library, YUI 2, is about to be retired in [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, it&#8217;s been almost seven months since I posted anything here.  But now I&#8217;m going to try to get this blog kick-started.  Here at Applied Predictive Technologies (APT), we&#8217;ve been spending some time lately thinking through which JavaScript libraries we should be using since our current library, <a href="http://developer.yahoo.com/yui/">YUI 2</a>, is about to be retired in favor of <a href="http://developer.yahoo.com/yui/3/">YUI 3</a>.  It would seem that YUI 3 would be the obvious choice, but since it isn&#8217;t backwards compatible and the syntax is quite different, the cost of switching to that versus <a href="http://www.jquery.com/">jQuery</a> or another library.  I personally have a particular affection for jQuery because I wrote an internal dashboard for helping our engineers manage their production features and bugs with it.  When they say it&#8217;s the &#8220;write less, do more&#8221; library, they&#8217;re not kidding.</p>
<p>Anyways, the point of all of this is that I&#8217;ve been trying to weigh some of the pros and cons of the different libraries as we begin to think about where we should begin to migrate our code going forward.  I&#8217;ll devote another post to enumerating some of the differences I&#8217;ve found between those two libraries, but suffice it to say, I&#8217;ve seen awesome sites written with both, so I&#8217;m not too concerned that our choice is going to have a big impact on our ability to create a great client side experience.  After playing with YUI 3 for a while over the past few days, especially their Widget framework, it seems like a natural progression of where we were headed with our code base anyways, so YUI 3, here we come.</p>
<p>Even though I&#8217;ve made a decision to pursue YUI 3, there is still a ton I don&#8217;t know about it.  The components and utilities it offers are very different from YUI 2, although you can start to see some convergence in later point releases of YUI 2.  I&#8217;m sure there are others in the same boat, so I&#8217;m going to begin blogging about YUI 3: the new functionality, the new frameworks, and how to &#8220;translate&#8221; YUI 2 to YUI 3.  At the same time, I hope to walk through, line by line, some of the YUI functionality to help folks get a better understanding of how the Yahoo! engineers structure their code.</p>
<h1>Y.bind</h1>
<p>This may not be the most interesting topic for starters, but it&#8217;s one that illustrates a cool technique in JavaScript that John Resig has <a href="http://ejohn.org/blog/partial-functions-in-javascript/">blogged about before</a> called partial.  The official documentation for this method is <a href="http://developer.yahoo.com/yui/3/api/YUI~oop.html#method_bind">here</a>.  You can probably guess from the name, but this method has something to do with binding functions to objects.  It&#8217;s most common use case is with event handlers.  In YUI 2, you might have the following code:</p>
<pre>YAHOO.util.Event.on("myElement", "click", this.myClickHandler, this, true);</pre>
<p>This just says, when a user clicks on the element with ID &#8220;myElement&#8221;, call the method &#8220;myClickHandler,&#8221; which is a method of some object and execute that function in the context of that object.  This is a pretty common setup.  Here&#8217;s how you&#8217;d do the same thing in YUI 3:</p>
<pre>Y.get("#myElement").on("click", Y.bind(this.myClickHandler, this));</pre>
<p>This looks pretty similar.  Most of this is relatively straightforward and reminds me a lot of another JavaScript library (cough&#8230;jQuery&#8230;cough), but the one piece I was interested in was the &#8220;Y.bind&#8221; method.  Here&#8217;s what the method looks like as of the YUI 3 Beta 1:</p>
<pre>/**
 * Returns a function that will execute the supplied function in the
 * supplied object's context, optionally adding any additional
 * supplied parameters to the beginning of the arguments collection the
 * supplied to the function.
 *
 * @method bind
 * @param f {Function|String} the function to bind, or a function name
 * to execute on the context object
 * @param c the execution context
 * @param args* 0..n arguments to include before the arguments the
 * function is executed with.
 * @return {function} the wrapped function
 */
 Y.bind = function(f, c) {
     var xargs = arguments.length &gt; 2 ? Y.Array(arguments, 2, true) : null;
     return function () {
         var fn = L.isString(f) ? c[f] : f,
             args = (xargs) ? xargs.concat(Y.Array(arguments, 0, true)) : arguments;
         return fn.apply(c || fn, args);
     };
 };</pre>
<p>This method is pretty short, but what is it doing?  Let&#8217;s break it down line by line.   Notice that it takes two required arguments &#8212; a function and an &#8220;execution context,&#8221; which is a fancy way of saying an object that will be the &#8220;scope&#8221; of the function when we call it &#8212; followed by any number of optional arguments that will be included as arguments to the eventual function call.  The first line of this method determines whether we have more than two arguments, and if so, parses out all of the extra arguments into an array.</p>
<p>After that, we create a function object we&#8217;re going to return.  This is one of the things I love about JavaScript.  You can have a function that returns another function.  Really powerful.  In this case, the function we are returning first checks to see if the argument &#8220;f&#8221; is a string, and if so, assumes it&#8217;s a method on the context object.  This is just for convenience.  I could&#8217;ve re-written my example as:</p>
<pre>Y.get("#myElement").on("click", Y.bind("myClickHandler", this));</pre>
<p>and it would&#8217;ve worked exactly the same way.  Now that we have the function, we want to determine what arguments to pass to it.  If we passed extra arguments to the Y.bind call, then we want to concatenate the arguments that will be passed to this returned function onto those arguments.  Otherwise, just use whatever arguments will be passed to this function.  Finally, this function will call our original method with the context we passed in (or if it wasn&#8217;t passed in, in the context of the function we passed in itself&#8230;not quite sure what the use case for that is), applying the set of arguments we&#8217;ve merged together.  And that&#8217;s it.</p>
<p>Before finishing this, it might be helpful to see an example of how what adding extra arguments does:</p>
<pre>var alertAllTheArguments = function() {
    for (var i = 0, len = arguments.length; i &lt; len; i++) {
        alert(arguments[i]);
    }
};
var alertOneAndTwoFirst = Y.bind(myFunc, null, 1, 2));
alertOneAndTwoFirst(); // alert(1); alert(2);
alertOneAndTwoFirst("hello", "world"); // alert(1); alert(2); alert("hello"); alert("world");</pre>
<p>So as you can see, it&#8217;s basically a way to enforcing that certain arguments are always populated with certain values.  You might think, this is great, but what if I want the arguments I&#8217;m passing to be at the end of the arguments list instead of at the beginning?  Well, luckily, there&#8217;s a method for that too: Y.rbind.  If you want to do more complex things, see John Resig&#8217;s article above which has more on this technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sophomoredev.com/2009/09/exploring-yui-3-what-is-y-bind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

