Think Different

Holy cow! I haven't blogged about anything in a very long time. I intend to do something about that starting with this post.

A little while back a colleague asked me to look at some code. He was curious if I thought there was a better way to write it. The only thing I knew about the code was that it worked.

Before you ask. I can't share any of the code. Just let it go.

The code was designed to look for a known string pattern inside a user entered string. The original code was looking for very specific patterns. Also, it had some logic in it that would allow for some of the checking to be bypassed under certain conditions. Like it was explained to me, the code worked and did what was expected of it.

After about 30 minutes I had whipped up, what I felt, was a better way to write the code. My code had about a quarter of the lines and was more efficient. It would check for an infinite number of patterns and conditions. I ended up expanding on it and delivered a couple different ways to make it better. Each one expanding on the previous. Also, I felt my code was better constructed as solve the intent now and still work years from now without alteration.

This is where I feel that experience came into play. I had to write something like this before I was able to pull on that experience when writing it. Not only that, but just my overall time in the field has allowed me more overall exposure to things so my thought processes are just different when presented with a problem.

But, at the end of the day the code is not even the main part if this. All it does is provide context for the main point I want to make.

I think that all of us should strive to be better and "Think Different". What I mean by that is to always look for a better way. Don't continuously rely on how you have always done something. Expand your knowledge and find opportunities to do you what you do, just do it differently, do it better.

Failure is an option, but don't let it deter you. Not every attempt to make things better will work out they way you wish. When trying to find better ways you will more than likely find more ways not do do something. For example, it took Edison over 1,000 tries to invent the lightbulb. He kept striving to find a better way or a different way to accomplish his end goal.

When trying to make it better don't be afraid to reach out and ask for help. With today's technology we are all connected to a vast network of people that have probably already done that. The large majority of them are usually more than willing to help and offer their expertise. There is a large wealth of knowledge and support out there, but if you don't use it you are only handcuffing yourself.

The new year is quickly approaching. Try and spend part, if not all, of 2016 trying to "Think Different".

My Son the Blackbelt

I don't think I have ever used my blog for personal stuff. So if you will indulge me just this once.

Yesterday my son, Bryce, tested and received his 1st Degree Blackbelt in Taekwondo. He started just before he turned 4 and is now 8. Some might say it is a little young but if you knew the dedication and training he has done you would know different.

So, congrats to my son, may this be just the start of your journey.

My new adventure

Well,

For those of you not listening to the podcast, www.cfhour.com, after many years at Disney I decided to change jobs. Leaving Disney was not a decision I took lightly. The decision process caused many sleepless nights and many moments of panic. But with the help of family and friends I was, obviously, able to make a final decision.

I have to say, leaving somewhere you have been for just shy of 11 years is tough. There is nothing that can prepare you for that day you resign nor the last day at work. I wish all the best to those friends I left behind at Disney. I know they will go forth and blaze a path on on their own.

So, what am I doing now? Well, I am now a Sr. Developer at Nonfat Media. I am very excited about the future and what lies ahead. It is a strange place to be at the moment. I am coming from somewhere where I had all the answers to somewhere I have to ask all the questions. Once I get my bearings and get some knowledge I know I will be able to help do great things here.

