Tuesday, October 26, 2010

[Level 3] Create bootable usb stick for Ubuntu.

If you want to create bootable usb stick to install Ubuntu,
please follow the steps below:
1. Download usb-creator package.
# apt-get -y install usb-creator
2. Run usb-creator.
# usb-creator-gtk
3. choose ISO image file.
4. create usb bootable stick.

Wish this helps.
regards,
Stanley Huang

Thursday, October 21, 2010

[Level 3] Method Resolution Order in Python

If you want to know the ordering of the method, you can check from __mro__.
Ex.
>>> class c11(object):
...   pass
...
>>> class c12(object):
...   pass
...
>>> class c21(object):
...   pass
...
>>> class c22(object):
...   pass
...
>>> class c1(c11,c12):
...   pass
...
>>> class c2(c21,c22):
...   pass
...
>>> class c(c1,c2):
...   pass
...
>>> c.__mro__
(, , , , , , , )
>>>

Wish this helps.
regards,
Stanley Huang

Tuesday, October 19, 2010

[Level 2] How to install nfs client/server on Ubuntu

NFS Server
1. apt-get install nfs-kernel-server
2. vi /etc/exports
ex.
/home/stanley *(rw,sync,no_root_squash)
3. /etc/init.d/nfs-kernel-server start


NFS Client
1. apt-get -y install nfs-common
2. vi /etc/vfstab
ex.
192.168.1.1:/home/stanley /mount/stanley nfs rw 0 0
3. mkdir -p /mount/stanley
4. mount /mount/stanley
5. mkdir -p /mount/stanley2
6. mount -t nfs 192.168.1.1:/home/stanley /mount/stanley2




Wish this helps.
regards,
Stanley Huang

Monday, October 11, 2010

[Level 1] How to change zone in Ubuntu?

How to change time zone in Ubuntu?
Just use the command dpgk-reconfigure

Ex.
#dpkg-reconfigure tzdata

Wish this helps.
regards,
Stanley Huang

Thursday, October 7, 2010

[Level 1] How to grant sudo without password in Ubuntu

If you want to grant root permission to user with sudo,
and also let user doesnot need to input his password while using sudo.
Just add pattern in your visudoers:
username host=NOPASSWD: commands/ALL
Ex.
# visudo 
[original contents]
...
%admin ALL=(ALL) ALL
...
[add new line]
stanley ALL=(ALL) NOPASSWD: ALL

PS. For above example, if user is inclued in admin group, please make sure new line is added at the below of group setting, or group setting will overwrite your setting and let use have to input his password while using sudo.

Wish this helps.
regards,
Stanley Huang