The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

How to get a free BlackBerry PlayBook tablet

posted under category: General on November 17, 2010 by Nathan

If there's one thing I know about programmers, it's that we love toys. Whether its Legos or smartphones, we love them. The next season's most promising toy that I've seen is the BlackBerry PlayBook tablet PC. Seriously, it's peppy and I want it. Mine is on preorder, and yes, I have a total bias because I'm getting it for free, but I don't want to be the only one. You can have it, too.

RIM currently has a giveaway program. It's simple: you make an app for the PlayBook and get it into their App World (aka the BB app store) by launch time, and they will send you the device. This developer promo is for real, so get started early. Here is the PlayBook dev overview page and the PlayBook developer resources page to get you going. I am starting with the webcasts from that last link.

Maybe it's a little ironic, you have to develop an application for a vaporware device, test it, deploy it and only then get the device, but I would argue that it is worth it. Having seen it in person, I will testify that is is a really nice toy, and I'm not above acting the shill because I really do want it to succeed.

(Discuss with Disqus!)

Phoenix CF DevCamp! Free ColdFusion Training - November 13th

posted under category: ColdFusion on November 1, 2010 by Nathan

Hey, you know how you've been meaning to learn how to program a little something here and there in ColdFusion, like this is an item on a to-do list that you just never quite check off? Well get your marker out - you can learn CFML in a day, and it won't cost you a thing.

On Saturday, November 13th, we're putting on a CF DevCamp. It's a full day, bring-your-own-laptop training session. We've got a big speaker (Terrence Ryan), corporate sponsorship (Adobe), food and drinks (SanTan Brewing Co), and plenty of stuff to give away (shirts, books, stickers and flash drives with all the software you need). Best of all, the day's events are free.

You can sign up for the Phoenix CF DevCamp now, or read more about the Phoenix CF DevCamp on our web site. This is a really, really good deal, think about it!

(Discuss with Disqus!)

ColdFusion 10, CF Builder 2

posted under category: ColdFusion on October 29, 2010 by Nathan

Just a quick note to say that I did hear, from the mouths of Adobe employees over this past week at MAX, that ColdFusion 10 is in development, and I saw, with my own eyes, ColdFusion Builder 2.0 running in a preview capacity.

For ColdFusion 10, they didn't announce anything at all about it - absolutely nothing, which is a little disappointing. All I got was a sentence fragment that confirmed that it did exist. Still, I can't wait until details start leaking out.

CF Builder looked really good. Raymond Camden already wrote down pretty much everything he saw at the preview. My quick take on it is that CF Builder 1.0 was trying to catch up with CFEclipse in a lot of ways, then surpass it in just couple, but 2.0 is improving on and surpassing all previous efforts pretty much everywhere. If you weren't impressed the first time around, stay tuned for a real, competitive IDE.

(Discuss with Disqus!)

Presentation: Holistic Program Quality and Technical Debt

posted under category: Software Quality on September 2, 2010 by Nathan

A couple weeks ago, I had the honor of doing a presentation for the Philly CFUG. The subject was about as dry as I could think to make it, but I think it went off pretty well. Being self-critical after listening to it, I have a pretty flat, monotonous voice, but otherwise, the content is good, IMNSHO.

Here's a link to the preso (thanks Adam): Holistic Program Quality and Technical Debt

(Discuss with Disqus!)

Technical Debt

posted under category: Software Quality on May 25, 2010 by Nathan

Technical Debt has been talked about a lot, but I have been thinking about pretty hard lately. Here's the concept: Make economic analogies for application development to help you (and especially your boss) understand code quality.

Let me lay it down so you can pick it up.

When you write code, you're making a monetary investment, be it in your own time or knowledge, there's been money spent. If it's not literal money, suspend your disbelief for a second when we pretend that your work is worth some arbitrary amount of cash. There's an amount you should spend to complete a given application, especially to do it right.

Now, when you take a shortcut in your programming, you save money up front. You can finish faster, but you're borrowing time, thus borrowing money. Eventually, that money has to be paid back, and you will pay it back.

Paying back technical debt means refactoring the application to undo those coding shortcuts, adding unit tests, making the application maintainable and adhering to best practices. The closer you are to the time you acquired the debt, the easier it is to pay it off. Think of credit cards; pay those off at the end of the month or else you accumulate interest.

Oh, and it's the interest payments that will really kill you.

Until you pay off that technical debt, every time you touch the application, you have to pay interest. In the past, you borrowed time from the future. Now the cruft in the code makes any subsequent task take longer. That is your interest payment. It comes off the top and you never pay it off until you remove the crufty code.

