Tuesday, January 05, 2010

I've used Aptana now for quite some time and I was disappointed to hear they were discontinuing PHP development. Not surprising considering the PDT acceptance and integration from everything from Eclipse to Zend as the primary PHP development toolkit. The huge hassle for me was that the FTP and WebDav plugins for Eclipse are useless from a web developer perspective. Frequently I'm challenged with small modifications to existing sites and uploading and downloading with other tools or "importing" and exporting is unrealistic. I would spend more time and effort in setting up a project than making some of the changes on a clients website. This also doesn't address the issues surrounding a team environment where you might need to sync back and forth on the same FTP server with multiple users.

So, after much hassle with Aptana, Eclipse and PHP I figured out how to have everything I need for development. This allows me to continue to use Aptana's FTP/SFTP plugins, JavaScript and jQuery tools as well as use PDT as the development IDE. This also enabled me to use other eclipse plugins I liked the SFTP Plugin which I couldn't get installed in Aptana's standalone version. So here is the process for getting everything you had in Aptana 1.5 working with Aptana 2.0

Step 1. Download and install Eclipse PHP Tools

Step 2. Add Eclipse as a new site and install it as a plugin to Eclipse http://www.aptana.org/studio/plugin This will require a restart of the IDE.

Step 3. After that is complete, go to Window -> My Studio, Click the plugins graphic. Using the Ajax Tab, find Jquery, and click Get It. This runs the update manager, you'll need to select jQuery in the list of ajax plugins. You can optionally install all, but jquery is the only framework I generally use. Restart of IDE Required

Step 4. Window -> Open Perspective, choose Aptana Web

You should then be able to use the file manager to create FTP connections and continue as before.

Apatana folks really need to make this part of the FAQ.

Thursday, July 23, 2009

Recently I've been working with Jasper Reports. I don't often do a lot of report writing so I enjoyed the opportunity to work on something different.

Once I had a query full of data I began to use the Jasper Parameters to filter out items in my query. For example I might have a query that looks like this.

select * from employees where first='$P{first_name}' and last='$P{last_name)'

Really simple stuff here nothing that Jasper didn't do or support. So I of course took this to the next level and said ok, I'm just looking for a last name so lets put in just the last name, leave the first name blank. Well when I did that the whole thing blew up because I had a query that looked like this at runtime

select * from employees where first='' and last='Smith'

So I have to put a parameter in? That's ridiculous! Searching around the meager JasperReports documentation I couldn't find anything helpful either. Checking with co-workers who use this more than I do I found that most of the time they build SQL in a stored procedure for this. I'm not opposed to a stored procedure but when you just want to filter a few things it's really stupid to have to jump through those kind of hoops.

I came up with a elegant solution to this that I could do within iReport and with no extra classes (as jasper suggests using a scriptlet - which isnt really a script its a java class).

The solution was quite simple once I figured it out. I created the regular parameter for input. This would be first_name, I then created a second parameter (not for input) called first_name_value. Inside the first_name_value "Default Value Expression" I entered this java code:

($P{first_name}.isEmpty()==true ? "" : " and first='" + $P{first_name} +"'" )

Now, once I had that inside my SQL code I used the following

select * from employees where last='$P{last_name)' $P!{first_name_value}

What this does is output NOTHING if first_name is blank. If it is filled with a value we add the entire "and first='John'" at runtime into the SQL statement. This of course has the drawback that you have to have at least 1 qualifier in your sql statement. Try something like where last!='' as a default. This then gives you every row and any "and" clauses are appended to the end. Also notice the $P! with the ! in there. That means it will evaluate before the query.

Why not just use a stored procedure? Well a couple of reasons. First, SP's take time. Sure, you might be good at them and can get your SP written in a short amount of time. Go for it. This solution works well because you don't have to bother with an SP at all. A simple query can be done within iReport and these filters applied.

Get fancy. You could get fancy with this and use your expression code to handle replacements as well. For example you could allow a > 95 and change the code to remove the = sign if something like that is input.

Hope this helps in your report development.

Friday, May 08, 2009

I have never been a fan of IE8. Most serious developers (web or otherwise) know that it is rubbish that unfortuneately has a very large adoption. I generally do most of my web development in FireFox and use Fire Bug to do my web site debugging and design. I like of course the on-the-fly features of changing and prototyping different web layouts.

IE has always been a pain my side not only because of their refusal to adopt widely used DOM standards but buggy browsers that are impossible to reasonably debug.

Today I needed to verify a layout issue and with my recent IE8 upgrade noticed the developers tools in the menu. I nearly fell out of my chair in shock to see a robust set of developer tools. This was just amazing that I could now do nearly the same things I could do in Fire Bug. I am in no way going to ditch firebug but I now have a rather decent means to debug IE problems specifically.

I could use Fire Bug Lite but I find that it's performance is poor in IE. This does work well however. I imagine that Microsoft is trying to muscle-in on the developer market but I think most serious developers are going to do ground-up development in FireFox.

Chrome is still my favorite browser to surf in. I can't wait till they get the developer tools in it so I can use it for more web development.

Anyhow, IE8 gained a few (very few) points with me today since they finally got some developer tools that actually work.

Saturday, April 18, 2009

I have to admit that I first thought that portable Ubuntu was going to be a install on a flash drive. It actually runs UNDER windows. The real credit though goes to Cooperative Linux. This allows a linux distro (almost any) to run while windows is running. Now I took the easy route and ran Ubuntu which is a decent distro for most desktop users.

Performance
It ran sluggish at first. I was really kind of disappointed and thought that it was because it was running from the flash drive. It really was just not getting enough CPU. I was able to improve the experience considerably on my laptop by setting the colinux and associated exe's to a high priority. This allowed them to get a bit more task scheduling from windows. This was enough to kill the little bit of sluggishness and get me rocking with all that linux has to offer.

On a side note this isnt my first experience with linux or ubuntu. I've run it under VM's and dedicated boxes for some time. It is just very nice to be able to start it up, shut it down and run it while I'm running windows apps. I'm going to go download aptana for linux and try it out under there. Would be nice to be able to take my favorite IDE everywhere regardless of the PC I'm on.


Recent Posts


Aptana, FTP, WebDav, PDT and Eclipse - Why cant FT...
Dynamic Query Parameters for Jasper Reports
IE8 Developer Tools
Portable Ubuntu - Take Linux With You
Quote Curling Function
Same Blog, New Look
On the fly JavaScript Packing - Speed up your site...
Super Simple AJAX Forms with jQuery and JSON : dat...
Super Simple AJAX Forms with jQuery and JSON : web...
Super Simple AJAX Forms with jQuery and JSON : Int...


Archives

01/01/2005 - 02/01/2005
02/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010

My Software

Blinky - GBPVR Plugin
PhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers

Programming Links

C# Formatter
NSIS

Other Links

Damn Small Linux

Sites I Manage

Do it yourself SEO. Cheap.
Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking