Nachos, not just chips and cheese

Recently my mother- and brother-in-law came for a visit. Usually during these visits I break out 3-4 dishes and a big breakfast or two. For some reason, that didn't happen this trip. We out out several times and slept in most mornings. But one evening my wife decided we needed to have nachos for supper. She is convinced her brother thought we were serving chips with cheese sauce. Oh how wrong he was. See, we have nachos at least twice a month in our house. We know how to make a meal out of them. He must have enjoyed them beyond the clean plate as my mother-in-law asked for the recipe!

[More]

ColdFusion Tips: Identify common items in 2 lists

It's been forever since I've written anything here. I know, I'm such a slacker and I have no excuse. But after discovering the ColdFusion solution I'm about to share, I knew I had to write about it.

Yesterday as quick test I attempted to create a solution for the following: Given 2 lists of names, create a 3rd, sorted list that contains ONLY those names that appear in both lists.

Pretty straightfoward, right? Before I show my first attempt I think it is important to understand that I always strive to answer "yes" to 3 questions when creating a solution:

  1. Does the solution accomplish the goal?
  2. Is the code easy to read/understand?
  3. Is the code performant?

My straightforward solution became:

view plain print about
1friends = "Chris,Ashley,Joe,Mike,Ritch,Jennifer";
2family = "Ashley,Jennifer,Nancy,Mae";
3framily = "";
4for( name in friends ){
5    if( findNoCase( name, family ) ){
6        framily = listAppend( framily, name );
7    }
8}
9framily = listSort( framily, "textnocase" );

In essence, loop through all the names in list "one". If the name also appears in list "two", add it to "common". If one of the lists was shorter (as "two" is)

I think my solution checks all those boxes. But looking at it I just knew there was a better approach. I played around with map but it didn't feel better, just more difficult to read. Then I unearthed array.retainAll(). As a ColdFusion developer I had never heard of it. It's not a method included in the documentation at CFDocs Array Functions.

Dear reader, retainAll() is a JAVA method, called in the format array1.retainAll(array2), that retains only common array elements of array1 and array2. Exactly what I wanted to do!

I changed my code to:

view plain print about
1friends = "Chris,Ashley,Joe,Mike,Ritch,Jennifer";
2family = "Ashley,Jennifer,Nancy,Mae";
3framily = listToArray( friends );
4framily.retainAll( listToArray( family ) );
5framily = listSort( arrayToList( framily ), "textnocase" );

This code accomplishes the goal and is mostly easy to understand. 2 of my 3 requirements for an acceptable solution.The use of retainAll() may not be clear for any CF developer with no java experience (like myself). But this can be mitigated by adding a comment, so I don't consider it a bad thing.

But how about the third question? How does it perform? Better than the original!

The average run-time over 10,000,000 iterations: Loop-based solution: 0.006364ms RetainAll-based solution: 0.0044926ms

It would be premature optimization to choose the retainAll-based solution based solely on the runt-time numbers, though. At that speed, the difference is really negligible. For me, the retainAll-based solution is the better choice because the code is more concise and easier to debug/maintain.

Slacker!

I feel like such a slacker! Here I have this perfectly good blog and I never use it. I need to find a way to change this. Maybe it's time for this space to undergo major reconstructive surgery and become something new.

Easy 20 Minute Chicken and Dumplings

Tonight was chicken and dumplings for supper. I mentioned this to a friend who had a simple reply: "I want the recipe". I thought surly I had blogged it already but apparently not. So here I give you my EASY 20 min chicken and dumpling recipe.

[More]

Interesting take on programmers

I was reading this article earlier and found this quote interesting: "You are a wizard harry. Programming is basically magic. Think about it - we study hard and pore over our books of lore (the computer + internet), to make spells (programs). Wizards can teach other wizards how to cast their magic. We can make things happen in the world spontaneously, and create wonderous devices anyone can use. (Like the internet and mobile phones). These devices can do things that would be impossible without our skills."

