Skip to main content
View by: Most Recent | Topic | Community | Webloggers   
Monthly Archives:    

Blogs by topic: Programming

• Accessibility • Ajax • Blogging • Business • Community 
• Databases • Deployment • Distributed • Eclipse • Education 
• EJB • Extreme Programming • Games • GlassFish • Grid 
• GUI • IDE • Instant Messaging • J2EE • J2ME 
• J2SE • Jakarta • JavaFX • JavaOne • Jini 
• JSP • JSR • JXTA • LDAP • Linux 
• Mobility • NetBeans • Open Source • OpenSolaris • OSGi 
• P2P • Patterns • Performance • Porting • Programming 
• Research • RMI • RSS Feeds • Search • Security 
• Servlets • Struts • Swing • Testing • Tools 
• Virtual Machine • Web Applications • Web Design • Web Development Tools • Web Services and XML 


Programming

This blog entry is the summary of a long discussion I had with my friend Jason Brazile about Calendar and Date manipulation in Java. Jason is one of those agnostics against Java platform and he is also a high skilled developer and researcher, so our discussions often unveil interesting details about the Java language. This one made me be totally stoned. How many concrete implementations of the...
on Jul 23, 2007
This is an exciting time for the Java platform for a lot of reasons, and certainly JavaFX Script is part of the buzz right now. If you read much about this new script language, you'll see lots of comments about how Sun is targeting this language for rich content development, a language to help us make our UIs sparkle. I think that opportunity is real, and I think JavaFX Script can help. At least...
on Jul 20, 2007
I was using this Java idiom today, not for the first time, and thought I'd blog it for people not aware of it. You probably know that if you compare two objects x and y using x.equals(y), the result will be false if they are distinct arrays, even if their contents are the same. There is an easy way to get the right result for arrays. It is Arrays.deepEquals(new Object[] {x}, new Object[] {y...
on Jul 20, 2007
Few days ago I received a simple Java task: to take a comma-separated values (CSV) file and to create a Properties file for every column. The content of CSV file was delimited by semicolon; and the data was typed as the example below. Notice that first token of each line in the csv file represents a key and the other tokens should be split in different files - one for each language. Original...
on Jul 16, 2007
Imagine taking your car into the shop, they call back saying you need to apply a manufacturers fix to the fuel injection system, it may not fail now but soon. Instead you say, "No way! I put one of those fixes on before and it took a week to get the car working again!" OK, my example isn't perfect but in the software world we are trending towards the wrong end of trouble-free updates. Don't get...
on Jul 10, 2007
The prizes and and the competition format were very attractive: 5 questions about Java SE, with victory criteria based on velocity and precision. With that in mind I showed up in the competition arena trying to be as fast as possible - a strategy mistake I figured out few minutes later. The questions were really not so hard, but you know, all that minor details about immutable classes and...
on Jul 2, 2007
The code below actually prints "yikes!" If you return in a finally block then any Throwables that aren't caught (in a catch block that is part of the same try statement as the finally block) will be completely lost. The really bad part about this is that it looks so innocent. I can think of no reason to return in a finally clause. If nothing else, catch(Throwable t) and return in that so it is...
on Jun 27, 2007
A pet peeve of mine is when a variable is declared way before it is needed. It is much easier to understand a piece of code if a variable is declared just before it is needed. That immediately tells me that it isn't used anywhere before that or in any wider scope. I also find it annoying when a variable is declared with a null value and them immediately assigned a value. String value = null;...
on Jun 25, 2007
The Sun Developer Network has a few newsletters that you can subscribe to. One of the newsletters is Core Java Technologies Tech Tips. I still can't see that title without smiling. I'm always amused that Sun's proper use of the word "Java" must always have an approved noun after it: Java language, Java platform, Java technologies. It doesn't matter that Java Technologies Tech Tips sounds...
on Jun 14, 2007
The core of the Footprint Project is alive, and during the next few days I will be organizing a minimum documentation in order to publish the first stable release. The current snapshot is able to generate and sign PDF documents through a concise code - a very good beginning considering the scarce resources of the project. Now it is time to check the outlook and to start discussing the more...
on Jun 13, 2007
I often see code like this (when using Java 1.4 or earlier): Iterator i = list.iterator(); while(i.hasNext()) { ... } but I write that as: for(Iterator i = list.iterator();i.hasNext();) { ... } because * It shorter * It keeps i in a smaller scope * It reduces the chance of confusion. (Is "i" used outside the while? Where is "i" declared?) I think code should be as simple to...
on May 23, 2007
Where: Jazoon'07, Zürich / Switzerland Date: June 24 - 28 Prize: Your Java Honor (and some gifts) So, check the mosquito flying, don't lose your focus and remember: one hit, one answer!
on May 21, 2007
I like to make my static method names start with an upper case letter. I know that isn't standard and that only class names are supposed to start with an upper case letter but I find that it is helpful because it quickly shows which methods are static. Also, I have never confused a static method with a class because the usage/syntax is different. Does this sound beneficial? Notes: I don't know...
on May 18, 2007
ClassCastException didn't used to have a message but I noticed that now it has a message that includes the cast class and the object class. That extra info is very beneficial. (Note that only recently could I start using 1.5 in my main product so I am behind the times a bit.) What other common Throwables need improved messages? NullPointerException should have the name of the variable. I...
on May 17, 2007
Do developers write good product documentation? Is someone who knows a product inside and out the best person to document it? Have you ever bought a product and you could obviously tell that the manual writer didn't speak the language natively? From my little knowledge of languages it seems that it works better for people to translate into their native language. I think the same principles...
on May 16, 2007
ELCA announced an entry level scriptlet competition at Jazoon'07, with focus in innovative thinking and rapid application development based on the new features of the JDK 6 or based on Groovy. The prizes are quite attractive for students, including free Jazoon'07 vouchers and books from Amazon. And, of course, the best prize: proving your skills in one of the richest markets in the world :)...
on Apr 11, 2007
Sometimes you need to clone objects, and sometimes you can't use their clone method, and sometimes serialization provides an alternative. Here's an explanation of when you might need this exotic and expensive technique, and how you can use it. When do you need to clone? The commonest time that you need to clone an object is when it is a parameter or return value of one of...
on Apr 4, 2007
If you've ever made a serious effort to get rid of "unchecked" warnings from the Java compiler (the ones it gives you with -Xlint:unchecked) then you'll probably have found some cases where you know a cast is correct but you can't convince the compiler of it. Is there anything better than adding @SuppressWarnings("unchecked") around the whole method? The problem with the @SuppressWarnings...
on Mar 30, 2007
As a programmer and somewhat graphist, i tend to make things nice, or at least i take time to work a bit on presentation. But should i? It is always better, in my opinion, to present even the slightest example with a little image but, when is that presentation distracting from the technological point of view, or in the opposite when is the presentation hiding flaws of an API? Is it better to...
on Mar 19, 2007
Last weekend i went and bought a new laptop (actually, this is my first laptop). So, as i plugged it in and connected to the net, Vista started downloading updates and installing them. And then i started thinking - what happens if one of these updates will simply crash the OS on the next boot? The implicit assumption of any update to the operating system is that it at least boots (if everything...
on Mar 8, 2007