Joshua van Aalst’s blog

June 29th, 2007

Netbeans 5.5.1 Visual Web Pack ‘webui’ is undefined javascript solution/fix.

Posted by Joshua van Aalst in Java and Web Development, Netbeans

Hi everyone,

I recently upgraded from Netbeans 5.5 to Netbeans 5.5.1 and noticed that some of my Visual Web Pack pages were rendering with the javascript error ‘webui’ is undefined.

If this error occurs most UI components on the page will cease to function.

Basically some new javascript libraries were added to Netbeans 5.5.1 and all components require them but some pages were not generating the required javascript code.

So what is required to fix this?

Ensure the following lines are at the top of the Visual Web Pack page that is causing the ‘webui’ is undefined error:

dojo.hostenv.setModulePrefix("webui.suntheme", "http://www.joshandfriends.com.au/dancemusic//theme/com/sun/webui/jsf/suntheme/javascript");
dojo.require('webui.suntheme.*');

]]>

Obviously change the domain above to your own.

If you would like a simpler way of doing the above that is dynamic and can be reused on any page with the issue then create a converter like so:

package com.jafp.web.jsf.converter;

import com.jafp.common.configuration.SystemConfiguration;

import org.apache.log4j.Logger;

/**
*
* @author Joshua van Aalst
*/
public class DojoJsConverter implements Converter
{

public String getAsString(
FacesContext context,
UIComponent component,
Object object)
throws ConverterException
{
try
{
Logger.getLogger(getClass()).debug(”Start DojoJsConverter”);
ResponseWriter writer = context.getResponseWriter();

writer.startElement(”script”, component);
writer.writeAttribute(”type”, “text/javascript”, “type”);

writer.writeText(”\ndojo.hostenv.setModulePrefix(\”webui.suntheme\”, \”"
+ SystemConfiguration.getSystemConfiguration().getApplicationPath()
+ “/theme/com/sun/webui/jsf/suntheme/javascript\”);\n”, “dojoscript”);
writer.writeText(”dojo.require(’webui.suntheme.*’);\n”, “dojoscript”);

writer.endElement(”script”);

Logger.getLogger(getClass()).debug(”End DojoJsConverter”);
return “”;
}
catch (Exception e)
{
throw new ConverterException(”Unable to generate a link for supplied object”, e);
}
}

public Object getAsObject(
FacesContext context,
UIComponent component,
String displayString)
throws ConverterException
{
return 3;
}

}

Now you can simply do this:

]]>

You can of course simplify this further by adding all .js includes to your converter. Then all you will have is 1 line:

]]>

June 21st, 2007

Eclipse 3.2 vs Netbeans 5.5 an excellent review

Posted by Joshua van Aalst in Java and Web Development

Hi,

In light of my upcoming review of Netbeans 6 vs Eclipse 3.3 I thought I’d first see what else is out there.

There is an excellent article here:

http://www.devx.com/Java/Article/34009/1954?pf=true

A very good read.

June 19th, 2007

The Google monopoly tightens it’s grip

Posted by Joshua van Aalst in Interesting Stuff, Josh and Friends

If you thought Google was the dominant search engine then think again!

Here is an interesting result from www.joshandfriends.com.au .

So far for the first 18 days of June Google search and Google images was responsible for a whopping 97.7% of inbound links from a search engine. That is 5,056 inbound hits.

Compare that to Yahoo with 0.2% with 15 inbound hits and MSN Live with 0.1% and 9 sultry inbound hits.

That’s an insane result. I would have expected Google was maximum around 80% of inbound hits.

To compound this the site actually ranks higher in Yahoo and MSN Live than it does in Google!

June 15th, 2007

Evaluating Debts… and why not to get into them!

Posted by Joshua van Aalst in Interesting Stuff

When people consider whether or not to go into debt be it for a purchase, a service or an investment they almost always miss-judge the full costs of debts.

Debts are made up of several different costs:

1) The face value cost i.e. a loan for $20,000 with monthly repayments of $500
2) The hidden costs
a) Ability to repay debts when other un-planned situations arise
b) Personal time
c) Emotional toll

Lets look into the 3 hidden costs a little more.

Dealing with un-planned situations.

