ALT_IMG

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...

ALT_IMG

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..

Alt img

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...

ALT_IMG

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...

ALT_IMG

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...

ALT_IMG

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..

ALT_IMG

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..

ALT_IMG

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..

Friday, 28 December 2012

Google Chrome - Keyboard Shortcuts

0 comments

Access your Google Chrome browser with your keyboard ONLY.
Using keyboard shortcuts often looks cool and the same could be done in your chrome browser too since Google Chrome allows many keyboard shortcuts and using them makes our work more simpler. Checkout!

Shortcuts -

CTRL + N: Open a new window

CTRL + <Link>: Open a link in a new tab

CTRL + SHIFT + N: Open a new window in Incognito Mode

SHIFT + <Link>: Open a link in a new window

CTRL + T: Open a new tab

CTRL + SHIFT + T: Reopen the last tab that you closed

ALT + F4: Close current window

CTRL + 1: Switch to the tab in position 1 on the tab strip

CTRL + 2: Switch to the tab in position 2 on the tab strip

CTRL + 3: Switch to the tab in position 3 on the tab strip

CTRL + 4: Switch to the tab in position 4 on the tab strip

CTRL + 5: Switch to the tab in position 5 on the tab strip

CTRL + 6: Switch to the tab in position 6 on the tab strip

CTRL + 7: Switch to the tab in position 7 on the tab strip

CTRL + 8: Switch to the tab in position 8 on the tab strip

CTRL + 9: Switch to the last tab on the tab strip

CTRL + TAB: Switch to the next tab

CTRL + PAGE DOWN: Switch to the next tab

CTRL + SHIFT + TAB: Switch to the previous tab

CTRL + PAGE UP: Switch to the previous tab

CTRL + W: Close current tab or pop-up window

CTRL + F4: Close current tab or pop-up window

ALT + HOME: Open your home page

CTRL + O: Open a file in the browser

CTRL + H: View Browsing History

CTRL + B: Toggle bookmarks display

CTRL + J: View Downloads

SHIFT + ESC: View Chrome's internal Task Manager

CTRL + P: Print the current page

F5: Reload the current page

ESC: Stop the current page from loading

CTRL + F5: Reload the current page, overriding the cache

SHIFT + F5: Reload the current page, overriding the cache

ALT + <Link>: Download link

CTRL + F: Open the 'Find in page' dialog box

CTRL + G: Find the next match from 'Find in page' box

F3: Find the next match from 'Find in page' box

CTRL + SHIFT + G: Find the previous match from 'Find in page' box

SHIFT + F3: Find the previous match from 'Find in page' box

CTRL + U: View source code of the current page

CTRL + D: Bookmark the current page

CTRL + PLUS: Make text larger

CTRL + MINUS: Make text smaller

CTRL + 0: Return to default text size

BACKSPACE or ALT + LEFT ARROW: Advance to the previous page in your browsing history (for the current tab)

SHIFT + BACKSPACE or ALT + RIGHT ARROW: Advance to the next page in your browsing history (for the current tab)

ALT + E or ALT + F: Open Chrome's "wrench", or tools, menu

CTRL + SHIFT + B: Activate or disable the Bookmarks Bar.

F6 or SHIFT + F6: Advance through active components on the current page, or through items in Chrome's Address bar, Bookmarks bar, or Downloads bar.

CTRL + SHIFT + J: Open Chrome's JavaScript Console.

CTRL + SHIFT + I: Open Chrome's Developer Tools interface.

F1: Open Chrome's Help Center in a new tab or window.

CTRL + SHIFT + DELETE: Open the Clear Browsing Data window.

CTRL + ENTER: Automatically add www. (at the beginning) and .com (at the end) of the text currently residing in the Address (or URL) bar

CTRL + BACKSPACE: Remove whatever key term precedes the active cursor in the Address (or URL) bar

CTRL + L or ALT + D: Highlight the full URL in the Address bar

CTRL + K or CTRL + E: Enters a question mark in the Address bar. Typing a keyword or keywords following this question mark will submit the search term to your default engine.

CTRL + S: Save the current page to your hard drive

CTRL + C: Copy selected text or images to the Clipboard

CTRL + V or SHIFT + INSERT: Paste the current contents of the Clipboard, preserving original formatting

CTRL + SHIFT + V: Paste the current contents of the Clipboard without original formatting



Continue reading →
Thursday, 27 September 2012

How To Use Captcha in HTML Forms

0 comments


HTML forms are the essential needs of almost any website viz. contact us form. A contact us form is very useful as it aids your visitors to communicate easily in a simple way. A simple form, without a captcha on it are the chief look-outs of hackers and spammers. It is essential to secure your form against all 'holes' that those hackers are searching for.


How does the spammers/hackers exploit HTML forms?

1) As a relay for sending bulk unsolicited emails.

