I think I’m in love….and not just with my wife

July 22, 2008

We’ve got a new member of our programming team, Uthay, I can’t even say or spell his full name, but anyway, he came along and showed me this tool called SQLyog.

Although we only had the community edition after some coaxing we managed to get the boss to shell out for the full version, enterprise edition.

This is absolutely superb, it is WELL WORTH upgrading the full enterprise version has some amazing tools that make database development MUCH easier. Especially when like us we have to modify and change databases then roll out the changes to another server. For example when we have 5 or 6 versions of our application out there and want to roll out the new application, that’s easy enough, but remembering the differences between the two versions is a bit of a pain, with this tool we can just syncronize them and it will modify the destination tables (and data if we want) to match the source.

I particularly like the Query development tool, one of the good things about good old Microsoft Access was how easy it was to build complex queries, in this software it is just as easy, particularly useful when building large scale data structures.

It’s such a shame it doesn’t support anything else apart from MYSQL. However I will be transmographying a database from a SQL server over to MYSQL JUST TO USE IT!

http://www.webyog.com/en/

There is a community version but the full version is only like £50 so it’s well worth purchasing.


Speeding up glassfish on Windows

July 12, 2008

Okay okay, WHY? would one want to run Glassfish on Windows????

Well sometimes we have to, I do a lot of building applications that need to run on existing servers because the customer doesn’t want to buy a new server. However given the choice I would always run Glassfish on Solaris on a Sun box (one of the small ones is fine).

So being tied down to a Windows server there are two things I do to make the server run faster that are basic but useful to know.

1. Control Panel, System, Performance, Give Priority to Background Applications

2. Make sure the Glassfish server is set up as a SERVICE (otherwise if you are remote desktoping in to start the server when you quit the session your server will stop).

3. Set the application server to PRECOMPILE JSPs, check out the Application Server tab in the Glassfish admin console.

That should put the wind up your server quite nicely.


Formatting Currency with Java Server Faces

July 4, 2008

This is simple but VERY neat.

ok

1. Create a textbox, bind it to a numeric field
2. Create a NUMBERCONVERTER by selecting it for the field

Converter:numberConverter1

3. In your Java init code for your server faces web page…

numberConverter1.setMaxFractionDigits(2);
numberConverter1.setMinFractionDigits(2);
numberConverter1.setPattern("£#.00");

(UK)

        numberConverter1.setMaxFractionDigits(2);
        numberConverter1.setMinFractionDigits(2);
        numberConverter1.setPattern("$#.00");

(USA)

Then any boxes you assign that number converter are auto formatted as currency!


Sun application server crashes / Glassfish server crashes

June 27, 2008

Ok this is quite obscure so I’m sure that it will help someone.

We had a couple of Sun Application servers that we would start by logging into terminal services and starting the server manually (it was just the way they were set up).

Upon logging off of terminal services, the glassfish server would crash (obviously if you just close the terminal server session you are still running it and that was fine).

Solution:

Uninstall the glassfish/sunapp server and reinstall, make sure you check the box that says “Run as windows service.” and then the system won’t have a problem, however DO NOT use the start menu to stop and start the app server, use the administrative tools/services programme.

 


Solaris new version of SL Windlight

June 19, 2008

Click the page above for the new version of Second Life windlight for Solaris


Using SQL Server 2000 with Netbeans 6.1 (can’t see any tables)

June 16, 2008

Right

I’m just starting a HUGE project which has a SQL sever 2000 database at the back. So I configured up the SQL database and couldn’t see any tables…

The problem?

I needed to select the dbo schema not the name of the database. So your settings should be like this:-

Connection String: jdbc:sqlserver://192.168.100.11:1433;databaseName=(database name)
Schema (this is the important bit) : dbo

For some reason I mistook the Schema for the DATABASE NAME which in NB is a completely different thing.

I also tried the jtds driver and decided to use that - it’s open source and provides even faster connection.

