A look back

Minutes to a new decade (I’m a programmer, the first item in a set is the 0th). Ten years ago tonight I was in a huge crowd in New Orleans watching Cowboy Mouth, holding my breath that Y2K wouldn’t really happen the way the worst scenarios said it could. The worst didn’t happen. Still the years haveĀ been pretty turbulent, with plenty of ups and downs.

I bought a part of the American Dreamā„¢ in the 00’s. There’s nothing that says “bright future” like signing a commitment for a few hundreds of thousands of dollars. Of course that’s balanced by the occupants of the house, my wife and two children, all three new additions to my life in the last ten years.

Then I was working as a contractor on a team of programmers for out-of-town customers. Since then I’ve gone through 5 job transitions and have mostly managed to land on my feet. I’ve got a good job and am doing interesting work that doesn’t look to end anytime soon.

As usual I wouldn’t have been able to tell you this is where I was headed ten years ago as I’m not a long term planner. I wouldn’t say that I’ve wasted the time however. How’s your decade been?

Posted in Uncategorized | Tagged | Leave a comment

Private Eyes (They're Watching You)

Posted on ajc.com in response to Bob Barr's op-ed on Eric Schmidt's recent interview on CNBC:

No, Mr. Barr, that's not what Mr. Schmidt is saying. He's saying that as our society embraces technology we tend to forget how easily that technology also allows others to find out what we are doing and saying. Virtually no technologies that people use daily are used in a manner that ensures the communications and actions can remain the private business of those using them. Some are intentionally public, some seem private but are easily made public (voicemail, text message, IM, email).

I'd be surprised if Google wants to turn over its data to anyone, that's where they make their money. But Mr. Schmidt is acknowledging the reality that the Patriot Act (that you voted for) can reach into many places and get data that would otherwise be (mostly) private. Your ire should be at best be directed inward or at the Department of Justice, not Google.

 

Posted in Uncategorized | Leave a comment

ImageSetBackgroundColor : Just say no.

At work I'm using the CFImage tags in CF8 to manipulate images to
create a rotating image carousel. For the images on the left and right
I was shearing them to create a poor man's perspective (cfimage has no
perspective function :-( ). The problem is that when you shear the
rectangle, there's a new triangular area created in the image as the
output of the function is still rectangular (that may not make sense if
you haven't used the imageShear function, go try it, I'll wait). That
new area has to have a color and by default it's white (I think, maybe
black). If you want the sheared image to fit in nicely to your webpage
you'll likely want that color to be set to something specific. I urge
you not to think, “Oh, well, I'll just use ImageSetBackgroundColor to
set the background color of the image.”

Instead take the sheared
image and paste it onto a rectangle that already is set to the color
you want. Why? I'm glad you asked. First, if you're using a PNG image
to shear, the ImageSetBackgroundColor function will cause the shear to
be applied to only parts of the image. Here's the situation: I've got
two images, one is of a happy little bunny, the second image has a two
layers (one is a gradient, the other is a 75% transparent rectangle).
The process I followed was to paste the layered image on top of the
bunny, then shear the resulting image object. When this is accomplished
without calling ImageSetBackgroundColor first all three pieces (bunny,
gradient, and translucent rectangle) shear uniformly. When I call
ImageSetBackgroundColor first, the translucent rectangle doesn't shear.
Changing the type of PNG generated in Fireworks had no effect as far as
I could tell.

Posted in Uncategorized | Leave a comment

Put your left foot in and wiggle it all about

I'm starting to do some iPhone development. I've got a decent handful of ideas that I think I can implement well. My hangup had been that I'm still stuck on a PowerBook and the iPhone SDK only works on an Intel-based Mac. Well, make that “is only supported” on an Intel-based Mac. Some enterprising people have figured out how to 1) trick the SDK installer to install the iPhone frameworks and tools on a PPC machine, and 2) how to trick the compiler into compiling on PPC as well. So I can go ahead and dive in before I can scrape together enough pennies to buy a MacBook (or (be still my beating heart) a MacBook Pro).

