vibol hou

Snippets

Uninstalling MacPorts

Having upgraded to Snow Leopard, I wanted to wipe out my MacPorts installation and start clean. I’ve had tons of stuff installed and updated from the past (three versions of each port, in fact). Here’s how to uninstall MacPorts.
The first step is to uninstall all the installed ports:
1sudo port -f uninstall installed
Then remove any trace [...]

Three steps to uninstalling MySQL on Mac OS X

Here are three simple steps to uninstall the MySQL installation provided by MySQL.com. You should take care with these commands since a typo can obliterate portions of your OS, requiring a reinstall. If you’re comfortable with shell commands and understand what’s being done, here are the commands:
123sudo rm -rf "/usr/local/mysql*"
sudo rm -rf "/Library/StartupItems/MySQLCOM/"
Go to System [...]

How to find total file size in Linux

DOS sums up the sizes of all the files it lists when using the dir command, but Linux ls does not. Here’s an awk script that will calculate that information.
1ls -la [filenames] | awk ‘{ sum += $4 } END { print sum }’
An easier command (thanks Sunny):
1du -hs * –total

Mass renaming files in Linux

1ls -d *.ext | sed ’s/\(.*\).ext$/mv "&" "\1.newext"/’ | sh
Explanation here: Mass renaming with Linux shell

Code folding in VIM 6.0+

Here’s a neat little feature I’ve just been introduced to. After coding in VIM for so many years, one might think I’d know these things, but as it turns out, there’s a lot of features in VIM I’m not using. This one, however, will likely be a time-saver. There are a number of different code [...]

Forcing an SSL Redirect in Apache

If you’ve ever needed to ensure that users are accessing a folder using SSL, you can use the following mod_rewrite snippet to achieve this:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

ExternalInterface, Internet Explorer and Callbacks

Whatever you do, don’t create callbacks named ’stop’ or ‘play’ via:
ExternalInterface.addCallback(“play”, null, thisFunc);
ExternalInterface.addCallback(“stop”, null, thatFunc);
Internet Explorer will choke a most horrible script execution error. Having a broken Internet Explorer script debugger didn’t help much either. Firefox showed no problems with this terminology.

Rebuild RRDTool when upgrading cPanel’s Perl

If you’ve upgraded Perl in cPanel, you need to make sure you’ve got an up-to-date build of rrdtool or stats will not run properly on the server. To do this, run:
/scripts/rrdtoolinstall
If there is no output, you will have to manual edit the file and comment out the version comparison to force the rebuild. You [...]


Audi Driving ExperienceThe Huntington LibrarySan PedroChicagoJulian + YoshiLong Beach Cambodian New Year Parade 2008IchiCSULB Cambodian Student Society Culture Show 2008Paintball 6/27/2009