tag:blogger.com,1999:blog-26690597527662991032009-06-24T01:41:14.996-07:00AWAT BlogEclipse,Netbeans,Java,PHP,C/C++/C#,.NET,Visual Studiowirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.comBlogger87125tag:blogger.com,1999:blog-2669059752766299103.post-33106748459335939392009-01-10T08:31:00.000-08:002009-01-10T08:32:13.948-08:00Page Navigator Likes Google<?<br /><br /> //Page Navigator Likes Google<br /> //By EThaiZone<br /><br /> //Current Page - เลขหน้าปัจจุบัน<br /> $page = !empty($_GET['page']) ? $_GET['page'] : 1;<br /><br /> //Total Pages - จำนวนหน้าทั้งหมด<br /> $all = 100;<br /><br /> //Amount of link's page - จำนวนลิงค์ที่แสดง (ถ้าเป็น 10 คือหน้า 10 หลัง 10 วิธีคิดเหมือนลิงค์ Google)<br /> $amount_link_page = 10;<br /><br /><br /> #########################<br /><br /> if($page > 1) {<br /> if($page == 2) <br /> $nav = " <a href=\"".$_SERVER['PHP_SELF']."\">[Previous]</a> ";<br /> else<br /> $nav = " <a href=\"".$_SERVER['PHP_SELF']."?page=".($page-1)."\">[Previous]</a> ";<br /> }<br /><br /> $show = empty($amount_link_page) ? $all : $amount_link_page;<br /> $start = ($page <= $show) ? 1 : $page-$show;<br /> $end = (($all-$page)<$show ? $all+1 : $page+$show);<br /><br /> for($i=$start; $i<$end; $i++) {<br /> if($i == 1 && $i!=$page) <br /> $nav .= " <a href=\"".$_SERVER['PHP_SELF']."\">1</a> ";<br /> else if($i!=$page) <br /> $nav .= " <a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";<br /> else <br /> $nav .="<b>[".$i."]</b>";<br /> }<br /><br /> if(($all-$page) > 0) {<br /> $nav .= " <a href=\"".$_SERVER['PHP_SELF']."?page=".($page+1)."\">[Next]</a> ";<br /> }<br /><br /> #########################<br /><br /> //Show link - แสดงลิงค์<br /> echo $nav;<br /><br />?><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-3310674845933593939?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-79713572893011343502009-01-07T08:40:00.000-08:002009-01-07T08:47:00.989-08:00Compile C++ code in ubuntuOne of many question of user who switch from window to linux to have how to compile c/c++ source code. Most of study c or c++ at school or home an are usually use windows.<br /><br />I think simple to start compile c/c++ in ubuntu to use first an editor like nano and create a source file then compile using gcc in command line. but first to install gcc complier and survival other utilities for compile software. use . <br /><br />sodu apt-get install build-essential<br /><br />build-essential is a meta package - a package which only depends on other packages, so installing it will automatically install several tools like gcc, g++ or make.<br /><br />Next, create your source file using a text editor of choice (I used Nano for this example):<br /><br />nano main.c<br /><br />Enter the content, e.g.:<br /><br />#include <stdio.h><br /><br />int main ()<br />{<br />printf ("Hello, world!\n");<br />return 0;<br />}<br /><br /><br />Notice that I also included a newline after the close bracket, otherwise the compiler will issue a warning. Save it with CTRL+O, then exit Nano using CTRL+X. To compile your source, simply use:<br /><br />gcc main.c -o myapp<br /><br />The output, myapp, will automatically be executable, so to run it use:<br /><br />ubuntu@ubuntu:~$ ./myapp<br />Hello, world!<br /><br />This is the simplest way of creating and compiling C or C++ code.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-7971357289301134350?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-32148793669705952602009-01-05T10:22:00.000-08:002009-01-05T10:39:03.591-08:00Speed Up Mysql query cache sizeOne of the best ways to speed up your web application is to enable query caching in your database, which caches commonly used SQL queries in memory for virtually instant access by the next page that makes the same request.<br /><br />The reason this method is so powerful is that you don't have to make any changes to your web application, you just have to sacrifice a little bit of memory. This isn't going to fix all of your problems, but it definitely can't hurt.<br /><br />Note: if your application updates tables frequently, then the query cache will be constantly purged and you won't get much or any benefit from this. This is ideal for an application that mostly does reads against the database, such as a Wordpress blog. This also won't work if you are running on shared hosting.<br /><br />Enable Caching with Server Running<br /><br />The first thing you'll want to do is make sure that your installation of MySQL actually has query caching support available. Most distributions do, but you should check anyway.<br /><br />You'll want to run this command from your MySQL console, which will tell you if query caching is available.<br /><br /> mysql> show variables like 'have_query_cache';<br /> +------------------+-------+<br /> | Variable_name | Value |<br /> +------------------+-------+<br /> | have_query_cache | YES |<br /> +------------------+-------+<br /><br />Don't mistake this as meaning that query caching is actually enabled, because most hosting providers aren't going to enable this by default. Oddly enough, my Ubuntu Feisty installation already had it enabled…<br /><br />Next we'll need to check and see if query caching is enabled. We'll need to check more than one variable, so we may as well do it all at once by checking for the variable query%<br /><br /> mysql> show variables like 'query%';<br /> +------------------------------+---------+<br /> | Variable_name | Value |<br /> +------------------------------+---------+<br /> | query_alloc_block_size | 8192 |<br /> | query_cache_limit | 1048576 |<br /> | query_cache_min_res_unit | 4096 |<br /> | query_cache_size | 8388608 |<br /> | query_cache_type | ON |<br /> | query_cache_wlock_invalidate | OFF |<br /> | query_prealloc_size | 8192 |<br /> +------------------------------+---------+<br /><br />Here's the important items in the list and what they mean:<br /><br /> * query_cache_size - This is the size of the cache in bytes. Setting this value to 0 will effectively disable caching.<br /> * query_cache_type - This value must be ON or 1 for query caching to be enabled by default.<br /> * query_cache_limit - This is the maximum size query (in bytes) that will be cached.<br /><br />If the query_cache_size value is set to 0 or you just want to change it, you'll need to run the following command, keeping in mind that the value is in bytes. For instance, if you wanted to allocate 8MB to the cache we'd use 1024 * 1024 * 8 = 8388608 as the value.<br /><br /> SET GLOBAL query_cache_size = 8388608;<br /><br />Similarly, the other options can be set with the same syntax:<br /><br /> SET GLOBAL query_cache_limit = 1048576;<br /><br /> SET GLOBAL query_cache_type = 1;<br /><br />Now how do we tell if it's actually working? You can use the SHOW STATUS command to pull all the variables that start with "Qc" to take a look at what is going on under the hood.<br /><br /> mysql> SHOW STATUS LIKE 'Qc%';<br /> +-------------------------+--------+<br /> | Variable_name | Value |<br /> +-------------------------+--------+<br /> | Qcache_free_blocks | 65 |<br /> | Qcache_free_memory | 201440 |<br /> | Qcache_hits | 18868 |<br /> | Qcache_inserts | 2940 |<br /> | Qcache_lowmem_prunes | 665 |<br /> | Qcache_not_cached | 246 |<br /> | Qcache_queries_in_cache | 492 |<br /> | Qcache_total_blocks | 1430 |<br /> +-------------------------+--------+<br /> 8 rows in set (0.00 sec)<br /><br />You'll notice in the stats that I have plenty of free memory left. If your server shows a lot of lowmem prunes, you might need to consider increasing this value, but I wouldn't spend too much memory on query caching for a web server… you need to leave memory available for apache, php, ruby, or whatever you are using.<br /><br />Enable in Config File<br /><br />If you want these changes to survive a reboot or restart of the mysql server, you'll need to add them into your /etc/mysql/my.cnf configuration file for MySQL. Note that it might be in a different location on your installation.<br /><br />Open up the file using a text editor in sudo or root mode, and then add these values if they don't already exist in the file. If they do exist, just uncomment them.<br /><br /> query_cache_size = 268435456<br /> query_cache_type=1<br /> query_cache_limit=1048576<br /><br />Query caching can significantly improve the speed of your web application, especially if your application does mostly reads. Monitor the status using the methods above and see how it works over time.<br /><br />link : http://www.howtogeek.com/howto/programming/speed-up-your-web-site-with-mysql-query-caching/<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-3214879366970595260?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-26384833792789175802008-12-18T03:23:00.000-08:002008-12-18T03:24:53.279-08:00addslashes single quote and double quote&lt?php<br />$old1 = 'H"s';<br />$old2 = "H's";<br />echo "new1 : " . addslashes ($old1);<br />echo "<br>";<br />echo "new2 : " . addslashes ($old2);<br />? &gt<br /> <br />The output :<br />new1 : H\"s<br />new2 : H\'s<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-2638483379278917580?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-25227277728894623912008-12-14T07:49:00.000-08:002008-12-14T07:50:20.839-08:00Spanning Tree Example<a href="http://www.cisco.com/warp/public/473/spanning_tree1.swf">http://www.cisco.com/warp/public/473/spanning_tree1.swf</a><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-2522727772889462391?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-65976449054100601822008-12-14T05:15:00.000-08:002008-12-14T05:21:00.369-08:00Finding prim number<pre><br />#include &lt stdio.h&gt<br />#include &lt conio.h&gt<br />#include &lt math.h&gt<br />main()<br />{<br /> int A,B,C=0,D;<br /> printf("Program for finding Prime Number!\n\n\t you enter D=");<br /> scanf("%d",&amp;D);<br /> printf("\nSo, prime number which is less than %d is...\n\n ",D);<br /> printf("2\n");<br /> for(A=3;A<=D;A+=2) { for(B=3;B<=sqrt(A);B+=2) {if(A%B==0) break;} if(B>sqrt(A))<br /> { printf("%d\n",A);<br /> C+=1;<br /> }<br /> <br /> }<br /> <br /> printf("\n\n\t***There are %d.\n\n\n\r",C+1);<br /> getch();<br />}</math.h></conio.h></stdio.h><br /></pre><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-6597644905410060182?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-71799559103207648282008-12-14T01:09:00.001-08:002008-12-14T01:14:47.030-08:00Relational Database Normalization Examples 7/7<b><u>ตัวอย่าง 5.1</u> ตารางที่ยังไม่ทำ normalization</b> (จากเอกสารของผู้ใช้ที่ส่งให้นักวิเคราะห์)<br />เป็นตารางการสั่งซื้อ ให้ท่านลองนำไปทำ normalization<br /><table bg="" align="center" border="0" cellpadding="4" cellspacing="4" style="color:black;"> <tbody><tr bg="" style="color:white;"> <td valign="top"><span style="font-family:fixedsys;">orderid<br />301</span></td> <td valign="top"><span style="font-family:fixedsys;">orderdate<br />15/12/46</span></td> <td valign="top"><span style="font-family:fixedsys;">productid<br />401<br />402</span></td> <td valign="top"><span style="font-family:fixedsys;">quan<br />2<br />5</span></td></tr> <tr bg="" style="color:white;"> <td valign="top"><span style="font-family:fixedsys;">302</span></td> <td valign="top"><span style="font-family:fixedsys;">16/12/46</span></td> <td valign="top"><span style="font-family:fixedsys;">402<br />405<br />406</span></td> <td valign="top"><span style="font-family:fixedsys;">4<br />4<br />1</span></td></tr> </tbody></table><b><u>ตัวอย่าง 5.2</u> ตารางที่ยังไม่ทำ normalization</b> (จากเอกสารของผู้ใช้ที่ส่งให้นักวิเคราะห์)<br />เป็นตารางเงินเดือน ให้ท่านลองนำไปทำ normalization<br /><table bg="" align="center" border="0" cellpadding="4" cellspacing="4" style="color:black;"> <tbody><tr bg="" style="color:white;"> <td valign="top"><span style="font-family:fixedsys;">saleid<br />101<br /><br /><br /><br /><br /></span></td> <td valign="top"><span style="font-family:fixedsys;">salesalary<br />2000</span></td> <td valign="top"><span style="font-family:fixedsys;">saleposition<br />sale</span></td> <td valign="top"><span style="font-family:fixedsys;">custid<br />201<br />202<br />203<br />204</span></td> <td valign="top"><span style="font-family:fixedsys;">custname<br />tom<br />dang<br />boy<br />girl</span></td></tr> </tbody></table><b><u>ตัวอย่าง 5.3</u> ใบเสร็จ 2 ใบ เลขที่ A0001 และ A0002</b> (ให้ท่านลองนำไปทำ normalization)<br />ตัวอย่างนี้ได้รับการเสนอแนะจาก sudomvon@minebea.co.th<br /><table bg="" border="0" cellpadding="4" cellspacing="4" style="color:black;"> <tbody><tr bg="" style="color:white;"><td><pre><span style="font-family:fixedsys;"> Invoice No.: A0001<br /> Date: 24/10/2004<br />Sold to: ABC company<br />Item Quantity UnitPrice Amount<br />Pen 50 3 150<br />Book 100 5 500<br />Ruler 20 2 40<br /> Total 690<br /></span><hr style="color:black;"><br /><span style="font-family:fixedsys;"> Invoice No.: A0002<br /> Date: 24/10/2004<br />Sold to: XYZ company<br />Item Quantity UnitPrice Amount<br />Pen 100 3 300<br />Book 120 5 600<br />Ruler 50 2 100<br /> Total 1000<br /></span></pre></td></tr></tbody></table><b><u>การทำ Normalization ของตัวอย่าง 5.3</u> (ได้รับคำแนะนำจาก <span style="color:red;">อ.อมรทิพย์ rung@yonok.ac.th</span>)</b><br /><ul><pre>การเริ่มต้นทำ normalization ต้องนำข้อมูลมาสร้าง <b>ตารางเริ่มต้น</b> ซึ่งเป็นขั้นตอนก่อนการทำ 1NF<br />โดยไม่เขียน amount และ total เพราะเป็นค่าที่เกิดจากการคำนวณเท่านั้น<br /><span style="font-family:fixedsys;"><u>ตาราง temp</u><br />A0001,24/10/2004,ABC company,Pen,50,3<br />A0001,24/10/2004,ABC company,Book,100,5<br />A0001,24/10/2004,ABC company,Ruler,20,2<br />A0002,24/10/2004,XYZ company,Pen,100,3<br />A0002,24/10/2004,XYZ company,Book,120,5<br />A0002,24/10/2004,XYZ company,Ruler,50,2</span><br /></pre></ul><ul><pre><u><b>การทำ 1NF ของ ตัวอย่าง 5.3</b></u><br />นำตารางเริ่มต้นมาจัดการเรื่อง multivalue เช่น คนชอบกินหลายอย่าง หรือการเพิ่ม key ประกอบข้อมูลที่อาจซ้ำ<br />ตัวอย่างนี้เพิ่มรหัสลูกค้า และรหัสสินค้า เป็น key เพราะคิดว่า ชื่อลูกค้า และชื่อสินค้า อาจมีโอกาสซ้ำกันได้ และไม่เหมาะที่จะเป็น key<span style="font-family:fixedsys;"><br />ตาราง <u>tempoforder</u><br /><u>A0001</u>,24/10/2004,101,ABC company,<u>201</u>,Pen,50,3<br />A0001,24/10/2004,101,ABC company,202,Book,100,5<br />A0001,24/10/2004,101,ABC company,203,Ruler,20,2<br />A0002,24/10/2004,102,XYZ company,201,Pen,100,3<br />A0002,24/10/2004,102,XYZ company,202,Book,120,5<br />A0002,24/10/2004,102,XYZ company,203,Ruler,50,2<br /></span></pre></ul><span style="color: rgb(0, 128, 0);"> </span><ul><pre><span style="color: rgb(0, 128, 0);"><u><b>การทำ 2NF ของ ตัวอย่าง 5.3</b></u><br />แยกตาราง tempoforder เป็นหลายตาราง และทุกตารางมี primary key ที่มีการตรวจสอบการขึ้นตรงอย่างถูกต้อง<span style="font-family:fixedsys;"><br /><span style=";font-family:ms sans serif;color:red;" >primay key คือ รหัสใบสั่งซื้อ</span><br />ตาราง invoid_1<br /><u>A0001</u>,24/10/2004,101,ABC company<br />A0002,24/10/2004,102,XYZ company<br /><span style=";font-family:ms sans serif;color:red;" >primay key คือ รหัสใบสั่งซื้อ และรหัสสินค้า</span><br />ตาราง invoid_2<br /><u>A0001,201</u>,50,3<br />A0001,202,100,5<br />A0001,203,20,2<br />A0002,201,100,3<br />A0002,202,120,5<br />A0002,203,50,2<br /><span style=";font-family:ms sans serif;color:red;" >ตาราง product เพราะราคาขึ้นกับรหัสสินค้า<br />primary key คือ รหัสสินค้า</span><br />ตาราง product<br /><u>201</u>,Pen,3<br />202,Book,5<br />203,Ruler,2<br /></span><br /></span></pre></ul><span style="color: rgb(0, 0, 128);"> </span><ul><pre><span style="color: rgb(0, 0, 128);"><u><b>การทำ 3NF ของ ตัวอย่าง 5.3</b></u><span style="font-family:fixedsys;"><br /><span style=";font-family:ms sans serif;color:red;" >ตาราง invoid_1 เพราะชื่อลูกค้าไม่ขึ้นกับรหัสใบสั่งซื้อ จึงต้องแยกไปทำตาราง customer<br />primay key คือ รหัสใบสั่งซื้อ</span><br />ตาราง invoid_1<br /><u>A0001</u>,24/10/2004,101<br />A0002,24/10/2004,102<br /><span style=";font-family:ms sans serif;color:red;" >ตาราง customer เพราะชื่อลูกค้าไม่ขึ้นกับ รหัสใบสั่งซื้อ แต่ขึ้นกับรหัสลูกค้า<br />primay key คือ รหัสลูกค้า</span><br />ตาราง customer<br /><u>101</u>,ABC company<br />102,XYZ company<br /><span style=";font-family:ms sans serif;color:red;" >primay key คือ รหัสใบสั่งซื้อ และรหัสสินค้า เพราะ ปริมาณ และราคาต้องขึ้นกับ key 2 ตัวนี้</span><br />ตาราง invoid_2<br /><u>A0001,201</u>,50,3<br />A0001,202,100,5<br />A0001,203,20,2<br />A0002,201,100,3<br />A0002,202,120,5<br />A0002,203,50,2<br /><span style=";font-family:ms sans serif;color:red;" >ตาราง product เพราะราคาขึ้นกับรหัสสินค้า<br />primary key คือ รหัสสินค้า</span><br />ตาราง product<br /><u>201</u>,Pen,3<br />202,Book,5<br />203,Ruler,2<br /></span><br /></span></pre></ul><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-7179955910320764828?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-45291471601135940342008-12-14T01:07:00.000-08:002008-12-14T01:14:27.435-08:00Relational Database Normalization 6/7<b>ขั้นตอนการ Normalization</b><ul><span style="color:blue;">5.1 เปลี่ยนตารางที่ยังไม่เคย Normalization เป็น First Normal Form หรือ 1NF</span><dd>วิธีพิจารณา คือ <b>แยกข้อมูลเป็นระเบียน โดยไม่มีการจัดกลุ่ม </b> <table width="80%" align="center"><tbody><tr><td valign="top" align="center"> <table bg="" border="0" cellpadding="4" cellspacing="1" style="color:black;"> <tbody><tr bg="" style="color:black;"><td colspan="4"><span style="color:white;"><b>ตารางที่ไม่ผ่านการ normalization</b> </span></td></tr><tr bg="" style="color:white;"> <td valign="top"><span style="font-family:fixedsys;">orderid<br />305</span></td> <td valign="top"><span style="font-family:fixedsys;">orderdate<br />31/01/47</span></td> <td valign="top"><span style="font-family:fixedsys;">productid<br />432<br />455<br />467</span></td> <td valign="top"><span style="font-family:fixedsys;">quan<br />20<br />2<br />1</span></td></tr> </tbody></table> </td><td valign="top"> <table bg="" style="color: rgb(0, 0, 128);" border="0" cellpadding="4" cellspacing="1"> <tbody><tr bg="" style="color:black;"><td colspan="4"><span style="color:white;"><b>ตารางที่ผ่านการ normalization ในระดับ 1NF</b> </span></td></tr><tr bg="" style="color:white;"><td valign="top"><span style="font-family:fixedsys;">orderid</span></td> <td valign="top"><span style="font-family:fixedsys;">orderdate</span></td> <td valign="top"><span style="font-family:fixedsys;">productid</span></td> <td valign="top"><span style="font-family:fixedsys;">quan</span></td></tr> <tr bg="" style="color:white;"><td valign="top"><span style="font-family:fixedsys;">305</span></td> <td valign="top"><span style="font-family:fixedsys;">31/01/47</span></td> <td valign="top"><span style="font-family:fixedsys;">432</span></td> <td valign="top"><span style="font-family:fixedsys;">20</span></td></tr> <tr bg="" style="color:white;"><td valign="top"><span style="font-family:fixedsys;">305</span></td> <td valign="top"><span style="font-family:fixedsys;">31/01/47</span></td> <td valign="top"><span style="font-family:fixedsys;">455</span></td> <td valign="top"><span style="font-family:fixedsys;">2</span></td></tr> <tr bg="" style="color:white;"><td valign="top"><span style="font-family:fixedsys;">305</span></td> <td valign="top"><span style="font-family:fixedsys;">31/01/47</span></td> <td valign="top"><span style="font-family:fixedsys;">467</span></td> <td valign="top"><span style="font-family:fixedsys;">1</span></td></tr> </tbody></table> </td></tr></tbody></table><br /><br /><span style="color:blue;">5.2 เปลี่ยนจาก 1NF เป็น 2NF(Second Normal Form) คือการเปลี่ยนตารางที่มีปัญหา 4 ประการ</span> </dd><dd>วิธีพิจารณาเปลี่ยน 1NF เป็น 2NF คือ <b>ไม่มี non key ตัวใด ไม่สัมพันธ์กับ primary key (ให้พิจารณาเฉพาะ non key และ primary key)</b> </dd><dd>สิ่งที่ได้จากตาราง 1 ตาราง จะแตกออกมาเป็นหลายตาราง </dd><dd> 5.2.1 แก้ไขข้อมูล ต้องแก้หลายระเบียน </dd><dd> 5.2.2 มีข้อมูลเดียวกันในหลายระเบียน อาจขัดแย้งกันได้ </dd><dd> 5.2.3 การเพิ่มข้อมูลทำได้ยาก </dd><dd> 5.2.4 การลบข้อมูลทำได้ยาก<br />ท่านลองพิจารณา Schema ของตารางนี้ว่าจะแยกได้กี่ตาราง<br />จาก <b>orderid,custid,custname,date,proid,proname,price,quantity,categoryid,categoryname</b><br />เป็น orders (orderid,custid,custname,date,proid,proname,price,quantity)<br />เป็น categories (categoryid,categoryname)<br />เหตุที่แยก categories ออกมา เพราะ categoryid ไม่สัมพันธ์กับ orderid แต่สัมพันธ์กับ proid โดยตรง จึงต้องแยกออกมา<br /><br /><span style="color:blue;">5.3 เปลี่ยนจาก 2NF เป็น 3NF(Third Normal Form) คือแก้ปัญหายังไม่หมด อาจยังมีข้อมูลที่มีปัญหาอีก จึงต้องทำ 3NF</span> </dd><dd>วิธีพิจารณาเปลี่ยน 2NF เป็น 3NF คือ <b>ไม่มี non key ตัวใด ขึ้นอยู่กับ non key ตัวอื่นใน entity เดียวกัน (ให้พิจารณาเฉพาะ non key และ non key)</b><br />จาก <b>orders (orderid,custid,custname,date,proid,proname,price,quantity)</b><br />เป็น orders (orderid,custid,date)<br />เป็น customers (custid,custname)<br />เป็น order details (orderid,proid,price,quantity)<br />เป็น products (proid,proname) </dd></ul><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-4529147160113594034?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-27783576765347136842008-12-14T01:06:00.001-08:002008-12-14T01:15:28.382-08:00Relational Database Design 5/7<ul><b>4. ขั้นตอนการเขียน ER model</b><ul><br /><b>4.1 กำหนด Entity type</b> โดยกำหนดมาจากความต้องการของผู้ใช้ระบบ ว่าจะให้มี Entity สำหรับเก็บข้อมูลอะไรบ้าง <ul><br />เอนติตี้(Entity) อาจเรียกว่า file หรือ table<br />4.1.1 Strong entity คือเกิดขึ้นด้วยตนเองไม่ขึ้นกับ entity ใด เช่น <span style="color:red;">นักศึกษา หรืออาจารย์ หรือสินค้า</span> เป็นต้น<br />4.1.2 Weak entity คือขึ้นโดยอาศัย entity อื่น เช่น <span style="color:red;">เกรดเฉลี่ย ที่มาจากแฟ้มผลการเรียน หรือ แฟ้มลงทะเบียน หรือ แฟ้มสั่งซื้อ</span> เป็นต้น <dd>:: สิ่งต่าง ๆ ที่ผู้ใช้งานฐานข้อมูลจะต้องยุ่งเกี่ยวด้วย เช่น คน แผนก ประเภท การสั่งซื้อ เป็นต้น </dd><dd><span style="color:blue;">Entities are the principal data object about which information is to be collected. Entities are usually recognizable concepts, either concrete or abstract, such as person, places, things, or events which have relevance to the database. Some specific examples of entities are EMPLOYEES, PROJECTS, INVOICES. An entity is analogous to a table in the relational model.</span> </dd><dd><img src="http://www.thaiall.com/learn/sader11.gif" border="0" /> </dd></ul><br /><b>4.2 กำหนดความสัมพันธ์ (Relationship type)</b> ที่เกิดขึ้นระหว่าง entity ในลักษณะของกริยา <ul><b>ดีกรีของความสัมพันธ์(Degree of relation) มี 4 แบบ </b><br />4.2.1 Unary relationship คือความสัมพันธ์ภายใน entity เดียวกัน เช่นแต่งงานของพนักงาน แต่ถ้ามีระดับแบบลูกน้อง หัวหน้าจะเรียก Recursive relationship(Unary)<br />4.2.2 Binary relationship คือความสัมพันธ์แบบสอง entity<br />4.2.3 Ternary relationship คือความสัมพันธ์แบบสาม entity<br />4.2.4 Quaternary relationship คือความสัมพันธ์แบบสี่ entity<br /><img src="http://www.thaiall.com/learn/sader12.gif" border="0" /></ul><br /><b>4.3 กำหนดแอททริบิวท์ (Attribute) ของแต่ละเอนติตี้</b><ul><dd>:: แอททริบิวท์(Attibute) อาจเรียก field หรือ column คือ สิ่งที่ใช้อธิบายคุณสมบัติของเอนติตี้ เช่นคุณสมบัติของคน ก็มี รหัส ชื่อ อายุ เพศ เป็นต้น </dd><dd>Attributes describe the entity of which they are associated. A particular instance of an attribute is a value. For example, "Jane R. Hathaway" is one value of the attribute Name. The domainof an attribute is the collection of all possible values an attribute can have. The domain of Name is a character string.<br /><img src="http://www.thaiall.com/learn/sader01.gif" /> </dd><dd>A key is the attribute or set of attributes which allow to identify each unique instance of an entity. So no two instances of an entity have or ever can have the same key value. These keys are called <b>candidate keys</b>. (รหัสนักศึกษา กับรหัสบัตรประชาชน) </dd><dd>Often we have different attributes or combinations of attributes which can serve as key. One key will be choosen and indicated as main key. It is called the <b>primary key</b>. The other keys are the <b>alternate keys</b>. The primary key is often the shortest possible and is the most unlikely to change. </dd><dd>The <b>primary key</b> is indicated by underlining the name of attributes which form the primary key. In this case the attribute 'Code' has beed underlined. </dd><dd>The roof, body and trim of a same car can have different colors. The attribute 'color' is called a <b>multivalued attribute</b>. This type of attribute is represented with a double line. (นักศึกษา 1 คนลงได้หลายวิชา) </dd><dd>The 'age' attribute, indicated with the slashed line, is a <b>derived attribute</b>. It can be computed from the year and the present date. (เกรดเฉลี่ยของนักศึกษา)<br /><img src="http://www.thaiall.com/learn/sader03.gif" /><br /><img src="http://www.thaiall.com/learn/sader04.gif" /> </dd><dd><u><b>คำต่าง ๆ ที่ควรทราบ</b></u> </dd><dd>- <b>คีย์หลัก (Primary key)</b> :: คีย์หลักประจำแฟ้ม <ul><ol><b>คุณสมบัติของคีย์หลัก</b><li>ข้อมูลของแอททริบิวท์มีความเป็นหนึ่งเดียว(Uniqueness) กล่าวคือทุก ๆ แถวของตารางจะต้องไม่มีข้อมูลของแอททริบิวท์ที่เป็นคีย์หลักซ้ำกันเลย </li><li>ต้องประกอบด้วยจำนวนแอททริบิวท์ที่น้อยที่สุด(Minimality) ที่จะสามารถใช้เจาะจง หรืออ้างอิงถึงแถวใดแถวหนึ่งในรีเลชันได้ </li></ol></ul> </dd><dd>- <b>คีย์คู่แข่ง (Candidate key)</b> :: คีย์ที่สามารถเป็น Primary key ได้ เช่น รหัสบัตรประชาชน หรือรหัสผู้เสียภาษี </dd><dd>- <b>คีย์สำรอง (Alternate key)</b> :: คีย์ตัวอื่น ๆ ในตารางหลังจากเลือก primary key แล้ว </dd><dd>- <b>คีย์นอก (Foreign key)</b> :: คีย์ตัวอื่น ๆ ในตารางหลังจากเลือก primary key แล้ว </dd><dd>- <b>คีย์ร่วม (Composite key)</b> :: สามารถแยกออกไปได้อีก เช่น ที่อยู่ </dd><dd>- <b>Composite attibute</b> :: สามารถแยกออกไปได้อีก เช่น ที่อยู่ </dd><dd>- <b>Atomic attibute</b> :: ไม่สามารถแยกออกไปได้อีก เช่น นามสกุล </dd><dd>- <b>Multivalued attibute</b> :: อาจมีหลายค่าได้ เช่น สีรถ </dd><dd>- <b>Derived attibute</b> :: ไม่มีค่าแน่นอนของตน แต่ขึ้นกับค่าอื่น เช่นอายุ ขึ้นกับปีเกิด และปีปัจจุบัน </dd><dd>- <b>Entity type</b> :: ชื่อของ entity เช่น <b>course</b> (courseno,coursename) </dd><dd>- <b>Entity instance</b> :: ค่าภายในของ entity เช่น <b>bcom101,Introduction to computer</b> </dd></ul><br /><b>4.4 คาร์ดินัลลิตี้ และปาร์ติซิเปชั่นของความสัมพันธ์ (Cardinality and participation of relationship)</b><ul><b>4.4.1 คาร์ดินัลลิตี้ของความสัมพันธ์(Cardinality of Relationship)</b><ol>:: แต่ละเอนติตี้มีความสัมพันธ์ต่อกัน โดยมีคำกริยามาเชื่อมระหว่างแต่ละเอนติตี้ <li>One-to-one relationship ความสัมพันธ์แบบ 1 ต่อ 1 <dd>เช่น คนขับกับรถ หรือครูใหญ่กับโรงเรียน เป็นต้น </dd></li><li>One-to-many relationship ความสัมพันธ์แบบ 1 ต่อหลายข้อมูล <dd>เช่น ลูกค้ากับหมายเลขโทรศัพท์มือถือ หรือ อาจารย์ที่ปรึกษากับนักเรียน </dd></li><li>Many-to-many relationship ความสัมพันธ์แบบหลายข้อมูล ต่อหลายข้อมูล <dd>เช่น นักเรียนกับวิชาที่ลงทะเบียน หรือ คนงานกับโครงการสร้างบ้าน<br /><img src="http://www.thaiall.com/learn/sader02.gif" /> </dd></li></ol><br /><b>4.4.2 ปาร์ติซิเปชั่นของความสัมพันธ์ (Participation of relationship)</b><dd>:: ความสัมพันธ์ระหว่าง entity </dd><dd>1. Total หรือ Mandatory participation (ต้องมี จะใช้เส้นคู่) </dd><dd>2. Partial หรือ Optional participation (เลือกได้ จะใช้เส้นเดียว) </dd></ul></ul></ul><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-2778357676534713684?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-66128579776270371162008-12-14T01:05:00.001-08:002008-12-14T01:15:38.271-08:00Relational Database ER Model 4/73. ER model (Entity-Relationship Model)<br /> :: เสนอครั้งแรกโดย ปีเตอร์(Chen,1976 - 2519) เป็นเครื่องมือนำเสนอโครงสร้างของฐานข้อมูลใน ระดับความคิด(Conceptual level) ออกมาในลักษณะของแผนภาพ(Diagram) ที่ง่ายต่อความเข้าใจ เพื่อสื่อความหมายระหว่างนักออกแบบฐานข้อมูล และผู้ใช้ เกี่ยวกับ ความสัมพันธ์ของเอนติตี้(Entity) กับเอนติตี้(Entity) และเอนติตี้(Entity) กับ แอททริบิวท์(Attibute)<br /> From: http://www.utexas.edu/cc/database/datamodeling/dm/erintro.html<br /> The Entity-Relationship (ER) model was originally proposed by Peter in 1976 [Chen76] as a way to unify the network and relational database views. Simply stated the ER model is a conceptual data model that views the real world as entities and relationships. A basic component of the model is the Entity-Relationship diagram which is used to visually represents data objects. Since Chen wrote his paper the model has been extended and today it is commonly used for database design For the database designer, the utility of the ER model is:<br /> - It maps well to the relational model. The constructs used in the ER model can easily be transformed into relational tables.<br /> - It is simple and easy to understand with a minimum of training. Therefore, the model can be used by the database designer to communicate the design to the end user.<br /> - In addition, the model can be used as a design plan by the database developer to implement a data model in a specific database management software.<br /><br /> From: http://itprojmngt.8m.net/softdev/analysis/erd/erd.html<br /> The goal of Entity Relationship Modeling Technique is to discover and represent the relations between groups of information elements. The method will list the information which is essential for the application and/or organization, structure and describe this information. The results will serve to design the databases. The resulting drawing is never finished. It will evolve together with the information which is managed by the application or/and which serves the business purposes.<br /><br /> ส่วนประกอบของ ER model<br /> - เอ็นติตี้ (Entity)<br /> - แอททริบิวท์ (Attribute)<br /> - ความสัมพันธ์ระหว่างเอ็นติตี้ (Relationship)<br /> - ดีกรีของความสัมพันธ์ (Degree of a relation)<br /><br /> ขั้นตอนการเขียน ER model<br /> 3.1 สร้าง entity ขึ้นมาจากความต้องการของผู้ใช้<br /> 3.2 สร้างความสัมพันธ์(Relation) ระหว่าง entity<br /> 3.3 พิจารณา key ของแต่ละ entity<br /> 3.4 พิจารณาคุณสมบัติของ entity แต่ละตัว<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-6612857977627037116?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-36383603713404277332008-12-14T01:04:00.000-08:002008-12-14T01:16:04.440-08:00Relational Database Design 3/72. ขั้นตอนเกี่ยวกับการออกแบบฐานข้อมูล<br /> 2.1 เปลี่ยนความต้องการของผู้ใช้เป็น ER model หรือ Relational model<br /> 2.1.1 โมเดลแบบ ER model (Entity-Relationship Model)<br /> - เอ็นติตี้ (Entity)<br /> - แอททริบิวท์ (Attribute)<br /> - ความสัมพันธ์ระหว่างเอ็นติตี้ (Relationship)<br /> - ดีกรีของความสัมพันธ์ (Degree of a relation)<br /> 2.1.2 โมเดลเชิงสัมพันธ์ (Relational model)<br /> - รีเลชัน (Relation) หรือ Table หรือ file<br /> - ทูเพิล (Tuple) หรือ Row หรือ Record<br /> - แอททริบิวท์ (Attribute) หรือ Column หรือ Field<br /> 2.2 การทำนอร์มัลไลซ์ (Normalization)<br /> 2.3 กำหนดคุณสมบัติของเขตข้อมูลแต่ละตัว<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-3638360371340427733?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-67784639683428794982008-12-14T01:03:00.000-08:002008-12-14T01:16:21.520-08:00Relational Databse Schema Example 2/7<b>ตัวอย่างของ Relation schema ของ </b> <span style="font-size:6;">Northwind</span> <ol><li><b>Categories</b> (<u>CategoryID</u>,CategoryName,Description,Picture) </li><li><b>Customers</b> (<u>CustomerID</u>,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax) </li><li><b>Employees</b> (<u>EmployeeID</u>,LastName,FirstName,Title,BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Photo,Notes,ReportsTo) </li><li><b>Products</b> (<u>ProductID</u>,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) </li><li><b>Shippers</b> (<u>ShipperID</u>,CompanyName,Phone) </li><li><b>Suppliers</b> (<u>SupplierID</u>,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax,Homepage) </li><li><b>Orders</b> (<u>OrderID</u>,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry) </li><li><b>Order Details</b> (<u>OrderID</u>,ProductID,UnitPrice,Quantity,Discount)<br /><br /><b>ตารางข้างล่างนี้คือ ตารางแสดงความสัมพันธ์ที่ใช้โปรแกรม Microsoft access สร้างขึ้น</b><br /><img src="http://www.thaiall.com/learn/sader06.gif" /> </li></ol><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-6778463968342879498?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-33530982431494083242008-12-14T01:01:00.000-08:002008-12-14T01:16:47.829-08:00Relational Database Design 1/7<ul><b>สถาปัตยกรรมฐานข้อมูล(Database architecture) 3 ระดับ</b>(Three-level architecture) :: <dd><span style="color:blue;">1.1 ระดับภายนอก (External level)</span> <ul><dd>มาจากแบบฟอร์มเอกสาร ว่ามีอะไรในเอกสารบ้าง หรือจากผู้ใช้ที่แต่ละคน </dd><dd>เป็นการรวบรวมข้อมูลอย่างง่าย ๆ จากผู้ใช้ เพื่อให้กับนักวิเคราะห์นำไปศึกษา </dd><dd>ผู้ใช้คนที่หนึ่ง : (<b>รหัส, ชื่อ</b>) </dd><dd>ผู้ใช้คนที่สอง : (<b>รหัส, ที่อยู่</b>)</dd></ul> </dd><dd><span style="color:blue;">1.2 ระดับความคิด (Conceptual level)</span> <ul><dd>ตีความออกมาเป็นตารางโดยนำแบบฟอร์มต่าง ๆ มารวมกัน เพื่อแสดงความต้องการของผู้ใช้ในรูปที่สมบูรณ์ </dd><dd>อาจมีการวิเคราะห์ และออกแบบโดยผ่านขั้นตอนมากมาย ทั้ง E-R หรือ Normalization จนเสร็จสิ้น </dd><dd><b>พนักงาน (รหัส, ชื่อ, ที่อยู่)</b> ในแบบสคีมา(Schema)</dd><dd>หรือ</dd><dd><b>person (id, name, address)</b> ในแบบสคีมา(Schema)</dd></ul> </dd><dd><span style="color:blue;">1.3 ระดับภายใน (Internal level)</span> <ul><dd>ตีความในระดับการจัดเก็บข้อมูลจริง เป็นหน้าที่ของผู้ออกแบบอย่างแท้จริง </dd><dd><b>struct person{ </b></dd><dd><b> int id; </b></dd><dd><b> char name[20]; </b></dd><dd><b> char address[20] </b></dd><dd><b>} index id;</b></dd></ul></dd><dt>source : http://www.thaiall.com<br /></dt></ul><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-3353098243149408324?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-68762350498580028602008-12-03T07:52:00.000-08:002008-12-03T07:53:35.533-08:00Education Resources Information Center<a href="http://eric.ed.gov/">http://eric.ed.gov/</a><br /><br />E<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-6876235049858002860?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-54738476182321358382008-12-02T05:37:00.000-08:002008-12-02T05:39:20.996-08:00วิธีแสดงภาษาไทย บน command prompt vista<table id="table1" width="100%" border="0" cellspacing="1"><tbody><tr><td><span class="styleorange"><< การตั้งค่าให้ดอสพร็อมพ์ในวินโดวส์ 2000/XP/2003 ให้ใช้ภาษาไทยได้ >></span></td> </tr> <tr> <td><span class="style2"> <span class="style13" style="color:#000080;">เขียนโดย คุณ ทัชชี่ </span></span></td> </tr> <tr> <td> </td> </tr> <tr> <td class="style13"><span class="style2"> โดยปกติแล้ว เราจะไม่สามารถใช้ภาษาไทยใน DOS BOX บนวินโดวส์ 2000 ขึ้นไป ไม่ได้เลย อ่านก็ไม่ได้ เขียนแล้วก็อ่านไม่รู้เรื่อง จะเปลี่ยนฟอนต์เป็นฟอนต์ที่มีภาษาไทยก็ไม่ได้อีก ดังนั้นมันต้องมีอะไรแน่ๆครับ<br /> <br />ผมเคยไปอ่านเจอวิธีแก้ปัญหานี้ใน Technet ของ Microsoft แต่มันเป็นวิธีแก้ปัญหาของคนในประเทศอื่นๆที่ไม่ได้มีลักษณะภาษาแบบภาษาไทย (ที่มันต้องมีสระบนสระล่างนี่แหล่ะครับ) ซึ่งลักษณะการแก้ปัญหาก็คล้ายๆกัน ผมจึงได้ลองประยุกต์ใช้ดู<br /> <br /> ปกติเราจะเห็นดอสของวินโดวส์ 2000/XP หน้าตาเป็นแบบนี้<br /> <br /> <img src="http://justusers.net/articles/others/thaidosxp/image01.png" width="358" border="0" height="126" /><br /> <br /> แล้วเราต้องการเปลี่ยนเป็นแบบนี้<br /> <br /> <img src="http://justusers.net/articles/others/thaidosxp/image02.png" width="381" border="0" height="157" /><br /> <br /> <br /> ผมมี 2 ตัวเลือกให้คุณเลือก คือ<br /> 1) สำหรับมือใหม่<br /> 2) สำหรับมือเก่า<br /> <br /> <br /> 1. มือใหม่อ่านที่นี่ครับ ส่วนมือเก่า ข้ามไปอ่านหัวข้อถัดไปได้เลยครับ<br /> <br /> 1.1 ก่อนอื่นไปดาวน์โหลดไฟล์นี้มาก่อนครับ<br /> <br /><a href="http://www.thaikore.com/forum/index.php?act=attach&amp;type=post&amp;id=609"> <span style="text-decoration: underline;">http://www.thaikore.com/forum/index.php?act=attach&amp;type=post&amp;id=609</span></a><br /> <br /> แล้วก็มาแตกไฟล์ (Unzip) จะเห็นได้ว่ามีไฟล์ทั้งหมด 4 ไฟล์ ตามภาพนะครับ<br /> <br /> <img src="http://justusers.net/articles/others/thaidosxp/image03.png" width="206" border="0" height="109" /><br /> <br /> 1.2 ให้ติดตั้งฟอนต์ Courier MonoThai ดังนี้<br /> <br /> - คลิก Start >> Run แล้วพิมพ์ในช่องว่า fonts<br /> - คลิกที่ไฟล์ <b>courmon.ttf</b> แล้วลากมาใส่โฟลเดอร์ fonts<br /> <br /> 1.3 ดับเบิลคลิกไฟล์ Registry ทั้ง 3 ไฟล์ เพื่อ Import เข้าไปใน Registry ของระบบ<br /> <br /> 1.4 Restart เครื่อง 1 ครั้ง<br /> <br /> 1.5 คลิก <b>Start >> Programs >> Accessories >> Command Prompt</b> แล้วคลิกตามภาพนี้<br /> <br /> <img src="http://justusers.net/articles/others/thaidosxp/image09.jpg" width="502" border="0" height="404" /><br /> <br /> 1.6 จากในภาพ ผมแนะนำให้ตั้งค่าขนาดฟอนต์เป็นขนาด 18 – 20 นะครับ เพื่อความคมชัด<br /> <br /> 1.7 หลังจากนั้นก็ลองใช้ดูได้เลยครับ<br /> <br /> <br /> 2. สำหรับมือเก่าอ่านตรงนี้ครับ<br /> <br /> 2.1 ดาวน์โหลดไฟล์ในข้อ 1.1 มานะครับ แล้วติดตั้งฟอนต์ให้เรียบร้อย<br /> <br /> 2.2 สั่งรันโปรแกรม <b>regedit.exe</b> แล้วเข้าไปแก้ไขในส่วนต่างๆ ดังนี้<br /> <br /> <span style="color:#0000ff;"><b> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\Nls</b></span> ให้เพิ่มข้อมูลชนิด String ชื่อ "<span style="color:#0000ff;"><b>0000041e</b></span>"<br /> <br /> <b><span style="color:#0000ff;"> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont</span> </b>ให้เพิ่มข้อมูลชนิด String ชื่อ "<b>874</b>" มีข้อมูลภายในคือ "<span style="color:#0000ff;"><b>Courier MonoThai</b></span>"<br /> <br /> <span style="color:#0000ff;"><b> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MS-DOS Emulation\Font</b></span> ให้เปลี่ยนข้อมูลชนิด String ที่ชื่อ "<b>font</b>" ให้เป็น "<span style="color:#0000ff;"><b>Courier MonoThai</b></span>"<br /> <br /> <span style="color:#0000ff;"><b> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybCodes</b></span> ให้เพิ่มข้อมูลชนิด String ชื่อต่อไปนี้<br /> <br />"<span style="color:#0000ff;"><b>0000041E</b></span>" มีข้อมูลภายในเป็น "<b>th</b>"<br /> <br />"<span style="color:#0000ff;"><b>0001041E</b></span>" มีข้อมูลภายในเป็น "<b>th</b>"<br /> <br />"<span style="color:#0000ff;"><b>0002041E</b></span>" มีข้อมูลภายในเป็น "<b>th</b>"<br /> <br />"<span style="color:#0000ff;"><b>0003041E</b></span>" มีข้อมูลภายในเป็น "<b>th</b>"<br /> <br /> 2.3 สั่ง Restart เครื่อง 1 ครั้ง<br /> <br /> 2.4 เข้ามากำหนดค่าต่างๆตามรูป 1.5 ครับ<br /> <br /> 2.5 ทีนี้ก็จะสามารถใช้งานได้แล้วครับ</span></td></tr></tbody></table><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-5473847618232135838?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-21990602518051727682008-11-25T08:13:00.000-08:002008-11-25T08:50:28.378-08:00Config switch vtp modeสวัสดีครับ เทอมนี้ได้เรียน datacom 2 เป็นเรื่องเครือข่าย โดยเฉพาะ Lab ได้ config siwtch , router....<br /><br /><br />เข้าเรื่องกันเลยดีกว่าครับ<br /><br />สำหรับการทำ vtp บน switch การทดลองนี้ผมใช้ CCNA Network Visualizer<br />ก่อนอื่นก็ทำการเชื่อมต่อ switch และ host แล้วกำหนด IP ให้กับ host ดังรูป<br />ในการทดลองนี้ผมให้<br />vlan1 ip 127.2.145.0<br />vlan2 ip 192.2.146.0<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_kES3xlANtrU/SSwonoqWg2I/AAAAAAAAAPg/LZJsKCBIWOs/s1600-h/lab2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 544px; height: 367px;" src="http://3.bp.blogspot.com/_kES3xlANtrU/SSwonoqWg2I/AAAAAAAAAPg/LZJsKCBIWOs/s400/lab2.jpg" alt="" id="BLOGGER_PHOTO_ID_5272633925139071842" border="0" /></a><br />เสร็จแล้วก็จะทำการ แบ่ง vlan บน switch ทั้งสองตัวกัน<br />โดยตัวแรก ก็จะมี 2 vlan ตัวที่ 2 ก็จะมี 2 vlan เช่นกัน<br />โดยใช้คำสั่งต่อไปนี้<br /><br /><br /><br /><br /><br />switch Con0 is now available<br /><br /><br /><br />Press RETURN to get started!<br /><br /><br /><br />switch>enable<br />switch#vlan database<br />switch(vlan)#vlan 2 name VLAN1<br />VLAN 2 modified:<br /> Name: VLAN1<br />switch(vlan)#vlan 2 name VLAN2<br />VLAN 2 modified:<br /> Name: VLAN2<br />switch(vlan)#exit<br />APPLY completed.<br />Exiting....<br />switch#<br /><br /><br />ที่นี้ก็ลอง แสดง vlan ที่เราสร้างไว้<br /><br /><br /><br /><br />switch Con0 is now available<br /><br /><br /><br />Press RETURN to get started!<br /><br /><br /><br />switch>enable<br />switch#vlan database<br />switch(vlan)#vlan 2 name VLAN1<br />VLAN 2 modified:<br /> Name: VLAN1<br />switch(vlan)#vlan 2 name VLAN2<br />VLAN 2 modified:<br /> Name: VLAN2<br />switch(vlan)#end<br /> ^<br />% Invalid input detected at '^' marker.<br />switch(vlan)#exit<br />APPLY completed.<br />Exiting....<br />switch#config t<br />Enter configuration commands, one per line. End with CNTL/Z<br />switch(config)#vtp ?<br /> domain Set the name of the VTP administrative domain.<br /> file Configure IFS filesystem file where VTP configuration is stored.<br /> interface Configure interface as the preferred source for the VTP IP updater<br /> address.<br /> mode Configure VTP device mode<br /> password Set the password for the VTP administrative domain<br /> pruning Set the adminstrative domain to permit pruning<br /> version Set the adminstrative domain to VTP version<br /><br />switch(config)#vtp ?<br /> domain Set the name of the VTP administrative domain.<br /> file Configure IFS filesystem file where VTP configuration is stored.<br /> interface Configure interface as the preferred source for the VTP IP updater<br /> address.<br /> mode Configure VTP device mode<br /> password Set the password for the VTP administrative domain<br /> pruning Set the adminstrative domain to permit pruning<br /> version Set the adminstrative domain to VTP version<br /><br />switch(config)#vtp mode server<br />Device mode already VTP SERVER.<br />switch(config)#exit<br />switch#sh vlan<br /><br />VLAN Name Status Ports<br />---- -------------------------------- --------- -------------------------------<br />1 default active Fa0/1, Fa0/2,Fa0/3, Fa0/4, Fa0/5, Fa0/6<br /> Fa0/7, Fa0/8, Fa0/9, Fa0/10<br /> Fa0/11, Fa0/12<br />2 VLAN2 active <br />3 vlan2 active <br />1002 fddi-default active<br />1003 token-ring-default active<br />1004 fddinet-default active<br />1005 trnet-default active<br /><br />VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2<br />---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------<br />1 enet 100001 1500 - - - - - 0 0<br />2 enet 100002 1500 - - - - - 0 0<br />3 enet 100003 1500 - - - - - 0 0<br />1002 fddi 101002 1500 - - - - - 0 0<br />1003 tr 101003 1500 - - - - - 0 0<br />1004 fdnet 101004 1500 - - - ieee - 0 0<br />1005 trnet 101005 1500 - - - ibm - 0 0<br /><br />Remote SPAN VLANs<br />------------------------------------------------------------------------------<br /><br /><br />Primary Secondary Type Ports<br />------- --------- ----------------- ------------------------------------------<br /><br /><br />switch#<br /><br />เพิ่ม port เข้าไปใน แต่ละ vlan<br /><br /><br />switch(config)#interface fastethernet 0/1<br />switch(config-if)#switchport mode access<br />switch(config-if)#switchport access vlan 2<br />switch(config-if)#exit<br />switch(config)#interface fastethernet 0/2<br />switch(config-if)#switchport mode access<br />switch(config-if)#switchport access vlan 2<br />switch(config-if)#exit<br />switch(config)#interface fastethernet 0/3<br />switch(config-if)#switchport mode access<br />switch(config-if)#switchport access vlan 3<br />switch(config-if)#exit<br />switch(config)#interface fastethernet 0/4<br />switch(config-if)#switchport mode access<br />switch(config-if)#switchport access vlan 3<br />switch(config-if)#exit<br />switch(config)#exit<br />switch#sh vlan<br /><br />VLAN Name Status Ports<br />---- -------------------------------- --------- -------------------------------<br />1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8<br /> Fa0/9, Fa0/10, Fa0/11, Fa0/12<br />2 VLAN2 active Fa0/1, Fa0/2<br />3 vlan2 active Fa0/3, Fa0/4<br />1002 fddi-default active<br />1003 token-ring-default active<br />1004 fddinet-default active<br />1005 trnet-default active<br /><br />VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2<br />---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------<br />1 enet 100001 1500 - - - - - 0 0<br />2 enet 100002 1500 - - - - - 0 0<br />3 enet 100003 1500 - - - - - 0 0<br />1002 fddi 101002 1500 - - - - - 0 0<br />1003 tr 101003 1500 - - - - - 0 0<br />1004 fdnet 101004 1500 - - - ieee - 0 0<br />1005 trnet 101005 1500 - - - ibm - 0 0<br /><br />--More--<br /><br />เสร็จแล้วก็ config ที่ switch ตัวที่ 2 ทำเหมือนกันกับตัวที่ 1<br /><br />ต่อไปจะ config vpt<br /><br /><br /><br />switch(config)#vtp mode server<br />Device mode already VTP SERVER.<br />switch(config)#vtp domain server1<br />Changing VTP domain name from NULL to server1<br />switch(config)#exit<br />switch#sh vtp status<br />VTP Version : 2<br />Configuration Revision : 4<br />Maximum VLANs supported locally : 64<br />Number of existing VLANs : 8<br />VTP Operating Mode : Server<br />VTP Domain Name : server1<br />VTP Pruning Mode : Disabled<br />VTP V2 Mode : Disabled<br />VTP Traps Generation : Disabled<br />MD5 digest : 0x70 0x01 0xF2 0x72 0x97 0xA1 0x35 0xEB<br />Configuration last modified by: 0.0.0.0 at 11-29-93 20:39:24<br />Local updater ID is 0.0.0.0 on interface Vl1 (lowest numbered VLAN interface<br />found)<br />switch#<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-2199060251805172768?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-31707360652408214062008-11-14T21:36:00.001-08:002008-11-14T21:36:51.881-08:00Remove element array in php<pre><br /><br /><?php<br /><br />////////////////////////////////// Lists(Numerical Arrays) /////////////////////////////////<br /><br />/**<br /><br /> * A small function to remove an element from a list(numerical array)<br /><br /> * Arguments: $arr - The array that should be edited<br /><br /> * $value - The value that should be deleted.<br /><br /> * Returns : The edited array<br /><br /> */<br /><br />function array_remove($arr,$value) {<br /><br /> return array_values(array_diff($arr,array($value)));<br /><br />}<br /><br /><br /><br />////////////////////////////////// Associative Arrays //////////////////////////////////////<br /><br />/**<br /><br /> * This function will remove all the specified keys from an array and return the final array.<br /><br /> * Arguments : The first argument is the array that should be edited<br /><br /> * The arguments after the first argument is a list of keys that must be removed.<br /><br /> * Example : array_remove_key($arr,"one","two","three");<br /><br /> * Return : The function will return an array after deleting the said keys<br /><br /> */<br /><br />function array_remove_key() {<br /><br /> $args = func_get_args();<br /><br /> $arr = $args[0];<br /><br /> $keys = array_slice($args,1);<br /><br /> <br /><br /> foreach($arr as $k=>$v) {<br /><br /> if(in_array($k, $keys))<br /><br /> unset($arr[$k]);<br /><br /> }<br /><br /> return $arr;<br /><br />}<br /><br /><br /><br />/**<br /><br /> * This function will remove all the specified values from an array and return the final array.<br /><br /> * Arguments : The first argument is the array that should be edited<br /><br /> * The arguments after the first argument is a list of values that must be removed.<br /><br /> * Example : array_remove_value($arr,"one","two","three");<br /><br /> * Return : The function will return an array after deleting the said values<br /><br /> */<br /><br />function array_remove_value() {<br /><br /> $args = func_get_args();<br /><br /> $arr = $args[0];<br /><br /> $values = array_slice($args,1);<br /><br /> <br /><br /> foreach($arr as $k=>$v) {<br /><br /> if(in_array($v, $values))<br /><br /> unset($arr[$k]);<br /><br /> }<br /><br /> return $arr;<br /><br />}<br /><br /></pre><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-3170736065240821406?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-44881056788133073842008-10-26T19:14:00.000-07:002008-10-26T19:15:20.829-07:00Finding Duplicates with sql<pre>SELECT email,<br />COUNT(email) AS NumOccurrences<br />FROM users<br />GROUP BY email<br />HAVING ( COUNT(email) > 1 )<br /></pre><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-4488105678813307384?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-88322470875117850472008-10-21T23:17:00.001-07:002008-10-21T23:17:29.638-07:00display ip on page<pre><?<span style="background-color: rgb(239, 239, 239);"><br /></span>//"ip.php" example- display user IP address on any page<span style="background-color: rgb(239, 239, 239);"><br /></span><span style="color:#ff0000;">Header("content-type: application/x-javascript");</span><br />$serverIP=$_SERVER['REMOTE_ADDR']<span style="background-color: rgb(239, 239, 239);">;<br /></span>echo "document.write(\"Your IP address is: <b>" . $serverIP . "</b>\")";<span style="background-color: rgb(239, 239, 239);"><br /></span>?></pre><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-8832247087511785047?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-75402147104251649462008-10-15T10:28:00.000-07:002008-10-15T10:28:34.583-07:00Change joomla template<div style="MARGIN: 0px auto 10px; TEXT-ALIGN: center">Change joomla template<br /><br />goto site>>template manager >> site template<br /><a href="http://1.bp.blogspot.com/_kES3xlANtrU/SPYoQLuoy4I/AAAAAAAAAPQ/Vp6qeIQjlfk/s1600-h/changetemplate2.jpg"><img border="0" alt="" src="http://1.bp.blogspot.com/_kES3xlANtrU/SPYoQLuoy4I/AAAAAAAAAPQ/Vp6qeIQjlfk/s320/changetemplate2.jpg" /></a><br /></div><br /><div style="MARGIN: 0px auto 10px; TEXT-ALIGN: center"><a href="http://1.bp.blogspot.com/_kES3xlANtrU/SPYoQVfH75I/AAAAAAAAAPY/U9D235CdAHY/s1600-h/changetemplate.jpg"><img border="0" alt="" src="http://1.bp.blogspot.com/_kES3xlANtrU/SPYoQVfH75I/AAAAAAAAAPY/U9D235CdAHY/s320/changetemplate.jpg" /></a> </div><div style='clear:both; text-align:CENTER'><a href='http://picasa.google.com/blogger/' target='ext'><img src='http://photos1.blogger.com/pbp.gif' alt='Posted by Picasa' style='border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;' align='middle' border='0' /></a></div><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-7540214710425164946?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-26434092767063556222008-10-15T10:25:00.000-07:002008-10-15T10:25:57.315-07:00<a href="http://1.bp.blogspot.com/_kES3xlANtrU/SPYnozkZGwI/AAAAAAAAAPI/OjadIh1Jguk/s1600-h/changetemplate2.jpg"><img style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CLEAR: both" border="0" alt="" src="http://1.bp.blogspot.com/_kES3xlANtrU/SPYnozkZGwI/AAAAAAAAAPI/OjadIh1Jguk/s320/changetemplate2.jpg" /></a><div style='clear:both; text-align:LEFT'><a href='http://picasa.google.com/blogger/' target='ext'><img src='http://photos1.blogger.com/pbp.gif' alt='Posted by Picasa' style='border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;' align='middle' border='0' /></a></div><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-2643409276706355622?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-44778152140502063902008-10-14T20:54:00.000-07:002008-10-14T20:56:57.583-07:00XML super ster contestMore detail <a href="http://www.asean.xmlsuperstar.com/web/guest/home">http://www.asean.xmlsuperstar.com/web/guest/home</a><br /><br />่น่าสนใจครับ เปิดรับสมัครถึงวันที่ <b>28 February 2009 </b>ก็จะมีหลายรายการที่จัดแข่งขันครับเข้าไปดูรายละเอียดได้<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-4477815214050206390?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-59535871688288176402008-10-14T09:34:00.000-07:002008-10-14T09:36:07.753-07:00asiasoft.co.thพอดีวันนี้ได้เข้าไปเจอเว็บหนึ่งชื่อว่า asiasoft.co.th ไปหน้าแรกเห็น product ของเขาเลยครับว่าเขาทำอะไรบ้าง เห็นเพื่อนมันเล่นเกมส์ ragnarok กันแต่ไม่รู้ว่าบริษัทไหนทำ พึ่งรู้ว่าเป็น asiasoft.co.th ก็วันนี้ละครับ<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-5953587168828817640?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-88108927616696139102008-10-14T06:17:00.000-07:002008-10-14T06:20:12.206-07:00Gazopa picture search engineวันนี้มารู้จัก web gazopa.com กันครับ<br /><br />เป็นเว็บ search engine แต่เป็นเว็บ search เกี่ยวกับรูปภาพนะครับ<br />ลองเล่นดูแล้วจะรู้ว่ามันทำได้ยังไงวะ<br /><br /><a href="http://www.gazopa.com/demo_video">http://www.gazopa.com/demo_video</a><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-8810892761669613910?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0tag:blogger.com,1999:blog-2669059752766299103.post-61775380378206653522008-10-13T03:33:00.000-07:002008-10-13T03:34:31.583-07:00Joomla class documentThis is joomla class reference for version 1.0.xx<br /><br />http://php.joomlademo.de/nav.html?_classes/index.html<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2669059752766299103-6177538037820665352?l=awatblog.blogspot.com'/></div>wirathttp://www.blogger.com/profile/15118904673598775862noreply@blogger.com0