<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-18315586</atom:id><lastBuildDate>Fri, 10 May 2013 21:46:38 +0000</lastBuildDate><category>ruby</category><category>error</category><category>web</category><category>software</category><category>rails</category><category>0600</category><category>oracle</category><category>development</category><title>Duane's Brain</title><description>Contents of my brain.  Or at least, the geeky bits.</description><link>http://duanesbrain.blogspot.com/</link><managingEditor>noreply@blogger.com (Duane Morin)</managingEditor><generator>Blogger</generator><openSearch:totalResults>253</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DuanesBrain" /><feedburner:info uri="duanesbrain" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-399448000344911872</guid><pubDate>Sat, 23 Feb 2013 02:49:00 +0000</pubDate><atom:updated>2013-02-22T18:49:19.601-08:00</atom:updated><title>Array Sampling Without Repeating  [Ruby]</title><description>I've often come across the problem of random sampling in situations where you don't want repeats. &amp;nbsp;For instance say you've got a list of the user's MP3 files and you are playing them randomly. &amp;nbsp;You've just played a song and you choose another random one. &amp;nbsp;It's easy to say "Don't pick the same one that you just picked." &amp;nbsp;And with a little work you could pick an N and say, "Don't repeat a song in the last N songs."&lt;br /&gt;
&lt;br /&gt;But you also don't want to say "Don't repeat any songs until all the songs are played", because if the user's got 500 songs in their library it'll be a long time before they hear their favorite song again. &amp;nbsp;What you really want is just something that says "Make it less likely to pick this song too too frequently."&lt;br /&gt;
&lt;br /&gt;
So, here's the idea I finally came up with. &amp;nbsp;Say that you've got an array of files to work with, regardless of what is in them. &amp;nbsp;In Ruby you can just ask for&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;file &amp;nbsp;= files.sample&lt;/span&gt; to get a random element out of the array.&lt;br /&gt;
&lt;br /&gt;
Now what? &amp;nbsp;We go and do what we want with&amp;nbsp;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;file&lt;/span&gt;, but now we want to assure that this is less likely to be called in the near future (and, preferably, absolutely guarantee that it is not called within the next N samples). &lt;br /&gt;
&lt;br /&gt;
Start by snipping&amp;nbsp;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;file&lt;/span&gt; out of &lt;span style="font-family: Courier New, Courier, monospace;"&gt;filenames&lt;/span&gt; and moving it to the end of the array:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;files &amp;lt;&amp;lt;= files.delete(file)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Try it:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;(main)&amp;gt; files=["foo", "bar", "baz", "quux"]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;=&amp;gt; ["foo", "bar", "baz", "quux"]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;(main)&amp;gt; file = files.sample&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;=&amp;gt; "bar"&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;(main)&amp;gt; files &amp;lt;&amp;lt;= files.delete(file)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;=&amp;gt; ["foo", "baz", "quux", "bar"]&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;So what? &amp;nbsp;The sample method is equally likely to pick any item in the array, right?&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;What if we tell it not to? &amp;nbsp;What if we tell it to only sample a portion of the array?&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;file = files[0..files.size&amp;gt;&amp;gt;2].sample&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;Here, we're saying to only get samples out of half the array. &amp;nbsp;So when a sample is chosen and moved to the back, we've established that there's no way this sample can be repeated until at least N/2 samples have been taken.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;Depending on your N you might want to do something like N*0.90 or something (if N is a thousand maybe only 100 samples have to go by before it's ok to repeat). &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;It's a little trick, but I think it's important. &amp;nbsp;&lt;a href="https://itunes.apple.com/us/app/shakeshare-shareable-shakespeare/id582068373?mt=8"&gt;I've got an app I'm working on that chooses random quotes, placing them on random images&lt;/a&gt;. &amp;nbsp;It bothers me when I know that I've got over 500 quotes in the database, and the user sees a repeated quote after 4 refreshes of the page. &amp;nbsp;So now they won't, now it'll take hundreds of refreshes before they see a repeat. Truthfully I'll probably switch that over to cap at 100.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/bLWAdMZRCsY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/bLWAdMZRCsY/array-sampling-without-repeating-ruby.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2013/02/array-sampling-without-repeating-ruby.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-4253815941181461387</guid><pubDate>Fri, 31 Aug 2012 13:51:00 +0000</pubDate><atom:updated>2012-08-31T06:51:38.500-07:00</atom:updated><title>RubyMotion : Gems Are Not Being Compiled / Built / Included</title><description>I was working on the most basic of apps, really nothing complicated at all, and trying to include BubbleWrap. &amp;nbsp;But the first time I tried to use anything (in this case, Device.screen.width) I was getting a name error - as if BW was not included.&lt;br /&gt;
&lt;br /&gt;
I had &amp;nbsp;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;require 'bubble-wrap'&lt;/span&gt; in my Rakefile. I'd done a &lt;span style="font-family: Courier New, Courier, monospace;"&gt;gem install bubble-wrap&lt;/span&gt;. &amp;nbsp;That wasn't it. &amp;nbsp;What appeared to be happening was that over in &lt;span style="font-family: Courier New, Courier, monospace;"&gt;build/iPhoneSimulator-5.1-Development/objs there should have been a /Users/dmorin/.rvm/...&lt;/span&gt; directory where my required gems were getting copied, and that directory didn't exist. &lt;br /&gt;
&lt;br /&gt;
I double checked everything, I ran "rake clean", I could not for the life of me make it include that directory. &amp;nbsp;I even created a brand new empty motion directory and included bubble-wrap in it so that this was literally the single line change I made from default -- and it compiled. &amp;nbsp;Go figure.&lt;br /&gt;
&lt;br /&gt;
Finally, I found it. &amp;nbsp;I had been modifying some sample code that I found online, and it was this line:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&lt;br /&gt;
app.files = Dir.glob(File.join(app.project_dir,'app/lib/**/*.rb'))|&lt;/span&gt;&lt;div&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;Dir.glob(File.join(app.project_dir, 'app/**/*.rb'))&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;I'd seen something like that trick before, and it seemed like something I understood - basically saying that you're going to put some common code into a /lib subdirectory, so compile that first in order to make it available to your primary code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;But that's not quite accurate. &amp;nbsp;I think there was a mistake in the code that I copied, because what this does is to make app.files *only* point the files in your app/ and app/lib directory - completing removing any gems from the filepath. &amp;nbsp;You can check this with &lt;span style="font-family: Courier New, Courier, monospace;"&gt;rake config&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;- performing this command on a brand new directory will return all of your gem paths (whether it's .rvm or not), but doing so in the directory where the above line is included in the Rakefile? &amp;nbsp;Shows all my app/ code, but no gems.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;In my case it turns out I don't need that line at all, so I've removed it. &amp;nbsp;Soon as I did that, my gems were included. &amp;nbsp;If you do need to manipulate app.files and the way things are included, you'll want to &lt;b&gt;append&lt;/b&gt;&amp;nbsp;or otherwise manipulate the existing list, not just replace it with a plain old equals!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/G1tLe1l_SeU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/G1tLe1l_SeU/rubymotion-gems-are-not-being-compiled.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/08/rubymotion-gems-are-not-being-compiled.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-3655907674672623660</guid><pubDate>Fri, 10 Aug 2012 18:59:00 +0000</pubDate><atom:updated>2012-08-10T13:14:54.284-07:00</atom:updated><title>Rails MVC vs iOS MVC</title><description>If your primary experience with Model View Controller (MVC) has been via Ruby on Rails, and then you switch over to iOS (iPhone / iPad) programming, see that it also supports MVC and think, "Oh, cool, I already know that!" &amp;nbsp;Not so fast.&lt;br /&gt;
&lt;br /&gt;
I am not expert at either of these technologies, but let me put it in the best terms I can. &amp;nbsp;In the Rails world, the controller is primarily associated with manipulating the model. &amp;nbsp;You have a Person object, you have a PersonController. &amp;nbsp;That PersonController has actions like index (show a list of Person objects), show (a single Person), edit/update, create/save, destroy and so on. &amp;nbsp;Things that you can do with that object. &amp;nbsp;Each action, in general, has a view. &amp;nbsp;To the point where the default behavior of an action called "foo" on the PersonController is to assume that there is a file called foo in the /views/person directory.&lt;br /&gt;
&lt;br /&gt;
In iOS world, each controller handles a single view. &amp;nbsp;I'm still trying to get my head around it. &amp;nbsp;I keep thinking of the View as an entirely separate object that I instantiate and "connect" to the controller in some way, such that the controller's only real job is to take in some user input, manipulate some stuff, and then let the next view do its thing.&lt;br /&gt;
&lt;br /&gt;
Not really. &amp;nbsp;In fact, the controller can go ahead and just instantiate a UIView object and start populating it. &amp;nbsp;There' a method called viewDidLoad, that gets called when the view is all loaded. &amp;nbsp;Fair enough. &amp;nbsp;Where is that method? &amp;nbsp;Is there a didLoad() method on UIView? &amp;nbsp;Nope! &amp;nbsp;It's on the controller. &amp;nbsp;So it's practically hard coded in the framework that a controller deals with "the view" and you don't get to trick it into managing many views.&lt;br /&gt;
&lt;br /&gt;
I don't yet fully get it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;UPDATE&lt;/b&gt;&amp;nbsp;- As I do more googling on stuff like "switch UIView" I'm learning some techniques for how to manage multiple views inside a controller. &amp;nbsp;It's not quite the same thing as having a specific view associated with a specific action like Rails does, but it's inaccurate to say that a controller can only handle a single view at a time. It's more like, "The controller has a pointer to a view. &amp;nbsp;You are free to swap out and/or otherwise regenerate that view according to whatever rules you like." &amp;nbsp;So I don't think I have to have a PeopleIndexController and a PeopleShowController and a PeopleEditController...&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/KLd8rAT8dgA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/KLd8rAT8dgA/rails-mvc-vs-ios-mvc.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/08/rails-mvc-vs-ios-mvc.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-687246344241695491</guid><pubDate>Mon, 16 Jul 2012 17:35:00 +0000</pubDate><atom:updated>2012-07-16T10:35:27.374-07:00</atom:updated><title>Speeding Up the Stanford iPhone / iPad / iOS Development Course</title><description>I've known for years that I should learn iOS and Objective-C programming. I've just never found the time and/or patience to do it. &amp;nbsp;I'm a full time Ruby on Rails developer with a bunch of years of Java before that, so I feel relatively confident in my ability to pick up a new platform/language, but I found that there were a number of key differences between that world and the world of Objective-C that merely picking up a book on the subject and banging on it for a few hours a night wasn't working for me.&lt;br /&gt;
&lt;br /&gt;
What is the greatest resource for learning iOS programming? &amp;nbsp;Everybody points to the &lt;a href="http://itunes.apple.com/us/itunes-u/ipad-iphone-application-development/id473757255"&gt;Stanford iPad and iPhone Development Course&lt;/a&gt;. &amp;nbsp;Tens of thousands of people have gone through the course, and most rave about it. &amp;nbsp; I like the idea, a lot. &amp;nbsp;My biggest problems with it are two-fold. &amp;nbsp;First, it's a video long video course - almost 20 hour-long episodes. &amp;nbsp;I don't have the attention span for that, honestly. &amp;nbsp;Second and perhaps related to the first, it is impossible for all learners to get the same amount out of a single course. &amp;nbsp;Someone who has never touched Smalltalk, for example, will take longer to grap the idea of message passing than someone who knows Smalltalk. &amp;nbsp;That means that a lesson on messages will be the kind of thing that some folks want to just fast forward past. &amp;nbsp;But then if you FF too far you may miss important things. &lt;br /&gt;
&lt;br /&gt;
This is why I've never done the Stanford courses, and instead tried to wing it with heavy Googling and lots of time on &lt;a href="http://meta.stackoverflow.com/questions/tagged/iphone"&gt;Stack Overflow&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Today, I found a better answer. &amp;nbsp;Playback the Stanford courses at double speed. &amp;nbsp;How? &amp;nbsp;Harder than it looks, actually, if you've got the latest of everything on your machine. Turns out you have to go back in time a bit. &amp;nbsp;[ Note that I am running a Mac with Lion installed. &amp;nbsp;Your mileage on Windows may vary.]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://discussions.apple.com/thread/3944508?start=0&amp;amp;tstart=0"&gt;Download Quicktime Player 7&lt;/a&gt;. &amp;nbsp;This advice comes straight from discussions on the Apple.com website, by the way.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Find your video in iTunes, select Show in Finder.&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Right-click (or ctrl-click or whatever) on your video, go to Open With... and pick QuickTime Player 7&lt;/b&gt;. &amp;nbsp; Note that you did not upgrade QuickTime in the first step, and it will not become the default player. You deliberately installed a previous version. &amp;nbsp;You may have to find it under "Other" the first time you do an Open With, but in my experience once you've done that the first time it will show up as an option the next time.&lt;/li&gt;
&lt;li&gt;Got it open in QTPlayer 7? &amp;nbsp;Good. &amp;nbsp;&lt;b&gt;Now go to Window -&amp;gt; Show A/V Controls.&lt;/b&gt; &amp;nbsp;This is the part that you needed QT7 for, because they've taken it out in later versions.&lt;/li&gt;
&lt;li&gt;In the lower right corner there's a slider for &lt;b&gt;Playback Speed. &amp;nbsp;Pick a speed.&lt;/b&gt; &amp;nbsp;I'm running them at 2x, and I find it the right combination of understandable while causing me to yell "Faster, talk faster!" at the screen like I do at 1x.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Now I feel like I'm getting somewhere. &amp;nbsp;If you've got two monitors, that's even better - put the video up on a second screen, and then go about your business doing whatever other tasks are important while you half-listen to the lecture (just like most of us developers do in staff meetings when we bring the laptop, am I right?) &amp;nbsp;When it gets to something that seems interesting, pay more attention to the video.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I learned this trick this morning, and blew through the first lesson (the one that I would have been most likely to scream "Talk faster!" at) while doing other things. &amp;nbsp;Now I'm halfway through lesson 2 and into stuff that's more interesting to me, but still only at that "Confirm and clarify stuff that I'd already experienced" sort of phase (remember, I've been banging around on all this stuff by myself for a long time). &amp;nbsp;Eventually I'll get to the "Entirely new to me" stuff and, if necessary, I can bring the speed back down to 1x.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
But probably not 1x. ;)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/HJbMs_WUtPA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/HJbMs_WUtPA/speeding-up-stanford-iphone-ipad-ios.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>1</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/07/speeding-up-stanford-iphone-ipad-ios.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-7135730192452597706</guid><pubDate>Tue, 19 Jun 2012 17:07:00 +0000</pubDate><atom:updated>2012-06-19T10:07:49.995-07:00</atom:updated><title>How To Hard Reboot / Factory Reset Your Verizon Droid Incredible 2</title><description>I have a Droid Incredible 2 from Verizon. &amp;nbsp;Had it coming up on 2 years. &amp;nbsp;This past Father's Day it stopped powering on. &amp;nbsp;Very weird circumstance, it rebooted itself while in camera, then acted flaky, then when I put it on the charger....nothing. &amp;nbsp;Stopped responding in any way to any sort of stimulus. &amp;nbsp;No lights, no nothing. &amp;nbsp;When I'd first plug it in there'd be a little red charging light, but that would go off in 5 seconds. &amp;nbsp;Left it on over night, nothing. &amp;nbsp;Popped the battery, still nothing.&lt;br /&gt;
&lt;br /&gt;
Having tried everything and now bracing myself for the worst (a dead phone), I call Verizon tech support, who quickly moves me along past all the above steps to "Ok let's do a factory reset on the phone."&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Hold down the Volume Down key.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Press and hold the Power key for 3-5 seconds.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;You should now get a boot screen. &amp;nbsp;(The hacker/geek in me squealed with glee when I saw this come up).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;One option is Factory Reset, which if you've never done one I'll warn you wipes your entire phone as if it's brand new, and you'll be tasked with setting up your Google accounts and such al over again, not to mention the havoc it will wreak on your various installed apps.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Another option, however, is Fast Boot.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
I asked the tech person, "Since I know what a factory reset will do, can I try Fast Boot? &amp;nbsp;Worst case it does nothing, and I repeat this process and select the reset."&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
"Sure, sounds good," she tells me. &amp;nbsp;"All we really have is directions for how to reset it."&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Wonderful. &amp;nbsp;I hit the Reboot and thank her for her time.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
A few minutes later (the I2 has a very long boot time, you ever notice that?) &amp;nbsp;I have my phone back! &amp;nbsp;Yay.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Documenting here because I did go googling for how to hard reboot my phone, and could not find easy instructions to do so. &amp;nbsp;Maybe the next guy to come along looking for it will land here. &amp;nbsp;Hold down Volume Down + Power, get boot screen, pick Fast Reboot.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/GaGNJMGkksI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/GaGNJMGkksI/how-to-hard-reboot-factory-reset-your.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>1</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/06/how-to-hard-reboot-factory-reset-your.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-3044343403685425553</guid><pubDate>Tue, 19 Jun 2012 15:15:00 +0000</pubDate><atom:updated>2012-06-19T08:15:15.256-07:00</atom:updated><title>Zazzle on Rails</title><description>I have merchandise on the &lt;a href="http://www.zazzle.com/ShakespeareGeek*"&gt;Zazzle&lt;/a&gt; store. &amp;nbsp;I also have sites that I manage, and I would like to advertise my merchandise on my sites under my own control. &amp;nbsp;Zazzle offers a handful of banner options, but I wasn't really finding the level of control that I wanted. &amp;nbsp;So I've set about writing my own.&lt;br /&gt;
&lt;br /&gt;
Zazzle does offer a &lt;a href="http://www.zazzle.com/sell/affiliates/promotionaltools/zazzlestore"&gt;PHP front end if you want to host your own store&lt;/a&gt;. &amp;nbsp;However I'm a Rails guy and would much prefer to work in that language. &amp;nbsp;From what I can tell, there is no Zazzle gem. &amp;nbsp;Yet.&lt;br /&gt;
&lt;br /&gt;
What they do offer is a simple enough &lt;a href="http://www.zazzle.com/sell/affiliates/promotionaltools/rss"&gt;RSS feed&lt;/a&gt; that will allow you to easily pull the relevant info on your products, in a variety of ways. &amp;nbsp;You can customize the call to grab newest items, or most popular, via search terms or by searching for specific product types only. &amp;nbsp;In my case, and since I have less than 100 items in the store, &amp;nbsp;I can just go ahead and grab all of them:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;@feed = Feedzirra::Feed.fetch_and_parse("http://feed.zazzle.com/ShakespeareGeek/feed?st=date_created&amp;amp;pg=1&amp;amp;ps=100")&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
You'll get back the item URL, description, and even a pre-made &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;span style="font-family: inherit;"&gt;complete with image that you can just go ahead and drop right on your page, if you like.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
Now it's really up to you what you do next. &amp;nbsp;I actually use this call to go ahead and seed a local database of Product objects, which I'm then tagging and categorizing as I see fit. &amp;nbsp;Since I know when I create new products, I can manually go in and update my database to stay in sync. &lt;br /&gt;
&lt;br /&gt;
I wrote up a simple banner script for now that just goes in and says "Get me 3 random products," and then I display the supplied HTML that came with the RSS feed. &amp;nbsp;Later, depending on the context of the page, I'll be able to say "Get me 3 random Hamlet products" or "Get me 3 t-shirts" or possibly even change what and how I'm displaying the items.&lt;br /&gt;
&lt;br /&gt;
Note that the URL takes you back to the product page on Zazzle, where your customer would then still have to hit a Buy button. &amp;nbsp;Not the greatest user experience, but I'm not trying to rebuild the store from scratch, either. &amp;nbsp;I just wanted a way to display advertisements for my merchandise in my own way. &amp;nbsp;Your mileage may vary.&lt;br /&gt;
&lt;br /&gt;
When I have time I hope to expand this with more source code and examples about exactly what I'm doing. &amp;nbsp;At the moment, though, I have no idea if Google will pick up this post and if anybody will ever see it. &amp;nbsp;So if you did land here because you do want to connect Zazzle and Rails, leave a comment so I'll know whether to keep posting on the subject.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/iks_IK44OC4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/iks_IK44OC4/zazzle-on-rails.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>1</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/06/zazzle-on-rails.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-7431730508717097030</guid><pubDate>Wed, 21 Mar 2012 01:01:00 +0000</pubDate><atom:updated>2012-03-20T18:01:35.103-07:00</atom:updated><title>Rails Migrations Break Over TIme?</title><description>Here's a fun little problem.&amp;nbsp; I'm sure I'm not the only one to have run into it, but I'll document it for kicks even though I'm not quite sure yet how I'll solve it.&lt;br /&gt;
&lt;br /&gt;
I just inherited a legacy codebase for a Rails 2.3.x project.&amp;nbsp; So I point to a clean database, run a rake db:create followed by a rake db:migrate, and suddenly I'm getting an error - in this case about the absence of a certain "ambassador" column in my AdminUser object.&lt;br /&gt;
&lt;br /&gt;Two things are odd.&amp;nbsp; First, there is a migration to set up that column on that object, we just haven't gotten to it yet.&lt;br /&gt;
&lt;br /&gt;
Second, this migration has nothing to do with that column.&lt;br /&gt;
&lt;br /&gt;
...or does it?&lt;br /&gt;
&lt;br /&gt;
Here's where the time warp comes in.&amp;nbsp; The original owner of this code set up the AdminUser object, then at some point later decided he needed an ambassador column, so he wrote a migration to add it.&amp;nbsp; Fair enough.&amp;nbsp; But then after that he went in and enhanced the create method for AdminUser to say "If your ambassador flag is set, do something different."&lt;br /&gt;
&lt;br /&gt;
Remember that migration that was failing?&amp;nbsp; That migration tries to insert a new AdminUser (as a mock object).&amp;nbsp; Before the column is added.&lt;br /&gt;
&lt;br /&gt;
So one migration created the AdminUser object (without the ambassador column).&amp;nbsp; Next in sequence comes this innocent migration that tries to create a mock AdminUser.&amp;nbsp; However, the AdminUser can't be created without looking at the ambassador flag - which hasn't been added yet.&lt;br /&gt;
&lt;br /&gt;
Not quite sure how I'm going to solve this one -- probably comment out the ambassador related code long enough to mock the object and let the migrations run.&lt;br /&gt;
&lt;br /&gt;
I just found it interesting.&amp;nbsp; You inherit a Rails project, you try to run migrations, they break in the middle.&amp;nbsp; Your first thought is quite possibly, "Oh great, the last guy didn't keep his migrations up, now I have to do everything in SQL."&amp;nbsp; Maybe not the case!&amp;nbsp; This appears to be a completely innocent problem that crept in over time, and he would never have noticed it because it's not like he's constantly going back and building his database from scratch like I just did.&lt;br /&gt;
&amp;nbsp;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/D3B5v_TC_-A" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/D3B5v_TC_-A/rails-migrations-break-over-time.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/03/rails-migrations-break-over-time.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-6986618713315613463</guid><pubDate>Wed, 25 Jan 2012 01:49:00 +0000</pubDate><atom:updated>2012-01-24T17:49:56.421-08:00</atom:updated><title /><description>I want to share with you something that I wrote in an email back in 12/2004:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
Imagine your favorite &lt;span class="il"&gt;book&lt;/span&gt;. &amp;nbsp;The sort of &lt;span class="il"&gt;book&lt;/span&gt; that you always like to&lt;br /&gt;
have a copy of, because there's always something in there worth&lt;br /&gt;
revisiting. &amp;nbsp;Maybe it's the Bible, maybe Shakespeare, maybe the Tao of&lt;br /&gt;
Physics. &amp;nbsp;Or, maybe it just happens to be the text &lt;span class="il"&gt;book&lt;/span&gt; for a course&lt;br /&gt;
you're currently taking.&lt;br /&gt;
&lt;br /&gt;
Now imagine you have a thought on that &lt;span class="il"&gt;book&lt;/span&gt;. &amp;nbsp;Maybe it's an idea you&lt;br /&gt;
want to scribble down so you don't forget. &amp;nbsp;Maybe it's a question.&lt;br /&gt;
Maybe you just want to talk to somebody about the &lt;span class="il"&gt;book&lt;/span&gt;, but none of&lt;br /&gt;
your friends are into it. &amp;nbsp;How do &amp;nbsp;you find a community of people who&lt;br /&gt;
are interested in it?&lt;br /&gt;
&lt;br /&gt;
What if that &lt;span class="il"&gt;book&lt;/span&gt; was really an e-&lt;span class="il"&gt;book&lt;/span&gt;, and that e-&lt;span class="il"&gt;book&lt;/span&gt; had a wireless&lt;br /&gt;
internet connection? &amp;nbsp;And, whenever you had such a thought or a&lt;br /&gt;
question, with a simple tap of the keys you could connect immediately&lt;br /&gt;
to a community of people exactly like you. &amp;nbsp;I like the notion of a&lt;br /&gt;
"&lt;span class="il"&gt;deep&lt;/span&gt;" &lt;span class="il"&gt;book&lt;/span&gt;, it feels very alice in wonderland to me. &amp;nbsp;Because you're&lt;br /&gt;
leaving the original intact, and that's key. &amp;nbsp;You're telling somebody&lt;br /&gt;
"Look, we're not gonna get in the way of your enjoyment with this&lt;br /&gt;
&lt;span class="il"&gt;book&lt;/span&gt;. &amp;nbsp;But when you want us, just look a little deeper." &amp;nbsp;The &lt;span class="il"&gt;book&lt;/span&gt;&lt;br /&gt;
itself is merely a reader onto the larger, centralized service that&lt;br /&gt;
tracks all the comments, questions, and so on.&lt;br /&gt;
&lt;br /&gt;
Right now, the idea would have to take the form of a PC-based reader.&lt;br /&gt;
It's really the only technology that can handle it. &amp;nbsp;But hey, that&lt;br /&gt;
could easily mean laptops. &amp;nbsp;What about PDAs? &amp;nbsp;Pretty soon. &amp;nbsp;Need a&lt;br /&gt;
better UI. &amp;nbsp;And before you know it, ebooks really will take off.&lt;br /&gt;
&lt;br /&gt;
How does this fit our model? &amp;nbsp;Imagine the kind of content that can be&lt;br /&gt;
plugged in to that sort of interface. &amp;nbsp;Who says it has to be a&lt;br /&gt;
straight blog/message board? &amp;nbsp;Maybe you work up a quiz on a certain&lt;br /&gt;
subject, and you link it directly into the &lt;span class="il"&gt;book&lt;/span&gt;. &amp;nbsp;And charge people&lt;br /&gt;
for it. &amp;nbsp;Not everyone will take it, of course, but some will. &amp;nbsp;Or&lt;br /&gt;
maybe you're the author of another &lt;span class="il"&gt;book&lt;/span&gt; on the subject. &amp;nbsp;Maybe you're&lt;br /&gt;
teaching a class that uses this text, and you want to leave a message&lt;br /&gt;
for your students. &amp;nbsp; &amp;nbsp;The &lt;span class="il"&gt;book&lt;/span&gt; itself not only becomes a walking&lt;br /&gt;
course on itself, it becomes an infinite number of courses on itself.&lt;br /&gt;
By grabbing a "&lt;span class="il"&gt;deep&lt;/span&gt;" view of Shakespeare you open up the door to&lt;br /&gt;
everything you could possibly learn about the subject, all depending&lt;br /&gt;
on how you choose to navigate through it. &amp;nbsp;On your terms and your time&lt;br /&gt;
line. &amp;nbsp;Want to pay for some stuff? &amp;nbsp;Ok. &amp;nbsp;But there'll be free stuff as&lt;br /&gt;
well. &amp;nbsp;You pick.&lt;br /&gt;
&lt;br /&gt;
The question, as always, is revenue. &amp;nbsp;Who pays? &amp;nbsp;Will readers pay to&lt;br /&gt;
be a part of this service? &amp;nbsp;Probably not 100%. &amp;nbsp;But they might pay for&lt;br /&gt;
certain premium services. &amp;nbsp;Imagine if J.K. Rowling offered sneak peeks&lt;br /&gt;
into her books to premium subscribers? &amp;nbsp;And what about content&lt;br /&gt;
authors? &amp;nbsp;Do they expect to be paid, or will they pay us to be a part&lt;br /&gt;
of the service? &amp;nbsp;The latter is not so very far fetched. &amp;nbsp;Because&lt;br /&gt;
basically what you're talking about is a built in community support&lt;br /&gt;
forum. &amp;nbsp;All an author needs to do is enable his &lt;span class="il"&gt;book&lt;/span&gt; to work with this&lt;br /&gt;
system and presto, a community might/can/will spring up, and he's&lt;br /&gt;
done. &amp;nbsp; &amp;nbsp;He can even make some money back by offering premium&lt;br /&gt;
services, as above.&lt;/blockquote&gt;
&lt;br /&gt;
We've finally reached the point where this is possible.&amp;nbsp; Check out &lt;a href="http://allthingsd.com/20120124/subtext-app-makes-readers-thoughts-an-open-book/"&gt;Subtext for iPad&lt;/a&gt;. I hate when this happens.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/yuYG2DsvSMg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/yuYG2DsvSMg/i-want-to-share-with-you-something-that.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2012/01/i-want-to-share-with-you-something-that.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-3480117424038984287</guid><pubDate>Tue, 14 Jun 2011 15:04:00 +0000</pubDate><atom:updated>2011-06-14T08:04:06.420-07:00</atom:updated><title>Rails : no such file to load -- devise/orm</title><description>&lt;p&gt;If you're like me, you're getting this error while trying to get Devise set up. You google around and everything talks about mongoid or mongo_mapper, which you're not using.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Turns out the solution to this one is easy. Go into config/initializers/devise.rb and not this section:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  &lt;p&gt;# ==&amp;gt; ORM configuratio&lt;br /&gt;&lt;br /&gt;  # Load and configure the ORM. Supports :active_record (default) an&lt;br /&gt;&lt;br /&gt;  # :mongoid (bson_ext recommended) by default. Other ORMs may be&lt;br /&gt;&lt;br /&gt;  # available as additional gems&lt;br /&gt;&lt;br /&gt;  &amp;nbsp;&amp;nbsp;require 'devise/orm/'&lt;/p&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;See it? When I read that I assume it meant that I could leave this alone and get active_record support. Apparently not. Change the line to read : &lt;b&gt;require 'devise/orm/active_record'&lt;/b&gt; and see if your problem doesn't go away. Mine did! :)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/d_ioTMFAyxQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/d_ioTMFAyxQ/rails-no-such-file-to-load-deviseorm.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>2</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2011/06/rails-no-such-file-to-load-deviseorm.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-3739670324694615008</guid><pubDate>Fri, 27 May 2011 02:00:00 +0000</pubDate><atom:updated>2011-05-26T19:00:43.050-07:00</atom:updated><title>How'd You Get Your Job?</title><description>In my day job I'm tasked with building a job board. What that means is still pretty open.&amp;nbsp; Never one to just copy what the other guys are doing, I've been on a research kick.&lt;br /&gt;
&lt;br /&gt;
So tell me.&amp;nbsp; How'd you get your job?&amp;nbsp; Job board?&amp;nbsp; If so, which one (if you remember)?&amp;nbsp; Or was it more about the connections, the who-you-know?&amp;nbsp; Right place, right time?&amp;nbsp; Newspaper ad?&amp;nbsp; Something else altogether?&lt;br /&gt;
&lt;br /&gt;
I'm interesting in all kinds of input from all angles, regardless of what sort of job you have. If people are using job boards I want to understand what the most important features are. If they're not, I want to figure out if there's something I can build into one that will make them useful again.&lt;br /&gt;
&lt;br /&gt;
I'll start - my last two jobs came when a former coworker said "Come work for/with me."&amp;nbsp; In both cases I knew and trusted the coworker and made the move.&amp;nbsp; Prior to that I had a trusted recruiter that I'd used on multiple occasions.&lt;br /&gt;
&lt;br /&gt;
Who's next?&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/6wQOYl-3jGo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/6wQOYl-3jGo/hows-you-get-your-job.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>4</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2011/05/hows-you-get-your-job.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-8345131925381720150</guid><pubDate>Mon, 03 Jan 2011 16:32:00 +0000</pubDate><atom:updated>2011-01-03T08:40:55.230-08:00</atom:updated><title>In Praise of Single Use Devices</title><description>There's an old marketing joke about the guy who went into the corporate office of the shampoo company and said "I can double your business with one word." That word? "Repeat."&lt;br /&gt;
&lt;br /&gt;
Very related to this story has to be the first guy who decided that any device with a computer chip in it has to come with a game. Cell phones, calculators, MP3 players, what device of sufficient computing power these days does not have some sort of game? Even the early ipods had some sort of solitaire in them if I recall, as well as this "Name that tune" game that was actually pretty innovative since if use your own music.&lt;br /&gt;
&lt;br /&gt;
Stop to think about it for a second. Why? Why does your phone need to play Blackjack?&lt;br /&gt;
&lt;br /&gt;
The answer is simple - it's so that when you don't need to use your phone, you will still want to use your phone. "I'm bored. Hey, I know, my phone plays Solitaire, I'll do that."&lt;br /&gt;
&lt;br /&gt;
Never forget that this is an invention intended to benefit the producer of the device, not the consumer. If there are two phones on the market, one of them does 3 things and one of them does 4 things, which one will most customers go for? Why, the one that does 4 things of course.&lt;br /&gt;
&lt;br /&gt;
Well as I sit here with my new Kindle in hand, I'm having something of a Luddite moment. There's value in single use devices. Let's go back to that very first example, your stupid phone that still managed to play Blackjack on that tiny keypad. That moment when you said to yourself "Nobody's calling me, I don't have anyone to call...but my phone plays Blackjack, I'll do that." Imagine that the phone didn't play blackjack. What would you do? How about SOMETHING THAT DOESN'T INVOLVE YOUR PHONE? Read a book. Exercise. Go visit someone. Clip your fingernails. There's got to be 1000 things you could do besides play that game, but because someone put that game in your hand, you will play it.&lt;br /&gt;
&lt;br /&gt;
I have a Kindle, not an iPad. Most people agree right now, at least from a distance, that multi-use devices like iPad will destroy single-use devices like Kindle. Why not, after all? Why get a device that does one thing when you can get a device that does 100 things? Well, because that device does 100 things, really.&lt;br /&gt;
&lt;br /&gt;
In the week I've had my Kindle I've already finished one book (The Princess Bride), am half way through another (A Wrinkle In Time, which I am scanning to see whether my 8yr old is ready for it), and have made a dent in 4 others. I carry it with me, and whenever I have a moment I read.&lt;br /&gt;
&lt;br /&gt;
If I had an iPad, what would I have done in that time? Yes, iPad has an ebook reader. Would I have used it? Of course not, and we all know it. I would have played Angry Birds every chance I got. New levels! New levels!! There are new Angry Bird Levels!!!&lt;br /&gt;
&lt;br /&gt;
When a device only does one thing, you come to appreciate the quality of doing that thing. The Kindle could be a better reader, on a number of fronts. I'd like a light, but not at the expense of that crisp contrast it has. I'd like better text-to-speech, and better page turning. But will either of those make me say "Oh, well, see, the iPad is better, then." Nope, because I know that the iPad is too much in the wrong direction. The Kindle wants to do one thing better than anybody else. The iPad wants to do everything good enough. Sometimes everything is too much.&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/v24NFkuMS_Q" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/v24NFkuMS_Q/in-praise-of-single-use-devices.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>2</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2011/01/in-praise-of-single-use-devices.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-2102188220466889355</guid><pubDate>Mon, 16 Aug 2010 18:46:00 +0000</pubDate><atom:updated>2010-08-16T11:46:34.910-07:00</atom:updated><title>When Does “You” Become “We”?</title><description>&lt;p&gt;I’ve noticed this every time I start a new job.&amp;#160; How long does it take before you stop referring to the company as “you” (as in, “What did you guys mean to do over here…”) and when do you start using “we”?&amp;#160; Twice now my new bosses have caught me and said “Feel free to start using ‘we’ any time, you’re part of the company now too.”&lt;/p&gt;  &lt;p&gt;I think the distinction I make is that when I’m speaking of the efforts that came before me, I say “you”.&amp;#160; After all, it’s not like I want to take credit for their work.&amp;#160; I can’t say “Here’s what we meant to accomplish in version 6.1” if it came out before I was around, right?&amp;#160; Once I’ve got new features added to the product I’ll feel more comfortable saying We.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/_gudu6NpEII" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/_gudu6NpEII/when-does-you-become-we.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>1</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/08/when-does-you-become-we.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-8930242246189030184</guid><pubDate>Wed, 28 Jul 2010 15:13:00 +0000</pubDate><atom:updated>2010-07-28T08:13:28.301-07:00</atom:updated><title>Test Driven Learning</title><description>&lt;p&gt;So, I’ve been out of work for about a month.&amp;#160; During my time back in the hunt I learned just how big test-driven development, or TDD, has become.&amp;#160; Quite literally every place I interviewed (for Java and Rails jobs alike) asked me what my experience with it was, my philosophy, and on and on.&lt;/p&gt;  &lt;p&gt;And I had to answer, in each case, truthfully.&amp;#160; I get the idea of TDD.&amp;#160; I’m a fan.&amp;#160; But never have I been in a place that’s truly adopted it.&amp;#160; Usually the typical legacy excuses all get in the way – nobody wants to write tests for code that already exists, so there’s no good framework from which to build new tests, and it’ll take too much effort to make that happen when it’s easier to just continue writing code like they’ve always done.&amp;#160; Not a good excuse, just a popular one.&lt;/p&gt;  &lt;p&gt;Well, I’ve got a new job now and all the above is still true.&amp;#160; However I think I’ve found a bit of a loophole in that logic that’s going to allow me to force feed TDD into the mix.&amp;#160; I’m a new hire.&amp;#160; There’s an existing code base.&amp;#160; I can read the code all day long, and I can think I understand it, but how do I really know?&amp;#160; Should my first real interaction with the code be when I’m making changes that could potentially introduce bugs? Into production?&amp;#160; Not such a great idea.&lt;/p&gt;  &lt;p&gt;So instead, as my first project, I integrate JUnit (it’s a Java shop).&amp;#160; Then, I start writing unit tests.&amp;#160; I read an existing function of an existing object, I think I understand what it’s supposed to do, so I write a test for it.&amp;#160; One of two things is going to happen.&amp;#160; Either the test will work, in which case my understanding of the code was correct, or else it’s going to fail, in which case either my understanding of the code was wrong, or else the code itself was wrong.&lt;/p&gt;  &lt;p&gt;The end result is that a) I know the code does what I think it does, b) I potentially uncover bugs that would have otherwise been uncovered the hard way, and c) now unit tests exist for the next guy.&amp;#160; Win win win.&lt;/p&gt;  &lt;p&gt;I call it “test driven learning”, and I dub it TDL.&amp;#160; Pass it on.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/Tv2ntRNkjHQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/Tv2ntRNkjHQ/test-driven-learning.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/07/test-driven-learning.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-2465426609194836000</guid><pubDate>Mon, 24 May 2010 14:32:00 +0000</pubDate><atom:updated>2010-05-24T07:32:14.139-07:00</atom:updated><title>What Do Drivers Do In Computers?</title><description>I've been working on a project recently where I get to look at the kinds of questions people ask of Google, when phrased as a question.&amp;nbsp; For any given subject I get a glimpse of what people want to know, based on how they ask it.&lt;br /&gt;
&lt;br /&gt;
Today's question is a very popular one on the subject of Windows device drivers :&lt;br /&gt;
&lt;blockquote&gt;What do drivers do in computers?&lt;/blockquote&gt;To really understand what drivers do in computers, you need to stop for a second and consider what's really going on under the covers.&amp;nbsp; You have "hardware".&amp;nbsp; That's the physical stuff - your memory, your CPU, your hard drive, your DVD player, your microphone.&amp;nbsp; Then you have "software".&amp;nbsp; That's the programs and files that live as bits (ones and zeroes) in the memory and on the hard drive.&amp;nbsp; The magic of how computers work could be summed up very briefly as, "The software tells the hardware what to do." &lt;br /&gt;
&lt;br /&gt;
When you load a DVD, there are some physical steps.&amp;nbsp; You open the tray, usually by pushing a button.&amp;nbsp; You put the DVD in, and then close the tray either by pushing the button again or giving the tray a little shove.&amp;nbsp; And then your movie starts playing.&amp;nbsp; But that's where software comes in.&amp;nbsp; How exactly did the computer know that you put a new disk in the drive? The DVD player itself has just enough smarts to know when that tray door opens and closes. So when you close it, a signal is sent down the cable that connects player to motherboard. The CPU, which listens to everything going on around it, says "Ok, I just got an XYZ signal from the PDQ cable, what am I supposed to do with that?"&lt;br /&gt;
&lt;br /&gt;
And that's where your "device driver" comes in.&amp;nbsp; The driver is a tiny little program whose sole purpose in life is to raise its little digital hand and say "Me!&amp;nbsp; Ooo!&amp;nbsp; I know how to handle XYZ signals from the PDQ cable!"&amp;nbsp; Ok, I'm being a little silly, but that's really what it comes down to.&amp;nbsp; Signals come through that cable, they go over to this little driver program, and the driver speaks a language that the rest of the software (Windows, typically) can understand.&amp;nbsp; So that XYZ signal is might translate into something like, "A new DVD has been inserted, pop up that dialog box that asks the user what she wants to do with it."&lt;br /&gt;
&lt;br /&gt;
Before Windows, you actually would have had to do this all yourself.&amp;nbsp; When you bought a new printer or even a mouse, it would come with a disk that contained these drivers.&amp;nbsp; You'd copy them over to your hard drive, and then have to modify the startup programs to let the computer know these drivers were available.&amp;nbsp; One of the reasons that Windows took over the PC world was because, in the words of one famous industry analysis, it was just "a big bag of drivers."&amp;nbsp; That was the whole point -- now you don't have to deal with drivers anymore, they're just there.&lt;br /&gt;
&lt;br /&gt;
Except when...they're not.&amp;nbsp; New devices come out all the time, it's impossible for Windows to have every driver for every device.&amp;nbsp; Worse than that, sometimes these driver programs have bugs in them and need to be updated.&amp;nbsp; So it's important to recognize the role these drivers play, and keep them updated.&amp;nbsp; Modern versions of Windows have an Update Service that will let you know when it's time to download new drivers.&amp;nbsp; Or you could look into a service like &lt;a href="http://www.driveragent.com/"&gt;DriverAgent.com &lt;/a&gt;which will do all the work for you, scanning your computer to determine which drivers are out of date and then offering you an easy way to download them all in one visit.&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/Opt0DKuJOyA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/Opt0DKuJOyA/what-do-drivers-do-in-computers.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/what-do-drivers-do-in-computers.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-8373550761947119583</guid><pubDate>Sat, 22 May 2010 02:20:00 +0000</pubDate><atom:updated>2010-05-21T19:20:53.295-07:00</atom:updated><title>Verizon DVR Hack : Deleting Multiple Episodes</title><description>If you've got Verizon DVR and you're like me, particularly if you've got the home media option for sharing between boxes, you'll often get 5 or so episodes of a tv show that you've watched but haven't deleted (because you watch them on other tv's where you can't delete).&amp;nbsp; And perhaps you've noticed a rather annoying issue with this where, once you're down to one episode, what happens is that it'll suddenly kick you back to the list of programs (because now there's no longer a folder for that show) and, because that episode is a few days/weeks old, it's buried at the bottom and you have to go find it.&lt;br /&gt;
&lt;br /&gt;
Know what I'm talking about?&amp;nbsp; You go into the Grey's Anatomy folder, and delete one.&amp;nbsp; This is already complicated enough because for Verizon you need to hit like 4 buttons - Right arrow to get into folder, then Enter to select episode, then Down two times (or three, if you're half way through the program and have "Resume Play" option) to get to Delete, and then down for Yes, then enter.&amp;nbsp; That's alot of keystrokes.&amp;nbsp; So you have to do that for N shows.&amp;nbsp; And when there's that last show left, suddenly you have to do even more because now you have to scroll through your shows to go find where in time that last one is hiding.&lt;br /&gt;
&lt;br /&gt;
Ok, enough of that, want to know the trick?&amp;nbsp; Skip the most recent episode.&amp;nbsp; Instead of deleting them top down, move to the second most recent one, and then delete them all.&amp;nbsp; What will happen when you only have the one most recent one left, it'll kick you back to the top level -- but look at that, your cursor is still sitting on the show you want.&amp;nbsp; Delete.&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/hiCtT0arScE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/hiCtT0arScE/verizon-dvr-hack-deleting-multiple.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/verizon-dvr-hack-deleting-multiple.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-3160664802693467790</guid><pubDate>Mon, 17 May 2010 13:37:00 +0000</pubDate><atom:updated>2010-05-17T07:23:23.112-07:00</atom:updated><title>What We Need Is Psychic Search</title><description>&lt;p&gt;Sunday afternoon, out having lunch at a noisy restaurant.&amp;#160; I hear part of a song I recognize, enough to say to my wife “Good song,” but then we can not hear the rest.&amp;#160; For the life of me I can not think of the song, and it drives me nuts all the way home.&amp;#160; Easy enough to Google lyrics, right?&amp;#160; Wrong, the sequence I heard was nothing but harmonizing, just background singers singing “Ahh ahh AHHHH….ahh ahh AHHHHH….ahh ahhh AHHHHHHH” where the third one has gotten higher, and then presumably it moves into the next verse which is what I can’t remember.&lt;/p&gt;  &lt;p&gt;Try googling “song opening ahhh ahh ahhh” and see what happens. I got lots of hits for Led Zeppelin’s Immigrant Song, which I think is funny because it is both an accurate answer to the question, and also not even close to what I meant.&amp;#160; There were also lots of hits on modern dance club songs, but I’m old and don’t really know those enough to say one way or the other.&lt;/p&gt;  &lt;p&gt;So I post on Facebook, and my friends begin guessing.&amp;#160; One says “At the Hop”, that old 50’s tune that starts “bahh bahhh bahhh bahhh, bahhh bahhh bahh bahhhh At the hop!&amp;#160; Well you can rock and you can roll and you can stomp and you can stroll at the hop….” (or whatever the words are).&amp;#160; Again, an accurate answer to the question pretty much, but not at all what I was looking for.&lt;/p&gt;  &lt;p&gt;Undaunted I started googling for “Hum a few bars” hoping to turn up one of those search engines where you can sing into the microphone to guess your song.&amp;#160; I find nothing but hits from the 2006-08 era, none still active, so I’m wondering if I searched wrong.&amp;#160; I do try the iPhone app “Shazam”, but it can not recognize the tune so chances are I’m singing it too poorly.&lt;/p&gt;  &lt;p&gt;I do strongly think that it is a 60’s tune, what I described to my friends as “hippie era” :).&amp;#160; Running out of ideas I google “summer of love music” and find a list of hits from that year (1967, I believe?) &lt;/p&gt;  &lt;p&gt;And there it is.&lt;/p&gt;  &lt;p&gt;Groovin, On A Sunday Afternoon by the Young Rascals.&amp;#160; My “ahh ahh AHHHH'” sequence is right there in the middle.&lt;/p&gt;  &lt;p&gt;Now what I need is for somebody make the connection from my original query to the query that ultimately found me the answer.&amp;#160; We’ll make millions. :)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;strong&gt;UPDATE&lt;/strong&gt; : Adding to my own post because the more I think about this, I think it’s not that far off.&amp;#160; I knew that it was a 60’s tune, right? Imagine if for my music search engine I was able to start there.&amp;#160; Just like the other folks I mentioned knew that there’s was a dance club song, and I knew mine was not.&amp;#160; From there maybe the engine could offer up some guiding questions like the tempo (this one is pretty slow), single or group (group), background harmony (definitely)…and so on.&amp;#160; I know that recommendation engines like Pandora break songs up into N different parameters and then match, saying “If you liked this song with these values then you’ll probably like this other song with similar values.”&amp;#160; But what if instead of doing that you offered up an interface where the user could just select those values on sliders?&amp;#160; “I want strong lead vocals, meaningful lyrics and a fast drum beat.”&amp;#160; &lt;/p&gt;  &lt;p&gt;A slow 1960’s song with a harmonizing group certainly wouldn’t guarantee finding my song, but it would at least help narrow the search, and that’s huge.&amp;#160; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/y2JWLx4akc4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/y2JWLx4akc4/what-we-need-is-psychic-search.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/what-we-need-is-psychic-search.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-5251839522759594391</guid><pubDate>Wed, 12 May 2010 19:59:00 +0000</pubDate><atom:updated>2010-05-12T12:59:44.165-07:00</atom:updated><title>Variety in User Interfaces</title><description>&lt;p&gt;Once upon a time Robert Heinlein wrote a book about a car with a voice synthesizer.&amp;#160; You talked to it, it talked back.&amp;#160; When it started speaking in phrases that the driver had never added, he chalked it up to one of his friends messing around with the database.&amp;#160; Eventually it got to the point where he wasn’t sure that the car wasn’t simply sentient.&lt;/p&gt;  &lt;p&gt;I think that there’s lots of room for voice applications in today’s user interfaces.&amp;#160; Take the GPS in your car.&amp;#160; I expect that it talks.&amp;#160; You’re not supposed to read the screen while you’re trying to drive, right?&amp;#160; So let’s think about how it talks.&lt;/p&gt;  &lt;p&gt;One way is to have a good solid database of what it can say, including names of all the streets.&amp;#160; That’s very handy, because instead of just “Turn left” it can say “Turn left on Quantum Street.”&amp;#160; But the downside is that you’ll be limited in other ways, and there’ll probably be very few ways that the computer phrases certain things.&amp;#160; It’s strength lies in being able to read you what is effectively a bunch of proper names.&lt;/p&gt;  &lt;p&gt;The other approach to take is more generic, and not speak the street names.&amp;#160; “Turn left” and you rely on the layout of the road to know that you’re taking the left it wanted you to take.&amp;#160; Of course there is still an image on the screen, which can have the street name, so it takes half a second to look down and see whether you’re going where you are supposed to.&lt;/p&gt;  &lt;p&gt;BUT! Once you substantially drop the size of the database by focusing only on a handful of “Turn left” / “Turn right” types of phrases, now you’ve opened the door to downloading your choice of voice.&amp;#160; You could have a celebrity read the 100 or so phrases, zip it up, and there you go.&lt;/p&gt;  &lt;p&gt;Even better, you could be given instructions for how to do it yourself.&amp;#160; My TomTom has this, but I’ve never taken advantage of it.&amp;#160; I do have John Cleese from Monty Python doing my directions, but I’ve never sat down to record the kids and wife doing it (“Turn left here, turn left, here, turn left! You’ll kill us all!”).&amp;#160; The instructions were fairly complicated, explaining how you had to get each soundclip exactly the right length for it not to sound broken.&amp;#160; Forget that.&lt;/p&gt;  &lt;p&gt;What I’d love to see, though, and this gets be back to my original story, is more variety.&amp;#160; The TomTom worked by saying “Ok, provide a folder consisting of 59 sound files labelled as follows.”&amp;#160; There’s a single sound clip for “end of trip”, so no matter how many times I use it, John Cleese is always there saying “You have reached your destination.&amp;#160; You may get out now, but I’m not going to carry your bags.”&lt;/p&gt;  &lt;p&gt;What if instead of 59 sound files I was told to provide 59 directories, and in each directory there could be as many files as I wanted?&amp;#160; And whenever the device needed to play something it would instead just grab a random file from the appropriate directory?&lt;/p&gt;  &lt;p&gt;That would be AWESOME.&amp;#160; For the most common ones you could sit down and record a good couple of dozen different ways to say it.&amp;#160; Maybe set something up that is user contributed so you just plain don’t know how many different sounds there are?&amp;#160; Or set a priority on them so that most of the time you get “Turn right” but once in a hundred you get “Turn right, moron.”&lt;/p&gt;  &lt;p&gt;This approach, of course, would thus work for any device that talks back to you.&amp;#160; Your answering machine, maybe?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/z_ZOukBN-4k" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/z_ZOukBN-4k/variety-in-user-interfaces.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/variety-in-user-interfaces.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-1388100910601347039</guid><pubDate>Wed, 12 May 2010 18:52:00 +0000</pubDate><atom:updated>2010-05-12T11:52:35.061-07:00</atom:updated><title>Type Type Revolution?</title><description>&lt;p&gt;&lt;a title="http://blog.shakespearegeek.com/2010/05/shakespeares-thighs.html" href="http://blog.shakespearegeek.com/2010/05/shakespeares-thighs.html"&gt;http://blog.shakespearegeek.com/2010/05/shakespeares-thighs.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, anybody know how to hack a “dance mat”?&amp;#160; I’ve&amp;#160; seen a bunch of games with this type of input device where you jump up and down on it – my kids even had a simple little “Strawberry Shortcake And Friends Dance Party” one if I recall.&lt;/p&gt;  &lt;p&gt;Take one of those and build a game up around it where instead of dancing to music, you’re typing like you would on a cell phone.&amp;#160; &lt;/p&gt;  &lt;p&gt;Improve your spelling, your accuracy…your appreciation of classic literature.&amp;#160; A game could be made out of it, where you have to answer questions but instead of jumping to A-D you have to spell out the answer.&lt;/p&gt;  &lt;p&gt;I would totally buy that.&amp;#160; Somebody, if they haven’t already, needs to make a generic “dance mat” controller for Wii or something (balance board does not count!) that games can be written to.&amp;#160; Or maybe even a USB one so you can use it on the PC?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/buX7JLVuF5I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/buX7JLVuF5I/type-type-revolution.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/type-type-revolution.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-4999569212594020825</guid><pubDate>Tue, 11 May 2010 13:45:00 +0000</pubDate><atom:updated>2010-05-11T06:45:04.898-07:00</atom:updated><title>MongoDB Ruby Driver : nToReturn=100?</title><description>&lt;p&gt;The other day I noticed in my logs that I kept getting my very large (6 million rows) result set back 100 rows at a time.&amp;#160; The log kept saying getmore, getmore, getmore… with nToReturn=100 set as a parameter.&amp;#160; So it was doing the right thing, but where was that 100 coming from?&lt;/p&gt;  &lt;p&gt;A post on the user group gave me the answer – the default “batch_size” option for find is set at 100 in my version of the Ruby driver, when it should be set at o (which is the signal for the driver to just figure out the optimal size).&amp;#160; So you can override this by forcing batch_size:&lt;/p&gt;  &lt;p&gt;@results = @objects.find(@conditions, {:batch_size=&amp;gt;0})&lt;/p&gt;  &lt;p&gt;You should notice an improvement in performance.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/uf_hR2_Xkh8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/uf_hR2_Xkh8/mongodb-ruby-driver-ntoreturn100.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/mongodb-ruby-driver-ntoreturn100.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-5293790346140383622</guid><pubDate>Mon, 03 May 2010 20:31:00 +0000</pubDate><atom:updated>2010-05-03T13:31:30.148-07:00</atom:updated><title>Mongo Good.</title><description>Been working on an interesting project lately where I was handed some 6 million XML files with no meaningful schema, and told to make a warehouse out of them.&amp;nbsp; Each XML file also happens to have several hundred elements in it.&amp;nbsp; With no schema it would be a nightmare to try and make one, never fully sure whether you'd allocated enough space, whether just because your sample of this field yielded integers means that it always has to be an integer .. stuff like that.&lt;br /&gt;
&lt;br /&gt;
I tried a very simple "Elements and Attributes" schema that is capable of loading any XML file.&amp;nbsp; Basically each Element and each Attribute get a row in the database.&amp;nbsp; This works fine for smallish data sets, but mine quickly blew up into billions of rows and was no longer manageable.&lt;br /&gt;
&lt;br /&gt;
Then I stumbled over &lt;iframe align="left" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="http://rcm.amazon.com/e/cm?t=suchstuff-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=bpl&amp;amp;asins=0321705335&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr" style="height: 245px; padding-right: 10px; padding-top: 5px; width: 131px;"&gt;&lt;/iframe&gt;the "No SQL" movement, where we quite literally throw out decades of knowledge about how to set up a SQL schema of tables and rows, joins and where clauses .. and replace it with something more document-driven, no schema. This sounded perfect, since that's exactly what I had.&lt;br /&gt;
&lt;br /&gt;
Enter &lt;a href="http://www.mongodb.org/"&gt;Mongo DB&lt;/a&gt;.&amp;nbsp; With a little help from Ruby, my loader script for 6 million XML files now looked like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;Foreach XML file:
  Load it via REST web service
  Parse it into a JSON object
  mongo.insert(object)&amp;nbsp;Done!
&lt;/pre&gt;&lt;br /&gt;
Done!&amp;nbsp; Now if I'm hiding the name of a software vendor somewhere in the middle of one of those objects, like say {"machine"=&amp;gt;{"software=&amp;gt;[ "instance"=&amp;gt;{"name"=&amp;gt;"Microsoft something" ... }]}}&amp;nbsp; and I want to find them?&amp;nbsp; All I need to say is&amp;nbsp; find("machine.software.instance.name" =&amp;gt; /Microsoft/) and presto, I've got back my filtered list.&amp;nbsp; I can add a count() to get the total number of matches, or an each(...) or map(...) to process the list, or basically anything else I might want to do.&amp;nbsp; Of course I can also add an index on it to keep the performance high, too.&lt;br /&gt;
&lt;br /&gt;
I'm finding this NoSQL stuff fascinating.&amp;nbsp; Takes a little while to mentally get around everything you've learned about normalizing a schema.&amp;nbsp; Instead of a dozen tables all crosslinked with each other, I've got one "collection" that is nested in a variety of ways.&amp;nbsp; But I quite literally spent 0 effort on schema design.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
I haven't even begun to touch on things like the built in sharding, which enables you to scale across multiple instances without having to worry about which server hold which portion of your data. Another player in this space, Cassandra (from the Facebook people), is most well known for being great at that. We looked at Cassandra but it had some schema setup required that I was not able to complete.&amp;nbsp; With Mongo I just inserted everything and now I'm free to query at will, no matter how complex the original key structure was.&lt;br /&gt;
&lt;br /&gt;
I hope to write more here as I come up to speed on what is obviously the next big thing in the world of database design.&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/T0TXVlWA1po" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/T0TXVlWA1po/mongo-good.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/05/mongo-good.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-3747904424567730696</guid><pubDate>Fri, 12 Mar 2010 19:21:00 +0000</pubDate><atom:updated>2010-03-12T11:21:34.154-08:00</atom:updated><title>How Geeks Pick Battles</title><description>&lt;p&gt;My son’s got a birthday coming up, and we’re having it at one of those local gymnastic places.&amp;#160; On their website is a “print your invitations” link, which turns out to be a 2 page PDF.&amp;#160; More specifically it is 4 rectangles – two front, two back – intended to be printed out double sided on card stock, then cut out and mailed.&amp;#160; Cool enough.&lt;/p&gt;  &lt;p&gt;I do not have a double sided printer, though, so I print out both pages and take it down to the local copy place, where I realize that…they don’t line up.&amp;#160; Damnit.&amp;#160;&amp;#160;&amp;#160; It’s clear what’s gone wrong, the people who cobbled this thing together put a 1” border from the left on both pages – but since page 2 is on the back they should have measured 1” from the right.&lt;/p&gt;  &lt;p&gt;The wife tells me no worries, she will just buy some invitations at the store.&amp;#160; I assure her that this is not a problem, I just need to muck with the margins on page 2.&lt;/p&gt;  &lt;p&gt;After discovering that your typical PDF reader does not let you play with the margins on a per-page level like that, I switch over to a PDF editor – InkScape, to be specific.&amp;#160; Technically, though, InkScape is a graphic editor with import/export PDF, so I can only edit one page at a time.&amp;#160; Fair enough.&lt;/p&gt;  &lt;p&gt;I will save you lots of cussing, but fast forward a half dozen sample printouts when I realize that it’s not that they are not lined up properly (they are not), but that one of the front rectangles is a different size than the others! This is throwing everything off.&amp;#160;&amp;#160;&amp;#160; That’s seriously annoying.&lt;/p&gt;  &lt;p&gt;But!&amp;#160; I’m in an editor after all.&amp;#160; Select all.&amp;#160; Ungroup.&amp;#160; Select background rectangle.&amp;#160; Resize.&amp;#160; Done. :)&lt;/p&gt;  &lt;p&gt;I spent maybe an hour and a half on that.&amp;#160; At any time I could have just skipped the whole thing and let the wife buy some new ones, but part of being a geek is taking the battle for supremacy very seriously, and not letting the machines win.&amp;#160; If the only thing standing between a problem and a solution is something involving technology, I’m not about to give up easily.&amp;#160; And it has been known to drive me occasionally crazy.&amp;#160; But I wouldn’t change it. &amp;gt;:)&amp;#160; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/U4iQ_Rtzpk4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/U4iQ_Rtzpk4/how-geeks-pick-battles.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/03/how-geeks-pick-battles.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-168389267979528827</guid><pubDate>Wed, 27 Jan 2010 21:32:00 +0000</pubDate><atom:updated>2010-01-27T13:32:43.170-08:00</atom:updated><title>Thoughts on iPad</title><description>&lt;p&gt;On the one hand, Apple’s new gadget is a big fat iTouch.&amp;#160; After all, what’s the real difference between an iPhone and an iTouch to begin with? Voice calls via 3G, for one.&amp;#160; Take those out and the only real difference is the video camera, which is neglible since they can put one in at any time.&lt;/p&gt;  &lt;p&gt;Here is why the best ebook reader in the world will still not get me to buy one, and it’s not because I’m a book nut who loves the smell of paper.&amp;#160; Ready?&amp;#160; You can’t rip a book.&lt;/p&gt;  &lt;p&gt;Go back to when iTunes was new, and you could buy music from Apple.&amp;#160; Not all music, sure.&amp;#160; But what were your options at that point?&amp;#160; If you already had the music in a different digital format then maybe you could port it.&amp;#160; Fine.&amp;#160; But the big killer idea was that you could get the CD and you could rip it.&amp;#160; Convert physical into digital.&amp;#160; And then you win.&lt;/p&gt;  &lt;p&gt;What’s the comparable example for books? I don’t read a great deal of brand new bestseller types.&amp;#160; When I pick up a book it’s either a non-fiction thingie out of the Shakespeare section, or its a classic scifi that I missed the first time around.&amp;#160; Sometimes, to be fair, a new scifi tome or Shakespeare novel will come out and I do pick those up off the “New Releases” shelf, but those are only a portion of my purchases.&lt;/p&gt;  &lt;p&gt;So, what am I to do?&amp;#160; The book I want is not available in iPad format.&amp;#160; Is it available in some other digital format because somebody else did the work for me?&amp;#160; Maybe.&amp;#160; Sometimes.&amp;#160; Not often.&lt;/p&gt;  &lt;p&gt;So then what?&amp;#160; I can’t meaningfully rip a book.&amp;#160; I am well aware that there is technology that can do it, and Google’s pioneering some work in that area.&amp;#160; I’m talking about a single home user trying to turn his physical book into a digital version.&amp;#160; Can’t be done.&amp;#160; And that kills me.&amp;#160; If you told me that you were installing a book ripping machine in every Apple retail store, and that I could walk in and get a genius to rip my books into iPad format for me? I’d be all over it.&amp;#160; I’d systematically rip my whole collection (depending on much Apple charged me for the service :)).&amp;#160; &lt;/p&gt;  &lt;p&gt;Where I do see a future for these devices is a few years down the line when my kids go to college.&amp;#160; I see them carrying a single device, instead of a backpack full of text books.&amp;#160; All their text books are right there in a tablet.&amp;#160; All the updates, too.&amp;#160; And homework and study guides, and question and answer forums.&amp;#160; It’ll have a keyboard for speedy word note taking, but you can also draw on it for diagrams.&amp;#160; It’ll have net so you’ve always got Google and Wikipedia, but it’ll also have instant message and SMS because you can’t live without those.&lt;/p&gt;  &lt;p&gt;The big question will be how you keep the difference between “study machine” and “cheating machine”.&amp;#160; If you’re allowed to have it, you’ll be able to cheat with it.&amp;#160; But if you’re not allowed to have it, you’ll lose all your reference materials.&amp;#160; I’m not sure how that will play out yet.&amp;#160; I’d love to imagine some sort of signal blocking device so that once you’re in the classroom your teacher could assure that all your devices switched to local mode, but I don’t see that happening.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/3jWBFg6LD88" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/3jWBFg6LD88/thoughts-on-ipad.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>2</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/01/thoughts-on-ipad.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-2180330870056304990</guid><pubDate>Mon, 11 Jan 2010 16:12:00 +0000</pubDate><atom:updated>2010-01-11T08:12:42.333-08:00</atom:updated><title>Rails : Passenger Is Deleting my Sub / RailsBaseURI Prefix</title><description>&lt;p&gt;Ok, this was a weird one.&amp;#160; I’m not going to jump into a lesson in how to make Phusion Passenger work to deploy Rails applications, but suffice to say that I had a situation working where we have multiple controller entry points all in to the same application, so I had this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;RailsBaseURI&amp;#160;&amp;#160; /foo      &lt;br /&gt;RailsBaseURI&amp;#160; /bar       &lt;br /&gt;…&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;/foo and /bar, then, are soft links from the docroot over to the Rails application’s public folder.&amp;#160; The dispatcher is smart enough to say “Ok, based on the public folder I know where the Rails app lives, and once I know that I can go invoke the appropriate controller.”&amp;#160; So a request for /foo would expect there to be a foo_controller.rb file. &lt;/p&gt;  &lt;p&gt;That’s been working fine for me in production for months.&lt;/p&gt;  &lt;p&gt;But this week I got the most annoying problem – I added /baz, and kept everything else the same – the soft link, the RailsBaseURI, the baz_controller file.&amp;#160; But now all of a sudden I’m getting&amp;#160; :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;No route matches &amp;quot;&amp;quot; with {:method=&amp;gt;:get}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;And, let me tell you, it is very hard to Google for empty strings.&amp;#160; I got plenty of examples of people having trouble with No route matches “/foo” or “/approot”, but in each case it was at least telling them their route – mine was being eaten!&lt;/p&gt;  &lt;p&gt;On a hunch I would try /baz/baz – and it worked fine.&amp;#160; I tried /baz/ (note the trailing slash) and suddenly my “No route matches” error would turn into “/”.&amp;#160; Aha, I had it – somehow my prefix, which I’m relying on to handoff to my controller, is being eaten.&amp;#160; So by the time Passenger spots “/baz” and hands off to Rails, it just gives “” – and Rails in this case doesn’t know what to do with “” because I don’t have a default route set up.&lt;/p&gt;  &lt;p&gt;The problem appears related to an update to Rails, in conjunction with Passenger.&amp;#160; Many people pointed me to this fix:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;config.action_controller.relative_url_root=”/baz”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I dismissed this out of hand, though, because of my multiple controllers.&amp;#160; What value would I put in there?&amp;#160; I did not want my app to default to one particular entry point.&lt;/p&gt;  &lt;p&gt;Turns out I dismissed it too soon.&amp;#160; What I did was add this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;config.action_controller.relative_url_root=’’&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;And guess what?&amp;#160; Success!&amp;#160; The best way I can take to interpret this is that it’s telling Phusion “Hey, the value in this variable?&amp;#160; I need this, don’t kill it.”&amp;#160; For instance when I made it a “/” value I suddenly started getting errors saying that I had no “baz” route (see how no slash?)&amp;#160; So by saying that I have no relative url root, I’m saying “It’s not safe to delete anything that came in as if it were extra baggage, just leave it all in place please.”&lt;/p&gt;  &lt;p&gt;That may be a painful explanation, particularly to anybody who understands the guts of the Passenger/Rails handoff, but it’s working for me now and I’m abiding by my “If I couldn’t find the answer by googling that means other people have the same problem” rule and posting for the next guy.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/l2GkjEiKsx4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/l2GkjEiKsx4/rails-passenger-is-deleting-my-sub.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2010/01/rails-passenger-is-deleting-my-sub.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-5080657393826473162</guid><pubDate>Tue, 03 Nov 2009 03:52:00 +0000</pubDate><atom:updated>2009-11-02T19:52:44.708-08:00</atom:updated><title>Verizon FIOS Disappoints … Again.</title><description>&lt;p&gt;When I heard FIOS was coming to my town, I got in line.&amp;#160; I couldn’t wait to get what I felt was the best technology in the market.&amp;#160; True, I’m no fan of Comcast.&amp;#160; Competition is good.&lt;/p&gt;  &lt;p&gt;The core technology that gets me my signal?&amp;#160; Fine, can’t complain.&amp;#160; As far as I know it’s even faster than I had before.&amp;#160; I have no complaints.&lt;/p&gt;  &lt;p&gt;It’s the extras.&amp;#160; The user experience.&amp;#160; For instance?&amp;#160; Take the DVR option.&amp;#160; I have several TVs, and a common scenario is to start watching some primetime show, like a Grey’s Anatomy or something, downstairs in the main family room with HD.&amp;#160; But often my wife will say “Can we finish watching this upstairs?”&amp;#160; Verizon has a Home Sharing option that allows exactly this.&amp;#160; Very handy.&lt;/p&gt;  &lt;p&gt;Except for the limitations.&amp;#160; Like, for instance, it won’t “downscale”.&amp;#160; So with a standard tv upstairs I have to record all my programs in standard (even though the box itself is a HD box) if I ever want to stream them.&amp;#160; I’ve learned to live with that. It also can’t be programmed from the remote boxes, so if you finish watching most of your programs upstairs on the bedroom tv you can’t just hit Delete – you have to remember, next time you’re downstairs, to purge all the old shows you’re done with.&amp;#160; An annoyance, but you can live with it.&lt;/p&gt;  &lt;p&gt;The latest disappointment though comes with the new Media Manager for Mac.&amp;#160; I’ve got all the family photos on a Mac Mini (which, also, is connected up to the HD tv in my family room).&amp;#160; That’s also where I rip the kids’ DVDs, and manage all my iTunes stuff.&amp;#160; So when they said “Run this software and your iTunes media will show up on your FIOS boxes” I thought, “Awesome.”&lt;/p&gt;  &lt;p&gt;Except for one small problem – it only works on the DVR box.&amp;#160; In a “Home Sharing” setup, you only have 1 DVR box in the house, and the rest are just dumb satellite player boxes.&lt;/p&gt;  &lt;p&gt;See the problem?&amp;#160; In order to share recorded television shows, you need – are required to have – exactly one Home Sharing DVR.&amp;#160; If you had a DVR box in every room, you could get Media Manager content on every DVR box.&amp;#160; But then you couldn’t share recorded tv programming!&lt;/p&gt;  &lt;p&gt;That’s what bugs me.&amp;#160; I appreciate having to work the kinks out of the system.&amp;#160; But here you’ve got a clear cut case of Verizon setting up mutually exclusive features, and then leaving it up to the customer to realize that.&amp;#160;&amp;#160; I’m not even misinterpreting it, either, as I had a lengthy conversation with Verizon Support over Twitter when I discovered this problem and they confirmed that yes, the options are mutually exclusive.&amp;#160; Get multiple DVRs to share media manager content, or get one DVR to share recorded tv shows, but not both.&lt;/p&gt;  &lt;p&gt;I hope they get some of these major problems worked out.&amp;#160; I doubt it, given the underlying architectural problem (namely, the remote boxes are without a hard drive and thus doomed to be brain dead).&amp;#160; But, still.&amp;#160; Hope remains.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/aWoEsd4Z88s" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/aWoEsd4Z88s/verizon-fios-disappoints-again.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>1</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2009/11/verizon-fios-disappoints-again.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-18315586.post-2501010446904385002</guid><pubDate>Tue, 27 Oct 2009 17:29:00 +0000</pubDate><atom:updated>2009-10-27T10:29:07.143-07:00</atom:updated><title>Who Is Blocking / Locking My Windows Clipboard ?</title><description>&lt;p&gt;Ever had this problem? Suddenly you realize that cut-and-paste doesn’t work.&amp;#160; You try it a couple of times to make sure you’re not being an idiot, but nope, something’s wrong.&amp;#160; You try it in several apps, and it’s just plain stopped working.&lt;/p&gt;  &lt;p&gt;Turns out there’s a reason for this, and it has lots of blah blahs.&amp;#160; Eventually you should end up &lt;a href="http://www.remkoweijnen.nl/blog/2007/10/25/rdp-clipboard-fix/" target="_blank"&gt;over here where someone was nice enough to create an unlocking utility&lt;/a&gt;.&amp;#160; I just tried it, works great.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/DuanesBrain/~4/vdMv9u0CJnA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/DuanesBrain/~3/vdMv9u0CJnA/who-is-blocking-locking-my-windows.html</link><author>noreply@blogger.com (Duane Morin)</author><thr:total>0</thr:total><feedburner:origLink>http://duanesbrain.blogspot.com/2009/10/who-is-blocking-locking-my-windows.html</feedburner:origLink></item></channel></rss>
