ManyCodes.com – codes & scripts Get free programming codes and tutorials!

28Jul/090

How to have a text alert when entering and exiting your website

Here is how you can have a text alert when entering and exiting your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<script language="javascript" type="text/javascript">

alert("Welcome to my weblog")

</script>

<body>
<h1>

<!-- hide script from old browsers -->
<!--this is on example of a long JavaScript comment-->

<script language="javascript" type="text/javascript">

document.write("IranJavaScript")

//end hiding script from old browsers -->
</script>
</h1>

</body>

<!--   DESCRIPTION:  This will cause an elert message before your visitor leaves (OR reloads) your page.
 INSTRUCTIONS:  Place this tag where your BODY tag is.  Make changes to attributes (TEXT, LINK, VLINK, BGCOLOR, etc.) as necessary.
 FUNCTIONALITY: Works in both Netscape and IE.

//Modified by CoffeeCup Software
//This code is Copyright (c) 1997 CoffeeCup Software
//all rights reserved. License is granted to a single user to
//reuse this code on a personal or business Web Site.
-->


<BODY onUnload="window.alert(' Good Bye ')">


</BODY>
<!--   DESCRIPTION:  This will cause an elert message before your visitor leaves (OR reloads) your page.
 INSTRUCTIONS:  Place this tag where your BODY tag is.  Make changes to attributes (TEXT, LINK, VLINK, BGCOLOR, etc.) as necessary.
 FUNCTIONALITY: Works in both Netscape and IE.

//Modified by CoffeeCup Software
//This code is Copyright (c) 1997 CoffeeCup Software
//all rights reserved. License is granted to a single user to
//reuse this code on a personal or business Web Site.
-->


<BODY onUnload="window.alert(' Good Bye ')">


</BODY>

<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
28Jul/090

How to Close the browser with a button

Here is how you can close the browser with a button.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<!-- Start of Close Browser Script -->
<!-- When the "Close Window" button is clicked, this script
 will close the browser window that the webpage is in.
-->
<script language="JavaScript">
<!--

function closeIt() {
 close();
}

// -->
</script>

<center>
<form>
<input type=button value="Close Window" onClick="closeIt()">
</form>
</center>

<!-- End of Close Browser Script -->

<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
28Jul/090

How to put a msn search box on your website

Here is how you can put a msn search box on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<body>
<table BORDER="0" WIDTH="222" HEIGHT="18">
 <tr>
 <td WIDTH="214" HEIGHT="10">
 <form NAME="search" ID="search" ACTION="http://search.msn.com/results.asp" METHOD="get">
 <p><font FACE="arial" SIZE="2"><strong>Search
 <font COLOR="#808080">the Web for:</font></strong></font><br>
 <input TYPE="text" ID="q" SIZE="18" MAXLENGTH="251" NAME="q" VCARD_NAME="SearchText"><input TYPE="submit" VALUE="Search" NAME="B1"><input TYPE="hidden" NAME="FORM" VALUE="FRNT"><input TYPE="hidden" NAME="un" VALUE="doc"><input TYPE="hidden" NAME="v" VALUE="1"></p>
 </form>
 </td>
 </tr>
 <tr>
 <td WIDTH="214" HEIGHT="21" VALIGN="bottom">
 <p ALIGN="center"><font SIZE="1" FACE="arial">
 <a HREF="http://search.msn.com/advanced.asp?MT=&RS=CHECKED&Form=FRNT">Use
 Advanced Search</a></font></td>
 </tr>
</table>
<p> </p>
</body>

<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
Filed under: Linux No Comments
28Jul/090

How to put a Google search box on your website

Here is how you can put a Google search box on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<!-- Search Google -->
<center>
<FORM method=GET action="http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/">
<IMG SRC="http://www.google.com/logos/Logo_40wht.gif" <br></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value="en">
<INPUT type=submit name=btnG VALUE="Google Search">
</td></tr></TABLE>
</FORM>
</center>
<!-- Search Google -->

<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
22Jul/090

Make a USB Boot CD for Ubuntu 9.04

The following tutorial explains how to create a USB Boot CD that can be used to boot a Ubuntu 9.04 USB flash drive on computers with a BIOS that does not natively support booting from USB. The boot CD contains a grub bootloader that loads the initrd and vmlinuz kernel from the CD and then proceeds to locate the filesystem on the USB drive. Because the USB driver modules are preloaded from the initrd on the CD, the compressed filesystem can then be detected and loaded from the USB device.

