posted under category: AZCFUG on December 24, 2008 by Nathan
I know a lot of us out in the general work force really do a lot of work, and some of us put in way more hours than is healthy, but with the holidays being upon us, I'd like to suggest one thing: have other projects.
By other projects, I mean a personal project or an open source project where you can do what you do best, whether that's bean counting, programming or technical document writing, do what you do best and what you love to do (or at least loved to at one point), and do it on your own time outside of work. In having this other project, you give yourself a number of great opportunities.
First, you get freedom - be creative, do it on your own schedule, do it your way. Freedom ignites the passion you have for what you do. At work, you conform to rules, legacy problems, people problems, and things that make what you do not fun. Freedom from that structure makes things fun, and you can bring that fun back with you to your job, something everyone will appreciate.
You also get learning opportunities that you would never have when you're slaving away for a dollar. They want things done their way, and you have 2 hours to do it, while on your own time, you can try something new and it doesn't really matter how long it takes you. Be creative and come up with the best solution. Once you get there, you've probably learned something new. Keep at it until this becomes a point on your resume.
For me, I typically learn new programming frameworks and languages, and try creative methodologies that initially sound like they could never work. This eventually trickles down to work for me in ways that I thought never would. One of them was quite tangible in getting me hired at better places - the more I know, the more people want to hire me, and the more money they want to give me. I honestly didn't expect that. Strange, I know, I'm a little dense.
One of my pet projects is doing little things in C#. I find it fun and can't explain why. Playing with C# has made me a better programmer in general, as well as it has been able to solve some relevant issues in my day-to-day work where I use it for utility chores and small projects. I'm not saying that C# should be your project; I'm just throwing that out there.
At one previous company I worked at, one of the interview questions was about extra, non-work programming projects. This was literally one of the measures of how serious a candidate was at programming - if it was more than just a chore and if it bled over into a way of life. Lucky for me (... ?) you can almost never find me far from a keyboard, hacking away at something.
Finally, with completed projects, there's always the chance to monetize them one way or another. You never know if the project you've been kicking around has million dollar potential until you've put some real work into it.
Let me suggest some projects to get you started. If you like starting new things, make a personal web site, or one for your family. Be creative with where things come from (like Photoshop & Illustrator for design, your Flickr account for content, etc.). If you have one, be improving it. If you make something cool along the way, consider open sourcing it. If there's a tool you always wanted to use, make it. If there's some boilerplate code you keep re-typing on each project, make a real tool or framework out of it.
If you don't like starting new things, download code from an open source project, make a few improvements and send them in. Open source developers LOVE this. If they don't want to take the app in the same direction you're going, fork it and start your own project. This is a great addition to your resume as well.
In conclusion, I'm urging you to get a personal pet project of your own, or a few. It's good for everyone, most of all, yourself.
(Discuss with Disqus!)
posted under category: General on December 19, 2008 by Nathan
I've got a fever, and the only prescription is a bunch of ranting run-on sentences...
See, here's the problem with Microsoft's software platform, especially relating to ASP.NET, but they keep doing things like this: they went from having no MVC, where web sites feel like desktop app programming, except with HTML, which really just makes no sense whatsoever and is a retarded paradigm to program for even though they pulled it off fairly well even from the first version, to finally having some basic MVC support; things that the rest of the programming universe have been doing and loving, where they finally addressed the issues where they just suck at, acknowledging that maybe all the programmers out there in the world are smart and are basically right and that the feeling of needing to make maintainable applications that aren't ridiculous to update and work with and acknowledging that letting the developers do the HTML, CSS and Javascript to do their web-based apps might be a good thing because after all, they probably work on a team with designers and deselopers and the like and the developers have to eventually be sick of the stupid paradigm of being forced to use ASP.NET's web controls and having those things write all their tables and login forms because the code those output just really sucks and they can't get in and fix it and make it look like the designers really wanted without sacrificing a lamb, by introducing ASP.NET MVC late last year, which would finally let Java programmers in, and maybe even ColdFusion and Ruby guys as well because they can all do MVC even though ASP.NET couldn't, and would also just make the platform much more approachable by traditional web developers who understand the request/response model and who like to get their markup right enough to validate and who are always annoyed by Microsoft's web stack getting in their way because there's only 3rd party support for making a normal web site instead of postback and having the whole page be a form, which again, makes no sense, ok, from that, straight into the ASP.NET MVC Design Gallery, where the traditional ASP.NET desktop software developers - and yes, I said they make desktop applications in ASP.NET because there's no other real excuse or explanation for what you're doing when you work with ASP.NET except that you're posting back and responding to events exactly like a desktop app in visual studio where you double-click on a button and write a codebehind action for the click event where it makes sense for desktop applications but falls utterly flat on the web unless you actually are doing something special with the button's onClick event like popping up a 'loading' image so the user doesn't hit the link again - now they can download and apply a pre-made design so that suddenly your MVC app is friendly, and you don't really have to do HTML and CSS because that's for web people, and programmers aren't web people, they're programmers and shouldn't have to learn html because it's somehow too difficult to understand for a programmer because after all, the programmers doing ASP.NET and dragging their little web controls onto the stage and shying away form the HTML probably actually are too slow to learn something as 'challenging' as the div and span tags, or at least Microsoft has somehow formed the permanent opinion that they are and they coddle their developers and pet them on the head and say "it's alright, you don't have to do HTML." If you commit your life to programming on the Microsoft platform, I would pretty much promise you that you will never have to learn HTML, Javascript or CSS, just C# or better yet, VB because then you can do vbscript too and program in classic ASP or make windows scripts and macros for Excel which is really all your business wants anyway. Imagine a programmer who never learns anything about what they're doing or what platform they're working on, then imagine armies of them crying and whining until Microsoft gives in and releases something that takes them from zero to hero, but you have to do it this one certain way and whenever you deviate off the path you're out of range, even for some clever googling because no one else has ever gone that path and that error number is so obscure that Microsoft would really rather that you never saw it so the MSDN page for it says something about how to get back on the right course because you tried to change the font tag to a span with a class and they didn't expect you to know what you were doing so you should leave it because, after all, IE v.16 still supports the font tag even though firefox had disbanded it 22 years after the standards committees threw the tag out and they figured no one would actually have software that generated a font tag because that would be ludicrous.
Dear Microsoft, make the developers on your platform grow some brains and learn a little about HTTP and a little about forms and links, where the Javascript goes and where CSS fits in, and how to write a multi-page form without postback (even though postback is a clever solution). See, it's too hard to know why we would implement a pattern (like postback or MVC) until we've suffered without it. There's no reason for an ASP.NET desktop programmer - yeah, i said it again - to switch to MVC (other than it's new and now has a design gallery) because MVC doesn't solve any of their problems, and MVC is better for making web applications that work together and have reusable parts and are well managed but it's not so good for just web pages, and who knows, I'm sure there will always be a market for those end-developers who really just want a web page with a login form and a table from the database and they want to call it an application even though the only cohesion it has with the rest of the pages is a link to another page and it has no reusability or management from the standpoint of the application as a whole and all the code is on the page or in a partial class which might as well be on the page except that now you have to have 2 files open in visual studio as if to prove the point that Microsoft is always trying to solve the wrong problem. Maybe if you allow ASP.NET to really be a part of the web instead of this alien spaceship that visits the web when it feels like it, then we'll drop some of the dead weight out of the programming chairs, as if the programming industry could downsize itself based on IQ, or better yet, it would let people learn some of what's really going on and how technology works and would excite them and make programming on your platform as fun and rewarding as we all know it can be like when you solve your first big problem and even though your manager wouldn't ever understand the programming difficulty you just overcame, you know you did it and you did it well, and it's 4:50 Friday afternoon so you can free your mind to have a relaxing the weekend and everything just feels right.
I like ASP.NET MVC. I really do, but I do not think it should be the first point of entry for a new developer getting into web development. I even somewhat like ASP.NET and web forms, although, I suppose in another way, I also despise them with the fire of a thousand suns, so it's maybe 50/50 what I'll feel depending on my caffeine intake for the day, but I don't think ASP.NET and web forms should be a new web developer's entry point into web development. It just isn't right. What is right? JSP is close, as it's still fairly modern and can be upgraded into an MVC pattern (many frameworks are available) as the developer matures, except for the complexity, specifically with getting your server up and running, and learning about beans and stuff, it's just overkill and that is a rant for a different day. PHP would work, except that when you look at the language you see C versus Perl with an out of control language library that could choke three camels. Ruby on Rails is a magical UFO that does MVC - too much code generation that hides what the world wide web does, not a good starter. Classic ASP, not really a language as much as a lightweight platform, and it's coupled usually with vbscript, I would say avoid it because, while not technically end-of-life, it hasn't seen any activity since ASP.NET came out in 2002 and is no longer considered modern. That leaves us with ColdFusion, which is perfect with its syntax that's similar to HTML and javascript without performing any type of web magic that can't be deduced by just looking at it, easy debugging, easy database connections, the ability to move into object oriented concepts and some well supported frameworks that give you as much MVC as you can wish for. As much as ColdFusion is touted for its ease of programming, it also doesn't hide the real web from you - it just makes it easy to get to.
(Discuss with Disqus!)
posted under category: ColdFusion on December 14, 2008 by Nathan
We've heard it, we may have seen it in action. If you have ever asked yourself "why," this is for you.
(BTW, I'm just going to call it a "facade" because "façade" is too difficult for my keyboard to produce)
The Pattern
A facade is a fake front, like a mask. A session facade hides away the "complexity" of using a session.
The session facade is the point-of-contact for your session variables. Using one, we no longer have a session scope that you can talk to, now we talk to the facade. The facade offers basic bean methods with generic names - get(), set() and delete(), or a variation on the theme.
Dave Ross has pretty much the definitive ColdFusion Session Facade article (2 pages worth and sample code) - how to use it and all. I'm just considering the usefulness of it.
That sucks
Instead of #session.username#
, now we can just type #application.objectFactory.getBean('sessionFacade').getData('username')#
and the session facade will handle the dirty work of typing the scope name "session" for us. Finally, more typing!
So now that we're typing more, we also have to learn a new API for managing the session scope. What if we use get, put and delete methods and our friend Bob Bobbery uses get, set, remove, clear, search, etc, etc? More to learn equals more complexity.
And what problem exactly did this fix? We had a session scope before, and we technically still have it. Nothing forces the bad coders on our eam to use it. Nothing really changes, assuming the facade just gets and sets variables from the session scope. It just added another CFC to manage and a bunch of extra code.
The final problem is that the session facade doesn't do anything to manage the session, to organize it, report on it, fix problems that could occur or reduce complexity. It's typically just a dumb bean with variables.* replaced with session.*. It's useless.
Oh, that might be cool
We programmers are managing change. That's one of the things that we do, and hopefully, we will do it well. What if the session scope goes away... no not likely, but with a session facade, we have the mechanism to manage every variable in and out of the session scope. We could reroute it to a database.
The session scope could disappear due to an administrative switch. On a hosted server, we may have no choice. The session facade could then be changed to get essential data from the database at every request.
What if, to reduce server memory, we want to put certain variables, or certain types of variables in our database. The session facade could be made to leave some things on disk, some in memory. A little brains can be added without touching the rest of the application.
What if we want to write a log event every time something goes in and out of the session scope? The session facade is basically our only option for this. The only other way would be to search our code for the word 'session' and add a cflog on each event. With a session facade object, we can do logging or any other type of thing all in one place. Not bad.
Perhaps we may want to cflock each session access because of some potentially unsafe code reading and writing to one variable - we can do that easily here by exclusively locking the set method and readonly locking the get method, using a unique session key to name the lock.
In summary
In summary, the choice to use a session facade should be based on the risk of drastic session scope change. The benefits seem to be a lot of 'what if' scenarios, but they could happen, maybe, while the drawbacks seem to pay off right away. Laziness now or laziness later?
(Discuss with Disqus!)
posted under category: AZCFUG on December 10, 2008 by Nathan
Hey everyone in the Phoenix valley - This month's AZCFUG meeting is going to be super-casual. We're going to Aunt Chilada's in Tempe next Wednesday, the 17th at 6:30. As usual, we will probably be out back somewhere, so look around until you find us.
There's an official post at our Adobe Groups site with a little more info.
The agenda? Nachos, the user group and giving away our schwag. Buy your own drinks, but bring something to say about the CFUG.
I'll get you started.
"I think one cool idea for a meeting next year would be __________."
"I think Alan would look better if his hair __________."
"I think, in regards to virtual presenters, we should __________."
"I would like to do a presentation on __________."
Oh snap, did I just involve the community?
(Discuss with Disqus!)
posted under category: ColdFusion on December 9, 2008 by Nathan
We've all heard it a thousand times. "VAR YOUR VARIABLES !" But why? You say, "I've never had that problem" and I'll tell you what, you probably wouldn't know it if you saw it. Pay attention here.
Let's take a simple ColdFusion function, easy stuff here. Dead simple.
<cffunction name="runMyCode">
<cfset result = 1 />
<cfloop from="1" to="5" index="i">
<cfset result = result * i />
</cfloop>
<cfreturn result />
</cffunction>
What's the harm?
Ok, so you hit your page, which calls this code tucked away safely in a CFC. You put that CFC in the application scope because that's the Singleton pattern, or something like it and it runs faster. You get a good result (120). Great. Hit it again, no problem. Write a unit test if you want, it passes every time.
Now, put that out on production. I dare you.
Minutes later, your phone rings. Bill Billings, your most loyal customer calls up. He must be your most loyal customer, because it's only loyal customers or especially angry customers that ever call. He sounds angry and you rethink Bill's loyalty. Bill says "What's the idea? I got '7200' when I know I was supposed to get 120!" And you're pretty sure he was supposed to get 120. I mean, that's what the function does. It just returns 120. You tested it! You tell Bill that you'll look at it and brush him off because you're busy coding. Check your glasses, Bill. Check your glasses.
As soon as you get off the phone, it's Sally Sallington, another loyal customer calling, asking how she got 518400000 from something that should really be giving something closer to 120. Oh man. Now you have a problem.
Interestingly, your customers are getting round numbers, and they are both divisible by 120.
The Java thread model
If you get the sense that java is screwing with you, you're on to something. What you failed to test for was multithreaded access to your method. When Bob and Sally hit that method at the same time, anything can happen.
You've got 2 users, so 2 threads running some code. Java has to make sure that both requests are satisfied as quickly as possible. How does it do that? Well Java will flip-flop between which thread is running, basically, on a whim. Maybe Bill will run through the loop 3 times and stop before the multiplication line, then Sally will just start the loop. Bill will run another 1 time around the loop, then Sally's thread takes a turn going 2 loops, stopping after the multiplication line.
Both variables in the function, result and i are being shared between everyone who runs the function. Bill sets result to 1, then 5, then 10, at which point, Sally may come in and set result back to 1, or pick up Bill's 10 at the start of the loop and go from there. It's impossible to say what exactly will happen. It's part of the magic of Java.
Why did they do it that way?
Why does Java's threading flip-flop between the active threads? Why can't it just finish one and then start the next? Well then you wouldn't be running a multi-threaded application server, would you?
Then there's HotSpot - Java optimizes code as it runs and chooses the best path while it's running. As far as I know, it's literal, actual, magic. There's no way to know what it will do.
Also, usually your code isn't quite that simple. You put <cfquery>
tags in there which could even be on a different server, maybe component instantiation calls that have to go to disk to pull in the CFC in, compile it and call it. While Java waits for the network or the disk or whatever else, it handles the other requests that are waiting.
But I have a 4-CPU, 4-core server
Oh, that's not going to help. Now Java can literally do the same operation across 16 threads at the exact same time. You're really in trouble.
read on for the stunning conclusion...
But my 'V' key is broken
Ok, so let's pretend that you can't fix your code. You really just don't have the budget or something. What can you do? Well, you can change the maximum number of simultaneous threads to 1 from your ColdFusion administrator tool. By not letting anyone do anything concurrently, you have solved your problem and made a new one: now your web site is slow. Another idea, instead of adding 'var' statements, you can exclusively lock calls to methods that have not properly varred their variables. It's a terrible workaround, but would allow more things to happen simultaneously while still single-threading the danger zones. Still, that could be a lot of work instead of fixing the root cause which is almost always going to be simpler.
How do I know what to 'var'?
Use the VarScoper tool! It's painless and simple. It's a friendly ColdFusion program that runs on a CF server. It reports every unvarred variable that it can find in a given CFC or directory structure, tells you what method it was in, tells you which variable it is and what line number it was first found on. The varScoper is truly a great piece of software. Run it frequently, say, weekly, to make sure things are still good.
There are exceptions to the rule
Yes, caveats exist. Specifically, if you are running CFMX 6.1 (No one should run 6.0 or earlier. No one.), you cannot var cfhttp. It just won't work. Don't try it. This is a time when you have to cflock any code that makes an HTTP call. There may be others, but this is off the top of my head, and again, it's CFMX6.1 only.
The right code
Some people requested the corrected code, so here it is:
<cffunction name="runMyCode">
<cfset var result = 1 />
<cfset var i = 1 />
<cfloop from="1" to="5" index="i">
<cfset result = result * i />
</cfloop>
<cfreturn result />
</cffunction>
This function will run with no problems. Also, check out the comments below where Ike shows us the dangers of using variables outside of functions, and Adam Cameron gives a very common example of functions calling each other, each using the generic "i" loop iterator variable, and conflicting with each other.
Thanks everyone out there for your constructive comments!
Wrapping up
Here's the quick summary, speedy delivery, Mr. McFeely style. Var all your ColdFusion function variables, learn about scopes and threading, run the varScoper tool often. Everyone will be happier.
(Discuss with Disqus!)
posted under category: Free Code For You on November 10, 2008 by Nathan
Hey all - quick note to let you all know that I issued my first commit of many into the SQL Surfer project. No real single-file download yet, but you can download the source and build your own with Eclipse, Ant and Groovy (if you dare!).
I'll share some more ideas with you all as I progress.
(Discuss with Disqus!)
posted under category: General on October 30, 2008 by Nathan
Reuse-in-the-small is a solved problem. Reuse-in-the-large remains a mostly unsolved problem.
Jeff Atwood from Robert Glass, Facts and Fallacies of Software Engineering
I'm actively hacking at my latest toy project, which integrates a few 3rd party projects, and I had the thought, integrating a library, like jQuery, is drastically simpler than integrating a whole application, like a discussion board or WYSIWYG text editor. How do you solve these problems?
A few years ago I attempted to drop Ray Camden's Galleon Forums into another project. My app was Fusebox, so I had to rewire some of the front end, then move the component calls back out to the circuit. Sounds fairly easy, but with 3 gaping problems.
1st, the client calls and we have to modify it heavily. It turned out the only thing Ray's app was good for, was a starter kit on the database and DAO templates.
2nd, Ray puts out a new version with features we like, avatars, BBcode and signatures. We were so far out of sync that there's no way we could implement his new version.
3rd, I was never sure how stable the rewritten code was (turns out it was ok, but I was crossing my fingers).
Result: Thanks for the starter kit, now I'm on my own.
Fast-forward a few years to my new project, and I've started integrating Edit Area, a javascript code editor, into my application. Edit Area presents a few challenges, including the build program written in PHP and the authors not being native English speakers. Also, I have some application requirements, such as no externally linked files, and oh yeah, it has to work right (grrr).
So, how do I make changes to the application while keeping myself open to future versions?
The method I chose was to make changes to Edit Area in my build file. Ant calls Groovy. Groovy reads in their file and turns it into my file, which my program includes. It is repeatable but not destructive. When the next version comes out that fixes some of my problems (and I do hope it does), it will be mostly zero effort to update my code. Their changes could break my build temporarily, but I can tweak and adapt.
The biggest issue here is the challenge of meta-programming, or programming programs to reprogram programs. It's a lot of trial and error to get it right, and a lot of regular expressions. Also, Ant isn't exactly a real programming language, so I have Ant run a Groovy script. It's initial complexity to solve a repeating problem, which is a fair trade to me.
Result: Brainiacs only, but it works well.
(Discuss with Disqus!)
posted under category: Free Code For You on October 19, 2008 by Nathan
I kind of went overboard on the languages & platforms with SQL Surfer 2.0, which I first mentioned early yesterday morning. Luckily, the finished product is just running CF/HTML/CSS/JS (That's 4).
The build process uses C# (+1) to customize fixes to Edit Area.
I used a batch file (+1) to copy the C# exe to my dev folder.
The build file is Ant (+1), and Ant is in XML (+1).
The build file uses groovy (+1) to replace some includes with actual content.
Total count: 9 different platforms, languages or technologies. Not bad for a little SQL tool.
UPDATE 10/23: I move the c# asynchronous process into Groovy during the build process, so that removes 2. That puts me down to 7 now.
(Discuss with Disqus!)
posted under category: Free Code For You on October 18, 2008 by Nathan
My wife has been on me to work on some projects that will make us money. Instead, she's seen me hacking away at this little toy. SQL Surfer 2.0 is a web 2.0 style SQL query editor. I've been playing with it for a few weeks now, and I've got to say, it really is starting to rock.
I had this old version, version 1, which was like your basic postback SQL tool in 200 lines of code. Well into 4 years old now, I was still using it, and i felt completely ashamed. Bad programmer. It looks lame, it works lame, but at least it worked. It had some cool ideas, like how it has a 1-file deployment for the whole thing - drop it in anywhere and it just works. Also, I like how it saves everything you run into a history box, but even that was limited.
SQL Surfer 2.0 brings the whole thing into web 2.0. I'm playing with some CF8 features now, but I hope to also deploy a CF6 compatible version. As always, I'm having trouble getting it to look right in Internet Explorer. I'm planning a beta "soon," so this is like a heads-up teaser.
Yeah I know the concept is like a solved problem. Ray Camden has the Database Explorer and Todd Sharp with Genesis, but I think I have a unique twist on the subject. More to come as I prep this one.
(Discuss with Disqus!)
posted under category: Life Events on October 6, 2008 by Nathan
I had completely promised myself that I would NOT join MySpace, just as a fundamental stand against poor web design, even if they did write it with my favorite programming language. As a result, I had mentally discarded social networks in general, but, when you get married, you know, you make some compromises. So anyways, a few weeks ago, Alanda talked me into joining Facebook (in exchange for me taking out the garbage and cutting down a tree and giving her a massage -- I think she got the better end of the deal).
If you don't know social networks, basically, you find all your friends and talk about yourself so they can keep up with your life. It's less formal than a phone call or even an email, but better than spreading hearsay and 3rd hand information. Then they can comment on what you say and vice versa.
Facebook is especially nice in that the usability of the site is fantastic and the design is consistent throughout. Pretty much any activity I would like to do from any given area is already there. Thus far, they've thought of everything. As far as social web sites, including ones I've worked on, it's the best I've seen, by far.
Just in this past few weeks I've found a friend from school I didn't know was living in town. Anyways, if you feel like it, come look me up.
(Discuss with Disqus!)
posted under category: General on October 3, 2008 by Nathan
A few days ago, Tony Petruzzi posted "It's official: jQuery wins!" I took it with a grain of salt, but left it in the back of my mind. Then today, I saw the State of jQuery '08 slideshow. Now, I think Tony was right.
(Discuss with Disqus!)
posted under category: Database on September 26, 2008 by Nathan
Along the trail of web-based ad-hoc query tools, I also have the need to back up my database from time to time. Having no direct connection to SQL Server across the internet on my host, I can't just use the SQL Server tools to do it.
Another scenario: a couple weeks ago I installed SQL Server Express 2008 64 bit. It's been running really well on Vista 64 and working fantastically with ColdFusion 8. The problem is, I had to recreate a local copy of dopefly.com's database (it runs the blogs and family photos apps). Then, I knew I wanted to populate it with some data, as close to the live data as possible. This is a pain because the only way to get the structure is to eyeball and hand-jam it. yuck, no thanks.
Well, I came up with a pretty good solution for myself, but I was hoping to get some advice from other people as to how they would do it. Any ideas out there?
(Discuss with Disqus!)
posted under category: Free Code For You on September 23, 2008 by Nathan
So after nearly a year of sitting on Pagination 1.0 RC, I finally have the 1.0 release of the data paging library for ColdFusion.
The only thing in the 1.0 final version that I changed from the release candidate was the error messages. Most of the questions I had were about why they were getting a variable doesn't exist type error. Turns out they didn't call init() or didn't set the queryToPaginate item. I added some checking and some cfthrows to better explain what is happening.
Pagination.cfc is available to download at RIAForge, and the subversion repository has all the files as well.
(Discuss with Disqus!)
posted under category: Database on September 19, 2008 by Nathan
I was just thinking about managing my database here on Dopefly. I don't have direct SQL access to the server (SQL Server 2000), so there's no using SQL Manager to do things. That sort of leaves me with FTPing my ad-hoc queries to the server and running one at a time (no please). That sucks, so my real solution was to make a web-based ad-hoc query tool, SQLSurfer (warning, old code!). I've got an admin area of the site here in a secured directory, so it's basically secure & safe, but I would not recommend installing it anywhere public, or anywhere that a client could find. Generally, I just use it for local development when I don't want to open big clunky tools.
The need for an ad-hoc query tool is debatable, but I would say it is needed just to verify my data validity and run some small reports, like, I don't have a screen that will display the most recent comments on the blog, reversed by date (for spam checking when my email was down). Or what about when I am trying to remember the names of my tables when I don't have a local copy running - it's perfect.
I'm sure I'm not the only one to have this general problem, so my question to you is - do you have a web-based ad-hoc query tool? What tools do you use? Really, I guess it comes down to how do you solve the problem?
The reason behind this is that I'm thinking of updating the old SqlSurfer (run a selected block of code, better history management, ajax), but am wondering if anyone has anything better already.
(Discuss with Disqus!)
posted under category: ColdFusion on September 16, 2008 by Nathan
I've got a few of these types of entries lined up. If you have a blog, post your own!.
<cflock name="#createUUID()#" type="exclusive" timeout="30">
This code creates a uniquely named exclusive lock - that's an oxymoron. If the name of the lock is unique every time this code runs, the cflock will never lock anything until somehow, magically, createUUID() returns the same value twice, within 30 seconds (right, not very likely).
(Discuss with Disqus!)
posted under category: Software Quality on September 6, 2008 by Nathan
Selenium is an open source, simple web site testing and automation platform. I say it's a "platform" because it can't really be classified as just a tool, a language, API or a full application, but rather to a degree, all of these.
The basic idea is to create, using very plain, easy HTML, a repeatable script that is then executed by a Selenium runner.
I recommend using the Selenium IDE to create your first script. It's an add-on to IE and Firefox that records your clicks. Save it to a file (it generates plain HTML) and you can repeat it later on. It won't always work perfectly, however, so you can edit it with any text or HTML editor. You just need a Selenium language reference to get by.
Selenium actions and accessors are the language you program your scripts in. Generally, you would use the click
action, type
to enter values into forms and things like assertText
to make sure certain content exists.
One part of using the language you will have trouble with is selecting elements. Hopefully, you use uniquely named text links everywhere. If not, Selenium supports XPath very nicely. For me, it's a matter of sprucing up my XPath skills, something I wanted to do anyway.
Selenium scripts consist of a table with three columns. The first column is the action to perform. The second column is like the first argument of a function, usually this is the item to perform the action on and is almost always used. The third column is like the second argument in a function, usually the content of the action like the text to enter into the form item from the second arg. This column is not always used.
Selenium scripts must run within your web browser, however, different tools to automate your browser exist:
The Selenium IDE will run a file off your disk. This is perfect for single scripts and quick browser automation.
Selenium Core is a javascript application that runs on your web site - put it on your dev/QA site. Being a javascript application, there is no server-side interaction and nothing to install. This method requires your scripts to live on the local web site as well (browser security). This is actually very natural feeling, as then you can check them into your source control (you HAVE source control, right?).
(jump break)
Selenium RC (remote control) allows you to control tests from a remote browser on a different server. It even allows you to take screenshots. I haven't used this yet.
If you are testing a large application, you should make a test suite. It's a simple HTML document that links to your different test cases. With Selenium Core, you can load your suite and run all your cases in order. It will go through each one and give you a pass/fail summary like any good QA tool.
You can also use Selenium for easy web automation. I used it, for example, to automate the steps needed to log into a timer system and enter my daily time.
Selenium goes much deeper than this, but my blog post doesn't. Read up about it on the OpenQA web site.
(Discuss with Disqus!)
posted under category: AZCFUG on August 26, 2008 by Nathan
Oh man, only 2 posts since last month's meeting. Am I ever slacking. Anyway, tomorrow, Wednesday, August 27, 2008, is another valley-of-the-sun CFUG meeting in Tempe. Jim Bambrough from Amkor is going to be talking about Mach-II and Eclipse, and giving us basically a nice overview of the technology he uses and how he uses it. It should be good.
As always, there's door prizes and stuff just for showing up. Check the site for details and directions: azcfug.org.
(Discuss with Disqus!)
posted under category: CFEclipse on August 11, 2008 by Nathan
I've heard it 2 times in the last week that people are having trouble using the find features in Eclipse, so I thought I might be able to help a little.
#1 - Refresh your project files automatically
#2 - The search dialog box
Hit the link to read it.
#1 - Refresh your project files automatically
Eclipse caches and indexes your code, and when you search, it does not always go back to disk to re-index them. If Eclipse detects that some files are out of date and have not been refreshed, it will just skip them while searching. The solution is to either set up automatic file refreshing or refresh manually. Manually refreshing your files means selecting the part you want to refresh on the Navigator view and pressing the F5 key. You select the root of what exactly you want to refresh, so to refresh a project, select the project root and hit F5. This is not the dreamweaver site refresh thing that makes your IDE crawl while it indexes. It politely runs it in the background in ways you won't even notice it. Do yourself a favor and turn it on:
Open the preferences superdialog - Window > Preferences
Navigate to General > Workspace
Check the "Refresh automatically" checkbox
Hit OK
If you open a project that was closed (right click, open / close project options), these projects are typically out of date, so whenever I open a project, I manually refresh the files first thing.
#2 - The search dialog box
Pressing CTRL + H or navigating to Search > Search brings up the extended search dialog. In Eclipse 3.4, there is a Customize button on the bottom that will allow you to toggle on and off search types that you do or don't want to use. I turn off everything but the "File Search" tab. Seriously, this is the one you need.
The File Name Patterns text field is what files you are searching in. You can put it at "*" to search everything, but I have it at "*.cfc, *.cfm, *.css, *.html, *.js, *.xml" which is all of the relevant files in my project. This field has a limited memory from search to search but sometimes erases entries, so don't trust it.
The Scope area is important.
If you select "Workspace," you will search all of your projects, which may take a while.
If you selected one or more projects, folders or files in the Navigator view, you can search "Selected resources" - this is what I do 99% of the time.
If you have an open file selected instead of items in the navigator, you can search "Enclosing Projects", meaning projects of the files that you have open.
If you have a working set, you can select it here to search, but be careful that the working set contains all the files you are interested in, sometimes they will not see new files.
You can search just for files by name if you leave the "Containing text" area empty.
If you install Aptana, you can use a multiline search. Yep, just like old HomeSite or Dreamweaver.
If that doesn't do it for you, I don't know what will. Anyone care to comment on what other problems they may be having with searching from Eclipse? I've got to say, it works so good for me that I'm shocked when I hear people are having trouble.
(Discuss with Disqus!)
posted under category: General on July 29, 2008 by Nathan
At work, we are required to take 5 days of training this year. This is a challenge for me on a few levels. First, I have a new baby at home, so I don't want to leave the Phoenix area. Second, I'm having trouble finding classes that are open and applicable to me.
I have a SQL Server background, and I'm using Oracle, so I tried to get into a good Oracle class, but it was cancelled, so now, I'm weighing Java and .NET among others.
Unfortunately, at this point, it's quickly turning into an annoyance that i just have to 'fix' instead of the terrific learning opportunity that I'm sure it was meant to be.
If anyone has any suggestions, I'm all ears.
(Discuss with Disqus!)
posted under category: AZCFUG on July 24, 2008 by Nathan
Bryan did an awesome job at conveying how simple it is to begin using Java in our CF applications, how helpful Eclipse is for Java development, how to make a simple Java GUI with NetBeans, how to work with the Java threading model, how to use a generic JDBC driver (jTDS) and how to create Excel files with Apache POI. It was awesome how much he covered in about 30 minutes. Bryan was well prepared as well, which was great because I only gave him like a week to prep (sorry!).
We don't have anything planned for the August meeting, so we're looking for volunteers!
As a final note, Alan asked me to co-manage the group with him, which I accepted. I guess I was the heir to the schwag box anyway, so this way he doesn't have to die first. It's good all around because I hate doing that. (yeah, of course i'm kidding).
(Discuss with Disqus!)
posted under category: General on July 15, 2008 by Nathan
With my old MCE experiences blogged, now it is time to discuss my upgraded Media Center PC. No, we're not going Tivo, that would be ridiculous. We are, however going completely off-the-shelf this time. For not much more than the price of a nice Blu-Ray player, we purchased a PC with one included, from woot. Here are the key PC stats:
- Quad-core CPU, perfect for encoding and decoding video, and doing multiple tasks all at once, but higer electricity costs
- Windows Vista Home Premium - I hear the upgraded media center software is fantastic
- 3GB of RAM - 10x more than I ever used on my old HTPC, but will be nice because of Vista
- High-def TV tuner with cable and atsc inputs - I doubt it has hardware MPEG encoding, but the recorded content will be mostly standard definition cable
- Blu-Ray/HD DVD combo drive - I guess it was a clearance item
- Two, 500GB SATA drives - 1TB total. If it has an IDE channel, I might bring over a 320GB drive from the old DVR
- Card reader - a big plus, considering it is our digital photo center
- 8-channel audio - I wish it was digital audio, but it is an upgrade from 6 channel
Additionally, we made 2 changes in the home network:
- We upgraded the router to 802.11n - now file access will be faster from other PCs
- We moved the router and cable modem over to the entertainment center; now the HTPC connects via 1Gb ethernet, as it has no WiFi adapter
Overall, this will be a good, much needed upgrade. We've been enjoying having an XP media center so much, I think that with a faster CPU, it can only get better.
(Discuss with Disqus!)
posted under category: General on July 10, 2008 by Nathan
A couple years ago, I wrote about my experiences with building my first Media Center PC - a low powered, half-purchased, half-constructed PC, DVR, file server and entertainment center based on Windows XP MCE. Since then, I've discovered a few things that have been working really well, and a few things that have not. These are my experiences.
Things that worked really well:
- Low powered CPU - budget-wise, has been nice on the electricity bill, considering this PC is on 24/7
- Purchased instead of built the core components - this gave me rock-solid stability, rebooting mostly just for an occasional sound glitch
- Recycling old IDE HDDs - gave me about 750GB of total storage
- DVD cataloging - We just put unwatched or often-watched movies on the HDD so we don't have to relocate the discs
- uTorrent's WebUI - I can access it from my desktop PC, which is only on occasionally, and have my media center download torrents 24/7
- MCE's movie library - allows us to access DVDs, Divx and home movies across multiple HDDs
- File server as a central location for our gigantic digital photo library
- 6 channel audio - even though our receiver supports 7.1, we only have a 5.1 speaker setup anyway
(jump break - things that sucked up next)
Things that did not work so well:
- Low powered, single core CPU - clocking in at 1.4GHz, I have roughly enough CPU to record 1 live TV show and, just barely, watch another
- Single TV Tuner - I want to record more than one show at a time - Windows can handle more, the CPU can't
- Nero software - burning shows onto a DVD was incredibly time-consuming. Again, this is probably CPU related
- Inability to play HD content - my plasma TV loves it, but the CPU is too weak - I get low frame rates, then the audio stutters, then the video
- IDE HDDs - No SATA support means I maxed out my available IDE channels with 3 HDDs and a DVD drive
- 802.11g with a cheap USB 1.1 adapter - it is online, but moving files across then network is slow
- Web Guide - Microsoft's free software to access MCE functionality over HTTP has CPU and network bandwidth requirements beyond my setup
- Media Center music library - my hundreds of albums slow the library to a crawl while they are fine in Windows Media Player
- Access permissions between users and PCs is annoying with workgroup networking, and having a domain server is overkill
Other miscellaneous thoughts:
- I have about 640MB of RAM, which doesn't seem to even matter; I rarely use more than 300
- The Windows MCE license came from an MSDN subscription, and I did do some development and testing with it, but I'm probably using it for more than the license permits
- I had originally tried to use Ubuntu + MythTV, but gave up in compatibility and configuration frustration
- Thanks to my CPU issue, I can't even consider upgrading it to Vista
My upgrade is coming soon...
(Discuss with Disqus!)
posted under category: ColdFusion on June 20, 2008 by Nathan
Adobe has graciously granted a copy of ColdFusion 8 to the AZCFUG, and, by physical proximity (my site is on their server), Dopefly has been updated to CF8.
Amazingly, this is the first application I've gotten to work on CF8 with, and it's about time!
Thank you Adobe!
(Discuss with Disqus!)
posted under category: General on June 18, 2008 by Nathan
My mother-in-law passed away last month, and I haven't really had anything to say here since then. I have some pre-written stuff, I just didn't really feel like posting it. We're still coping with the loss.
At work, I just got a major release out of the way. It was 6 months in the making, so my boss is prodding me to become "agile," as in, regular releases with smaller changes. I agree, so I'll be experimenting with it. A year or so ago we had a client who demanded us to work with their agile process, which was just a huge, uncomfortable time wasting disaster. It makes sense in development teams, not so much in a business end where you're paying developers in another company, halfway around the globe, by the 6-minute increment to sit in your daily hour-long "scrum" calls. That was just set up for failure from the start.
I had some thoughts on code coverage, but I'm still not sure how to word it. I think my current application's code coverage is around 15% - hey, it's better than zero!
Firefox 3 - I'm liking the new features, but I've had a few javascript-heavy pages that wouldn't render, such as the uTorrent WebUI that I have running on my media center box at home.
Alanda got a new notebook (dude, guess what brand). Great machine, but riddled with problems, and, for the record, the Intel X3100 is NOT a decent video card for ANY gaming whatsoever. We're returning it, free of charge. Would buy again. Instead, Alanda's letting me build her a PC. She'll take my old video card (GeForce 8600 GTX) and I'll get a new one (probably a 9600, waiting for the price drop once the new nVidia cards are out in a couple weeks).
We're taking her old tablet PC downstairs to stream media to the TV. The downstairs (it's just a single, small room/bomb shelter from the 60's) is being converted into a workout room.
Final note, we've gone 'N'. I upgraded my router to an 802.11N Linksys. This will make a huge difference with movement of video files and music to and from our media center / file server / backup server (via Mozy).
We have to tell our kids that most people don't have a computer on their TV. They're like "Wow, really? Why not?" They have no concept. It's adorable.
In summary, I'm sad, I'm busy with home PCs, and I'll keep blogging.
(Discuss with Disqus!)
posted under category: General on May 6, 2008 by Nathan
At home, I've been using Vista Pro, 32 bit for nearly a year. I got it free from a developer promo Microsoft was pushing. I'm fairly cheap, and fairly into developing windows software, so I went for it. My XP install at that point was almost 2 years old, which is ancient for me. I was eager to wipe it and try out Vista.
A few months ago, Microsoft had another promo, and I, being cheap, traded my privacy for Vista Ultimate. My software came last Saturday.
If you don't know, when you get Vista Ultimate, it comes with both 32 bit and 64 bit discs. Since I was going to trash my Vista Pro install anyway, why not go 64.
I decided to split up my primary partition and make room for an XP install to make sure my kids' software still works, and, you know, just in case. Truth is, Vista can't be trusted.
So I installed XP, which overwrote my boot record. Now only XP will boot. I formatted my boot partition and installed Vista 64 - a good experience, but not as good as installing Ubuntu. Now only Vista will boot.
XP's recovery software is awful. Truly bad. Wait 20 minutes for the DOS-like installer to load SCSI drivers that I don't need, then give me a crippled DOS prompt. If you destroy your boot records with XP (which I did 4 times), Vista's install disc will fix it for Vista, but there's no clear way to get them to dual boot.
Eventually, with a few lucky googles, I stumbled on EasyBCD. Great software. A few trial & error reboots and now it's perfect.
The 64 bit nature thus far has been a real sleeper. Vista hasn't crashed yet, so that's good. I haven't installed enough software to notice the larger memory footprint. The only thing even noticeable is the "Program Files (x86)" folder and the special designation for x86 software in the task manager. Not bad. So far, everything has just worked. I think the real test will come when I reinstall Crysis.
As for it being Ultimate, animated desktops, a poker game and drive encryption are not worth the extra money I would have paid.
Overall, it's good. I like having the things I wanted from Home Premium along with my IIS7 that I liked from the Pro version. The price was right. No complaints.
Next, I'm going to try triple-booting by adding Ubuntu.
(Discuss with Disqus!)
posted under category: Life Events on April 20, 2008 by Nathan
I tend to keep my personal & family related blogging exclusively on my family's blog. The same segregation works in reverse to keep my family from yawning at the content I typically post here. My aunt, the pharmacist doesn't want to hear about functional programming with ColdFusion any more than you want to hear about the fruit trees in my back yard.
Rarely have I posted cross-over entries, but, today is a different day, so I've added a category for life events.
Today, Aubri Gail Strutz was born. This is my 3rd child. She is perfect and healthy. Her mom is recovering quickly and her siblings are excited. It's been a long night.
Now, I'm not saying I'll start telling you all about my fruit trees, but I think it helps when a blog has a touch of personal life thrown in. Something I feel I've lacked here.
I will, however, make no promises on blogging at all for a little while. But who knows, I've got the week off. :)
(Discuss with Disqus!)
posted under category: Fusebox on April 14, 2008 by Nathan
I finally got around to updating the Fusebox XML cheat sheet. The first version I released was for Fusebox 4.1, so this is now 3 major releases later. Remember to update your offline copies.
Here are the links:
Fusebox 5.5 XML Cheat Sheet, HTML (printer friendly!)
Fusebox 5.5 XML Cheat Sheet, 5 page PDF
The 4.1 version is still available at the Fusebox 4.1 XML Cheat Sheet page.
(Discuss with Disqus!)
posted under category: ColdFusion on April 12, 2008 by Nathan
There, I said it. I'll say it again. ColdFusion is a DSL. A Domain Specific Language.
What does that mean? Is it still a programming language? It means it's a programming language meant to solve a specific problem, and solve it well. It's meant to be limited. It's meant to do one main thing, to solve one problem.
Sorry, let me say that agin. ColdFusion was meant to be limited. It's not a good tool for desktop applications. It's not a great language for managing huge amounts of data. It's not the platform of choice for creating build systems. It has never been used to compile itself (afaik). It has its limits, and they should not be crossed. Of course, to mix metephors, if all you have is a hammer, make lemonade until the cows come home, by all means.
ColdFusion is meant to be the dream language for web applications. Its original goals were to make your HTML web site database-enabled and dynamic. That goal was basically perfected with version 1.0 and the cfquery tag.
That's why we use it, people. That's why we like it. It's a DSL for HTML.
Now granted, it's so much more, now. It's been called the duct tape of the internet. No other platform that I've used can so easily and quickly connect things and people together. CF has really grown up, especially in the last few years. It has ways to add extensions to the language itself. It has added OO. It interacts with Java, .NET, C++, SMS, email & email servers, http, ftp, exchange, directory services, file systems... 98% of everything you need to build a successful web app, for nearly any purpose. As I said, it's so much more, now, but it is still, in essence, a DSL.
It solves the problem space almost perfectly. For HTML jockeys like myself, it was a natural extension, some 10 years ago now. It's not everything, but it doesn't need to be. It's not supposed to be. I hope it never is. But, for what it does, nothing beats it.
(Discuss with Disqus!)
posted under category: Browsers on April 11, 2008 by Nathan
Rick Faircloth, a long time CF-Talk member was introduced to my project, Pagination.cfc earlier today. He was looking for an easy way to upgrade his own pagination, more than just previous/next links.
The HouseOfFusion's CF-Talk list is great. Any answer you need, 15 minutes or less.
Rick got 2 links to my project, thanked the referrers, and three hours later had this to say:
Just wanted to let you know that I implemented your component and it went perfectly...and that was the first cfc I've ever used!
I haven't gone beyond the default settings, except for number of records per page, but I'm sure customizing will go well, too.
Nice clear instructions for the use of the component.
Much appreciated!
(Discuss with Disqus!)
posted under category: General on April 9, 2008 by Nathan
Yeah it just pops up on me every year. I can't believe it's already CSS Naked day.
I wish they would have it on the same day every year so I don't have to change my code. A week ago I moved my CSS Naked script up from the 5th to the 9th. Good thing, or I would have been a little premature.
(Discuss with Disqus!)
posted under category: Database on April 3, 2008 by Nathan
I felt the need to mention that to anyone who isn't using the Eclipse Data Tools Platform (DTP), you should look into it. I recently finally figured out how to make it run. It wasn't a very obvious process, so I thought I would type up some help in a blog entry. This is part review, part new user help, part promotion for another deserving open source product.
The first hurdle for me was connecting to my database. It's not easy, even with help from all the sources. Remember that someone out there has already done it, so keep googling until you find what you need. For me, I was missing my database instance name / service ID on the connect string. The format for my Oracle server is [email protected]:port:instance. This is not documented hardly anywhere. Once connected, I could browse the server, introspect the tables, procedures, views and everything. These things were pretty easy to figure out at this point.
The worst thing for me was figuring out how to just execute some adhoc SQL. It doesn't make sense at first. Eclipse makes you create a SQL file, even for adhoc statements. That's a true pain, but it's somewhat standard in the Eclipse IDE: you have to make a file before you can put anything in it. This differs from most other products, such as Dreamweaver or Flash, Adobe products, and also Notepad or Word, both MS products. Microsoft is so good at this, that you can make a visual studio project, put a bunch of files together, compile an exe and run it, then, if you don't want to save it, just close the project and, with confirmation, throw it all away. This kind of adhoc throw-away mentality is what most of us have been trained on, and is one of the major hurdles when switching to Eclipse.
(jump break - stunning conclusion and an Adobe rant after the break)
Back to DTP. you've created a .SQL file. Make sure you select your database connection at the top of the editor, then, when typing, you will be blessed with content assistance. It's not the best I can imagine, but it's rather good. Knowing what brand of database I use, the SQL editor gives me shortcuts to all the database functions as well as my own database objects. Now, getting your queries to run is a trick. Select what you want to execute, right click and pick "Execute Selected Text". Alt+X (CMD+X for mac?) is the shortcut key. Also, you can run all the queries in the file at once by selecting "Execute All" - Ctrl+Alt+X. The SQL Results view should pop up immediately and show you what you just did. In the results view, the left pane shows a history log of the queries you ran (and is persisted even between sessions, until you clear it), the right pane shows the data that was returned, if any.
I like the way it keeps track of historical queries. I toyed with a web version of something close to this years ago, though not so successfully. From the results view's data, you can export what you selected in different ways, which can even be loaded back into your database through the data source explorer (right-click on a table, data, load).
One last note in this review/plug/tutorial. DTP will generate DBUnit tests. I haven't used it yet, and I doubt I'll get to it soon, but for a full time DB developer with java experience, this is great news.
Overall, I like the integration and flow and how the aspects of the tool work together. Once you make your connection and figure out how to do the basics, the Eclipse Data Tools make a powerful database IDE. The price, as always, can't be beat, and you know the Eclipse plugin developers are always hard at work on improvements for the next version. While the features are not as deep as deep as many proprietary tools such as Toad or SQL Server Manager, its integration into an already well-loved IDE, Eclipse, makes it worthwhile to have on hand, though, as with the Eclipse culture, it won't give you a quick pick-up-and-edit experience.
For users of other Eclipse plugin DMBS's such as SQL Explorer or Quantum, would you want to switch? This, I can't say for sure. Perhaps, if you like the integrated nature of tools made by the Eclipse foundation, this could be up your alley. Trying it out doesn't hurt, but I would not bet money that it's better than your current tools. If anyone has experience, please share.
For ColdFusion developers, why would I choose DTP over the Adobe ColdFusion RDS database tools? For one very simple reason. The CF RDS SQL editor is terrible. Unbelievably awful. Go ahead, try to use it. Try block indenting. Try to hit the delete key. No color coding, no database introspection, no right-clicking on the text, no select all (not even with ctrl+a), no find or replace. Thank you Adobe for making a text editor that's worse than Notepad. Even worse than 'edit' from MSDOS. If I were Adobe, I would focus on connecting a JDBC driver to an RDS server. Then we could use RDS with DTP, SQLExplorer or a pure java app, etc., etc.
(Discuss with Disqus!)
posted under category: Browsers on March 19, 2008 by Nathan
Here's one that hits me excessively hard. What percentage of my code is covered with unit tests?
The reason I ask is because I know my code coverage percentage is abysmally low, easily in the single digits. It's hard to talk about because I'm a huge offender. However, even after looking in the mirror and viewing the plank in my eye, I know that this is typical in the world of ColdFusion developers. Most of you have never written a formal, automated test case. Ever. I know you. You don't. Admit it.
If you do it, kudos. Get yourself a cookie.
Now, code coverage. It's the measurement of how much of your application is covered by automated tests. I would argue that it is probably impossible to have 100% code coverage with things like environmental variables such as sessions, server operating systems, client browser dot versions and the types of input parameters your application can be given.
Let's take this simple function:
function add(p1, p2) { return p1+p2; }
How many test cases do you need to write to have this code fully covered? Unfortunately, probably a lot. Starting with 0+0, 1+1, 0+1, 1+0, sure, that's easy. What about approaching the upper limits of a java integer? negative numbers? doubles and floats? Will it unbox automatically? What about those pentium and java bugs from years back that would return floating points on simple arithmetic? Maybe that's absurd, but at least we're not using it...
"IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE CONTROLS, INCLUDING [...] THE DESIGN, CONSTRUCTION, MAINTENANCE OR OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, AND LIFE SUPPORT OR WEAPONS SYSTEMS"
(what not to do, from the Coldfusion End User License Agreement 6.c)
So I think you can get 95% in just a few tests, zeros, small, medium and large sized numbers, as well as non-numbers and assert errors when it should throw errors.
(jump break, almost done)
How do you really define completely covered code? Is 95% good enough? Probably, as long as your unit tests are living and breathing with the application. I think one of my favorite quotes in this arena is "Make mistakes once." That is, once you find a bug in your software, add a condition to your test cases to recreate it, so that it never happens again.
While I know there are people even in the CF world that actually keep a good code coverage, and maybe a few that even track a code coverage percentage as if 100% were a goal. Where do you stand?
(Discuss with Disqus!)
posted under category: General on March 4, 2008 by Nathan
I said a few months back that I had decided to go head first into software quality as a general scope to become proficient at, so here's an update. I'm proud to announce that I've been making good progress.
I have been using Selenium to test some of my web applications. It can get complicated, but so far it has been marginally worth it. After figuring out the system, I set up a test suite for one app and have been working on it. I will blog about this experience soon.
I looked into CFUnit and CFCUnit. These are both CFC unit testing tools. If you google it, you won't learn which is better. They both have really good pluses. I went with CFCUnit because Sean Corfield and Chris Scott said so and it was easier to get working. Unit testing, even on the handful few components I applied it to, has already paid off really well. I will be doing more of this.
I made a couple Ant scripts. It's definitely starting to pay off, so I'm not giving up. I think I just now "get" the paradigm, so things are picking up. I will blog this one soon, probably after Selenium.
I will be playing with these new tools for a long while now before declaring myself king (or whatever it is I do before I get bored and move on).
Some day, I would like to explore some sort of DBUnit testing. I am seeing at least half a dozen angles for this, but two in particular. First, to test database relational integrity and just performing crud operations on all the tables, I would need a framework to support that - this isn't unthinkable to do in CFCUnit. Second, to snapshot my data's current state for when the data changes due to any testing and I would like to be able to change it back, quickly and easily.
(Discuss with Disqus!)
posted under category: General on January 29, 2008 by Nathan
I call myself a real hacker, so naturally I'm at my keyboard a lot. In mid-2007 I passed a budget approval through the family finance committee and began researching keyboards. I have a few important criteria that are all important. I'm not a really picky person, I can jam on a standard dell keyboard and do alright, I can type fine on strange and annoying keyboards just fine, and with practice, on a notebook, but we all know there's getting by, and then there's getting what you really wanted.
This is my list of must-haves for selecting a new keyboard:
Must be a full sized keyboard
Must connect via USB port (for speed and compatibility)
Must not be split for ergonomics
Must not have a malformed control navigation area (home, end, insert, delete, pgup pgdwn)
Must not have a malformed arrow navigation area (I hate you, MS natural keyboard)
Must have a numeric keypad, spaced out from the rest of the keyboard
Must be wired, both because I don't want to fiddle with batteries and for responsiveness
Must have multimedia control buttons, specifically volume control
Must not be a mouse/keyboard combo
Must cost less than $100
No generic brands
Extra gadgets, buttons, sliders and such are a plus
Logitech has exactly one choice that fits my criteria, the $99 G15 Gaming Keyboard. I like games, but I don't know if I'm that hardcore. Programmable keys and the LCD screen are nice.
Microsoft also has exactly one choice that fits my criteria, the $30 Digital Media Pro Keyboard. No screen, but many other strengths, and less than 1/3 the price of the Logitech choice.
NewEgg revealed some other choices from Saitek and Belkin, but both seemed to have compressed layouts and odd designs. Amazon showed basically nothing else.
So of the two choices it looks like I have, I chose the Microsoft Digital Media Pro Keyboard. $70 extra for a keyboard screen doesn't really sound like a great deal for what I do.
I've been using my Digital Media Pro Keyboard now for a few months and have been very happy with it. I highly recommend it to anyone who is looking.
Have you fallen in love with a keyboard? Share your obsession, write a comment.
(Discuss with Disqus!)
posted under category: General on January 16, 2008 by Nathan
Some of the anti-patterns listed on Wikipedia's page are way too familiar. It's good reading in the sense that we should learn what not to do. Here are my favorites that hit closest to home:
- Bug magnet: A block of code so infrequently invoked/tested that it will most likely fail.
- Anemic Domain Model: The use of domain model without any business logic which is not OOP because each object should have both attributes and behaviors
- BaseBean: Inheriting functionality from a utility class rather than delegating to it
- Lava flow: Retaining undesirable (redundant or low-quality) code because removing it is too expensive or has unpredictable consequences
- Ravioli code: Systems with lots of objects that are loosely connected
- Copy and paste programming: Copying (and modifying) existing code rather than creating generic solutions
- Reinventing the square wheel: Creating a poor solution when a good one exists
- Tester driven development: Software projects where new requirements are specified in bug reports
- Crisis mode (a.k.a firefighting mode): Dealing with things only when they become a crisis, with the result that everything becomes a crisis
- Seagull management: Flies in, makes a lot of noise, craps all over everything, then flies away.
- Warm bodies: The worker who barely meets the minimum expectations of the job and is thusly shunted from project to project, or team to team.
(Discuss with Disqus!)
posted under category: Free Code For You on January 6, 2008 by Nathan
Today I am releasing a 1.0 Release Candidate of my Pagination.cfc. New in this version is:
Added examples (lots, in the download)
Added documentation (featuring what, why, usage, reference, css and extensibility)
Added ability to paginate Arrays and Structures
Added properties: BeforeNumericLinksHTML, BeforeNextLinkHTML, ClassName, TotalNumberOfItems, FirstPageLink, PreviousPageLink, NextPageLink, LastPageLink
Added CFCUnit test (needs help)
Moved numbered link rendering into its own function (extensibility)
Fixed CSS support (and documented)
I'm not anticipating further changes, so this is a release candidate! If you can, please help me test it out. I did include a CFCUnit test file but I didn't get very far with it. Any feedback is highly appreciated.
Download Pagination 1.0 RC here.
View the documentation online here. It is included in PDF and HTML formats in the download.
I think I'll put this up on RIAForge for the 1.0 final. Comments appreciated!
(Discuss with Disqus!)