Skip to main content

Posts

Publish Maven site with Amazon S3 and CloudFront

Amazon S3 now supports static website hosting . As a 10 years Maven user, I wonder how easy it is to deploy Maven generated site to Amazon S3 and let the rock-solid storage provider to host my project websites. There are several existing s3 wagon providers , which all seem to have the same problem, not supporting directory copy. This is understandable since before S3 new website hosting feature, I guess people mostly expect to deploy artifacts rather than website to S3. So my first task is to write an AWS S3 wagon that supports directory copy. With AWS Java SDK , task becomes as simple as one single class . I made my S3 wagon available in Maven central repository at org.cyclopsgroup:awss3-maven-wagon:0.1 . The source code is hosted in github:jiaqi/cym2/awss3 . The next thing is to create an S3 bucket in console . To avoid trouble, bucket name is set to the future website domain name according to this discussion . Website feature needs to be explicitly enabled. I also created an...

1300ms to 160ms, tune Spring/Hibernate on slow MySQL

I write this article to remember the different behaviour various JDBC connection pool displays when they work with slow JDBC connection(to MySQL database, in this case). It starts with a typical Java application on Spring, Hibernate, Jetty, ApacheCXF and MySQL like following code. Version 1: without correct pooling //... service code @Transactional(isolation=Isolation.READ_COMMITTED) public void foo() { //... do something with database } //... connection pool configuration ... class = "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"; url = "jdbc:mysql://mysql.far-far-away.com/mysystem"; user = ... //... transaction management configuration in spring ... <tx:annotation-driven transaction-manager="transactionManager" order="100" /> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="mySessionFact...

Migrate source code from SourceForge subversion repository to GitHub

Since GitHub.com , a successful commercial git hosting provider that hosts over a million repositories, offers reliable free open source git hosting service now, I decided to go ahead and move the source code that I had in last 8 years from sourceforge subversion repository to GitHub. This page documents the steps that I did, which was pretty simple and smooth anyway. Obviously I need to be a user in GitHub.com . It's easy to sign up , no confirmation is required. Create new repository from here , and import from a public subversion URL. The URL is something like http://<projectname>.svn.sourceforge.net/svnroot/<projectname>. Before import starts, you are required to tell more about each user discovered from subversion repository. The user name and email address each sourceforge user maps to doesn't have to be existing user in GitHub.com. It takes very very long time for import to finish. Be patient. I already have git on my computer. If you don't, find out how ...

Dream comes true - a movie directing experience

For random reason, I was assigned for a project of a cheesy 10 minute film, including script writing, film directing and editing. Although all the actors and the producer involved are all nerdy software engineers and managers, one of them does have professional movie acting experience with a best director in the world. Schedule is tight, actors are not trained, and budget is zero. However the project went well and film went out on time.

Java closure shows his face - Lambda expression

JSR335 , Lambda expression started review ballot stage on November 16th 2010. Java closure finally show the new breath taking expression. Citing from the detail of JSR request: ... 2.7 Please give a short description of the underlying technology or technologies: We propose extending the Java Language to support compact lambda expressions (otherwise known as closures or anonymous methods.) Additionally, we will extend the language to support a conversion known as "SAM conversion" to allow lambda expressions to be used where a single-abstract-method interface or class is expected, enabling forward compatibility of existing libraries. We propose extending the semantics of interfaces in the Java Language to support virtual extension methods, whereby an interface can nominate a static default method to stand in for the implementation of an interface method in the event that an implementation class does not provide an implementation of the extension method. This enables interfaces ...

My day

8:00 Time to get up. First thing first, before Yilin wakes up, I have a few minutes to prepare her breakfast. Fortunately, this is done with my mom's help. 8:10 Yilin usually starts her day at this point, which leads to diaper changing, cloth changing, running and chasing, etc. 8:20 - 9:20 A full hour can slip so quickly, when it's time to feed Yilin. Again, my life would be much more painful if my mom weren't here. Sometimes I take chance to have my breakfast, sometimes I miss. 9:20 It's time to take Yilin to day care. It's already late since the morning activity time is from 9AM to 10 AM. If lucky Yilin can enjoy the sunshine for 30 minutes. 9:50 - 10:30 After good bye with Yilin, finally it's time to take a bus and go to work. This 40 minutes is one of my most relaxing time in a day. Sometimes I pick a book to read. But more and more often, I play little games on iphone. 10:30 It's an awkward time to come to office and start work this late. However I'...