USB Boot CD for Ubuntu 9.04 creation essentials

  • PC with a BIOS that does not support booting from USB
  • Working CD Drive and USB Port
  • Ubuntu 9.04 Live CD
  • USB flash drive with Ubuntu 9.04 preinstalled
  1. Insert the Ubuntu 9.04 Live CD and restart your computer, booting from the CD
  2. Open a Terminal and Type mkdir -p ubcd/boot/grub
  3. Type cp /usr/lib/grub/i386-pc/stage2_eltorito ubcd/boot/grub
  4. Type gedit ubcd/boot/grub/menu.lst
    Add the following information to your menu.lst file and click save:

    title Run Ubuntu 9.04 from USB DISK
    root (cd)
    kernel /boot/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper noprompt cdrom-detect/try-usb=true persistent
    initrd /boot/initrd.gz
    boot

  5. Type cp /cdrom/casper/initrd.gz ~/ubcd/boot
  6. Type cp /cdrom/casper/vmlinuz ~/ubcd/boot
  7. Type sudo gedit /etc/initramfs-tools/modules
    Add the following lines to the modules file and click save:

     usbcore
     usb-storage
     uhci_hcd
     ohci_hcd
     ehci_hcd
     sd_mod
     scsi_mod
  8. Type sudo gedit /etc/initramfs-tools/initramfs.conf
    Add the following line to the bottom of the file and click save:

    WAIT=8

  9. Type sudo mkinitramfs -o ubcd/boot/initrd.gz 2.6.2*
  10. Replacing 2.6.2* with your actual kernel version.

    Type uname -r to find your kernel version. I.E. initrd.gz 2.6.28-11-generic

  11. Type mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o usbcd.iso ubcd
  12. Burn the usbcd.iso to a CD
21Jul/091

Make a USB Boot CD for Linux Mint

This USB Boot CD can be used to boot Linux Mint 6 from a USB flash drive on computers with a BIOS that does not support booting from USB. Linux Mint is a remix based on Ubuntu. The USB Boot CD uses a grub bootloader to launch the vmlinuz kernel and initrd from the CD, loading the necessary USB drivers, and then proceeds to locate and extract the compressed filesystem from the flash drive.

Please Note: This USB Boot CD should work on most systems. However, it should be noted that the USB Boot CD may not work on really old computers with only USB 1.0 hardware support.

Can be used to boot flash drives created using the Linux Mint USB Install via CD or Linux Mint USB Install via Windows

USB Boot CD for Linux Mint 6 creation essentials:

  • PC with a BIOS that does not support booting from USB
  • Linux Mint 6 Live CD
  • Working CD Drive and USB Port
  • USB flash drive with Linux Mint 6 preinstalled

Creating a CD to Boot Linux Mint 6 from USB

The following process will enable you to create a Boot CD that can be used to Boot Linux Mint 6 from a USB Flash Drive on systems that do not natively support booting from USB.

  1. Insert the Linux Mint 6 Live CD and restart, booting from the CD
  2. Open a terminal and type mkdir -p usbcdm/boot/grub
  3. Type cp /usr/lib/grub/i386-pc/stage2_eltorito usbcdm/boot/grub
  4. Type gedit usbcdm/boot/grub/menu.lst
  5. Add the following information to your menu.lst file and save it
    title Run Linux Mint 6 from USB DISK
     root (cd)
     kernel /boot/vmlinuz file=/cdrom/preseed/mint.seed boot=casper noprompt cdrom-detect/try-usb=true persistent quiet splash
     initrd /boot/initrd.gz
     boot
  6. Type cp /cdrom/casper/initrd.gz ~/usbcdm/boot
  7. Type cp /cdrom/casper/vmlinuz ~/usbcdm/boot
  8. Type mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o usbcdmint.iso usbcdm
  9. Burn the usbcdmint.iso to a CD

Booting from the USB Boot CD for Linux Mint

  1. Shutdown your computer
  2. Insert the USB Boot CD and your Linux Mint flash drive
  3. Set your BIOS or Startup Menu to boot from CD
  4. Start your computer (booting from the CD)

The USB Boot CD should load the necessary USB drivers, detect the filesystem.squashfs on your flash drive, and then proceed to boot Linux Mint 6 from the flash drive.

