Sun Microsystems and MYSQL get Married

February 28, 2008

Wedding bells are in the air. But what does this mean?

The marriage of Sun Microsystems  and MYSQL means quite a lot. It is a very strategic move that Mr Msoft should have thought of. With Netbeans fast becoming a favorite amongst developers it means MYSQL could become the defacto back end database standard, leaving Mr Msoft sadly not invited to the reception.

For a developer learning Netbeans from .net is not rocket science, neither is working from Mr Msofts database server over to sunny MYSQL. So we could see a new breed of developer who’s first choice is always the MYSQL/Netbeans platform for anything from a small website up to a full enterprise system with glassfish.

Perhaps it could even become the point that servers will be rolled out with Ubuntu Linux on since we don’t really care what we run our java/mysql on - it makes no difference.

One of the main objections to java as a language and development tool is the cost of ownership is higher in the long run because you have to have better programmers, oh, sorry, did I say better, I meant more expensive, so you’re initial rejoicing at getting a cheap start up base becomes dogged by the fact you’re spending $100 US a day more on programmers to roll out the “Widget Stock System”. (man I’m biased).

Times are changing and I think for the better. Netbeans is a true RAD tool and now that MYSQL is part of the family you can build an enterprise system with Mr Msoft even getting a look in, except perhaps on the client machines operating system unless the user is running Linux or Mac.

So every blessing to your new marriage and I hope the honeymoon lasts forever. The nice thing is - we are all invited, at no cost.


Second Life Netbeans User Group

February 26, 2008

There is open enrollment for the Netbeans User group in Second Life if you just do search in SL under groups.


Filling a listbox with the results of a query — fast and dirty

February 26, 2008

Ok in this snippet of code using NB 6.0.1 I have create a swing List box and I want to fill it from the results of a query. The List box can actually go ahead and list the results of the query by using the  toArray() function. But I wanted to clean up the data first and get rid of the square brackets.

In this example I wanted to list 2 fields, the record id followed by a comma then the problem in the knowledgebase table.

  // Connect  	EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory("PHJSupport-app-clientPU");
        EntityManager em = emf.createEntityManager();
       
       
     
        lstRESULTS.removeAll();
        try {
        Query q = em.createNativeQuery("select id,problem from Knowledgebase");
       
        Object[] results=q.getResultList().toArray();
        int icount;
        // now clean them up
        for (icount=0;icount<results.length;++icount) {
            results[icount]=results[icount].toString().replace("[", "");
            results[icount]=results[icount].toString().replace("]", "");
           
        }
           
        lstRESULTS.setListData(results.clone());
       
       
       
       
        } catch (Exception e) {
            System.out.println("Error " + e.getMessage());
        }    

Note that I could replace the code

            results[icount]=results[icount].toString().replace("[", "");
            results[icount]=results[icount].toString().replace("]", "");

with

           results[icount]=results[icount].toString().replace("[", "").replace("]","");

Remember loops are costly and so we want to make things as efficient as possible.


Very nice screen backgrounds (and other bits).

February 22, 2008

Just a short post today.

Not that I’m a Netbeans keeny but…. 

http://www.netbeans.org/community/teams/evangelism/collateral.html#wallpapers

Has some nice graphics and wallpapers for Free. Also join the Sun Developer network as there are a lot of goodies there (some cost) but they have some good online training we are looking at using with some of or junior programmers.


The Netbeans Visual Library in Netbeans 6 - using to express data.

February 21, 2008

One of the applications I look after manages a complex data warehouse, one of the problems is that with that complexity it seems only a low amount of users have got their head around the software. So I’ve been looking for a more graphical way to express the data.

A lot of things in life are joined together by work flow of some sort. Database tables have relationships, jobs go through a process from start to finish etc etc. Using the Netbeans visual library I was able to construct a data map of some data to show the relationships between different objects directly from the database.

http://graph.netbeans.org/ - if you want to see the library used. It is nothing short of incredible, it allows the construction of user interfaces and then the development of applications that map objects dynamically, for me I’m mapping them over the data allowing the user to edit the data, delete the data, change the relationship or create a new data set, (like a crud application but much prettier).

The first version has caused some excitement even though it does nothing but display the data in a pictorial form! Just wait till they are editing records.

I can see in the future people having whole applications where they start with a map and are able to arrange the application how they like! What about setting up a virtual desktop for your application? Anything is possible.


Bad coding = life pain for users

February 20, 2008

My first experiences of coding, I still maintain, were very good for me. We had no memory, no processor speed and no clever display stuff. Life was a struggle, disks were so big you could not carry them. So fragile you dare not breathe on them. Tape storage would mean the endless loss of your hard tapped in machine code.

So we would write workng code, then tighten it up, then tighten it up again just to get it to run as fast as we could. But this practice seems to have diminished in recent years, both large and small corporations, instead of looking at profiling code properly are just buying bigger kit to run the badly written code on.

Some clients get to the point where the hardware guys are blaming the software and the software guys are blaming the hardware and neither can prove the other right or wrong.

Just recently I saw an SQL server with only 80 users (only 80!) and 4 processors and 4gb of ram running like a dog at 100% usage most of the time. The software developer had used the “access upgrade wizard” and not bothered to index the SQL server’s database. Now the same SQL server is running at about 40% at very busy times. Not bad considering the customer was about to spend a lot of money throwing hardware at the problem.