When we are repaying debts, changing situations inevitably arise. We have a new job and need to purchase a car to travel. We move houses. A new type of movie player (ala HD-DVD) is released and we *have* to buy one. The share market drops and we want to take advantage of the low share prices and buy in.

All the above will require financing. Financing must come from 1 of to 2 places. Either we borrow money or we divert existing funds away from other payments.

Either of the above will place increasing pressures on any existing debts that we have.

The longer the debt the higher the risk is for the above to occur.

So the end result is? It takes longer to pay off the debt or we need to re finance the debt. Both of which create issues with regards to Personal time and consequently have an Emotional toll.

Some would argue that as our wage increases over time it is easier to pay off the debts. I strongly disagree as over time not only does our wage increase but so does total interest, amount of debts and of course the price of goods (inflation).

Personal time.

So what happens when we have to re-finance debt or extend the payment terms?

Inevitably one will have to phone not just one but many financial institutions multiple times.

Why?

To find out what is the most efficient way to re-finance the debt.
To hear the precise terms of the re-finance.
To accept the offer.

If you consider that financial institutions like to make customers wait on hold for around 20 minutes and have those dreadful computer answering voices (press 1 for blah, press 2 for blah e.t.c.). The personal time invested in the debts and the emotional toll increases dramatically.

To make matters worse lets add to the mix a house move. Now one will have to phone all related financial institutions to notify them of the new address. If it takes 30 minutes to call each one and you have multiple institutions financing your debt you could be in for a very long haul!

… and what happens if your working 9 till 6 with a 1 hour lunch break? Calling such institutions could take weeks of free time!

Emotional toll

So you’ve spent all lunch time for a month on the phone to financial institutions listening to “You have progressed in the queue” messages. Un-planned for costs have dramatically increased the length of time you will need to close off the debts and the size of the debts and the total interest has increased.

What happens?

Stress.

You lye awake at night. You get angry at your partner, friends and family.

What’s worse is that as new debts come in and old ones are extended due to re-financing the situation will get worse and worse spiraling out of control.

The moral of the story.

Research and way up the debts you are entering. Their will always be hidden costs. Make sure you plan for them!

Can you really afford that debt?

June 10th, 2007

What’s hot in the USA! and how it compares to Australia.

Posted by Joshua van Aalst in Interesting Stuff

Well almost back from my tour of the US (Los Angeles, Vegas, Orlando, New York and Boston).

I thought I’d jot down a couple of insights and mini reviews of places we went to and what was cool and what wasn’t.

Firstly though, a couple of general points for people visiting the US:

1) Always bargain. Even if you think you can’t bargain try anyway! And don’t look like you will purchase the item anyway, that would obviously be silly.

A great example, on my first day in Los Aangeles I visited Melrose St and bought a pair of shoes for $90 US without bargaining. Later in a non tourist district (St Marks St) in New York, I saw the same pair for $69 US. Sales staff will laugh at you if you pay full price…. And so will I!

2) Extreme sales people

Due to the extreme capitalist nature of the US (employees working for tips, no public health e.t.c.). People are forced to sell as their lives (literally) depend on it. Be careful. A good sales person will have you walking out of their store in a skirt that is 2 sizes too big and a putrid shade of bile green. You have been warned!

3) Awesome service.

Again due to the dependency on tips service people have to provide the best service to generate the maximum tips. This is pretty cool for an Aussie who’s used to waiters who put a plate in front of you and that’s all you ever see of them.

4) Sales Tax

My personal favourite in the USA! No one seems to be able to explain how this works. According to a camera dealer in Orlando you pay sales tax on TOP of the price of all items other than food. Seems simple right?

In all the clothing vendors in Boston and New York (that I visited) the sales tax was included in the price but in the diners it wasn’t! Opposite to Orlando.

Sales Tax is absolutely random. Always ask if it is included. Prices in America are ridiculously misleading. By the time you’ve added sales tax and a tip onto the beer you just ordered, it’s more than doubled from what you had sat down for.

5) Queues, queues and more queues.

From my travels it appears that American’s love to queue. In Australia if your in Martin place (central business district) at lunch it is a free for all, people shoving to the front to get served. In the US from Disney land to New York’s famed Magnolia bakery. People politely queue and patiently wait.

