Get updates

Development

Scott - 3DM Design Hexmap Coordinates the Easy Way

When it comes to turn-based strategy games, I’ve long preferred hexes over a square grid. Naturally in working on my own projects I want to use hexes… but at first glance it seems the coordinate system for hexes must be much more complicated.

It’s actually easier than you’d think, I’ll show you how.

Continue Reading…

Scott - 3DM Design Forking Bucketwise

I used to keep track of personal finances with Microsoft Money, but it’s not exactly suited to my needs.

Enter Bucketwise, a personal finance rails app that’s open source – hence ready to be customized.

Continue Reading…

Scott - 3DM Design Blog Relaunched

A new, less saturated, coat of paint and a shorter URL – 3DM Design has been relaunched!

Continue Reading…

Scott - 3DM Design Blog and Feeds Moving

I’ll soon be moving the blog to http://3dmdesign.com/, and likewise updating the feed URLs to http://3dmdesign.com/feed and http://3dmdesign.com/comments/feed.

Continue Reading…

Scott - 3DM Design Q&A: How to Customize Rails to_json output?

Rails has a bunch of JavaScript helpers, but once you move beyond those and want to write your own JavaScript code for your application, you may find yourself dealing with some JSON produced on the server-side.

By default, the to_json method in Rails is probably a lot more verbose than most people want. I’ll share a few tips on how to tame it.

Question: How can I slim down the output of to_json in Rails?

Continue Reading…

Scott - 3DM Design JavaScript Variables and Anonymous Objects

JavaScript is not Ruby, but it does offer syntax that can lead to expressive code. There’s one case where JavaScript could have gone a step further and given us even more expressive code syntax, when dealing with object literals or anonymous objects.

Continue Reading…

Scott - 3DM Design Back to Rails

It’s been a long time since I’ve worked on a Rails project, but it feels good to finally get back to Ruby on Rails.

Continue Reading…

Scott - 3DM Design JavaScript Event Delegation

Coding interactive behavior into “dumb” HTML elements is one of the basic scenarios for JavaScript use. The standard method is usually to hunt through the DOM looking for elements of a certain id or class and attach an event handler function directly to each one.

For most types of events, there’s a better way: Event Delegation. At the basic level it involves attaching an event delegation function to a parent element, then catching events which bubble up and passing them off to specific handlers based on the event’s target.

Continue Reading…

Scott - 3DM Design Learn to Program with JavaScript: Instant Feedback

Last time, with part one of this Learn to Program with JavaScript series, I introduced some basic HTML with an interactive tutorial. As JavaScript works very nicely inside a web page, this gave us the foundation. Now it’s time to add actual JavaScript on top.

Just like other aspects of an HTML page, JavaScript goes into a specific tag. The <script> tag, to be precise. Try out the first example to see our own version of “hello world” in JavaScript:

Continue Reading…

Scott - 3DM Design JavaScript RegExp Tool Available

There are times when I just need to process some text quickly and efficiently. Regular Expressions are very well suited to this task, and now I’ve released my own JavaScript Regular Expressions tool for just this purpose.

Continue Reading…

Scott - 3DM Design First Steps to Comet: Orbited in PHP

I’ve recently become interested in Comet, as a web technology, and Orbited, as a Comet server. For anyone else starting down this path, I thought I’d write up the summary of this weekend’s quick foray into event-driven server-sent-messaging goodness.

Continue Reading…

Scott - 3DM Design Comet for Web Games

For those not familiar with Comet, you’re either not a front end web developer or you’ve been kept in the dark. To sum it up quickly, Comet is a technology like Ajax. While Ajax basically consists of an asynchronous request by the client to the server, followed by the server’s response, Comet is a bit different. In Comet the client establishes a connection (or makes a request) to the server, and then generally keeps that connection open for the server to send responses back to the client on its own schedule.

Continue Reading…

Scott - 3DM Design Extending JavaScript Strings with Chomp using Prototypes

