Tech Ravings

An Opinion is a Terrible Thing To Waste
Subscribe

Archive for July, 2007

A limited-java programers journey into Google Web Toolkit

July 20, 2007 By: ScottK Category: Google Web Toolkit No Comments →

I’ve always liked working with widgets as they can be quick and easy or both challenging and fun. I’ve built widgets in many scripting languages as well: HTML; JavaScript; PHP plug-ins for WordPress. I’ve also built widgets using the Yahoo widget frame work  but to keep an open mind I decided to look into Google Web Toolkit (GWT) frame work as well. This article and subsequent related articles describe my limited-java experience while learning and using GWT.

The Google Web Toolkit as described by Google is a Java development frame work that allows you to develop widgets in Java which is then compiled into JavaScript. GWT supports the HTTPRequest object, XML Document, and even Remote Procedure Calls. GWT is touted as being cross browser compatible without the need to detect.

Google Web Toolkit can be used with any editor but Eclipse is recommended. When creating a GWT widget application there are arguments to signify to build the Eclipse project file for direct import into Eclipse which is quite handy. Although you can certainly test your app in both hosted and web mode from the Command Line Interface you can also use Eclipse to test both modes as well, again another handy feature.

So why would I, having many years of deeply working with JavaScript, use GWT? My Java experience is limited and this would be a great way for me to get back into it. Certainly I’m not saying that GWT is Java and as a matter of fact you can only use a limited amount of true Java and below version 5.0. The GWT classes are however Java so there is the trade off.

The other neat feature is the junit testing which I have not gotten into yet. Of course I unit test my JavaScript using jsUnit but even that can be tricky and really sticky when doing HTTPRequest tests. Not to mention the JavaScript test are nothing more than bloatware when moving the js files to production. Keeping in mind that I use JavaScript classes and not free functions so my unit tests must be internal to the object.

No more alert(); type debugs either. Using System.out.println() within Eclipse you can see the output within the console. I haven’t gotten to the point of using the debugger yet. Should be interesting.

What’s your target. I hope it’s not new!

July 17, 2007 By: ScottK Category: HTML No Comments →

I have been seeing several websites that like to open new pages with the target=”new” anchor tag. Let me discuss why this is a bad thing, in fact you are telling the browser to fail safe if you do not have a frame named new. With no frames of said name you could be causing your visitors who use *cough* I.E. problems. In I.E. by calling target=”new” does open a new tab/window but any subsequent click in the previous page changes the window in the called window. It’s a real pain.

Let’s examine the use of the target attribute on the anchor element. For those who may not understand what I am referring to that’s cool. The <a is actually an element of the Document Object Model (aka Document Node Mode). An attribute is anything that describes said element: ie href=, target=, style=, onclick=, etc. Although in HTML the common written text is <a href=”http://www.techraving.com” mce_href=”http://www.techraving.com”>.

In order to produce targets within the same web page to find certain sections we need to have named anchors. <a name=”new”></a>. So when an anchor is written to find the href=”#new” mce_href=”#new”, <a href=”#new” mce_href=”#new”>New</a> then the named page is scrolled down to at the appropriate position. What happens if I change the referring link to: <a href=”#” mce_href=”#” target=”new”>New</a>? Well a new window pops up without scrolling the page to the “new” named anchor. Why is that? Frames!

Frames were very popular once and out of this frames navigation was needed. To achieve this the target= written in alphanumeric means find a frame with name= equal target=. <a target=”new”… means find frame name=”new”. You could literally do the same thing by saying <a target=”Fred” equals find frame name=”Fred”. Once new or Fred were found then the href page was displayed in that frame.

What’s a browser to do when the named frame was not found? FAIL SAFE! How the browser achieves this is truly dependent on the browser however. FireFox opens a new window every time. Internet Explorer will replace the window of the last opened by the previous calling page. Meaning if you are doing this and I have two pages of interest too me I can only see one at a time as clicking one link will open a new window but the second link will replace the first.

Whether you are techy or not reviewing the official w3c explanation: http://www.w3.org/TR/html4/types.html#h-6.16 would really help to understand. Certainly you can have differing opinions with me or the w3c and continue to use the target=”new” attribute. However and silently do this, create within your page this piece of code:

<iframe name=”new” width=”300″ height=”300″></iframe>

If your anchor does not open within this iframe then by all means you can contact me or the browser manufacturer you are using. I suggest with me first. However before you do try your anchor target=”_blank” and see what happens.

Unless your website is dealing with navigation between frames or iframes any target that does not have a target=”_ is only causing your visitors trouble. You as a webmaster/owner can not dictate what browsers your visitors are using or how the browsers themselves act so you must try to stand on what is publicized on the standards that everyone hope to achieve across browsers.

Weekend Retreat

July 17, 2007 By: ScottK Category: News No Comments →

This past weekend PayPerPost went on our company retreat. Retreating from what I don’t know as it was very intensive and I didn’t get any time to enjoy the sun. Minus a few minutes during lunch on Friday. We did however get to participate in the infamous “Scavenger Hunt” Friday night and I unfortunately became the victim of the human Sunday. I’m sure the cleaning ladies were quite upset at us as you can see the after effects in my bathroom from the face paint and the chocolate sauce.

Scavanger Hunt Bathroom

The really cool thing about the scavenger hunt was that I got to meet a special woman. Well OK she was from Italy and about 8 months pregnant and there with a student group. Her name was Gaeda and she had never heard of a scavenger hunt and thought that PayPerPost had made this up. She really wanted our hunt list.

I seen her the next morning hoping she forgot, mainly because I had to turn in our lists, but she recognized me and asked for it. I did manage to get a fresh copy; you really didn’t want to see the used ones. I explained the whole concept to her and suggested alternatives for children. She also owns a PR company and suggested exactly what this event was about and that it would be a great team building activity.


ss_blog_claim=ef6135f29164404afb5ea2743196c435