Posts

Exposed Domain Object implemented with Spring Aspect Transaction Control + AspectJ

Image
This application was designed and implemented as my first web app following the DDD principles. There are some interesting issues to solve. I had the domain models exposed to the presentation layer. No facade!??? Yeeeeaah, but not exactly. I did not see the similar design at other places yet. Which has no facade in front of domain models, no facade between presentation and business layers. I can imagine the reaction from people who are so used to facade. Spring+AspectJ allow you have this design. Using domain object that has the supporting DAO injected and letting "spring's annotation transaction aspect" handles the transaction. It can work. Although, using Spring+AspectJ can implement this design, it doesn't necessarily mean this design is good for all applications. An evaluation needs to be done. Here are the pros and cons . Pros: Faster development. It accelerates the development. No Facade for the exposed domain model. When a domain object is a natural entry point...

New Stuffs Making Me Feel the Passion Again

Facelets Before knowing this, I can hardly think of a reason to use JSF. There are many benefits from using Facelets with your JSF app. I like the most is the "jsfc" attribute. What it does is converting xml element to another at runtime. With this feature, JSF can finally be "designer friendly". Although I haven't find a way to get the facelets template also friendly to html designers. It's hundred miles better than using bare JSF. From: <input type="text" jsfc="h:inputText" value="#{hello.world}" /> to: <h:inputText value="#{hello.world}" /> Inside Facelets Facelets fits JSF like a glove Developer Doc TestNG I like its annotation, data provider, dependent methods, and some other flexible features. TestNG Doc EasyMock Doesn't matter you are a classical or mockist styles of Test Driven Developer, you will find EasyMock is a good tool in your pocket. Mocks Aren't Stubs EasyMock Doc Shale Ever wondere...

Domain Driven Design

What I can say, still a new new thing to do if you are working with a serious project, think it twice. It had given me some interesting challenge. Spring, aspectj, and Hibernate, the domain object are injected with the repository. Some how, domain driven design made me think that Eric Even's "Entity" are similar to EJB's "Entity" bean. They are all heavy objects. They all hide the details about the database operations. They all need this factory and service to complete the life cycle. Let me know if I am wrong about this. This is about a subtle problem during my development of a project. It related to hibernate lazy initialization. When the domain object loaded with hibernate configured lazy="true", and spring + run time aspectjweaver was trying to inject in the data store, I had this "CGLIB Enhancement failed [classname]" failure from hibernate. . Took me an hour to find out what really happened. Had no clue at first. Then there is no ot...

Blizzard

Image
Here was what Edmonton just had on Jan 10, 2007. I was looking at Maven2 and am very convinced by its power. To have a project going, maven 2 can save you a lot of time on those small things. Testing report, build, dependency jar files and more. The Continuous Integration tool I used is continuum. A very nice tool, it works with Maven nicely. Another thing that is worth to mention is that JSF is not that bad after all. I spent a little time on JSF and found it's not hard to pick-up. It is going to win a bigger market share soon. Because it's "standard". A lot people will buy it just because of that.

JDK 6

JDK 6? I felt 5 was just out for not long, wait a minute, it has been out more then a year ago. Am I too old!? Do you guys have to same feeling? Java grows like crazy. Had a look at JDK 6, I love it. You can feel it's faster, some say it's two digits performance improvement. The script engine is a brilliant idea! I was thinking that JCP was only stealing ideas from open source projects. Of cause there are lots other improvements. Such as the new debugger. Looking forward to use that function soon. It made me exited and proud to be in Java field. Give me some challenges.

Scripting

Have been thinking about learning a powerful script language for a while. I am not bad on Bash. Bash probably is the most guaranteed tool when you need a scripting language. You can find it on every machine these days. It definitly worth to spend sometime if you use *nix. Last night, I felt that I have to do something about my scripting skills. Walked up to my computer, did a quick search on google, before long, I found I need to choose one from Python and Ruby. Did 30 minutes reading, among these two languages, I decided I will learn Ruby. Why, here are the reasons. I live in Java world. Python use "indent" to mark the boundary, made me feel unsecure. I do web applications. Ruby on Rails is another attraction that Ruby have on me. Ruby's Completely OO. I am curious about what Ruby's OO looks like. IMO, to learn which one probably doesn't really matter. Ruby just happened fit in my knowledge base better. =============================================== After about ...

Spring framework, Hibernate and MySQL Replication

Image
Laterly we have our site grown to the stage that a single mysql server will not able to do the job anymore. That's something we realy like to see. The CPU usage had reached more then 90% at peak traffic time. MySQL even crashed a couple time when we were running an early version. 5.0.x. Don't remember what it was exactly. But when we upgrade to 5.0.24, it stopped crashing. It was also unacceptablely slow under the heavy loads. We need some heavy duty database solution. I have read a couple articals about mysql cluster. So my first thought is cluster. But when we ask our hosting company to set up a MySQL cluster, they suggested replication instead. Sometimes you just could not judge things by their name. Have run into the word "replication" a couple times in the mysql ref book. I miss judged the replication function. My sql does not like some other databases, this replication is real-time replication. To set up a master/slave replication system up is really a straight ...