Chomp is that oh-so-fun function in Perl to bite off extra newlines from the end of a string. It can be useful to have chomp for JavaScript too, especially in cases such as reading input in textareas.

This time around, I’m going to take a quick look at how we can take the standalone JavaScript chomp function and make it even more accessible by extending JavaScript’s String object, which also gives us an excuse to try out the awesome prototype feature in JavaScript.

Continue Reading…

Scott - 3DM Design Learn to Program with JavaScript Series: An HTML Beginner’s Interactive Tutorial

I’m a web developer by day and have been programming, in one language or another, most of my life since age 10. But for someone without consistent (or any) programming experience, how do you learn to program? This question was brought on by a friend of mine who had a programming class or two years ago and is now setting his sights on giving it another shot.

The good news is that you don’t have to be a life-long programmer to have some fun with it. Old, young, students, hobbyists, and non-programmer professionals can all learn to program, provided they have some interest and a little time (it doesn’t take much to get started).

Continue Reading…

Scott - 3DM Design Introduction to Regular Expressions in JavaScript: Alternation and Grouping

Regular expressions provide lots of flexibility in processing text, and this article introduces two additional metacharacters (three counting both parentheses), but first I’ll start with a summary of what was covered in the previous regex article:

Continue Reading…

Scott - 3DM Design Introduction to Regular Expressions in JavaScript

If you’re a programmer who has ever had to develop an application dealing with text input (which is most of them), from files, databases, or user input, you might be interested to know that regular expressions can make your job a lot easier.

Unlike most dry regular expressions tutorials out there (Mike’s smart post aside), I intend to provide more than just the “what”; I’ll walk you through the “how” and “why” too. After all, why would you care to learn regular expressions if you don’t get to find out about some of the cool and powerful things you can do with them?

Continue Reading…

Scott - 3DM Design Q&A: What Methods are Available with acts_as_list?

When you make use of Active Record’s convenient acts_as_list modifier in Rails, what does this do for you? Most of the info out there describes the way acts_as_list manages position of items, ordering them like items in a, well, ordered list.

That’s great, but what about new helper methods provided by acts_as_list? Doesn’t it make juggling list items easier? Or do you simply have to fend for yourself when you want to rearrange your list?

Question: What additional methods are provided when using acts_as_list?

Continue Reading…

Scott - 3DM Design Chomp for JavaScript

In most programming languages, there exist certain simple and useful functions that people come to rely upon. From my days with Perl, chomp was one of those functions for me.

Given a string, chomp bit off all newline characters at the end of the string (and returned the number of newline characters it removed).

Continue Reading…

Scott - 3DM Design Easing into Rails Deployment with Mongrel

Like the good [Rails] book says, Apache plus FastCGI is the way to go. Or is it?

It’s been a while since I’ve been free to work on ListFinity, just recently I was able to start addressing the question of deployment: How can I get my Rails application running on a local server, in “stable” production mode while I tinker away separately on the development version?

Of course I had to start by following my Rails book’s advice.

The much-touted solution of Apache plus FastCGI required, well, getting Apache running. Okay, done. Then CGI- check. Then Rails with CGI on Apache… wow we’re losing altitude quickly.

Continue Reading…

Scott - 3DM Design JavaScript Check All Checkboxes

Have you ever used a site with a bunch of checkboxes, and you needed to check all of the checkboxes but they didn’t provide that feature directly in their user interface? You might shrug, and click away until the job is done… or use the “JavaScript command line” aka your browser’s address bar, to do it the power-user way.

I realize that may not be a common problem, but in my day job I kept running into it while adding hundreds of keywords at MSN’s adCenter (wanting all of them to use all match types).

Hasn’t someone else already solved this problem? Seems very likely, but my searches were only pulling up examples of “check all” functions to use on your own site, so after a bit of coding I present to you my check-all checkboxes function:

Continue Reading…

3DM Design is where Scott Drake publishes thoughts on programming web applications in JavaScript and Ruby.