Yeah! Programming is just like that!

The surreal world

The one piece of custom code I added to the blogCFC engine that I wanted back was the ability to customize the keywords on an individual entry. I wrote that code 3 years ago and certainly don't recall what I did. However, it was easy to add back in.

I wrote a blog post about it! It was quite surreal to read my own blog post on how to update blogCFC to do what I wanted. But, it took 5 mins and boom, it was back in place!

I'm back...

So, while playing around with some settings I inadvertently hosed my blog installation. Well, it's back and I think all the posts were recovered. I know I'm missing some code updates I made, but that's ok.

I've had a problem with posting entries. It just doesn't occur to me to post things. Hopefully, this will not be the last post of the year.

Taco Soup Recipe

As the temperature begins to drop one of our go-to dishes for a quick, tasty meal has become taco soup. It's one of those 1 pot meals that really warms you up and only take about 45 minutes from start to finish. This recipe feeds 10, but we typically scale it back a little.

  • 2lbs ground sirloin, browned and drained
  • 1 medium onion, diced
  • 1 can green chilies
  • 1 can whole kernel corn
  • 1 package Ranch dressing mix
  • 1 package Taco seasoning
  • 3 cans diced tomatoes (I like at least 1 can of fire-roasted tomatoes)
  • 1 can pinto beans
  • 1 can hot chili beans
  • salt and pepper to taste
  • 1 1/2 cups of water

Mix all the ingredients together and simmer for about 30 minutes or until you can no longer resist the aroma emanating from the kitchen.

It doesn't get much simpler than that!

Even though this recipe includes green chilies and chili beans, it's pretty mild. So, here's some suggestions to take care of that:

  • Use "hot" taco seasoning (really, this should be a given)
  • just like when making chili, adding a diced chili pepper or 3 is never a bad thing
  • add some red pepper flakes
  • a dash of Sriracha sauce (ok maybe 2 dashes)
  • a couple tablespoons of hot salsa

I like my bowl with a plate of tortilla chips and a cold beer.

It's the 80's baby!

I don't remember where I first heard about it. But nearly every Friday for the past year I have tuned into The 80's Rewind Show on Codebass Radio. As the name implies, it's a flashback to the music, movies, and tv of that great decade: the 80's.

Counting "down" from 1980 to 1989, the DJ, James Allen, plays a couple of tunes from that year selected from the US Top 1000 charts and listener-requests. Interspersed with soundbytes from movies, tv-shows and commercials it's a great way to end the work-week. Tune in and check it out.Also, if you can, check out the live webcam during the show.

Did I mention the show is (usually) LIVE?!

Sublime Text 2

I had been using Dreamweaver for development as long as I can remember; 10 years at least. When I started my new job 6 months ago I was told that nearly all the ColdFusion developers used it and it was no big deal to get a license. However, not too much later I got the itch to try a new editor. I saw some tweets concerning Package Control – once you have this installed, you have a resource within ST2 to install and manage a vast array of plugins.

From with the package manager I installed: ColdFusion for CF syntax functionality.

Automatic Backups. This is awesome. When you save a file, a backup will be saved to a local folder. It's almost like having a built in versioning system. This works great for me at work because all our development files are stored on the network. Recently a snafu occurred and an important folder was deleted. Backups were restored from the night before, but because of automatic backups I had a backup of all my work from up to a few minutes ago.

BracketHighlighter can be good for keeping your sanity. When you highlight an opening brace, bracket or parenthesis, it will highlight the closing match for it. If you do work in javascript or jquery, I would consider this a must have!

TrailingSpaces is something small with a big impact, for me. All it does is highlight any time a line ends in a space. This may seem like nothing, but we have a standard that specifically addresses this. If a line of code ends with a space, you will fail your code review. So this is a great frustation saver.

If you are frustrated with your current IDE/editor or just looking for something different give Sublime Text 2 a shot. I don't think you will be disappointed.

More Entries