SUB in Perl Language

SUB in Perl Language


sub testperl {
my $testperl = shift;
print $testperl;
}

Now we can use the subroutine just as any other built-in function:


testperl("test perl language");

Basic IRC Bot with Perl


#!/usr/bin/perl
use IO::Socket;
$irc='irc.example.net';
$nick='ตั้งชื่อบอท';
$owner='ชื่อคนใช้บอท';
$channel='#channel';
########################################################################
system('cls');
print "\n [+] Connection To $irc Please Wait ...\n\n";
########################################################################
$connect=IO::Socket::INET->new(PeerAddr=>$irc,
PeerPort=>'6667',
Proto=>'tcp',
Timeout=>60) or die "[!] Couldnt Connect To $irc\n\n";
#########################################################################
print $connect "USER xxx xxx xxx xxx\r\n";
print $connect "NICK ".$nick."\r\n";
print $connect "JOIN ".$channel."\r\n";
######################- Loop Connection -##############################
while ($svrmsg=<$connect>) {
if ($svrmsg=~m/^\:(.+?)\s+433/i) {
die "NickName in use";
}
print $svrmsg;
if ($svrmsg=~m/^PING (.*?)$/gi) {
print $connect "PONG ".$1."\r\n";
print "PONG ".$1."\r\n";
}
########################################################################
if ($svrmsg=~/Where you from ?/) {
if ($svrmsg=~/^\:$owner\!/) {

print $connect “PRIVMSG “,$channel,” :I’m Form Thailand\r\n”;

}
}
}

ที่มา : http://icheernoom.blogspot.com/2011/06/basic-irc-bot-with-perl.html
โดย : ICheer_No0M

Assembly abbreviation (อักษรย่อ แอสเซมบลี)

หลายๆท่านที่เริ่มหัดเขียน assembly อาจเคยพบปัญหานี้ คือการจำคำสั่งของแอสแซม และปัญหาที่ตามมาคือ “จำไม่ค่อยได้” เพราะคำสั่งมันแค่ 3 ตัว แต่ถ้าเรารู้ว่าคำสั่งนั้นเต็มๆมันคืออะไร มันก็จะจำได้ง่ายขึ้นครับ  (:

 

ตัวอย่าง

	JNA	Jump If Not Above	     
	JNAE	Jump If Not Above or Equal	     
	JNB	Jump If Not Below	     
	JNBE	Jump if Not Below or Equal	     
	JNC	Jump If No Carry	     
	JNE	Jump If Not Equal	     
	JNF	Jump if No Flag	     
	JNG	Jump if Not Greater than	     
	JNGE	Jump If Not Greater or Equal	     
	JNL	Jump If Not Less

เขียนโดย : sornram9254

CSS : ความลับที่คุณอาจไม่เคยรู้ [เกี่ยวกับ script ที่ฝังมากับ host ฟรี ]

CSS : ความลับที่คุณอาจไม่เคยรู้ [เกี่ยวกับ script ที่ฝังมากับ host(ฟรี) ใครรู้แล้วขออภัยครับ : ) ]
และวิธีนี้เหมาะกับเว็บเล็กๆ ที่ไม่ค่อยมีไรมากนะครับ  wanwan016


เคยรำคารกันไหม ที่โฮสฟรีๆ ชอบมีโฆษณากวนใจ ที่โฮสฝัง script มา แก้ก็ไม่ได้
วันนี้ผมมีวิธีแก้ครับ(อาจจะไม่ได้ทุกเจ้า) โดยใช้เจ้า CSS   Shocked

เริ่มแรกนะครับ ให้เราหา script ที่โฮสฟรีทั้งหลายฝังเอาไว้ก่อน ยกตัวอย่างของ freewebhostingarea.com แล้วกันนะครับ จะได้โค้ดนี้มา

<!– Free Web Hosting Area Start –>
<center><script type=”text/javascript” src=”hxxp://users.freewebhostingarea.com/a/l3b.js”></script></center><br>
<center><a target=”_blank” href=”hxxp://www.freewebhostingarea.com”><img src=”hxxp://users.freewebhostingarea.com/i/freehosting.png” border=”0″ width=”88″ height=”15″ alt=”Free Web Hosting”></a></center><br>
<noscript><br><center><font color=’#000000′ face=’Verdana’ style=’font-size: 11px; background-color:#FFFFFF’><a target=’_blank’ href=’hxxp://www.freewebhostingarea.com’><font color=’#000000′>Free Web Hosting</font></a></font></center></noscript>
<!– Free Web Hosting Area End –>

