Sunday, May 10, 2009

Zen Garden

Find a very beautify personal web page:


http://www.rosefu.net/projects.php



From there, I find the Zen Garden.


http://www.csszengarden.com/?cssfile=194/194.css

Let's share

Yes, there is free lunch in the world.
We plant seeds, they grow into forests, because sunshine, air and water is free.
Share is free, so why not?

Free Online multiplayer game:
Shaiya

Free Online Music:
site1
Free Textbooks
Electronics

Free Online courses:
UC berkeley
MIT Open Courses

Free Online Drama
BBC Radio arts and Drama

Free Site Hosting
Google Site

Free online compilers
Java/Applet
multiple Languages online compiler (C/C++/Java/VB/C#)

Free web design library
Free CSS Navigation memue
embedable photo slider
flash clock
summary at blogbuster
flash game

Free web TV/movie
youtube
hulu
msnTV
abc.com
cbs.com

Free domain name
http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html

Free online dictionary
Learn Chinse

Free Who'is database
The main whois database for the top-level domains ".com", ".net", and ".org" can be searched through any of the following sites:
The InterNIC Whois Search *
Domain registrars -- each with their own whois database
BetterWhois.com
AllWhois.com
SWITCH Whois Gateway
Google - Domain Name Search
Yahoo Whois Directory
The following Whois databases can be searched for information on other areas of the Internet, including Asian, Caribbean, European, and Latin American countries, and the ".mil" and ".gov" domains:
American Registry for Internet Numbers Whois
Asia Pacific IP Address Allocations Whois
European IP Address Allocations Whois
Latin American and Caribbean Internet Addresses Registry
US Military Whois - requires authorization to access
US Government Whois
Matt Power's Whois Servers List provides a long list of searchable world wide whois database servers.

An accurate and informational ip geo location  lookup

On mother's day











Blog Tricks, how to embed flash music in your post in 10 seconds?



Super easy. Just go to any website with embed music
(e.g.http://www.4shared.com/network/search.jsp?searchmode=3&searchExtention=category%3A1)

Select a music, copy the content in the textbox labeled "embed", paste into you Html code.
Done.

Blog Tricks, how to embed music in your post in 10 seconds?


...bug found...audio player removed...

I later find that autostart="false" is ignored by safari.
Not to annoy you (if you are a mac user), I removed the audio player... If you know how to resolve this cross-browser issue, please kindly let me know.


-----------------------------

(For IE users) Super easy, just paste the following code into you Html, change src="whatever your music link", done.

<embed src="http://myblogtalk.com/uploads/billu.mp3" width="144" height="62" type="text/html; charset=UTF-8" autostart="false" loop="false" controls="console"></embed>

Blog Tricks, how to embed youtube in your post in 10 seconds?

It is super easy. On the top-right hand of youtube page, there is a textbox labeled "embed".
Just copy the content in the textbox, paste it into your Html. Done!

Saturday, May 9, 2009

Bridgewater Associates, Inc. interview Questions (software developer).

I recently had a phone interview with Bridgewater Associates, Inc.

They called me at 4:00pm. There are three interviewers. The interview includes 10 minutes on my previous projects, 20 minutes on standard interview questions, 20 minutes about the job position and their team. When asking questions, they like to ask a simple question first, then trace down to the detail untill your head began to spin. They will give hints and lead you to the answer ... then... you know what? they ask a harder aditional question.

The followings are some of the interview questions:
1. If I dip a 10x10x10 Rubik's Cube into red int, how many of the 1000 cells will have red faces.
2. a bad king has a cellar of 1000 bottles of delightful and very expensive wine. a neighbouring queen plots to kill the bad king and sends a servant to poison the wine. (un)fortunately the bad king's guards catch the servant after he has only poisoned one bottle. alas, the guards don't know which bottle but know that the poison is so strong that even if diluted 1,000,000 times it would still kill the king. furthermore, it takes one month to have an effect. the bad king decides he will get some of the prisoners in his vast dungeons to drink the wine. being a clever bad king he knows he needs to murder no more than 10 prisoners - believing he can fob off such a low death rate - and will still be able to drink the rest of the wine at his anniversary party in 5 weeks time.
3. additional question: to increase your chance of living, which prisoner would you want to be?
4. What's the difference between Java and C#?
5. additional question: Why C++ have multi inheritance but Java don't have?
6. What's the difference between interface and abstract methods?
7. additional question: In what conditions you prefer abstract methods instead of interface?
8. additional question: What can interface do but abstract methods can't?
9. Given two arrays A and B. Array A is sorted with n empty elements at the end; while array B has total n unsorted elements. How can you merge A and B into a sorted array.
10. additional question: What's the Big Os of Selection sort, insertion sort, bucket sort?
11. A linked list has a loop in it, how can you find it?
12. additional question: suppose the linked list is super long, how can you find it the loop quickly?
13. Explain left join in sql.
14. Additional question: What's the difference between left join, right join, inner join, outer join and full join?
14. Additional question: How can join effect the query performance?

Cool youtube videos

Reverse Engineer



Stanford CS107
Programming Paradigms (CS107) introduces several programming languages, including C, Assembly, C++, Concurrent Programming, Scheme, and Python. The class aims to teach students how to write code for each of these individual languages and to understand the programming paradigms behind these languages.





Fight Science


Diablo 2 End Cinematic


Starcraft II

Blog Tricks, How to toggle text in your post?

Show   Hide



---------------------------------------------------------------------------
I figured out how to toggle text using inline javascript. Here is the code:


<a href="javascript:var a = document.getElementById('Link1').style.display='block'">Show</a> &nbsp <a href="javascript:var b = document.getElementById('Link1').style.display='none'">Hide</a>

<div id="Link1" style="DISPLAY: none">
Here is the text you would like to show
</div>


Please kindly let me know if you have found other ways of doing this.

Tuesday, May 5, 2009

Windows multi-threading examples

Free Web Counter

Free Counter


These examples are based on the stanford CS107 lecture 15 - lecture 20.

youtube playlist


Since C++ multi-threading library is operation system dependent, the codes listed here are tested on Visual C++ 2008 Express Edition.

Windows Multithreading Helloworld
Several Agents are selling some amount of tickets in parallel, their access to the global parameter numTicketsp are synchronized by a Mutex.
-------------------------------
The following code is tested on Visual C++ 2008 Express Edition.
Show Code   Hide Code
--------------------------------


Simple Semaphor Example
A simple network server :
writer() grab data from network connection, then write characters to buffer, at the mean-time reader() constantly read character from the same buffer.
Two semaphors "emptyBuffer" and "fullBuffer" are used here to make sure reader() and writer() won't step onto each other.

-------------------------------
The following code is tested on Visual C++ 2008 Express Edition.
Show Code   Hide Code
--------------------------------



A little bit advanced Semaphor Example

Classic Five philosophers problem:
There are 5 philosophers who sit around a table. There is a folk between each neighboring philosopher. Each philosopher must grab two folks to be able to eat. Once a philosopher finished eating, he will put the forks back and waiting for the next chance to eat. The objective is to write a multi-threading program to simulate the situation.

The trick is -- suppose each philosopher is holding a folk at his/her left hand, and waiting for the philosopher at his right hand side to give up a fork. The philosopher at the right hand will not gonna to give up his fork, because he/she is also waiting for a fork from the right side...A dead-lock condition is thus created, nobody will be able to eat and they will be waiting forever.

To resolve the dead-lock, we only allow at most 4 philosophers to grab forks at any given moment, the rest philosophers have to wait.

The pseudocode is as follows:

Semaphore forks[]={1,1,1,1,1};
Semaphore numAllowedToEat(4);
void philosophor(int id)
{
for(int i=0; i<3; i++){
think();
SW(umAllowedToEat);
SW(forks[id]);
SW(forks[(id+1)%5]);
eat();
SS(forks[id]);
SS(forks[(id+1)%5]);
SS(numAllowedToEat);
}
-------------------------------
The following code is tested on Visual C++ 2008 Express Edition.
Show Code   Hide Code
--------------------------------

MarketAxess

MarketAxess: The Leader in e-Trading for Global Fixed Income MarketAxess Holdings Inc. (MarketAxess) is an international financial technol...