Today is a good day to code

Macromedia or Adobe Studio 8

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, Programming, Uncategorized | Tags: , | No Comments »

Macromedia or Adobe Studio 8

Picture of Irv Owens Web DeveloperToday I started looking at Studio 8, and of course I am impressed by Flash 8. But I'm really drooling over Dreamweaver 8, which of course will get more use. I like the new video features of Flash 8 and the performance increase is definately welcome, but for all intents and purposes Flash MX is still great. But as always the brilliant marketing folks at Macromedia have priced the upgrade aggressively to move the entire suite. What is interesting to me is that they are still bundling flash paper. I would have thought it would be pulled in favor of the soon-to-be-included Adobe Acrobat. I guess the ink hasn't dried on the agreement yet.

Some of the things Macromedia is promising in Dreamweaver 8 that look good to me are, Section 508 compliance and complex CSS rendering. As well as XML / XSLT reference materials. The reference section has been by far the biggest thing to keep me using Dreamweaver over using other tools. The visual XML editor should be cool too. I'll probably pre-order the suite. I'm looking forward to using Fireworks as I have always preferred it to using Photoshop. Before I get flamed, let me remind you all that I am a developer first, and a designer second. Plus I got the Suite MX before I got Photoshop CS so that is my tool of choice. I can't wait to see what some of the designers are going to do with Flash 8.

My only long lasting gripe that has almost led me to create my own WYSIWYG editor several times is that the FTP process in Dreamweaver is awful. It doesn't make sense that this is not spun off onto it's own thread running separately from the application with a lock on the file that is currently in process. Why this wasn't done in Suite 2004, I'll never understand. It makes me use my favorite FTP tool Transmit instead of the one built into Dreamweaver, which is somewhat inconvenient.

Of course the RDS stuff for databases and the CFC components panel is nice, but it would be great to see some real commitment to ColdFusion with a CFC browser like the one that is built into the Administrator working through the RDS connection. Also, while I'm at it, it would be cool to have the CF validation tool in Dreamweaver to quickly validate CF templates against different versions of ColdFusion. Especially for those of us who got our CF legs in MX, but who sometimes have to work in 5, yuk!


The Future of Scripting

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, Companies, Microsoft, Programming, Sun Microsystems, Uncategorized | Tags: , , , | 1 Comment »

The Future of Scripting

Picture of Irv Owens Web DeveloperInitially I wanted to stay away from scripting languages as a developer due to the fact that they weren't really programming languages at all. For some time I was reluctant to even call myself a programmer until I built my first Java desktop application. In CNET's open source blog today, they ask the question has scripting peaked?

Scripting hasn't peaked out yet. The reason is clear. Building a web site with C++ or Java is like driving an armored tank to your mailbox. It is that ridiculous. The funny thing is that even Microsoft realizes this, giving their ASP.net developers two languages to choose from when developing web applications. There are many reasons for enterprises to choose C# over Visual Basic when building a web application, especially if they already have desktop and client-server applications built using the technology. It would be possible to completely reuse many of the methods used in the desktop application for the web application. The frameworks built into J2EE as well as C# allow for robust development making it less likely that a developer will lose control of their code. Still, using these technologies and frameworks where a scripting language and a light framework would do adds un-necessary overhead to a project and can push deadlines out unreasonably.

Here's what I see. PHP is a fantastic scripting language that has no real back end and therefore is suitable for light to moderate customer facing websites and some intranet applications. Use of PHP in this regard will only continue to grow. I think some of the 25% decline in worldwide use is a reactive measure to PHP's early security vulnerability. PHP is losing ground quickly to ASP.net and VB scripting as Microsoft's Server 2003 is more widely adopted. Personally I think that LAMP is superior for many tasks, but ASP.net is almost ubiquitous now, hosting and maintenance are cheap. I'll continue to use PHP for light jobs, but at the same time I realize that this is just a preference and performance-wise ASP.net is better. Talking about Java… Sun needs to buy ColdFusion from Macromedia / Adobe. It should be THE Java application server. There is no cleaner and easier scripting language, and it has nearly unlimited flexibility and is design-pattern friendly. Why this move hasn't occured yet is beyond me. It would have made sense for Macromedia to sell it, but I think the issue is that Sun has many proud engineers who love to over develop products. The thought of supporting something as business friendly as ColdFusion probably makes them sick. The business case for this is probably that Macromedia probably sees the big picture and that there are big bucks in ColdFusion, especially now that enterprises are seeing it as a way to get around JSP's notoriously long development cycles.

