Tuesday, April 23, 2013

Rotating Banner for your website with HTML and JavaScript

What is Rotating Banner?

Web banners play an immense part in today's advertising methods. While browsing in the web, you can see advertising banners that is cycling through a number of images each of them linking to specific target pages. Let us see the code to create such a rotating web banner to be used in your website and bit of understanding about the code.

I am using Dreamweaver as my HTML editor software. You can use any available editors of your choice.
  • Create a new HTML file and my editor automatically provides the very basic tags embedded within the file.
  • Create a top section on your web page for the banner to be displayed using <div> tag 
<div>
  <a href="_blank"><img src ="images/Chrysanthemum.jpg" height="200" width="1345"  id="banner"/>
   </a>
</div>

My first image on the rotating banner is "Chrysanthemum.jpg" placed in images folder with id attribute for <img> tag as "banner".
  •  Now enter into the JavaScript code within the script tags.
<script language="javascript" type="text/javascript">
</script>
  • We write a rotate() function to flip through the images with a tiny time gap. Create a variable "ad" and initialise it to "0" outside the function.
function rotate()
 {
     var images = new Array ("images/Chrysanthemum.jpg", "images/Desert.jpg", "images/Hydrangeas.jpg");
     ad++;
     if (ad == images.length)
      {
        ad = 0; 
      }
     document.getElementById("banner").src = images [ad] ;
     setTimeout(rotate, 2000);
 }


Within the function a new array called images is created with the image files. The setTimeout function is used to call the rotate() function every 2000 milliseconds. Each time the function is called the "ad" value will be incremented and the "src" attribute of the banner element will be substituted with image from the images array with index as the current "ad" value.
  • We need to add links to each image with a function named newlocation().
function newlocation ()
 {
     var url = new Array ("http://www.google.com","http://www.yahoo.com","http://www.bing.com");
     document.location.href = url [ad];
     return false;
 }


Within this function a new array called url is created with the links to each image. The entire URL of the document is substituted with link from the url array with index as the current ad value.
  • Its time to call the functions now as below.
 document.getElementById("banner").parentNode.onclick = newlocation;
 rotate();


Whenever an image is clicked the newlocation() function is called with the help of onclick event and rotate() function is called directly. This is the basic code for rotating banner and you can add any style to your banner with the help of CSS.

Download code here

Thursday, April 4, 2013

Tips for hassle free use of iPhone by boosting the battery life

  • Turn off Fetch New Data for Mail
Go to Settings -> Mail ->Fetch New Data and turn off Push. Select the option "Manually" from the Fetch options given below. Open the Mail app to receive the emails whenever you wish to read.
  • Auto-Lock feature
Go to Settings -> General ->Auto-Lock. Set the Auto-Lock to 1 Minute to save the battery life.
  • Turn off Bluetooth and Wi-Fi
When you are not using any Bluetooth devices with your iPhone, turn off Bluetooth. Go to Settings -> Bluetooth and turn off. Similarly turn off Wi-Fi when you don't use it. Go to Settings -> Wi-Fi to turn off.
  • Turn on Auto-Brightness
Go to Setting -> Brightness and turn on Auto Brightness. The sensor will detect if you are in bright or dark lighting condition and adjust the brightness of your iPhone as per the condition. This will protect your eyes as well as save battery power.
  • Adjust Equalizer
Go to Settings -> Music ->EQ. Set EQ to "Flat" to conserve battery power.
  • Update to the latest version of the iPhone software. 
  • Turn off Location Services
Go to Settings ->Privacy ->Location Services. Turn off the location services and whenever you open a app that requires location services, it will ask you to turn on the Location services in settings. You can either turn on the feature at that moment or use the app without enabling the service.
  • Keep the iPhone always in room temperature. Avoid leaving the phone either in too hot/cold conditions.
  • Turn off Notifications 
Go to Settings ->Notifications and turn off notifications for those apps from which you don't want to receive any notifications.
  • Once a month, drain your battery completely and then recharge to save battery lifetime. 

Note: All the above stated tips or some of them can be used, based on the preferences in the elements of the iPhone that are intensely being used by the particular person.

