<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Dave Dash</title>
 <link href="http://davedash.com/atom.xml" rel="self"/>
 <link href="http://davedash.com/"/>
 <updated>2012-04-07T22:42:44-07:00</updated>
 <id>http://davedash.com/</id>
 <author>
   <name>Dave Dash</name>
   <email>dd+atom1@davedash.com</email>
 </author>

 
 <entry>
   <title>Plus Addressing</title>
   <link href="http://davedash.com/2012/04/07/plus-addressing/"/>
   <updated>2012-04-07T00:00:00-07:00</updated>
   <id>http://davedash.com/2012/04/07/plus-addressing</id>
   <content type="html">&lt;p&gt;One of my biggest pet peeves is registration forms that don't accept &quot;plus&quot;
addresses, e.g. &lt;code&gt;myname+whatever@mysite.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I've been using plus addressing for years, and before that,
&lt;a href=&quot;/2008/10/12/google-apps-in-search-of-a-worthy-email-system/&quot;&gt;&quot;minus&quot; addressing&lt;/a&gt;.  Since GMail handles my &lt;code&gt;@davedash.com&lt;/code&gt; email
addresses I am forced to use the &quot;plus&quot; style if I want to easily create
multiple addresses on a whim.&lt;/p&gt;

&lt;p&gt;I use this style of addressing to keep track of who might be spamming me
(JC Penny for example).  I might sign up with &lt;code&gt;myname+facebook@mysite.com&lt;/code&gt; for
Facebook, &lt;code&gt;myname+pinterest@mysite.com&lt;/code&gt; for Pinterest, etc.  Unfortunately this
wasn't working when I signed up for Pinterest.  My wife and a few of my friends
were quick to tell me about this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/static/images/2012/04/07/pin-screenshot.jpg&quot; alt=&quot;pinterest registration screenshot&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So when I joined Pinterest, I immediately filed a bug, and then after talking
to a few people, decided to fix it.  The fix was remarkably simple.&lt;/p&gt;

&lt;p&gt;There's usually two causes for this problem.  1. People use the wrong
validation for their emails.  Namely one that says &lt;code&gt;+&lt;/code&gt; is bad.  Luckily most
web frameworks, like Django, get this right.  2. They use the email address as
some sort of parameter in a URL.  For example:
&lt;code&gt;http://mysite.com/newsletter/unsubscribe?email=myname+whatever@mysite.com&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;The wrong validation&lt;/h2&gt;

&lt;p&gt;If you're using the wrong validation, fix it.  There's no excuse for anybody
seeing &quot;sorry please use a valid&quot; email address when their email is perfectly
valid.  Django has a &lt;a href=&quot;https://github.com/django/django/blob/master/django/core/validators.py#L88&quot;&gt;regular expression which you can use&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;The URL issue&lt;/h2&gt;

&lt;p&gt;The URL issue is an issue of URL encoding.  In our example
(&lt;code&gt;http://mysite.com/newsletter/unsubscribe?email=myname+whatever@mysite.com&lt;/code&gt;):&lt;/p&gt;

&lt;p&gt;The email variable gets decoded as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;myname whatever@mysite.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Clearly that &lt;em&gt;is&lt;/em&gt; invalid.  On a URL bar, the &lt;code&gt;+&lt;/code&gt; is interpreted as a space.
The solution is to encode your email address.  For Pinterest, this is all we
needed to do.  JavaScript has a handy &lt;code&gt;encodeURIComponent&lt;/code&gt; to change this.  If
you are using an &lt;code&gt;ajax&lt;/code&gt; call from jQuery, you can simply pass the data an
object:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{'email': 'myname whatever@mysite.com'}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will get encoded properly.&lt;/p&gt;

&lt;h2&gt;Call to Action&lt;/h2&gt;

&lt;p&gt;Plus addressing a minimal use case, but please... make sure that people aren't
hitting validation errors in your registration.  Each input on a registration
form is a reason to not register.  Each validation error, is a reason to give
up prematurely.  Do your users and your product a favor and don't invalidate
them unnecessarily.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/static/images/2012/04/07/pin-screenshot-fix.jpg&quot; alt=&quot;pinterest registration screenshot post-fix&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>An Adventure</title>
   <link href="http://davedash.com/2012/03/19/an-adventure/"/>
   <updated>2012-03-19T00:00:00-07:00</updated>
   <id>http://davedash.com/2012/03/19/an-adventure</id>
   <content type="html">&lt;p&gt;I have left the Mozilla Corporation this month.  A lot of people have asked me
why I decided to leave.  To some, a decision like that is unfathomable.
Mozilla has been my favorite place to work ever, so leaving was a difficult
choice.  I've done some things I'm proud of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I built out the add-ons search (twice).&lt;/li&gt;
&lt;li&gt;I helped rewrite our add-ons website in Django... and then all our sites.&lt;/li&gt;
&lt;li&gt;I helped us ship solid code with continuous integration.&lt;/li&gt;
&lt;li&gt;I helped grow our team with some solid people (about 20 people were brought
in or interviewed by me).&lt;/li&gt;
&lt;li&gt;I helped speed up our recruitment process.&lt;/li&gt;
&lt;li&gt;I helped smooth out &lt;a href=&quot;http://mozweb.readthedocs.org/&quot;&gt;our on-boarding process&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;I helped &lt;a href=&quot;http://blog.mozilla.com/webdev/2011/09/28/pyladies-and-djangocon-2011-2/&quot;&gt;get a few members of PyLadies to DjangoCon&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Mozilla made it very easy to do things like this.  It encourages this type of
behavior.  I've had a lot of good mentors, and a lot of great peers.&lt;/p&gt;

&lt;p&gt;I also learned quite a bit of python.  Hiring bright python engineers who are
happy to share their knowledge helps.&lt;/p&gt;

&lt;p&gt;The folks at &lt;a href=&quot;http://pinterest.com/&quot;&gt;Pinterest&lt;/a&gt; proposed an adventure for me.  One where I'll get
to learn quite a bit on the fly, but also take similar initiatives at making
engineering fun and productive.  I'll also be working on a product used by
many people, but more importantly a product that's used by quite a few of my
friends.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Yes, I like it too!</title>
   <link href="http://davedash.com/2012/03/07/yes%2C-i-like-it-too%21/"/>
   <updated>2012-03-07T00:00:00-08:00</updated>
   <id>http://davedash.com/2012/03/07/yes,-i-like-it-too!</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;http://www.asofterworld.com/clean/shades.jpg&quot; alt=&quot;When I overhear someone say, That's fucking gay...&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It's time to grow up, Mozilla.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>TechShop Offsite</title>
   <link href="http://davedash.com/2012/03/01/techshop-offsite/"/>
   <updated>2012-03-01T00:00:00-08:00</updated>
   <id>http://davedash.com/2012/03/01/techshop-offsite</id>
   <content type="html">&lt;p&gt;For the Mozilla Flux Web Development team we went to the Tech Shop and we lasered some cool stuff.&lt;/p&gt;

&lt;div&gt;
&lt;a href=&quot;http://www.flickr.com/photos/morgamic/sets/72157629121855200/with/6796875162/&quot; title=&quot;Build Your Dreams Here by morgamic, on Flickr&quot;&gt;&lt;img src=&quot;http://farm8.staticflickr.com/7209/6796875162_38de6bd2f9.jpg&quot; width=&quot;500&quot; height=&quot;331&quot; alt=&quot;Build Your Dreams Here&quot;&gt;&lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;TechShop staff was totally accommodating.  It's definitely a great place for anybody to check out, or any team to do a team building exercise.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Moving from Android to iOS</title>
   <link href="http://davedash.com/2012/02/22/moving-from-android-to-ios/"/>
   <updated>2012-02-22T00:00:00-08:00</updated>
   <id>http://davedash.com/2012/02/22/moving-from-android-to-ios</id>
   <content type="html">&lt;p&gt;I'm a cheapskate, because of this I'm stuck on Sprint which gives my wife an I
a very cheap cell phone plan.  The downside is we were stuck on Windows phones
until just over a year ago, when Sprint said we could pay a fee to use an
Android phone.  Then a few months ago, the iPhone 4 and 4S were options.&lt;/p&gt;

&lt;p&gt;So I had a top of the line Android device (Epic 4G) for almost a year until my
toddler (I suspect) waterboarded my phone.&lt;/p&gt;

&lt;p&gt;Sprint was willing to transition me to an iPhone 4S as an early upgrade.&lt;/p&gt;

&lt;p&gt;I've had my iPhone for months and it's been attached to me to a fault.
There are two things I notice:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I use it way more.&lt;/li&gt;
&lt;li&gt;I don't give up and look for my laptop as much as I did with my Epic.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;There are a few things Android has that trump iOS, but at some point might get
resolved.&lt;/p&gt;

&lt;h3&gt;Sound and Vibration&lt;/h3&gt;

&lt;p&gt;This changes with each version of Android, but I felt like I could have 3
settings: Silent; Vibrate; Noise (+ Vibrate).  iOS seems to have two, and I've
more or less gotten used to it.  The alarm in silent mode though is a bit,
scary... I could do with a vibrate-only alarm.&lt;/p&gt;

&lt;h3&gt;Gmail&lt;/h3&gt;

&lt;p&gt;I feel like Google really dropped the ball on quality with the Gmail app.
The complaints are numerous: single account only, not a lot of settings,
common iOS gestures are broken.&lt;/p&gt;

&lt;p&gt;I'll wait til a third party, like &lt;a href=&quot;http://sprw.me/comingsoon/&quot;&gt;Sparrow&lt;/a&gt;
does it right.&lt;/p&gt;

&lt;h3&gt;Google Naviagtion/Maps/Latitude&lt;/h3&gt;

&lt;p&gt;Latitude as a platform for finding people in real-time is somewhat failing
everywhere.&lt;/p&gt;

&lt;p&gt;Navigation is nonexistant.  The Maps app in iOS is Google powered, but it lacks
the functionality and niceties of the Android app.  I'm sure some third party
(if not Apple) will rush in to fill the gap.  Android navigation is great, in
many cases you can ditch your car navigation and use Android's, so long as you
can get a fix on your location.&lt;/p&gt;

&lt;h3&gt;Open in...&lt;/h3&gt;

&lt;p&gt;Android also has a great feature of letting you open certain URLs in apps as
opposed to the web browser.  So I might click on a linkto a restaurant
on &lt;a href=&quot;http://yelp.com&quot;&gt;yelp.com&lt;/a&gt;, but I'll get prompted to open it using the
Yelp app.  Android clearly has a benefit here.  Countless times I go to
websites and see an ad for their iPhone app which I've already installed.  I
just want it all to work seemlessly.&lt;/p&gt;

&lt;h3&gt;no regrets...&lt;/h3&gt;

&lt;p&gt;I have no regrets though.  These are small peaves compared to the slowness,
and lack of polish I experienced regularly on Android.  I'll probably stick
with iOS for the foreseeable future.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Our New Car</title>
   <link href="http://davedash.com/2012/02/16/our-new-car/"/>
   <updated>2012-02-16T00:00:00-08:00</updated>
   <id>http://davedash.com/2012/02/16/our-new-car</id>
   <content type="html">&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: This car is new to us as of last summer.&lt;/p&gt;

&lt;p&gt;Since moving out to California, Katie and I have hung close to our beloved 1995 Geo Prizm with 215,000 miles on it.  It's been a fantastically reliable car, but over time it's created a series of minor issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The rear right shoulder belt does not work&lt;/li&gt;
&lt;li&gt;The rear windows don't roll down easily.&lt;/li&gt;
&lt;li&gt;The trunk has a lip that makes it hard to put things inside it.&lt;/li&gt;
&lt;li&gt;The &quot;fill up the gas now&quot; light is burned out.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I had been slowly setting aside some money each month in an effort to buy a new car.  A friend of mine who works close to my office mentioned he's looking to sell his 2007 Prius with very few miles on it.  We were sold.&lt;/p&gt;

&lt;p&gt;We were originally looking at the Elantra, the Fit and other cars in that class.  A used Prius from a friend made our decision easier since it was a step up in class and It came with a ton of creature comforts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rear camera&lt;/li&gt;
&lt;li&gt;A fairly decent navigation system&lt;/li&gt;
&lt;li&gt;A decent audio system&lt;/li&gt;
&lt;li&gt;It's apparently a hybrid gas/electric vehicle&lt;/li&gt;
&lt;li&gt;It's got a lot of storage space.&lt;/li&gt;
&lt;li&gt;LATCH system for carseats (almost all cars post 2000 have this)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So we're hoping we can hang on to this car as long as we had our Prizm (9 years, but it's been in the family since new).&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Naming things and a recursion</title>
   <link href="http://davedash.com/2012/01/05/naming-things-and-a-recursion/"/>
   <updated>2012-01-05T00:00:00-08:00</updated>
   <id>http://davedash.com/2012/01/05/naming-things-and-a-recursion</id>
   <content type="html">&lt;p&gt;Most Mozilla webdev projects have an awful project structure, and it's
