Category: Tech

  • A Jinja macro for generating an html select box with US states

    More on Jinja macros {% macro states_select(name, value=”, class=”, id=”) -%} {% set states = [“AL”, “AK”, “AZ”, “AR”, “CA”, “CO”, “CT”, “DE”, “FL”, “GA”, “HI”, “ID”, “IL”, “IN”, “IA”, “KS”, “KY”, “LA”, “ME”, “MD”, “MA”, “MI”, “MN”, “MS”, “MO”, “MT”, “NE”, “NV”, “NH”, “NJ”, “NM”, “NY”, “NC”, “ND”, “OH”, “OK”, “OR”, “PA”, “RI”, “SC”,…

  • A JavaScript Sigmoid Function

    Here’s a simple sigmoid function showing a logistic curve written in javascript function sigmoid(t) { return 1/(1+Math.pow(Math.E, -t)); }

  • How-to Set Up Ubuntu w/ MongoDB Replica Sets on Amazon EC2

    This tutorial is intended for beginners who aren’t familiar with EC2 yet, but are generally familiar with mongoDB. EC2 is actually pretty easy, but a lot of the basic info you need to get started is interspersed across numerous websites and articles. This post hopefully puts all the necessary details in one place. The first…

  • Running cherrypy on multiple ports (example)

    As a continuation of my previous post on how to run cherrypy as an SSL server as HTTPS (port 443), this tutorial show how to run a single cherrypy instance on multiple ports for both HTTP (port 80) and HTTPS (port 443) We need to do a few things differently than in most examples out…

  • Using SSL HTTPS with cherrypy 3.2.0 Example

    It took me more time than it should have to piece together the right bits of current information for using SSL with cherrypy. Here’s a fully working example of cherrypy 3.2.0 serving up HTTPS requests. Quick notes – if you haven’t tried cherrypy, do it. It’s awesome in its simplicity. Also, I got my SSL…

  • Inspiring Civic Hacking

    Mick Ebeling recently gave a TED talk about the homemade eye-tracking device he and a bunch of hackers made to allow a paralyzed man to communicate, stephen hawking style. They did this with an off-the-shelf PS3 camera and some open source software for $50. That’s what I call a righteous hack. Most importantly it has…

  • A False Sense of Security with Test-driven Development

    Test driven development is great as long as you have proper tests. The problem is that it’s very hard to predict enough edge cases to cover the field of possible scenarios. Code coverage analysis will help developers make sure all code blocks are executed, but it doesn’t do anything to ensure an application correctly handles…

  • Getting Wikipedia Summary from the Page ID

    While working on my forthcoming checkin.to project, I needed to use the MediaWiki API to get the summary paragraph of wikipedia articles pertaining to places. Checkin.to relies on the Yahoo Where On Earth Identifiers (woeid). Yahoo also conveniently offers a concordance API so from the woeid I get the Geonames ID and the Wikipedia page…

  • A continuous, blocking python interface for streaming Flickr photos

    As I explained in my last post, Yahoo! claims their Firehose is a real-time streaming API and it’s not. So to make life a bit easier for app developers I wrote a python wrapper that provides a continuous blocking interface to the Flickr polling API. Effectively it emulates a streaming API by stringing together frequent…

  • The Yahoo Firehose "feed" isn’t a feed at all

    The web has been on a big trend of real-time for the past couple years. Friendfeed was one of the first services to show real-time updates across your social network and real-time feeds took the stage in a big way when Twitter started its streaming API. In April, Yahoo! announced it’s Firehose API claiming “it…