Tutorials
Featuring short lessons and techniques, covering languages viz. PHP, MySQL, CSS, HTML, JavaScript, Java. The latest methods of developing web applications and basic tutorials of Java technology. You'll find free codes available in the post added with some video tutorials wherever applicable. Readmore...
How-To's
There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..
Tips and Tricks
Sony announces its very first mobile phone ‘Sony Xperia Ion’ in 10 years after it is being seperated from Ericsson at the CES 2012. Now the new products and devices is back with its brand logo of Sony instead of Sony Ericsson. is the first operator to have a Sony phone in the assortment Readmore...
Hacking Tricks
In the past few months we saw so many ultrabooks budding up in the electronic market. The Apple’s trendy MacBook Air gave the PC makers a cause to be anxious, since it is obvious that these thin-and-light laptops seems to be in a tough competiton with them. In general, Ultrabooks are the small, light, powerful Readmore...
Gadgets
The minute you get your hands on the Droid Xyboard, it is clear that this is a higher-caliber Android tablet while comparing with almost everything else available today. The tablet is sleek, properly balanced and felt comfortable in our hands. A completely new look, significantly enhanced performance and Readmore...
Internet Tweaks
There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..
Tech News
There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..
Downloads
There went a rumour about the announcement of the Sony Xperia S and also we have seen some leaked photos of the model many time before. The latest leak photos had Sony Ericsson logo wearing on it but this final product image from CES has a Sony logo on the top Readmore..
Google Chrome - Keyboard Shortcuts
How To Use Captcha in HTML Forms
The HTML form above contains the fields for name, email and message. In addition, we have the CAPTCHA image. The <img> tag for the CAPTCHA image points to the script captcha_code_file.php. The PHP script in 'captcha_code_file.php' creates the image for the captcha and saves the code in a session variable named '6_letters_code'.
Validating the CAPTCHA
{
if(empty($_SESSION['6_letters_code'] ) ||
strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errors .= "\n The captcha code does not match!";
}
if(empty($errors))
{
//send the email
$to = $your_email;
$subject = "New form submission";
$from = $your_email;
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$body = "A user $name submitted the contact form:\n".
"Name: $name\n".
"Email: $visitor_email \n".
"Message: \n ".
"$user_message\n".
"IP: $ip\n";
$headers = "From: $from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to, $subject, $body, $headers);
header('Location: thank-you.html');
}
}
Customizing the CAPTCHA
The CAPTCHA script in the sample code download can be customized. If you open the script, you can see the first few lines of the code as shown below:
$image_height = 40;
$characters_on_image = 6;
$font = './monofont.ttf';
//The characters that can be used in the CAPTCHA code.
//avoid confusing characters (l 1 and i for example)
$possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
$random_dots = 0;
$random_lines = 20;
$captcha_text_color = "0x142864";
$captcha_noise_color = "0x142864";
You can change the size of the CAPTCHA by changing $image_width & $image_height. The number of characters in the CAPTCHA can be changed by updating $characters_on_image. Similarly, the text color of the CAPTCHA can be customized by updating $captcha_text_color. The code adds some 'noise' in the image by adding random lines and dots. you can increase or decrease the noise. Please note that increasing the noise may make it difficult for your genuine visitors to read the code.
How to Create a Horizontal Dropdown Menu with HTML, CSS and jQuery
Menus play an essential part on the web. They allow users to find their bearings and help them navigate your website. When designing menus, usability is the key.
Beginners often struggle with the basics. In this tutorial I'm going to show you how to create a simple, usable and functional horizontal menu with HTML and CSS. I will also dive a little bit into jQuery to add animations to your menu.
This tutorial assumes you have a basic knowledge of HTML and CSS. It’s recommended to use a CSS reset for consistency. I use the one by HTML5Doctor.
The Basics
Let's start with the basic HTML structure of the menu:
<li><a href="#">Home</a></li>
<li><a href="#">Tutorials</a></li>
<li><a href="#">Gadgets</a></li>
<li><a href="#">Tips and Tricks</a></li>
<li><a href="#">Contact us</a></li>
</ul>
A menu consists of an unordered list, and each list item contains a link with the text. Don’t create unnecessary divs. You don’t need any.
To add a sub menu simply nest another unordered list inside the item that's going to have the sub menu, like this:
<li><a href="#">Home</a></li>
<li>
<a href="#">Tutorials</a>
<ul>
<li><a href="#">PHP</a></li>
<li><a href="#">MySQL</a></li>
<li><a href="#">JavaScript</a></li>
<li><a href="#">HTML</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">Java</a></li>
</ul>
</li>
<li><a href="#">Gadgets</a></li>
<li><a href="#">Tips and Tricks</a></li>
<li><a href="#">Contact us</a></li>
</ul>
As you can see, creating the structure is very simple. This is how it should look in your browser at this stage:
#coolMenu ul {
list-style: none;
}
#coolMenu {
float: left;
}
#coolMenu > li {
float: left;
}
#coolMenu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
}
#coolMenu ul {
position: absolute;
display: none;
z-index: 999;
}
#coolMenu ul li a {
width: 80px;
}
#coolMenu li:hover ul {
display: block;
}
- I decided to float the whole menu to contain it but you can use overflow hidden or even set a fixed width for the same purpose.
- It is important to float the list elements rather than the links.
- The links should be displayed as blocks, otherwise, they won’t behave as expected.
- Absolute position the submenu and hide it to remove it from the regular flow and make it invisible. Also, set a high z-index to prevent the submenu from showing behind other elements.
- Set a height for the link elements and the line-height equal to the height to center the text vertically. By specifying a fixed height instead of just using padding you avoid flickering problems with jQuery animations later on.
- Even though it’s not necessary to set a fixed width for the submenu items, it’s always a good practice. It allows you to style them more consistently later on.
- Notice that the hover state is set on the list element and not the link.
With all this set, the menu should be already working. Try opening it in your browser and hovering over the third option to show the sub menu.
Improving Usability
This step will cover how to style the menu with some basic CSS to make it more accessible.
------------------------------------------*/
#coolMenu {
font-family: Arial;
font-size: 12px;
background: #2f8be8;
}
#coolMenu > li > a {
color: #fff;
font-weight: bold;
}
#coolMenu > li:hover > a {
background: #f09d28;
color: #000;
}
/* Submenu
------------------------------------------*/
#coolMenu ul {
background: #f09d28;
}
#coolMenu ul li a {
color: #000;
}
#coolMenu ul li:hover a {
background: #ffc97c;
}
Keep in mind this is very basic, and is meant to be just an example. You can style this however you want. The important thing to remember here is, as I mentioned before that the hover states, are styled in the list items and not the links.
This is how the menu looks so far:
Adding Animations
This final step is not necessary but it’ll help you add animations to your menu with simple jQuery. The first thing you need to do, of course, is to call the latest jQuery plugin on your website:
Now, let’s add a "noJS" class to the submenu to be able to unhook the hover css state in jQuery. This will also ensure that the menu will still work when javascript is disabled.
<a href="#">Tutorials</a>
<ul class="noJS">
<li><a href="#">PHP</a></li>
<li><a href="#">MySQL</a></li>
<li><a href="#">JavaScript</a></li>
<li><a href="#">HTML</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">Java</a></li>
</ul>
</li>
You also need to add the class to the sub menu CSS hover state:
display: block;
}
Now that everything is set let’s add some magic:
$('#coolMenu').find('> li').hover(function(){
$(this).find('ul')
.removeClass('noJS')
.stop(true, true).slideToggle('fast');
});
});
The code is pretty explanatory. The script finds the immediate children list items and adds a hover function. Inside the function it removes the "noJS" class since we’re using JavaScript, and then it tells the menu to slide down on hover and to slide up on un-hover. This is achieved with the slideToggle function. The stop function prevents the animation from repeating itself if we hover multiple times.
Apple announced the 4-inch iPhone 5 smartphone
Apple today announced the most awaiting phone for all the Apple lovers, the Apple iPhone 5. Many of the rumors came while talking about iPhone 5. Among those rumours was the 4-inch display and that the phone is thinner and higher than its predecessor, the iPhone 4S. Also chinese iPhone 5 was also launched in china market way before its launch.
The 7.6mm width makes it the thinnest iPhone so far. Making the phone thinner is probably a good enough reason for many to updating their existing 4S to the new model. But making a thin phone also limit the possibility for Apple to produce a much better camera as it must be room for the lens and sensor which must be stacked on top of each other. Therefore, the Iphone 5 has similar camera specifications. It is a 8 megapixel camera with a BSI sensor, auto focus, face detection and 1080p video capture. The front camera has an increased resolution of 720p.
The new phone has a 4-inch retina display that has a 640 x 1136 pixel resolution. The width of the display is the same as iPhone 4, but the height is increased with 176 pixels up to 1136. This makes up to add one more row for icons. The iPhone 5 has a 800:1 contrast ratio and 500cd/m2 max. brightness, again same as iPhone 4.
The old 30-pin connector has been replaced by a 8-pin connector called Lightning. A Lightning-to-30-pin adapter accessory is available in the Apple Store for $29. The adapter is compatible with all older accessories and Iphone 5, Ipod Touch 5th generation and Ipod Nano 7th generation.
Apple has also updated the headset with a new design. Earlier, you could mix left and right ear-plugs, but that is not possible any more as the new headphones has directional speakers. Just like Apple has done with the camera (iSight) and display (Retina) these headset has got a name. The new headphones are called EarPods and these will work with all previously released Apple products.
- New A6 processor
- Three different network configurations (2 x GSM and one CDMA)
- LTE network speed
- Now with Wi-Fi a (802.11a/b/g/n)
- Larger display (4-inch with a 640 x 1136 pixel resolution)
- 1.2 front camera with 720p video capture
- New smaller Lightning connector (8-pin)
- Audio jack located at the bottom of the handset
- New EarPods headphones
- iOS 6
- Lighter with 112 gram
- Weight: 112 gram
- Size: 123.8 x 58.6 x 7.6 mm
- Networks configurations -
- GSM model A1428: UMTS/HSPA+/DC-HSDPA (850, 900, 1900, 2100 MHz); GSM/EDGE (850, 900, 1800, 1900 MHz); LTE (Bands 4 and 17)
- CDMA model A1429: CDMA EV-DO Rev. A and Rev. B (800, 1900, 2100 MHz); UMTS/HSPA+/DC-HSDPA (850, 900, 1900, 2100 MHz); GSM/EDGE (850, 900, 1800, 1900 MHz); LTE (Bands 1, 3, 5, 13, 25)
- GSM model A1429: UMTS/HSPA+/DC-HSDPA (850, 900, 1900, 2100 MHz); GSM/EDGE (850, 900, 1800, 1900 MHz); LTE (Bands 1, 3, 5)
- 4 inch touch display, 640 x 1136 pixels resolution
- Wi-Fi a/b/g/n (2.4 and 5GHz
- 8 megapixel camera, BSI sensor
- Bluetooth 4.0
- A6 processor
- AGPS and GLONASS
- Talk time: 8 hours (3G)
- Standby time: 225 hours
- Sensors: gyro, accelerometer, proximity, ambient light