6) Cigarettes and Liquor everywhere.

In America you can pick up your medicine at the Pharmacist whilst buying a pack of your favourite cigarettes and a bottle of hard liquour. There is also absolutely no health warning on cigarettes and they are much bigger than Australian cigarettes. That being said their’s nothing better than stepping into any restaurant and ordering an alcoholic drink. No need to worry about who’s licensed and not. They all are!

7) Hotels are NOT your friends.

Don’t accept hotels special airport taxis! You are generally offered 1 of 2 options by the hotel. A shuttle bus to the airport. These take hours longer than a direct taxi as they generally stop at multiple hotels and they aren’t much cheaper. The other option hotels like to offer is a ‘special’ taxi. The special Taxi from the Holdiay Inn in midtown New York to JFK airport was $60 US. A normal taxi was only $45!

Also of note baggage storage, according to hotels should cost you $1 to $2 tip per bag checked. This is too much and is what they want you to pay to compensate the fact that they don’t pay their concierges and valets (Yes a Valet at the Hilton in Las Vegas confirmed this), $2 will be fine for 3 bags.

The following places rock! Visit them … (In order of coolness):

O, Cirque Du Solieu (Las Vegas)

This show was utterly amazing. O is Cirque Du Solieu’s water show in the Belagio. The Belagio’s theatre is massive, closer to a stadium than a theatre. About 4 times the size of the biggest theatre we visited in Broadway (New York). The show itself was amazing. 60 performers in perfect unison performing syncronised swimming, trappese, rope, swings, circus tricks, fire tricks and more. The best part of this show was it’s scale. 60 performers really is a very large ensemble. To put it in perspective a big Broadway musical will have around 30 (maximum 40 performers). So it is double that. Also the stage was amazing, transforming from a water stage to a fire stage and even to a diving pool all whilst the performance continued.

Also a bit of Trivia there are 4 different Cirque Du Solieu shows throughout Las Vegas and a show like O above has 2 performances a day! That’s Las Vegas for you!

Melrose St (Los Angeles)

If your looking to buy medium range clothing between $50 to $200 US. Then this is your place. Easily the best male clothes shopping that I have ever experienced (and some great girls clothes too). The shopping area of Melrose St extends for approximately 10 blocks and is filled with local designers and boutiques with amazing and awe inspiring clothing (at decent prices). The clothes really were amazing often with large custom prints and designs covered in studs, patches and other decorations. Lots of attention to detail, these are the clothes that General Pants, Urban Outfitters and Supre homogenize to make accessible for the general public. One sentence…. SHOP THERE!

Marks St (Manhattan, New York)

Similar to Melrose St in Los Angeles but with a focus on Goth and Punk clothing. One of the most amazing aspects of Marks St is the atmosphere. You’ll find locals out in force dressed to the teeth in the hottest Goth, Punk and alternative clothes with a somewhat silly amount of accessories. One of my favourites was a really big guy in hot pink stilettos (no not a drag queen either) and a shop assistant who had a massive gun as a belt buckle. The prices are again very reasonable and it’s a great place to see artists designing clothes right there. Defiantly worth a visit, the street is not on the maps so happy hunting (head to lower Manhattan).

Mary Poppins, the Musical (New York)

A stunning example of a Broadway production and the massive spectacle you expect from it. Awesome moving set too. Props to the actors dancing upside down on the roof of the theatre and Mary Poppins soaring through the air!

Blizzard Beach (Disney World, Orlando)

One of Disney Worlds 2 massive water parks, check it out for some of the most amazing water slides in the world. They really are inspiring. Plenty of long rides and even better … to get around the park simply hop in a massive rapid river in a blow up rubber tire and you’ll be taken on a ride around the whole park.

Virgin Music and Toys r Us (Times Square, New York)

These stores are both almost next to each other. Both are amazing 4 leveled beasts. The Toys r Us store has a 4 storey high Ferris wheel in the middle of the store where the wheel’s seats are My Little Pony’s, Bob the builder cars and many other famed kids shows. Virgin Music has an amazing selection of DVDs, the largest i’ve seen, with plenty of DVD’s from TV shows i never knew existed.

