Today is a good day to code

Why I Will Never Specialize

Posted: January 5th, 2009 | Author: | Filed under: java, Programming, Uncategorized | Tags: | No Comments »

Why I Will Never Specialize

Picture of IrvinI realized a few weeks ago that I had left behind the concept of being an expert in any particular language. Not that being an expert is all bad, however the pace of change in software development makes it impractical.

For a while now my interviewing ( candidates ) has changed to reflect that belief. I frequently get into constructive arguments with my hiring managers about the types of resumes they are sending to me to screen. The problem isn’t that they aren’t qualified, the problem that I see is that they are insanely qualified. Meaning that they have for example 20 years of Java or something with no hint of other languages, or techniques. I mean how many awesome programmers have you met that had never deployed their own PHP server, or their own tomcat server. How many programmers have had no experience with shell scripting.

Actually a red flag for me is someone who has never even looked at what Microsoft has to offer. I don’t use Microsoft technologies, but I have worked for companies where I did, and I stay as informed as possible about their various languages and APIs. The reason is because I am interested in programming, not in making a bunch of money ( even though that would be nice ) or finding a cush job to lounge in. I really want to understand what is happening inside of the compiler, etc…

I mean recently I started on a foray into what I thought was the V8 JavaScript engine, which is *MEGA COOL* by the way, but I found myself looking at the assembly language commands and thinking, hmmm… I want to understand that. So I started digging in, and now I think that assembly language is cool. Boy, I’m a long way from ColdFusion.

I don’t have anything against people who specialize in one language. That is the way people hire, the reqs always are asking for 10 years experience in Java or some truck like that. I would prefer the req say, and they do when I have control of them, 10 years of programming experience, which means you could be 18 or 75, its all the same to me. The best resumes are the ones where the person has just about every language, with one at around 8 to 10 years of experience, but lots of side projects in everything from lisp to sed and awk. It is probably hurting my chances of getting ahead in my career, but that doesn’t matter, that I won’t just stick to one thing, but I really want to understand this, I want to know how it all works, and I want to have a part in making it better.

It probably means that I am a freak.


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.


What Does a Sun Bankruptcy do to Enterprise?

Posted: December 29th, 2008 | Author: | Filed under: Companies, java, Programming, Sun Microsystems, Uncategorized | Tags: , | No Comments »

What Does a Sun Bankruptcy do to Enterprise?

Picture of IrvinFor more than a few weeks now, I have been pondering some broad implications of companies that we all rely upon failing. Probably the grand-daddy of these is Sun Microsystems.

Normally I wouldn’t be concerned about tech companies going away. It is part of the normal advancement of the art, but in Sun’s case, it does concern me. While I don’t share many developers’ blind love of Java, or Solaris, or any product really. I do feel that Sun has given a tremendous amount to the software engineering community and would be sorely missed if they were to go belly up. At the time of my writing this, Sun’s stock is at $3.41 per share, and their market capitalization is 2.52 Billion, less than Sun has on hand in cash.

I don’t necessarily think that Sun is in financial trouble, but it does seem that there are a bunch of products that they release that are mostly not for pay. Not to mention that their financial performance may / should, be giving some corporate IT departments pause as to their dependence on their technologies. Many companies rely on support from Sun, and if that were to transition to the community, the level of response may not be sufficient. The question I would ask is, “Will a Sun Bankruptcy Drive Corporations Back to Microsoft?”

Unfortunately, I can’t see any other alternative at the moment. There are millions of lines of code out there written against the Sun JVM, and while the JVM is now mostly open source, and so is Solaris, the companies that count on those lines of code typically are not interested in maintaining that code as well. Without Sun, you could have JVM forking, Solaris forking, etc… where a particular application written against Java or Solaris may not run in a given company. Corporations would have none of these problems if they used the .net stack for application development.

Now, I am not advocating that all corporations out there should drop their Sun implementations and run to Microsoft, but what I am saying is that they should prepare themselves for a little instability. I tend to use Ruby and the Rails framework for most everything anymore, but I have come to be somewhat skeptical of the gems that I am using. I am also aware that there is currently no support beyond community support for most of these items, and the developers working on them could get bored and go away. So for functionality that is more than a nice-to-have, I tend to write it myself.

Hopefully this will go away when we start to see professional gem houses, but in the near term, I would hope that companies would begin to diversify their stack a bit so as to mitigate the cost, such as re-engineering their non-core systems to be less dependent on core software from a particular vendor. The last thing you would want would be to find a showstopper bug in something you were about to release that was based on a technology from a shaky vendor, that holds up your business process.

Most good IT shops already support a variety of technologies so as to not be locked in to any one particular implementation from any given vendor, but enterprise developers should not continue to believe that Sun or Java will be around forever in its current enterprise-blessed, no-brainer form. I think serious unbiased evaluation of technologies to be included in future products should gradually become the norm. If Microsoft wins, so-be it, there is some good stuff in .net, but I would hope that Ruby and PHP would benefit from this situation.