Monday, March 25, 2013

Create your own ScreenCast

What is a Screencast?

A Screencast is a video of your computer screen with audio narration.

Many Screencast applications are available in the web and Camstudio is one of them. It is a free open source screencast application.

How to create a Screencast with Camstudio?
  • Go to http://camstudio.org/, Click on the Download links at the middle of the page. Download and install the application on your computer.
  • After installing open the CamStudio program.
  • You can see the buttons to Record, Pause and Stop your screencasting.
  • Go to Options -> Program Options and select "Minimise Program on start Recording". This helps the application to minimise its window automatically when you start recording.
  • By default no audio is recorded. If you want to record audio, Go to Options -> Audio Options and select "Audio Options for Microphone".
  • Select the "Region" on the computer screen to be recorded. 
  • Begin recording your How to videos, lectures etc by clicking on the red circle (Record Button). After finishing your task on the screen to be captured, press F9 to stop the recording. 
  • Now you will be prompted to save the avi file on your computer. You Screencast is now ready to be shared on YouTube.
 Who can benefit more from screencasting technique?
  • Software Professionals - to demonstrate software features.
  • Teachers - for tutorial purpose.
  • Students - to organise seminars and for e-learning.
  • Business Professionals - for publicity, training etc.
I have created a sample ScreenCast and uploaded in YouTube.

How to embed the sample video from YouTube in this post?
  • Go to your YouTube video.
  • Right click on the video and select "Copy embed html".
  • Come back to the blogger post and select HTML view instead of Compose view.
  • Paste the html code copied from YouTube to the existing html code. Postion the code as per your wish for target position.



Note: Many other paid ScreenCast applications are available in the market with more and more features. Based on the type of use and the price they can afford, one can use the screencast program which suites them best.

Wednesday, March 13, 2013

Declutter your Wallet with iPhone's PassBook feature

We have too many cards to carry with us these days apart from the debit/credit cards. Some of those cards are Loyalty cards, Reward cards, Airline Cards, Gift Cards, Store Cards, Coupons, Tickets etc. iPhone's new built-in app named PassBook (A Virtual wallet) can help you to declutter your wallet and store all your cards digitally in a single place. In order to use the PassBook effectually, you need to add your cards to the PassBook. Let me show you how to add the Starbucks Card to your PassBook.

  • Tap on the PassBook App.
  • To add Starbucks Card to PassBook, you first need to download the Starbucks app. Hence tap on the "Apps for PassBook", which will direct you to the App Store and show all the apps that are compatible with PassBook.
  • Install the Starbucks App. Open the Starbucks app and sign in to your Starbucks account. You can enter the numbers on the back of your original starbucks card into the app and the added card will be shown.
  • Tap on the Manage button, and tap on Add Card to PassBook.
  •  Go to PassBook and you can see the Starbucks card added to PassBook.

If you have added your favorite store locations in your starbucks account, once you enter the store, the iPhone uses its location services to know where you are and display you the right card (now starbucks card) on your lock screen before you even think about the card. You can show the barcode to them and get your coffee.. Usually the Pass displayed will contain a barcode for scanning, some additional information like balance, expiration date etc based on the type of the card.

Note: The process of adding cards to the PassBook is different from one company to the other. But once the respective app is downloaded it's easy to add the card by following the onscreen instructions.


Post to Facebook and Twitter from Notification Center - iPhone

With ios6, we have got the facebook and twitter accounts in-built in the iphone rather than depending solely on the apps. Tweeting to twitter and Posting to Facebook can be done rapidly from the iPhone's Notification Center.



Make sure you have signed into facebook and twitter accounts through Settings. To do that, Go to Settings, scroll down to Twitter and Facebook widgets, provide your User Name and Password in the respective columns and sign in your accounts.

How to post easily to Twitter/Facebook?
  • Scroll down the status bar at the top of the screen and the Notification Center will be shown with the two columns "Tap to Tweet and Tap to Post".

  •  'Tap to Tweet' - Twitter

Note: You can tap the "Add Location" to add in your current location. 
  • 'Tap to Post' - FB

Note: You can tap on "Friends" to confine the post to certain group of friends alone.