Spamalot, the Monty Python Musical (Broadway, New York)

This was the funniest show we saw. Lots of laughs and the story does not follow any of the Monty Python movies exactly (contrary to popular opinion) although it does draw a few scenes from the Holy Grail. The only downside was that the theatre was ridiculously crammed. The seats were so small and close together you felt you would fall over the person in front of you. Also the Gay scene could have been done far better. They needed an actual Mardi Gras coloured flag and a drag queen.

Star Trek, The Experience (Hilton Hotel, Las Vegas)

Hidden away in the Hilton Hotel is Quarks bar and grille and 2 massive Star Trek rides one based on Voyager’s Borg episodes and another based on the Klingon encounters. Not only were the rides great but so were the drinks. I dare you to order a large warp core breech! The drink is made with over 5 full shots and dry ice that creates a smoke effect pouring from the oversized glass! ?

Delta Shuttles

Delta is one of America’s biggest airlines. The Delta shuttles are like a bus service from major city to major city. They are fantastic:

1) You can sit anywhere
2) Planes fly every half an hour so you can get one as soon as you check in. No need to wait around in the air port
3) Planes are extremely roomy. I could open my laptop!
4) Planes are not over crowded. Often you’ll get 2 seats to your self.

Yes and before you question the praise we were flying in peak holiday season and we did fly delta shuttles twice.

New York food!

In general New York food was supurb. Meals were large and absolutely delicious. I heard some people talking: “If a resteraunt is not amazing in New York it dies instantly”. I Could not agree more.

The following places we were told to visit but were a little disappointing (You might still enjoy them though):

Century 21 (New York)

We heard lots of good things about this discount department store but to put it frankly it was ? . Firstly it was totally overcrowded and secondly all the branded clothes (Guess, Marcs, Levis e.t.c.) were 2 years ago’s seasons and were quite obviously the lines that didn’t sell. If you are buying an item purely for the brand name this might suit you but I didn’t like it at all. That being said branded underwear was very cheap and for guys you can’t really go wrong there.

Grays Papies (New York)

Heard a lot of good things about this chain of hot dog vendors. Although hot dogs were good they were tiny and well were just plain hot dogs. They were dirt cheap though which was a plus but given how small the hot dogs were you’d need to have at least 2 for anyone to be full.

Magnolia Bakery

We first passed it in a Taxi and saw the massive queue. Having seen it on Sex and The City, Donna and I decided to make the trek and after walking miles to find this little hotspot I was wondering how awesome a cup cake could possibly be. We each bought a different flavour of cup cake but although each was very nice they were still…. Cup cakes! They were really rich and I ended up throwing most of mine out.

Avenue Q, The Musical (New York)

I had heard rave reviews about this musical. It was a comedy done with puppets. I and Donna found it just not funny and rather boring. Their was absolutely no plot and the jokes were a tad bad taste “We’re all racist” e.t.c. and the very overdone Jewish weddings. If your going to do a Jewish comedy segment. Do it well ala Seinfield. Props to the leading lady in this she was the best thing in it. See Spamalot it was much funnier.

Los Angeles Hotels that are downtown.

I wrote a bit about Los Angeles already. Golden rule: Los Angeles is ridiculously large and busses go in straight lines only (You will often have to catch 2 buses to get anywhere). Make sure you get a hotel that is near the location you are going to visit. Downtown is really in the middle of nowhere that a tourist would want to visit. Be careful of the maps too. They only show about 1 in every 10 streets. They are deceiving.

Apple Store (5th Avenue, New York)

Totally boring and huge mark ups, exactly the same Apple products as every other store with no exception.

June 10th, 2007

Josh and Friends - A Real World Web Application Developed Using Netbeans Visual Web Pack

Posted by Joshua van Aalst in Java and Web Development, Josh and Friends

Hi all,

Winston Prakash has posted a great blog about the www.joshandfriends.com.au, www.gayscene.com.au and the new www.stratacentral.com.au series of sites on his block here:

http://blogs.sun.com/winston/entry/realworld_webapp_using_vwp

I’d like answer two posts in regards to the site:

______________________________________

A. Varela - Can you please elaborate a bit on how Josh is using converters on his website?

