by Michael Zhang on March 6, 2010

I think social networks and other “social” services need to move away from the word “like” for sharing information. Often the word is used to indicate popularity of a certain thing… RSS feed stories in Google Reader, news stream items in Facebook.
However, the meaning behind “like” and the intention of sharing an item or showing that you think it’s important often don’t overlap. For example, check out the above story in my news feed just now. It’s about a couple in Korea who starved their child to death because they were obsessed with a game. Why would you “like” that story? Of course there’s always a “share” option for passing on this item to your own network, but that’s a bit different.
Facebook is the same. They only offer a “like” or “share”. If someone posts a really tragic story, you can either “like” it, or republish it to your own stream. If someone posts a really sad personal or news item, there’s no way to indicate “I support you”, or “I think this is important”.
Digg is a little better, in that the word “digg” is a little less meaningful, and a lot more in line with what it means. Reddit’s up and down voting system is even better in this regard.
by Michael Zhang on March 5, 2010
Delicious was once a poster child of Web 2.0, being one of the first web services to embrace concepts like tagging (aka folksonomy). Then Yahoo bought it, and it’s almost as if Delicious decided to race Yahoo downhill to see who could die faster.
They had a redesign and upgrade recently, but it’s becoming more and more clear that the service is going nowhere. I feel like a few good engineers could really turn the ship around in big ways, but there’s just nothing going on.
Aside from the fact that they lack even simple filters for browsing recent bookmarks (how about filtering by age or number of bookmarks?), here’s one of the usability fails that has been bugging me recently:

When browsing recent bookmarks, you can change the display style of the bookmarks, including how much information is shown with each one. When you switch over to the popular page for that same tag, the link to change the display format disappears while everything says exactly the same!
If a page is affect by a certain control, then that control should appear on the page. That should be expected right? Why should I have to switch to “recent bookmarks” in order to change the view on “popular bookmarks”.
What’s funny is that the space is still there. Nothing took its place. It’s simply gone.
by Michael Zhang on February 27, 2010
Recently, for a small school project, I pointed one of my domain names away from a server I lease and towards my Rackspace Cloud Sites account. The transition went pretty smoothly.
However, today I was trying to do a GET request using Curl on a specific page. The code was something like the following:
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://domain.com/page.php");
curl_setopt($c, CURLOPT_TIMEOUT, 5);
curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
$cr = curl_exec($c);
Instead of getting the page back, I received the following response:
Service Temporarily Unavailable
The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.
Any Curl request directed at the domain name would return 503, while the same request on any other domain name worked fine. After a good amount of time trying to figure out what was wrong, Googling the issue, and talking to tech support, the support technician asked me to try the IP address directly.
I tried pinging the domain name from my server, and suddenly realized that it was trying to ping itself. Turns out the server thought the domain name was still on the server, and was therefore calling the GET requests on itself.
Doh!
by Michael Zhang on February 26, 2010

If you need to quickly graph some data you have, did you know you can graph it using only HTML and PHP?
I was doing some research for my master’s thesis today and needed to create some flexible graphs of various things. The screenshot above is of a graph using tables and divs.
The trick is to use vertical-align: bottom in each table cell, which contain divs. Each div is an individual bar in the graph. Simply give the divs a background color, and set the heights depending on your data!
by Michael Zhang on February 12, 2010
Check it out! Rounded borders!
Rounded borders are built into CSS3, and the latest browsers all take advantage of it. Here’s the CSS to round your borders:
-moz-border-radius-bottomleft: 10px;
-moz-border-radius-bottomright: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
-webkit-border-bottom-left-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz is used by Firefox and -webkit is used by Safari.
by Michael Zhang on February 12, 2010
Was experiencing high load and slow performance on my server today, and was trying to pinpoint the cause. Memory was fine, but MySQL was clogging up, but not due to anything performing incorrectly. I took a look at server-status, and noticed that most of the workers were serving the same 2 IP addresses: 88.131.106.30 and 88.131.106.32.
I decided to ban them using iptables, like so:
iptables -A INPUT -s 88.131.106.30 -j DROP
iptables -A INPUT -s 88.131.106.32 -j DROP
You can use iptables -L to view the current rules. Read more about iptables here. A few seconds later, the server cleared up and there were actually only a few workers serving real people.
by Michael Zhang on February 11, 2010
Discovered today that I was getting the wrong id back when trying to do insert_id() on a MySQL connection that previously ran a INSERT… ON DUPLICATE KEY UPDATE…. The problem is that ordinarily on inserts, LAST_INSERT_ID() returns the auto_increment value that was used in the insert. However, when the query updates instead because a key already exists, the LAST_INSERT_ID value isn’t meaningful, and a subsequent call to insert_id() on the connection will not return the correct ID that was updated.
The fix is to pass in the ID it needs to return in the update, in the following form:
INSERT … ON DUPLICATE KEY UPDATE id = LAST_INSERT_ID(id) …
This will cause a subsequent call to insert_id() to return the id of the row that was updated.
by Michael Zhang on January 25, 2010
If you use a Mac, you might have run into problems when trying to view images of patents filed with the US Patent Office. The images are in TIFF format, and might not load properly in the browsers you’re using.
For me, I had a Quicktime logo flash for a couple seconds, before disappearing, leaving only a white screen. After searching for quite some time, I found pat2pdf, a free web application that allows you to download patents as PDF documents.
It actually works quite well, and is much easier than the downloadable apps that help you turn patents into PDFs.
pat2pdf
by Michael Zhang on January 10, 2010
I’m going to be compiling a list of software that I’ve come across that helps to protect your computer against viruses and malware, as well as finding and fixing problems after they’ve occurred. I’ll be updating the list over time as I find and learn more:
by Michael Zhang on January 4, 2010
Twitter has a serious flaw in its user interface, and I’m surprised it hasn’t been fixed yet given how popular the service is. The “block” link in the right hand column of user pages has undergone a number of changes in the past months:

Notice how the link appears immediately under the “message” link for sending direct messages. Now, users probably rarely block their followers, but might direct message their followers very often. A mouse slip of about 10-20 pixels might cause the user to accidentally click “block” instead of “message”.
This wouldn’t be that bad of a problem, but Twitter has dropped all confirmation steps from the blocking process. This means that if you accidentally click “block” on a follower, you will instantly break the follows between you and that user (both ways), and that user will be added to your block list. If it was an accident, there’s no way you can cause the user to re-follow you. That user must do so themselves.
Previously Twitter brought you to a whole new confirmation page to ensure that you indeed wanted to block that particular user. That then changed to a Javascript popup, which was still acceptable. However, this no-confirmation style is a huge mistake, and a simple search of the terms “message block” will return tweets of users who accidentally blocked their friends.
Cmon Twitter.