Objective-C has some interesting quirks. Some of the format looks like C but mostly it looks like bastardized Actionscript right now (mostly because I've just come off a long Flex project at work). Onward and upward!

Posted in OS X, iPhone | Leave a comment

Upgrading Mango on Linux

I've finally gotten around to upgrading Mango to 1.2.2 for this blog but it wasn't without adventure. Version 1.1 introduced an automated updater. The update process to 1.1 went without incident. But when I tried updating to 1.2.2, I got some file permissions errors. I'm running CFMX 7 on Linux. I've run into some file permissions error like this before so I had thought I solved them by creating a group that Apache and the files in the websites. But I still had the errors after resetting the permissions on the root for the blog. Then I discovered that CFMX wasn't running under any user name but as “nobody”. I cahnged that to a real user (created just for this) and then I was getting some errors when starting CFMX. I reset the ownership on all the CFMX files /opt/coldfusionmx, restarted and all was fine.

Posted in Coldfusion | Leave a comment

Changing the name of Flex templates

This is not my work. This is copied verbatim from http://www.morearty.com/blog/2006/12/11/changing-the-filenames-in-flex-builder-html-templates/ by Mike Morearty so I could have a copy of this if his site went down. File under “For Future Reference”:

 

Suppose you want the main HTML file that wraps your Flash app to be deployed as index.aspx instead of index.html. It’s a little trickier than you might think.

If you look in the html-template directory of your project, you will see that the main file is called index.template.html. This is a special name — Flex Builder recognizes filenameit, and says “Oh I know what that is,” and uses it to create MyApp.html and MyApp-debug.html in the bin folder.

But if you just rename it to index.template.aspx, you’ll have problems. Notice that after doing that, and then cleaning your project, you now have only index.aspx in the bin
folder. There are two issues with that: For one thing, the app name
isn’t part of the , which cause trouble if you have more than one app
in the project; and also, it doesn’t differentiate between the debug
and release versions of the file. If you examine it, you’ll see that it
contains a reference to MyApp-debug.swf. Where did the release one go?

The answer is that since the file no longer has the special index.template.html
name, Flex Builder doesn’t know what to do with it. It does see the
“.template” part of the name, and it uses that to decide that it should
do macro-substutition within the file; but beyond that, it does nothing
more.

And since there are two SWFs (release and debug), Flex Builder ends
up processing your file twice. First, it creates the release version of
index.aspx, then it creates the debug version of the same
file, overwriting the release version. (It probably should report an
error in this case, but it doesn’t.)

But the solution, it turns out, is very easy (although not at all obvious): Give the file the rather cryptic name of…

${application}${build_suffix}.template.aspx

That does the trick. The ${application} and ${build_suffix} macros are substituted when creating the filename that goes into the bin
directory (build_suffix is “” for the release build and “-debug” for
the debug build); and “.template” causes Flex Builder to do macro
substitution inside the file.

To wrap up:

  • Any file in the html-template directory can have macros in the
    filename. Substitution will be performed when using those template
    files to the create the files in the bin directory.
  • In addition, if any filename contains .template (either at the very end, or followed by a punctuation character such as “.”), then the contents of that file will have macro substitution performed, and the .template part will be removed from the filename when copying to the bin directory.
  • Finally, the name index.template.html is a special case, and is essentially equivalent to ${application}${build_suffix}.template.html.

So, what macros are available? ${project}, ${application}, ${version_major}, ${version_minor}, ${version_revision}, ${build_suffix}, ${swf}, ${bgcolor}, ${width}, ${height}, ${title}.

Posted in flex | Leave a comment

Q & A with Khoi Vinh

Those of you with a design bent may be familiar with the grid-based work of Khoi Vinh. What I didn't know was that he was the Design Director for nytimes.com. There's a Q&A with him online at their website.

Posted in Uncategorized | Leave a comment

Creating PDFs that automatically print via CFPDF and DDX

Here's the situation. A user is viewing a report online. The business owner of the application decided to provide a nice PDF format of the data, all the user needs to do is click a button, perhaps named “print”. The CF server generates the PDF, hands it off to the browser through either CFLOCATION or CFCONTENT. So now the user has the PDF loaded in a secondary window and have to go hunt for the print button again. But fear not, dear user! We'll save you by judicious use of XML, Javascript, and ColdFusion.

Some time ago (maybe Acrobat 7), Adobe added embedded Javascript to the PDF format (see the Acrobat JavaScript Scripting Guide). Among other things, this allows the creation of scripts that will execute whenever the PDF is opened in Acrobat Reader (and maybe, though I haven't tested it, with the Adobe PDF web browser plugin). And in ColdFusion 8, Adobe added the CFPDF tag, which allows access to a stripped down set of functions in the LiveCycle DDX format. DDX is an XML-based format for directing PDF manipulation. Currently the Livedocs entry for CFPDF lists a set of DDX elements that are explicitly supported and a set that are explicitly not supported. The Javascript element isn't included in either but it does work, possibly because it is a sub-element of the PDF element. So what we're going to do is to create a Javascript file that tells Reader to bring up the print document, a DDX file that will combine the Javascript file with the PDF, and a CFML file that uses CFPDF to bake it all together.

First, the Javascript file, printDocument.js:

this.print({
bUI: true
});

 

Second, the DDX file, embedPrintCommand.ddx:

 

And finally, the CFML script to bring it all home:

Hello World! The time is #timeFormat(now())#

<!--- setup the mapping for the source PDF files --->

<!--- setup the mapping for the result PDF files --->

<!--- process the PDF with the DDX file --->
   
   #result.outputPDF#

 

Save all three in the same directory and hit the CFML file in your web browser. You should get a helloWorld_out.pdf file. Open that in the Adobe Reader and shortly after opening you should see a print dialog. Pretty cool huh?

Posted in Coldfusion | Leave a comment

Now, where's the HEMI?

Jim Priest has an article up on the IBM DeveloperWorks site about Coldfusion coding with CFEclipse. In it he lists as a prerequisite, “ColdFusion V8 Developer Edition”. I like it! Who needs that puny 4-cylinder web app server, gimme the V8! Vroom vroom!

Posted in Coldfusion | Leave a comment

Integrating Google Webmaster Tools with MangoBlog

Yesterday I created a new MangoBlog plugin to insert the Google Webmaster Tools verification code into the HTML Head of your blog pages. This is a code that Google uses to verify that only owners of a site can see statistics about the site (see Google's help page on site verification for more information). In the not too distant future I'd like to expand the plugin to generate sitemaps as well. To download the plugin, click here

.

Posted in Coldfusion | Leave a comment