Archive for May, 2006

cfObjects Framework Still Active

I’ve been slowly, but surely, working on a new version of the cfObjects framework, mainly for my own use since quite a few of my clients’ sites were developed in it. Also, partly because I still enjoy tinkering around with it. Out of curiosity, I visited the Sourceforge site I made for it years ago and was pleasntly surprised to find out that it’s still active. It has a few downloads every months, so I guess other people are still using it. I’m glad.

Of course, its popularity declined drastically once CFMX came out with support for CFCs and with the surge in popularity of other frameworks such as Fusebox, Mach-II and Model-Glue. However, my updates should be of interest not only to current users, but others looking for a different framework to try.

Here’s what I’ve got so far.

  • AjaxCFC integration
  • Multiple object inheritance
  • Full CFC spec conformance
  • Three different implementation styles
  • External object method implementation
  • Updated event model

It’s going to be very flexible, easy to implement and fast to develop with. Hopefully I’ll have it done soon. I just wonder who else it still using it, if anyone, or are people just downloading it out of curiosity.

Java Subsystem Access Via ColdFusion

A recent question on the CF-Talk lists had been asked several times in the past, so I thought I’d post some basic code routines for accessing parts of the Java engine via ColdFusion.

System Properties

<cfscript>
sys = createobject("java", "java.lang.System");

// Set a system property
sys.setProperty('myProperty', 'myPropertyValue');

// Assign local variable to properties structure
props = sys.properties;
</cfscript>


<cfdump var="#props#">

All ColdFusion Sessions

<cfscript>
sessiontrackerObj= createObject("java","coldfusion.runtime.SessionTracker");
activesessions = sessiontrackerObj.getSessionCollection(application.applicationname);
nosessions=ListLen(structkeyList(activeSessions));
</cfscript>
<cfoutput>
<h3>Total Sessions : #nosessions#</h3>
</cfoutput>
<cfdump var="#activesessions#">

* Courtesy of Snake’s Blog

Java Memory Usage

<cfscript>
// Create Java object instances needed for creating memory charts
runtime = createobject("java", "java.lang.Runtime");
mgmtFactory = createobject("java", "java.lang.management.ManagementFactory");
pools = mgmtFactory.getMemoryPoolMXBeans();

maxJVM = runtime.getRuntime().maxMemory();
freeJVM = runtime.getRuntime().freeMemory();

newGeneration = pools[2].getUsage().getUsed();
survivorspace = pools[3].getUsage().getUsed();
tenuredGeneration = pools[4].getUsage().getUsed();
permanentGeneration = pools[5].getUsage().getUsed();
</cfscript>

Political Technology

I’ve never posted any political opinions on my blog before, but the article I read today about the NSA recording every single phone call made in the U.S. really tears me up.

Not why you think it would either.

It’s the apathy of most Americans. I’m a very active citizen, while most everyone I know is completely ignorant not only of local issues and candidates, but even larger issues threatening our everyday liberties. While I find this act by the NSA deplorable, and indefensible, I have to sit in awe of the technological juggernaut that this program must be.

I know of no one besides myself who actually takes the time to read what their local representatives stand for, let alone write to them voicing their opinions. Very few of my acquaintances actually vote, which is disgusting, and every time one of them start blathering about how they don’t like this or that, I just ask them why don’t they vote.

It’s very simple: if you don’t like what your elected officials are doing with their voice in our government, simply vote them out for another person who will do the right thing. The National Committees of the two major parties in this country have done a fantastic job of installing the thought “well I have to vote for a Republican or Democrat because they’re the only one’s who get in office”. I sincerely hope that I don’t have to point out the idiocy of that way of thinking.

Average Americans have been snowballed, hoodwinked, bamboozled and stymied by these organizations to the point of complete indoctrination – and that’s a dangerous state to be in. True, parties like the Libertarian Party, independant candidates and the Green Party get a good amount – albeit insignificant – of votes, but until we start teaching our children that they can vote for whomever they like and that if you get enough people to vote for someone, they can represent you in Congress, will the Rep/Dem deadlock be broken in our political system.

Wake up America and flex your Constitutional muscles. We run this country, not our elected officials… that’s why we elect them, to make the decision we want them to make.