partially my fault.  I'm &lt;a href=&quot;https://github.com/mozilla/playdoh/pull/67&quot;&gt;attemtping to fix that&lt;/a&gt;, but I
cringe every time someone creates a new &lt;a href=&quot;http://playdoh.rtfd.org/&quot;&gt;playdoh&lt;/a&gt;
(Mozilla's Django template)
based project.&lt;/p&gt;

&lt;h3&gt;The typical python project&lt;/h3&gt;

&lt;p&gt;Your typical python project looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/my_project
    someotherstuff/
    docs/
    theactualthingicareabout/
    setup.py
    LICENSE
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;MOZtrosity&lt;/h3&gt;

&lt;p&gt;We didn't have a good guide when we first started writing Django projects, so
we opted for something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;theactualthingicareabout/
    apps/
        foo/
        bar/
    __init__.py
    urls.py
    settings.py
    LICENSE
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In otherwords, the Django Project, which is a python module, is immediately
checked out.  If you check this out to an invalid directory, e.g. you do something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone github.com/davedash/myawesomeproject.git will.not.work\!
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Bad things will happen.&lt;/p&gt;

&lt;h3&gt;So?&lt;/h3&gt;

&lt;p&gt;To some people this seems like an easy thing to work-a-round, but when it takes
three of my excellent coworkers a week to diagnose an issue, where this ended
up being the root cause...  well it becomes a higher priority issue.&lt;/p&gt;

&lt;p&gt;So here's what happened this week, when we tried to deploy
&lt;a href=&quot;https://github.com/mozilla/lumbergh/&quot;&gt;the new careers site&lt;/a&gt; to a VM hardware.&lt;/p&gt;

&lt;p&gt;Our ops team sensibly checked out the project like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone https://github.com/mozilla/lumbergh.git careers
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;They did everything right.  Sure, they were creative and chose &lt;code&gt;careers&lt;/code&gt; over
the default &lt;code&gt;lumbergh&lt;/code&gt;, but they knew the shortcomings of our system and picked
a name that would resolve as a valid python package.&lt;/p&gt;

&lt;p&gt;Unfortunately we'd hit some &lt;em&gt;recursion error&lt;/em&gt; anytime we tried to hit a URL.
So we knew there was an issue with the URL resolver, but we couldn't figure it
out.&lt;/p&gt;

&lt;p&gt;Here's what the project layout looked like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;careers/ # I could be called anything, but they chose careers
    __init__.py
    apps/
        careers/  # I'm going to cause problems,
                  # but neither devs nor ops will suspect a thing! mwahaha
            __init__.py
            models.py
            urls.py
            views.py
    settings.py
    urls.py
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;other files.&lt;/p&gt;

&lt;p&gt;We configure our &lt;code&gt;apps/&lt;/code&gt; directory to be part of our &lt;code&gt;PYTHON_PATH&lt;/code&gt; so we can
do things like &lt;code&gt;from careers import views&lt;/code&gt;... you can probably see where this
is going.&lt;/p&gt;

&lt;p&gt;Here's the main &lt;code&gt;urls.py&lt;/code&gt; &lt;a href=&quot;https://github.com/mozilla/lumbergh/blob/master/urls.py&quot;&gt;1&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;...
urlpatterns = patterns('',
    (r'', include('careers.urls')),
)
...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The main &lt;code&gt;urls.py&lt;/code&gt; includes &lt;code&gt;careers.urls&lt;/code&gt; which if you look at the above
project layout, resolves to two different python packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;careers/urls.py&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;careers/apps/careers/urls.py&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Python chose the first, and therefore &lt;code&gt;urls.py&lt;/code&gt; kept calling upon itself.&lt;/p&gt;

&lt;h3&gt;So what did we learn?&lt;/h3&gt;

&lt;p&gt;Do better.&lt;/p&gt;

&lt;p&gt;First of all, we need a better project layout. This will continue to cause
problems for even the brightest developers.&lt;/p&gt;

&lt;p&gt;Secondly, if you don't do this at least name apps carefully.
Django's app model can be a bit much for
non third party apps.  Sometimes there's one app which spans the entire
project, and it's tempting to call it the same name as the project
(e.g. &lt;code&gt;careers&lt;/code&gt;), but sometimes a lamer more generic name like &lt;code&gt;common&lt;/code&gt; is
better.&lt;/p&gt;

&lt;p&gt;But really, the second point is moot if we just clean up.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>18 months</title>
   <link href="http://davedash.com/2011/11/30/18-months/"/>
   <updated>2011-11-30T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/11/30/18-months</id>
   <content type="html">&lt;p&gt;Yesterday Siddhartha turned 18 months.  I remember last year running into an
18 month old at the airport and being amazed at how well she said &quot;bébé&quot;
(she was French) when she saw Siddhartha.  So I had an expectation that
Siddhartha would be able to speak at least a word or two by now.&lt;/p&gt;

&lt;p&gt;He does.&lt;/p&gt;

&lt;p&gt;He's shy until he gets to know you, but once he warms up he'll repeat most
words you tell him,
or if he knows the sign he'll sign them.&lt;/p&gt;

&lt;p&gt;He cried after slipping and falling the other day, and we did the
&quot;cell phone test&quot; to see if he was okay.
As he sniffled, he would read all the letters that I was drawing on the
screen.  Amazing!&lt;/p&gt;

&lt;p&gt;He talks, he walks, he climbs, he tries to help put away dishes,
and his signs are way more accurate.&lt;/p&gt;

&lt;p&gt;This is him a year ago:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://farm6.staticflickr.com/5288/5275838461_c1906a7ba9.jpg&quot; alt=&quot;6 months&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is him today:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://cl.ly/131b1h3B0Y0t3C3J3T0b/sibi.jpg&quot; alt=&quot;18 months&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Choosing a New Web Stack</title>
   <link href="http://davedash.com/2011/10/09/choosing-a-new-web-stack/"/>
   <updated>2011-10-09T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/10/09/choosing-a-new-web-stack</id>
   <content type="html">&lt;p&gt;I like building web sites, a lot.  Usually every few years I need to re-
evaluate the stack I use for a side-project.  Joshua's
&lt;a href=&quot;http://stackparts.com/&quot;&gt;Stack Parts&lt;/a&gt; site is handy for this.&lt;/p&gt;

&lt;p&gt;At Mozilla Webdev we stick to reeds + mysql + elasticsearch + celery + rabbitmq
+ memcache + git + virtualenv + python + django + jinja2 + modwsgi + commander
+ puppet + apache + less + jquery as our go-to stack.  It's tried and true and
it's been working and been evolving for two years.&lt;/p&gt;

&lt;p&gt;So I'm at re-evaluation time.  The first element of the stack I needed to
decide upon was the web framework.  I initially thought I'd use Django, and
maybe alternate a few supporting libraries just to color my experience.  But
Flask caught my attention.&lt;/p&gt;

&lt;p&gt;Flask is from Pocoo who have given me great things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lodgeit&lt;/li&gt;
&lt;li&gt;Werkzeug&lt;/li&gt;
&lt;li&gt;Jinja2&lt;/li&gt;
&lt;li&gt;Sphinx&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It was a microframework, which meant that it didn't contain as many things as
Django, but at the same time, I didn't use that much of Django.&lt;/p&gt;

&lt;p&gt;Flask was a nice way to stay mostly in my comfort-zone, and in some ways, focus
me on just writing an app, and not working in a framework.  Since it's python,
if I start to miss Django, I can probably rewrite my code without too much
effort.&lt;/p&gt;

&lt;p&gt;Overall I'm excited, and I just got past, &quot;Hello World.&quot;&lt;/p&gt;

&lt;p&gt;I'm not sure what my stack will look like, I'm imagining it will evolve into:&lt;/p&gt;

&lt;p&gt;postgresql + memcache + git + flask + jinja2 + gunicorn + fabric + puppet +
nginx + less + backbonejs + jquery&lt;/p&gt;

&lt;p&gt;This will give me a chance to learn more about things I'm interested in, and
utilize what I think might be better options along the stack.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Interviewing: How You Think</title>
   <link href="http://davedash.com/2011/08/28/interviewing%3A-how-you-think/"/>
   <updated>2011-08-28T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/08/28/interviewing:-how-you-think</id>
   <content type="html">&lt;p&gt;My friend and Web Dev colleague, James Socol, wrote a piece recently about
&lt;a href=&quot;http://coffeeonthekeyboard.com/so-you-want-me-to-hire-you-606/&quot;&gt;some hiring things&lt;/a&gt;.  I think it's a good idea, and it would certainly make
my job easier.  It reminded me that I'm putting off a few posts about hiring.&lt;/p&gt;

&lt;p&gt;I want to touch a bit on the &quot;build/implement/write an X&quot; style technical
questions.  For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement a linked list&lt;/li&gt;
&lt;li&gt;Write a url parser&lt;/li&gt;
&lt;li&gt;Make an image resizer in Javascript&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Often we get candidates who are exceptionally smart on paper, have great Github
accounts, but fall flat on the in person implementation.&lt;/p&gt;

&lt;p&gt;For some people this is &lt;em&gt;hard&lt;/em&gt;.  So let's get over the &lt;em&gt;nerves&lt;/em&gt;.  I'm not
going to tell you &lt;strong&gt;it's silly to be nervous&lt;/strong&gt; or that
&lt;strong&gt;I'm as nervous as you&lt;/strong&gt; (I'm not), or
anything that you already know.  I will tell you this. If you notice yourself
not thinking as sharply as you normally do, &lt;strong&gt;count backwards from 10&lt;/strong&gt;.
Then carry on.  Repeat if
necessary.  Usually our interviews are 45 minutes long.  10 seconds of you
counting backwards isn't going to kill us for time.&lt;/p&gt;

