Today is a good day to code

Installing ColdFusion MX 7, and the Apache Connector on Leopard Server (10.5.5)

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

Installing ColdFusion MX 7, and the Apache Connector on Leopard Server (10.5.5)

Picture of IrvinThis weekend, I spent an unpleasant 24 hours or so working on upgrading a client’s server to Leopard 10.5.5. The actual Leopard upgrade went pretty well on the G5 XServe. The secret to that was having a crossover cable, and knowing the specific RackMac system identifier to be able to get the IP address to SSH into. The problems started with ColdFusion.

Now I am going to rant. My client has an Enterprise license, so we aren’t running on some hacked up installation, we are running a major OS that has been on the market for about a year, it has been in the hands of developers for more than a year. That there isn’t a proper connector bundled with the installation is criminal. If I wanted to go hacking around inside of source code, building crap, I could run open source. Why did we pay so much money for this? I will not write any more private applications with ColdFusion. If a corporation wants me to build ColdFusion applications, I may, but only after I try to convince them to go with something that is more likely to be supported on UNIX / Mac OS X.

I mean, how long has Apache 2 64-bit been out there, this shouldn’t come as a surprise to Adobe. I can’t trust that they will support major platforms going into the future. This is because of one or both of two things. The first possibility is that Adobe doesn’t want to put money into ColdFusion because it is dead or dying, the second is that Adobe wants to force people to upgrade to ColdFusion 8 by any means necessary. What Adobe has done is to make me look bad in front of my clients for choosing a technology that was not supported. I have already begun to write my applications in RoR, now I am definitely going to write my applications in RoR. I am done. I could have made so much more money writing code instead of screwing around with compiler flags.

The problem is that I would expect to run into trouble installing or running my software when using OSS. That comes with the territory, but when you buy software and it claims to support the platform, one would reasonably assume that the platform would be fully and actively supported. Anyway, rant over.

Now I will show how I fixed the problem:

First:

If you have a standalone installation (the only one that works), you will need to start it by switching to your ColdFusion directory, if you followed the defaults, it will be /Applications/ColdFusionMX7/runtime/bin. You will need to issue the JRun command from here ./jrun -start coldfusion. This will work, if you try to start it any other way, you will get the THIS_PROCESS_HAS_FORKED errors.

If you have installed it in multi-server, you are screwed, I have not found any decent way to get this to work.

Second:

You should be able to get to the administrator on http://127.0.0.1:8500/CFIDE/Administrator/index.cfm. Then you will need to set up the connector, this was crazy. The solution I am about to post I found on Scott Pinkston’s blog. The post is called ColdFusion 8 Leopard with apache an answer for the rest of us. It is generally for CF 8, but it will work on ColdFusion MX 7.

Here are the steps from his blog:

go to terminal window.
cd /Applications/JRun4/lib
unzip -d src wsconfig.jar
cd src/connectors/src  

apxs -c -Wc,-arch -Wc,x86_64 -Wl,-arch -Wl,x86_64 -n jrun22
mod_jrun22.c jrun_maptable_impl.c jrun_property.c jrun_session.c
platform.c jrun_mutex.c jrun_proxy.c jrun_utils.c

apxs -i -n jrun22 -S LIBEXECDIR=/Applications/JRun4/lib/src/connectors/src/
mod_jrun22.la

strip mod_jrun22.so

Now run the connector configuration:
sudo java -jar /Applications/JRun4/lib/wsconfig.jar

After it finishes, run this command:
cp /Applications/JRun4/lib/src/connectors/src/mod_jrun22.so /Applications/JRun4/lib/wsconfig/1/mod_jrun22.so

sudo apachectl restart

The order of the files to be compiled is *IMPORTANT* I was working on a Dual-G5 2.3 GHz so my command was /usr/sbin/apxs -c -Wc,-arch -Wc,ppc64 -Wl,-arch -Wl,ppc64 -n jrun22 mod_jrun22.c jrun_maptable_impl.c jrun_property.c jrun_session.c platform.c jrun_mutex.c jrun_proxy.c jrun_utils.c.

You will get some warnings, you can ignore them. If you get an error saying something about functions that start with an underscore in your apache error logs, when you try to start it, you have the file names in the wrong order. If you see an error that says it found the module, and it is mach-o, but it is the wrong architecture, you are probably using -WI (I as in imitate) instead of Wl (l as in Larry).

Step 3:

Make sure to add the add handler to your httpd.conf. in the ifmodule for mod_jrun22.so. Mine did not install this by default, so my ColdFusion templates were coming up with the code showing up as plain text. Here is the default handler: AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf.

I hope this prevents anyone from going through the ridiculous configuration nightmare that I went through this weekend. I apologize for the rant, but I have some other cool projects that I would rather work on than spending forever hacking around with my application server.


Google Sitemaps

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

Google Sitemaps

Picture of Irv Owens Web DeveloperAnother couple of projects I started working on was getting a properly configured robots.txt, going, and to use Google sitemaps. If you have a gmail account, and you are a publisher, this is a very easy way to make sure Google crawls your site properly, and knows about all your links. One of the things I have noticed about the googlebot is that it frequently hits my homepage, but it would always only index the blogs that were directly linked to from that page. It would almost never go all the way through my site to get to the oldest articles.