I see scripting as having a bright future, and I'll tend to side with Zend's guys as saying that regardless of how the Evans study got its numbers, PHP is increasing in use not decreasing. I'm not sure if it is true, but if the next version of IIS is going to have PHP support built-in, I'll be seriously considering going with a Microsoft server in the near future and running it alongside ColdFusion. I like PHP, but I just like ColdFusion better.

news.com – Scripting's demise


Pondering Switching the Other Way

Posted: December 31st, 1969 | Author: | Filed under: Apple, ColdFusion, Programming, Uncategorized | Tags: , , | No Comments »

Pondering Switching the Other Way

Picture of Irv Owens Web DeveloperWhile I have been a Mac user for the past five years almost exclusively, I have been thinking lately about switching back to using a PC. The reasons for this truly stem from my need for the ultimate in geekery. I'd really like to get a dual-core Pentium 4. The tremendous advantage is that these cores also employ hyperthreading which to the OS looks like four discreet CPUs. Also, I have the urge to work in several 3D programs, none the least of which is Swift3D, that I have noticed run significantly faster on the newest Intel and AMD based machines than on the Macs.

But the Macs are going to go Intel you say. That is true, but the Mac prices aren't going to change. That is almost guaranteed. There is no way Apple is giving up it's hardware margins, nor should they. I have a choice, and I can get more bang for my buck going with a PC. This has always been true, but at one time I was happy with an iMac G3. The iMac has always been competetively priced relative to it's PC counterparts so I was content. When I first bought my G5 I was relatively content. Now the issue is that G5s cost about $2,000 at the entry level. I can take that money to Dell and get a Dual-Core P4 that will take it's lunch money on any given day, albeit with several crashes along the way.

But you by a Mac for the software, that is why it is worth it. This is true, and Mac OS X is definately superior to Windows XP and probably it's upcoming service pack, Windows Vista. I will miss it, but running Mac OS X does not enhance my productivity in any tangible way, it just looks better and the entire OS crashes less. I have had plenty of application crashes, which are about the same.

What it comes down to is what my current computing needs are vs my wallet, and in that game the Mac is at a severe disadvantage. We won't even talk about gaming. But the ultimate reason is my geekiness. I have a weak spot for Visual Studio 2005. After using several betas of the application via Microsoft's Express Beta program, I have to say I am impressed with the ease of developing using C# in this IDE. Their visual web developer software is equally compelling although unless I had to I wouldn't use ASP.net for just about anything. Not because it is bad, but because it takes so much longer to develop anything in than ColdFusion or PHP. Ultimately, my love of new technology and my desire to retain as much of my cash as possible is fueling this internal debate. I will probably not buy another Mac because of the cost, but at the same time I will not give up my iBook. I'll probably carry a Mac laptop for the forseeable future. My workhorse, the desktop however is definately another story.


Internet Explorer 6 Hangs with Multiple Connections

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, JavaScript, Programming, Uncategorized | Tags: , , , | 6 Comments »

Internet Explorer 6 Hangs with Multiple Connections

At work we are using the demis map server, which by itself is an incredible application. We had built a flash based client as our application to allow people to see images overlaid on top of the vector data digested by the map server. One of the issues we had observed with the application was that it tended to hang, or stop responding when a user would ask for many images to be shown on top of the vector map, then they navigated away from the current screen. Now, since I had seen the code and it was a mess with JavaScript setting cookies that ColdFusion was supposed to read and pass to flash, and images for checkboxes, I automatically suspected the code. However, the problem was deeper than that.

The code needs to be rewritten no doubt, there are many more efficiencies to be had, but that didn’t explain the hang. I combed over the server, watching response while a user was using the application. The map server stresses the machine, because it needs a ton of I/O and it would spike the CPU frequently, but no processes went to 99% CPU utilization, and the server seemed to respond to other clients even when one of them was hung up. It was pretty clear then that the problem wasn’t with the server. To take this logic a little further, we built a load test using wget and saving the result to a file. We looped over the calls as fast as we could and we never caused the map server to hang. It performed as expected.

