Oral Tradition

October 16, 2008 12:34 pm PDT | In Study | 2 Comments | hide

Mark A. Kasevich et al., rf Spectroscopy in an Atomic Fountain:

In the early 1950’s, Zacharias attempted to make a fountain of atoms by directing a thermal atomic beam upwards. [2]

[2] Knowledge of J. R. Zacharias’s work has been passed down in the oral tradition. …

Tags: ,

Convert video to iPod format

August 7, 2008 8:21 pm PDT | In Tech | 1 Comment | hide

Basic command:

ffmpeg -i input.avi -f mp4 -vcodec mpeg4 -b 1000kb \
-acodec aac -ab 192kb output.mp4

A more interesting example: input file is in mkv format with 5.1 aac audio (if you don’t convert 5.1 to 2.0, playing the file crashes your iPod/iPhone).

  • Extract aac audio from the mkv file:
    ffmpeg -i input.mkv -vn -acodec copy audio.aac
  • Downmix 5.1 to 2.0:
    faad -d audio.aac -o audio-2ch.wav
  • Merge and convert to iPod format:
    ffmpeg -i input.mkv -i audio-2ch.wav -map 0.0:0 -map 1.0:1 -f mp4 \
    -vcodec mpeg4 -s 470x320 -b 1000kb -acodec aac -ab 192kb output.mp4
  • The output of the last command gives a little more info of what I am doing here:
    Input #0, matroska, from 'input.mkv':
    Duration: 01:24:42.5, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264, yuv420p, 704x480, 24.39 fps(r)
    Stream #0.1: Audio: aac, 48000 Hz, 5:1
    Input #1, wav, from 'audio-2ch.wav':
    Duration: 01:24:42.5, start: 0.000000, bitrate: 1536 kb/s
    Stream #1.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
    Output #0, mp4, to 'output.mp4':
    Stream #0.0: Video: mpeg4, yuv420p, 470x320, q=2-31, 1000 kb/s, 24.39 fps(c)
    Stream #0.1: Audio: aac, 48000 Hz, stereo, 192 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #1.0 -> #0.1

Video conversion can certainly be way fancier than what I am doing here, and faad is obviously not the best way to downmix audio from 5.1 to 2.0. You can also find quite a few iPod converters but personally I like command line. Anyway, happy converting! (ffmpeg ref)

Tags: , , , , , ,

Google ads in Gmail

August 3, 2008 9:54 am PDT | In Misc | 3 Comments | hide

Google ads are “content-sensitive”. What does that mean?

  • Case 1: My colleague worked overnight, so I sent an email to him in the morning: “Great work, have some good sleep then.”. Gmail popped up a sponsored link: “Sleep Apnea Cure”. Oh come on, my colleague sleeps very well…
  • Case 2: My friend did not show up in a scheduled meeting, and he emailed me: “Sorry I screwed up today….  Could we meet late afternoon tomorrow”. The Google ads beside this email was “Date Hot Stanford Girls!”. ok, ok, I guess Google knows my geolocation, and “screw up” does have another meaning…

Tags: ,

Matlab under Ubuntu

June 27, 2008 10:17 pm PDT | In Tech | 1 Comment | hide

Some tips:

  • Q: Matlab desktop does not show up correctly.
    A: export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/ (requires Sun Java 6 Runtime)
  • Q: Matlab windows disappear in taskbar (Window List applet).
    A: minimizing all windows (show desktop button) seems to bring all windows back into taskbar. Or you can try to export AWT_TOOLKIT=MToolkit
  • Q: Printing in Matlab throws java exception.
    A: Go set all printers > Job Options > Orientation to something other than “Automatic Rotation”.

Links: 1, 2.

Tags: , ,

Ubuntu: upgrade to 8.04

April 26, 2008 1:00 am PDT | In Tech | No Comments | hide

Simply do: do-release-upgrade. Initially Mr. Ubuntu said “A unresolvable problem occurred while calculating the upgrade”. /var/log/dist-upgrade/main.log complained ubuntu-desktop package was f**ked up. After manually removing this package, everything went smoothly. Took about 6 hours.

Tags: , ,

Microsoft Visio save as EPS

February 8, 2008 2:04 pm PST | In Tech | 2 Comments | hide

To convert a Microsoft Visio document to EPS without losing scalable vector format (and without installing 3rd-party software…):

  1. Install Microsoft Save as PDF or XPS Add-in for 2007 Microsoft Office programs (only available for Office 2007?).
  2. Save Visio document as PDF in Visio 2007.
  3. Convert PDF to Postscript (.ps) with pdf2ps utility.
  4. Open .ps file with gsview, and select File -> PS to EPS, be sure to check “Automatically calculate Bounding Box”.

Now you have an EPS file to be embedded into your LaTeX document. Many other converting methods exist, see also Visio and EPS.

Tags: , , , ,

TeraStation does not auto-mount USB disk

January 31, 2008 4:32 pm PST | In Tech | No Comments | hide

Don’t know exactly why TeraStation does not automatically mount my external USB disk, but the fix is to manually fill in the USB disk GUID in /etc/melco/diskinfo. GUID can be obtained from /proc/scsi/usb-storage/*. Related script is possibly /etc/hotplug.d/scsi_device/usb-buffalo.hotplug.

Tags: ,

Convert WordPress database from Latin1 to UTF-8

January 12, 2008 5:39 pm PST | In Tech | 2 Comments | hide

Some early WordPress databases use raw Latin1 encoding to represent UTF-8 characters. The following seems to be an O.K. way to convert those databases to native UTF-8 databases (at least it works for me, Mysql 5.0.45):

  1. Stop/restrict web service.
  2. Dump the database:
    $ mysqldump --default-character-set=latin1 --databases wordpress > m.sql
  3. Change encoding settings in m.sql, including table default encoding and client communication encoding:
    $ replace "CHARSET=latin1" "CHARSET=utf8" \
        "SET NAMES latin1" "SET NAMES utf8" < m.sql > m2.sql
  4. Import the “converted” sql:
    $ mysql < m2.sql
  5. Add the following lines to WordPress wp-config.php
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
  6. Reopen web service. That’s it.

Note: For future convenience, you might as well change the database default encoding to utf8.

Ref to WordPress documentation for details: here and here.

Tags: , , , ,

下一页 »

This weblog is licensed under a Creative Commons License.
Powered by WordPress. Theme based on Pool by Borja Fernandez.