&lt;p&gt;Hopefully this will calm you.  If this doesn't... well it was worth a shot.&lt;/p&gt;

&lt;p&gt;So let's get down to &lt;a href=&quot;http://en.wiktionary.org/wiki/brass_tacks?rdfrom=Brass_tacks&quot;&gt;brass tacks&lt;/a&gt;.  I want to know how you implement
things.  I want to know &lt;em&gt;how you think&lt;/em&gt;.  I don't care as much about the
answer, but the correct answer is comforting.&lt;/p&gt;

&lt;p&gt;If I tell you &quot;implement an image resizer in Javascript&quot; and you start diving
into JavaScript code and get flustered, I can't really help you.
If you can do that
without getting flustered and produce something that works, I'll be impressed,
but somewhat alarmed.&lt;/p&gt;

&lt;p&gt;What I really want is you to &lt;strong&gt;step back from the problem&lt;/strong&gt;.
I want you to show me what the resizer will look like and how it will behave.
You don't need to go into too many details, but &lt;em&gt;enough details so I know you
understand the problem&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;If the problem is easily testable (like writing a url parser),
it wouldn't hurt to have some tests to start.&lt;/p&gt;

&lt;p&gt;Then I want you to write the code backwards from high level to low level.
Write the HTML, write the initialization code, and finally write the event
handlers.&lt;/p&gt;

&lt;p&gt;This is not only easier to follow in an interview,
it's basic problems solving,
because you end up breaking the problem into smaller chunks.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>DjangoCon Testing Tutorial</title>
   <link href="http://davedash.com/2011/08/10/djangocon-testing-tutorial/"/>
   <updated>2011-08-10T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/08/10/djangocon-testing-tutorial</id>
   <content type="html">&lt;div class=&quot;side&quot;&gt;
   &lt;img src=&quot;/static/images/2011/08/10/djangocon.png&quot;
        width=&quot;287&quot; height=&quot;184&quot;
        alt=&quot;DjangoCon 2011&quot; /&gt;
&lt;/div&gt;


&lt;p&gt;If you want to learn all you can about testing anything in your Django App, see
&lt;a href=&quot;http://djangocon.us/schedule/presentations/30/&quot;&gt;my tutorial&lt;/a&gt; at &lt;a href=&quot;http://djangocon.us/&quot;&gt;DjangoCon&lt;/a&gt;.
It's on September 5th, it'll be 3 hours
long and so far with seven sign ups it will be very hands-on.&lt;/p&gt;

