Re-Opening Web Services in Coldfusion using Application.cfc

When you run your Coldfusion App using Application.cfc with an onRequest() method, you'll soon discover that your web services no longer function.

In my mind this is a bug in CF, but be that as it may, here's how you get arround it:

Inside your onRequestStart method, add the following lines.

        <!--- Define arguments. --->
        <cfargument name="TargetPage" type="string" required="true" />
        <!--- Open Webservices --->
        <cfif REFindNoCase( "\.cfc$", ARGUMENTS.TargetPage )>
            <!--- Since this is a web service call, we need to get rid of the OnRequest() event method.--->
            <cfset StructDelete( VARIABLES, "OnRequest" ) />
            <cfset StructDelete( THIS, "OnRequest" ) />
        </cfif>

jQuery 1.3.2 Toggle Element Issue

So here's a little obscurity I ran across in using jQuery 1.3.2 to affect effects on an unordered list.

Here's what I've got:

<!doctype html>
<html>
    <head>
        <script>
            $(".bb_qlist_title").click(function(){
                $(this).siblings('ul').slideToggle(function(){
                    var visible = $(this).is(':visible');
                    if( visible ){
                        $(this).siblings('h4').css('background-image', -->
                            'url(lib/images/content/icons/bullet_arrow_down.png)');
                    }else{
                        $(this).siblings('h4').css('background-image', -->
                            'url(lib/images/content/icons/bullet_arrow_up.png)');
                    }
                });
            });
        </script>
    <head>
    <body>
        <ul>
            <li><h4>Title</h4>
                <ul>
                    <li>menu item</li>
                    <li>menu item</li>
                    <li>menu item</li>
                 </ul>
            </li>
        </ul>
    </body>
</html> 

Pretty streight forward you'd say. We're building a list and sub-list. The sub-list get's slid up when the user clicks on the h4 element. We're also wanting to change a background-image of the h4. In this case the images used are up and down arrows.

But here's the kicker, the above code will not work. The problem line is "var visible = $(this).is(':visible');". Here's what's going on.

The UL that contains our sub-list elements has no box size. In jQuery 1.3.2 the toggle methods no longer look at the CSS visibility of an element, but rather the visible area that element takes up on the page. Since the UL doesn't take up any area, the above line is always false.

Now there are two ways around this pickle.

  1. If like you could give the sub-list UL some dimensions.
  2. or we can just watch for it's children.

The 2nd option seams the most rhobust to me since we don't know how many list items our sub-list will hold, so setting a height is not an option.

So the simple fix is to change this line:
var visible = $(this).is(':visible');
to this line:
var visible = $(this).children('li').is(':visible');
We're now watching the sub-lists children LIs which do take up physical space on the page and jQuery 1.3.2 can see them.

Google Chrome Quick Tips

So here's some cool things you can do with Google Chrome. Obviously this is not a complete list, just something I stumbled on, so please add your own quick tips in the comments.
  1. Ctr-click the address bar arrow to open current url in a new tab.
  2. Ctr-click address bar arrow to open current url in new window.
Enjoy.

How to Find GoDaddy Hosting File Path

If you ever have the ill-fated reason to work with GoDaddy hosting. You may find it difficult to find the full file path of your account.

This happened to me just now. I moved a development version of Wordpress to a client's GoDaddy hosting account only to learn that the file path was no where to be found. After some digging I finally found a description of how the file path is constructed.

This help document is related to .htpasswd location, but its description of the file path is correct. Note you may have to be logged into your GoDaddy hosting account to read this.

http://help.securepaynet.net/article/1641?prog_id=424050

Thoughts on the Maturing Digital Age

It's happening to an entire generation of tech savvy people; the increasing amount of available data is starting to be arranged in a manageable way. On my laptop I'm now combining my Twitter and Facebook feeds. Images, audio and video are starting to be shared through common channels. It's to early to proclaim the age of the web site is over, but we can certainly see a fore shadow of such a time as we increasingly pull our digital world into simple apps that manage our interactions for us. Simplicity is the key here and web apps are maturing quite well.

So what does this mean for the mobile phone industry? It means consumers are starting to expect that same functionality on their mobile device, not just the computer. Take me for example. I have a Google Voice number that rings my mobile and my Skype account. Call records and voice mail is all contained in my Google Voice account. My contact list is synced between all my Google accounts (docs, gmail, etc) and my mobile phone.

This hodge podge of technologies is just the beginning. I full expect mobile providers to provide better integration in the future. Imagine a mobile device that natively syncs all your contact lists, news feeds, social media channels. The Palm Pre is a big step in the right direction as WebOS does a pretty nice job integrating your contacts, etc.