A. Varela - Can you please elaborate a bit on how Josh is using converters on his website?

Their are a couple of issues here. The main one is that I want the URLS to be SEO friendly. Something like http://www.joshandfriends.com.au/Events/Create

The issue with using a standard VWP faces component is it won’t generate SEO URLs. I use converters to examine an object and create a SEO URL from it. On the inbound side the Servlet Filter interprets these URLs and forwards them to the correct VWP jsps.

For example if i were to pass an object instance of Class “au.com.jaf.News” to a converter called converter.LinkConverter.

The output would be something like /News/VWP_5_5_1 _released_2345

… where 2345 is the id of the instance.

This also occurs with my Images which are surrounded by a href.. tags

I also find Converters very useful for fine grained control of the output. All my images have alt and title attributes. All the links have title attributes.

I didn’t use custom tags as I don’t really like configuring a tld each time i change something.

You can also use converters for generating HTML tags that aren’t realised in the VWP or MyFaces component libraries. UL and OL tags are an issue here.

______________________________________

JJ - Does the site load in the Visual Designer or does it have to entirely be updated in the jsp view? If it doesn’t load in the designer I don’t see the point.

You raise an excellent point. The answer depends on the following:

1) If you are using a static skin (via CSS) then the sites layout will show correctly.

1b) If you are NOT using a static skin i.e. the user can choose skins for the site (like in the case of my site). Then it will never display correctly in VWP designer view. — That being said you can still use the designer! Use the Outline Window to reach you components and the properties window to edit the components.

2) Dynamic images will never load so the Designer view will look kind of weird even if it does display.

So the question is why use the designer at all when it only correctly renders primarily static sites with dynamic text?

For many reasons:

1) The designer is very useful for prototyping up the page before you add dynamic content. I do use it for prototyping up pages which use relative positing i.e. a Dream Weaver generated html templates.

2) I often use the designer to configure properties/values of components rather than the docos. It is very easy to use (and see what’s available) via the VWP properties window and the Outline VWP window.

3) The designer does a great job of some useful code generation. A prime example is the actions for paging on outputTables. Without the designer I’d have to have done it myself.

4) For quicklky testing action event combinations. I often use simple designer pages to test combinations of auto-submit on changes and complex components. You can knock up a test on your code base asap.

Hope the responses were useful.

Thanks,
Josh

p.s. I’ll ask my web designer to post up some locations to download predefined stock HTML templates.

June 2nd, 2007

Josh’s Las Vegas survival guide!

Posted by Joshua van Aalst in Interesting Stuff

Las Vegas is without a doubt the worlds most finely tuned money sucking machine. Having spent almost 3 days there I thought I’d write a mini guide so you can be prepared for the onslaught.

1) Beware major price differences between drinks at different casinos.

If your planning to walk through any of the 5 stars like the Belagio or the Wynn e..t.c. do NOT stop to buy drinks or play the pokies. A standard beer like a Budweiser will cost you $8 US. If you walk across the road to the cheaper Casino Royale, you can buy that same Budweiser for $1.50 US!

2) Beware the odds of the pokies!

This is a big one. In Australia the Government controlled odds of winning on the pokies are 80% (I need a precise stat on this). In Las Vegas this is totally not the case. When I mentioned this to pokie girls (they bring drinks to pokie players) at the Belagio, The Luxur and Casino Royale they laughed.

The pokie machines in Las Vegas are tourist machines. The wins are extremely rare. Occassionally someone will win big but that is normally a local who has gambled so much it is somewhat ridiculous.

3) Beware the free drinks if you play the pokies.

One of the hypes of Las Vegas is the…. Free drinks if you play the pokies. This is most definitely true at the bigger casinos. That being said there is normally only 1 girl per 20+ patrons playing the pokies. This means your likely to get 1 drink every 30 minutes max!

Of course you have to play the pokies which even on a 1cent machine delaying the press of the button is loosing you around $20 every 30 minutes.

Head over the road and buy your drinks. It will work out cheaper.

4) Do your sitting down at the hotel room or the pool.

Do not head out tired. There are no seats anywhere other than at pokies! Even if you go to the bathroom the only waiting seats outside are at the pokies.