Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Monday, December 1, 2014

To find the files which appear in both file lists

This problem is always encountered in file processing, but in linux, the solution is really simple.

Firstly, sort the file lists

sort file_list_1 > sorted_list_1
sort file_list_2 > sorted_list_2

Then

comm -12 sorted_list_1 sorted_list_2


According  to the help page of comm, what the operation is doing:

Usage: comm [OPTION]... FILE1 FILE2
Compare sorted files FILE1 and FILE2 line by line.

With no options, produce three-column output.  Column one contains
lines unique to FILE1, column two contains lines unique to FILE2,
and column three contains lines common to both files.

  -1              suppress column 1 (lines unique to FILE1)
  -2              suppress column 2 (lines unique to FILE2)
  -3              suppress column 3 (lines that appear in both files)

...

Wonderful.



Monday, November 17, 2014

On running legacy audio driver (oss) on Fedora 20 (for running wavesurfer with alsa-oss)

wavesurfer  (http://www.speech.kth.se/wavesurfer/) is a popular tool for speech scientists to perform speech analysis. However, it uses the old OSS driver for sound output.

Although there is alsa-oss for compatibility, alsa-oss has been obsoleted since Fedora 20 due to no maintainer.

Therefore, in order to make wavesurfer work again, at least play sound, we need to compile alsa-oss by ourselves.

Firstly install the necessary libraries. Since wavesurfer is 32-bit software, we also install the 32-bit version of the libraries.

sudo yum install  alsa-lib-devel
sudo yum install  alsa-lib-devel.i686

sudo yum install alsa-plugin-pulseaudio.i686
sudo yum install alsa-plugin-pulseaudio


Download alsa-oss from
http://www.alsa-project.org/main/index.php/Download

and compiles

sudo ./configure
sudo make
sudo make install

And runs wavesurfer like this
aoss wavesurfer

Saturday, September 6, 2014

Installing the HTK Speech Recognition toolkit on 64-bit Ubuntu

When installing the HTK Speech Recognition toolkit on 64-bit Ubuntu, the following packages are needed.

sudo apt-get install libc6-dev-i386

sudo apt-get install libx11-dev:i386 libx11-dev


Then, just go
./configure
make all
sudo make install

Sunday, August 31, 2014

Solution to "Cannot display Asian (Chinese, Japanese, Korean) characters in Google Chrome title bar, address bar and tabs 解決 Google Chrome 用戶介面無法顯示中文問題

Works on Ubuntu 14.04
  1. Go to /etc/fonts/conf.d
  2. Remove any of the *.conf entries for the Google Droid font (in my case 65-droid-sans-fallback.conf  65-droid-sans-fonts.conf)
    mv /etc/fonts/conf.d/65-droid-sans-fallback.conf  /etc/fonts/conf.d/65-droid-sans-fallback.conf.oldmv /etc/fonts/conf.d/65-droid-sans-fonts.conf /etc/fonts/conf.d/65-droid-sans-fallback.conf.old
  3. Update fontconfig fc-cache -f -r
Reference


Friday, August 29, 2014

To copy everything (including soft and hard symbolic links) with rsync, from remote host to local host, with linux

To copy everything (including soft and hard symbolic links) with rsync, from remote host to local host, with Linux

rsync -azHv user@remotehost:/some/path/to/folder /some/local/destination

a -- include soft symbolic link
H -- include hard symbolic link
v -- verbose
z -- compression

Wednesday, June 4, 2014

Secure Copy (scp) from remote site to local host

To copy file foo.txt from remote host to localhost during ssh session:

scp foo.txt username@ip_address:/some/remote/directory

Monday, May 19, 2014

No dropbox after upgrading Ubuntu 14.04 LTS with KDE desktop?

1. Uninstall "nautilus-dropbox"

sudo apt-get remove nautilus-dropbox


2. Install the latest dropbox client from dropbox's page
https://www.dropbox.com/install?os=lnx

Sunday, October 20, 2013

VMware player: To change NAT settings for remote desktop to windows client

This works in Ubuntu 13.10

1. Suspend all virtual machines
2. Edit /etc/vmware/vmnet8/nat/nat.conf
sudo nano /etc/vmware/vmnet8/nat/nat.conf 

For remote desktop in windows,
run ipconfig to check the ip address in address

ipconfig

It should start at 172.16.*.*

Then add the line

3389=172.16.*.*:3389 

under the section
 [incomingtcp]

where *.* is the ip address of your windows box

3. Restart vmware-player
sudo /etc/init.d/vmware restart



Sunday, July 21, 2013

VMware player: compile the kernel module after kernel update for Ubuntu Linux

This works for VMware player >5.0

After the kernel update, run this on a console.
(You need the latest kernel header files. Also update them when you update. )

sudo vmware-modconfig --console --install-all 

It works on Ubuntu 13.04

Tuesday, May 7, 2013

Color Picker Tool for Ubuntu Linux

The package "gcolor2" does.

sudo apt-get install gcolor2

Works on 12.04

Monday, April 1, 2013

To convert an image in pdf format to jpeg format


In Linux, one may use Ghostscript

gs -sDEVICE=jpeg -o Task1v2.jpg -r300x300 -dJPEGQ=95 Task1v2.pdf
In this example,
resolution=300dpi
Quality=95%

Sunday, July 1, 2012

Leap second causing ksoftirqd and Java eat up a lot of cpu rescources in CentOS 6

A leap second is added on 1 July 2012 UTC+0.

I found that ksoftirqd and MATLAB in my machines comsume extremely high CPU load even they were idle.

The affected machines all run on Centos 6 and 6.2.

The solution is simple, just run:
# date -s "`date`"

on the affected machine and they got back normal.

Reference:
http://marc.info/?l=linux-kernel&m=134113389621450&w=2 


Updates:


When I read the system log, the kenrel indeed acknowledge the occurrence of lead second.


I think the problem is from Java, which Matlab runs on it.

Thursday, February 9, 2012

Solving "error while loading shared libraries" in Linux

For some newly compiled and installed programs in Linux, when they are executed for first time, the following error comes out

"error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory"
It happens in my Ubunutu Linux 11.10 box.

The solution is pretty simple.
1.)  Edit  /etc/ld.so.conf