FC6 LiVES amr_nb amr_wb audio

I was trying to connect a couple video clips from my daughter's Halloween party. My home computer has Fedora Core 6 Linux. The video editing tool is LiVES . Under the hood, it's using mplayer to load my videos. But with my installed mplayer options, the amr_nb audio wasn't enabled. It's time for source code digging. Into the libavcodec directory of mplayer, noticed the amr.c file, it says: This code implements amr-nb and amr-wb audio encoder/decoder through external reference code from www.3gpp.org. The licence of the code from 3gpp is unclear so you have to download the code separately. Two versions exists: One fixed-point and one with floats. For some reason the float-encoder is significant faster atleast on a P4 1.5GHz (0.9s instead of 9.9s on a 30s audio clip at MR102). Both float and fixed point is supported for amr-nb, but only float for amr-wb. --AMR-NB-- The fixed-point (TS26.073) can be downloaded from: http://www.3gpp.org/ftp/Specs/archive/26_series/26.073...

Fedora core 6 update

Image
First snow of 2006 Edmonton. Noticed that the Fedora 6 was out when I had the "baseurl" yum error. So I just could not stop myself from downloading a copy. Started Bittorrent and run out for a whole day. After my daughter's halloween party, the dvd iso downloading is complete. Did not stop the seeding until I have the DVD burned. That was about 11:00pm. Try to give something back instead only taking. That's what p2p about. I did not use yum to upgrade my home machine from 5 to 6, because when I tried yum, it met some dependency issues. I also don't have time to figure it out. My wife is always checking our financial status on this machine. There are some instructions about using yum to upgrade from other FC to FC5. Haven't seen one talking about 5 to 6 yet. Had the machine booted from the new dvd. Selected "upgrade" instead of install a new system. Then it's the waiting game. I went to bed to catch some sleep. All my family had not enough sleep f...

UTstarcom

Image
This is a photo I took a couple days ago using an UTstartcom pocket PC. Finally I had a Pocket PC. UTstarcom, 3 years contract with Telus. I have played with it for two weeks now. Nice device. Runs Microsoft Windows Mobile 5.0. OS dead twice. Had it resetted once. I guess it's what MS famouse about. I like it very much. Tried wireless network, worked perfectly. So I can surf the Internet while I am on the toilet. Downloaded WordNet CE version. It's a free dictionary. It works, only crushes from time to time. Didn't bother to buy a dictionary. Downloaded PocketPutty , the cvs nightly build version. Worked very well. Only thing I don't like is that it doesn't work with ssh port higher then 9999. I am really excited about being able to connect to my machines from anywhere at any moment. Although I doublt that I will use it for a real situations. I had this photo taken a couple minutes ago. I am going to have it on my profile. 8-]

Mplayer mencoder converting videos to flv files

The website I worked on is a casual game and video type website. Lately I have got a chance to revisit the back end media conversion engine we built half year ago. Instead of using ffmpeg, this time I used mplayer project to do the trick. I like mencode better. FFmpeg is good, does everything, except did not give me enough options, switches to adjust. I did not find a middle way to have the quality and the size of the flv meet our needs. In our environment, I have faac, faad2, lame installed. Faac and faad2 are a little trouble-some. I downloaded their release first, the source code just would not compile. So I tried their cvs version. It worked perfectly. I think I was too cautious. Here is the mencode command I used: #mencoder $1 -o $2 -ofps 15 -of lavf \ -oac mp3lame -lameopts abr:br=64 -srate 22050 -ovc lavc \ -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames \ -lavcopts vcodec=flv:keyint=25:vbitrate=300:mbd=2:mv0\ :trell:v4mv:cbp:la...

Day trip to Miquelon Lake

Image
Had invited a couple friends to have a day trip to Miquelon Lake at South-East Edmonton. About one hours driving from Edmonton. Here is what I am going to bring: Food, water, salad bow, forks, cups, dishs, knife, cutting board. Swimming suite, sun screen, off, lighter, axe, tower, chairs, shade, soccer, camera, map, first-aids, leatherMan SuperTool. We met at The Brick Store at 23Av-Calgary Trail at 10:00 AM. Had a quick discuss about the trip and route, and hand every driver a map. The funniest thing happened after 30 mins driving. We found out that the park is closed for improvements. Then we changed our plan and went to the hw 16, and spent a day at Elk island. It's the last thing you would expect that a lake shore was closed in summer. We took the yellowhead high way 16 and had a nice day in Elk Island.

Things can get better

Seems things are getting better, it has been a while I did not get kneed at my ribs. Started taking Brazillian Jujutsu classes. Only two classes so far. It's very interesting. At the same time, I noticed that my kicking skills are not as good as it used to be. More practic.
Was kneed on my rib last Friday and kneed on my leg yesterday. It hurts. It is still a long way to go. All these weapons, elbow, knee, punch and kicks, they are slowly getting effective during the sparring. I am going to take a rest this Saturday. Not used to the bike riding yet. Hopefully it will be better next week.

First day

This is the first post. It gives life to this blog. 8-]