So what's missing? The complete syncronization of data into the cloud. I should be able to fully access my contacts, voice mail, call history, documents, etc. from any platform, mobile or desktop, Windows or Apple.

Google UI Update in Suggested Search

Not only did Google just update their homepage search box and buttons, but they added an interesting placement for their "Google Search" and "I'm Feeling Lucky" buttons.

Now when you start typing a search phrase you will notice a new UI for the suggested search drop down. Both buttons appear inside the search suggestion drop down. Also, clicking one of the suggestions will start the search for that phrase.

Now I understand the click to search feature, that's rather handy. But adding the search buttons baffles me. How are they helpful?

Quick Tip #1: Don't use a containing div.

I'm always looking for ways to simplify my HTML, especially as I move ever closer to HTML5. So today's tip will, I hope, prod you to stop using extra markup you really don't need.

Body of Lies
The most common over use of the div tag is to surround page content in order to limit the page width. You will find these container layers are named things like #content, #container, #page, etc. I submit to you this is a duplication of effort since we can do the same thing with the body.

body { width: 960px; margin: 0 auto; } works just as well on the body tag as it does an extra div. After all, body is already containing the, well, the body of our document.

Don't Fence in Your Lists
Did you know the unordered and ordered lists are in fact block elements? That's right, their on the same level as a div, so don't surround them in a div then you can define the list in the same way. Consider this code:

.nav {width:100%;background:#ff0;}
.nav ul {margin:0;list-style:none;}
.nav ul li {float:left;}
<div class="header">
    <div class="nav">
        <ul>
            <li>Home</li>
        </ul>
    </div>
</div>

It's not so bad right? Sure it's functional, but is it efficient use of space? I submit you can accomplish the same thing like this:

.header > ul {width:100%;background:#ff0;margin:0;list-style:none;}
.header > ul li {float:left;}
<div class="header">
    <ul>
        <li>Home</li>
    </ul>
</div>

So simplify your work life by thinking about how to use HTML elements to their full potential. Your thoughts and ideas are greatly appreciated. 

How I Manage Projects

I came to a realization, some time ago: I'm just not a natural at project management. Yet it is an essential skill we must have so here's what I've done to compensate.

Pre-planning: Think of this as a todo list on steroids. I pre-plan every project to the fullest extent possible. I write down every task and it's dependencies and map out a plan of action with deliverables for myself and the client. The goal is to so thoroughly plan that I can just follow the step by step actions "work the plan" and achieve frequent milestones. When I'm in production mode I don't want to think about the next step. I want to focus exclusively on that task.

Plan the day: I use a notebook from Franklin-Covey to plan my day. I'm very specific about this planner because it helps me plan by task importance, not by time. Since I have my projects pre-planed, I can now break those down and tackle multiple tasks across multiple projects throughout the day, all organized in one planner. I also intersperse other tasks, like writing proposals, phone calls, emails, etc. throughout the day, all listed by importance.

Cut out the noise: This one I still have trouble with, as is evidenced by the fact that I'm writing this post while I should be working ;-). I manage emails like a fiend, I only check mail once a day. If a client's matter is so important it can't wait till 9am, then they can call. When I do get a call, I try to ascertain the calls importance within the first 20 seconds. If it's not absolutely pressing I'll put the call off, "Hey Stan, I'm working with a client right now, let me call you back at 2."

Twitter and Facebook are also noise, the kind that are hard to cut out because I've gotten real work from both channels. But they can sneak in and steal the day so I set 5-10 minute segments of time to check them, and I check them as a business tool... in and out. The goal being to glean some quick insights from those I follow, bookmark some links to follow up on later, and share some helpful thoughts with my followers. Then it's back to work.

The break: This is the absolute hardest for me... taking a real break, away from the PC. As work grows and dependencies mount, I tend to skip breaks, sometimes even lunch, to try and get ahead. What happens though is after two days of 8+ straight hours of work I get burned out and spend the next three days procrastinating. So my goal is 15 minutes off the PC every 2 hours, and 1 hour for lunch. Think about it, it's not that time expensive. If you take 15 minutes at 10am, 2pm and 4pm, plus 1 hour at lunch, that's 1:45 of break, multiply by your hourly rate. Is that dollar amount worth your sanity? It is for me.

Self awareness: This is the absolute most important thing to grasp. You are not perfect and you were not designed to multi-task.Period. Our modern society puts great value on multi-tasking, but that's only a recent development. It's something computers do well, but it's not a human trait. I'm a perfectionist and have a very healthy ego as well so getting over the self-inflicted idea that I should be all things to all people in all situations has been a real struggle for me. I imagine it is for quite a few freelancers. The point is, know your limitations and be ok with them. Don't settle for them, but be ok with them; and then go and work around them.

So what do you do? How do manage the free thinking, mold breaking monster?