The Web as Google”s Data Source

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

The Web as Google's Data Source

Picture of IrvinOne of the things that Google is doing to the web is that it is, I believe by design, deterring individuals from doing things that make the presentation layer richer. The method by which they crawl and index pages leaves out Flash and AJAX content entirely. When a company that bases their revenue on pageviews and or visits is designing a web property, doing an all AJAX / Flash / Silverlight / etc… implementation of the interface is often swept off the table because Google and other search engines can't crawl it. It makes more sense for these companies, financially, to do a tidy looking crawlable interface.

The interesting thing about doing a “SEO friendly” interface is that it often isn't the best from an architectural perspective since your presentation and business logic are tied up in your controller. Technically speaking, you can't change one without the other changing on the application server. I talked about this a while ago in an article discussing the MVC pattern and application servers. Instead what you get, minus any JavaScript and CSS, is a nicely formatted, structured document, ready for ingestion into a massive database, i.e. Google's, and presented through a much nicer UI, i.e. Google's.

When looked at this way, it becomes apparent what the future of the web looks like. At first I was against things like AppEngine and doing SEO based pages until I realized that much of what is happening around us, RSS readers, and the like, are really interfaces that aggregate web content and taylor it to the way I want to see it in an often native interface. When you imagine the web as a massive data source you begin to understand the need to impose formatting rules on the interfaces. Not that crawling AJAX sites wouldn't be a daunting task, but with Google's technology, they could accomplish it, but I don't think it would be in their best interest.

If Google can get everyone to insert their content into the App Engine, then it saves them a step because your content would be inserted directly in their database, no need to crawl. Then Google could create optimized mashups of your content with other content to create superior applications. Anyone using AppEngine, or anything of the sort has to be aware that this is a possibility. If they want to control the creation of mashups, they should not use it.

My recommendation to build a future-proof site would be to build a clean simple version for the web, per Google's guidelines, and then build a desktop and mobile version that can digest your content and present it in a more flexible way. This may change as runtime web scripting languages become more powerful, but in some ways I think that we would be worse off without Google's webmaster guidelines. The web as a data source is a powerful concept, one that I'm sure is not lost on Google, or Vint Cerf. I just don't know how much that concept jives with the way people currently think of the web as a platform.


Do We Really Want Flash for the iPhone

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

Do We Really Want Flash for the iPhone

Picture of IrvinI've been thinking about this for a while now, and I believe, I'm still not 100% sure, that I do not want flash on the iPhone. This is not because I don't like flash, it is more because I have seen what JavaScript does to the CPU of the iPhone, and I have also seen my iPhone rarely exceed 60Kbps. I don't want my iPhone downloading flash ads that prevent the rest of the page from loading, or tie up my CPU, or make navigation difficult.

The bigger issue is do we really need flash on the iPhone with the canvas tag, SVG, the techniques collectively known as AJAX, QuickTime, MP3, and AAC support? I'd argue that I do not. I like flash, but as with anything it is being misused to put questionable ads on sites, and I normally don't mind too much until it starts slowing down my browsing. If EDGE were 3 Mbps then it still wouldn't be too big a deal, but as it is I think I'll pass on flash for now.


Firefox 3 Over 80 Bugs

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

Firefox 3 Over 80 Bugs

Picture of IrvinSo if Firefox 3 has over 80 bugs, none of them seem to affect the platform running on Mac OS X Leopard that I can tell. As far as I can see, with the exception of having no plugins that work for it yet, it seems almost as fast as webkit and seems moderately stable.

Granted, however, I have not started trying to write for the offline storage, or used micro-formats, so I can't really tell yet what kind of bugs are lurking under the surface. Except for a bug with the JavaScript surrounding the canvas tag. I am using a canvas tag that creates a reflection on the fly, and it works in Firefox 2, but in Firefox 3, it doesn't appear. Oh well, its a beta.

As far as end users go, I think that the usability of the application for surfing the web and the tabbed browsing enhancements are as stable as I would expect from the mozilla foundation. I think this bugs thing must be either, a Microsoft conspiracy utilizing the New York Times, or an Apple conspiracy to undermine XULRunner on mobile devices utilizing the New York Times.

While I make not pretense as to my heaping heavy helpings of favoritism in Mozilla's way, I do think that they have a larger problem. It lies within their rendering engine. Browser makers are choosing WebKit for a reason. Its standards compliance, and heavy support for advanced XHTML / HTML tags and CSS make it ideal for futuristic web browsing applications. Also, its small size makes for incredible benefits when it comes to mobile devices. I would love to see a port of WebKit to Java for embedded browsing applications, but I am afraid it is just a pipe dream due to Java's weak support for Graphics2D in Swing applications.

