The Chartio team has grown now and several months ago I had to stop coding completely and focus on CEO tasks. I’ve missed programming a lot, and tonight, the night before Thanksgiving and one of the first breaks I’ve gotten, I created a little javascript chess game and AI.

If you’re interested you can play the game here or checkout the source code here.

I utilized jhlywa’s helpful chess.js library for some of the move intelligence and game status storage. It relies on the Forsyth–Edwards Notation (FEN) and I found it quite simple to use. It has an odd implementation of an object constructor so extending the class was difficult, but typically only one instance of the chess object is used anyway so I just kept it simple and appended a few functions on to the instance for now.

The chess.js files come with an ASCII output but no html interface. It was fairly quick to use the chess unicode characters and the drag and drop from jQuery-UI to make up a classic looking board and drag controls. Most of that code can be found in game.js

Lastly, it wasn’t fun at all to play myself so I made my first attempt in many years at writing an AI. I used an alpha beta search which is effectively a minmax algorithm with a few shortcuts. In theory the AI should work pretty well. In practice however its quite dumb. There are two main reasons

    • game status and potential moves are stored as strings
    • I have no openers stored in memory
    • the board score is only based on the pieces that remain

To fix those I would have to write my own Bit based chart engine.  Right now the string based chart.js library can only search a depth of 2 before the wait time starts to get really annoying.  That’s pretty bad. I read that typically a depth of 6 or 7 is desired for intelligent mid-game play. Many AI implementations also have some openers stored in memory. Mine does not and so it pretty much sabotages its game right away by continually choosing its first move (pushing the first pawn) until the game starts to get more interesting.

Anyway, it was fun to get back into coding with a small project.  Especially one that I can play and share with others.  The code is free as in beer, but if you do anything with it please let me know as I’d love to check it out!


Gmail is a frequently used SMTP host for Django apps.  Its free and relatively simple to setup which is ideal for small apps.  There are a few significant downfalls. First, its limited to 500 emails a day with no option to upgrade.  Second, it limits and even re-writes all outgoing emails to the username of the connector.

For example if you’re trying to send an email from or you’re out of luck because all of those emails will actually get sent at or whatever email account you have configured. I’m sure this saves millions of people from millions of spam but it adds a bit of annoyance to developer’s lives.

The recently launched MailGunoffers a great solution.  Its free for up to 200 emails per day and super cheap and dramatically scalable after that.  It also works as a drop in replacement for whatever service you were using for your django smtp server.  Changing will take you less time than reading this article.

The Steps:

  1. Sign up for MailGun
  2. Go to the control panel and click on the server created for you.
  3. In the upper right you will find your “SMTP Authentication” credentials for this server.
  4. Open the in your django app and configure your email with the given credentials.  It should look something like this.
    EMAIL_USE_TLS = True
    EMAIL_HOST = ''
    EMAIL_PORT = 587
  5. Test it out!./ shell

    >>> from django.core.mail import send_mail
    >>> send_mail('MailGun works great!', 'It really really does.', '', [''], fail_silently=False)

Yesterday I was on the cover of the Business section of the StarTribune.  Its a nice article that talks a bit about Socialbrowse and my path to what I’m doing right now.

It also talks about Luke Francl and his awesome startup FanChatter which is also from Minnesota and also in YCombinator.  Here is a link to the article

The print version comes with pretty pictures of Luke and I which I think is worth the money :).

Thanks Thomas Lee for the nice coverage.

Django has a really handy function on the request object that will determine if the request was an AJAX request (an XMLHttpRequest).


It simply checks whether the HTTP_X_REQUESTED_WITH header is equal to ‘XMLHttpRequest’, a standard that’s supported by most javascript libraries. You can read more about it and see the list of supporting frameworks here.

It’d be great if the Django client had a simple client.ajax request in addition to its and client.get requests, but alas it doesn’t.  The tests can still be done however by changing the HTTP_X_REQUESTED_WITH header when sending  your test requests.

>>> from django.test.client import Client
>>> client = Client()

>>>“”, {“foo”: “bar”}, **{‘HTTP_X_REQUESTED_WITH’: ‘XMLHttpRequest’})

From there its fairly straight forward to create your own .ajax wrapper if you’d like.

Now you have no excuse for not having complete tests for all of your XMLHttpRequests :).

