• Introduction to Graph Theory: Finding The Shortest Path

    Posted on February 9th, 2013 | Tags: Data Structures, Python, Ruby

    Graph theory is one of those things in the computer science field that has the stigma of being extremely hard and near impossible to understand. My goal for this post is to introduce you to graph theory and show you one approach to finding the shortest path in a graph using Dijkstra's Algorithm. Don't worry about learning everything in one go. If you can walk away with a few concepts and one or two things implanted in your memory you're well on …

    read more

  • Creating a Simple Bloom Filter

    Posted on February 2nd, 2013 | Tags: Python, Data Structures

    Bloom filters are super efficient data structures that allow us to tell if an object is most likely in a data set or not by checking a few bits. Bloom filters return some false positives but no false negatives. Luckily we can control the amount of false positives we receive with a trade off of time and memory.

    You may have never heard of a bloom filter before but you've probably interacted with one at some point. For instance if you use …

    read more

  • Python Shortcuts for the Python Beginner

    Posted on January 26th, 2013 | Tags: Python

    The following are just a collection of some useful shortcuts and tools I've found in Python over the years. Hopefully you find them helpful.

    Swapping Variables

    x = 6
    y = 5
    
    x, y = y, x
    
    print x
    >>> 5
    print y
    >>> 6
    

    Inline if Statement

    print "Hello" if True else "World"
    >>> Hello
    

    Concatenations

    The last one is a pretty cool way to combine objects of two different types.

    nfc = ["Packers", "49ers"]
    afc = ["Ravens", "Patriots"]
    print nfc + afc
    >>> ['Packers', '49ers', …

    read more

  • Create Your Own jQuery Autocomplete Function

    Posted on January 19th, 2013 | Tags: jQuery

    It's always nice when text or code autocompletes for you. Why not give your users the same happiness on your site?

    I'm aware that there are several autocomplete libraries out there. I've personally used jQuery UI's autocomplete which is really nice and simple. However, I feel that creating an autocomplete widget is simple enough to prevent the need of including another large javascript library. The final compressed javascript for this project only adds 608 bytes and could likely be modified to be less. …

    read more

  • Realtime Django Using Node.js and Socket.IO

    Posted on January 12th, 2013 | Tags: Node.js, Django, Redis

    Our goal for today is to build a realtime chatroom using Django, Redis, and Socket.IO. While we'll be building a chatroom the concepts can be applied to almost any web app. At a high level this post will show you how you can convert your REST based app into a realtime web app. I'll be using Django to create the REST based portion but feel free to use any language/framework you're comfortable with. With that said let's jump into the code and get …

    read more

<< Older Posts Newer Posts >>