讓 VI 也認得 SystemVerilog

Step.1 先到 這裡 下載 systemverilog.vim

Step.2 將 systemverilog.vim 移到 ~/.vim/syntax/ 的目錄下
Step.3 編輯 ~/.vim/filetype.vim 並加入

augroup filetypedetect
au BufNewFile,BufRead *.sv setf systemverilog
augroup END

原來 CUPS 是 Apple 的東西

在安裝 Linux Print Driver 的時後,
順手印了一張測試頁,
測試頁的標題是: “CUPS Printer Test Page”,
這張測試頁,從以前到現在,印很多次也看過很多遍了;
不過剛剛無意間看了測試頁下方的小字:
“… CUPS and the CUPS logo are the trademark property of Apple Inc. …”
原來 CUPS 是 Apple 的東西,
現在才發現,Apple 在 Opensource 也貢獻了不少東西。
不知道在 Linux 的世界裡,有沒有微軟貢獻的東西?

Compile SystemC on OpenSuSE 11.3

Download systemc-2.2.0.tgz from
解開壓縮檔

$ tar zxvf ./system-2.2.0.tgz

因為 gcc 是 4.x.x 版,所以要做 patch,compile 才會過
修改 systemc-2.2.0b/src/sysc/utils/sc_utils_ids.cpp
加上:

#include "string.h"
#include "cstdlib"

Compile SystemC and Install


$ sudo mkdir /opt/systemc
$ cd system-2.2.0
$ mkdir objdir
$ cd objdir
$ ../configure --prefix=/opt/systemc
$ make
$ make check # if you want to check
$ sudo make install

OpenSuSE 11.2 x64 + Sun Grid Engine

Workstation:

    PC1 : NIS Server, NFS Server, SGE master
    PC2 : NIS Client, NFS Client, SGE Execution Hosts
    PC3 : NIS Client, NFS Client, SGE Execution Hosts
    PC4 : NIS Client, NFS Client, SGE Execution Hosts
    —-
    PC1, share /home
    PC2~4, mount PC1:/home on /home

OS:

    OpenSuSE 11.2 x64

Package Requirement:

    openmotif22-libs
—————————————————————————

Step.1 Configuration Password-less ssh Access for the root User

    === PC2~4 ===


      check /etc/ssh/sshd_config


        => “PermitRootLogin yes


    === PC1 ===

    // Generate SSH Key
    # ssh-keygen -t rsa

    // Put SSH public key to slave PC2~4
    # rsync -av /root/.ssh/id_rsa.pub root@PC2:/root/.ssh/authorized_keys
    # rsync -av /root/.ssh/id_rsa.pub root@PC3:/root/.ssh/authorized_keys
    # rsync -av /root/.ssh/id_rsa.pub root@PC4:/root/.ssh/authorized_keys

    // Test Password-less ssh access for root user

    # ssh root@PC2
    # ssh root@PC3
    # ssh root@PC4

    Step.2 Download Sun Grid Engine


      Sun Grid Engine 6.2 Update 4, Linux x64 (required), tar.gz format


        sge62u4_linux24-x64_targz.zip … 27.63 MB


      Sun Grid Engine 6.2 Update 4, Linux x86 (required), tar.gz format


        sge62u4_linux24-i586_targz.zip … 27.56 MB


    Step.3 Setup SGE Master / Execute Node


      PC1 (SGE Master):


      # mkdir /home/srv/sge6-2
      # cd /home/srv/sge6-2
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2-common.tar.gz
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2u4-bin-linux24-x64.tar.gz
      # tar -zxvf $DOWNLOAD/sge6_2u4/sge-6_2u4-bin-linux24-i586.tar.gz
      # SGE_ROOT=/home/srv/sge6-2; export SGE_ROOT
      # util/setfileperm.sh $SGE_ROOT

      // GUI Install
      # ./start_gui_installer


        Admin User = root
        Qmaster Host = PC1
        Grid Engine root directory = /opt/sge6-2
        Cell Name = cell_test

Step.4 Test

    // Login in PC1~4 by normal user account
    # source /home/srv/sge6-2/cell_eda/common/settings.csh
    # qsub my_job.sh

Install FreeNX Server on OpenSUSE 11.2

openSUSE 11.2

The FreeNX package is no longer present in the official openSUSE 11.2 repositories. You can find the package in the Build Service.

  • Install NX and FreeNX rpms from here and here. The versions from the repository X11:RemoteDesktop/openSUSE_11.2 should work fine.


rpm -ivh http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2/x86_64/FreeNX-0.7.2-26.1.x86_64.rpm http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2/x86_64/NX-3.2.0-22.1.x86_64.rpm

    • As pre-requisite before installing the rpm above, you may need to install packages like expect and rdesktop. Install using YaST’s Software Management or zypper on command line.
  • Run nxsetup –install –setup-nomachine-key –clean to install the server the first time
  • Use nxserver –status to check status of the server. The server runs on the ssh port, 22.
  • Test connecting using any NX client. Official No Machine client can be downloaded from www.nomachine.com which installs the client binary at /usr/NX/bin/nxclient See http://walter.deback.net/blog/archives/19 for using the NX client effectively.

在 Mac OS 10.6 安裝 git

  • Make sure your ports are up to date.
  • Install Git (You may want to include Subversion support if you want to import SVN repositories)

$sudo port selfupdate
$sudo port install git-core +svn

Reference: http://help.github.com/mac-git-installation

Mac OS X 10.6, MD5 checksum

由於 Mac OS X 10.6 並未內建 md5sum
所以先安裝 md5sum

sudo port install md5sha1sum

可以一次列出所有檔案的 MD5 Checksum,包含子目錄

find . ! type d print0 | xargs 0 md5sum

檢查所有檔案的 MD5 Checksum,包含子目錄

find . ! type d print0 | xargs 0 md5sum c check.md5

WordPress latin1 轉utf-8

有效告別數據庫亂碼, gbk/gb2312/big5/latin1轉utf-8

1. 在shell中用root登陸服務器
2. 進入mysql目錄 (linux Server):

  • cd /var/lib/mysql/

3. 利用mysql自帶的mysqldump功能dump一下原有的latin1編集的數據庫:

  • mysqldump –user=username –password=password –default-character-set=latin1 –skip-set-charset dbname > dump.sql

4. 把數據庫數據從latin1轉換成utf-8編集:

  • sed -r ’s/latin1/utf8/g’ dump.sql > dump_utf.sql

5. 創建新的urf-8新數據庫:

  • mysql –user=username –password=password –execute=”DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;”

6. 以正確編集導入轉碼後的數據庫數據:

  • mysql –user=username –password=password –default-character-set=utf8 dbname