Once I’d got into the software things became even worse. The users were waiting up to a minute and a half for a screen to appear. Ok the software WAS written in Access 2000 (yes I know, not a good choice for an enterprise system that runs 24 hours) and had been festering for a couple of years. After getting hold of the source and rewriting a lot of it I got the screens loading almost instantly.

The problem was simple. The software developer was used to 5 user networks. So they didn’t care about the speed something loaded “it’s ok here!”. His programming style was fine for a small company but disaster for a larger one.

Please people just think about your code.

You are running on a one user machine - if you’re a professional developer you’ll probably have a pretty good machine to run it on. Most developers never feel the pain of the  users. It’s easy to be protected by salesman who shrug their shoulders and can’t help when faced with an irate user. Sometimes the developer needs to go sit with the user and see the users pain.

What we need to do is to have pride in our code. Squish it down to it’s most efficient. Get rid of all those loops unless you really need them. Learn how to optimise SQL usage and make the best of the equipment you have. Remember years ago whole corporations, (and big ones) ran on less hardware than you have on your desk. We had to write the code then submit it to be run and wait for the result, which when you are a junior programmer might not come back till the next day with “Syntax Error Line 5″.

Lisp - Boot camp for programmers 

One of the things I love about Lisp is it’s elegance. The way it drives you to write elegant code, “oh too many brackets”, I hear you cry. But get past the brackets and you’ll see something really great. Every programmer should learn Lisp, it will make you laugh and cry, swear and keep saying “oh Wow”. Lisp has a very very steap learning curve. When you “get” Lisp it is almost like a religious experience but one that will affect your coding for the rest of your life.

Lift your glass to the easy programming!

With the advent of the “easy” programming with NetBeans I hope we don’t become LAZY programmers. I hope we still look at our code and imagine what would happen if 100,000 users were running it. Netbeans and Glassfish give us a platform to build an awesome scaleable solution, so make every byte count. Every processor instruction worth the work.

So get out there and write beautiful, beautiful code.


Experienced in another language, some stuff I found with NetBeans

February 20, 2008

If you are like me and you came from another background language, you will probably have some strange expectations with Netbeans.

- I expected to have to hand write most of my code to do even the most basic task. This is just not required using the IDE.

- I expected to have to spend my life searching websites for code snippits and I did that at first, but actually the sample projects generally show you hot to do the things you need.

- I was surprised I could run an environment with multiple projects open, I could have a server side app, a client app, a web app all mashed together in one project allowing me to refer from one thing to another.

- I was surprised about how much code is automatically generated by the dragging and dropping from databases, web services, IDE componants etc etc etc.

- I was also surprised how cheap Sun Support is for a full year on all products and to be honest I think Sun do deserve SOMETHING for their part in all this wonderful stuff.

- Working with Netbeans I think is getting easier than .net and other languges (compared to Lisp its a dream). I love the way I can chose a different framework, install Jasper Reports and have a reporting system, all in oe place.

So if you are new to netbeans and are an existing developer….STOP

Go watch all the videos at http://www.netbeans.org so you can get a full flavour of it

Pull up some of the demo apps and take a peak at the way they are built - otherwise you’ll waste a LOT of time trying to do things in the way you expect to do them which is…. to be honest a waste of time. Most of what we do in code in other places is simple dragging and dropping.

It’s just knowing where to look.


Free Java Hosting for Developers!

February 16, 2008

http://www.myjavaserver.com/

Is a free hosting site for developer. but there’s a catch  to get the free hosting you have to do a bit of coding to prove you really ARE a java developer. I cracked it quite quick but I do have to say you need to read the specification CAREFULLY.

Good Job!


Netbeans/Glassfish = Community

February 16, 2008

Very interestingly one of the things that the Sun folks asked at on the Second Life Meeting on Thursday night was what would make people come along? (it was packed out as it was).

Someone said “more free stuff”.

I then pointed out that actually, we get so much for free we need to be thinking about giving to the community not taking it.

For Free from Sun Microsystems and the Community

- Netbeans - FULL Java IDE that supports doing just about anything you want to do with a computer

- Glassfish - The most AWESOME application server ever

- The Java database tool - Even has its own small database system

- MYSQL (industry standard database) - Sun Microsystems are doing this.

- Updates and Support for Free

You try buying that lot from Mr Gates ad you will be spending a LOT of money. (£4000 for an enterprise version of .net for one developer with MSDE membership).

So here’s a call - to those who are learning and starting out - lets build community - join Second Life and come visit the Sun Microsystems islands where you can get involved with the Java Developers Group.

Promote Netbeans and Java within your own developer community (once you’ve got into it you will be doing it!).

Perhaps start a blog.

Oh and by the way don’t forget that Netbeans and Glassfish don’t just run on windows - you can get an UBUNTU linux box going in about an hour (if everything goes ok) and have a full office compatible system with a development environment and industry class SQL server (MYSQL) for free.

I have to say the folks at Sun Microsystems have been amazing as my company has been exploring the Java platform.

Good job guys. Onwards and Upwards


New to Netbeans - please please watch these first.

February 14, 2008

Everyone expects java to be complicated.

Watch these two by Roman, very very good - and you won’t spend a lot of time coding!

http://www.netbeans.org/download/flash/why-netbeans-part1/player.html

http://www.netbeans.org/download/flash/why-netbeans-part2/player.html

(also if you think .net is good watch this)