<?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>New Auburn Personal Computer Services LLC</title>
	<atom:link href="http://www.napcsweb.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.napcsweb.com/blog</link>
	<description>professional web development and consulting</description>
	<lastBuildDate>Mon, 22 Aug 2011 04:57:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>On The Desired Complexity of Rails</title>
		<link>http://www.napcsweb.com/blog/2011/08/21/on-the-desired-complexity-of-rails/</link>
		<comments>http://www.napcsweb.com/blog/2011/08/21/on-the-desired-complexity-of-rails/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 04:54:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=294</guid>
		<description><![CDATA[I attended Madison Ruby this weekend and got a healthy dose of knowledge from some very talented presenters. Some of the talks focused heavily on improving our practices, especially in Rails applications. Jeff Casimir talked about making views nicer by introducing decorators. These are relatively simple to implement in a language like Ruby, but Jeff [...]]]></description>
			<content:encoded><![CDATA[<p>I attended <a href="http://madisonruby.org">Madison Ruby</a> this weekend and got a healthy dose of knowledge from some very talented presenters. Some of the talks focused heavily on improving our practices, especially in Rails applications.</p>
<p>Jeff Casimir talked about making views nicer by introducing decorators. These are relatively simple to implement in a language like Ruby, but Jeff created a nice gem to make it even easier, called <a href="https://github.com/jcasimir/draper">Draper</a>.  </p>
<p>Several talks mentioned using <a href="https://github.com/voxdolo/decent_exposure">decent_exposure</a>, a gem by Stephen Caudill, to keep instance variables out of views, as Rails does a somewhat nasty hack to get instance variables from controllers.</p>
<p>Then today, I saw <a href="http://nicksda.apotomo.de/2011/08/rails-misapprehensions-the-dependency-injection-pattern/">another article</a> talking about how Rails code could be made even more easy to maintain by leveraging Dependency Injection, a well-known, and very very useful technique.</p>
<p>On a few applications, I could have used a couple of these techniques to make the code easier to maintain later. And on one I did use a proxy instead of helpers in a complex view. But in the last six years of working on projects for clients, other consultancies, and even when I&#8217;ve mentored others, using these patterns would have been a huge jump in complexity for the majority of the projects.</p>
<p>When I decided to use Rails, it was because it was a productivity boost. When compared to Struts, Spring MVC, or other similar frameworks, Rails cuts a lot of corners in exchange for this productivity.</p>
<p>But seeing a number of respected thought leaders looking to bring this complexity to Rails makes me wonder&#8230;. is Rails (the community) growing up? Are we out of the &#8220;teenage kid that knows it all&#8221; phase? Are we done telling Java and C# programmers that they&#8217;re not &#8220;with it&#8221;? </p>
<p>Since it came on the scene, Rails, through decisions made by developers and the core committers, has evolved from something a PHP developer or Java developer would find easy to pick up to something that is much, much more complex. It&#8217;s no longer a framework for beginners, but rather a solid foundation and collection of &#8220;best practices&#8221;  to build modern web applications. Rails is now being used to build bigger and more complex applications, and that complexity calls on us to revisit concepts like decorators, proxies, service objects, and dependency injection, the very &#8220;high ceremony&#8221; things that Rails developers were proud to avoid a few years ago.</p>
<p>While I don&#8217;t expect these kinds of things to make it into Rails itself, I do expect these concepts to gain traction. But I hope they only gain traction for the 5% of the situations where they&#8217;re needed, rather than for the sake of &#8220;well, so-and-so said it was good, so I&#8217;m doing it.&#8221;  Using these tools to mediate complexity in applications adds a different kind of complexity, and that&#8217;s worth some thought, especially since, as I was told several times this weekend, there&#8217;s apparently a shortage of talented Rails developers these days.</p>
<p>Proper use of these object-oriented concepts in the right place will make our projects better. But it&#8217;s vital that we truly understand when we should apply these patterns so we can decide when the additional complexity is warranted, and where it&#8217;s overkill.  As I was reminded this weekend, there is no &#8220;golden path&#8221; in Rails. </p>
<p>I encourage you to explore these things. And read  <a href="http://www.amazon.com/gp/product/0321490452/ref=as_li_tf_tl?ie=UTF8&#038;tag=webdesfordev-20&#038;linkCode=as2&#038;camp=217145&#038;creative=399369&#038;creativeASIN=0321490452">Design Patterns in Ruby</a><img src="http://www.assoc-amazon.com/e/ir?t=webdesfordev-20&#038;l=as2&#038;o=1&#038;a=0321490452&#038;camp=217145&#038;creative=399369" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
 while you&#8217;re at it, especially if these concepts are new to you. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2011/08/21/on-the-desired-complexity-of-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Oracle Client on Ubuntu.</title>
		<link>http://www.napcsweb.com/blog/2011/05/31/installing-oracle-client-on-ubuntu/</link>
		<comments>http://www.napcsweb.com/blog/2011/05/31/installing-oracle-client-on-ubuntu/#comments</comments>
		<pubDate>Tue, 31 May 2011 15:15:31 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=288</guid>
		<description><![CDATA[Ubuntu isn&#8217;t one of the supported operating systems from Oracle, so we have do to some manual work to get things set up. First, we need to create a home for the files we&#8217;ll be downloading. sudo mkdir -p /opt/oracle/11_2 sudo apt-get install libaio1 Then we need to visit Oracle&#8217;s download page and grab these [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu isn&#8217;t one of the supported operating systems from Oracle, so we have do to some manual work to get things set up.</p>
<p>First, we need to create a home for the files we&#8217;ll be downloading.</p>
<pre><code>
sudo mkdir -p /opt/oracle/11_2
sudo apt-get install libaio1
</code></pre>
<p>Then we need to visit Oracle&#8217;s download page and grab these three files for the Instant Client for Linux:</p>
<p>Instant Client Basic-Lite<br />
Instant Client SDK<br />
Instant Client SQLPlus*</p>
<p>We&#8217;ll want the  ZIP files, not the RPM files,  for each one. You will need an Oracle account to download these files.</p>
<p>Then, once we get those zip files  over to our Ubuntu server, we need to unzip them all. We should end up with a folder called </p>
<pre><code>instantclient_11_2</code></pre>
<p>Now let&#8217;s move that folder into the /opt/oracle/11_2 structure we made.</p>
<pre><code>mv instantclient_11_2 /opt/oracle/11_2/instantclient</code></pre>
<p>Next, we need to open /etc/environment and add this line:</p>
<pre><code>
LD_LIBRARY_PATH=/opt/oracle/11_2/instantclient</code></pre>
<p>The LD_LIBRARY_PATH is a variable used by lots of programs that talk to Oracle. </p>
<p>At this point, you will want to estart your terminal session so the environment variable will be available. You could set it manually, but this is a good place to test to make sure that the variable is actually loading into the environment.</p>
<p>Next, we&#8217;ll fire up sqlplus to make sure that the Oracle stuff is installed properly. </p>
<pre><code>sqlplus</code></pre>
<p>If it comes up without any errors, we&#8217;re good to go. We can exit with CTRL+C.</p>
<p>Next, let&#8217;s install the Ruby Oracle adapter. We&#8217;ll need to symlink a file since we&#8217;re using the InstantClient.</p>
<pre><code>
cd /opt/oracle/11_2/instantclient
ln -s libclntsh.so.11.1 libclntsh.so
</code></pre>
<p>Next, we need to copy over all the development header files into the instantclient root folder so RubyGems can find them when it needs to compile the native extensions.</p>
<pre><code>
cd /opt/oracle/11_2/instantclient/
cp sdk/include/*.h .
</code></pre>
<p>Finally, we can install the gem. If you&#8217;re using sudo, then the environment won&#8217;t have the variables you need so you&#8217;ll need to pass them with the command.</p>
<pre><code>sudo env LD_LIBRARY_PATH=/opt/oracle/11_2/instantclient gem install ruby-oci8</code></pre>
<p>That should be it. If you run into other problems, don&#8217;t fight with Oracle &#8211; just remove the /opt/oracle/11_2/instantclient folder and start over.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2011/05/31/installing-oracle-client-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3, Refactored Code, and Docs</title>
		<link>http://www.napcsweb.com/blog/2011/05/10/rails3_refactored_code_docs/</link>
		<comments>http://www.napcsweb.com/blog/2011/05/10/rails3_refactored_code_docs/#comments</comments>
		<pubDate>Tue, 10 May 2011 19:43:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=280</guid>
		<description><![CDATA[If you&#8217;ve been doing Rails work for a long time, you&#8217;re familiar with the difference between delete and destroy in your ActiveRecord models. If you weren&#8217;t, you might look at your code and see what class you inherited from. class User < ActiveRecord::Base ... end In Rails 2 and below, the delete and destroy methods [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been doing Rails work for a long time, you&#8217;re familiar with the difference between <code>delete</code> and <code>destroy</code> in your ActiveRecord models. If you weren&#8217;t, you might look at your code and see what class you<br />
inherited from.</p>
<pre lang="ruby">
  class User < ActiveRecord::Base
   ...
  end
</pre>
<p>In Rails 2 and below, the <code>delete</code> and <code>destroy</code> methods were both listed in the documentation for ActiveRecord::Base. </p>
<p>In Rails 3, you'll find these under <code>ActiveRecord::Persistence</code>. And the only way you'd know to look there is by looking through the eight <code>delete</code> methods located in the sidebar at <a href="http://api.rubyonrails.org">the API</a>. </p>
<p>There's not really a good fix, because the refactoring they did makes a lot of sense. But it also makes these automated documentation tools a lot less useful, especially since there's no indication in ActiveRecord model declarations that a <code>Persistence</code> module is loaded. You'd need to dig into the Rails source, or know who to ask for clarification.</p>
<p>And if you're wondering what the difference is, <code>destroy</code> will invoke callbacks and observers, whereas <code>delete</code> just uses raw SQL to remove the record. Both have their place and it's important to know the difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2011/05/10/rails3_refactored_code_docs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing Vim configs with Mac and Windows using Dropbox</title>
		<link>http://www.napcsweb.com/blog/2011/01/27/sharing-vim-configs-with-mac-and-windows-using-dropbox/</link>
		<comments>http://www.napcsweb.com/blog/2011/01/27/sharing-vim-configs-with-mac-and-windows-using-dropbox/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 22:41:52 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=262</guid>
		<description><![CDATA[I&#8217;m back to using VIm again, after a few years of working with TextMate on the Mac. VIm is great because it works the same on many different platforms, and I jump from Mac to Windows a lot these days. I&#8217;ve devised a setup that lets me keep almost all of my configuration for VIm [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m back to using VIm again, after a few years of working with TextMate on the Mac. VIm is great because it works the same on many different platforms, and I jump from Mac to Windows a lot these days.</p>
<p>I&#8217;ve devised a setup that lets me keep almost all of my configuration for VIm on my Dropbox account so I can have the same configuration synchronized on all of the computers I use. Here&#8217;s how you do it:</p>
<h3>Inital Setup</h3>
<p>Of course, I assume you have Dropbox and VIm installed on your Mac and Windows machines. I&#8217;m not covering any of that setup in this article.</p>
<p>You need a few folders in your Dropbox to make this work. I find doing this on my Mac the easiest:</p>
<pre lang="bash">
mkdir -p ~/Dropbox/dotfiles/.vim/autoload
mkdir -p ~/Dropbox/dotfiles/.vim/backup
mkdir -p ~/Dropbox/dotfiles/.vim/bundles
</pre>
<p>Next, we&#8217;ll create a master <code>.vimrc</code> file in our Dropbox. If you already have one, move it there.</p>
<pre lang="bash">
mv ~/.vimrc  ~/Dropbox/dotfiles/.vimrc_main
</pre>
<p>If you don&#8217;t have a good config file, there&#8217;s one at the end of this article you can look at. For now, just create a blank file there:</p>
<pre lang="bash">
touch ~/Dropbox/dotfiles/.vimrc_main
</pre>
<p>Next, let&#8217;s set up a way to manage plugins, or extensions to VIm.</p>
<h3>Pathogen</h3>
<p>We&#8217;ll use Pathogen.vim to manage our plugins.  Pathogen modifies VIm&#8217;s load paths and lets us keep our plugins in folders we can easily update.</p>
<p>Download Pathogen.vim from the <a class="popup" href="http://www.vim.org/scripts/script.php?script_id=2332">official site</a> and place it in your Autoload folder. </p>
<pre lang="bash">
mv pathogen.vim ~/Dropbox/dotfiles/.vim/autoload/pathogen.vim
</pre>
<h3>vimrc</h3>
<p>Now, create a new .vimrc in your Dropbox folder. This will be our normal .vimrc for our macs. </p>
<pre lang="bash">
  vim ~/Dropbox/dotfiles/.vimrc_mac
</pre>
<p>And put this in the file:</p>
<pre lang="vim">
call pathogen#helptags()
call pathogen#runtime_prepend_subdirectories(expand('~/Dropbox/dotfiles/.vim/bundles'))
source ~/Dropbox/dotfiles/.vimrc_main
</pre>
<p>We&#8217;re telling Pathogen to load any installed plugins from our Dropbox, and then we&#8217;re loading in our <code>vimrc_main</code> file which will contain all of our platform independent configuration.</p>
<p>Now, symlink that to your home directory so VIm will find it.</p>
<pre lang="bash">
ln -s ~/Dropbox/dotfiles/.vimrc_mac ~/.vimrc
</pre>
<p>And symlink your .vim folder so everything else you put there gets loaded as well:</p>
<pre lang="bash">
ln -s ~/Dropbox/dotfiles/.vim ~/.vim
</pre>
<p>Now we&#8217;re ready to set up the Windows side of things.</p>
<h3>Windows setup</h3>
<p>Since Windows has no symlink support, you&#8217;ll need to create a couple of empty stubs.  You&#8217;ll need a _vimrc file and a <code>_vimfiles</code> folder in your Home directory. </p>
<p>First, from a command prompt, create a <code>_vimfiles</code> folder</p>
<pre lang="bash">
   mkdir %HOMEDRIVE%%HOMEPATH%\vimfiles
</pre>
<p>And an autoload folder</p>
<pre lang="bash">
   mkdir %HOMEDRIVE%%HOMEPATH%\vimfiles\autoload
</pre>
<p>Then copy pathogen.vim into that folder from your dropbox</p>
<pre lang="bash">
   cp "%HOMEDRIVE%%HOMEPATH%\My Dropbox\dotfiles\.vim\autoload\pathogen.vim" %HOMEDRIVE%%HOMEPATH%\vimfiles\autoload\pathogen.vim
</pre>
<p>Create the file <code>%HOMEDRIVE%%HOMEPATH%_vimrc</code></p>
<pre lang="bash">
  vim %HOMEDRIVE%%HOMEPATH%\_vimrc
</pre>
<p>Add this to the file:</p>
<pre lang="vim">
call pathogen#helptags()
call pathogen#runtime_prepend_subdirectories(expand('c:\My Dropbox\dotfiles\.vim\bundles'))
source c:\My Dropbox\dotfiles\.vimrc_main
</pre>
<p>This is nearly identical to the file on our Mac, but it instead specifies the paths to the vim bundles folder and <code>vimrc_main</code> files in our Dropbox. <b>Change those paths to the ones for your Dropbox installation!</b></p>
<h4>Environment Variables and Path</h4>
<p>At this point, you should set a <code>HOME</code> environment variable, as Windows doesn&#8217;t yet ship with that variable set by default (although it does have  <code>HOMEDRIVE</code> and <code>HOMEPATH</code> variables.) Many VIm plugins use the <code>HOME</code> environment variable, and things might break down if you don&#8217;t have one set. You can set the <code>HOME</code> environment variable to <code>%HOMEDRIVE%%HOMEPATH%</code>.</p>
<p>Next, you should ensure that VIm is on your system PATH so you can access it from the commandline.</p>
<p>You typically set both of these environment variables through the Control Panel. </p>
<ol>
<li>From the desktop, right-click <strong>My Computer</strong> and click <strong>Properties</strong>.</li>
<li>In the <strong>System Properties</strong> window, click on the <strong>Advanced </strong>tab.</li>
<li>In the <strong>Advanced </strong>section, click the <strong>Environment Variables</strong> button.</li>
<li>Finally, in the <strong>Environment Variables </strong>window, highlight the <strong>Path </strong>variable in the <strong>Systems Variable</strong> section and click the <strong>Edit </strong>button. Add the path to <b>gvim.exe</b> to this list, keeping in mind that each different directory is separated with a semicolon.</li>
<li>Next, create a new environment variable called HOME, and give it the value <code>%HOMEDRIVE%%HOMEPATH%</code></li>
</ol>
<h3>Plugins</h3>
<p>Many of the most awesome plugins for VIm are now maintained in Git repositories stored on Github. If you have Git installed on your Mac, which you can do quickly with the <a href="http://code.google.com/p/git-osx-installer/">Mac OSX installer</a>, you can clone each plugin&#8217;s repository right into your <code>vim/bundles</code> folder and Pathogen will load them right up.</p>
<p>Here&#8217;s what I use:</p>
<ul>
<li><strong>Rails.vim</strong> gives me support for Rails development</li>
<li>The <strong>Cucumber </strong>and <strong>HAML </strong>bunldes provide syntax support for their respective languages.</li>
<li>The <strong>NERDTreee </strong>plugin gives me a project tree which is absolutely necessary when working on anything substantial.</li>
<li>The <strong>closetag </strong>plugin lets me close any open HTML tags by pressing CTRL+_, and since I work in HTML and XML a lot, it&#8217;s a lifesaver when you&#8217;re several levels deep in a hierarchy.</li>
<li>I&#8217;m using the VividChalk color scheme, which I love.</li>
</ul>
<p><code><br />
cd ~/Dropbox/dotfiles/.vim/bundle<br />
git clone git://github.com/tpope/vim-rails.git<br />
git clone git://github.com/tpope/vim-cucumber.git<br />
git clone git://github.com/tpope/vim-haml.git<br />
git clone git://github.com/tpope/vim-endwise.git<br />
git clone git://github.com/scrooloose/nerdtree.git<br />
git clone git://github.com/scrooloose/nerdcommenter.git<br />
git clone git://github.com/tpope/vim-surround.git<br />
git clone git://github.com/vim-scripts/closetag.vim.git<br />
</code></p>
<p>For suggestions on other plugins, see Tammer Saleh&#8217;s <a class="popup" href="http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen">blog post</a> on the topic, which is very helpful.</p>
<h3>A .vimrc_main config file</h3>
<p>Remember the <code>.vimrc_main</code> file we created in the Dropbox? You&#8217;ll put all of your common configuration in that file. Here&#8217;s what&#8217;s in mine, if you&#8217;d like a starting point. I&#8217;ve pulled this from so many sources I can&#8217;t even remember where everything came from, but I have found that peeking at other people&#8217;s VIm files is really helpful.</p>
<p><script src="https://gist.github.com/799434.js"> </script></p>
<p>A couple of important points about this configuration:</p>
<ol>
<li>The mapleader key is set to the comma, and I&#8217;ve set it so that the NERDtree plugin can then be toggled with <code>,d</code> when you&#8217;re in <b>normal</b> mode.</li>
<li>I&#8217;ve set soft tabs to two spaces.</li>
</ol>
<p>It&#8217;s not an amazing configuration by any means, but it does the job for me.</p>
<h3>Wrapping Up</h3>
<p>There are a ton of steps to this process, but once you&#8217;ve gone through it, you can easily work on code on any configuration. And you can install Dropbox on Linux, too, so you could expand this over to that platform as well.</p>
<p>Share your comments and suggestions. I&#8217;m always looking for new VIm tips.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2011/01/27/sharing-vim-configs-with-mac-and-windows-using-dropbox/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Learning Clojure &#8211; Baby Steps Towards Readable Code</title>
		<link>http://www.napcsweb.com/blog/2010/10/29/learning-clojure-baby-steps-towards-readable-code/</link>
		<comments>http://www.napcsweb.com/blog/2010/10/29/learning-clojure-baby-steps-towards-readable-code/#comments</comments>
		<pubDate>Fri, 29 Oct 2010 15:55:49 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Clojure]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=247</guid>
		<description><![CDATA[One thing that keeps me coming back to trying to learn Clojure is the way the language forces me to think about problems in a different way. To illustrate that, I thought I&#8217;d share a simple problem and solution with you. The sales tax on items where I live is 5.5%. 5% goes to the [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that keeps me coming back to trying to learn Clojure is the way the language forces me to think about problems in a different way. To illustrate that, I thought I&#8217;d share a simple problem and solution with you.</p>
<p>The sales tax on items where I live is 5.5%. 5% goes to the state of Wisconsin, and the other .5% goes to Eau Claire county.  So, given a price, let&#8217;s compute the total amount owed by the customer. Most programmers have done this simple problem enough. We know that the math is basically this:</p>
<pre lang="clojure">
price + (price * 0.055)
</pre>
<p>Let&#8217;s break down what we know about Clojure and write this expression.</p>
<p>First, we know we can add two numbers together like this:</p>
<pre lang="clojure">
(+ 4 4)
</pre>
<p>And we know we can multiply things like this:</p>
<pre lang="clojure">
(* 4 4)
</pre>
<p>So by combining those concepts together, we could define our function like this:</p>
<pre lang="clojure">
(defn total [price] (+ price (* price 0.055)))
</pre>
<p>That works, but let&#8217;s make it more expressive.</p>
<p>In Clojure, things like + and * aren&#8217;t just traditional operators. They&#8217;re functions, and the parameters we pass in can <em>also</em> be functions.</p>
<p>So if we made a function that computed just the sales tax for Wisconsin at 5%:</p>
<pre lang="clojure">
(defn wi_tax [price] (* 0.05 price))
</pre>
<p>and another function that computed the tax for Eau Claire county at 0.5%</p>
<pre lang="clojure">
(defn ec_county_tax [price] (* 0.005 price))
</pre>
<p>then we can simply add the results of those two functions together with the price to get our result.</p>
<pre lang="clojure">
(defn total [price] (+ price (wi_tax price) (ec_county_tax price)))
</pre>
<p>When we call</p>
<pre lang="clojure">
(total 5)
</pre>
<p>we see that we end up with a total of 5.275 for our total price. More importantly, we&#8217;ve written readable code.</p>
<p>Looking into the problem more, we see we&#8217;ll need to round the number up to the nearest hundredth. Also, this illustrates how we can make better use of functions, but this code doesn&#8217;t seem to be very maintainable in its current form. There are 72 counties in Wisconsin, each with their own value for taxes. But I&#8217;m sure Clojure has a nice way of handling things like that.</p>
<p>Baby steps, for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2010/10/29/learning-clojure-baby-steps-towards-readable-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Accessibility &#8211; The Screenreader Experience Part One</title>
		<link>http://www.napcsweb.com/blog/2010/10/15/web-accessibility-the-screenreader-experience-part-one/</link>
		<comments>http://www.napcsweb.com/blog/2010/10/15/web-accessibility-the-screenreader-experience-part-one/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 17:11:38 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=228</guid>
		<description><![CDATA[In order to help other developers understand accessibility and assistive technology, I&#8217;ve been working on a series of articles aimed at developers. As a slight change of pace, I invite you to experience Twitter through the &#8220;eyes&#8221; of a screen reader in this short video. You&#8217;ll hear what it sounds like when a screen reader [...]]]></description>
			<content:encoded><![CDATA[<p>In order to help other developers understand accessibility and assistive technology, I&#8217;ve been working on a series of articles aimed at developers. As a slight change of pace,  I invite you to experience Twitter through the &#8220;eyes&#8221; of a screen reader in this short video.  You&#8217;ll hear what it sounds like when a screen reader reads the text of a page, and you&#8217;ll experience what a blind user might experience if he or she encounters a browser popup dialog. You&#8217;ll also get a chance to experience what happens when the browser experiences the &#8220;spinning beachball&#8221; on Mac OSX.<br />
<span id="more-228"></span></p>
<p><iframe src="http://player.vimeo.com/video/15880427" width="400" height="300" frameborder="0"></iframe>
<p><a href="http://vimeo.com/15880427">The Screenreader Experience Part One</a> from <a href="http://vimeo.com/user4977179">NAPCS</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<h3>Discussion</h3>
<p>I want you to know that I used Twitter in this example because it was on my screen when I started recording. These problems aren&#8217;t isolated to Twitter. Many, many sites have similar problems. However, there are three things Twitter could do right now which would have made the experience easier.</p>
<p>First, they could provide useful alternate text on the avatar images. They have the ability to know the account name of the user, and instead of &#8220;normal&#8221;, they could use &#8220;avatar for bphogan&#8221;. </p>
<p>Second, the main profile page seems to use the Geolocation API to find my address, which I find annoying even without a screen reader because it&#8217;s obtrusive. Browsers are required to ask permission to expose my information.  Geolocation APIs can get your current coordinates, but that functionality should be handled on the preferences page of the site, not on the main interface page.</p>
<p>Thirdly, navigation that gets me right to the timeline should be available right at the top so that non-sighted users can get right where they want to be instead of having to listen to the contents of the search bar.</p>
<p>Nothing Twitter did causes the machine to lock up during this screencast. I caused that to happen with a script in another window. I wanted you to see what that experience is like, because some JavaScript code can take a while to load, and that can cause the machine to be slow to respond. The screenreader navigates by keyboard, and when the machine becomes unresponsive, keyboard commands get lost in the shuffle and users get confused.</p>
<p>The takeaway from this is that there are issues that people face with these devices. Following best practices like &#8220;skip navigation&#8221; and better alternative text are a good start for improving the experience, but being aware of other problems will help you much more as a developer than any &#8216;accessibility checklist&#8221; ever will.</p>
<p>Please share your thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2010/10/15/web-accessibility-the-screenreader-experience-part-one/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Survive a Live Coding Demo Without a Projector</title>
		<link>http://www.napcsweb.com/blog/2010/10/10/how-to-survive-a-live-coding-demo-without-a-projector/</link>
		<comments>http://www.napcsweb.com/blog/2010/10/10/how-to-survive-a-live-coding-demo-without-a-projector/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 20:42:11 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Public Speaking]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=223</guid>
		<description><![CDATA[I love to turn bad situations into opportunities to help others learn. This morning I gave a talk at Twin Cities Code Camp on &#8220;Building Mobile Apps with HTML5 and Web Standards&#8221;. The talk had a slide deck, but was mostly designed to be a follow-along live demo. When I went in to give the [...]]]></description>
			<content:encoded><![CDATA[<p>I love to turn bad situations into opportunities to help others learn. This morning I gave a talk at Twin Cities Code Camp on &#8220;Building Mobile Apps with HTML5 and Web Standards&#8221;. The talk had a slide deck, but was mostly designed to be a follow-along live demo. When I went in to give the talk, the projector system was locked down. According to my feedback, the talk still worked very well, thanks to the preparation I did beforehand to accommodate for things like this. Hopefully this advice will help you if you&#8217;re preparing for a talk in the future.</p>
<p>My slides for the talk are online <a href="http://napcs.com/files/tccc9_html.pdf">here</a>. The code is on <a href="http://gitub.com/napcs/html5_offline_notes">Github</a>.</p>
<h2>Practice Writing and Drawing</h2>
<p>I have horrible handwriting when I write fast, and when I&#8217;m nervous. I teach a lot though and have learned to slow down and think carefully as I write. Having clear handwriting on a whiteboard is really important because you&#8217;re going to have to give people URLs to your content. They need to be able to read it at the back of the room, too, so be sure to write big.</p>
<p>Learn to carefully draw simple shapes that resemble things you&#8217;d show on-screen. In my talk, I drew the interface elements we&#8217;d be creating and was able to show how they&#8217;d look.</p>
<h2>Have a live copy people can see</h2>
<p>Make the finished product available on your website so people can play with it. If you&#8217;re building a web site, provide the URL to the demo version. If you&#8217;re demoing an iPhone or Android app, have a link to a video that people can watch that shows the app in action if you can&#8217;t get access to put the app on the App store.  This helps people see what&#8217;s in your head (and on your screen.)</p>
<h2>Make a PDF of your slide deck!</h2>
<p>If you use Keynote or PowerPoint, or even SlideDown, convert your slides to PDFs. Include presenter notes in your export so that people will have more context as they&#8217;re reading along. If you don&#8217;t make use of presenter notes, you should start. They can help you when you present, but they can also help jog memories later when people look at your slides at work.</p>
<p>Protip: Presentation Remote for iPhone will let you see the presentation notes in your hand. You can control the slideshow with it as well.</p>
<h2>Use Git and Github for your examples</h2>
<p>Lately I&#8217;ve been using Git branches to stage my code examples. For my talk on HTML5 mobile apps, I started out with a new branch like this:</p>
<pre code="bash">
git init
git checkout -b 01_simple_form
</pre>
<p>Then I&#8217;ll do all the work for the first stage, commit it, and make a new branch for the second stage. In this talk, the first branch was just the HTML for the user interface. The second branch then covered the JavaScript we used to create the database on the client machine. </p>
<pre code="bash">
git add .
git commit -m "Web form"
git checkout -b 02_create_database
</pre>
<p>By the time I&#8217;m done, I have several branches in the repository that I can use to track the stages of my live demo. At the end, I merge my last branch into the Master branch.</p>
<pre lang="bash">
git checkout master
git merge 09_offline
</pre>
<p><b>Protip:</b> If I realize that I made a mistake, I can check out the earlier branch, fix the code, commit the code, and merge that fixed branch forward into the branches that followed.</p>
<pre code="bash">
git stash      # puts your in-progress work aside
git checkout 01_simple_form
# fix changes
git commit -am "fixed the form"
git checkout 02_create_database
git merge 01_simple_form
git checkout 03_add_note
git merge 01_simple_form
git stash apply # put your stuff back
</pre>
<p>Once I&#8217;m ready, I create the new Git repository and push my code. I have to push the master branch and the other branches too.</p>
<pre code="bash">
git remote add origin git@github.com:napcs/html5_offline_notes.git
git push origin master
git push origin 01_simple_form
git push origin 02_create_database
git push origin 03_add_note
..
</pre>
<p>So how does this help me during a talk? I can direct people to the Github page and they can use the <em>Select branch</em> section to see each branch. The Github web interface lets them follow along as I talk about the  code. That&#8217;s what I did here.</p>
<div class="thumbnail"><a href="http://skitch.com/bphogan/d42pq/git-advantages"><img src="http://img.skitch.com/20101010-gjkuratctm989skpbqmd3b5e48.preview.jpg" alt="Git advantages" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://skitch.com">Skitch</a>!</span></div>
<h2>Be ready offline</h2>
<p>As a last resort, take this git repository and your PDF presentation and make it available on a thumb drive, or fire up a local wifi hotspot and run a server. An iPad, iPhone, or iPod Touch with<a href="http://itunes.apple.com/us/app/air-sharing/id289943355?mt=8"> Air Sharing</a> can help with this.</p>
<h2>Wrapping Up</h2>
<p>So, that&#8217;s how I&#8217;ve done preparation for my talks and managed to make it through a code-centric talk with just a whiteboard. Do you have any suggestions on what you would do?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2010/10/10/how-to-survive-a-live-coding-demo-without-a-projector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Accessibility For Developers</title>
		<link>http://www.napcsweb.com/blog/2010/10/06/web-accessibility-for-developers/</link>
		<comments>http://www.napcsweb.com/blog/2010/10/06/web-accessibility-for-developers/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 15:40:26 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Accessibility]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=220</guid>
		<description><![CDATA[Recently, I polled people via Hacker News and Twitter about the things they&#8217;d like me to share about web accessibility given my experience as both a web developer and a daily user of assistive technology. The questions I received are great, and I&#8217;ll be writing a series of posts over the next few months about [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I polled people via <a class="popup" href="http://news.ycombinator.com/item?id=1716463">Hacker News</a> and Twitter about the things they&#8217;d like me to share about web accessibility given my experience as both a web developer and a daily user of assistive technology. The questions I received are great, and I&#8217;ll be writing a series of posts over the next few months about various ways developers can improve the accessibility of their sites for not only disabled users, but for everyone.</p>
<p>To kick this off, you can read my latest article in the October issue of PragPub Magazine, entitled &#8220;<a href="http://www.pragprog.com/magazines/2010-10/html-accessibility-for-all">HTML5: Accessibility For All</a>&#8221; where I discuss some of the new accessibility features in HTML5 that make sites easier to use for both screen readers and mobile devices.</p>
<p>In the coming weeks, you can expect to see articles on</p>
<ul>
<li>Improving audio and video for the web</li>
<li>Colorblindness</li>
<li>Learning disabilities</li>
<li>more concrete progressive enhancement</li>
<li>Motor impairment issues</li>
<li>low vision issues</li>
</ul>
<p>and many more.</p>
<p>I hope you follow along. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2010/10/06/web-accessibility-for-developers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Connecting to SQL Server from a Mac (Again)</title>
		<link>http://www.napcsweb.com/blog/2010/09/20/connecting-to-sql-server-from-a-mac-again/</link>
		<comments>http://www.napcsweb.com/blog/2010/09/20/connecting-to-sql-server-from-a-mac-again/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 19:07:29 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=213</guid>
		<description><![CDATA[Connecting to SQL Server is one task I have to do regularly when I work on Rails applications for clients that use Microsoft technologies. I usually set my machine up and don&#8217;t really worry too much about how it all comes together. Recently I had to do the installation completely from scratch. I followed Ken [...]]]></description>
			<content:encoded><![CDATA[<p>Connecting to SQL Server is one task I have to do regularly when I work on Rails applications for clients that use Microsoft technologies.  I usually set my machine up and don&#8217;t really worry too much about how it all comes together.</p>
<p>Recently I had to do the installation completely from scratch. I followed <a href="http://www.metaskills.net/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more">Ken Collins&#8217; comprehensive walkthrough</a>, but I ran into a problem &#8211; I wanted to use RVM. Ken&#8217;s tutorial uses MacPorts to install the Ruby ODBC bindings, and I wasn&#8217;t using Ruby via MacPorts. </p>
<p>Everything out there wasn&#8217;t working for me even when I followed Ken&#8217;s article on RVM.</p>
<p>Here&#8217;s what ended up working for me.</p>
<p>First, I used MacPorts. Then I installed the ports I needed:</p>
<pre lang="bash">
sudo port install unixodbc
sudo port install freetds +odbc
</pre>
<p>I modified <code>/opt/local/etc/freetds/freetds.conf</code> to look like this:</p>
<pre>
[my_dev_server]
  host = 192.168.1.58
  port = 1433
  tds version = 8.0
</pre>
<p>Then I modified <code>/opt/local/odbcinst.ini</code> to point to my FreeTDS configuration:</p>
<pre>
[FreeTDS]
Decscription = FreeTDS driver for SQLServer
Driver = /opt/local/lib/libtdsodbc.so
Setup = /opt/local/lib/libtdsodbc.so
FileUsage = 1
</pre>
<p>Finally I modified <code>/opt/local/odbc.ini</code> and created my ODBC DSN.</p>
<pre>
[my_dev_server_dsn]
Driver=FreeTDS
Description=My Server Connection
Servername=my_dev_server
Server=my_dev_server
Port=1433
Database=killer_app
</pre>
<p>Note that the servername matches the servername defined in the FreeTDS configuration file.</p>
<p>Then I went and installed the gems I needed for my project</p>
<pre lang="bash">
gem install ruby-odbc
gem install dbi  -v=0.4.1
gem install dbd-odbc -v=0.2.4
gem install activerecord-sqlserver-adapter -v=2.3.9
</pre>
<p>But when I ran my Rails application, attempts to connect to models failed.</p>
<pre>
ODBC::Error: IM002 (0) [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded
</pre>
<p>It&#8217;s using iODBC which comes with OSX. It wasn&#8217;t using UnixODBC at all!</p>
<p>To fix that, I had to reinstall the ruby-odbc gem and instruct it to use the unixodbc path. This is what ultimately fixed things for me:</p>
<pre>
gem install ruby-odbc -- --with-odbc-dir=/opt/local
</pre>
<p>After that, everything worked again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2010/09/20/connecting-to-sql-server-from-a-mac-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessible Rails Applications &#8211; Let Cucumber help you test for Accessibility</title>
		<link>http://www.napcsweb.com/blog/2010/08/27/let_cucumber_help/</link>
		<comments>http://www.napcsweb.com/blog/2010/08/27/let_cucumber_help/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 18:07:03 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.napcsweb.com/blog/?p=207</guid>
		<description><![CDATA[Developers working with Rails are constantly looking for ways to use Cucumber to test their JavaScript. One thing I&#8217;ve come to love about Cucumber&#8217;s default setup is that it does not work with JavaScript at all, which actually helps me ensure that my applications work for uses without JavaScript enabled. if I write a Cucumber [...]]]></description>
			<content:encoded><![CDATA[<p>Developers working with Rails are constantly looking for ways to use Cucumber to test their JavaScript. One thing I&#8217;ve come to love about Cucumber&#8217;s default setup is that it does <em>not work with JavaScript</em> at all, which actually helps me ensure that my applications work for uses without JavaScript enabled.</p>
<p>if I write a Cucumber story that tests to see if a delete works, and I&#8217;ve used the default &#8220;link_to&#8221; method for deletes made popular by the Rails scaffolding, my cucumber feature will fail. I&#8217;ll be shown the Show page instead of the &#8220;successfully deleted&#8221; message.</p>
<p>Keep that in mind as you work through your applications &#8211; See what stories break when you don&#8217;t have JavaScript enabled and reconsider your implementations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napcsweb.com/blog/2010/08/27/let_cucumber_help/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.953 seconds -->
<!-- Cached page served by WP-Cache -->