sudo nano /etc/ld.so.conf


2.)  Add the path of the *.so, usually custom libraries are installed in  "/usr/local/lib", so adding this line can solve most of the problems.

3.) Save (of course) and execute

sudo /sbin/ldconfig –v

The problem is then solved.




Tuesday, April 26, 2011

重建 Ubuntu 默認的panel

一時錯手把 ubuntu desktop 頂的panel 給delete 掉, 但不用怕, 只需三句指令就可以把它重建

打開一個terminal


gconftool-2 --shutdown
rm -rf ~/.gconf/apps/panel
pkill gnome-panel

Sunday, April 19, 2009

Installing Ubuntu 9.04 into ASUS eeepc 901 在eeepc 901 安裝Ubuntu 9.04

Sorry that I am in hurry so I type up in English here. I will provide the Chinese version later.

Now I am installing the Ubuntu 9.04 beta into my eeepc 901. It looks that the hardware works fine out of box for 9.04 in live CD session. The WLAN works, the bluetooth is detected, the sound is detected and can play. The hotkeys for adjusting the brightness of the screen and the audio volume also work. The web-cam works in Skype.

For the front-mic, it works in skype, but fails in sound recording. The recorded sound is flipped in sound recording. Updated: It is due to a bug in default ogg format of sound recording. When I change it to .wav, everything is fine.


I boot up the eeepc with the CD image loaded in a USB thumb drive. See my previous post for instruction. The response of the operations is fast.

*****
The default installation does not contain Adobe Flash Player, but it can be installed by downloading the package in Adobe's site and restart the machine.

