• Rotating a Matrix

    Posted on April 20th, 2013 | Tags: Challenges, Python

    From time to time when I'm bored I'll go through seemingly simple programming/interview challenges. One that I found interesting was the following:

    Rotate an NxN matrix 90 degrees in the clockwise direction.

    Sometimes the question also has a "bonus" challenge of rotating the matrix in memory. So basically without creating a new array or matrix. I'm not really a fan of this addition since it takes the naive approach off the board. Granted the naive approach is really dirty compared to what it …

    read more

  • Reading JSON Data With Django

    Posted on April 13th, 2013 | Tags: Django

    While working on an application I ran in to an issue reading data from a request so I figured I'd share.

    I'd say about 99% of the time when you're reading data from a Django request you're either using request.GET or request.POST. I ran into an issue where an app was sending JSON data through an AJAX request via POST. However, Django's request.POST wasn't picking it up which had me kind of confused. My next step was just to print out the request …

    read more

  • Bit Level Manipulation

    Posted on April 6th, 2013 | Tags: Optimizations

    Bit level manipulation allows us to write more efficient code due to the fact that CPU's are really good at handling bits. In fact that's all they really do. Even if you've never played around with bit manipulation it's likely that your compiler has modified your code to use bit manipulation.

    Finding Odd AND Even Numbers

    At some point everyone's probably written some code to this effect:

    def odd_or_even(number):
        if number % 2 == 0:
            return "Even"
        return "Odd"
    

    However, as we all …

    read more

  • Simple Search With Django ORM

    Posted on March 30th, 2013 | Tags: Django

    Many websites find it useful to have a search box on their site to enable their users to find content easier. I just wanted to share a simple way that I was able to do it using the Django ORM.

    The first step will be to get the user's query then split it into an array for each word.

    query = " Django search " #Search query entered by user
    query = query.split() #Remove excess spaces and split the query into array items …

    read more

  • Build Your Own RSS Feed Reader

    Posted on March 23rd, 2013 | Tags: PHP

    It's not everyday that a company with a significant market share in a sector gives up that market share. The RSS industry has seen a significant landscape change recently with Google's announcement to power down Reader. Quite a few new feed readers have sprung up recently and several existing ones have been rapidly iterating their software to handle the new influx of users. I'm personally content with using Hacker News and Reddit as my feed readers but I understand people's desire for …

    read more

<< Older Posts Newer Posts >>