At any rate, I think the whole bugs thing with Firefox is overblown. I'm not sure who is pumping the FUD this time, but my FUD meter is in the red on this one, it will probably come out in the next few days, but Microsoft's greasy fingerprints are all over this one.


The MVC Disaster Befalling Application Servers

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

The MVC Disaster Befalling Application Servers

Picture of IrvinI have always felt that the entire metaphor of MVC has been broken to a degree in web development. For a while I thought that AJAX held promise that eventually we would reach the point where we could have true MVC in that the controller would be the application server, the model would reside in the database, and the view would be entirely pushed down to the client as JavaScript.

Unfortunately, largely because of Google and its cohorts, this promise will have to wait. Since pages must be indexed, and Google refuses, not can't, but refuses to index AJAX content the pattern will remain broken.

The first and most egregious breakage of MVC is between the controller and the view, so we'll start there. The current implementation of web applications typically has HTML residing on the server mixed with JavaScript. This HTML is usually generated by an application server, so it is mixed with some, hopefully small, amount of business logic. Frequently this resembles a family gathering over noodles, tomato sauce, and meatballs. If people want dynamic behavior they will frequently deliver an RSS feed, or some other form of XML or JSON to the client via AJAX and update some div somewhere after parsing it. This is how good implementations are done today. What I'd like to know is where is the MVC in that design? business logic should not be allowed in template pages at all, no conditionals, no loops, definitely no method definition, this should not be allowed. What should happen is that you should be able to use an XML tag to create an instance of a bean representing a view interface and call getters. This would be a proper implementation of an application server IMHO.

The next and most dangerous breakage of MVC, not just in code cleanliness and readability, but also in security comes in the interface between the model, and controller, or as in some cases the model bypassing the controller and heading straight for the view. Typically this manifests itself in some process generating HTML, JavaScript and CSS from the domains data, and putting that content on an application server. Then using JSON or XML and the XmlHttpRequest pulling that preformatted content and putting it directly on the screen. In this case, there is no separation between layers at all, its just that kid putting his stupid hand down through the cake and squeezing at your birthday party.

If you are a single developer, it may be possible to manage such an implementation, but for a team it is impossible, there are bottlenecks everywhere, UI people have to wait for the process to run to generate the markup, the back-end people have to wade through lines and lines of markup to debug their code, and if you have AJAX engineers, forget it, they have to understand your back-end code to deal with the generated JavaScript. In other words, and put simply its a mess. Even sending HTML to the UI, a hijacker could change URLs so your client clicks and goes to a phishing site, etc… that is not to say that it couldn't happen with XML, but it is a little easier to handle these security issues if you have several steps between receiving the data and displaying / executing it.

On the security front, many people like JSON. I like it too if all hackers were to disappear. If someone were to inject packets into your JSON stream, it is too easy to hijack someone's browsing session. Remember all JSON is executed once its loaded in most cases, at least with XML usually it is treated like text and is never eval'd.

Unfortunately there is no application server that comes close to this strict MVC implementation. Maybe, in a stretch you could suggest that JSF, JSP, JSTL, and Tomcat all together create a decent MVC implementation, but really no server does that. Even if it did, people wouldn't know how to use it anyway.

Why does this matter? It doesn't if you are the only one maintaining and implementing a web application, if you waste your own time it really doesn't matter. It is when you need to scale in performance via parallelism, or in resources that you will constantly curse yourself for not fixing this broken MVC implementation. As far as I can see, facebook is coming the closest to doing a good job, at least metaphorically in this area, that may be because I can see their API. The fbml model is a good one, it conceptually separates business logic from the view, and hopefully their model is separate, I'd say it is because of the robustness of their model API it is.

At any rate, I'd hope to see better application servers, and implementations soon. I think it will take better application servers forcing better implmentations to make people change.


Google Forcing Apple to Embrace Java on iPhone

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

Google Forcing Apple to Embrace Java on iPhone

Picture of IrvinWith the Android SDK preview now out in the wild, we can guess a few things about the future. The first is that the iPhone will find itself stuck as a niche device, and never find its way into business, or be the “Jesus Phone” that everyone wants, if they don't embrace Java, or release a crippled SDK. The second is that Android will be a force to be reckoned with in the cellular industry and that Symbian had better watch its step. The third is that Google is proving its commitment to keeping information free.

The iPhone will remain a niche player if they don't embrace Java. This is a bold statement. What I really mean is that basically, more people know how to write Java applications, than know how to write Objective-C applications, or AJAX applications. It is a much better understood language, and with the Jazelle ARM extensions, the iPhone is an excellent platform for the language and a Java SDK could incite an explosion of applications developed for the iPhone. I have talked about the iPhone's Jazelle processor before, and it is almost a no-brainer as to Apple releasing Java and Swing for the iPhone.

