How I Overcame My Fear of Flash

Long ago I remember the first Flash site I ever saw–spinning gears replaced typically boring site navigation and sound illuminated a previously silent web. My jaw dropped and I said to myself, “I want to build these kinds of websites!” After playing with Flash Professional for days, I realized that my mathematically inclined brain just could not output the kind of beauty that I began to see all over the Flash powered web. I gave up and resorted to building very ugly HTML interfaces. Not because I didn’t want them to look better but rather, it was just too much work and I lacked the skill.

Read more

HowTo: Reduce the size of your Flex app

Flex 2 added a neat little feature which allows you to load Runtime Shared Libraries, from other domains. And since the browser caches these libraries in theory we could all point to a central set of Flex 2 Framework RSLs and users of your application would only have to download the RSLs the first time they went to an application which used them. Before I show you how to make this work, lets talk about the caveats… First and most important, THIS IS UNSUPPORTED BY ADOBE. While the Flex team is working on a better, more permanent solution to this problem, this is really a hack and despite the fact that I am using this in my applications, neither I or Adobe warranty or support the use of this in any way. Second, since there is no failover mechanism, until we find a better home for the RSLs, if you choose to point to my hosted RSLs, your application will be at the mercy of my web server. Third, if someone hacks my web server and uploads new cracked malware RSLs, or uses a man-in-the-middle attack to replace the RSLs in flight, then you (and I) have been p0wned. Fourth, I, James Ward, may have included modified Flex framework files which do bad things, like track user behavior/input and report them back to my server. While I promise I have not done this, if you choose to use these RSLs, you are putting your trust in my promise.

So despite the caveats, I still think this hack is sufficient enough for many applications. Flex engineering is really working hard to make this work for everyone. In the mean time what is outlined here may likely help you to dramatically reduce SWF size. Read on to find out how.

Read more

Flex Paint – Flex Display Object to PNG

UPDATE – I’ve created a new version of Flex Paint which doesn’t require the server roundtrip.

Flex allows you to easily create beautiful UIs. But what if you want to take a piece of the UI and save it as an image? Well, using Tinic’s AS3 PNG Encoder, Remote Object, and Flash’s BitmapData and ByteArray API it’s very easy. To show how this is done, I created a simple application called Flex Paint.

Read more

Enterprise PHP?

PHP is no doubt a great web programming platform. It is simple and fairly robust. About 90% of the time I want to find an open source web app for something, there are at least 5 written in php. It seems to have become the de-facto standard for simple web apps.

Currently I spend most of my time writing php because the contract I am currently on started with php as their web platform. I have written some pretty cool apps in php. With my most recent app I built a simple persistence framework in php. My background is Java and there are many great frameworks in Java for doing just about everything; from persistence to ui layout. Java definitely seems to have more frameworks that actual apps. That’s interesting and a topic for another day.

Anyways, can PHP really scale to an enterprise level? I discovered something very interesting recently which leads me to answer that question: “Not right now”. What I discovered kind-of shocked me. Perhaps I am just not searching Google for the right thing, but it seems to me that php has no mechanism for putting stuff into a global space where all threads / requests can access it. For example when I was writing my little php persistence framework I thought it would be cool to have a connection pool instead of having each request make a new db connection. Well… after searching, playing, programming, etc. for hours, it seems that there isn’t a way to do it. Ouch… So there is no way I can have like a true Singleton in php. Now that’s a big bummer because it means that things that get done over and over by many different requests can not really be pooled.

Ok, so for me that totally rules out php as an enterprise level solution. At least in Java if you are solely using Tomcat, your servlet can maintain a connection pool or similar services for you. If you are using JBoss you get that, JCA, Session Beans, etc… Lots of options for that kind of thing. So maybe I am just being dumb and there really is some way to do it. If that’s the case, please someone set me straight.

My next project will be to research having php connect to session beans so that I could use php for the web tier and java for the business tier. Sounds like fun…

The JCP And Java Standards

My friend Mike came across an interesting wiki on Struts/JSF by Craig McClanahan himself… Struts – More About JSF

It’s an interesting wiki post… One comment I found interesting is: Every technology goes through a lifecycle of innovation, followed by popularization, followed (often, but quite often in the Java world) by standardization, followed by commoditization.

As always, there are two sides. And since I am the rebelous one, I’ll post the other: Howard Lewis Ship’s View on JSF

One very interesting comment that Howard made was the JSR concept is fundamentally flawed; you don’t innovate by committee

JSF was innovated by a committe. Sure you will say that Struts is the predecesor to JSF, so JSF wasn’t really innovated by a committe. And I say, why can’t the JCP build JSR’s out of existing, proven technologies, instead of taking a bunch of ideas which as a whole have never been proved, and creating JSR’s from those ideas? There are a number of places where great ideas turned to JSR’s, then to implementations, then to standards, then to crap. All because the the ideas were never proven to work in the real world. So then the minds get back together and try something else. Why does the JCP function like this? Why do they continually think that they can think of a better solution than one that has already been proved? Why does the JCP always have to think of a new and better solution instead of just standardizing an existing one?

I think the JCP would function better if Craig’s statement was actually true… That the standardization was made around a proven, popular solution to a problem. I would love it if Struts, Hibernate, Log4j, etc became the standards rather than ideas based on those technologies becoming the standards. Maybe the JCP needs an incubator. A place where ideas can be tried before they become standards. And the ones that actually become popular move out of the incubator into JSR’s. Kinda like Jakarta’s Incubator. Maybe this begs the question; Are JSR’s standards or a way to incubate an idea? If the former, then the JCP needs an incubator. If the later, then the JCP needs a way to move the JSR’s that get popular and survive to a “Standard”. And there should be one “Standard” solution for a given problem set. This would mean that both CMP and JDO cannot be standards. I think this would greatly help Java’s popularity since there are so many “Standards” for a given problem, no one knows which “Standard” to choose. MicroSoft makes this much easier. “Use us and you will always know what the Standard is.” Very simple. I guarantee you that Java would be more popluar if user’s didn’t have to evaluate which persistence, logging, presentation, management, xml, etc, etc framework to use. Am I saying there shouldn’t be options? Not at all. There will always be more than 1 way to solve a problem. But the community should decide (based on simple majority) what the 1 standard solution to a given problem is. And that standard should be the most proven and most popular one. And the JCP should say, “The standards are x, y, and z”. And when technology w becomes more popular and more proven then x, the standard changes.