Friday, October 19, 2007

My dream Sound Recording System

















The mixer, encoder and a pair of mics above can be purchased ad www.zsounds.com with the above prices.

Monday, October 1, 2007

Lamont Adams' Ten Commandments of Egoless Programming

  1. Accept your mistakes - the important thing is to locate and deal with them in a timely manner.
  2. Do not invest your emotions in your code - this can lead you to taking critiques of your code personally.
  3. Seek out the input of others - programming is a collective effort.
  4. Consult your colleagues before you rewrite a sequence of code. Any such revisions should be part of a team-based review process.
  5. Show deference to those who know less than you about a project. To show impatience reinforces a stereotype of developers as egotistical prima donnas.
  6. Be open to new technological developments - the world of programming changes rapidly, and you need to keep up to date. You should welcome new developments as opportunities to improve your work.
  7. Knowledge is the only real determinant of authority on a software project - you should defer to anyone better informed than you, regardless of their place in the pecking order.
  8. Understand that sometimes your ideas will not be accepted. This is part of the experience of being a team member. Don't make a big deal of it if it turns out later that you were right.
  9. Work in an open, collaborative environment. Those who code alone tend to be less effective than others.
  10. Criticize code rather than programmers. Your critique should be positive in tone and should be for the purpose of improving the code.

Wednesday, September 19, 2007

Weakness on Mac (Finally!)

OK, after sometime getting used to this new OS, I finally found some weakness as compared to Windows or even Linux GUI. First of all the font rendering. Unlike Windows' ClearType font rendering that is sharp, OS-X fonts are blurry, especially from close distance. Some people on the Internet mention that OSX' fonts look better if we see them from a few feet. Hey, I don't want to work with my keyboard a few feet away from my monitor. How about inevitable built-in laptop screen?

The second weakness is its ability to display true color. Turned out it is not 24-bit RGB. This results much less than 2^24 colors as it supposed to be (my Compaq laptop has true millions of colors. I couldn't find any artifacts/washed out colors when playing movies from DVDs). Don't get me wrong, this issue is only seen on Macbook (or Macbook pro) built-in LCD screen. If we hook up to external LCD monitor, that's gonna be different. I have seen the iMac screen, it is much better.

Saturday, September 8, 2007

How fast is Apple Macbook?

My Macbook has Intel Core2 Duo 2.1 GHz. I wrote a small program to do very simple math (trigonometry computation):

#include
#include


int main()
{
double x,y;
long i;

x = 1/3.1415692653;
for(i=0; i<1000000; i++) {
y = i/100000*x;
printf("%lu) sin(%lf) = %lf\n", i, y, sin(y));
}
}

Compile it with:

gcc -mtune=nocona -m64 -msse3 -mfpmath=sse -O3 sin.c -o sin

and execute is as below:

time ./sin

The result is:

real 0m12.345s
user 0m2.624s
sys 0m3.554s

The "real" gives result 12.345 seconds to do 1E6 iterations!, or for each iteration it'd take 12.345E-6 second (12.345 microseconds). Wow!

OS-X is 64-bit Unix

Just to prove that my Macbook is a 64-bit machine, I build the following simple program:

#include

int main()
{
printf("sizeof(long) = %d\n", sizeof(long));
printf("sizeof(double) = %d\n", sizeof(double));
}


Compile it with:

gcc -mtune=nocona -m64 -mfpmath=sse -msse3 -O3 test.c -o test

and execute test. If the size of long is 8 bytes, it's 64-bit!

Sunday, September 2, 2007

Making ipod video files from DVD

Search google for "handbrake", and install it.

Edit/create a new shell script, and paste one of the following:

For low resolution:
HandBrakeCLI -f mp4 -w 320 -l 176 -s 1 -N eng -e x264 -b 700 -2 -d -E ac3 -B 160 -R 48 -T -x "--threads 2" -i /dev/dvd -o $1

For high resolution:

HandBrakeCLI -f mp4 -w 640 -l 368 -s 1 -N eng -e x264 -b 1500 -2 -d -E ac3 -B 160 -R 48 -T -x "--threads 2" -i /dev/dvd -o $1


The /dev/dvd is where the DVD device is located (might be different that this one). While the output file is the only parameter in that script.

Say the script file is named "dvd2ipod". To make a m4v file, we just type:

dvd2ipod , where is replaced with the output file we want to make into. For example, the following is the result after I typed something.

linux-dell:/> dvd2ipod evil_cult.m4v
HandBrake 0.9.1 (2007090200) - http://handbrake.m0k.org/
2 CPUs detected
Opening /dev/dvd...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
Scanning title 1...
+ title 1:
+ vts 1, ttn 1, cells 0->6 (2015335 blocks)
+ duration: 01:43:07
+ size: 720x480, aspect: 1.33, 29.970 fps
+ autocrop: 62/72/8/10
+ chapters:
+ 1: cells 0->0, 14566 blocks, duration 00:00:44
+ 2: cells 1->1, 270120 blocks, duration 00:13:49
+ 3: cells 2->2, 274760 blocks, duration 00:14:03
+ 4: cells 3->3, 330130 blocks, duration 00:16:53
+ 5: cells 4->4, 377811 blocks, duration 00:19:20
+ 6: cells 5->5, 345073 blocks, duration 00:17:39
+ 7: cells 6->6, 402875 blocks, duration 00:20:37
+ audio tracks:
+ 1, Unknown (AC3) (2.0 ch), 48000Hz, 224000bps
+ subtitle tracks:
Applying the following x264 options: --threads 2
Modified x264 options for pass 1 to append turbo options: --threads 2:ref=1:subme=1:me=dia:analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0
x264 [info]: using cpu capabilities: MMX MMXEXT SSE


The HandBrake is an open-source application and supports Mac, Linux and Windows platform and is downloadable at http://handbrake.m0k.org/