So, what about my blog (haven't blogged in a while) and the podcast? They will both continue on. I have gotten permission to talk and blog about things that I do here (with some restrictions). So, I hope that along my new journey of learning I will be able to teach others as well.

Till next time...

--Dave

Creating XML in ColdFusion

Well.. I ran across this code and wanted to share. I am using it as more of an example of something you probably shouldn't do.

One of the strengths of ColdFusion is to make hard things easy. This code basically ignores that principal and makes hard things harder.

So.. here is the code I found

view plain print about
1<cffile action="WRITE" file="#WallXML#\#NewFile#" output="<?xml version='1.0' encoding='UTF-8'?>" addNewLine="yes" fixnewline="yes" charset="iso-8859-1">
2
3
4<cffile action="APPEND" file="#WallXML#\#NewFile#" output="<gallery xmlns:media='http://search.yahoo.com/mrss/'>" addNewLine="yes" fixnewline="yes">
5
6<cffile action="APPEND" file="#WallXML#\#NewFile#" output="<settings>" addNewLine="yes" fixnewline="yes">
7    <cffile action="APPEND" file="#WallXML#\#NewFile#" output="<mediaFolder type='large' media='image'>media/3dwall/</mediaFolder>" addNewLine="yes" fixnewline="yes">
8    <cffile action="APPEND" file="#WallXML#\#NewFile#" output="<mediaFolder type='thumbnail' media='image'>media/3dwall/thumbs/</mediaFolder>" addNewLine="yes" fixnewline="yes">
9<cffile action="APPEND" file="#WallXML#\#NewFile#" output="</settings>" addNewLine="yes" fixnewline="yes">
10
11    <cfloop query="WallPics">
12            <cffile action="APPEND" file="#WallXML#\#NewFile#" output="<item>" addNewLine="yes" fixnewline="yes">
13                <cffile action="APPEND" file="#WallXML#\#NewFile#" output="<media:text>Tooltip 1</media:text>" addNewLine="yes" fixnewline="yes">
14                <cffile action="APPEND" file="#WallXML#\#NewFile#" output="<media:content url='#Photo#' type='image/jpeg' width='500' height='375' />" addNewLine="yes" fixnewline="yes">
15            <cffile action="APPEND" file="#WallXML#\#NewFile#" output="</item>" addNewLine="yes" fixnewline="yes">    
16    </cfloop>
17
18
19<cffile action="APPEND" file="#WallXML#\#NewFile#" output="</gallery>" addNewLine="yes" fixnewline="yes">

While in principal the code works. An XML file is generated and written to the server. However there are many issues with this.

1: The XML being written replaced an XML document used by a flash object. If the flash object tried to call the XML while it was being written it would error.

2: IF there was an error in XML generation the system would be left with an invalid and incomplete XML document on the server. This would probably cause the flash object to fail.

3: Causes excess I/O to the file system.

So, how did I fix it? Well easy.. ColdFusion has a built in way to create XML. There are a couple ways to do it but I used the tag approach. It just seemed to fit with the current code.

Here is what I ended up with:

view plain print about
1<cfoutput>
2<cfxml variable="theResult">
3<gallery xmlns:media='http://search.yahoo.com/mrss/'>
4    <settings>
5        <mediaFolder type='large' media='image'>media/3dwall/</mediaFolder>
6        <mediaFolder type='thumbnail' media='image'>media/3dwall/thumbs/</mediaFolder>
7    </settings><cfloop query="WallPics">
8        <item>
9            <media:text>Tooltip 1</media:text>
10            <media:content url='#Photo#' type='image/jpeg' width='500' height='375' />
11        </item></cfloop>
12</gallery>
13</cfxml>
14</cfoutput>
15
16<cffile action="write" file="#WallXML#\#NewFile#" output="#theResult#">

Now the code just generates a single XML var and then writes it at once to the server. If something were to go wrong with the generation the existing XML document will be left untouched. Also, since it is a single write the odds of the flash object being impacted by the new XML are drastically reduced.

So, remember, let ColdFusion do what it does. Don't try and work against it and make your lives harder.

Till next time,

--Dave

How I got started in ColdFusion

So, how did I get started? For me it was a complete fluke. I actually had no aspirations of getting into technology at all. Infact, I was on my way to being a restaurant manager for Denny's. Following in my mothers footsteps. Then a complete and unexpected event happened and I found my self a ColdFusion programmer.

I was young main in my early 20's. Working at Denny's and just enjoying life. Then, when helping my mom move a refrigerator a freak accident changed my life. I was moving the refrigerator through a door when it fell on me. I suffered a severely messed up ankle and a dislocated hip. My hip went back into place on its own. My ankle was a whole noter story.

I ended up not breaking anything but it would be months before I was able to walk again. It would be years before I could walk for distance without any pain. I spent the next 9 months on crutches and in wheelchairs. I spend many an hour in physical therapy to get my ankle back a useable condition.

It was about a year after my accident that my doctor told me I needed to find a new career. He said I am young and it should not difficult. I was spending lots of time on BBS systems during my healing. So, getting into computers seemed like a good idea. I picked up a few books and did lots of reading. The internet was not the same back then as it was today. Books were still the best way to get accurate information.

Fast forward a couple months. I was sitting in Denny's bar ( yes the Denny's I worked at had a bar) reading of all things "HTML for Dummies". A customer who I knew from when I worked there came up to me. He asked me if I built websites. I said I was just starting out and learning. He offered me the opportunity to create a website for his company. I took the offer and was off to the races.

I was working with a form submission and was having some issues. I talked to a friend and he suggested that I build it using Cold Fusion (yes with a space cause that is how it was spelled back then). The rest is history.

For a more to this story please listen to episode 107 of the CFHour podcast where I tell this story in much more detail.

http://cfhour.com/post.cfm/show-107-new-stuff-and-the-long-road

Till next time,

--Dave

New look to the blog

Well... I had this great idea a while back to make my blog black with some blue parts. The more I looked at it the more I hated it.