I have also run the ubuntueeetweak (http://code.google.com/p/eeescripts/) to install the OSD display and make the font smaller. (Although the original font size is indeed OK for 8.9" display. :-) )

Finally I also installed the eee-control (http://greg.geekmind.org/eee-control/) and now the eeepc is nearly perfect.

整個安裝過程很暢順,在光碟iso 檔放進usb 手指後(post),可以順利進入live CD, 並用wifi上網,選擇install 後約15分鐘後已完成安裝。

硬體支援良好,安裝完後已經立刻可用內置mic 和cam, wifi和bluetooth都沒有問題。

預設並沒有安裝Adobe Flash Player, 不過可以在Adobe 的網站下載.deb 的package.

之後我再安裝了ubuntueeetweak (http://code.google.com/p/eeescripts/) 和 eee-control (http://greg.geekmind.org/eee-control/),部eeepc 差不多完美了。

Update: Battery Life of EEEPC 901 in Ubuntu 9.04

I have been using eeepc 901 in Ubuntu Linux 9,04 for over 1 month. I am quite satisfied with the performance of the machine. The overall battery life is 7.5 hours, which is very sufficient for my diary work.

Wednesday, December 24, 2008

除了Windows xp 還有Ubuntu eee Easy Peasy

如果覺得eee pc 的 內置LINUX 比較簡單一點,除了安裝WINDOWS XP 外,ubuntu linux 也是一個好選擇。

暫時見到兩個專為EEE PC 而設的 ubuntu linux,Ubuntu eee 是其中一個,最新版本建基於8.04 8.10版



網址: www.ubuntu-eee.com


網址: http://www.geteasypeasy.com/

要安裝Easy Peasy最方便的方法就是用USB 碟安裝
參考:http://www.ubuntu-eee.com/wiki/index.php5?title=Get_Easy_Peasy
1)首先預備一隻1GB 以上的USB 手指
2)之後當然是在網站下載Easy Peasy的CD IMAGE
3) 再用unetbootin把CD image 寫入手指 (下載)

4)再用usb 手指boot起eeepc
5)進入LIVE CD MODE, 可以先試用或者直接INSTALL

注意事項: 如果EEEPC是用SSD,硬碟格式要選EXT2, 並且不要有SWAP SPACE
參考:https://help.ubuntu.com/community/EeePC/Installation

Wednesday, October 22, 2008

在Linux 下安裝 Canon LBP 3050 鐳射打印機 Laser Printer

Canon的LBP3050 可以在linux用的。
最近買了Canon的LBP3050 鐳射打印機,這部打印機不是用Postscript 作為打印語言,而是用Canon 自己的CAPT。以為不能在LINUX 安裝,但也辜且在GOOGLE找找。最後發現Canon也算待LINUX不錯,也有放LINUX CUPS的驅動出來。

LINUX的CAPT驅動下載: CAPT Printer Driver for Linux Ver1.70
雖然網站是日文,但捲到最底 有兩個RPM或DEB可以下載
把它們都下載下來,並而安裝
我是用Ubuntu 8.04,double click 已經可以安裝好了
之後選system->Administration->Printing
1.選New printer
2.Device URI 選PRINTER 連接的位置
3.下一頁選Canon
4.型號選Canon LBP3310 CAPT (UK)
5.跟著設定就可以了

Monday, October 6, 2008

eeepc 下的remote desktop

其實eeepc是內置有remote desktop , 可以連接windows xp.

首先crtl+alt+T, 打開terminal
輸入 rdesktop , 可以是ip, domain name, etc, 和一般remote desktop 一樣
你的windows desktop 就會出現等你輸入password
預備的resolution 是800x600, 假如加 -f 就會全瑩幕, 但全瑩幕返linux desktop 要按windows 內的中斷連線, 很麻煩, 可以用 -g 90%, 會出現一個是你eeepc 個screen 90%的windows, 這可方面很多
可以加 -z 會開啟壓縮功能, 會再快上一點。

完整command
rdesktop your.domain -z -g 90%

Monday, September 15, 2008

回復 GRUB

重新安裝了Windows XP. 但本來管理Ubuntu 和Windows dual boot的GRUB 給Windows 覆蓋了。難道要重裝linux?好在google找到了解決方法

1.)用Ubuntu的liveCD boot 機, 去到有console的地方, 就是desktop那裏
2.)開console
3.)sudo grub
之後會出現一個grub的console
grub>打 find /boot/grub/stage1
會傳會類似的回應: (hd0,3)
grub>打 root (hd0,3)
grub>打 setup (hd0,3)
再quit

重新啟動後,grub回來了