This morning, I was in a meeting with an onsite customer. We were going through updating the workflow for the system we are developing. We used the whiteboard a lot...
At the end I suggested we took a picture of it and use it to describe the workflow; luckily he had a Digital camera with him so we did just that. I thought of it because I read someone had done it in an XP book a couple months ago...
Later on, I created a page on our wiki about the meeting, put the two pictures we had taken and added a few notes... and that's it. Most of what was important in the design of the workflow was conveyed ! We need to work on the design issues, UI, validation and the rest but at least the developers have an idea of what was discussed.
I am considering buying a PC at home to replace my aging Pentium II 400Mhz laptop on which I can't even compile JBoss.
I want this PC to act as a file server, download big files from the internet, play divx, run as a VCR, etc.. It needs to run 24x24 and since I live in a typical small parisian appartement and I hate noise, it must be silent so I've been trying to find info.
I found The Silent PC and silentpcreview.com. Apparently, they have built a PC that runs at 35 dBA and plan to build a gaming machine running at 25 dBA shortly. I've also found a couple other websites selling heatsinks, fans, etc... so there is a trend here.
Just to give you a couple pointers, 20 dBA is a light breeze and 40 dBA is wispering 2 meters away. So I'm going to see how much this would cost. I don't need the latest and greatest processor or gfx board. I'd rather trade power for silence :)
madbean.com: Code idiom: inserting a separator between the elements in a list an idiom I saw for the first time two weeks ago when one of the developpers on my team used it to transform strings to collections and back. I thought then that it was really well thought out (and still do...). The fact that someone blogged about just shows how much we all still have to learn from Java.
And by the way, isn't this just a case of the NullObject pattern ? This is one of my favorites : it removes "noisy" if statements from code and makes everything easier to read. I fell in love with it when Grand spelled it out clear in his book.
My other favorite pattern is template... am I an OO-junky ?
I found this idea of a kazaa lite website on how to get rid of ads & popups : adding entries to the hosts file !. This is brilliant.
All you have to do is add entries such as these
127.0.0.1 ad.adsmart.net
127.0.0.1 ad.ca.doubleclick.net
127.0.0.1 ad.de.doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 ad.es.doubleclick.net
127.0.0.1 ad.fr.doubleclick.net
127.0.0.1 ad.free6.com
127.0.0.1 ad.it.doubleclick.net
127.0.0.1 ad.iwin.com
and ads can no longer get served from there !
I have been surfing a bit since doing this and it seems like many sites are now serving ads from their own domain so this won't work all the time :(
Follow-up: I got a bit carried away : it won't prevent popups... it will just prevent them from displaying anything...
Live from Tokyo: Tech Blog: Project Management Checklists links to an interesting site with a bunch of checklists for project leadership/management.
How many developers do only pure development work ? At some point in time, we all end up being responsible for something, be it only only the technical aspects.
I think this check list has some interesting points. I am especially partial to the Development Environment checklist these days since I am focusing on just that !
For those that have been following my little saga here (any?) and who have experienced my problems I have good news ! It's solved :)
It turns out that just about eveyrthing was wrong:
- our production oracle database was setup as UTF8 while our test databases were either UTF8, WE8ISO8859P1 or ASCII ! This is VERY bad because when we imported data from the production environment to the test environment, the contents of the VARCHAR columns were wrong for extended characters
- our production env was running redhat while our test & dev are debian... it turns out all of our debians didn't have their locale correctly set so the JVM was starting with file.encoding ANSI_X3.4_1968. Setting the locale using dpkg-reconfigure locales to fr_FR ISO-8859-1 solved that problem !
The reason why I thought something was wrong with weblogic is that I seemed to be getting correct data through an SQL request only in Eclipse's JUnit. What really was happening is that I was looking at what the J2EE app was writing to a file... that's what you get when your tests are not "unit" enough !
It took a few days before we realized how many things were wrong but we finally got it right : the DBA is changing all dbs to UTF8 and now have 18 tests that run in JUnit. These tests save and load text files with accents and check that the encoding is ISO-8859-1
Yeah !
I've been refering to Ascii Table - ASCII character codes and html, octal, hex and decimal chartsa lot today as I was trying to solve my character encoding problems...
It's very strange : I export data from a database using SQL queries. To do so, I have a DAO which requests a connection if it needs one (it's cached per thread using a ThreadLocal variable... very nice trick I read at developerWorks by the way!). This connection comes from a weblogic instance's JNDI tree. The thing is, the string I get from the DAO inside the J2EE app has question marks !
As Laurent had suggested in his comment of my previous blog entry, I tried to reproduce the bg in a JUnit test case. I used the same ExportDAO outside of Weblogic. But it still used the connection from the weblogic JNDI tree. At first, I was getting non-accented characters (ie é became e, à became a, etc...) ! Of course, I had to figure out that the encoding for my java files had to be Latin-1 in eclipse rather than ANSI_X3.4-1968 ! After getting our DBA to work on the issue, he determined that oracle's NLS was set to WE81508859P1 (looks familiar) but that another character set setting was ASCII7 !! After he did some magic on the database, I could all of a sudden insert accents into the database using DbUnit and, most of all, read them in the java test case.
But... I still get question marks inside the J2EE app... on that same row where it works in the test case. So I've not been able to reproduce the bug/feature outside of the test-production environment... :(
I did notice, however that extended characters were being encoded as two bytes in the DB's columns. It turns that the production environment is UTF8/UTF8 and our developpement and test databases are setup using oracle exports&imports so I guess the import process doesn't do character conversions ! That would definatly explain question marks but... I can't update the column and remove the two bytes and make them one...
So tomorrow we'll create yet another database, set it up like the production one this time and try again...
Talking to people here, I discovered that they never were able to get accents to work correctly in the test environment. Now we're paying for it...
PS: The M5 build for eclipse 2.1 is pretty cool. I especially like the "useless imports" feature... It's amazing how many import statements we can delete here !
I think I've gotten over my head today... It had started out nicely : just making sure all the automated tests would run in anthill... which means in ant. But JUnitReport needed xalan 2 so added it to the classpath and started getting linkage errors.
All right then.. I'll just clean the classpath, well that was bad enough, see me previous posts but now... all my accented characters are showing up as question marks !
So I started looking into java character encodings... UTF-8, UCS-2, ISO-8859-1... Ok so we're using latin-1 which appears to be 8859-1 but guess what... eclipse & java in linux use ANSI_X3.4_1968... never heard of it !! So now I've figured out how to actually SEE accented characters in my eclipse text editor now... wow ! I also make sure all the character incodings of xml snippets that get inserted into the file are correct and that all files have an encoding declaration. I also make sure the xsl:output statement is correct in each xsl...But that still didn't work
So I looked at the file.encoded system property. It says ASCII while the default character encoding on inputstreams is that ANSI thing... Ok, let's start weblogic with -Dfile.encoding=ISO-8859-1, that doesn't do it yet...
If I do an xsl transformation using my XmlFile class on a file I build in the class (including accents), it works fine... humm... could it be the JDBC driver ?
well, it seems like doing resultSet.getString() on a column with an accent makes it disappear (ie... é becomes e) but my database is setup to use WE81508859P1 which according to oracle's docs should be seemlessly converted to UCS-2 which therefore should handle accents correctly.
I'm stumped... anyone ??
Seems like I'm not the only one running into classpath & jar problems. I've been perusing weblogs and found this about Bill de hÓra: xerces.hell.
And Steve wrote a classpath verifyer... neat !
I've moved my blog to my own website. Freeroller is just too slow. Too many people there I guess so I'm actually helping out by doing this :)
I'm using MovableType which is grand but it took me a while to figure out that Username actually meant my full name rather than my nickname... strange !
I've been wondering about this blogging thing too... Since I am not doing this anonymously, can I freely talk about what's going on at my work and what I am trying, running into, etc ? Actually, I believe my contract says I can't so perhaps I am stuck with talking about what I do around java outside of work. Anyone solved this dilemna ?
Followup on the alst post : I guess I should have read up a bit about JAXP before going down the XML road. The Server side has a book on XML that mentions those settings I took a long time to figure out. Although you must agree that it isn't obvious that linkageerrors stem from faulty parameter configurations...
I've been working on getting an automatic build setup, including tests so that individual developpers don't have to integrate manually all the time, I find Continuous Integration worthwhile but it's too costly in our current all-manual setup ! I first started using cruisecontrol but when I discovered anthill I quickly switched to it. It's very very easy to use. I just read about maven on another weblog and it seems complicated... is it worth it ? I'm not sure, I think I'll just stick to anthill which suits my need.
Doing this forced me to clean up the jars used in the class path ! Have you ever tried it ? It's a real nightmare : LinkageError on the SAX Document interface, noSuchMethodErrors, etc, etc... This was happening when I was running the unit tests through ANT and had added xalan.jar (Xalan-2) to the classpath so that the JUnitReport task would work. And by the way... the project was using a very old xerces & xalan and not the newest... Since only 3 classes refered to Xalan I decided to upgrade to Xalan-2 and have only one xalan jar for the whole project. The fact that this project was over a year old and no-one had done it before me should have hinted something.
I figured that it was all due to the various jars which include different versions of the same classes or interfaces. For example weblogic.jar from weblogic6.1 contains crimson, jaxp interfaces, an old xerces with a weblogic.apache... package while I had a parser.jar (from sun), a newer xerces & xalan on the classpath... Ok... so I figured out what jars were needed and cleaned the classpath. But I was still getting a linkage error :( After a few hours, I had gotten to the point where I had unjared the weblogic jar and started removing anything to do with XML. And that's where I finally figured it out : the system properties which indicate which parser to use were incorrectly set (or not set...) Ahhhhhhhhhhh ! So I finally added the -D.... to the script running ANT and tada... everything works. Will it work in weblogic ? Well... I guess the XMLRegistry is what sets those properties...I'll see on Monday but I'm confident. I think this is an unacceptable situation. I shouldn't have to spend 3 or 4 hours on this kind of stuff.
Have you ever heard of wiki ? One of the most well known, and the original I believe, is Ward's Wiki but there are many clones in Java, PHP and other languages.
Anyway, I introduced UseModWiki in my company in November to entice everyone to share information. It's a nice, simple wiki. It took about 2 months before before started getting the hang of it and see how it helped us. What does it buy you ? Essentially this
every page in the system is identified by a WikiName which is a bunch of letters with at least 2 capitals
every user can change every page, at will
there is a diff log for every page
every page contains some sort of very simple layout mechanism (or html for newer wikis) such as using asterisk for bulleted lists or hyphens to draw lines, etc
It's kind of weird when you start using it. It seems unatural to allow anyone and everyone to change every page but it's really a wonderful tool to publish information on your intranet !
This afternoon I installed twiki, from http://www.twiki.org This is the ultimate wiki. It allows you attach files to pages, to categorize pages using a FORM automagically and easily, the search function is great too. For example, in no time I had categorized all the use-cases for a project I am leading and built a simple request to report the state of all use-cases on a single page ! And I've only just started looking at what it can do.
It's got lots of plugins such as
doodle drawing
smilies
spreadsheet for tables you build in your page
to do sheet
lots of others...
Check it out...
I played with Hibernate today. I figured it was about time since I'd first read about it. It's basically a persistence layer offering powerful O/R mapping possibilities. And it's fully OO which I love. I don't know about you but I hate using Java and not being able to do extends and mock objects and other intersting things. Anyway, here's how I did it
I had a database with a couple thousand entries in 2 tables which I use for the development of I site a maintain (check it out...it's called eurobilltracker. I created it about a year ago when I wanted to do a little more SQL than select * from account where pk_id=1). Anyway, it's a table of users and a table of bills. Each user can have a referer (so this is a many-to-one I guess although not parent/child) and each line in the bill table is in fact a bill entry (if you don't know what I'm talking about, check out the site). Each user can enter bills in the system so there is a one-to-many relationship from a user to a bill and it needs to be bi-directional (not many-to-many... remember, each line in the bill table is a bill entry, not just a bill). I really should have a third table but I had decided to denormalize the bills and each entry each bill (the rationale being that few bills will be entered more than twice, that I am using mysql -ie no transaction support- and that I want each entry to be as quick as possible).
I'd say it took me about 2 hours to get the following to work
display all the information related to user with id=1 including all bills this user had entered
display a list of countries and the number of bills entered in these countries order by descending count
including the time to get the zip and read how to create the O/R mapping. I think that's pretty amazing. I can't imagine what it would have taken me from scratch with an EJB when I first learned about them... Here is a very interesting link for hibernate which lists all possible collections, maps, subclassing and other idiomatic configurations for the hibernate xml files.
I'm going to keep on testing it. I have started using JUnitPerf to see what happens what I query for an object, change it's value and flush it; the catch being that two threads are doing it at a time. Unfortunatly, right now, I'm getting various exceptions : SQL link exceptions, iterator exceptions... it's weird because I'm not sharing the Session object but oh well... I'll figure it out.
I can tell I've started being brain-washed by EJBs even though I have not used them that much. Questions that spring to mind about hibernate
how does it scale with multiple web servers
what happens when one "live" object is updated in one server ? Does a second server see it ?
how well are transactions handled ?
don"t I need object distribution ?
Pretty bad isn't it ?
Next time I'll write about DbUnit and how nice it was for us !
I've dived into blogging... don't know how much it will last but we'll see. When will someone actually read one of these entries...? I'm curious.
Anyway, I've finally had some time to do some reading of other bloggers. It all started for me on Cedric's blog (http://freeroller.net/page/cbeust) even though I'd read Dave Wieners' for a while. Cedric used to write articles in an Amiga magazine a couple years ago. When I saw his name as a contributor to an EJB book a year ago when I was in a Toronto bookstore, it rang a bell so I went to his site... which in turn led to his blog.
From there on, I discovered the web of interconnected blogs... it's interesting how discussions start, arguments are thrown. It seems that in this subspace of the blogging universe, a couple of themes are being actively discussed. One of them is AOP, the other is pair programming and XP in general.
* AOP I read about about 2 years ago, a little after the first articles started getting published and AspectJ was starting to look like something. After spending a few hours on it, I figured it needed a bit more maturing. As I go back to it now and look at what people are saying about it today I can only think of one thing : too complicated. I don't believe that it can really be used by a team of average programmers... at least not in a creative sense where a programmer/senior developer will decide that it's a good way to implement a feature. Maybe it can be included in a big project through ready-made design patterns (for tracing, for object persistence or others). I think mastering something like EJB and J2EE is proving a challenge to many software engineers even though it is not nearly as abstractly complicated as AOP.
* I read Kent Beck's white book in October 2000 and was fascinated and profundly interested by what he described. To me it looked like the answers to all questions (I was only 24 at the time!) and I looked forward to applying all of his precepts as soon as possible : no documentation, refactoring, giving the power back the developer, feeling confident thanks to great unit test coverage. Two years later and now that I am responsible for a (small) team of diversly-talented developers, I feel like reality is setting in. I think Kent must have described a situation & project in flow. This is a concept that describes groups that are uniquely centered around the same goal as well as highly productive. It usually applies to sportsmen/women. I have however wholly embraced his idea of unit testing, continuous integration and refactoring mercifully. I have also successfully applied ideas like very short iterations and flexibility in terms of what should be implemented. However, it does mean that you have to have a group of developers that is sharply focused and very able... this is by no means the usual case...
Ok, enough for the first post... lot's of things I want to talk about : test-first, EJB, mocking, Hibernate... Let's see if someone picks this blog up and starts a discussion