Here is the code from the component that I am using to generate the sitemaps file. I modified the code originally avaliable at ColdFusion based Google Sitemap Creator. It is a .cfc so it should be pretty plug and play. Of course I will change the sensitive details about my site…








http://www.owensperformance.com/index.cfm
#theDatetime#
always

1.0


http://www.owensperformance.com/resume.cfm
#theDatetime#
monthly

0.9


http://www.owensperformance.com/aboutus.cfm
#theDatetime#
monthly

0.3


http://www.owensperformance.com/blog.cfm
#theDatetime#
daily

0.8






http://www.owensperformance.com/blog_content.cfm?
articleid=#urlString.articleid#

#theDatetime#
never

0.7





file=”#ExpandPath('../sitemap.xml')#”
output=”#theXml#” nameconflict=”overwrite”>
Google Sitemaps Overview


ColdFusion “Scorpio” Possible New Features

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

ColdFusion “Scorpio” Possible New Features

Picture of Irv Owens Web DeveloperOver on Ben Forta's blog, www.forta.com, he has a discussion running about new features for ColdFusion MX 8. One of the things he suggests is tighter integration with Microsoft Exchange. I think that would be very cool, but I'd agree with some of the readers over there that some type of iCal support would be sweet along with the ability to interact with a mail server using IMAP.

I'd like to use the Exchange interaction to allow my applications to use the events for a particular user as a trigger, for example, if a user had an event set up for a particular meeting room using a custom ColdFusion meeting booking system, the server could see if that room were still free about two hours before the meeting and if it weren't, it would send an email to all the meeting participants, in the Outlook format, to reschedule the event or change its location.

That's a really simple way to use it, and I'm sure there are others, but it would be helpful. I would like to see IMAP support so that I wouldn't have to actually pull down a user's mail in order to display it using the cfpop tag. It would be nice to have a customizable mail interface.

What I would really be interested in was an optional built in framework of some type, and upgraded SESSION management. While I don't mind having to use cflock whenever I am using SESSIONs, it would be really cool if I didn't have to use it. I also think that it would make development much easier for those who don't read up as much as I do, fail to use cflock, and end up with large applications with SESSION breakdowns. It might be cool to have another type of shared scope for objects that would automatically check to see if there were an instance of the object. If there was, then the system would use that instance unless told not to. If there were no instance, it would load a new instance from the disk.

Wow, I thought I had no real opinion about the upcoming version of ColdFusion, and that I was pretty happy about its current level of functionality, but I guess there are a couple of suggestions that I could make. More support for Mach-ii and other frameworks via a system level plug-in would be nice. Perhaps if they were more integrated into the application server, they could allow more convention-over-configuration like rails.


Whirlwinds of Code and Forming Design Patterns

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

Whirlwinds of Code and Forming Design Patterns

Picture of Irv Owens Web DeveloperOne of the biggest issues with understanding object oriented programming is getting over its associated terminology. Most developers whether they realize it or not have formed design patterns, and use them all the time. If an established developer were to look at their code, they would often see that their application was broken down into data access and storage components, display components, and the logic that allows them to successfully communicate. When asked to bring a system from one application to another, they can usually do it with little to no modification. This is the idea behind design patterns.

In an interview yesterday I realized that I had better take a more aggressive look at design patterns. Understanding the terminology may be tough, but it is an excellent way to communicate an application's business needs, especially using UML, as well as getting down to the lowest level of describing the objects that will comprise your frameworks. I have always tried to get a firm handle on design patterns, but they have largely eluded me. I have understood simple systems like breaking your code into well defined model-view-controller layers, and using messaging to communicate between layers, but I have never really been able to understand the more advanced concepts. In the interview I noticed that I was designing with some object oriented concepts by using Fusebox, even if I didn't know what to call them, but ignoring some of the more specific ones.

Programming is often like the game Dark Cloud for the PlayStation 2. For those who haven't played the game, it is a role playing game in which the player travels around their world trying to re-assemble their world, which was scattered by an evil genie. The player is provided a weapon which is pretty weak to start with, and by travelling around the world, they can gain objects which make their weapon stronger. When they get enough objects, they can merge their objects permanently into the weapon, increasing its effectiveness. They then begin the process anew, adding objects to the newly enhanced weapon until they can merge it again. When you have better weaponry, the player can gain pieces of their world more quickly and can assemble more complex worlds in shorter time. It is like this with programming. Often I feel as though code is whirling around me and once I have that “aha!” moment it merges and becomes something solid for me that enables me to take the next step. Building large applications has caused me to develop different frameworks or APIs for me to use. For example, most of my applications require search, so I have developed a pretty thorough search framework, made up of components, that can be moved with little modification. I wouldn't have known that it was that, but it is.

