install GD ให้ PHP 5.2.8

posted on 23 Dec 2008 17:52 by jquery-execute  in PHP-Programming
ขั้นตอนการติดตั้ง GD เพิ่มเติมหลังจากติดตั้ง PHP 5.2.8
ที่ต้องติดตั้งเพิ่มเพราะว่า PHP Version ใหม่ๆจะไม่ Support GD แล้ว
ดังนั้นเวลาจะใช้ GD ต้องติดตั้งเพิ่มเอง

สิ่งที่จะต้องติดตั้งเพิ่มก่อนจะ compile GD นั้นก็คือให้ compile พวก
- libpng
- libjpeg
- libxpm

ข้อมูลต่างๆอยู่ใน http://th.php.net/manual/en/image.setup.php

ตัวอย่าง File config ของ php
./configure \
    --with-apxs2=/usr/sbin/apxs \
    --with-mysql \
    --prefix=/usr/local/php \
    --with-config-file-path=/usr/local/php \
    --enable-force-cgi-redirect \
    --disable-cgi \
    --with-zlib \
    --with-gettext \
    --with-gdbm \
    --with-gd=/usr/local/lib \
    --with-png-dir=/usr/local/lib \
    --with-jpeg-dir=/usr/local/lib \
    --enable-calendar

การ install php 5.2.8 แบบ manual บน centos

posted on 23 Dec 2008 15:48 by jquery-execute  in PHP-Programming

ขั้นแรก Download PHP Version ล่าสุด และทำการกำหนดค่า configuration

./configure \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql \
--prefix=/usr/local/apache/php \
--with-config-file-path=/usr/local/apache/php \
--enable-force-cgi-redirect \
--disable-cgi \
--with-zlib \
--with-gettext \
--with-gd=shared
 
Apache 2.2 : httpd.conf
# Use for PHP 5.x:
LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php 
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html       php
# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps
 

 

jquery การ access iframe

posted on 16 Dec 2008 13:26 by jquery-execute  in jQuery

ติดตามอ่านบทความ jQuery ตั้งแต่ basic ถึงAdvance ได้ที่ http://www.jquery.in.th

วิธีการ Access Iframe โดยใช้ jQuery นั้นสามารถทำได้ดังนี้

$('#myIframeID').contents();

จาก Code นี้ ถ้าสั่งให้ alert ค่าออกมาก็จะได้ Object ของ html ที่อยู่ใน iframe นั้น
ต่อไปก็ขึ้นอยู่กับเราว่าจะนำเอา obj นั้นมาทำอะไรต่อเช่น ต้องการค้นหา tag div ที่มี id ชื่อ test
ก็สามารถทำได้ดังนี้

$('#myIframeID').contents().find('#test').html('Test Access Iframe');


จาก Code ตัวอย่างนี้เป็นการเขียน html ลงไปใน DIV test ที่อยู่ใน iframe

edit @ 23 Mar 2009 16:57:26 by jQuery-Execute.in.th

ติดตามอ่านบทความ jQuery ตั้งแต่ basic ถึงAdvance ได้ที่ http://www.jquery.in.th

การตรวจสอบการกด แป้นพิมพ์ หรือ Keyboard นั้นจะต้องรู้ code ของปุ่มต่างๆก่อน
จึงจะสามารถนำไปใช้ในการดักเหตุการณ์ต่างๆได้ เราสามารถเช็คค่าได้ดังนี้

Code :

$.('body').keypress( function(){

          alert( event.keyCode );       

} );

edit @ 13 Dec 2008 16:25:35 by jQuery-Execute.in.th

edit @ 23 Mar 2009 16:57:10 by jQuery-Execute.in.th

jQuery.each

posted on 12 Dec 2008 11:48 by jquery-execute  in jQuery

ติดตามอ่านบทความ jQuery ตั้งแต่ basic ถึงAdvance ได้ที่ http://www.jquery.in.th

ในการเข้าถึง input box ไม่ว่าจะเป็น

- text
- file
- textarea

ถ้าหากมีหลายอันนั้น เวลาจะ validation form นั้นจะทำได้ลำบาก เพราะต้องเขียนการเช็ค
แต่ละตัวไป แล้วยิ่งมีการ append input box เข้ามาแบบ dinamic แล้วละก็ยิ่งเป็นการยากที่
จะเช็ค form ได้ ตัวอย่างนี้เป็นการใช้ jQuery เรียกเช็คค่า ว่ามีค่าว่างหรือไม่ได้กรอก ข้อมูลหรือไม่
ถ้ามีค่าว่างก็ให้ทำการ alert message ออกมา โดยที่ไม่ต้องเช็คแต่ละตัว และยังสามารถระบุ Type ได้อีกด้วย
ว่าให้เช็คเฉพาะ type = text เท่านั้น

Code:
$('#myform').submit(function(){
       jQuery.each($('#myforminput[type="text"]'), function() {
                    if($(this).attr('value') == ''){
                        alert('Input box is Empty');
                    }
});

 

 

edit @ 23 Mar 2009 16:57:00 by jQuery-Execute.in.th