Tuesday, December 29, 2009

First Blog



(1). create new project
> rails -d mysql weblog ---> force to use mysql as database

(2). cd to project directory
> cd weblog
> sudo nano config/database.yml ---> make sure all details correctly state eg.password
& username for database

(3). create table into the database
> rake db:create

(4). change route inside routes.rb
> sudo nano config/routes.rb
= find this line #map.connect :controller => "welcome" ---> remove #sign and
change welcome to post
> rm public/index.html ----> make sure post page will be display for homepage

(5). create scaffold
> script/generate scaffold Post name:string title:string content:text
--> automatically create

(6). rake db:migrate ---> migrate table into database

(7). adding validation
> sudo nano app/models/post.rb
= class Post < ActiveRecord::Base
validates_presence_of :name, :title, :content
end
----> make sure this code inside post.rb

(8.) Edit page that we create early
> sudo nano app/views/posts/index.html.erb
= change all the following code
- for tag h1, change to The Ruby Web Blog Using CMD
- for tag Name , change to Namae
Title , change to Shogou
Content , change to Ganryou
- for tag <% for post in @posts %>, change @posts as @posts.reverse
---> to make sure new entry for blog will be at the top.
- for tag <%= h post.name %>, change post.name to post.name.capitalize
---> make sure author name will be capitalize.


p/s ---> i'm using nano instead of vim or gedit.. u have the right to use vim or gedit. ^_^

Thursday, December 17, 2009

SSH

(1) install ssh server --- sudo apt-get install openssh-server
(2) edit /etc/ssh/sshd_confg -- $ PermitRootLogin = no
$ AllowUsers = user1,user2
(3) restart --- sudo /etc/init.d/ssh restart
(4) test --- ssh localhost

(5) install ssh client --- sudo apt-get install openssh-client
(6) open connection --- ssh username@196.168.0.10

NFS

(1). install NFS server ---- sudo apt-get install portmap nfs-kernel-server
(2). edit /etc/exports ---- add this ... /home 196.0.0.10 (rw,sync,no_subtree_check) 196.0.0.11
(ro,sync,No_subtree_check)
/home 196.0.0.10/255.255.255.0 (rw,sync,no_subtree_check)
---- rw = read & write, ro = read only, sync = server only reply to
request after changes flush to the disk.
(3). export the shares ---- sudo exporfs -ra
(4). restart portmap ---- sudo /etc/init.d/portmap restart
(5). restart kernel ---- sudo /etc/init.d/nfs-kernel-server restart

(6). install NFS client ---- sudo apt-get install portmap nfs-common
(7). edit /etc/hosts.deny ---- add this .... portmap : ALL
---- deny all client machine except listed in hosts.allow file
(8). edit /etc/hosts.allow ---- add this .... portmap : NFS server IP, eg 196.0.0.10

(9). static mount ---- create mountpoint eg. servershare
---- edit /etc/fstab & add this servername:dir /mountpoint nfs rw,hard,intr 0 0
196.0.0.10:home servershare nfs rw,hard,intr 0 0
#hard = if server unavailable, program will
wait until it available
---- then mount as usually.... mount /mountpoint or mount -a (mount everything)
mount servershare.

https://help.ubuntu.com/community/SettingUpNFSHowTo

Early Morning

Quote from "Sang Murobbi" movie...

Ingat la 2 perkara & lupakan 2 perkara...
Ingt la kebaikan yg sedikit itu daripada orng lain dan kejahatan kmu kapda mereka...
Dan lupakan la kebaikan yg kmu lakukan kpda mereka dan lupakn kejahatan yg mreka lakukan kepada kamu..

Quote from book Al Mawa'idz Al Badiah..

Ingat la 2 perkara & lupakan la 2 perkara...
Ingatla akn Tuhanmu & akan matimu..
Lupakan la kejahatan org kepadamu & kebaikan mu kepada orng lain...

Jika kau ingin berbuat jahat, cari la tempat yg bukan milik ALLAH..

Wednesday, December 16, 2009

3rd Day

Counting day and learn 'new' thing..

Trying to do analysis about email full message header..
sure interesting...
B4 ne, tau sal sender and recipient je & yg lain tak kisah pun..
Bila da baca article tue, leh ar check mail server, reliable atau tak kan..