หน้าเว็บ

วันจันทร์ที่ 23 กรกฎาคม พ.ศ. 2555

Default printer troubles with Thunderbird

ตั้ง Printer ให้โปรแกรม Thunderbird แล้วไม่จำค่า Printer Default ที่เราตั้งไว้

If you can't print from Thunderbird, or if Thunderbird won't recognize the computer's default printer:

1. In Thunderbird, go to Tools - Options.
2. Under Advanced, on the General tab, click on the Config Editor button.
3. Scroll down to the line starting with print.print_printer. If you don't have that line, then everything should already be set correctly.
4. Right-click on the print.print_printer line & choose Reset.
5. Close the configuration window, then click OK to close the Options window.
6. Close Thunderbird.
7. Make sure that the correct default printer is selected. To do so, go to Start - Settings - Printers and Faxes. The one with the small checkmark is the default. To set a different printer as the default, right-click on it & choose Set as Default Printer.
8. Reopen Thunderbird.


ที่มา
http://arstechnica.com/civis/viewtopic.php?f=11&t=224248

วันอังคารที่ 10 กรกฎาคม พ.ศ. 2555

Linux Mint 13 Maya : sources.list

Although I posted linux mint ‘sources.list’ for my own reference, it is 
the most viewed content on this site. So I will continue to post the
‘sources.list’. The upcoming Linux Mint 13 Maya ‘sources.list’ will
probably look the following.
 
sudo nano /etc/apt/sources.list
 
deb http://packages.linuxmint.com/ maya main upstream import
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ precise partner
deb http://packages.medibuntu.org/ precise free non-free

# deb http://archive.getdeb.net/ubuntu precise-getdeb apps
# deb http://archive.getdeb.net/ubuntu precise-getdeb games

Linux :Mount partition on startup.

สามารถ Mount Partition ที่เป็น NTFS ตอน boot หรือ Partition ext3, ext4 อื่น ๆ ได้โดย
1.ใช้ ntfs-3g (ถ้ายังไม่มีก็ติดตั้งได้เลยด้วย apt-get)
2.แก้ไข /etc/fstab ป้อนข้อมูลลักษณะดังตัวอย่าง


  1. # <file system>   <dir>     <type>    <options>             <dump>  <pass>
  2. /dev/<NTFS-part>  /mnt/windows  ntfs-3g   defaults        0       0
2.1 (ต้องสร้าง Directory /home/name/DATA ได้ก่อน) หรือที่อื่น ๆก็ได้
2.2 ใช้ UUID เผื่อกรณีที่มีการสลับ Hard disk แล้วลำดับเปลี่ยน (ใช้คำสั่ง blkid เรียกดู)
2.3 ใช้คำสั่ง sudo nano /etc/fstab  เพื่อเพิ่ม Partition ที่จะให้ StartUp

เพิ่ม Partition ที่เรารู้ UUID แล้วเข้าไป เช่น

# Auto Mount Drive Data
UUID=3be91762-2823-4bf5-86ac-5f12ba53220c /home/suwit/DATA     ext4    defaults  0       0

 
หรือ Ntfs ก็เปลี่ยน Type เป็น
  ntfs-3g defaults        0       0    เป็นต้น

เท่านี้เวลาเปิดเครื่อง Partition ก็จะถูกเปิดขึ้นมา Auto แล้วครับ

วันพุธที่ 27 มิถุนายน พ.ศ. 2555

Ubuntu : CHOMD ที่ควรรู้จัก


<< CHMOD >>
CHMOD คือ ค่า Permission ครับ หรือธิบายเป็นไทยคือ ค่าของความมีสิทธิ์ในการเข้าถึงและใช้งาน File หรือ Directory นั้น ๆ ซึ่งจะมีค่าต่าง ๆ แบ่งเป็นตัวเลข 3 หลัก เช่น 755, 777 เป็นต้น ในความหมายของเลขแต่ละหลักทั้ง 3 หลัก จะมีความหมายดังนี้
Execute คือ การสั่งให้ทำงาน  Write คือ การเขียนFile หรือ Directory  Read คือ การอ่าน File หรือ Directory
* การที่จะได้เลขหลักใด ๆ มา ก็คือการนำเอาเลขในกลุ่มสิทธิ์นั้น ๆ มาบวกกัน ตัวอย่างเลข 6 จะได้มาจาก การนำเอาเลข 4 กับ 2 มาบวกกัน (Execute+Write)
เลขในหลักแรก -> เจ้าของไฟล์/directory (Owner)
ตัวเลขในหลักแรก จะแสดงถึงสิทธิ์ในการเข้าถึงไฟล์ของผู้เป็นเจ้าของไฟล์ หรือ Dir นั้น ๆ ถ้า ตัวเลขหลักแรกเป็นเลข 
4 จะหมายความว่า เจ้าของ (Owner) ไฟล์นั้น มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน เพียงอย่างเดียว แต่ไม่มีสิทธิ์ เขียน หรือ อ่าน ไฟล์นั้น 
6 จะหมายความว่า เจ้าของ (Owner) ไฟล์นั้น มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน และมีสิทธิ์ในการเขียนไฟล์นั้นเพียงอย่างเดียว แต่ไม่มีสิทธิ์อ่านไฟล์นั้น (4+2)
7 จะหมายความว่า เจ้าของ (Owner) ไฟล์นั้น มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน และมีสิทธิ์ เขียน หรือ อ่าน ไฟล์นั้น (4+2+1)
(ดูค่าตามตาราง ประกอบ)

