Thursday, October 24, 2013

Free GUI Applications for LaTeX (WYSIWYM)?

For those who do not want to memorize syntax and commands, a few applications with GUI can produce LaTeX documents,

Among the above, only LyX is free with a GPL license. Wikipedia has a comparison page for TeX editor.  

Wednesday, October 23, 2013

Remove Old Linux Kernel Images in Ubuntu from Command Line

As you upgrade your Ubuntu Linux, the number of different versions of Linux kernel images grow. The Linux kernel images can occupy quite some disk space. Your /boot file system may be short of space for future upgrades of Linux kernels. It may look for a method to remove the old Linux kernel images. The following discussion suggests that we remove old kernel images using "Synaptic Package Manager",

However, it requires a graphical user interface. I am more interested in removing the old Linux kernel images using command line tools only, as sometimes, I simply do not have the luxury of running a GUI. However, the discussion above indeed a good guide. I simply follow the steps below,

  1. Find the versions of Linux kernel images and their packages.

    You may first list the content of the /boot directory, which gives you an idea what kernel images are installed. Then you can use dpkg to find out the package names. Here is an example,
    userfoo@ubuntu:~$ dpkg -l | grep linux | grep 3.0
    ii linux-image-3.0.0-12-generic 3.0.0-12.20 i386 Linux kernel image for version 3.0.0 on x86/x86_64

    In the above, I am looking for "3.0" because I figured from listing the content of the /boot directory that I have a Linux image of version of 3.0.0 installed. The above tells me that the corresponding package of the Linux image is "linux-image-3.0.0-12-generic".
  2. Remove the Linux image package.

    I remove the above Linux image package using apt-get.
    userfoo@ubuntu:~$ sudo apt-get remove linux-image-3.0.0-12-generic
Repeat the above steps for other versions of old Linux images. Typically, as suggested by many other people, you want to keep at least one or two old Linux image to fall back on in case there is an issue with your newest Linux kernel image.

Similar method can be applied to CentOS and Fedora Linux. You can accomplish it using yum alone.

Monday, October 21, 2013

Mounting a Windows Share from Windows 7 in Linux: Mount Error(12): Cannot Allocate Memory

I wanted to mount a network share from a Windows 7 host in Fedora Linux. I encountered a problem below,

[user@fedora]$ sudo mount -t cifs -o username=my-windows-7-username,uid=my-linux-user-name,rw  //windows7host/path-to-network-share /directory-to-mount
[sudo] password for user:
Password for my-windows-7-username@//windows7host/path-to-networshare: ********
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

A few web searches produced quite a few hits. Most suggest to change "IRPStackSiz"; however, that is not for Windows 7 host. The correct answer is from the "archlinux" site that has a page,
which explicitly states "Note: Googling will reveal another tweak recommending users to add a key modifying the "IRPStackSize" size. This is incorrect for fixing this issue under Windows 7. Do not attempt it." Kudos to that!

For the impatient, run the following as administrator in Windows 7,
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f

reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "Size" /t REG_DWORD /d 3 /f
Then reboot the Windows 7 host.

Sunday, October 20, 2013

The Windows.old Folder

After I upgraded Windows 8 to Windows 8.1, I found a Windows.old folder that occupied more than 1 GB disk space.

Here is what Microsoft says about the folder,

Wednesday, October 9, 2013

Massively Open Online Courses

This just serves as a bookmark for the leading websites offering Massively Open Online Courses (MOOCs). I found many good computing courses.


Sunday, October 6, 2013

Join Multiple Video Files

I wanted to join a few .mp4 video files together on a Linux host using free software.With my limited experience with avconv (and ffmpeg) and some web search, I attempted to join the .mp4 files using the following command,
avconv -i concat:1.mp4\|2.mp4\|3.mp4 all.mp4
Unfortunately, the above command did not produce the expected result. It threw an exception and stopped at the end of the first .mp4 file, which was also observed by a few frustrated users, e.g.,

The reason turns out to be that the concatenation operation cannot be performed on .mp4 file, which is also suggested in the answer to the last of the three examples above.

The solution to the problem is in fact included in the FAQ of libav and that of ffmpeg, which is suggested by a stackoverflow post and answer.  Below is how I actually got it done,
avconv -i 1.mp4 1.mpeg
avconv -i 2.mp4 2.mpeg
avconv -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | avconv -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
ffmpeg -i 1.mp4 1.mpeg
ffmpeg -i 2.mp4 2.mpeg
ffmpeg -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | ffmpeg -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
This solution is also suggested by a few posts, such as, this one, this one.

If you observe quality degradation in the resulting video, you may add the "-qscale" option, such as,
avconv -i 1.mp4 -qscale 1 1.mpeg
where the value of qscale is between 1 and 0 with 1 being the highest quality (also the largest file) and 0 being the lowest quality (also the smallest file).

Note that many web posts, when discussing the tools, refer the "sameq" option, which apparently not supported any more, as discussed here.

By the way, when I was looking for a solution to the "join-mp4-vidoe" problem, I happened to come across a post on the history of libav and ffmpeg that I enjoyed reading and that answers my question, "why are there two almost identical but different libraries and tools, libav and ffmpeg?"