October 20th, 2010
You are currently browsing the articles from KomKid.Net written on October 20th, 2010.
Axapta มีคำสั่ง SQL รวมอยู่ใน X++ อยู่แล้ว
แต่ถ้าอยากใช้คำสั่ง SQL อื่น ๆ เช่น ใช้ประโยชน์จาก NewID() ของ MS SQL Server เพื่อ random ก็ทำได้ ดังตัวอย่าง
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| static void Job3(Args _args)
{
LogInProperty Lp = new LogInProperty();
OdbcConnection myConnection;
Statement myStatement;
ResultSet myResult;
str sqlQuery;
;
sqlQuery = 'SELECT TOP 10 * FROM CustTable ORDER BY NewID()';
LP.setServer("Server");
LP.setDatabase("db");
Lp.setUsername("user");
Lp.setPassword("password");
try{
myConnection = new OdbcConnection(LP);
}
catch{
info("Check username/password.");
return;
}
myStatement = myConnection.createStatement();
myResult = myStatement.executeQuery(sqlQuery);
while (myResult.next()){
box::info(myResult.getString(1));
}
} |
Written by Komkid on October 20th, 2010 with no comments.
Read more articles on Axapta and Database and Programming.
กันลืม
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.
อ้าว 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.
คำสั่ง 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 |
เช่น
restore ไฟล์ที่บีบไว้ ใช้ -z เหมือนกัน
Tape
backup ลง tape
1
| tar -cvf /dev/st0 data_to_backup |
ดูรายการใน tape
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 ใหม่ทีไร ลืมทุกที
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.