Code with high technical debt tends to be brittle. One change means everything breaks, so we spend our time being extra careful, or by accidentally creating a wide range of errors across the application. Interest makes programming harder, and harder is not what we need.

(Discuss with Disqus!)

The Single Greatest iPhone Ringtone Ever

posted under category: General on April 15, 2010 by Nathan

It's a simple concept, really. Think about it. What sound makes you sit up a little straighter? What sound makes you want to run forever? What sound makes you want to kick a turtle more than anything else you have ever heard in your lifetime?

The answer is obvious. You must be thinking of the invincible music from the original Super Mario Bros, circa 1985. As soon as you picked up the star, nothing could stop you. Fire breathing plants and flying fish fall by your wayside as you don the seizure-inducing clothes.

As a ringtone, this invincible music will own your attention every time. Your eyebrows will lift. Your heart will beat a little faster. Your hands may sweat.

As a final insult, as if you needed it, when you don't answer it soon enough, it goes into one minute left double time music. Yes, that's invincible on speed. Your b-sprint finger cannot handle ringtones of this magnitude.

USE WITH CAUTION

Download this Mario Bros Invincible iPhone Ringtone now!

It's 500KB, m4r, just add it to iTunes, sync and change your ringtone global or per-contact settings. I made it with Adobe Soundbooth using a free wav file I found somewhere, and I converted it to m4r with audiko.net. Not responsible for damage.

*Update: By request, an MP3 version for you lucky ducks using Android phones. 400KB.

(Discuss with Disqus!)

12 ways to reuse your ColdFusion code

posted under category: ColdFusion on April 8, 2010 by Nathan

It's no doubt that code reuse is an important part of programming. Here's a list of ways you can do it while you're programming in ColdFusion.

  1. <cfinclude template="file.cfm">
    This is the most basic server-side include, which pulls one file into another. There is no way to send parameters to the included file (besides setting variables before the include). The included template can by dynamic using a #variable#. Unlike classic ASP, the file is included only when the tag executes.

  2. include "file.cfm"
    This is the cfscript version of the cfinclude tag and behaves similarly.

  3. <cf_file attribute1="value1">
    This is Custom Tag syntax. You can use this to send parameters at an included file. In this example, file.cfm exists either in the relative current directory, in a custom tag path specified by your Application.cfc file, or in a custom tag path specified in the CF Administrator.

  4. <cfmodule [name= or template=] >
    Similar to the custom tag model, but you can use any file with a relative path.

  5. <cfimport namespace="imported"> ... <imported:file />
    Specify a directory and namespace, and you can use this JSP style include. The cfimport tag must be applied on every template you wish to use the namespaced file set in. Imported files behave like custom tags in that they use attributes and can have a closing tag, but it can also be used for JSP tagsets.

  6. <cffunction name="reusable"></cffunction>
    Defines a reusable function, method or subroutine of your application. You can type this anywhere in your application, except within another function.

  7. function reusable() {}
    This is the cfscript version of cffunction. Since CF9, it can use extra syntax to give more metadata and control like the tag-based version has.

  8. <cfcomponent> ... </cfcomponent>
    This is the root element of a .cfc file. Any code within is executed immediately upon instantiation (see cfobject). The methods (functions) within are executed upon request.

  9. component { ... }
    This is the cfscript version of defining a CFC. This also provides the only way to write cfscript without the cfscript tags.

  10. <cfobject >
    Creates an instance of (a.k.a. "instantiates") an object, which could be Java, .NET, a web service, or a variety of others, but in this case, we are talking about creating an instance of a ColdFusion Component (CFC) or ColdFusion web service.

  11. createObject("component", "myComponent")
    new myComponent()

    cfscript versions of cfobject and traditionally the easiest way to create an instance of any CFC.

  12. <cfinvoke>
    Invokes a method on an object or webservice, instantiated or not.

That's a big list!

(Discuss with Disqus!)

Solving the problem with too many choices

posted under category: ColdFusion on April 3, 2010 by Nathan

Yesterday I talked about how we have too many choices when people get started using ColdFusion. There were some really good comments, and the consensus was that more is always better. I agree with that, for the most part. I promised I would share my idea for a solution.

My opinion is that you have to try them all. Yeah that sucks but there's a lot of truth to it. You just can't get a feeling for a tool until you try to make something with it.

For an IDE, spend a week with it. For any type of framework, make a little sample app - I like to make a generic list-add-delete program, which gives me enough of a feel for where things go and how you interact with them. Experimentation is essential.

That's my opinion, but the solution is not good enough. What can we do so people don't have to try everything, every time?

I hate to point out problems without offering the solution, but worse yet, I hate offering a solution without offering to do any work. So here I am, a hater. If someone starts it, I would pitch in.

