WordPress 2.5 Released
Filed in Web, March 29, 2008, 11:00 am
Finally, this long waited version has been released! I’ll update this blog to the latest version after this post.
Cheers!
You can download WordPress 2.5 here: http://wordpress.org/wordpress-2.5.zip
What A Week …
Filed in Personal, March 28, 2008, 3:37 amI updated this blog to Wordpress 2.5-RC1 two or three days ago, but I found RC3 is already released …
Last weekend was the Easter weekend which was a normal long weekend for me. What I did was the LFS (Linux From Scratch) project. I’d compiled most of the software, but not the kernel …
All this whole week I did at work is figuring out how to call functions in .lib from C#. I already know how to do it manually, but we have a project that is made for this purpose, but I can’t make it work …
Thanks god, today is Friday!
The Fact Is …
Filed in Discovery, March 18, 2008, 11:21 pmI haven’t updated my blog for a long time, no excuses for that. I’m not sure this blog even has a single reader, so if you’re waiting for update for a very long time, I would say I’m really sorry about that. But I’m back now. From now to May 2009 is the last year for me to be an undergraduate student in the University of Waterloo, I’ll keep updating this blog to record something, well, something …
OK, let’s get into what I want to say today.
As you know, or maybe you don’t know, there is a big bad thing going on in Tibet. Many people in the rest of the world don’t know the truth of Tibet problem in China, because some “anti-China” media like to mislead people, I guess. So, if you want to hear some voice from inside of the country, please watch the video:
(Caution: The words in this video clip are defensive and against some other countries.)
Post from BlackBerry
Filed in Personal, January 13, 2008, 12:21 amI’ve gotten this phone for a week already but I hadn’t look at it carefully — too busy to play.
Evil Look
Filed in Discovery, January 4, 2008, 12:13 amI know it’s not new, but I just can’t stop laughing whenever I watch the video.
Baby Gives The Evil Eye - Watch more free videos
Back to Waterloo and Happy New Year
Filed in Personal, January 2, 2008, 4:47 amYesterday was the first day of 2008, I went back to Waterloo. Everyone had a day off so I didn’t count it as the first day of the new year, HOHO.
Happy new year, happy 2008!
Merry Christmas!
Filed in Programming, December 26, 2007, 3:14 pmHey, this is the first christmas for jaux.net, and today is my first boxing day to crash a door. Got nothing but happy holidays :)
Merry Christmas, everyone!
Street Fighter IV
Filed in Game, December 15, 2007, 5:04 am15 years had already passed, but I can still remember the day I was playing Street Fight II when I was in elementary school.
Hot-pot Party Forum Is Up
Filed in Personal, December 14, 2007, 3:50 pmYesterday, we several friends had a wonderful hot-pot party night. We then called ourselves “Hot-pot Party” — such a amazing party name.
We couldn’t get together like last night every night and talk, but it’s not a big problem. We can’t talk face to face, let’s talk virtually.
Here we go, Hot-pot Party!
How To Prevent Creating Objects On Heap
Filed in Programming, December 12, 2007, 3:55 pmYesterday I saw a C++ interview question that was asking the interviewees to prevent the clients from creating objects on heap. That is, you write a class and your class users can’t use new to create an object.
Here is my solution:
class Foo
{
public:
Foo(const Foo& f) {}
static Foo getAnInstance()
{
return Foo();
}
private:
Foo() {}
};
Explanation:
To prevent users from creating objects on heap, I basically can’t give them any public constructors (ctor); therefore, I need to write at least one ctor myself and make it private since if I fail to do so, the compiler will generate a public default ctor for me and that is exactly what I don’t want. Then the user can only use the static member function getAnInstance to get an object to use.
Analysis:
In fact, my solution contradicts the explanation because I actually have a public ctor — the copy ctor. The copy ctor makes the following usage work:
Foo f0 = Foo::getAnInstance();
But because there is a copy ctor, after the user get his/her first object, he/she can do the following:
Foo* f1 = new Foo(f0);
This is saying that my solution can only guarantee the first object is on stack and it can’t go further.
So, my solution fails to solve the question.
p.s. I haven’t really seen the point of the interview question, but it’s interesting to think about ;)
Update:
The correct solution is to overload the new operator and make it private. Credit to DANIWEB