This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!

Valentin Crettaz

Gold Digger
+ Follow
since Aug 26, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Valentin Crettaz

will it work if I simply group this regex as follows:

Nope, the ()* must be within the regular expression, i.e. within the /.../

Try this
For trimAll, I would take special care if the function is applied on a string that contains HTML tags, because the space(s) between attribute values are going to be removed.

"<table border='0' class='myTable'>".trimAll();
would yield
which is not good.

Instead, I would declare trimAll as follows:
String.prototype.trimAll = function(replaceStr) {
return this.replace(/\s+/g,replaceStr || "");

That way, if replaceStr is provided, the spaces will be replaced by it otherwise, the empty string is used by default.

"<table border='0' class='myTable'>".trimAll(" ");
correctly yields
<table border='0' class='myTable'>

Of course, if you have left and/or right spaces, you'd have to left/right-trim them as well
The links contain both a solution for IE and FF.

Your code, however, won't work if Flash is not available or cannot be installed for security reasons (i.e., in highly secure intranets!)
I'm backing Bear here. We've been developing a huge ebanking system for a famous private banking institution and there is a good load of Ajax in there Of course, there are more things to think about when using Ajax because there are more possible execution paths, but in the end if you do your analysis correctly, this should not be a problem.
You can either use a hidden field as Bear proposes, but you can also make your button behave that way using:

<button type="submit" name="command" value="READ">Read</button>
<input type="submit" name="command" value="READ" />
Yes, basically the dot is used to denote a CSS class name in a selector. The only way around is to do how Bear proposes, i.e. to escape the dot.
For what it's worth, what bothers me most with GWT are the following issues.

1. It is very difficult to have a graphical designer working on the team. The problem here is that GWT generates everything (HTML, CSS, JS) for you and the only place where you have a hand on is setting a CSS class name for a given GWT component. You don't get to tweak the HTML, CSS or JS, even though you can bring your own CSS and JS files into the GWT mix. On one project we started last year, we had to turn down GWT for this very reason. We had a graphical designer and an HTML integrator (who is not a Java developer!) on the team and we could not think of a consistent and productive way to work with them using GWT. Designing new graphical components that are not in the base library will require efforts on the part of your Java developers . And, well... Java developers are not the best persons to do this kind of things (Fact: 90% of Java developers, myself included, suck a graphical design!). Usually, a graphical designer does that and an HTML integrator transforms the Photoshop sketches into HTML/CSS/JS. With GWT, you can send the HTML integrator guy at home and ask a Java developer to do it in its place... or teach the HTML integrator guy to develop in Java...

2. You have to decide in advance what gets generated. That is, GWT will generate a huge amount of files depending on your needs. For each browser and each language to support, there is going to be a copy of the website. For instance, if you have to support IE6, IE7, FF, Opera, Safari and Konqueror in English, French, German and Chinese, you're going to have 24 web sites generated for you. Then all the magic happens when the user connects to your site. GWT detects the user agent and the language and serves the correct files to the user. This has the advantage of having a ~100% compatible website for every user, but adds some runtime and compile-time overhead.

3. Everyone looking at the source will know that your website has been generated by GWT (a META tag says which Java class is backing up the page being viewed). Looking at it from a security perspective, I personally can't stand the fact that users know what kind of technology is used behind my application. The more they know, the easier they will find out what kind of security issues your website is vulnerable to.

Thus, my personal opinion on GWT is that it is fine to use it if:
- you don't have to care too much about global UI constraints and pixel-precise look&feel accuracy
- you don't have too many browsers and languages to support
- security is not of primary concern to you
[ September 23, 2007: Message edited by: Valentin Crettaz ]
Prototypal inheritance in JS doesnt provide the classical inheritance (should I say class based?) and scoping (private, protected, package) you get in Java.

Even though JS doesn't recognize the private modifier, it is still possible to have private scoping in JS. Closures anyone?

In the code below, the name parameter is not assigned to but to a constructor-local _name variable which is accessible only through the getName() method.
Is there any way I can try to access that URL remotely ?
I designed one such components once and I called it "flip flop"
What is the projects layout? How do you built your code and set up the classpath?

I'm sorry I have a hard time figuring out how your project is organized.
Sorry, I don't get it... Are you deploying a WAR file or an EAR file? Or are you working in exploded mode in WL 9.2?