Bash-Shell.Net

I'm a developer, not a writer

CoffeeScript FIrst Impression

by justin on April 25, 2013, 9:48 p.m. EDT

Today I tried to use CoffeeScript for the first time. Some of the other guys at my new job like it and it's not often that you are encouraged to use more cutting edge, less supported, less proven technology so I figured I'd give it a try on my current work project.

So far I'm not impressed. Maybe it's because I don't really dislike JavaScript in the first place, but I don't feel like what I've gained outweighs what I've lost. The syntax is a bit more terse and I've gained ...

→ read more

Two Scoops of Django

by justin on March 25, 2013, 3:16 p.m. EDT

I recently bought the beta of Two Scoops Of Django based on all of the good reviews and recommendations it's getting fro people who know way more about Django than me. I haven't read it all in depth, but I've read most of it and at least glossed over the rest and so far it was well worth the $15.

The explanations of how and when to use the Class Based Views were excellent. The official documentation hasn't been very clear on them, so I've avoided them. In my personal case I still think they ...

→ read more

Python Tic-Tac-Toe AI

by justin on Jan. 4, 2013, 3:44 p.m. EST

Not too long ago I began talking to a company which will remain unnamed for now about a Django dev job. Part of their hiring process is to write single player a tic-tac-toe game where the computer always wins in Python. The hiring is on hold over the holidays, but I figured I'd get a head start and document it here for fun.

I start with a couple of basic classes, Board, Player, and AIPlayer.

class Board(object):
    """A tic tac toe board"""

    wins = ((0,1,2), # rows
            (3,4,5),
            (6,7,8),
            (0,3,6), # columns
            (1 ...
→ read more

Python Unicode Gotcha

by justin on Dec. 4, 2012, 9:11 a.m. EST

I was peer reviewing a bug fix for some code at work the other day and learned something about Python and encoded Unicode. It makes sense now, but when I first saw the fix my initial thought was that there's no way that's what is going wrong. It turns out that once you've encoded a Unicode string, perhaps to utf8, you can chop off just part of the bytes of a single Unicode character using string slices.

>>> u = u'A string with some random unicode \u0200 \u0202. There it is.'
>>> u
u'A string with some random ...
→ read more

Djukebox Gets Handlebars and a REST API

by justin on Oct. 26, 2012, 3:48 p.m. EDT

I recently reworked the Djukebox UI. It's still ugly, but it uses way cooler things behind the scenes. The original incarnation had a main page which housed the player, a hidden iframe for uploading new tracks while letting the user continue browsing and listening, and another iframe for the current page content so that the player could keep playing while the user clicks around through lists of tracks and albums.

It worked pretty smoothly, but it's not cool and new. This is an old, hacky way of doing things. The point of Djukebox is to be a playground ...

→ read more

Control Panel Development Is Underway

by justin on July 31, 2012, 10:18 p.m. EDT

I have begun work on a new control panel app for the CMS used for bash-shell.net. I got to learn a little about how django.contrib.admin works since I dug into its code to see how the dynamic urlconf creation happens and how model registration is handled. For bscontrolpanel entire views are registered rather than single models. This can be a bit more work, but it allows for streamlined, user friendly control panel views to be built, housed with the app they belong to, but appear dynamically in the control panel and all live under a common base ...

→ read more

A New Look and Reworked Back End

by justin on June 25, 2012, 9:22 p.m. EDT

The site has a new look. I completely scrapped the old html and css and started from scratch. I'm terrible with picking colors so I used a bootstrap them from BootSwatch and then went to work on the layout. I made changes to the back end to hopefully let me expand this more as time goes on. The blog section is now one app while the projects are their own app rather than being hacked into the blog stuff. I'm hoping to find time to take the projects section and tie into github and bitbucket APIs, add file ...

→ read more

Programming Pearls: Phone Directory

by justin on May 6, 2012, 9:55 a.m. EDT

I recently started reading the book Programming Pearls. It walks through several situations in software development which had interesting solutions. The solutions generally required a bit more thought about a problem than a person might initially give it, but were far simpler to write and/or more efficient than the first solution most people would think of as well.

This also includes exercises after each section which reinforce some of the concepts and ways of thinking used to solve the initial problem. I intend to do some of these and occasionally post my answers. The book used C++ and I ...

→ read more

Django / Nginx / uWSGI / Supervisor On Debian

by justin on April 28, 2012, 6:29 p.m. EDT

So I've moved my stuff over to Rackspace and have pulled Apache out of the mix. I'm now running Django behind Nginx and uWSGI in a virtualenv with Supervisor. It was more work than I expected and most of the instructions out there I didn't find to be very helpful because they expect you to be setting things up exactly how the author of those instructions does it, so here's my own little bit of info on how to do this. I run Debian, so the specifics I provide here will be for Debian (and Ubuntu ...

→ read more

The Redesign Continues

by justin on Feb. 18, 2012, 11:56 p.m. EST

Today I decided to do a little bit more to make this site look just a touch nicer. Rather than relying on doing everything myself, I decided to pull in bootstrap which the people at Twitter have been nice enough to provide. It allowed me to strip out some of my own css, add the little older and newer buttons down at the bottom of the main page, and provides a whole lot of functionality that I haven't used yet... fancy drop down menus, a menu bar, pop-up alerts, progress bars, and more.

I did find getting started a ...

→ read more
Member of The Internet Defense League