It happened a few weeks ago and we mentioned it on the Socialbrowse Blog but I feel like mentioning it here as well. Socialbrowse was covered on the News!  Zack and I were interviewed by Ali Lucia and were really pleased with the coverage.  Unfortunately I can’t embed the video in this wordpress blog so you’ll have to follow the link:

Watch The Socialbrowse News Coverage

So what did I learn from being on the news?  A few things:

  1. It doesn’t bring much traffic to a web site
  2. It brings substantial clout among friends/family who wonder what I’m doing with my life
  3. You get some temporary local fame/recognition
  4. Its best to be prepared (our site was going down during our interview 🙂
  5. 95% of what you say in an interview isn’t used
  6. So speaking in small poignant sentences helps

I’m currently doing a lot of research and experimenting in Marketing as its my weakest skill as a startup founder.  I want to make it one of my strengths, or at least become moderately good at it.  One of the marketing tools I’m going to be experimenting with is this blog.  To do that I really think it needs some sort of re-design, or rather a first-design as almost no design went into it in the first place.

Lately I get between 30 and 80 views per day, numbers I hope to increase significantly.  I have various distribution methods in mind and am confident I can accomplish the task.

So here’s the deal

I’m a bootstrapping startup founder, so I have no money to spend on this.  I’m hoping there’s someone generous enough to design it for the experience and the portfolio builder.  Everyone starts somewhere.  Hairstylists give out a lot of free haircuts before they get paid.  Writers write a lot of free stories, and even engineers write a lot of software before someone ever pays us.

Though I can’t offer money,

Here is what I can offer

  1. Name and link of designer’s site at the bottom of each page.
  2. A blog article thanking, complimenting, and recommending the designer
  3. Possible paid work on sites in the future

I make a lot of websites and have alot of projects.  I won’t always be poor.  I also know a lot of people who make a lot of web sites and are looking for good designers.  If I like your work, I’m not shy to recomend people.

Here’s what I want

This blog is about the Things I Learn, and most of that tends to be about technical stuff (but not all).  It should be modern, stylish, and clean.

Here are some blogs, who’s designs I really like.

I’d like a large RSS icon on a sidebar as well as some space to put the Socialbrowse Blog Widget and other widgets that my hacker friends have made.  I’d like a great font so that the post is fun to read on its own, without always needing a picture to support it.

I’d also like to keep the blog hosted on wordpress, which means the design is constrained to using one of the currently available themes (formats) and updating the css.  Here is more information about the Custom CSS feature and a FAQ.

If you’re interested or want more information contact me at dave [at]

I’m probably the last person to look this up but I’ve often wondered what the best answer to “Paper or Plastic?” really is.  The best answer ofcourse is neither.  I should bring my own bags, but I rarely preform ideally so that aside what’s the best?

It seems like paper would be more environmentally friendly because its renewable and degrades much faster.  Also its brown and reminds you of nature, so that has to be better environmentally right? Plastic bags use up a lot of oil, which we know is not nonrenewable.  But then how much oil is used to make paper bags?  Cutting down all those trees, shipping them, printing, gluing, etc.  The more extensive manufacturing process must take a considerable amount of oil right?

This article gives some quick facts on the costs of each:

To make all the bags we use each year, it takes 14 million trees for paper and 12 million barrels of oil for plastic. The production of paper bags creates 70 percent more air pollution than plastic, but plastic bags create four times the solid waste — enough to fill the Empire State Building two and a half times. And they can last up to a thousand years.

Another great article suggests further proves that there is no consensus on the issue:

Both paper and plastic bags consume large amounts of natural resources and the majority will eventually end up in the landfill. Both bags can be recycled to some extent and can be utilized around the house. I’ve read several studies comparing the two choices and none of them agree.

Drats!  I hate issues with no clear answer.  The first article suggests that there are bio-degradable plastic bags that take only a few weeks to break down.  That would be the ideal solution, but they’re rarely a choice.

For now I think I’m going to go with plastic on this one but with the intent to save the bags and recycle them.  The plastic uses less resources and polutes less.  Recycling them should reduce their significant impact which is in all the garbage they produce.  I’m also going to continue to not take a bag when one is not required.  Too often I see people check out with one or two small items and walk off with them in a bag.  If you don’t need the bag, don’t use it.

Update: My friend Natalie recently shared this clever video promoting careful use of your plastic bags.