We need a wiki that compares and contrasts all of our options. They need to be categorized (like I did above), give a short description, explain the popularity (or lack thereof), show some screenshots or code, talk about how they work compared to other options, discuss downsides and difficulties that people have (especially problems that new initiates have, all in order to overcome them), and finally, provide links to the most popular resources.

The best we have as of today is Sean Corfield's framework comparison discussions. They're outdated now, and it was a valiant effort, but not good enough.

And with that, I'm going to end it abruptly, again.

(Discuss with Disqus!)

Are there too many choices in ColdFusion?

posted under category: ColdFusion on April 2, 2010 by Nathan

Too many choices is both a way to fail and a way to succeed. The choices make it undoubtedly more difficult to choose your development path. Let's talk about some of these choices.

IDEs: CFEclipse or ColdFusion Builder for Eclipse lovers. Dreamweaver and HomeSite for the traditional people. And then there is the plethora of other multi-purpose-but-supports-CF notepad replacements, including but not limited to: TextMate, Notepad++ and jEdit.

Front Controller Frameworks. Fusebox, Mach-II, Model-Glue, ColdBox, OnTap and CFWheels, not to mention the newer minimal frameworks, FB3Lite, LiteFront and FW/1.

ORM tools, from Transfer to Reactor, CFWheels' built-in ORM and Hibernate via CF9's ORM.

Bean Factory / Dependency Injection Frameworks, including ColdSpring, ColdSpring Lite and LightWire.

Servers: Adobe ColdFusion 8 or 9, in demo, developer, professional or enterprise flavors. BlueDragon JX, Java or .NET in enterprise or standard and Open BlueDragon, and Railo regular, express with Jetty, express with Resin or custom.

And that's leaving out most of the alternatives that are pure crap, as well as not even thinking about entire categories of applications like CMS', Blogs, Wikis, and so on.

There are a lot of things a new developer has to weed through. How do you choose?

This is sort of an abrupt ending, so I'll try to hit this again tomorrow.

(Discuss with Disqus!)

Front Controller Frameworks Suck

posted under category: ColdFusion on March 2, 2010 by Nathan

I always hated them for this one reason. How do you explain this URL:

www.example.com/index.cfm?fuseaction=main.default

What I dislike about that is...

  • It's hard for your users to remember or even type
  • It's ugly to see
  • Your web stats say everyone visited one page - index.cfm - they had different query strings, but they only visited one page
  • Your SEO is hurt. How does the googlebot know the difference in importance between the fuseaction query param over any other params? Sure, it's smart, it knows, but it can't really know, you know?
  • It reduces the number of results in this search

Really, it comes down to your users, their experience, and how they see your application. While it's not as important as your usability, design, content or uptime, it does take away from the overall quality.

So what can be done about this problem? Few have tried, some have succeeded. Here are the strategies that are out there.

  • CFM pages everywhere.
    This is generally the opposite of using a framework. All of the hassle, none of the benefit.
  • URL Rewriting. As requests come to the server with an attractive URI, they are translated into whatever your application needs to load it by.
    This is a good strategy, and it works well. On Windows with IIS, most of the software is either expensive or buggy, and definitely not portable. On Apache, mod_rewrite is great. Either way, you cannot make a cross-platform solution, meaning URL rewriting on an open source project is a no-go.
  • Generated CFM pages everywhere.
    You have software that spits out static files from dynamic actions in your framework, that call back in to your framework. In our example, a /main/default.cfm page would be generated that may set the fuseaction querystring parameter and invokes the framework. This is a great solution, but I've never heard of anyone putting it to practice. Writing this software is deceptively complex.
  • The OnMissingTemplate rerouting method.
    You link to pages that do not exist, then have an onMissingTemplate handler in your Application.cfc file that redirects requests to your framework with the right parameters. This new URL might look like example.com/main/default.cfm, which doesn't exist, so your onMissingTemplate method fakes like it's the ugly URL and invokes the framework.

Can anyone think of another method of doing it?

Personally, I like the OnMissingTemplate method a lot. The distinct advantage above the URL rewriting method is that this one is portable without installing other software. Of course it doesn't work everywhere, but it almost always will.

In summary, make your users happier and write your next application with a better SES strategy.

(Discuss with Disqus!)

Basic MVC is a Gateway Drug

posted under category: ColdFusion on February 24, 2010 by Nathan

My last blog entry was about how to create the easiest ever MVC application, but looking at it, you have to see where you'll just start repeating things all over the place. I mean, look at this code:

/app/controller/main.cfm

<cfinclude template="../model/main.cfm" />
<cfinclude template="../view/main.cfm" />

Are we going to have to do that for every controller? That's some serious boilerplate stuff that really shouldn't have to be typed every time. What a pain that would be!