อันนี้จะเจอฝงอยู่คือ iframe (มาจากไฟล์ users.freewebhostingarea.com/a/l3b.js )
เราก็แค่เพิ่มโค้ดนี้ลงไปในไฟล์ css ซะ

iframe{
	display: none;
	visibility: hidden;
}

และถ้าในเว็บเราดันต้องใช้ iframe ด้วย ก็ควรใช้การกำหนด id หรือ class เพิ่มเข้าไปแทนนะครับ เช่น
<iframe id=’iframe’ src=’#’></iframe>

#iframe{
	display: block;
	visibility: visible;
	background:#fff;
}

written by : sornram9254

How to : Use firefox component in Visual Basic

สำหรับท่านที่ต้องการเขียนโปรแกรม แล้วใช้ component browser แต่ไม่ต้องการใช้ของ IE ก็สามารถทำได้ดังนี้

1. ขั้นแรกให้เข้าไปที่  MozillaControl download แล้ว install ให้เรียบร้อย

2.เข้าโปรแกรม Visual Basic แล้วทำการ add component ให้เรียบร้อย

Visual Basic.NET

The Mozilla Browser control should be usable from any automation control container. This includes Visual Basic .NET, so follow these steps to add the control to your VB project:

  • Install the control / or compile it and ensure it is registered.
  • In the “View” menu, click “Toolbox”
  • Click the “Components” tab
  • Right-click anywhere in the “Toolbox” and click “Customize Toolbox…”
  • In the “COM Components” tab, check the “MozillaBrowser Class” and click “OK”
  • The Mozilla Browser control should now appear as “Browser” in the “Toolbox” for insertion into any application. (Click and drag onto your form)

Visual Basic 6

The Mozilla Browser control should be usable from any automation control container. This includes Visual Basic, so follow these steps to add the control to your VB project:

  • Install the control / or compile it and ensure it is registered.
  • Right mouse over the VB control bar and select “Components…”.
  • Choose “MozillaControl 1.0 Type Library” from the list of controls
  • The Mozilla Browser control should now appear in the toolbar for insertion into any application

Once the control is inserted, you should be able to directly call the events, methods and properties it exposes. The latest control source contains an example VB project called VBrowse.

Note: Save your project often! Bugs in the alpha-quality Mozilla will crash your development environment and will wipe out any unsaved work you may have.

3. ในการเรียกใช้ Component firefox ให้ใช้ Code ดังนี้ (ตัวอย่าง)