&lt;p&gt;Here's what I think I will cover, but I may change this depending on what the
audience wants:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Testing issues

&lt;ul&gt;
&lt;li&gt;ask people to fill out etherpad with issues they've run into&lt;/li&gt;
&lt;li&gt;ask someone to rank them in order of complexity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;List an outline of topics

&lt;ul&gt;
&lt;li&gt;post them on etherpad&lt;/li&gt;
&lt;li&gt;have people + them if they are interested&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Testing overview

&lt;ul&gt;
&lt;li&gt;We started in late 2009 early 2010&lt;/li&gt;
&lt;li&gt;Our largest project has 2500 tests&lt;/li&gt;
&lt;li&gt;Our next largest has 1100&lt;/li&gt;
&lt;li&gt;We have pretty good coverage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;How testing works    in Django

&lt;ul&gt;
&lt;li&gt;I'm not 100% sure on this&lt;/li&gt;
&lt;li&gt;Test runner setups up a new database&lt;/li&gt;
&lt;li&gt;Test runner finds and runs tests&lt;/li&gt;
&lt;li&gt;Tests run class setup&lt;/li&gt;
&lt;li&gt;Test runs each test in a test case

&lt;ul&gt;
&lt;li&gt;Load fixtures&lt;/li&gt;
&lt;li&gt;Tests run setup&lt;/li&gt;
&lt;li&gt;Tests runs the test&lt;/li&gt;
&lt;li&gt;Tests runs teardown&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Tests run class Teardown&lt;/li&gt;
&lt;li&gt;You get an F if you're bad and a . if your not.&lt;/li&gt;
&lt;li&gt;Now that you know it, you can hack it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;How we've hacked testing

&lt;ul&gt;
&lt;li&gt;2500 tests is a lot&lt;/li&gt;
&lt;li&gt;We no longer recreate the database when you run the test suite&lt;/li&gt;
&lt;li&gt;In each test case we just load the fixtures once.&lt;/li&gt;
&lt;li&gt;We rearrange the tests so things with the same fixture set run together&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Testing tools that we use at Mozilla

&lt;ul&gt;
&lt;li&gt;nose/django_nose&lt;/li&gt;
&lt;li&gt;nose plugins

&lt;ul&gt;
&lt;li&gt;nicedots&lt;/li&gt;
&lt;li&gt;progressive&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;coverage

&lt;ul&gt;
&lt;li&gt;git + whatchangedpy&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Testing everything, no excuses

&lt;ul&gt;
&lt;li&gt;100% Coverage isn't important&lt;/li&gt;
&lt;li&gt;80% is nice&lt;/li&gt;
&lt;li&gt;Good coverage on tricky things is important&lt;/li&gt;
&lt;li&gt;Some coverage on everything is important&lt;/li&gt;
&lt;li&gt;External&lt;/li&gt;
&lt;li&gt;If you start depending on APIs, Search or different tools you need to be able to test for them.&lt;/li&gt;
&lt;li&gt;Writing these test cases will take less time than this tutorial&lt;/li&gt;
&lt;li&gt;It will save you so much headache in the future.&lt;/li&gt;
&lt;li&gt;The same headaches you save yourself by writing &quot;normal&quot; tests&lt;/li&gt;
&lt;li&gt;Mock easy things

&lt;ul&gt;
&lt;li&gt;use a decorator on any test/view that might use redis&lt;/li&gt;
&lt;li&gt;if redis isn't setup, use the mock client&lt;/li&gt;
&lt;li&gt;mock client doesn't support everything,

&lt;ul&gt;
&lt;li&gt;just what I need to get my tests running -&lt;/li&gt;
&lt;li&gt;feel free to extend it if you use it&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Testing Redis&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Setup/Teardown for complicated tools

&lt;ul&gt;
&lt;li&gt;Good for search and APIs&lt;/li&gt;
&lt;li&gt;Raise SkipTest (nose) if the developer doesn't want to run these tests&lt;/li&gt;
&lt;li&gt;Non realtime tools

&lt;ul&gt;
&lt;li&gt;Testing Sphinx search&lt;/li&gt;
&lt;li&gt;SetupClass

&lt;ul&gt;
&lt;li&gt;load fixtures&lt;/li&gt;
&lt;li&gt;run indexer&lt;/li&gt;
&lt;li&gt;run server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Sphinx server now available for all tests in your test case&lt;/li&gt;
&lt;li&gt;Teardown

&lt;ul&gt;
&lt;li&gt;stop server&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Real time tools

&lt;ul&gt;
&lt;li&gt;Nicer, data can be added in post_save signals or elsewhere in your app&lt;/li&gt;
&lt;li&gt;Testing LDAP

&lt;ul&gt;
&lt;li&gt;Setup

&lt;ul&gt;
&lt;li&gt;Remove LDAP files&lt;/li&gt;
&lt;li&gt;Load an ldif&lt;/li&gt;
&lt;li&gt;Start slapd&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Your code can now touch LDAP&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Testing ElasticSearch

&lt;ul&gt;
&lt;li&gt;We leave ES running all the time.&lt;/li&gt;
&lt;li&gt;Setup

&lt;ul&gt;
&lt;li&gt;Checks for ES support or SkipTest&lt;/li&gt;
&lt;li&gt;Deletes index&lt;/li&gt;
&lt;li&gt;Creates index&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;You can now read/write to ES&lt;/li&gt;
&lt;li&gt;Teardown

&lt;ul&gt;
&lt;li&gt;Delete's index&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Fixtures

&lt;ul&gt;
&lt;li&gt;Fixture Magic&lt;/li&gt;
&lt;li&gt;Model Maker&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;pitfalls

&lt;ul&gt;
&lt;li&gt;dates&lt;/li&gt;
&lt;li&gt;using PDB&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Groupon is poor value</title>
   <link href="http://davedash.com/2011/07/09/groupon-is-poor-value/"/>
   <updated>2011-07-09T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/07/09/groupon-is-poor-value</id>
   <content type="html">&lt;p&gt;I bought a $30 coupon to Hobee's for $15.  I spent $67 with friends.  However,
since we ordered 2 $9 mimosas at half off, we couldn't use the Groupon.  Rather
than Hobee's accepting the fact that I spent well over $30, they charged me the
full price for the Mimosas, making my net savings at Hobee's $6.  That's less
than 10% of my total bill.&lt;/p&gt;

&lt;p&gt;This isn't the first time this has happened to me.  Tandori Oven of San José
and even my beloved the Mmoon have weaseled out of Groupon's or similar by
negating anything that remotely seems like a deal at their stores.&lt;/p&gt;

&lt;p&gt;I feel like a bunch of restaurant owners bought into the &quot;Groupon&quot; marketing
concept and saw their (I imagine) already slim margins, get even slimmer - so
they are making Groupons unusable.&lt;/p&gt;

&lt;p&gt;Here's the math, as I've understood it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You buy a coupon: $10 for $20 of an item.&lt;/li&gt;
&lt;li&gt;Groupon gets $5, the store gets $5.&lt;/li&gt;
&lt;li&gt;The store is effectively discounting something by up to 75%.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;What these stores fail to understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I'm discounting my meal by a non-trivial amount.&lt;/li&gt;
&lt;li&gt;In return I buy more than I need to.&lt;/li&gt;
&lt;li&gt;I also tip their employees a bit more.&lt;/li&gt;
&lt;li&gt;I will stop going to their store if they attempt to nickel and dime me.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So I'm going to hold off on Groupons unless I go somewhere where I always pay
the same price and they have no &quot;specials&quot; or &quot;deals&quot; that I might get side
tracked with.  The process is a horrible user-experience, for moderate savings.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Siddhartha: The One Year Old</title>
   <link href="http://davedash.com/2011/05/29/siddhartha-one-years-old/"/>
   <updated>2011-05-29T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/05/29/siddhartha-one-years-old</id>
   <content type="html">&lt;p&gt;This first year of parenting started roughly and going into year two still has
its challenges but the ride has become enjoyable.&lt;/p&gt;

