Posts tagged "programming"

My TextMate setup

Taking a few cues from Alex Payne’s blog post on using TextMate, I’ve got a nice little setup for how I like to use the handy Mac text editor. I’m not sure how much I’ll continue to use this, however, as I may be making the transition to MacVim if TextMate doesn’t show any signs of development activity soon, but for now, my TextMate setup seems to work well for me.

Plugins I can’t live without

ProjectPlus

First off would have to be ProjectPlus. This takes the tired old TextMate project drawer (the one you get when you open a whole folder with TextMate) and gives it a much-needed kick in the pants. It adds support for version control status on files (you can see which files are committed to git/svn/hg, etc), updates the UI, supports Finder-like color labeling on files, and more. TextMate without this is bleak.

MissingDrawer

I partner this with MissingDrawer, which more or less integrates the drawer with TextMate and makes it look its purdiest.

Bundles that I work with

GetBundles

First and foremost, GetBundles, GetBundles, GetBundles. Make sure you’ve got Subversion (you’re on a Mac? You probably already have it then) installed, then whip up your Terminal.app, and run the commands here. Next time you open up TextMate, you’ve got a special bundle installed that fetches other bundles that are retrievable via official TextMate trunk, or via the ever-closer-to-official GitHub listing of TextMate bundles. All in an easy-to-use GUI for searching, installing, and updating them. This bundle is the king of all bundles, and I’m surprised it’s not included with the install of TextMate.

Python-Django.tmbundle

Syntax highlighting for both Python and Django, available at GitHub. Installable through GetBundles. Seriously, though, get GetBundles.

Other UI enhancements

Green Moleskine

Jason Evers’ Green Moleskine UI refresh for TextMate is the last bit of goodness that I use to round everything out. It enhances colors in the sidebar, changes the folding indicators to look nicer, and also includes the MissingDrawer plugin (as well as a few I don’t use, like WebMate and SVNMate). Check it out; it even comes with a nicer icon than the purple one TextMate comes with.

Recap

All in all, I have a working environment that works for me. It certainly tides me over until TextMate 2, if that piece of vaporware ever gets here.

My setup

Etcetera: nearing 1.0 release

Etcetera Building Detail

As I’ve been punching away at building Etcetera, I seem to have lost sight of versioning and building anticipation and what-not… and it really doesn’t matter that much to me (nor does it matter to those that are using the system), but in thinking about it, I’ve realized that I probably should have some sort of milestone that I’m building towards, as it gives me a good outline of where I should be headed in terms of features and capabilities. I’ve decided that milestone is the 1.0 release. Once it’s in place, only minor feature revisions will be added to the code base (as well as fixes and things) unless something totally drastic happens (like a mandate from the heavens).

I’m getting closer and closer to the feature goal, and this is a brief overview of what I’ve gotten done so far.

  • Actions menu: while this used to be along the ‘headline’ of the page, I’ve moved it to a more expandable box on the right-hand side of the page with a fixed width. I’d like to get it looking better (perhaps at the same height of the whole heading section), but for now, it’s there and it’s easier to add commands to without the concern of running out of room.
  • Expanded model fields: in the Checkout model, I’ve added an activation feature (in the form of a datetime form field) that drives the organization of tickets between various sections of the Checkout application. Now the equipment technicians can toggle when they’ve delivered a ticket and it gets timestamped. Better for record-keeping, too. The WorkOrder model in the Service app has a modified department field — instead of a basic text charfield, it’s now a foreignkey mapped to our organizational unit table. There’s an additional department_text field that assumes the old functionality for the public’s benefit.
  • Better date/time input: per this post, I’ve implemented something that easily tops the built-in admin date/time picker widget functionality of Django, and it’s a set of form subclasses that use python-dateutil for date/time string validation, and it’s damn good at handling a regular user’s interpretation of the date and time. For most of our public form users, the time picker led to the most confusion, so I used a touch of CSS to hide it temporarily. This serves as the fix in shining armor for that problem. Besides… who in the States likes to use (let alone understand) 24-hour time?
  • Per building/department/equipment quick reports: the feature I’m currently working on implements a display of the open checkout and workorder tickets per department or per building on campus. I’ve also added this per equipment; instead of open tickets, it shows everything prior. And I think it’s a paginated list. Can’t remember.
  • Google Charts API integration: a cool thing that I was working on but kinda put on the backburner. Google’s got a great easy-to-use charts API that I’ve learned how to use. There’s even Python bindings available for it. Problem is there’s not a whole lot of good documentation on using it, so I’ve had to do a lot of tinkering with it. I’m hoping to have it ready with the 1.0 release, but no promises there.

You can track my progress on Etcetera’s GitHub page, if that’s your thing. If not, I should be posting more updates soon about things as I gear up for that 1.0 release!

KreegerStudios.com is up

I’ve put up my personal portfolio site — and for the most part, everything looks and functions like it should (the JavaScript-based slideshow bit gives me some problems so I’m taking a look at it).

This marks a pretty landmark moment in my life — actually finishing something I planned to do a long time ago. I bought KreegerStudios.com… maybe 3 years ago now? I don’t know for sure, but it either always redirected to this site here, or to a placeholder page saying my site is coming soon.

Okay, so I enjoy punching myself over being a slacker. You’d enjoy it, too.

Dynamic SQL? Not if I can help it

I’m eschewing my traditional Django/Python banter, at least for a little while, in favor of some of the full-time work I’ve been doing now using (gasp) .NET, C#, and SQL Server.

We’ve got a table that has a foreign key that’s not explicitly stated as a foreign key; rather, it’s a parent entity ID, with a partner column for the parent entity’s name. It allows a relationship to any other table’s primary key, as long as that table’s name is in the parent entity name field. The idea is that a row in this table (an email marketing campaign, for instance) can be tied to any table along a certain marketing categorization level’s table (top-level table for company, mid-level table for a promotion, bottom-level table for a campaign, etc.) if it’s applicable for a certain level of the marketing categorization hierarchy. Sorry, I hate using big words.

The puzzle lies in running a query when given an item that references one of those bottom-level tables, and the goal is to get a list of those email marketing campaigns. At first, I thought perhaps a dynamic SQL statement was in order, so I could do a SELECT against a variable that contained a table’s name. That’s a pretty bad idea, as that can introduce vulnerabilities for SQL injection attacks.

This blog knocked it right out of the park for me, because I was pondering putting in a case statement in my joins. That’s invalid SQL code, however. I used an left outer join instead against a view we had created before-hand that aggregated a hierarchy per row based on the bottom-level table. That way, depending on the value that was in parent_entity_name, it would do a left outer join against the appropriate column using or clauses. Worked like a charm. If you want to weed out duplicates, throw a distinct() in the top of your select statement around the primary key of the table you’re searching for.