CARVIEW |
![]() Get Involved
Get Informed
Get Connected
Search
Online Books:
|
![]() |
||||||||||||||||||||||||||||||||||||||||||||
![]() |
John O'Conner's Blog
Another solution for non-UTF8 source files in NetBeans 6.1?Posted by joconner on April 05, 2008 at 09:55 PM | Permalink | Comments (4)Recently I mentioned a potential problem when saving source files in a non-Unicode charset encoding. The potential data loss is significant for large projects. After thinking about the problem a little more, I have a potential solution, a solution that allows you to save to a non-Unicode encoding but also prevents data loss. You are familiar with Here's how it would work. First, NetBeans 6.1 uses UTF-8 for a project's default source code and configuration file encoding, an excellent choice by the way. So, now imagine that your source code has the Euro currency symbol in it. That's Unicode code point Now, let's imagine that you need to change your project encoding for some reason. So, maybe you choose ISO-8859-1, which doesn't contain the Euro symbol. You can still represent the Euro character, but you'll have to encode it with the \u. Wouldn't it be nice if NetBeans did this for you, creating So, what do you think? Maybe the NetBeans team can get this into the 6.1 product before final release? Have you seen NetBeans 6.1? Give it a try, and blog about it. Who knows, you might win $500! Also posted to joconner.com. Call for participation: Internationalization and Unicode Conference #32Posted by joconner on April 03, 2008 at 12:04 AM | Permalink | Comments (0)The Internationalization & Unicode Conference is the technical conference for software and web internationalization engineers. If you have a product that implements the Unicode standard or an idea that will help others work with this standard, share your knowledge. The "call for participation" is an invitation for Unicode gurus, clients, and vendors to submit papers for this upcoming conference. Learn more at the Unicode Conference web site. Also posted to my software internationalization blog at joconner.com NetBeans 6.1, UTF-8 encoded source files, and a tale of corruptionPosted by joconner on March 30, 2008 at 02:59 AM | Permalink | Comments (3)I'm always happy when a company or product adopts Unicode as its charset. I think it makes perfect sense to do so. There are lots of good reasons why standardizing on Unicode is the right thing:
I was pleased to see that NetBeans 6.0 and the 6.1 beta uses the UTF-8 encoding (a Unicode encoding) as its default for project configuration and source files. The following figure shows the default setting in the project's property sheet: This makes it much easier to edit non-ASCII, non-English source and property files. You can type text in any supported Unicode script right into Java source code. A legitimate usage would be comments or even localizable text in javac -encoding UTF-8 YourSource.java Despite the potential benefits of this, NetBeans 6.1 still doesn't support this correctly in my humble opinion. Why not? Well, the biggest reason is simple: file corruption and permanent data loss. Ouch! Let's take a simple "Hello, world!" example in Japanese. This is simple for NetBeans because of the UTF-8 encoding. The NetBeans editor even displays it correctly as shown here:
Unfortunately, the joy of this discovery was short lived when I discovered how easy it is to corrupt this data. Feel like experimenting with the charset encoding? Surely someone will. I suspected what would happen, so I didn't do this with any substantial code base...but someone will. I sure hope they use version control software. Reopen that project property sheet, select another encoding, say
Some of you, the super careful, nit-picky ones will now argue with me, "But John, you haven't really lost anything yet. 8859-1 and CP 1252 don't have those characters, but the original byte values are still entact. You can get them back in this example." OK, I concede the point. But now I'll show you some serious data loss, no messing around this time. Instead of
Now that's just not good. Did NetBeans save the file correctly? Sure. However, NetBeans can do better than this. I would argue that if NetBeans knows that the target encoding does not support the source encoding, it should at least warn the user that the resulting file will contain garbage characters and that parts of the file will be lost--permanantly in many cases. So, just in case anyone over there in the NetBeans developer group can hear me...you have to fix this. Yes, I know it's a silly mistake for someone to do this, but NetBeans can help them avoid the problem. Just provide a warning dialog, "Saving this file in the target encoding will cause data loss because the target encoding does not support all characters in this file or project." Keep the encoding feature, just perfect it by helping some users avoid this costly mistake. The fact is that most software developers still don't understand character sets and encodings, and this is just an accident waiting to happen. On a personal note: I really love NetBeans. And I hope this blog qualifies me for the NetBeans 6.1 blogging contest! I could probably file this under the "suggestions on how to enhance NetBeans 6.1" category. Will blog, write, or program for JavaOne passPosted by joconner on March 26, 2008 at 12:01 AM | Permalink | Comments (0)
Although I was there last year -- writing, blogging, communicating to the community -- I don't have a pass to JavaOne 2008 yet. Unfortunately, I have no concrete plans. No corporate or community sponsor has agreed to help yet either. It's a sad, sad thing. Indeed, these are trying, desperate times. I want to go to JavaOne...and I'm willing to take drastic action. Sure, I could just put up the money myself. The $1595 price tag for a 4-day pass is expensive but not entirely out of my budget. Still, there's no fun in that, especially if I can do something more interesting than just sending in the registration cash. So, I'm going to do something a little different in order to participate this year. I'm hiring myself out! Yes, that's right. The first sponsor to offer a full 4-day Conference Pass and room will receive my professional consulting/writing/blogging/programming/go-fer services for the duration of the event! Here's what you'll get:
Yes, it's a bit unusual. But the JavaOne conference is unusual too. I think this is going to work out just great. You know how to reach me: john at joconner dot com. Beans Binding and my Flex friendPosted by joconner on March 23, 2008 at 10:53 AM | Permalink | Comments (8)
I recently wrote a brief introduction to Beans Binding called Synchronizing Properties with Beans Binding. I was enthusiastic about Beans Binding, and then a coworker threw a wet towel on me. The conversation went something like this: John: I just finished an article on java.net. This API might be useful in this project. Coworker: Yeah, what's that? John: Beans Binding. It's an API that will help us bind beans together, synchronizing properties. Coworker: What do you mean? John: You know...say you want to update a table with new data anytime a result set changes, or maybe you want a price field to display the current total of all purchased items in a shopping cart. You can use beans binding to synchronize the properties without having to write all the plumbing and event handling yourself. Coworker: Hmm. Java hasn't always had that? John: Well, yes. Java has always allowed you to synchronize properties, but we've never had an API to make it this easy. Coworker: Really? We've had this in Flash and Flex forever. John: You've had binding? Coworker: Binding, or Beans Binding...whatever you call it. We can bind a variable or property to another variable or property so the updates trickle throughout the application. It's a great feature, a must-have, and I couldn't do without it. I use John: Yes, it's great. I agree. So take a look at that article. Beans Binding, it's pretty cool. Coworker: You're just getting binding in the Java language? Hmm... really? I just assumed Java would have had that all along. John: Um, it's not exactly part of the language. It's a new API. Making changes to the language is difficult and usually takes a long time... Coworker: Oh, I misunderstood. It's not part of the language? Just a separate API? Got it. Hmm...ok. Well, uh, gotta run. John: Hey, wait. But Java FX Script has a Coworker: Right. Java FX Script. It's about time Java got got a bind operator or keyword, something. John: No, not Java. Java FX Script. That's the new language for rich client app development. Java FX Script has the Coworker: OK, right...well...hey...I have to get back to work on this Flex app. But I agree, binding is great, couldn't do without it, use it all the time. Videos and the cubicle effect on content consumptionPosted by joconner on March 20, 2008 at 02:54 PM | Permalink | Comments (6)They do great work over there on the java.sun.com editorial team, and they've been improving the site with lots of videos lately. The last three featured content pieces have been videos. That's excellent work, but it's inaccessible for a couple reasons. First, I like to hit java.sun.com first thing in the day from my workplace. That's been a cubicle environment recently. I can quietly read a text article, even print it and read it later during a lunch break. Unfortunately, I can't do the same with the videos. They're fun, sure, but unwatchable because video and audio are distracting to others in the office. Bandwidth issues aside...people just don't like to hear this from another cube. I understand that, so I don't intrude on their peace and quiet. Unfortunately, the video is inaccessible to me. And when I get home, well, there's a better than even chance that I won't watch a tech video then either. Second, the videos are inaccessible to those with hearing or sight impairments. Seems obvious, right? Can't hear...the audio isn't usable. Can't see...can't watch the video either. I suppose you could listen to the video -- but not in my cube. So, the videos are inaccessible to others too. Granted, those who can't benefit from the videos are a small minority. Still, wouldn't it be nice to include them as far as possible? I think a solution is possible. Video is a great idea for java.sun.com, and clearly the medium is popular. Just witness the popularity of YouTube, etc. I think the videos could be improved though with something very simple. Transcripts. Providing a transcript with the video would allow cubicle dwellers access to the content. The same transcript makes the content accessible to hearing and site impaired developers too. Can't hear -- you can read the transcript content. Can't see? Text readers exist for that case. Either way, the videos become more accessible to a larger group of people. Is this a complaint? No way. I enjoy practically all of the content provided by java.sun.com. This is just a friendly suggestion, hoping that it will bring the content to an even wider audience. It has been a long, long time since I last worked in a cubical environment. I find the experience undesirable but tolerable. It makes me curious though...just how many of us work in a cube environment? Might be a great polling opportunity for the java.net editors... Should we expect more db acquisitions?Posted by joconner on February 24, 2008 at 08:10 PM | Permalink | Comments (3)Last month Sun announced it had acquired MySQL, which may very well be the most influential and widespread open source database in the world. Aside from a few announcements, there wasn't nearly as much comment on this as I expected. Here are the databases that I see being supported at Sun:
HSQLDB? You would agree that Sun is the largest supporter of Open Office, right? I mean even though OO is open source, that doesn't mean it doesn't have huge corporate sponsorship. And that huge corporate sponsor is Sun, which donates time, material, money, employees, and advertisiing to Open Office. Open Office has adopted HSQLDB as its internal database. Surely HSQLDB's project gets support from Sun too. After all, it is an integral and important part of the Open Office suite.And its a 100% Java implementation. Maybe this isn't an expensive investment compared to MySQL...but why bother with HSQLDB, especially when you have this next db? Apache Derby. Sun's branding calls this Java DB, but underneath, it's still Apache Derby. Derby is the 100% Java database that supposedly can scale from embedded applications to larger, departmental, transactional apps too. Impressive for sure, but certainly duplicated by the HSQLDB product's abilities, no? Regardless of the overlap in abilities, these are two different products with different supporters and communities. Still, that's another db, and more money, time, and resources from Sun. Then we have the heavier hitter, MySQL. And this is by far the biggest ticket item. What was the price? $1 billion? I put this db in a different league from HSQLDB and Derby. 100% Java? Not at all. However, it does have more enterprise credentials than either of the other databases. It's probably not fair to even put the others in the same arena as MySQL. As I dig around, I see that Oracle purchased Innobase, the company that provides InnoDB within MySQL, a couple years ago. So, Oracle owns InnoDB, and Sun owns MySQL. Interesting, but what's that mean about InnoDB within MySQL now? I see Sun developing more and more interest in database technologies, from small systems like HSQLDB and Java DB to the larger MySQL. It's a pattern, and I wonder what it means. Can we expect Sun to actively support and even purchase more db technologies? What might those be? With limited time resources, I can't work on all the things I'd like to. I can't read all the books I would like to. I can't give to all the charities that deserve my attention -- or money. I think companies have similar constraints on their resources, money, employees, etc. As far as I can tell, Sun has now made committments to at least three different database systems. Which one will prevail at Sun, and which will get the resources to maintain itself? Java applets not viable for this application?Posted by joconner on February 22, 2008 at 10:10 AM | Permalink | Comments (28)I've been working with a company that creates a chat system that helps companies sell more of their products online. The backend is all Java, complete with Spring, servlets...all good Java stuff. The frontend is...well, it's Flash. Preferring Java everywhere when possible, I asked about the Flash choice on the customer-facing app -- the actual chat client. The conversation went something like this: John:Wow, this product uses Java everywhere except on the front, where the customer actually interacts with it. Why choose Flash there? Dev mgr:Well, Flash was just easy. It was simple to use for such a simple UI too. John: I see, but it's pretty easy to do that chat UI in Java too. Swing's layout managers are easy now, particularly if you use an IDE like NetBeans to layout the UI. Dev mgr: That may be true, but the choice is based on more than just ease of creating the UI. John: Yeah? So what's that? Dev mgr: Flash is on every client browser. We don't have to install the runtime. John: Java should be there too, right? Most PC manufacturers include it. Dev mgr: Maybe, but we know Flash will be there. Flash is all over the web, and chances are that a customer has the runtime already. If they don't, the download and install is fast and easy. John: OK, but Java will also install easily. Dev mgr: But Java takes so long to install. It's too big. John: I don't know if that's so true anymore. There's been a lot of work to make the runtime smaller and more compartmental. So you only download what you need. Dev mgr: What we need is something very, very simple. A very simple UI with simple functionality to relay chat text. Flash does the job well. The conversation continued...but I didn't get too far. Maybe Flash does do applets better than Java? Working with Sun for so long, I just naturally imagined that Java was everywhere and that everyone else loved it too. I've always been able to make things work...but apparently not everyone else has. The download size never bothered me...but it does bother some others. Additionally, I find that perception is as important as reality. So what if Java is now faster, leaner, and great working within browsers? Somehow it doesn't matter. The old perception is still out there -- that it's slow, huge, and difficult to work with in a browser. It's amazing to find out that some just don't see Java as their solution in that space anymore. I called a few friends who put together consumer-oriented websites. They use Flash too. What about Java? Sure...all on the back end business logic. But what about applications that the customer will use? If they're embedded in the browser, they're using Flash. Wow. So, how would you approach this? What does the Java community need to do to fight back old perceptions? Why is Flash so much more popular in browser based applications? And how can we get Java there instead? ![]() |
![]() |
April 2008
Search this blog:CategoriesAccessibilityBusiness Community Community: Global Education and Learning Community Community: Java Communications Community: Java Games Community: Java Specification Requests Community: Java Tools Community: Java Web Services and XML Community: JavaDesktop Community: JDK Community: Mac Java Community Community: NetBeans Databases Deployment J2EE J2ME J2SE JavaOne JXTA Open Source Programming Swing Tools Archives
April 2008 Recent EntriesAnother solution for non-UTF8 source files in NetBeans 6.1? Call for participation: Internationalization and Unicode Conference #32 NetBeans 6.1, UTF-8 encoded source files, and a tale of corruption ArticlesSynchronizing Properties with Beans Binding (JSR 295) All articles by John O'Conner » ![]() |
![]()
|