Sunday, June 20, 2010

Convert audios on Mac

Nowadays, on the Internet, there are really diverse formats of audio files. I often
find the need to convert files from one format to another. For naive users, this
can be a challenging task. But actually it can be a trivial script or set of commands
if you know how to tap the power of all the marvelous open source tools, esp.
mplayer and lame, etc.

These two links show the basic example.
http://www.linuxquestions.org/questions/linux-general-1/converting-m4a-to-mp3-170553/
http://gimpel.gi.funpic.de/wiki/index.php?title=Howto:convert_aac/mp4_to_wav/mp3/ogg_on_Linux

You can also convert other formats, like flash, too, as long as you have all the plugins.
The Mac specific build of MPlayer is here:
http://mplayerosxext.googlecode.com/files/MPlayer-OSX-Extended_rev13.zip

Thursday, January 28, 2010

Misc tricks on Windows Development

Another two trick I discovered recently:

1. How to unlock a file/directory that is locked by a unfriendly process?
On Windows, you cannot delete or rename (move) a file/directory if it is
locked by a process. There is a way to do it (CreateRemoteThread). See
http://social.msdn.microsoft.com/Forums/en-SG/csharpgeneral/thread/9e2044c5-ae5d-4552-a335-01cc567dfc58. But if I want a tool to do it, then,
Unlocker is all you need.

2. How to check memory leak on Windows?
Well, using MSVC runtime, you can use the crtdbg interface. The post is here:
http://msdn.microsoft.com/en-us/library/e5ewb1h3%28VS.80%29.aspx

NTP on Windows

Time is important. Very! Few Windows users really care about
whether there computer clock is right or not. But as an IT professional,
we all know very well that. The time is IMPORTANT.

Recently, I have been annoyed by the fact that my Thunderbird order
my emails wrongly because of my local Windows machine's time is not
correct. Well the time stamp in the email is the client-side's time stamp,
not the server-side one. What can I do? I think I can just ensure that
at least, my machine has the correct time. I know very well how to set up
a NTP client in the *NIX world. But how to do it on Windows? I didn't find
a way from the GUI (Control Panel). So I Google researched a bit.
Below is the excerpt from the Microsoft site:

To configure a client computer for automatic domain time synchronization
  1. Open a Command Prompt.

  2. Type the following command and then press ENTER:

    w32tm /config /syncfromflags:domhier /update

  3. Type the following command and then press ENTER:

    net stop w32time

  4. Type the following command and then press ENTER:

    net start w32time

This way, your Windows machine get the time from the domain controller.
You can also get the time from specified NTP server. Just need to change
to :
w32tm /config /syncfromflags:manual /manualpeerlist:servername /update

I love command line.

Tuesday, November 24, 2009

Bash conditional

I have been always confused by the Bash conditional tests. This link is a great
tutorial.
http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements

Tuesday, October 27, 2009

Running cron in cygwin

I setup my cron job in cygwin today. The correct way to start the cron
daemon is using the /usr/bin/cron-config tool that comes with the cron
package. You can choose to run cron daemon with you own user account
or as a SYSTEM account process. The difference is explained in
/usr/share/doc/Cygwin/cron-VERSION.README. I chose to run cron
as SYSTEM process. This gave me a bit trouble. Because the job spec
I edited is owned by my own user account. The cron daemon process
cannot load a crobtab file with different owner than its process owner.
(Maybe not correct, but once I change my crontab file to be owned by
SYSTEM, it worked). I got this fixed by using the cronevents.exe tool,
which is really really helpful. Also, you might want to cron_diagnose.sh
script to check if various configuration is correct, such as the /var dir's
permission.