&lt;div class=&quot;side&quot;&gt;
&lt;a href=&quot;http://www.flickr.com/photos/ketiya/sets/72157626722598543/&quot;
   title=&quot;Studying his new book&quot;&gt;
   &lt;img src=&quot;http://farm3.static.flickr.com/2311/5778978503_3bc2882968_m.jpg&quot;
        width=&quot;240&quot; height=&quot;161&quot;
        alt=&quot;Siddhartha studying his new book&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;He's heavier, taller, easier to deal with, can take food from multiple sources,
mobile.  Overall, he's a lot of fun.  I enjoy my time with him whenever I can,
and we even get to do &quot;guy stuff&quot; like grocery shopping
and running errands.&lt;/p&gt;

&lt;p&gt;He brings us and others a lot of joy and I'm sure he will continue to do so.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Better querying for ElasticSearch</title>
   <link href="http://davedash.com/2011/05/17/better-querying-for-elasticsearch/"/>
   <updated>2011-05-17T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/05/17/better-querying-for-elasticsearch</id>
   <content type="html">&lt;p&gt;I wrote &lt;a href=&quot;/2011/03/25/filter-queries-using-pyes/&quot;&gt;about how to write filter queries using &lt;code&gt;pyes&lt;/code&gt;&lt;/a&gt;.
Unfortunately after using ElasticSearch in &lt;a href=&quot;http://builder.addons.mozilla.org&quot;&gt;the Add-ons Builder&lt;/a&gt;, I realized
that our code would become unwieldy and hard to read if we kept using straight
up &lt;code&gt;pyes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I prefer to write APIs so that are natural and conform to how I think, not one
that simply mirrors another system.&lt;/p&gt;

&lt;p&gt;So rather than this:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;    &lt;span class=&quot;n&quot;&gt;filters&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;platform&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;all&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;product&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;firefox&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;version&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;4.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;filter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ANDFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FilteredQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MatchAllQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_term_facet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;I made &lt;a href=&quot;https://github.com/davedash/elasticutils/&quot;&gt;something simpler&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;    &lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;elasticutils&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;S&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;S&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;all&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;product&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;firefox&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;4.0&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
               &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Here were the design thoughts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I wanted something easy to remember, &lt;code&gt;S&lt;/code&gt; for search.&lt;/li&gt;
&lt;li&gt;I wanted smart defaults, by default &lt;code&gt;S()&lt;/code&gt; matches all documents, unless you
give it a query term.&lt;/li&gt;
&lt;li&gt;I didn't want to write python that looked like Java, or JSON or even a
&lt;code&gt;dict&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I wanted to write something that felt like the Django-ORM&lt;/li&gt;
&lt;li&gt;Ultimately I want code that I enjoy writing.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;So here it is, I expect it to power Firefox Add-ons, the Add-ons Builder and
Firefox Input shortly.&lt;/p&gt;

&lt;p&gt;This is all part of &lt;a href=&quot;https://github.com/davedash/elasticutils/&quot;&gt;ElasticUtils&lt;/a&gt;.
Let me know if you are using it, and pull requests are welcome!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>DeliciousTube</title>
   <link href="http://davedash.com/2011/04/27/delicioustube/"/>
   <updated>2011-04-27T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/04/27/delicioustube</id>
   <content type="html">&lt;p&gt;What do I think about 2 of the YouTube founders buying Delicious?&lt;/p&gt;

&lt;p&gt;Everyone who used Delicious (including those of us who worked on Delicious) and
was aware that Yahoo! purchased Delicious thought at some point, &quot;Well if &lt;em&gt;I&lt;/em&gt;
ran Delicious, I'd do &lt;em&gt;X&lt;/em&gt;.&quot;  Where &lt;em&gt;X&lt;/em&gt; is more than getting a hamster to run in
a wheel.  Chad Hurley and Steve Chen actually put their money where there
mouths are.&lt;/p&gt;

&lt;p&gt;I'm glad Delicious is getting a new lease on life.  The problems it solves
still exist on the web, and I'm hopeful that it will flourish.&lt;/p&gt;

&lt;p&gt;Also, I'd like to publicly apologize for not implementing the following things
while I worked on Delicious:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeping archive copies of the web sites.&lt;/li&gt;
&lt;li&gt;Finding which links are dead or need redirecting.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In hindsight, all the things I did work on were not nearly as important.  I
built the product I was told to, not the product I wanted.  Oops.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Filter Queries using pyes</title>
   <link href="http://davedash.com/2011/03/25/filter-queries-using-pyes/"/>
   <updated>2011-03-25T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/03/25/filter-queries-using-pyes</id>
   <content type="html">&lt;p&gt;I've been having a tough time navigating the Elastic Search docs, but some
sleuthing in the test suite for &lt;code&gt;pyes&lt;/code&gt; has proved helpful.&lt;/p&gt;

&lt;p&gt;If I have documents that I'd like filtered by let's say &lt;code&gt;product&lt;/code&gt;, &lt;code&gt;version&lt;/code&gt;
and &lt;code&gt;platform&lt;/code&gt;, I can construct a query like so:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;    &lt;span class=&quot;n&quot;&gt;filters&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;platform&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;all&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;product&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;firefox&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;version&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;4.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;filter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ANDFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FilteredQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MatchAllQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;There is perhaps a more succinct way of doing this, but this serves my
purposes.&lt;/p&gt;

&lt;p&gt;Let's say you need facets as well:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;    &lt;span class=&quot;n&quot;&gt;filters&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;platform&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;all&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;product&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;firefox&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
               &lt;span class=&quot;n&quot;&gt;TermFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;version&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;4.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;filter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ANDFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FilteredQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MatchAllQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_term_facet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>How we slug at Mozilla</title>
   <link href="http://davedash.com/2011/03/24/how-we-slug-at-mozilla/"/>
   <updated>2011-03-24T00:00:00-07:00</updated>
   <id>http://davedash.com/2011/03/24/how-we-slug-at-mozilla</id>
   <content type="html">&lt;p&gt;One problem we find with slug generators, is they do an awful job with unicode.