With Google, however releasing a Java based SDK, the applications will be developed for the Android platform, these will include music playback applications, video applications, all sorts of mashups between, business applications, you name it. While the iPhone will end up being just an MP3 player with a phone, and a great browser crippled by an awful data network. People who love iTunes will keep using it, but the hue-and-cry of the prosumer and enterprise for better interoperability and more applications on the iPhone will go away, and people will just buy Android phones instead of pushing Apple.

By being whatever carriers and phone manufacturers want it to be, Android can easily become the most popular phone OS, quickly replacing Symbian, at least on “smartphones.” Let's face it. Until the iPhone the best interface we had, when it was not locked up, was on the Windows CE devices. Android gives users a good looking interface with minimal effort. Its pretty much going to become the standard OS for smartphones, and will aid Palm on its way to becoming only relevant as a Wikipedia article entry.

Google is making good on its mantra to a) do not evil, and b) organize and make available the world's information. It will effectively free the information that is inside my cell phone, and enable me to take my phone from carrier-to-carrier, or just use Google's service, hopefully. By finally opening the cell phone's software, something that for years had been intentionally obfuscated, and by democratizing software development for the mobile platform, Google will enable users to choose what they want to run and how. Carriers may try to stop users from installing applications, but I think that given the handset manufacturer's partnership with Google, they won't try.

All in all, this is the best thing to happen to the cellular industry, basically ever.


MacWorld 2008 Spoiler Leaked Keynote

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

MacWorld 2008 Spoiler Leaked Keynote

Picture of IrvinLike it was said on technovia, if the leak is real, it will probably be deleted. So it looks like there is going to be a 16 GB iPhone, no mention of 3G. There was mention of a new MacBook Pro ultraportable, great, but what I really wanted to see was information about the new SDK. What was there, if true, is good and bad.

First I want to point out that I think Apple is giving the indie community what they have been asking for. There will probably be many, many more widgets than Apps. The revenue and pricing model covers Apple's cost for distribution and validation of the source code. That is O.K., and will probably be O.K. for most developers. The current interface between widgets and Cocoa is a JavaScript Cocoa bridge, with Apple allowing use of the frameworks that are acceptable to them. If this is in place, it will, for all intents and purposes, make this the primary method of developing applications for the iPhone. The problem is that if larger 3rd party developers will be forced into a subscription model for their applications, especially if Apple does cap the max cost at $6.99.

At any rate, it was a cool read, if you want to read it too, here it is, but don't expect for it to be around long:

Leaked MacWorld 2008 Keynote


iPhone onorientationchange Event

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

iPhone onorientationchange Event

Picture of Irvin* Update: I was wrong about this, it won't work. you have to use the dirty markup method and put it in the body tag. Safari's DOM renderer processes the JavaScript in parallel, so the body element is not recognized by the JavaScript if it is at the top. There are other ways to delay the execution of this command until the DOM is rendered, but they aren't worth the trouble *

I'm glad that Apple has created this event. I think most of the developers who started early with the iUI were polling for the window.innerWidth. While this was an awesome hack before Apple had a proper event. Well now they do, but I don't really like their example code.

It is somewhat nitpicky, but applying an event handler to an element explicitly in the DOM is not the best way to do it, besides not being valid HTML / XHTML, it is sloppy. Some would argue that most validator plugins will detect your addition of the event handler post rendering anyway, but at least your html looks clean for debugging if you don't have strings of event handlers on all of your elements!

At any rate, what Apple's example shows is:

That will work as long as your JavaScript libraries are included before the body element, something that YSlow! and Yahoo! suggest hurt performance. I don't agree with Yahoo! on their performance guidelines most of the time, but in this case, I have seen the improvement, and I am now a believer.

If you leave your markup alone and add the event handler in one of your JavaScript files like:

document.getElementsByTagName(“body”)[0].onorientationchange = updateOrientation;

Then your markup will remain clean, you can move your JavaScript script include tags to just before your closing body tag, and you will have a quick and efficient page.

If you are handling the orientation event, it will return 0 for portrait, -90 for landscape after a clockwise turn or to the right, and 90 for landscape after a counter-clockwise turn, or to the left if the screen is facing you.

For most cases, you would have to determine if it was not 0, like this:

if(window.orientation != 0){
// iPhone is in landscape mode
}else{
// iPhone is in portrait mode
}

That is simplistic, but it should get you started. At any rate, I am really happy that Apple is bringing more events online, hopefully we'll get firmware 1.1.3, local storage, and advanced WebKit CSS functionality in that update, or shortly thereafter.

Apple's original article is at:

http://developer.apple.com/documentation/AppleApplications/
Reference/SafariWebContent/HandlingEvents/chapter_8_section_6.html