Private Sub Form_Load()
MozillaBrowser1.Navigate (“http://www.google.co.th”)
End Sub

4. ตัวอย่างผลลัพธ์

http://www.iol.ie/~locka/mozilla/vbrowse.gif

 

สำหรับข้อเสียคือ ในเครื่องผู้ใช้โปรแกรมจำเป็นต้องลง Component MozillaControl ด้วย ถ้าไม่เช่นนั้น จะไม่สามารถใช้โปรแกรมที่เราเขียนขึ้นได้

ตัวอย่างเครื่องที่ไม่ได้ติดตั้ง MozillaControl จะเป็นลักษณะนี้

http://image.free.in.th/z/it/67untitled.png

ข้อเสียอีกอย่างคือ Component ตัวนี้ยังไม่รองรับคุณลักษณะ css บางคำสั่ง เช่น text-shadow ฯลฯ

ดังนั้นเมื่อเราเขียนโปรแกรมเสร็จ เวลาแจกจ่ายโปรแกรม เราต้องให้เครื่องผู้ใช้ติดตั้ง MozillaControl ด้วย

ข้อมูลเพิ่มเติม : http://www.iol.ie/~locka/mozilla/control.htm
By : Sornram9254

 

Programming Language and Martial Art

หลังจากคราวที่แล้วว่ากันเรื่อง ภาษาสำหรับเขียนโปรแกรมกับอาวุธ คราวนี้เรามาว่ากันเรื่อง ภาษาสำหรับเขียนโปรแกรมกับวิทยายุทธ์ ก็อย่างที่เคยบอก เรื่องนี้เป็นเรื่องละเอียดอ่อนอันดับต้นๆ ของโลก ผมแค่นึกขึ้นมาได้ตอนขับรถกลับบ้านเท่านั้น เท่านั้นจริงๆ ช่วงนี้คงจะอ่านนิยายกำลังภายในมากเกินไป มีทั้งจอมคนแผ่นดินเดือดและฟงอวิ๋น สนุกจนไม่ต้องหลับต้องนอน แต่นิยายสมัยนี้ไม่ค่อยมีกระบวนท่าโดดเด่น ผมเลือกมาเฉพาะที่คนส่วนใหญ่จะรู้จักเท่านั้นพอ

  • Cคัมภีร์เก้าเอี้ยง พลังภายในล้วนๆ กรุณาหาฝึกกระบวนท่ากันเอง
  • C++คัมภีร์เก้าอิม กระบวนท่าเยอะมาก ถ้าตีความผิดอาจกลายเป็นวิชามาร
  • Java พลังอาภรณ์วิวาห์ มีความสุขใน virtual machine ไม่ยอมให้มีอะไรเล็ดรอดหลุดออกไป และก็ไม่มีอะไรแทรกเข้ามาได้เหมือนกัน
  • .NET พลังหยกอำไพ ตัดต่อกันสนุก ลิงค์ไปมา managed/unmanaged ง่ายมาก
  • Pythonฝ่ามือสยบมังกรสิบแปดท่า มีไม่กี่ท่า ไม่พลิกแพลง แต่ใช้ได้ทุกสถานการณ์ วนเวียนได้ไม่รู้จบ ไม่ต้องใช้สมองมาก
  • Rubyเก้ากระยี่เดียวดาย ทุกกระบวนท่ามีแต่รุกไม่มีรับ ลุยแหลก ผู้ฝึกต้องมีไหวพริบปฏิภาณพอตัว
  • Luaลมปราณภูติอุดร ตัวเองแทบขะไม่มีอะไร หาของคนอื่นมาใช้สบายใจ
  • Perl กระบี่หกชีพจร พลังเต็มพิกัด แก้ปัญหาตรงจุด เอ่อ แต่ถ้าพลาดเป้าก็จบตัวใครตัวมัน ใช้นานไม่ได้ เหนื่อย
  • PHPไม่เท้าตีสุนัข มั่วจนได้ดี
  • Lispพลังเคลื่อนย้ายจักรวาล เอาไว้เสริมคนที่เก่งแล้วให้เก่งยิ่งขึ้นไปอีก
  • Fortranฝ่ามือหกสุริยัน เกิดมาแก้ปัญหาเฉพาะทาง ทำลายเป้าหมายจนหมดสภาพ ไม่มีความปราณี
  • ABAP/4มีดบินไม่พลาดเป้า เป็นภาษาเฉพาะทางที่สุดภาษาหนึ่ง อย่าหวังว่ามันจะทำอะไรพลิกแพลงได้มากนัก ไม่ว่าจะโยนออกไปด้านไหนมันก็จะปักคอหอยอยู่ดี โชคดีที่เป้าหมายคือปักคอหอย ใช้ยังไงก็สำเร็จ

กำลังมองหาภาษา ไร้กระบวนท่า แต่ยังหาไม่เจอ

ปล. อย่าคิดมาก แค่ขำๆ ถ้าใครคิดว่ามีอะไรที่เหมาะกว่านี้เสนอได้เลยครับ เอ่อ Assembly ผมถือว่าเป็นวิชามารนะ

ที่มา : http://www.howforge.com/programming-language-and-martial-art

โค้ดเว็บอัพโหลดไฟล์ PHP อย่างง่าย

<?php
if (is_uploaded_file($cUploadFile))
{
if (move_uploaded_file($cUploadFile, “$cPath/$cUploadFile_name”))
{
print “http://127.0.0.1/upload/$cUploadFile_name\n”;       // ให้บันทึกไฟล์ไว้ที่ใหน
}
else {
print “Uploaded file $cUploadFile_name failed.\n”;
}
}
?>

<form enctype=”multipart/form-data” method=”post” action=”index.php”>
<input type=”hidden” name=”cPath” size=”76″ value=”upload”><br>
<input type=”hidden” name=”MAX_FILE_SIZE” value=”อัพได้สูงสุดกี่ไบต์“>
Upload <input type=”file” name=”cUploadFile” size=”42″>

<input type=”submit” name=”cSubmit” value=”Upload Now”>
</form>

ไปไรับแต่งกันเองนะครับ
ขอบคุณโค้ดจาก หนังสือ insight PHP พิมพ์ครั้งที่ 8 ของ Provision

Automount partition [linux : ubuntu]

Automount partition on startup

/dev/sda??? /media/??? ntfs-3g defaults,locale=en_US.UTF-8 0 0
/dev/sda??? /media/??? vfat defaults,locale=en_US.UTF-8 0 0

หลังจากนั้นก็ Reboot แล้วดูผลงานได้เลยครับ