เลขในหลักที่สอง -> ผู้ใช้กลุ่มเดียวกับเจ้าของไฟล์/directory (Group)
เลขในหลักที่สอง จะแสดงถึงสิทธิ์ในการเข้าถึงไฟล์ของผู้ใช้กลุ่มเดียวกับเจ้าของไฟล์ (Group) หรือ Dir นั้น ๆ ถ้า ตัวเลขหลักที่สองเป็นเลข 
4 จะหมายความว่า ผู้ใช้ในกลุ่มเดียวกับเจ้าของ (Group) ไฟล์นั้น มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน เพียงอย่างเดียว แต่ไม่มีสิทธิ์ เขียน หรือ อ่าน ไฟล์นั้น
6 จะหมายความว่า ผู้ใช้ในกลุ่มเดียวกับเจ้าของ (Group)ไฟล์นั้น มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน และมีสิทธิ์ในการเขียนไฟล์นั้นเพียงอย่างเดียว แต่ไม่มีสิทธิ์อ่านไฟล์นั้น (4+2)
7 จะหมายความว่า ผู้ใช้ในกลุ่มเดียวกับเจ้าของ (Group) ไฟล์นั้น มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน และมีสิทธิ์ เขียน หรือ อ่าน ไฟล์นั้น (4+2+1)
(ดูค่าตามตาราง ประกอบ)

เลขในหลักที่สาม -> ผู้ใช้ในอื่น ๆ (Others)

เลขในหลักที่สาม จะแสดงถึงสิทธิ์ในการเข้าถึงไฟล์หรือ Dir ของผู้ใช้งานอื่น ๆ หรือผู้ใช้งานทั่วไป ถ้า ตัวเลขหลักที่สามเป็นเลข 
4 จะหมายความว่า ผู้ใช้ในอื่น ๆ มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน เพียงอย่างเดียว แต่ไม่มีสิทธิ์ เขียน หรือ อ่าน ไฟล์นั้น
6 จะหมายความว่า ผู้ใช้ในอื่น ๆ มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน และมีสิทธิ์ในการเขียนไฟล์นั้นเพียงอย่างเดียว แต่ไม่มีสิทธิ์อ่านไฟล์นั้น (4+2)
7 จะหมายความว่า ผู้ใช้ในอื่น ๆ มีสิทธิ์ในการสั่งให้ไฟล์นั้นทำงาน และมีสิทธิ์ เขียน หรือ อ่าน ไฟล์นั้น (4+2+1)
(ดูค่าตามตาราง ประกอบ)

ตัวอย่างเลข 777 จะหมายความว่า ผู้ใช้ในทุกกลุ่ม ไม่ว่าจะเป็นเจ้าของไฟล์ / กลุ่มเดียวกับเจ้าของ / ผู้ใช้อื่น ๆ ทุกกลุ่มที่กล่าวมา มีสิทธิ์ในการกระทำทุกสิ่งกับไฟล์ที่มีค่า CHMOD เป็น 777 เป็นต้น
ตัวอย่างการใช้งานเช่น ในไฟล์ TEXT ของโปรแกรมเรา อย่างเช่นโปรแกรม COUNTER ที่จะต้องมีการ สั่งให้ทำงาน อ่าน และเขียน อยู่ทุก ๆ ครั้งที่มีการเรียกใช้งานเว็บเพจที่มีการติดตั้งโปรแกรมดังกล่าว ไฟล์ TEXT นั้น จะต้องมีการเปลี่ยนค่า CHMOD เป็น 777 เพื่อให้มีการเขียนไฟล์ได้จากผู้ใช้อื่น ๆ เป็นต้น


