Using Greasemonkey To Fix Other’s Bugs

Ever since I got into Macromedia Flex I have not been able to view .mxml applications in any Mozilla based browser on Linux. Mozilla for some reason cuts off the Flash at around 240 pixels in width. I have searched the web and Mozilla’s Bugzilla trying to find others who have also experienced this problem. I haven’t found much. A few Mozilla bugs seem to indicate others had this same problem. But not enough for anyone at Mozilla or even Macromedia to care. There has only been 1 post about this issue on the flexcoders Yahoo list. So not really a big deal, except to those of us on Linux!

It seems that the problem is with percentage width embedded objects inside percentage width tables. When writing mxml applications I can easily work around the issue by not using a table. However, anytime I view someone else’s application who has not worked around this bug, I only see the left 240 pixels of the application. I could try to file a bug with Mozilla, but I think that’s been done and didn’t get the issue resolved. Greasemonkey to the rescue!

Greasemonkey is a Firefox extension which lets me easily manipulate web pages when they are loaded in my browser. So I wrote a simple Greasemonkey script which fixes the problem! Fo those interested, here is what you need to do…

or any other Flex application and you should see the full application!

My script is just a hack. If you have any ideas for improving it, please let me know!

The RIA Race Is On

For the past six months I have been building one of the first ever Rich Internet Application (RIA) portals. The project has been incredibly fun and wrought with many challenges. Since the inception of our crazy idea to build a RIA portal I have learned a great deal about where the web is going. My RIA adventure started when I first encountered Macromedia ‘s Flex Explorer. I saw the very elegant components, and I was awed. Then I saw examples of the code I would soon be writing, and I was hooked. I couldn’t believe that a terrible UI developer like me could so easily create a beautiful RIA. I dove right in and quickly built a prototype of our soon-to-be portal complete with DataGrids and RemoteObjects, which were written in Java and exposed via AMF to the Flash-based front end. After a short time developing in Flex I realized I could never again enjoy building a Struts / JSP / HTML web application. They are too cumbersome and tedious for me after seeing how easy it is to build web applications in Flex.

Read more

TreeGrid Version 2

The second version of the TreeGrid component is done. It is working much better thanks to comments from Matt and Jose. I was able to resolve all of the issues I was aware of except the hard coded reference to “product”. I was even able to get recursion working. I think I may have to eventually extend DataGrid so that I can add column sorting. Here are the changes I would still like to make to it:
– Column sorting is currently disabled. I would like to make it work… Maybe it would just sort top level nodes. What do you all think?
– Column resizing does not clip the disclosure icon correctly. The Label gets clipped right, but not the icon. Any ideas?
– Any other ideas to make this better?

Well here it is:

Here is the mxml code
Here is the cellRenderer code

Please let me know your comments and suggestions.

-James

Flex TreeGrid

For a while I have been wanting to create a TreeGrid component for Flex. The
basic idea is to allow a user to navigate a Tree like object within a
DataGrid. Well, I just finished a very hacky version 1:
Here are some problems with the current implementation:

  • I get strange flicker when mousing over the cells. Don’t know why.
  • If I resize the right column to cover part of the Title, the title doesn’t get clipped. Don’t know why.
  • The code looks only for children named “product”. I don’t know of a way to make this generic / configurable.
  • Only supports 3 levels because I can’t figure out how to do recursion in the disclosurePress function. When I tried to call another function to do recursion the recursive method never got called. Don’t know why.

Other than all that, it works decently. :) Any ActionScript experts out there, please help me out. :)

Here is the mxml code
Here is the cellRenderer code

Enjoy!

-James

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.