Axapta : Find user group of current userid

กันลืม

1
2
3
4
5
6
7
8
9
 UserGroupList   userGroupList;
;
    WHILE SELECT userGroupList
    WHERE userGroupList.userId == curuserid()
//    && userGroupList.groupId == 'searchGroup';
    {
        print userGroupList.groupId;
    }
    pause;

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on Axapta and Programming.

Ubuntu : Shutter add-ons

อ้าว Shutter (โปรแกรมสำหรับ capture screen) ทำไม capture แล้ว edit ไม่ได้หว่า
search ดูถึงได้รู้ว่า ขาด add-ons บางอย่างไปนี่เอง ว่าแล้วก็ติดตั้งซะเลย

1
2
apt-get install libgoo-canvas-perl
apt-get install gnome-web-photo

อันแรกเอาไว้ capture แล้ว edit ได้
อันที่สองเอาไว้ capture หน้า web page ยาว ๆ มันจะ scroll ให้อัตโนมัติ

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on IT Tips and Software and Ubuntu.

Ubuntu : Backup & Restore

คำสั่ง mt (Magnatic Tape) ปกติระบบจะ mount ไว้ให้ที่ /dev/st0

1
2
3
4
mt -f /dev/st0 status # ตรวจสอบสถานะ
mt -f /dev/st0 rewind # สั่งหมุน tape กลับ
mt -f /dev/st0 erase # ลบข้อมูล (นานมาก)
mt -f /dev/st0 offline #สั่งเด้ง tape ออก

Cleaning Cartridge # บางรุ่นอาจไม่เหมือนกัน
ใส่เข้าไป พอมัน load เข้าไปแล้วทำความสะอาดเสร็จจะเด้งออกมาเอง
(Cleaning Cartridge เป็นแบบใช้แล้วใช้เลย rewind กลับมาใช้อีกไม่ได้)

คำสั่ง Backup & Restore
Backup ใช้ -c

1
tar -cvf backup_filename data_to_backup

เช่น

1
tar -cvf backup.tar /home/nikom

กรณีต้องการให้บีบอัดไฟล์ด้วย เพิ่ม parameter -z

1
tar -cvzf backup.tar.gz /home/nikom

Restore เปลี่ยน -c เป็น -x (เข้าไปใน directory ที่จะ restore ก่อน เพราะสั่งตรงไหน restore มาตรงนั้น)

1
tar -xvf backup_filename

เช่น

1
tar -xvf backup.tar

restore ไฟล์ที่บีบไว้ ใช้ -z เหมือนกัน

1
tar -xvzf backup.tar.gz

Tape
backup ลง tape

1
tar -cvf /dev/st0 data_to_backup

ดูรายการใน tape

1
 tar -tvf /dev/st0

restore จาก tape

1
 tar -tvf /dev/st0 backup_filename

backup & restore กับ tape ก็ใช้ -z สำหรับการบีบอัดได้

backup แบบ incremental
การ backup เฉพาะส่วนที่เพิ่มขึ้น ทำได้โดยใช้ -g ตามด้วย ไฟล์ที่ใช้เก็บส่วนต่าง เช่น

1
 tar -g /home/nikom/tar_inc_file.dat -cvf /dev/st0 /home/nikom

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on Admin and Ubuntu.

Ubuntu : Automount NTFS partition when login

ติดตั้ง ubuntu ใหม่ทีไร ลืมทุกที
1.แก้ fstab
1.1 mkdir /media/Data1 #สร้าง mount point
1.2 sudo apt-get install ntfs-3g
1.3 sudo nano /etc/fstab
1.4 เพิ่มบรรทัดดังนี้
/dev/sda1 /media/Data1 ntfs-3g defaults 0 0

2.ใช้ script
2.1 nano /etc/automount.sh
2.2 ดังนี้

1
2
3
#!/bin/bash
mount /dev/sda1 /media/Data -t ntfs -o rw
mount /dev/sda2 /media/Data2 -t ntfs -o rw

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on Ubuntu.

Expanding the size of a virtual disk

เมื่อ OS ใน Virtual Box เต็ม จะทำอย่างไรกันดีเล่าพี่น้อง
ความจริงวิธีที่จะทำ มันไม่ตรงกับหัวข้อครับ เพราะมันไม่ใช่การขยาย แต่มันเป็นการสร้างใหม่
1.เลือก VDI Image เป้าหมายที่ต้องการขยาย

2.สร้าง VDI Image อันใหม่ให้มีขนาดที่ต้องการ
3.เพิ่ม Image อันใหม่เป็น Slave และ เพิ่ม linux Image เข้าไปใน CD สำหรับใช้ Boot ตามตัวอย่างใช้ Parted Magic

4.เปิด terminal พิมพ์ nano /proc/paritions เพื่อดูขนาด harddisk

5.ใช้คำสั่ง dd โดยสังเกตขนาดตามรูป จะโอนจาก 10G(hda) ไปเป็น 30G(hdb) ก็ใช้คำสั่ง

1
dd if=/dev/hda of=/dev/hdb

6.รอจนเสร็จแล้ว shutdown
7.สร้าง OS อันใหม่ แล้วเพิ่ม VDI Image อันใหม่ กับ image ของ Parted Magic boot อีกทีเพื่อ resize partition เพราะ image ใหม่มีขนาด 30 GB ก็จริง แต่ขนาด partition ยังเท่าเดิม

8.เสร็จแล้วก็ shutdown แล้วเอา image ของ Parted Magic ออกก็จะได้ OS ใหม่ใหญ่กว่าเดิมไว้ใช้งาน

Written by Komkid on July 22nd, 2010 with no comments.
Read more articles on Admin and IT Tips and Software and Ubuntu.

« Older articles

Newer articles »