When I got back from cf.Objective I decided to change it. However, in the past, to change, it I had to modify the blog code a bunch to get the blog to work with the layout template I choose. The issue with that is my blog would go a long time without updates as getting them in was time consuming. This time I decided to be a little smarter.

I used the stock layout that comes with BlogCFC and just altered the header bar. Nothing groundbreaking but at least I can easily update the site now.

The one thing I did was create the projects page. This is just a BlogCFC page with a renderer. Little did I know that BlogCFC has this slick function that allows you to put dynamic content into pages. After a little chat with Ray Camden about it I got it working. The project page is now a pull of the xml feed from RIAForge.org.

So that is about it for now.

Till next time...

--Dave

RE: ColdFusion or Railo ?

In a recent blog post a comparison was made between ColdFusion and Railo.

http://www.cfmldeveloper.com/page.cfm/coldfusion-vs-railo-1

On episode 77 of CFHour.com podcast we discuss this post in detail. There is one overall thing on the post I did not agree with. That was the moderation of the comments. So, having said that, feel free to post your comments here. My blog is not moderated and you can feel free to speak your mind.

Till next time...

--Dave

Yep.. that is correct.. I got hacked

I debated if I should even post this. But in the end I thought it would be a good learning lesson for others. Learn from my mistakes so you dont make them yourself.

So, what happened to me? Well, my email account was hacked. This is my main google account for Voice, Picasa, Analytics, and AdSense. However, it was not my primary email account. It was however my primary account for gTalk.

The account was hacked because of 2 reasons. 1: my password was week. 2: I had not changed it in a very long time. I consider both of these to be totally my fault.

[More]

Hey Apple: Can't we all just get along.

I have waited a few days to write this while I gather my thoughts. I wanted to get a feel for how others were feeling and see their responses. I will probably talk more about this on an upcoming episode of my podcast CFhour().

There has been lots of talk lately about the proposed change to the iPhone OS4 EULA. It seems to be all that people are talking about. Not just those that use Adobe products but others as well. This EULA change impacts a much broader audience than most realize. The EULA change basically squashes anything that can be used to generate iPhone apps that is not Apple's IDE.

The EULA change from Apple came out just before Adobe was set to announce the release their CS5 suit. The suit that included the tool to publish Flash based applications as iPhone applications. I highly doubt this was a coincidence. I think that everything that Apple does is calculated to get the largest impact.

Like I stated, this change impacts everyone. Well, anyone that intended to create applications for multiple platforms with the same code base. If most programmers are like me then they know a few languages. Once you learn a couple the rest become easier. However, with the ever changing technological landscape, is getting harder to keep up. With new tools like those from Adobe and Titanium, I could make applications in what I already know and deploy my app to more places.

The ability to create one code base and deploy to many devices is very compelling to us, the programmers. Writing programs that are device specific is hard. It is very time consuming and complicated. For the non-programmer it can be compared to this. Write a document in Word so you can send it to your friend that has a Windows PC. Now, if your other friend on a Mac wants to read the document you have to rewrite it using Notepad from scratch. No cut-paste allowed, you must retype it. Sounds hard and insanely unnecessary huh?

Well this is what Apple is doing to us with the EULA change. We now have to make a decision before we start the project. Will we create an iPhone version of our app or not. We can create an app and then deploy it to the desktop (any OS), Android, Blackberry and others with the same code base. But, if we want to support the iPhone/iPad/iPod then we must make a version for them from scratch.

As I told a friend of mine. I have a shovel and want to use it in everyone's sandbox. However, apple made it so that my shovel is incapable of moving their sand. So I now have to decided on weather or not to get a specialized shovel for their sandbox or not play in it. I personally have no intent on getting that shovel. I have plenty of shovels already that work for me.

This, for me, is a total travesty. This is to me something like Apple smacking the technology world in the face. To me, the have this air of superiority and appear to have this "we can't go wrong" attitude. It is like Apple is playing big stack poker. They have 3/4 of the chips and are using their stack to control everything. There are some new players at the table but they don't have enough chips yet to push back.

Well, these are my thoughts on the topic. However disjointed and all over the place they are. I don't see this as an Apple vs. Adobe issue. I think it is an Apple vs. Technology issue. I hope that Apple and the rest of the technology community can work this out. In the end, all that Apple is really hurting is the consumer.

Till next time...

--Dave

Blog is back up - (I think)

Ok.. well after a day or so of issues, my blog is back. Once I get all the details together I will post as to what went wrong. But, to be honest. I still do not know what went wrong. I am still trying to solve the issue permanently. I just put in a HUGE work around to prevent the crash.

Till next time...

--Dave

More Entries