หน้าเว็บ

วันเสาร์ที่ 3 กันยายน พ.ศ. 2554

เปิด Numlock อัตโนมัติ ที่หน้า logon screen

เข้าไปแก้ไขที่ Registry
ไปที่ HKEY_USERS\.Default\Control Panel\Keyboard
แล้วเปลี่ยนค่าของ InitialKeyboardIndicators เป็น 2

ความหมายของตัวเลข

0 : Turns off Num Lock, Caps Lock, and Scroll Lock

1 : Turns on Caps Lock

2 : Turns on Num Lock

3 : Turns on Caps Lock and Num Lock

4 : Turns on Scroll Lock

5 : Turns on Caps Lock and Scroll Lock

6 : Turns on Num Lock and Scroll Lock

7 : Turns on Caps Lock, Num Lock, and Scroll Lock

Axapta X++ : การเรียกใช้คำสั่งของ Windows ด้วย X++

ตัวอย่างการเรียกใช้ Notepad

Code :
WinApi::shellExecute(strFmt('%1\\%2', WinApi::getSystemDirectory(),'\\notepad.exe'),fileName);  

Axapta : Progress bar

Code สำหรับแสดงผล Progress bar เอาไว้แสดงเวลาทำงานที่ใช้เวลา run นาน ๆ

Code Test :


static void jobProgress(Args _args)
{
    InventTable inventTable;
    SysOperationProgress simpleProgress;
    int totalItem;
    #AviFiles
 
    SELECT COUNT(recId) FROM inventTable
    WHERE inventTable.ItemGroupId == "P:BW";
    totalItem = inventTable.recId;
 
    simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, 'Please wait ...', totalItem);
    // go through all companies and update temporary table
    WHILE SELECT ItemId FROM inventTable
    where inventTable.ItemGroupId == "P:BW"
    {
        simpleProgress.incCount();
        simpleprogress.setText(strfmt("Item : %1", inventTable.ItemId));
        simpleprogress.update(true);
    }
}

Ubuntu : เพิ่มความสามารถให้ Shutter

ทำให้สามารถแก้ไขรูปที่จับมาได้

apt-get install libgoo-canvas-perl

ทำให้สามารถจับ web แบบ scroll ได้

apt-get install gnome-web-photo

Ubuntu : PHP & MSSQL Server

จะเขียน script PHP จาก Ubuntu ให้ติดต่อไป MSSQL Server ต้องติดตั้ง package เพิ่มเติม ดังน้ัี

sudo apt-get install php5-mssql

Code Test :


<?php
$myServer = "server";
$myUser = "user";
$myPass = "password";
$myDB = "database";
 
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
  or die("Couldn't connect to SQL Server on $myServer");
 
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
  or die("Couldn't open database $myDB");
 
//declare the SQL statement that will query the database
$query = "SELECT ItemId ";
$query .= "FROM InventTable ";
 
//execute the SQL query and return records
$result = mssql_query($query) or die("Couldn't query");
 
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
 
//display the results
while($row = mssql_fetch_array($result))
{
  echo "<li>" . $row["ItemId"] . "</li>";
}
//close the connection
mssql_close($dbhandle);
?>

Network : วิธีหาว่าคอมพิวเตอร์ต่อสายอยู่กับ Switch ช่องใด

ใช้ได้กับ switch รุ่น 3Com 4400
1.หา MAC ของเครื่อง ได้ดังนี้
1.1 ดูจาก DHCP / DNS
1.2 ใช้คำสั่ง ping ทิ้งไว้สักครู่ แล้วตามด้วยคำสั่ง arp -a
1.3 ดูที่ LAN Card (กรณีเครื่องอยู่ใกล้ตัว)
1.4 ใช้คำสั่ง ipconfig /ifconfig (กรณีเครื่องอยู่ใกล้ตัว)
1.5 nbtstat -a ดู IP -> ชื่อ, MAC

2. telnet ไปที่ IP ของ Switch 3Com

3. ใช้คำสั่งเพื่อดูว่า MAC ที่สนใจอยู่ที่ Port ใด ดังนี้ (คำสั่งสามารถพิมพ์เฉพาะตัวอักษรบางตัวได้)
3.1 bridge > addressDatabase > summary > all เพื่อดูทั้งหมด
3.2 bridge > addressDatabase > find > ป้อน MAC เพื่อดูอันเดียว

4. ถ้าหมายเลข port เดียวมีหลาย MAC แสดงว่า port นั้นต่อไป Hub/Switch ตัวอื่น

Axapta X++ : ไว้เช็คว่า PO นี้เคย POST ไปแล้วหรือยัง


static void checkPOState(Args _args)
{
    container   existingJournals;
    PurchTable  po;
    ;
    po = PurchTable::find("PO11-10148");
    existingJournals = po.existingJournals();
    if(conpeek(existingJournals, PurchTableType::posPurchaseOrder()) ? true : false){
        info("POSTED");
    }else{
        info("NOT POSTED");
    }
}