China Musings

Writings and Ramblings (A/V) from Guangzhou, China

Goodbye to Java

Filed under: Work Related, Web Development — Adeh at 6:13 pm on Wednesday, April 12, 2006

I have been working with PHP for a long time now, and Java for longer, and Ruby for about a week. Today, I had to implement a very small script in a jsp page without my library of helper functions. This script in php would have been easy in about 10 lines. In Ruby, 5 lines. In java, it was about 35. I just had to post the most obvious example of Java obtuseness:

public int compare(Object left, Object right) {
return ((Long)((HashMap)left)
.get("timestamp")).compareTo((Long)((HashMap)right)
.get("timestamp"));
}

The context is trying to sort an array of hashes according to one of the entries which was a long. Sounds simple right? Not in java.

When I first started writing PHP scripts, I cursed the fact that there was no typing and I always got mixed up in what was what. But now, I really see the benefits of a loosely typed language!

cameraitacina.com is LIVE

Filed under: Work Related, Web Development — Adeh at 7:35 am on Monday, April 3, 2006

After a really long development period, cameraitacina.com is live and public. This was not an easy project, and has given me lots to learn during the development phases. I re-wrote the AJAX part using the Protoype Javascript library, which is awesome by the way, and I had to add a cache because it was totally crashing the server under the load. The Chamber of Commerce gets lots of visitors, this site is my highest traffic project by far.

Aside from creating a huge WP theme for the site, we also implemented 3 searchable databases, streamlined the multi-lingual plugin, added an event registration feature, and integrated the photo gallery. It was a lot of work, but I am pretty happy with the result.

Awesome Ruby Tutorial

Filed under: Web Development — Adeh at 3:04 pm on Monday, February 27, 2006

I have been really interested in the Ruby Language and the much hyped Ruby on Rails web development platform. I had already played a bit with Rails, but this weekend, I decided to go back and do some research in Ruby itself. I found this wonderful book/tutorial that I just had to share:

http://tryruby.hobix.com/

http://poignantguide.net/ruby/

They are both written by the same guy. Its amusing, strange, and very informative. It is aimed at someone who is just starting programming, so it moves a little slow. But what it did was it gave me a very good feel for the Ruby language. Not just the syntax, but also the style.

Wordpress 2.0 Is my Hero

Filed under: Web Development — Adeh at 1:56 pm on Sunday, January 1, 2006

Wow, I just installed WP2 and I could not be more impressed. Alison was asking me what is wrong, cause I just whooped in amazement. You won’t see much change on your end, but here where I type in this stuff… man it is SLICK! Hmm, maybe I should put a litle effort into the page design?
Enjoy!

Oh, and happy new year!

Also! comments are back…

I am AJAX Ready

Filed under: Work Related, Web Development — Adeh at 1:47 am on Friday, December 30, 2005

For the backstreet project, I wrote a WP plugin that allows the user to control what shows up on the front page. One of those items was the main graphic, the big pic that sort of sets the tone for the whole front page. The reasoning behind it was so that they could use that space to promote big acts. Of course, they have not used it even once!

Anyway, I have recycled that plugin now for CCIC, and tonight, I decided to update it a little. The idea is that the users can upload as many pictures as they like, as long as they are the right size, and the front page will rotate through the pictures randomly each tome the page reloads.

Since I did backstreet, I have been using Gmail, and I really like how it is able to grab content in the background without me doing anything. So I got to thinking… what if you didn’t have to reload to see a new photo on the front page. How can we use AJAX to reload the images in the bacground, say on a timer.

Well, I have been following the XMLHttpRequest movement very closely, but I had not actually written any code. I decided this was the place to start. And you know what, it was rather anti-climactic. 5 minutes. It literally took 5 minutes to turn the front page into an automatic Javascript based slideshow that works like a charm. Now granted, I already had the infrastructure in place. So the images are already uploaded, there is already a function that returns a random image name. All I had to do was hook that function to a GET level parameter and copy some code from this excellent tutorial. (It is rare when a 1 page tutorial leads you to a point where you can do something useful, but here I am)

To be fair, it really isn’t AJAX, since I am not returning any XML, just a plain string. However, I find this extremely useful, and I think I am going to be using it in other places as well.

So go ahead and check it out http://cameraitacina.net.cn

Dev site up for CCIC

Filed under: Work Related, Web Development — Adeh at 2:56 am on Monday, December 19, 2005

Our current client, Camera di Commercio Italia in Cina, or The China-Italy Chamber of Commerce , or 中国意大利商会 (I like the Italian name best), has set up their new China based hosting -> http://cameraitacina.net.cn.

The site is backed by wordpress with the multingual plugin. I had to fix some bugs and add some additional code, but multilingual was awesome.

The site will be ready in the first week of Jan… until then you can continue to check that site to watch the development progress. Right now the biggest task is continuing to hack multilingual to add support for links, and for site-wide language pref cookies. After that, we need to ensure the member directory is working and looks good. Finally, the site will be a well-designed, informational site with a very rich back-end editing platform. Hope they like it!

Whoah!! All Hail FeedBurner!

Filed under: Web Development — Adeh at 1:28 am on Saturday, December 10, 2005

I just added my feed to feedburner, cause Wordpress was doing funny things to my RSS feed. (ie it was non-existant)

Anyway, http://feeds.feedburner.com/ChinaMusings

Check it out! I’m going public with this thing!

New Site for Lau Reunion

Filed under: Web Development — Adeh at 6:31 pm on Thursday, November 10, 2005

Just uploaded a wikified version of my Mom’s site for the Lau Reunion 2006. If takes the pages my Mom made in Freeway, but puts in the simpleCMS software we use.

It was pretty simple, the only holdup was the awful HTML output by Freeway. Plea for all HTML editing programs: “HELLO, its 2005!” Let’s leave behind the slice/table method for good, OK. If we want to continue to develop the web platform, we have to MOVE. All of us. That means YOU Mr. I love tables!

Java Generics

Filed under: Work Related, Web Development — Adeh at 2:10 pm on Friday, November 4, 2005

I am working right now on bringing my ERP system into the Java1.5 fold. My original impressions are not terribly positive. I like the new for each syntax, that is very handy, but for generics, I feel it is just more typing…

Sorry, bad puns aside, in comparison to C++ templates which I like a lot and find are necessary, there isn’t anything in my java code where I have found that I needed to use generics. Maybe this will change with time.

I guess I have to learn more about it before I start really talking about it. I just refreshed the system today though, with all the underlying structural code converted to java1.5 This doesn’t necessarily mean it uses it in the right way, but I went through and parameretized my SQL code, which was fun. It helped to get rid of a lot of extra code I had in there to catch exceptions and the like.

New Prototype Application

Filed under: Work Related, Web Development — Adeh at 5:40 pm on Tuesday, October 25, 2005

Just uploaded a new demo of an application my Mom thought of. She showed me this shockwave application that allows students to drag unfamiliar words to a “notepad” on the side of the screen and later print them out. She was hoping there was a way to “borrow” this funtionality and use it with her own content for her class. But since it was done as one big, ugly, clunky shockwave (not even Flash) app that took me 5 minutes to download, there was no chance.

Enter Web 2.0. What we used to call DHTML, and now can just call html, has developed to the point where implementing nice interfaces over the web is a snap. In this case, I used the excellent javascript library Script.aculo.us for its Drag and Drop objects. I implemented the same functionality found in that shocking shockwave app in minutes.

I plan to add a bit of php to allow people to upload their own stories and get their own URL. Check out the prototype now:

http://desandies.com/words

Next Page »