Note that ODBC is old hat now and you should not use it as it’s really slow and probably ends up using the same sort of code you would use directly but with extra layers.

 

 


Resolution to Checkbox problem

June 4, 2008

Ok, I’ve just installed the latest patch upgrades to Netbeans 6.1 and it seams that checkboxes bound to boolean fields in MYSQL databases now work (WOOHOO!)

Just map the “SELECTED” property to the database field and make sure selected value is not set to anything (could be set to true if you like).

It also seems to be much faster with the compiled code for java server faces which is a big help.

I am marking bug:-

http://www.netbeans.org/issues/show_bug.cgi?id=132885

 

As resloved


Deploying to the Glassfish Server…

May 12, 2008

Ok, so you’ve built your world cracking application, how do you get it onto the production glassfish server? You could ofcourse configure your netbeans to look at the server and just hit Deploy but that isn’t always possible. Sometimes the server is out there on a remote network or behind a firewall. Luckily its not rocket science.

1. Set up your db connections

Easiest way to do this is to run Netbeans and run your project. Then pull up the admin console to your current glassfish server in the web browser:-

http://localhost:4848

Username is normally admin password is adminadmin unless you’ve WISELY changed it to something else (which I always do ESPECIALLY on remote systems).

Now pull up the REMOTE glassfish server and copy the settings (sorry it’s manual!), you’ll need to create a connection pool (this is the thing that connects to the DB) and a JDBC resource to connect. Copy it from your settings, make any changes you need like the database server may be somewhere else.

Now deploy your application.

Click on Applications/Enterprise Applications then DEPLOY then you need to find the “dist” folder in the root of your project, and upload and deploy the file ending in .ear

TADA!

Incremental Deployment

Ok so what happens when we want to do an update - great news is you don’t have to log everyone out and make them wait for you to drink coffee, have a lunch break and update.

Simply Deploy the project under a different name then you can get them to login to the different URL. You could for instance have a redirect from a URL which you just change to point at the new site. Then as people relog they get the new version.

Ofcourse if you’re clustering just take the server offline you want to update. They will carry on on the other servers, do it one by one….and off you go.

Problems

Databases arghghhhghhgggh - If you can make sure your database username/password you used to develop on is the same as the one on your deployment server. Otherwise your Persistance Unit won’t work.

Copying the MYSQL driver to the right place - really it should be included in the setup of glassfish (Sun own MYSQL, Sun own App Server, 1+1=2?). Despite all the stuff around on where to copy that file (which I did) in the end I created a NB project on the server with some MYSQL an published it and that installed the driver and solved the problem.

In the end I have quite a nice set up where I set up my remote glassfish server in NB and published directly to the remote server - once you’ve done that updates are easy.

 


I’m speaking at JAVAONE in Second Life next Tuesday

May 1, 2008

http://blogs.sun.com/sdnblog/entry/communityone_and_javaone_in_second

About 3/4 of the way down “Using Netbeans in Industry”


MYSQL Workbench SE

May 1, 2008

Well, I downloaded the community edition of MYSQL workbench and stopped pretty quick when I realised you needed the standard edition to reverse engineer database structures….after a lot of paperwork and purchase orders I now have the full SE version.

Good Points

It’s quick
It looks great
It has a LOT of options
Reverse engineering the database was faultless and really made it quick for me to do a database diagram.
PDF export is standard

Bad Points

On a system with 2 screens work bench gets very confused about where the middle of the screen is. Us programmers have terrible double vision so we have two screens, one for the source and one for the run. So I had to switch back to using one screen then work bench sorted itself out.

Printing, would it print in landscape? no, in the end I popped out the diagram to PDF first then printed it from there.

Is it worth £60 a year? yes, without a doubt. It’s not perfect by a long shot but runs pretty well. Only other complaint is (SUN ARE YOU READING THIS?) I have to run it under Windoze but my operating system of choice is (SUN) SOLARIS. So the SUN Workbench really needs to work on the SUN operating system since it’s owned by SUN.