<html>
<head>
<title>jQuery add / remove textbox example</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<style type="text/css">
div{
padding:8px;
}
</style>
</head>
<body>
<h1>jQuery add / remove textbox example</h1>
<script type="text/javascript">
$(document).ready(function(){
var counter = 2;
$("#addButton").click(function () {
if(counter>10){
alert("Only 10 textboxes allow");
return false;
}
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.after().html('<label>Textbox #'+ counter + ' : </label>' +
'<input type="text" name="textbox' + counter +
'" id="textbox' + counter + '" value="" >');
newTextBoxDiv.appendTo("#TextBoxesGroup");
counter++;
});
$("#removeButton").click(function () {
if(counter==1){
alert("No more textbox to remove");
return false;
}
counter--;
$("#TextBoxDiv" + counter).remove();
});
$("#getButtonValue").click(function () {
var msg = '';
for(i=1; i<counter; i++){
msg += "\n Textbox #" + i + " : " + $('#textbox' + i).val();
}
alert(msg);
});
});
</script>
</head><body>
<div id='TextBoxesGroup'>
<div id="TextBoxDiv1">
<label>Textbox #1 : </label><input type='textbox' id='textbox1' >
</div>
</div>
<input type='button' value='Add Button' id='addButton'>
<input type='button' value='Remove Button' id='removeButton'>
<input type='button' value='Get TextBox Value' id='getButtonValue'>
</body>
</html>
Tuesday, November 10, 2015
How to add / remove textbox dynamically with jQuery
Thursday, November 5, 2015
How to remove index.php from codeigniter in Raspbian....... 2 different solution!
In
application/config/config.php
change:$config['index_page'] = 'index.php';
to:
$config['index_page'] = '';
Step 1 :
Add this in htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
Step 2 :
Remove index.php in codeigniter config
$config['base_url'] = '';
$config['index_page'] = '';
Step 3 :
Allow overriding htaccess in Apache Configuration (Command)
sudo nano /etc/apache2/apache2.conf
and edit the file & change to
AllowOverride All
for www folder
Step 4 :
Enabled apache mod rewrite (Command)
sudo a2enmod rewrite
Step 5 :
Restart Apache (Command)
sudo /etc/init.d/apache2 restart
-------------------------------------------------------------------------------------------------------
Solution 2:
There are 3 steps to remove index.php
1.Make below changes in application/config.php file
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
2.Make .htacces file in your root directory using below code
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
3.Enable rewrite mode (if your rewrite mode is not enabled)
i. First, initiate it with the following command:
a2enmod rewrite
ii. Edit the file /etc/apache2/sites-enabled/000-default
change All AllowOverride None to AllowOverride All.
iii. Restart your server with the following command:
sudo /etc/init.d/apache2 restartMonday, October 26, 2015
ADDING THE NETWORK DETAILS TO THE RASPBERRY PI and WiFi from eBay!
sudo wget https://github.com/porjo/mt7601/raw/master/src/mcu/bin/MT7601.bin -O /lib/firmware/mt7601u.bin
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Go to the bottom of the file and add the following:
network={
ssid="The_ESSID_from_earlier"
psk="Your_wifi_password"
}
RaspberryPi perl: warning: Setting locale failed.
Sometime I got so mad when I saw this error. So here is the solution:
- Stop forwarding locale from the client. Do not forward the locale environment variable from your local machine to the server. You can comment out the
SendEnv LANG LC_*
line in the local/etc/ssh/ssh_config
file. - Stop accepting locale on the server. Do not accept the locale environment variable from your local machine to the server. You can comment out the
AcceptEnv LANG LC_*
line in the remote/etc/ssh/sshd_config
file.
Friday, October 23, 2015
RaspberryPi image write from linux
It's cool if we can see the progress when we are trying to write Raspbian image to a sd card. Following command will show how to do that:
dd if=2015-05-05-raspbian-wheezy.img | pv | dd of=/dev/sdb
dd if=2015-05-05-raspbian-wheezy.img | pv | dd of=/dev/sdb
/dev/sdb is your sdCard and be careful when are you choosing this option.
Thursday, October 22, 2015
VirtualBox setup
VirtualBox
This chapter should only be done when installing a local server with VirtualBox
- Get latest VirtualBox from https://www.virtualbox.org/wiki/Downloads
- Also get the extension pack for the current VirtualBox version and install
- Also get the VBoxGuestAdditions ISO for the current VirtualBox version. It should be available at http://download.virtualbox.org/virtualbox/
- Create a new machine, 8Gb HDD 4Gb Memory, Linux/Ubuntu 64, dynamically allocated hard disk.
- Select the new machine, Settings->Network->Network Settings, set adapter 1 to Bridged Adapter, Allow All
Ubuntu Server
- Get the latest 64-bit Ubuntu Server from http://www.ubuntu.com/download/server (Current version is 14.04LTS).
- Mount ISO image
- If in VirtualBox, just mount ISO and start the virtual machine
- If standalone server, burn ISO to CD or to USB stick, set the BIOS to boot from that media and boot
- Set it up as a LAMP server
- Set up MySQL to use the root password from config/database in the source code.
- If a standalone server, copy the source to the server /var/www
Configuring VirtualBox Guest additions
Settings->Storage. Select the CD ROM and remove the current disk from the virtual drive.- Settings->Storage. Select the CD ROM and "insert" the VBoxGuestAdditions ISO image.
- In the linux box:
sudo apt-get install dkms sudo mount -r /dev/cdrom /media/cdrom sudo bash /media/cdrom/VBoxLinuxAdditions.run
- Add to /etc/rc.d before the exit 0 line:
sudo mount -t vboxsf boenderegistret /var/www
- Reboot so it gets properly mounted
RaspberryPi apache2 server; Increase upload size in your php.ini
If you are using Raspbian and try to upload bigger file through phpmyadmin. Below instruction will help you, how to do it:
For this you need to be sudo premission:
-sudo su
-nano /etc/php5/apache2/php.ini
-ctrl+w (for search) : upload_max_filesize --> change to 2000M
-ctrl+w (for search) : post_max_size --> change to 2000M
For this you need to be sudo premission:
-sudo su
-nano /etc/php5/apache2/php.ini
-ctrl+w (for search) : upload_max_filesize --> change to 2000M
-ctrl+w (for search) : post_max_size --> change to 2000M
Subscribe to:
Posts (Atom)