Today, or last night rather, I had one of those “aha!” moments, the moments we all write software for. I was finally able to put names to some of what I was doing. Now that I am beginning to understand, I can see why it would be hard for experienced object oriented developers to explain to procedural developers how to do OO design. You just begin to think differently. I can see about ten areas in which I can improve my search API / framework to make it more portable. The hardest part is finding the dragon, slaying it is easy. In other words, associating design patterns to what you are doing is hard, once you can put names to faces so to speak, the rest is simple. For a while I could never understand why people were so excited about Microsoft enabling the use of C# in SQL Server 2005. But now I can see, you can create an entire data access framework all on the database server, abstracting the underlying database and its queries from the application. It would be possible, in a web application, to completely separate the model from the controller and view layers. This has huge benefits in code maintenance because you could have any number of applications using the data access framework through web services.

What really dragged it together for me was why Java was so tough. I realized that it was tough because my mostly procedural mind was trying to write a program thinking about what each class should do instead of things like what does this class know about itself, what is it's purpose. How do the methods inside it work to help it achieve its purpose. In short I was trying to write a simple program, instead of thinking about a toolset to help me achieve my goal. With Java, you have to diagram, you have to chart or you will just get lost. Even objective-c makes more sense, with over-riding the init method for objects. These things didn't make sense before, but now I am getting it. I still have a long way to go, but I think I'll start working with Mach II, even if there is a performance hit. That is a little more OO than Fusebox, but Fusebox is a great foundation for it.

All that being said, there are still some instances where you can go too far with data encapsulization. For example if you had a table that had contact information in it. You wouldn't want to return each row, create a struct out of it, then set an iterator method to go through each struct, then each element of the structs, at least not in ColdFusion. Iterating over a query is something that the built-in elements of ColdFusion do fairly well anyway so building frameworks to disassemble a query object, then re-assemble it as a bunch of structs is probably an un-necessary layer of complexity for most applications. So like anything else, discretion is required. Now I'm ready to tackle the UML book and hopefully figure out how to use that nifty ID3 tag reader framework for Objective-C that I downloaded a while back and couldn't quite figure out how to use. I've got Macintosh applications that need to be developed.

Here are a few of the sites that helped me get to the “aha!” moment.
Macromedia exerpt from 'Design Patterns'
ColdFusion object factories, the Composition CFC
Introduction to the Mach-II framework


ColdFusion MX 7 Licensing Issues

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

ColdFusion MX 7 Licensing Issues

Picture of Irv Owens Web DeveloperI have been wrestling with an issue that should not be an issue that anyone should have to deal with. The licensing issues around a piece of software. The piece of software happens to be ColdFusion MX 7. The issue is that I am running it on OS X Server on a brand spanking new Xserve. I have everything installed properly, all my applications are working, and the server is operating beautifully. It should be nothing to plug in the serial number to put the finishing touches on it right? Wrong.

I have my client purchase a standard license for the “other” installation of ColdFusion, and the Mac OS X version of JRun. He proceeds to do so and sends me the serial numbers for both. I am excited because I'll finally be done with setting the server up and can get back to developing applications. I bring up the JRun administrator, put in the serial number with no problem. JRun says fully licensed 2-cpu version. I am very happy as I bring up the ColdFusion administrator to put this baby to bed. Once I bring up the admin, and get to the system information screen where I can enter the serial number I enter the number with no hesitation. The server responds that it is not accepted. Taken aback I check the number twice and have the purchasing agent fax over the list of numbers. No, the number is right. I go on a long excursion of un-installing ColdFusion, re-installing ColdFusion. Trying to put in the serial number at the beginning of the installation. That doesn't even work, it says that I already have a version installed, even when I don't. I know because I formatted my computer to make sure every vestige of ColdFusion was gone. I even installed it onto my PC putting in the standard serial number to see it work just fine. Neither myself, or the purchaser saw that to run the J2EE version of ColdFusion you must purchase the “Enterprise” license.

Let me say that again clearly so that anyone else running into this issue can find this on the web and save their time.

ColdFusion can not be installed in standard mode ever using the J2EE / “other” version.

This was bizarre to me, not because we both missed it, but instead because during the purchasing process a warning didn't come up letting him know that we couldn't use the “other” installation with the “standard” license. I know that running ColdFusion on Mac OS X Server is not supported, but they could at least let users run ColdFusion standard if they want to. When I got them on support I indicated that it appeared to be a nickel-and-dime, bait-and-switch sales operation. Buy this and then if you want it to really work, you have to buy this.

My feelings regarding this are like one would feel to a significant other who had wronged them in some way. On one hand you still love them and couldn't think of a world without them, but on the other, you wish they would go away forever. This isn't the first time I have felt that way about Macromedia. So, here is a situation where I will probably have to re-write my applications in either PHP or JSP. Macromedia, since we have bought JRun, doesn't seem interested in swapping out our standard and JRun enterprise licenses for a single ColdFusion enterprise license with the JRun license. It would be fair for us to have to throw in an extra $1,000, but another $3,000. As sweet as ColdFusion is, I'm not sure it is worth the cost. I've never had to buy it before, and I don't think I would.


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.