วันพุธที่ 20 มิถุนายน พ.ศ. 2555

PHP : อย่าง งง กับ CHECKBOX

1. ต้องการให้ Checkbox ตรวจสอบค่า Text และส่ง ค่าใน Text1 ไปยัง Text2
2. ถ้าไม่ ติ๊ก ให้ Text2 ว่าง
3. เก็บค่า 0 , 1 เข้า Database
4. เรียกข้อมูลเดิมมาดูให้แสดง ติ๊ก ไม่ติ๊ก ตาม DataBase ที่ Select มาได้

1, 2 :
    input type="checkbox" name="checkbox" id="checkbox" onclick="if(this.checked){this.form.Name Text2.value = this.form.Name Text1.value}else{this.form.Name Text2.value = '';}" />
3 :
ส่งค่าไปอีกไฟล์ PHP รับค่า $_POST เพื่อทำการ SAVE
เช็คว่าว่างหรือไม่ว่าง แล้วเก็บค่าไว้ในตัวแปร ค่อยไปยัดใส่ Database

    if(!empty($emp_address_check)){
        $emp_address_check = 1;
    }else{
        $emp_address_check = 0;
    }
4 :
 เช็คค่า ที่ Select มาจาก Database ว่าว่าง หรือ เท่ากับ 0 หรือไม่ ให้เก็บค่าใส่ตัวแปรว่า checked='checked' แล้วค่อยไป echo

        if(empty($emp_address_check) || $emp_address_check = 0){
            $checked = "";
        } else {
            $checked = "checked='checked'";
        }
ส่วนแสดงผล
    input type="checkbox" name="checkbox" id="checkbox" onclick="if(this.checked){this.form.Name Text2.value = this.form.Name Text1.value}else{this.form.Name Text2.value = '';}" <?php echo $checked ?> />

วันพฤหัสบดีที่ 14 มิถุนายน พ.ศ. 2555

PHP Upload and Resize Image

phpUploadResize.html

<html>
<head>
<title>ThaiCreate.Com PHP Upload Resize</title>
</head>
<body>
<form action="phpUploadResize.php" method="post" enctype="multipart/form-data" name="frmMain">
<table width="343" border="1">
<tr>
<td>Upload</td>
<td><input name="fileUpload" type="file"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>

phpUploadResize.php

<html>
<head>
<title>ThaiCreate.Com PHP Upload Resize</title>
</head>
<body>
<?
if(trim($_FILES["fileUpload"]["tmp_name"]) != "")
{
$images = $_FILES["fileUpload"]["tmp_name"];
$new_images = "Thumbnails_".$_FILES["fileUpload"]["name"];
copy($_FILES["fileUpload"]["tmp_name"],"MyResize/".$_FILES["fileUpload"]["name"]);
$width=100; //*** Fix Width & Heigh (Autu caculate) ***//
$size=GetimageSize($images);
$height=round($width*$size[1]/$size[0]);
$images_orig = ImageCreateFromJPEG($images);
$photoX = ImagesX($images_orig);
$photoY = ImagesY($images_orig);
$images_fin = ImageCreateTrueColor($width, $height);
ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
ImageJPEG($images_fin,"MyResize/".$new_images);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
}
?>
<b>Original Size</b><br>
<img src="<?="MyResize/".$_FILES["fileUpload"]["name"];?>">
<hr>
<b>New Resize</b><br>
<img src="<?="MyResize/".$new_images;?>">
</body>
</html>

ที่มา http://www.thaicreate.com/php/php-upload-resize-image.html

แสดงรูป
<?="MyResize/NameFile.jpg"; ?>

วันจันทร์ที่ 11 มิถุนายน พ.ศ. 2555

การเปิดหน้าต่างใหม่ - onClick="javascript:window.open()"

เปิดหน้าต่าง ใหม่และย่อขนาดให้เล็กลง PHP

<script language="javascript">
var win = null;

function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>


[ <a href="function_query_repor_print.php" onClick="NewWindow(this.href,'name','800','600','yes');return false">คลิก</a> ]







////////////////////////////////// หรือ //////////////////////////////////////////////


onClick="popWin()";

function popWin(){
window.open('keycalen.php' , 'mypopup' , 'nenuber=no,toorlbar=no,location=no,scrollbars=no, status=no,resizable=no,width=180,height=180,top=220,left=650 ' )";
mypopup.focus();
}





ที่มา http://www.thaicreate.com/php/forum/025196.html