Here’s some very simple steps you can take to start to get to know your local, regional, and state representative.

  1. Take the World’s Smallest Political Quiz to find out what political party you really should identify with
  2. Read you local newspaper (hardcopy or online) on a regular basis to keep up-to-date on local government activities. It doesn’t have to be every day, even just reading the Sunday paper every week will keep you fresh.
  3. Contact your House representative and/or state Senator and ask their office to send you a policy statement
  4. Watch, or listen, to a debate by local candidates. The national ones are useless and don’t effect your everyday lives nearly as much
  5. Write a letter to, or send an email, to your representative expressing your views. Believe it or not, they do listen.
  6. Next time an elected official is in your area to address or meet the public, go and meet him/her. If it’s an interactive session, stand up and make your voice heard.

Apache Proxy to JBoss and IIS

Well, I finally had to enable some PHP sites on my servers, effectively ending my ColdFusion-only epoch. Getting IIS up and running alongside JBoss (or even JRun) turned out to be ridiculously easy with Apache. As was my experience with JBoss, the documentation from the vendor turned out to be somewhere between poor to adequate and I ended up relying almost completely on the examples and tutorials placed out by others on the Web.

Now that I think about it, it wasn’t “ridiculously” easy because I had a problem with IIS and JBoss attempting to listen on the same IP address even though I went into IIS and changed the configuration. Luckily this was a documented issue and I found the resolution easily (more info below).

Step 1 – Install Apache

I downloaded version 2.0.58 which works just fine for my purposes.

Apache Configuration

Find the ‘Listen’ section of in the \Apache\conf\httpd.conf file and specify the IP address and port on which Apache is listening.

Listen 192.168.1.200:80

Now, since I’m hosting multiple domains on my system, I need Apache’s virtual hosts to match up with each JBoss virtual host. You can read my article on hosting multiple domains with JBoss for more information on that. the first thing to do is tell Apache that this IP/Port will be using Named Virtual Hosts instead of IP Virtual Hosts.

NameVirtualHost 192.168.1.200:80

Now that Apache knows the it’s going to be accepting request for multiple domain names, we need to set up each of those domains using the <virtualhost> tag. All you need to specify is the ServerName property, which the the base URL of the domain, and the ProxyPass property which simply tells Apache where to redirect the original request.

<virtualhost>
ServerName www.orbwave.com
ProxyPass / http://www.orbwave.com:8080/
</virtualhost>

<virtualhost>
ServerName www.fusioncube.net
ProxyPass / http://www.fusioncube.net:8080/
</virtualhost>

JBoss Configuration

As you can see above, if you’ve got JBoss listening on port 80, it will conflict with Apache and you need to reset it to listen on port 8080. Then Apache redirects the request to port 8080 to be fulfilled by JBoss.

IIS Configuration

Now here’s the tricky part. IIS can’t listen to requests on the same IP address as Apache or it tries to hijack all requests by default. Therefore, you need two IP addresses to be assigned to the server accepting these HTTP requests. Two ways to do that:

  1. Install another network adapter, assign is a distinct, static IP address and plug it into the network.
  2. Assign another IP address to the network adapter you’re already using.

Now you have to disable socket pooling in IIS. You have to use a utility called Httpcfg.exe to disable it. This utility is found in the /Support/Tools folder on your Windows Server 2003 CD.

Open a command prompt and type httpcfg set iplisten -i w.x.y.z:n to set the new IP address (w.x.y.x) you added to your network card and port number on which you want IIS to listen. This inclusion list specifies which IP addresses http.sys listens on and is initially empty by default, which means that IIS listens to all IP addresses.

Then restart IIS because http.sys reads this list only on startup. You don’t have to restart all IIS services, only the HTTP Service.

Summary

It takes a little work, but it’s not difficult as long as you have all the information. I now have PHP, ColdFusion and ASP sites running happily on the same server thanks to this setup and I (and a few clients) couldn’t be happier.

System Manager 1.4.0.4 Released

Quick fix for System Manager timing out too quickly when starting/stopping services. Thanks for John Umbridge for finding the bug.

Download System Manager 1.4.0.4 now