My Blog « Tonny Xu
...Life is like a box of chocolates,
you never know what you’re gonna get...
» My Blog «

How does this feel?
-> Not so bad.

What if I need a picture?
-> It’s too weak! I need the basic picture manipulation functions. Like position and size.

Category?
-> Damn it! Flock blogging does not support category! Unbelievable!
-> Oh, sorry, it does support category but not so obviously.

Comments

How does this feel?
-> Not so bad.

What if I need a picture?
-> It’s too weak! I need the basic picture manipulation functions. Like position and size.

Category?
-> Damn it! Flock blogging does not support category! Unbelievable!

Comments

 

The Carbon Economy

(View high quality video on YouTube)

It’s time for real

Hellmann’s – It’s Time for Real from CRUSH on Vimeo.

The State of The Internet

JESS3 / The State of The Internet from Jesse Thomas on Vimeo.

Comments

Higly recommend every developer to use Gist to share the snippets.

It’s really great!

Comments

Fine, this topic has been talked many many times, and you can find a lot of great answers over the internet. Stackoverflow.com listed a lot of answers. And also, you can find great approach from Joshua Bloch’s Effective Java also pointed out 2 effective approaches. What’s more, Joshua Bloch also provided an enum approach(Page 31) as the best practice for Serializable Singleton. If you like Wikipedia, you can also find a Java solution for Singleton, and for deep background knowledge behind this approach, please read “Double check locking” and “Java 5 memory management” by Bill Pugh.

If you are as lazy as me, just remember the following implementation, which is thread safe and can be used on all the java version. The key point in this implementation is using Java atomic class load mechanism to guarantee the thread safe and using static method to implement lazy initialization.

If you also have some curious on the other implementations, please keep reading.

  1. The simplest implementation(Immutable class, thread safe, but no lazy initialization)
  2. The double check locking implementation(Thread safe, lazy initialization, but requires Java 5+)
  3. The enum implementation(Thread safe, Serializable, also requires Java 5+)

After reading all of these, I don’t think you need any other implementations, but to understand why and how these implementations work, you need read something more[Typically those links I provided at the beginning]. There are things called Google and Bing on the earth, I guess you can find the answer very soon.

Comments

I saw an interview question.

Write a function to reverse a string.

It’s a simple question, Hmm? But not so simple.

In Java, StringBuilder class provided a convenient method to reverse the characters it holds, and in C#, we have a static method Array.reverse() to help us. Also, we can write it by ourselves(it’s not a big deal, right?).

OK, let’s take a look at how we can do this.

It’s simple. Hmm? We turn the string into char array, and swap the array element. It’s done.

If we use the API provided by .NET Framework, it will be much more simple.

These 2 approaches are all right, and we can reverse an alphabet string and also, we can reverse an Unicode string like “私は中国人です。”. But if we need to reverse 10,000 strings and each string was 10,000 characters long, which one could be faster?

Read the rest of this entry »

Comments

Since Visual Studio 2008 still does not provide a colorful editor for Visual C++, I decided to find some solution. I’m lucky, I found Visual Assist X very quickly. This is a highly recommended plug-in for C/C++ developers on Windows platform. I even suspicious that Microsoft and Whole Tomato(The company created Visual Assist) had a agreement that Microsoft will not develop any powerful editor for Visual C++ developers. Why? cause you can find out the C# editor is providing some basic functions that Visual C++ editor does not have.

Look at this.

Microsoft Visual Studio Industry Partner

 

Any way, this a great tool, and it is a must-have plug-in for Visual C++. [Get a copy and take a trial] of Visual Assist X and take a look these wonderful features.

Take a tour of Visual Assist X

Comments

Recently, I started a new open source project for practicing C++ and Windows Programming. I chose google to host my project. Now I think I made the right choice.

Google Code is great! Especially, it integrates a wiki-style document authoring tool. That is fantastic! I really like it. Before I started to use google code wiki page, I had tried to learn these syntaxes on Wikipedia.com, but I failed, I thought those mark up language was too difficult to remember. I was wrong. It’s not those mark-up’s fault, it’s wiki who did not provided a clear tutorial to new users. On the other hand, google dose provided an easy way to understand these mark-ups. That’s a short sample code within the edition box. That really helps!

I will try much more about wiki style from now on.

Comments

I got it today. Why I missed this when I read the HTTP RFC document 5 years ago? Maybe I just ignored this part. Shit!

Here, please view Bill Venners article written in 2006 when he interviewed Elliotte Rusty Harold.

Here, to see what Elliotte Rusty Harold said about REST.

And here to see what is REST on wikipedia.

One thing to remember, there are 4 HTTP verbs, GET, POST, PUT, DELETE, not just 2. Someone killed the other 2 we don’t familiar with.

Comments

I designed this new version, and it’s still under developing and tuning.

[Updates: 2010/02/03] Implement the "Recent Posts", and "Random Posts" feature.

[Updates: 2010/02/04] Updated “About” and “Contact” page.

Comments