Tagged as: , , , , 1 Comment
21Jul/090

Install easy_install Via yum on Linux CentOS Server

To install easy_install on Linux using yum you will need to install the python-setuptools package. Installing this package with yum is easy by following the directions below.

Run this command in your ssh termianl bash:

yum install python-setuptools 

An example of a python-setuptools install is below.

[root@server ~]# yum install python-setuptools
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: pubmirrors.reflected.net
* updates: mirrors.serveraxis.net
* addons: mirror.anl.gov
* ruby: repo.premiumhelp.eu
* extras: mirror.sanctuaryhost.com
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package python-setuptools.noarch 0:0.6c5-2.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
python-setuptools noarch 0.6c5-2.el5 base 479 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 479 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): python-setuptools- 100% |=========================| 479 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: python-setuptools ######################### [1/1]

Installed: python-setuptools.noarch 0:0.6c5-2.el5
Complete!
21Jul/090

How to Install dig on a CentOS Linux Server?

Installing dig on a CentOS Linux server is easy with yum. Dig is actually a bind tool so you will be required to install some bind libraries along with the bind utility package.

 [root@server ~]# yum install bind-utils  

Now you can run something like the below using dig to find MX records.

 [root@server ~]# dig @NAMESERVER EXAMPLE.COM MX  

Your install will look something like the below showing how yum looks for dependencies and installs them automatically.


[root@server ~]# yum install bind-utils
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for bind-utils to pack into transaction set.
bind-utils-9.3.4-6.0.2.P1 100% |=========================| 40 kB 00:00
---> Package bind-utils.x86_64 30:9.3.4-6.0.2.P1.el5_2 set to be updated
--> Running transaction check
--> Processing Dependency: libisccc.so.0()(64bit) for package: bind-utils
--> Processing Dependency: bind-libs = 30:9.3.4-6.0.2.P1.el5_2 for package: bind-utils
--> Processing Dependency: libbind9.so.0()(64bit) for package: bind-utils
--> Processing Dependency: libdns.so.22()(64bit) for package: bind-utils
--> Processing Dependency: libisccfg.so.1()(64bit) for package: bind-utils
--> Processing Dependency: liblwres.so.9()(64bit) for package: bind-utils
--> Processing Dependency: libisc.so.11()(64bit) for package: bind-utils
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for bind-libs to pack into transaction set.
bind-libs-9.3.4-6.0.2.P1. 100% |=========================| 41 kB 00:01
---> Package bind-libs.x86_64 30:9.3.4-6.0.2.P1.el5_2 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
bind-utils x86_64 30:9.3.4-6.0.2.P1.el5_2 updates 171 k
Installing for dependencies:
bind-libs x86_64 30:9.3.4-6.0.2.P1.el5_2 updates 874 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): bind-libs-9.3.4-6. 100% |=========================| 874 kB 00:35
(2/2): bind-utils-9.3.4-6 100% |=========================| 171 kB 00:04
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: bind-libs ######################### [1/2]
Installing: bind-utils ######################### [2/2]

Installed: bind-utils.x86_64 30:9.3.4-6.0.2.P1.el5_2
Dependency Installed: bind-libs.x86_64 30:9.3.4-6.0.2.P1.el5_2
Complete!

21Jul/090

How to Verify a CentOS Linux Server is 32 Bit or 64 Bit?

To verify if a system is 32 bit versus 64 bit you can use the uname command. Below are examples of using the uname command from the CLI on a 32 bit system followed by using the uname command on a 64 bit system.

32 Bit CentOS Linux Server
view plaincopy to clipboardprint?

[root@server ~]# uname -a
Linux server1.example.com 2.6.18-92.1.13.el5 #1 SMP Wed Sep 24 19:33:52 EDT 
2008 i686 i686 i386 GNU/Linux

64 Bit CentOS Linux Server
view plaincopy to clipboardprint?

[root@server ~]# uname -a
Linux server.example.com 2.6.18-53.1.21.el5 #1 SMP Tue May 20 09:35:07 EDT 
2008 x86_64 x86_64 x86_64 GNU/Linux

As you can see above the 64 bit server will show x86_64 numerous times after the install date and time. The 32 bit system will show i686 and i386 after the install date and time. So it is very easy to verify if a system is 32 bit versus 64 bit using the “uname -a” command from a shell.