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!

new MAC!!!!

Filed under: Work Related, Well, alright — Adeh at 2:45 pm on Monday, April 3, 2006

I just received a new 1.83Ghz Macbook Pro from my new empoloyer. I am in HK right now, and this is soooo nice. I’m still in the store, writing this about 2 minutes after opening.

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.

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!

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

drdesandies.com - REDUX

Filed under: Work Related, Web Development — Adeh at 7:00 pm on Tuesday, September 6, 2005

Redesigned, or I should say designed drdesandies.com is up today. Basically just added a few images and a contact form, and we are ready to go. The CSS is quite a bit more complicated now, but by using png-8 for all the images, the size of the site is still crazy small.

Launched DrDeSandies.com [beta]

Filed under: Work Related, Web Development — Adeh at 1:36 am on Thursday, September 1, 2005

Launched preliminary version of drdesandies.com. This is a small site for My father’s private therapy. It is designed for simplicity, creating a quite striking and attractive design with about 10 lines of XHTML and 20 lines of CSS. The content is handled by our simpleCMS, so the actual new code is less than 40 lines. We have to add some images though, mainly a the title text as an image, and an image of the principle.

Backstreet update

Filed under: Work Related, Web Development — Adeh at 4:27 pm on Tuesday, August 16, 2005

We released the new front page of backstreet last week, it is backed by a new Wordpress plugin we wrote. WP is a great piece of software. Craeting the plugin was a snap, and allowing the client to have a unified inferface to update all the content in the site is very helpful.

The design is a berak for the original. The problem was that although the previous design was “pretty” it did not have enough space for up-to-the-date info. So we let it go a little bit in terms of style, and we make it up by giving more space to the bar to advertise it’s acts and events. This is the whole form vs. function debate. And in this case, I think we made a good compromise.

Next Page »