If you are not validating your form fields (on the serve side) before sending the emails, then hackers can alter your email headers to send the bulk unsolicited emails. (also known as email injection)


2) For sending spam messages to you.

There are programs known as 'spam-bots' that leech through the web pages looking for web forms. When found, those 'bots' just fills the fields with a spam message and submits. Eventually you will start getting many hundred submissions send by those spam bots and you will find it difficult to separate genuine submissions from spam messages.

The solution for this problem is to use a mechanism to identify human submitters from 'bots'. CAPTCHA is one of such tests.


Adding Captcha


Captcha is an image with a code written on it. The website visitor is required to read the code on the image and enter the value in a text field. If the word entered is wrong, the form submission is not processed. As CAPTCHA is a smartly blurred image, the spam bot can't read it. So the form cannot be auto-submitted by a 'bot'.



Contact form with Captcha


<form method="POST" name="contact_form"
action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
<label for="name">Name: </label>
<input type="text" name="name"
value="<?php echo htmlentities($name) ?>">
<label for="email">Email: </label>
<input type="text" name="email"
value="<?php echo htmlentities($visitor_email) ?>">
<label for="message">Message:</label>
<textarea name="message" rows=8 cols=30>
<?php echo htmlentities($user_message) ?></textarea>
<img src="captcha_code_file.php?rand=<?php echo rand(); ?>"
id="captchaimg" >
<label for="message">Enter the code above here :</label>
<input id="6_letters_code" name="6_letters_code" type="text">
<input type="submit" value="Submit" name="submit">
</form>


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


When the form is submitted, we compare the value in the session variable(6_letters_code) with the submitted CAPTCHA code( the value in the text field 6_letters_code). If the codes match, then we proceed with emailing the form submission. Else we display an error.

Here is the code that does the server side processing:


if(isset($_POST['submit']))
{
  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_width = 120;
$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.







Screenshot -




Continue reading →
Tuesday, 25 September 2012

How to Create a Horizontal Dropdown Menu with HTML, CSS and jQuery

1 comments



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:


<ul id="coolMenu">
<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:


<ul id="coolMenu">
<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:




There are multiple ways to set up the CSS for a horizontal menu. After many years I found that this is the quickest and cleanest way to do it:


#coolMenu,
#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.


/* Main menu
------------------------------------------*/
#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.


<li>
    <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:


#coolMenu li:hover ul.noJS {
    display: block
}


Now that everything is set let’s add some magic:


$(function(){
    $('#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.







Continue reading →
Thursday, 13 September 2012

Apple announced the 4-inch iPhone 5 smartphone

1 comments



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.

Apple has kicked out Google from the iPhone 5 software. Google Maps are now history for iPhone which is now replaced by Maps. Hence, the iPhone 5 will be the first Apple device running iOS 6, and Apple Maps are now the default navigation and map app on this and future iOS devices.

                                            Comparison of Google Maps v/s Apple Maps

Apple is very good at making their new products look revolutionary and sensational. One example of this evident during the presentation today. Instead of saying that the Iphone 5 is 1.7 mm thinner than the iPhone 4S, the company showed the audience that the new phone model was 18% thinner. A much larger number to show off.

The hardware specifications is not iPhone's strength any more. Looking at the specifications alone is not a good reason to go for this particular phone model. I think consumers will buy this for the well-known intuitive user interface and of course the Apple/iPhone brand name.


                              

The iPhone 5 will be available with three variants. Apple has not yet revealed the sim-free price of iPhone 5, but these are the prices in US on two year contract.
16 GB edition for $199
32 GB edition for $299
and the largest 64 GB edition for $399.
Too bad Apple didn't add a memory card slot on the new iPhone.

Like earlier the phone is launched in two colors : Black and White. iPhone 5 will be available in the US, Canada, Hong Kong, Singapore, France, Germany, Australia, UK on September 21st. 22 other European countries will get the phone on September 28. 100 countries will receive the iPhone 5 during December.

Apple again, has shown the world that it can make good software indulged in good hardware. There's no doubt that in one year from now, the iPhone 5 will be the best-selling mobile phones from Apple. I pesonally, do not think the iPhone 5 is the "All-new design" and "Completely redesigned" as Apple chose to call it. The iPhone 5 is an evolution smartphone based on the ideas behind Iphone 4/4S.


Some new features found in iPhone 5 -

  • 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


Apple iPhone 5 highlights -

  • Weight: 112 gram
  • Size: 123.8 x 58.6 x 7.6 mm
  • Networks configurations - 
  1. GSM model A1428: UMTS/HSPA+/DC-HSDPA (850, 900, 1900, 2100 MHz); GSM/EDGE (850, 900, 1800, 1900 MHz); LTE (Bands 4 and 17)
  2. 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)
  3. 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


Continue reading →