Andy Li's Blog

23/02/2009

The right way to work with a web service

Filed under: Uncategorized — Tags: — Andy @ 12:51 am

Mash-up is certainly a big feature of web 2.0. It make use of different open web services to create creative apps, or even artworks. But creative is creative, “hacking” open APIs with some way might not be so appropriate.

Let say here is a blogging API

The API lets people write and read blogs in the server. For security reason, the web service do not allow HTML appears in the post content. Certainly, as a user, we hate this feature since plain text is boring and a text-only blog is likely nobody would like to read. So, developers (and even bloggers) will try their best to create some workarounds.

One developer thinks that he might encode the blog content in his software before sending to the web service, so the server will not recognize the HTML stuff and store the whole content. When retrieving back, the content is decoded before showing up to the users.

What’s wrong?

Firstly, the security problem that “patched” by filtering out HTML is come back again, like we are back to the starting point. Secondly, since the API is open, that means there are other software/programs that will make use of the API, and they all do not know the decoding method used by the developer. So, the end users of that developer’s software will be likely blogging encoded posts that no one can read without using the same software. Thirdly, this may break the terms of use of the API.

There is no hope in that case?

If you want HTML, no, there is no hope. But you might still implement other methods to work with the API.

For example, Twitter is very similar to this case, mirco blogging with plain text, but there is TwitPic, which store the picture in other server and insert the link of the picture to the tweet. Users of TwitPic is certainly seeing their picture displayed beautifully. And the normal Twitter users can still see the picture by clicking on the links. The idea is similar to “graceful degrading”.

16/02/2009

Some research on JavaScript benchmark

Filed under: Uncategorized — Tags: , — Andy @ 2:02 pm

Since I am going to make a benchmark for ActionScript performance across different browser/platform, I take a look into the JavaScript benchmark to see if I can simply port one to be used in ActionScript.

The most famous ones should be Apple’s SunSpider, Google’s V8 Benchmark Suite, Mozilla’s Dromaeo. All the benchmarks are compose of several test areas, basically including some basic JavaScript operation test like Array manipulations, some more practical based test like regular expression, ray-tracing etc.

V8 Benchmark Suite consist 6 tests which has the least tests among the three. But when I take a look into the source code, the testes are very long. It even overrides Math.random() to a seeded random generator.

SunSpider’s structure seems to be more simple and the tests inside are more easy to read (although less documented compares to V8’s). I think it should be not that hard to port to AS.

I still do not have time to look into Dromaeo’s source but it has quite a lot of tests. And some of the tests includes DOM and use of library like jQuery and Prototype, which is not quite appropriate to be ported.

My target should be porting SunSpider. But there is still some things to be considered like whether to use AS’s build-in library, coverage of Graphic manipulation etc. More researchs are needed ;-) .

13/02/2009

Happy Valentine’s day!

Filed under: Uncategorized — Andy @ 11:46 pm
Valentine's day chocolate

Chocolate made by Ca

Kiss

Ca and I

This is the third Valentine’s Day for us!

Wish every couple a happy Valentine’s Day!

Older Posts »

Powered by WordPress