The next logical step was to look at the possibility of corrupt files. We did notice that we could get the map server to crash when we fed it corrupt files, but we found no eveidence that the files that we were using in production were corrupt in any way. At this point we were plenty dejected, because we had spent something like 35 hours over a couple days working on this problem and we had nothing. We performed a new ColdFusion install on a different server, we built a server with better hardware, we reinstalled the map server application multiple times, nothing seemed to affect it. We even improved the network bandwidth available to the client, still nothing. At that point I was down to either it was the code, or it was the client.

To test this theory I commented out all of the flash calls on every page and went through the application to try to cause the system to hang. I couldn’t do it, so I had effectively limited the possible cause to the Flash movie. I started to go through what the Flash movie was doing, and what could cause it to fail. The demis people told us that they had seen hangs when the map server wasn’t responding, and the Flash player was parsing XML. This lead me to try the application in Firefox, and lo and behold, it never hung up. It worked like a charm. The only problem was that our client was set on Microsoft Internet Explorer

I started about the arduous task of removing all XML parsing from the Flash code, then I tried it and it still hung. I was truly disappointed, but I rethought what was happening with the XML. It was making server calls, I realized that I could have up to 8 consecutive connections going on. At the time I thought it was nothing, but then I started trying to find out what was different between Internet Explorer and Firefox. I happened upon an article on MSDN about a known bug that Internet Explorer will hang for 5 minutes when there are 2 persistent connections to a server, and rich content is downloaded. I had found my culprit. It turns out that I had to add 2 keys to the registry. MaxConnectionsPerServer, and MaxConnectionsPer1_0Server. I set the latter to 8 and the former to 24, hexadecimal. The keys need to be DWORD keys.

That would allow 8 connections for HTTP 1.0 and 32 or so connections for HTTP 1.1. The HTTP 1.1 guidelines recommend that there only be 2 connections allowed, but if Firefox wasn’t adhering to it, why should I. I added the keys to HKEY_CURRENT_USER>Software>Microsoft>Windows>Current Version>Internet Settings and it worked like a charm. Everything was perfect. Talk about looking for a needle-in-a-haystack. I’m still amazed that I found it.

The purpose of this entry is so that no one has to go through the week that I just went through. Generally no software should be in front of the client before it is ready, but in this case we already had a client. Hopefully this will help anyone out there who is experiencing hangs in Internet Explorer. Darn Microsoft and not fixing bugs for almost 3 years!

*EDIT Make that 8 years, since IE 8 appears to still suffer from the same problem!*

Here are some helpful links that might be better at explaining than I am…

Wininet Connection Issue

IE Hang Issue


Preventing Comment Spam With Spamhaus in ColdFusion and Java

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, Programming | Tags: , , , , | 3 Comments »

Preventing Comment Spam With Spamhaus in ColdFusion and Java

Recently I turned comments on again for my blog, but I started getting hammered with spam comments so I looked into trying to figure out how to stop spammers.

Most people rely on some type of image based spam prevention. This is probably performance wise the best solution, the problem is when people with poor eyesight come in, or actual people come to spam your site. This solution doesn’t prevent that scenario.

A client of mine got me to look into SPF for protecting everyone else from someone masquerading as us. That somehow led me to spamhaus again. I had always thought of using them for spam filtering, but what I didn’t know is that you can use them for web submission protection. On the site, I learned that implementing their blacklist filtering is really easy to implement. Basically the way they work is that you supply part of your visitor, whether they are sending an email on port 25 or whether they are visiting on port 80, since Spamhaus includes their web site on their black list, if someone is sending spam mail, they will return for an http request.

Basically you have to send a request over to Spamhaus’ zen DNS server. If it returns a value, then they are a spammer, or at least they are listed at Spamhaus as a spammer. The method you use is you reverse the bytes of the IP address, for example if the IP address is 2.3.4.5 then you would send a DNS request over to Spamhaus like 5.4.3.2.zen.spamhaus.org. For Java and ColdFusion, I use InetAddress, but there are methods in every language to perform these tasks.