For a string like this: &lt;code&gt;Bän...g (bang)&lt;/code&gt; you get something like
&lt;code&gt;bng---g--bang-&lt;/code&gt; or at best &lt;code&gt;bang-bang&lt;/code&gt;.  But it's 2011, urls can have
unicode... here's what we really want: &lt;code&gt;bäng-bang&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In some cases transliteration might be acceptable.  But if we look at Django's
approach it fails at Russian.  Here's a comparison with ours for the Russian
phrase &quot;Быстрее и лучше!&quot; (&quot;Faster and better!&quot;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; from django.template.defaultfilters import slugify as djslugify
&amp;gt;&amp;gt;&amp;gt; from slugify import slugify
&amp;gt;&amp;gt;&amp;gt; str = u'Быстрее и лучше!'
&amp;gt;&amp;gt;&amp;gt; print djslugify(str)

&amp;gt;&amp;gt;&amp;gt; print slugify(str)
быстрее-и-лучше
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So as you can see, the built-in Django &lt;code&gt;slugify&lt;/code&gt; could be disastrous.  So take
a look at &lt;a href=&quot;https://github.com/mozilla/unicode-slugify&quot;&gt;ours&lt;/a&gt;.  If you have some more test cases, please fork it.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Data Anonymous</title>
   <link href="http://davedash.com/2011/03/02/data-anonymous/"/>
   <updated>2011-03-02T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/03/02/data-anonymous</id>
   <content type="html">&lt;p&gt;I wrote a simple database &lt;a href=&quot;https://github.com/davedash/mysql-anonymous&quot;&gt;scrubber script&lt;/a&gt;.  It takes a &lt;code&gt;yaml&lt;/code&gt; file that
describes what scrubbing needs doing and then outputs &lt;code&gt;sql&lt;/code&gt; that you can send
to &lt;code&gt;mysql&lt;/code&gt;.  It's dreadfully simple and I'd like to see if others can make use
of it.&lt;/p&gt;

&lt;p&gt;At Mozilla we have a lot of contributors and would like them to have access to
realistic data since many of our bugs are based on certain states within the
data.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Siddhartha: More time out than in</title>
   <link href="http://davedash.com/2011/03/01/siddhartha%3A-more-time-out-than-in/"/>
   <updated>2011-03-01T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/03/01/siddhartha:-more-time-out-than-in</id>
   <content type="html">&lt;p&gt;It's hard to believe that Sidd's spent more time out of the womb than in.
We've also lived in our home longer with the baby than without.  Time is
clearly flying.&lt;/p&gt;

&lt;p&gt;So here's what's new:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;He crawls really well.&lt;/li&gt;
&lt;li&gt;He pulls up on everything especially people.&lt;/li&gt;
&lt;li&gt;He babbles a lot - a few mornings he'll repeat the word &quot;Hi&quot; to me.&lt;/li&gt;
&lt;li&gt;Teething seems to be worse with each tooth.&lt;/li&gt;
&lt;li&gt;He has two bottom teeth, two top teeth and likes to use them (ouch!).&lt;/li&gt;
&lt;li&gt;He still has dairy sensitivity, but eggs are okay.&lt;/li&gt;
&lt;li&gt;He's great at solids... sometimes too great

&lt;ul&gt;
&lt;li&gt;We're just sticking to once maybe twice a day.&lt;/li&gt;
&lt;li&gt;He really likes broccoli, peas and blueberries, but we expect this to
continually change.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Sometimes he doesn't poop for a while.&lt;/li&gt;
&lt;li&gt;His poop has become more adult like (read smelly, but solid).&lt;/li&gt;
&lt;li&gt;His pee smells.&lt;/li&gt;
&lt;li&gt;Sleep

&lt;ul&gt;
&lt;li&gt;Naps are transitioning from 2/3 a day to 1/2 and it's tough - like
teething.  I've been able to get him to nap with not too much fuss
(normally Katie gets him to nap).&lt;/li&gt;
&lt;li&gt;Sleep has good days and bad days.  In the end, I'm glad we're still
co-sleeping.  He lunges for daddy when mommy is holding him and vice
versa... sometimes over and over again.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;These last three months have breezed on by.  I think the next three months will
be just as fantastic.&lt;/p&gt;

&lt;iframe title=&quot;YouTube video player&quot; width=&quot;560&quot; height=&quot;349&quot;
        src=&quot;https://www.youtube.com/embed/G4aMOOMoWdw?rel=0&amp;amp;hd=1&quot;
        frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;



</content>
 </entry>
 
 <entry>
   <title>Bulk load ElasticSearch using pyes</title>
   <link href="http://davedash.com/2011/02/25/bulk-load-elasticsearch-using-pyes/"/>
   <updated>2011-02-25T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/02/25/bulk-load-elasticsearch-using-pyes</id>
   <content type="html">&lt;p&gt;When indexing a lot of data, you can save time by bulk loading data.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;pyes&lt;/code&gt; you can do the following:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pyes&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ES&lt;/span&gt;


&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;This will make 4 independent network calls.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pyes&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ES&lt;/span&gt;


&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bulk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bulk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bulk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-index&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;my-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bulk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;es&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Will do this in one call.  This is handy for those &quot;reindex all the items we
can&quot; weekends.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Installing ElasticSearch plugins</title>
   <link href="http://davedash.com/2011/02/24/installing-elasticsearch-plugins/"/>
   <updated>2011-02-24T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/02/24/installing-elasticsearch-plugins</id>
   <content type="html">&lt;p&gt;I'm slowly trying to familiarize myself with ElasticSearch and the &lt;code&gt;pyes&lt;/code&gt;
python interface.  ElasticSearch uses a lot of plugins, and while the plugin
system is easy to use, it's not obvious where to find the plugins.&lt;/p&gt;

&lt;p&gt;They are &lt;a href=&quot;http://elasticsearch.googlecode.com/svn/plugins/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to install the attachments plugin, you can do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bin/plugin install mapper-attachments
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And voilà it's installed.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>What I should have done...</title>
   <link href="http://davedash.com/2011/02/22/what-i-should-have-done.../"/>
   <updated>2011-02-22T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/02/22/what-i-should-have-done...</id>
   <content type="html">&lt;p&gt;From &lt;a href=&quot;http://www.edd.ca.gov/disability/Paid_Family_Leave.htm&quot;&gt;EDD&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;For &lt;strong&gt;California workers&lt;/strong&gt; covered by State Disability Insurance, Paid Family
Leave (PFL) insurance provides up to &lt;strong&gt;six weeks of benefits&lt;/strong&gt; for
individuals who must take time off to care for a seriously ill child, spouse,
parent, or registered domestic partner, or to &lt;strong&gt;bond with a new child&lt;/strong&gt;.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I learned about this as I did my taxes this year.  Had I done my 2009 taxes by
myself I may have learned of this, and taken advantage of this.  If/when we
have a second child I plan on taking advantage of this.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Interviews with Fibonacci</title>
   <link href="http://davedash.com/2011/01/28/interviews-with-fibonacci/"/>
   <updated>2011-01-28T00:00:00-08:00</updated>
   <id>http://davedash.com/2011/01/28/interviews-with-fibonacci</id>
   <content type="html">&lt;p&gt;I have the privilege of interviewing many of the people who wish to be web
developers at Mozilla.  I unfortunately witness
&lt;a href=&quot;http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html&quot;&gt;programmers not being able to program&lt;/a&gt;.  My interviews are 45 minutes
long.  I tend to ask people about their history, experiences and about what
they know.  Then I give them some time to write some code.&lt;/p&gt;

&lt;h3&gt;My Question&lt;/h3&gt;

&lt;p&gt;I use questions relating to the Fibonacci sequence.  E.g.:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Print &lt;code&gt;n&lt;/code&gt; numbers of the Fibonacci sequence&lt;/li&gt;
&lt;li&gt;Give me a &lt;code&gt;list&lt;/code&gt; (if the person knows python) of &lt;code&gt;n&lt;/code&gt; numbers of the Fibonacci
sequence.&lt;/li&gt;
&lt;li&gt;In rare cases, Print the &lt;code&gt;n&lt;/code&gt;th numbers of Fibonacci.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In some cases I dumb it down... a lot:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Give me &lt;code&gt;n&lt;/code&gt; integers.  In other words &lt;code&gt;f(5) = [1 1 1 1 1]&lt;/code&gt;.  I just want to
know if you can write a &lt;code&gt;for&lt;/code&gt;-loop.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Here's the sequence:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;1 1 2 3 5 8 13 21 34 ..  k[n-2] k[n-1] k[n]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;strong&gt;first two numbers are &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;&lt;/strong&gt;.  Each successive number is the
&lt;strong&gt;addition of the two proceeding numbers&lt;/strong&gt;.  In other words:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;k[n] = k[n-2] +k[n-1]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I don't care too much about efficiency.  I often don't care if it works, if
they're trying.&lt;/p&gt;

&lt;h3&gt;This is a low bar&lt;/h3&gt;

&lt;p&gt;A good &lt;strong&gt;number of people solve this with no issues&lt;/strong&gt;.  They calculate the
sequence and print out the numbers, or store them in a &lt;code&gt;list&lt;/code&gt;.  I run the code,
we optimize it slightly, we move on.&lt;/p&gt;

&lt;p&gt;Unfortunately, &lt;strong&gt;I expect &lt;em&gt;everyone&lt;/em&gt; I interview to easily solve this&lt;/strong&gt;.  Quite
honestly, &lt;strong&gt;if they can't solve this they should not have even made it past the
phone screen&lt;/strong&gt;.  It's harsh and the only exception is pressure.&lt;/p&gt;

&lt;h3&gt;Pressure&lt;/h3&gt;

&lt;p&gt;Interview pressures is a real thing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Interviewees at Mozilla are generally excited by the prospect.&lt;/li&gt;
&lt;li&gt;People want to appear intelligent to their peers.&lt;/li&gt;
&lt;li&gt;They had too much coffee at their hotel.  There's a lot to think about,
&lt;strong&gt;it's not a natural environment&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I try to solve this by using a comfortable room with couches.  I also refrain
from yelling at the candidates like a Tiger Mom.  Being nervous, however, is
difficult.&lt;/p&gt;

&lt;p&gt;This problem gives a lot of people coders-block.&lt;/p&gt;

&lt;p&gt;My advice to anyone doing technical interviews:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;Practice.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Have your friends, family, fiance, whomever ask you programming questions.  You
can compile a huge list, and just have them pick one at random.  Make the
process seem natural.&lt;/p&gt;

&lt;h3&gt;Excitement&lt;/h3&gt;

&lt;p&gt;The best &lt;strong&gt;people who solve these problems&lt;/strong&gt; are the ones who
&lt;strong&gt;think problems are exciting&lt;/strong&gt;.  They enjoy challenge.  They are also find the
interview exciting, they are &lt;strong&gt;entering in with a good attitude&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;not about intelligence&lt;/strong&gt;.  Intelligence is rarely a factor.  It's about
effort, and effort is easy to exert if you find something exciting.&lt;/p&gt;

&lt;p&gt;If they are excited to ace a simple interview question, I can usually rely on
them to do their jobs, and in many cases turn to them to come up with solutions
to problems I might be running into.&lt;/p&gt;

&lt;p&gt;The excited interviewer asks about what the solutions should entail, and the
rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are we starting at zero or one?&lt;/li&gt;
&lt;li&gt;Do you want a &lt;code&gt;list&lt;/code&gt;, or a generator?&lt;/li&gt;
&lt;li&gt;Do you want to print this out?&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;They eagerly churn out code.  They check it with some basic tests.  They let me
know it works with confidence.  Occasionally they stumble and sometimes come
out with the wrong answer, but with some assistance they could usually figure
it out.  I can use their failures as a segue to talk about testing and quality
assurance.&lt;/p&gt;

&lt;h3&gt;How do you think?&lt;/h3&gt;

&lt;p&gt;I don't ask this problem, because I'm dying to know the 12th number of the
fibonacci sequence.  I already know that's 144.  I want to know how people
solve problems.  How do they take a set of requirements and implement them.&lt;/p&gt;

&lt;p&gt;Our jobs as software developers are to take requirements or problems, find a
suitable solution and write code to solve it.&lt;/p&gt;

&lt;p&gt;This is my approach.  I know the first number is 1 and the next number is 1,
therefore I can store those and get the third number by adding them.  I shift
the variables around in a for loop and I can get this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cur = next = 1
for 1..n:
    print cur
    last = cur
    cur = next
    next += last
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's just pseudo-code.  I'm not a math and/or computer science genius.  I
can, however, take requirements and imagine how I would solve them if I had to
do it by hand, and then transcribe that process.&lt;/p&gt;

&lt;p&gt;Likewise if someone tells me, we need to know the average rating that people
gave Firefox in the area of start-up time each day, I can figure out that
problem and then implement it using software.&lt;/p&gt;

&lt;p&gt;So now I have to preface my interviews with, &quot;If you read my post about the
Fibonacci sequence, let me know.&quot;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Testing Redis in Django</title>
   <link href="http://davedash.com/2010/12/07/testing-redis-in-django/"/>
   <updated>2010-12-07T00:00:00-08:00</updated>
   <id>http://davedash.com/2010/12/07/testing-redis-in-django</id>
   <content type="html">&lt;p&gt;For the &lt;a href=&quot;http://addons.mozilla.org/en-US/firefox/&quot;&gt;Firefox Add-ons&lt;/a&gt; we've been using &lt;a href=&quot;http://code.google.com/p/redis/&quot;&gt;redis&lt;/a&gt; here and there mostly
for cache, but lately for a few things we'd love to persist.&lt;/p&gt;

&lt;p&gt;Unfortunately relying on redis does mean we need to be able to test it.  Since
redis touches some of our core components of the site, we can't just raise a
&lt;code&gt;SkipTest&lt;/code&gt; like we would for Sphinx search related tests.  I also don't want to
rely on our developers to have redis installed in order to run the
test-suite.&lt;/p&gt;

&lt;p&gt;So I built a simple &lt;a href=&quot;https://github.com/mozilla/nuggets/blob/master/redisutils.py#L47&quot;&gt;Mock Redis client&lt;/a&gt;.  It's part of our
&lt;code&gt;redisutils.py&lt;/code&gt; that handles connections to redis.  If a test's &lt;code&gt;setUp&lt;/code&gt; method
calls &lt;code&gt;mock_redis&lt;/code&gt; you'll get this phony object that can do a few minimal
redis-like operations.&lt;/p&gt;

&lt;p&gt;It works great for our specific cases, but feel free to fork it and make it
better.&lt;/p&gt;

&lt;p&gt;Note: This &lt;code&gt;MockRedis&lt;/code&gt; is specifically designed to work with &lt;a href=&quot;http://www.djangoproject.com/&quot;&gt;django&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Siddhartha: The Sixth Month</title>
   <link href="http://davedash.com/2010/11/29/siddhartha%3A-the-sixth-month/"/>
   <updated>2010-11-29T00:00:00-08:00</updated>
   <id>http://davedash.com/2010/11/29/siddhartha:-the-sixth-month</id>
   <content type="html">&lt;p&gt;Siddhartha: The sixth month&lt;/p&gt;

&lt;p&gt;Six months ago, we were playing the waiting game.  Katie woke up in a hospital
bed and was undergoing pregnancy induction, and I woke up in an uncomfortable
nook -- not realizing that long restful nights of sleep were gone.  Today, I
woke up on a couch with a six month old sleeping on my belly.&lt;/p&gt;

&lt;p&gt;This month was much like &lt;a href=&quot;/2010/10/30/siddhartha%3A-the-fifth-month/&quot;&gt;last month&lt;/a&gt;, he just got better at everything.
His rolling is now a nuisance on the changing table.  His crawling is still
army like and now he gets into stuff or terrorizes the cat.  He bounces up on
all fours.  He can also sit up without support which means we can put him in a
high chair or in a shopping cart.  And that tooth that's been threatening to
emerge since 2.5 months?  It's broken ground.&lt;/p&gt;

&lt;p&gt;We did give him an avocado for Thanksigiving and we tried once more on
Saturday, but he (and it may be sheer coincidence) got some redness on his
face, excessive spit-up and sneezing, so we're going to try a new vegetable
later this week.&lt;/p&gt;

&lt;p&gt;Here is my son vs a robot:&lt;/p&gt;

&lt;div&gt;
&lt;object width=&quot;560&quot; height=&quot;340&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube-nocookie.com/v/pgfK7isMo5w?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;hd=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube-nocookie.com/v/pgfK7isMo5w?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;hd=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;560&quot; height=&quot;340&quot;&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Pythonic string formatting in Javascript</title>
   <link href="http://davedash.com/2010/11/19/pythonic-string-formatting-in-javascript/"/>
   <updated>2010-11-19T00:00:00-08:00</updated>
   <id>http://davedash.com/2010/11/19/pythonic-string-formatting-in-javascript</id>
   <content type="html">&lt;p&gt;We do a lot of string manipulation on the &lt;a href=&quot;https://addons.mozilla.org/&quot;&gt;Firefox Addons&lt;/a&gt; site.  A lot of
it has to do with localization so one thing that comes up is being able to
format strings.  Here's a little snippet to give yourself python like string
formatting:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;    &lt;span class=&quot;cm&quot;&gt;/* Python(ish) string formatting:&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;     * &amp;gt;&amp;gt;&amp;gt; format(&amp;#39;{0}&amp;#39;, [&amp;#39;zzz&amp;#39;])&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;     * &amp;quot;zzz&amp;quot;&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;     * &amp;gt;&amp;gt;&amp;gt; format(&amp;#39;{x}&amp;#39;, {x: 1})&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;     * &amp;quot;1&amp;quot;&lt;/span&gt;
&lt;span class=&quot;cm&quot;&gt;     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;re&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/\{([^}]+)\}/g&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>My Refrigerator's Sabbath Mode</title>
   <link href="http://davedash.com/2010/11/10/my-refrigerator%27s-sabbath-mode/"/>
   <updated>2010-11-10T00:00:00-08:00</updated>
   <id>http://davedash.com/2010/11/10/my-refrigerator's-sabbath-mode</id>
   <content type="html">&lt;p&gt;From my refrigerator's manual:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;The Sabbath mode feature turns off all lights, disables the water and ice
dispenser, disables all alarms and tones, disables the automatic defrost
feature and disables the control panel.&lt;/p&gt;&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>Using git to borrow from the future</title>
   <link href="http://davedash.com/2010/11/09/using-git-to-borrow-from-the-future/"/>
   <updated>2010-11-09T00:00:00-08:00</updated>
   <id>http://davedash.com/2010/11/09/using-git-to-borrow-from-the-future</id>
   <content type="html">&lt;p&gt;One of the great features of &lt;code&gt;git&lt;/code&gt; is the ability to re-order commits, break
commits into parts, and merge commits together.&lt;/p&gt;

&lt;p&gt;Assuming that my &lt;code&gt;master&lt;/code&gt; branch is a pristine copy of the site and an ancestor
of &lt;code&gt;mybranch&lt;/code&gt; we can re-order commits by running:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git rebase -i master&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will take all the commits in your current branch (&lt;code&gt;mybranch&lt;/code&gt;) that are
built upon &lt;code&gt;master&lt;/code&gt; and allow you to reorder or edit them individually,
remove them or squash them.&lt;/p&gt;

&lt;p&gt;For example you might get:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pick 123abcd New feature supreme
pick 123abce Whitepsace fixes
pick 2222222 Rename functions.
pick 123abcf rebase me
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The last commit listed is the latest commit and is where &lt;code&gt;mybranch&lt;/code&gt;'s &lt;code&gt;HEAD&lt;/code&gt;
points to.&lt;/p&gt;

&lt;p&gt;You can edit this like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pick 123abce Whitepsace fixes
pick 2222222 Rename functions.
pick 123abcd New feature supreme
f 123abcf rebase me
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will re-order history so the first three items happen and the &quot;rebase me&quot;
commit just gets rolled into the &quot;New feature supreme&quot;.  Note since this is a
rebase the commit hashes will change.  Let's say history is now this (reverse
chronological):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;323abcd New feature supreme
3222222 Rename functions.
323abce Whitepsace fixes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Great?  Almost.&lt;/p&gt;

&lt;p&gt;There's a likely hood that your apps' unit tests will not pass after the commit
&quot;Rename functions&quot;.  Some functions may have been renamed somewhere later in
&lt;code&gt;mybranch&lt;/code&gt; possibly in &quot;rebase me&quot; which is now a part of &quot;New feature
supreme.&quot;&lt;/p&gt;

&lt;p&gt;This is a mess, but we can run &lt;code&gt;git rebase -i master&lt;/code&gt; again and edit the
&quot;Rename functions.&quot; commit.  If you run a test-suite and things fail you can
&quot;borrow from the future&quot;.  You see at this point &lt;code&gt;Rename functions&lt;/code&gt; is
something that happened in the past.  &lt;code&gt;mybranch&lt;/code&gt;'s head is now
&lt;code&gt;New feature supreme&lt;/code&gt; which is the future.  We can pick and choose little
changes with some &lt;code&gt;git&lt;/code&gt;-fu.&lt;/p&gt;

&lt;p&gt;While rebasing in the &lt;code&gt;Rename functions.&lt;/code&gt; we might notice that we forgot to
rename a call, but we remembered to rename this call at some point in
&lt;code&gt;mybranch&lt;/code&gt;.  We can simply do this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout -p mybranch [paths]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will let you interactively select chunks of code from the head of
&lt;code&gt;mybranch&lt;/code&gt; and put it into your specific commit &lt;code&gt;Rename functions.&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can narrow this down by specifying some &lt;code&gt;paths&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once we finish rebasing we'll have a commit history that is logically ordered
and have all tests passing tests.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Siddhartha: The Fifth Month</title>
   <link href="http://davedash.com/2010/10/30/siddhartha%3A-the-fifth-month/"/>
   <updated>2010-10-30T00:00:00-07:00</updated>
   <id>http://davedash.com/2010/10/30/siddhartha:-the-fifth-month</id>
   <content type="html">&lt;p&gt;This month has been my favorite thus far.  The first month was exciting, but
nerve racking.  Two was full of changes.  Three was somewhat boring, but we did
get sleep.  Four we lost all our sleep.  In this month a lot of stuff happened
and we got used to the &lt;a href=&quot;http://localhost:4000/2010/09/29/the-fourth-month/&quot;&gt;sleep regression&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This month we are also sleeping differently.  He sleeps around 7 or 8PM and
wakes up a few times at night.  We sleep around 9 or 10PM.  Katie nurses him in
bed the first few times he wakes.  Once it's 4am I take him out so Katie can
get an hour or two of uninterrupted sleep (or more on the weekend).  I'll
either get him to fall back asleep on me in the couch or in his swing.
Sometimes I'll need to change his diaper, or bottle feed him a bit.&lt;/p&gt;

&lt;p&gt;But the sleep regression wasn't all for naught.  He now rolls, which is
amazing, and he can army crawl:&lt;/p&gt;

&lt;div&gt;
&lt;object width=&quot;560&quot; height=&quot;340&quot;&gt;
    &lt;param name=&quot;movie&quot;
        value=&quot;http://www.youtube.com/v/3ec7gal2d60?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;hd=1&quot;&gt;
    &lt;/param&gt;
    &lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;
    &lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;
    &lt;embed src=&quot;http://www.youtube.com/v/3ec7gal2d60?fs=1&amp;amp;hl=en_US&amp;amp;rel=0&amp;amp;hd=1&quot;
        type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot;
        allowfullscreen=&quot;true&quot; width=&quot;560&quot; height=&quot;340&quot;&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/div&gt;


&lt;p&gt;I think I'll be spending a lot of weekends hiding wires and cables and other
things that babies think are delicious.  Crawling (and perhaps teething) have
led to a lot more spit-up too.&lt;/p&gt;

&lt;p&gt;My biggest problem has been one of scheduling.  I wake up around 5 or 6AM, get
ready for work, wait for Katie to get ready, then go to work, come back around
6PM and start putting him to sleep.  I don't get enough time to spend with him
on weekdays, and I feel like I'm rushing to and from a job I really enjoy.  I'm
really hoping that he gets to sleep easier, so I won't feel rushed each day.&lt;/p&gt;

&lt;p&gt;In any case, this next month should be exciting - our plan is to give this guy
an avocado for Thanksgiving.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Faceted Search on Input</title>
   <link href="http://davedash.com/2010/10/29/faceted-search-on-input/"/>
   <updated>2010-10-29T00:00:00-07:00</updated>
   <id>http://davedash.com/2010/10/29/faceted-search-on-input</id>
   <content type="html">&lt;p&gt;So one trick with &lt;a href=&quot;http://sphinxsearch.com/&quot;&gt;Sphinx search&lt;/a&gt; is &lt;a href=&quot;http://en.wikipedia.org/wiki/Faceted_search&quot;&gt;faceted search&lt;/a&gt;.  It's somewhat
crudely implemented, by batching queries together, but does the job well.  In
the case of &lt;a href=&quot;http://input.mozilla.com/&quot;&gt;Firefox Input&lt;/a&gt; it can reduce quite a bit of queries (our
search result pages take one batched sphinx query, and one database query now
instead of 5 database queries).&lt;/p&gt;

&lt;div class=&quot;side&quot;&gt;
&lt;a href=&quot;http://www.flickr.com/photos/davedash/5126379671/&quot;
   title=&quot;Add-on Search Results for shopping :: Add-ons for Firefox&quot;&gt;
   &lt;img src=&quot;http://farm5.static.flickr.com/4041/5126379671_33b3e472d5_m.jpg&quot;
    width=&quot;240&quot; height=&quot;172&quot; alt=&quot;Add-on Search Results for shopping&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Faceted search is search with filters to help narrow down a result set.  I'll
give you three examples.  &lt;a href=&quot;http://addons.mozilla.org/&quot;&gt;Firefox Add-ons&lt;/a&gt; which I wrote,
&lt;a href=&quot;http://www.sittercity.com/search-sitters.html?ct=101&amp;amp;zip=95126&quot;&gt;Sitter City&lt;/a&gt; which gives you a lot of ways on narrowing down on the perfect
baby sitter and &lt;a href=&quot;http://ebay.com/&quot;&gt;ebay&lt;/a&gt; which lets your narrow down on auction items.&lt;/p&gt;

&lt;p&gt;For &lt;a href=&quot;http://input.mozilla.com/&quot;&gt;Input&lt;/a&gt; we ask for the following when we do a search:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How many opinions match the term for which we are searching taking into
account any preferences we have already specified (feeling, locale, operating
system, date range, etc).&lt;/li&gt;
&lt;li&gt;How many opinions show a positive sentiment, and how many show a negative
sentiment?&lt;/li&gt;
&lt;li&gt;What is the breakdown of languages for the opinion results.  (I.e. how many
are en-US, de, fr, etc).&lt;/li&gt;
&lt;li&gt;How many people are on Mac, Linux or Windows.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We can batch these four queries into a single Sphinx request.&lt;/p&gt;

&lt;p&gt;Here's &lt;a href=&quot;http://github.com/davedash/reporter/commit/348018&quot;&gt;our implementation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Having done this twice, I do recognize that there is a lot of room for making
the code a bit more reusable.  But overall it runs fairly well.&lt;/p&gt;
</content>
 </entry>
 

</feed>