So lets see what we can do to fix that. What we need is a generic controller that will do most of the job, most of the time, but allow us to do special work when we need it. I hate to use the "F" word, but I'm going to - this is a Framework. Worse yet, it's your standard run-of-the-mill front controller framework. I know, I hate it too, but hear me out.

There's a real easy, real obvious reason for doing it like that. No, I'm really not a fan, but I do it all the time, right along with everyone else. Let's see what it takes to make our MVC quasi-framework happen.

/app/controller.cfm
<cfparam name="action" default="main" />
<cftry>
  <cfinclude template="controller/#action#.cfm"/>
  <cfcatch />
</cftry>
<cftry>
  <cfinclude template="model/#action#.cfm"/>
  <cfcatch />
</cftry>
<cftry>
  <cfinclude template="view/#action#.cfm"/>
  <cfcatch />
</cftry>

Now hitting /app/controller.cfm?action=main includes the main controller, model and view automatically, and if they don't exist, it just ignores them. Easily done, no redundant typing, very little pain.

Congrats, we've just made a framework. It's cheap, but it works.

(Discuss with Disqus!)

Easiest Ever MVC with ColdFusion

posted under category: ColdFusion on February 17, 2010 by Nathan

Slowing down and backing up, this is a very quick introduction to making an MVC application in ColdFusion.

First, make yourself an appropriate directory structure. Follow along here, it's really simple.


There are a hundred a thousand infinite different ways to go from here. Let's try the most basic way I can think of. Your browser should always hit the controller no matter what, so let's put in an index.cfm to redirect /app/ visitors to a default controller, /app/controller/main.cfm.

/app/index.cfm

<cflocation url="controller/main.cfm" />

Now that main.cfm controller file: /app/controller/main.cfm
<cfinclude template="../model/main.cfm" />
<cfinclude template="../view/main.cfm" />

And the model: /app/model/main.cfm
<cfset name = "Nathan" />

Finally, the view: /app/view/main.cfm
<cfoutput>Hello, #name#!</cfoutput>

That is about as simple as an MVC application can be, and from there, you can begin to enjoy the advantages of MVC.

You can download this very simple MVC app.

(Discuss with Disqus!)

Reminder: Talk about the basics (and 6 reasons to do it)

posted under category: General on February 11, 2010 by Nathan

We tend to forget about the basics. Once we've mastered them, we move on to whatever else interests us. When beginning a learning project, we grow the most, we post the most questions, answers and blog entries, and we talk about our beginner problems the most. Later on, we stop talking about what it's like to get started, and for good reason, we're not getting started. It's out of sight, out of blog.

Take me, for instance. I have become so wrapped up in OO, design patterns, frameworks and extensibility, that I've nearly forgotten there are loads of new developers out there, hoping to learn something from the likes of me.

But big deal, why should we even talk about the basics? Well lucky for the universe, I've compiled this list, because we all love lists.

Talking about the basics...

  1. Gives you something to blog about
    I have like 2 posts for the entire year so far. I need some new subjects.
  2. Ups your search results ranking, bringing more traffic to your web site
    And who doesn't want more traffic? Not me, man, I want it all.
  3. Increases the stability of the global knowledge on the given subject
    Maybe esoteric and meta, but it's true. Sometimes old resources go dry, while new ones are usually prettier.
  4. Increases the keyword rank
    Increase the google trends ranking. Increase the general popularity of your subject. Get uninitiated people interested in a "that looks easy" kind of way.
  5. Gets uninitiated people interested
    If you have them saying "Hey, I can do that, it's easy" then you can add to the numbers of those working in your world.
  6. Guarantees your high place in the minds of the unknowing
    Readers like a hero, and you'll like people coming up to you, years later, expressing their gratitude.

So with that, I hereby to promise to talk about (at least a few) easier concepts, (at least a little) more often. I'll use this blog to do it. I promise to use my position as a ColdFusion software user's group manager for the benefit of newer programmers and recent and future converts.

(Discuss with Disqus!)

Like puzzle games? iPhone & iPod Touch users, try Relix

posted under category: General on January 4, 2010 by Nathan

A good friend of mine (and ColdFusion developer [see how I'm on topic {note the stylish use of nested parens}]) at work has been hitting iPhone development on his spare time to come up with this game Relix. I've been playing it tonight and am thoroughly perplexed at some of these puzzles, like level 12:



It's been fun playing it, and it's only a buck, on the app store now, plus you'll be helping a fellow programmer, one of the 'little guys.'

This should link to it - Relix, the puzzle game for iPhone & iPod Touch. Oh, and do check the video, it makes starting off way easier.

(Discuss with Disqus!)
Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.