To do this in ColdFusion you could use code that looks like this:


<cfset address = CGI.REMOTE_ADDR />

<cfset addressArr = listToArray(address,".") />

<cfset newArray = ArrayNew(1) />

<cfset newArray[1] = addressArr[4] />

<cfset newArray[2] = addressArr[3] />

<cfset newArray[3] = addressArr[2] />

<cfset newArray[4] = addressArr[1] />

<cftry>

<cfset inet = CreateObject("java", "java.net.InetAddress") />

<cfset inet = inet.getByName(arrayToList(newArray,".") & ".zen.spamhaus.org") />

<cset hostName = inet.getHostName() />

<cfif hostName NEQ "">

<cfreturn />

</cfif>

<cfcatch type="any">

<!-- do nothing -->

</cfcatch>

</cftry>

To explain, in the first line you are starting a cftry / cfcatch block. The reason for this is if the visitor’s server is clean, it will throw an error because it won’t be able to get a response. However, if it doesn’t throw an error, it will be able to complete.

So the way this code works is that it takes the visitor’s IP address, splits it into an array, copies it into a new array, and then reconstitutes it into the IP address string but backwards.

It then creates an instance of InetAddress and calls the getByName method passing in the created address and waits for a response. If it doesn’t get one, it does nothing. If it does get one, and the result is something that isn’t an empty string, such as 127.0.0.2, it will return and not allow whatever it is protecting to be executed.

If you are using Java the code could look like this:

try{

InetAddress inet = new InetAddress();

inet = inet.getByName(backwardsip.zen.spamhaus.org);

// this should return an IP, but it really doesn’t matter what it

// returns

String hostName = inet.getHostName();

// this is just to catch a possible error

if(hostName.length() > 0){

System.out.println(‘Visitor is dirty’);

return;

}

}catch(Exception e){

System.out.println(‘Visitor is clean’);

}

So far this is proving to be a good way to check for bad commentors. The problem is that if you are a high-traffic site, Spamhaus will want to charge you for the use of their static list. If you are a high-traffic site, you would want it anyway for performance reasons. I think the cost may be worth it though in hassle.


ColdFusion Frameworks

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, Programming, Uncategorized | Tags: , | 1 Comment »

ColdFusion Frameworks

Picture of Irv Owens Web DeveloperI have recently begun exploring the landscape of potential, mostly object oriented, controller layers for ColdFusion. Three of the frameworks that I have been working with are a substratum framework to add OO style to Fusebox 3, Fusebox 4, and Mach-II. In bouncing between these frameworks I have noticed that there are significant differences between all of them. In fact, I have noticed that for some tasks, one framework is better than another.

Taking Fusebox 3 first. It is possible to add your own CFC invokation layer to Fusebox. This works well for medium to small-sized applications, or applications that need performance. The reason Fusebox 3 works so well, even though it is so old, is that even with the many cfincludes it performs frequently better than Fusebox 4 and Mach-II due to their use of XML. The use of XML for their control files, instead of the fbx_switch.cfm file in Fusebox, enables developers to port their applications to different languages like PHP with much less difficulty. In order to port, you just need to recode your objects, you don't have to rethink how the application works. This is only of benefit however, if you intend to move the application.

The downside to using Fusebox 3 is that it requires much greater discipline from the developer. If you are commited to OO like development, and CFCs. You will have to enforce it yourself, the framework is not going to make you avoid procedural code. In some cases procedural is the way to go, but it is up to the developer to know this.

Fusebox 4 has much improved support for CFCs and OO like programming style. It uses listeners, can implement loop logic in the control files, and also allows freedom, to a lesser degree than Fusebox 3, to the developer to decide how they want to build the application. The XML control files are only read once if you set the framework to production, and then cached which enhances performance. Fusebox 4 performs almost as well as Fusebox 3 in my experience. If you use CFCs, inheritance, binding, and design patterns, it performs slightly better than Mach-II but significantly slower than the same application, coded differently in Fusebox 3 since Fusebox 3 doesn't support CFCs in the same way. It is possible to use design patterns in Fusebox 3, but it still seems just a hair faster. Granted none of this analysis is scientific, it is just my observations over time.

Mach-II I have talked about in earlier blogs, however it is still I think the best general purpose framework. It can perform somewhat slowly due to it's use of the application variable scope for almost all variables, and it's forced “implicit-invokation.” The variable issue can be avoided however by using var frequently in your objects to indicate local variables only. The error catching employed by this framework could use some work and there should be a built in way to cache invoked components to enhance performance, but these features will hopefully find their way into Mach-II 2.0, or a later version. In the hands of a skilled developer familiar with the framework, Mach-II can be very quick and scalable, however in the hands of a novice… Well, OO novices, and people really new to ColdFusion probably shouldn't touch Mach-II, it can be really frustrating. Truthfully the best framework for beginners, and people who have been using ColdFusion for a while, and want to get better at organizing their code should really look at Fusebox 3, in no time they will be ready to graduate to Mach-II. That is my opinion, and of course there are those people who can pick up a ColdFusion book and a Mach-II book on a weekend and be ready to code professionally on Monday, but most people aren't like that.

I've been thinking about trying to create my own ColdFusion specific controller layer, but it is difficult to keep it general enough for any application. Perhaps it would be better to group applications, and develop several frameworks that would work for certain groups. Well, I'll keep at it.

The Home of Fusebox
The Home of Mach-II
Tips and Help for Mach-II


Flash Forms in ColdFusion MX 7

Posted: December 31st, 1969 | Author: | Filed under: ColdFusion, JavaScript, Programming, Uncategorized | Tags: , , , | No Comments »

Flash Forms in ColdFusion MX 7

Picture of Irv Owens Web DeveloperOne of the coolest things in the not-so-new-anymore ColdFusion MX 7 release is the ability to use Flex and ColdFusion tags to generate Flash components without having to design them. One of the perennial headaches for a web developer has been the difficulty in creating self-validating forms, and grid components that could take the stress of sorting off of the web or database servers.

I am not really too into screenshots so I will just show you a sample of the new flash forms. I am not sure if they validate or not, but they are definately cool. The built in forms validation is excellent also, it is handled completely on the client. If you press the submit button without entering any text in the you must enter some text field, it will show you the error. The binding is sweet too, you can bind one item to another in a form. If you notice, when entering text in the top box, you will see the bottom box mirroring it.
Flash Form Example

That is sweet for many different reasons, here is the code behind it:

<cfform name="code" action="http://www.owensperformance.com/test/formExample.cfm" method="post" format="flash" height="600" width="639" preloader="true" timeout="100" preservedata="yes">

<cfformgroup type="tabnavigator">

<cfformgroup type="page" label="Text Entry">

<cfformitem type="text">Enter Some Text

<cfinput name="aninput" type="text" required="yes" message="You must enter some text" />

<cfformitem type="text">Bound to the Above Text Box

<cfinput name="bound_input" type="text" bind="{aninput.text}" />

<cfformitem type="text">A Text Area

<cftextarea name="moreText" value="Some More Text" />

</cfformgroup>

<cfformgroup type="page" label="Grid Component">

<cfgrid name="myGrid" width="624" height="350" query="theQuery" format="flash" align="absmiddle">

<cfgridcolumn name="title" header="Title" />

<cfgridcolumn name="dateEntered" header="Title" />

</cfgrid>

</cfformgroup>

</cfformgroup>

<cfinput name="Submit" value="Submit" type="submit" />

</cfform>

Another really cool item is the cfgrid component. It is a fully featured flash grid that can show any number of objects. I am toying with the idea of implenting it on my search page, using javascript to show and hide the results, but that seems like overkill. I would show one to you in action, but you’ll just have to settle for the code.

This will create a nice grid component that handles sorting for you. It will draw its data from the query myQuery. Each column will pull from the field in the database according to its name. For example the date column will get its data from #myQuery.date#. The others will get their data similarly. I don’t know why I didn’t use flash forms before. They are certainly cool. You can bind to the data in the columns so you could have a field that would allow you to edit the currently selected field in the database. This is extremely handy in creating sensible and usable forms. I hope this helps, some java application servers don’t support flash forms, in fact I am not certain that this one will. However I’ll try, if it doesn’t work, at least the code may be helpful.