Monday, December 9, 2013

The Java program doorway - main method

In any Java Application, there should be at-least one main method available and can be in any of the classes. The JVM starts the execution from the first statement of the main method and ends after the last statement. A Sample main method...

public class MyFirstApp
{
public static void main(String[] args)
{
System.out.println("Main method inside class MyFirstApp");
}
}

The keyword 'public' specifies that the main method can be accessed from anywhere. 

The 'static' keyword implies that the main method can be accessed without instantiation i.e objects are not needed to access the main method.

'void' denotes that the main method doesn't return any value.  

String[] is an array of strings (sequence of characters) and is named 'args' (This name "args" can vary"). In Java, the main method needs a single array of strings as parameter.

Queries:

Can we declare a main method as Private?
                               or
Can we remove static keyword from the main method?
                               or
Can we remove the argument String[] args from the main method?

If we do any of the above, the compiler will run properly. But at run time, the JVM throws the error message.

What will happen if I write "static public void" in place of "public static void"?

The program will run and execute properly with no errors.

Can I have many main methods in the same class?

No, Compiler error occurs.

Note:

The name of the class containing the main method must be the same as the name given to the program file itself.

Wednesday, November 20, 2013

All about $GLOBALS in PHP

PHP Superglobals or Auto-globals

In PHP there are certain predefined variables and are called superglobals or Auto-globals. Those variables are accessible throughout the program irrespective of their scope. One such is a variable named $GLOBALS.

$GLOBALS

PHP stores all the global variables (variables within global scope of the script) currently available in the script, in an associative array called $GLOBALS[index]. "index" refers to the name of the individual global variables.
 
Example:

global $myVar = 3;

global $a = 20;


"myVar" is a global variable and holds the value 3.

"a" is a global variable and holds the value 3.

implies

$GLOBALS['myVar'] = 3;

$GLOBALS['a'] = 20;


The example given below explains the $GLOBALS array.

<?php
$x = "save";

function toclose()
{
$y = "close";
}
?>

Here, $x will be stored in the $GLOBALS array (as x is declared outside the function) and $y wont be stored in the $GLOBALS array (as y is declared inside the function).

Generally a global variable has scope only outside the functions. Since $GLOBALS[] is a superglobal, this can be used to access the global variables even within the functions. Here is an example to portrait this scenario..

Code:

<?php
$myVar = 10;

function testglobals()
{
 $GLOBALS['myVar'] = 20;
}

testglobals();
echo $myVar;
?>

Result:

20

Note: From the above exemplar, we can note that, with the help of superglobal $GLOBALS, it is possible to access or modify any global variable inside any space of the program.

Some of the other PHP Superglobals are

$GLOBALS, $_SERVER, $_REQUEST, $_POST, $_GET,
$_FILES, $_ENV, $_COOKIE, $_SESSION.

These can be discussed in future posts.

Monday, November 4, 2013

Basic framework for websites of present style

Designing a compact website is one of the key factors for success in the bush of web. In current era, your websites serve as an icon for your own dream of passion in any field such as Business, Arts, Education, Sports, Entertainment or whatever it maybe. Henceforth the websites need to be well designed to cope up with today's trend as well as to satisfy the requirements of your viewers and dispense a great user experience. Here are some basic elements a website should possess to attain a neat design.

Banner

A banner is a rectangular piece of element  made up of texts/graphic images/sounds/animations etc. usually present at the top of the website. This bears the symbol/logo/watchword of your website.


Tabbed Navigation

This allows the user to load multiple pages into tabbed segments of a single page. This element is useful for proper organization of the web info and makes the user navigation easy and clear. When the user clicks on any tab, that particular tab turns up to the front.
Fly-out Menu

In view of the fact that the websites have more categories and sub categories, it should provide fly-out menus with navigation links to all categories in addition to the standard Tabbed Navigation. This type of menu allows the user to peer instantly into all the categories just by moving the mouse over the menu. This hugely lowers the number of clicks the user requires to do and offer a rich overview of the website to the viewer.

Tabbed Navigation & Fly-out Menu

Rollover

This is an interactive effect adapted in websites which allows the user to rollover a text/image/button and making them react i.e do a simple action.

Exemplar: Flip between two images.

When the user perform "mouse over" by moving over the first image,the second image will appear - when the user "mouses out" by moving the mouse away from the image, the first image will reappear.

Go to http://www.yahoo.com/ and rollover the smaller images to look over the larger ones.

Skinning & Themes

Skinning is a technique through which the same website can be presented with different look & feel to different users (custom designed) based on the individual's taste. In this case, the website needs to propose a range of per-designed themes/skins for the user's choice.

Social Media elements

Social media plays a significant role in increasing the exposure of a particular website among viewers. This can be accomplished by integrating the social media icons within you website and bring to light your realm in the social world.


FAQ Page

FAQ (Frequently Asked Questions) Page is a collection of most commonly asked questions with the answers. The FAQ Page adds value to your website and serves as a reference guide for your users.



Popups

A popup is a small window that emerge in the front and is activated when you choose something with the mouse/key. A well designed popup is the one with all the browser components such as browser menus, scroll bar and re-sizing options. The response time for popup is faster compared to the original page itself.



Site map

A site map lists all the pages on the website with links organized in hierarchical fashion. It provides the search engine with information regarding the entire content of your website. For large sites, this helps the people to figure out the information they are looking for. The site map can be compared with the traditional geographical map.



Iconography

Icons are the emblematic representation of some idea. The icons completely change the appearance of your website. The iconic link takes less space compared to a textual link. They can be placed in Navigation Bars, Side Bars, footers etc. The clever use of icons provide better experience to the user.


Google maps

This is a free element from Google. It is very easy to embed Google maps to any website. You can embed a simple map, a set of driving directions, a map you created using Custom Maps for Google Maps, a map of a local search or maps created by other users into your website.

Photo/Video gallery

Embedding Photo/Video gallery is one of the most popular web design trend existing today.


Search Box

This element improves the quality of site navigation and accessibility. In addition to this forthright benefit, the site's search box also helps the website owner to learn more about the user expectations from their site, through search query analysis.



Tuesday, August 20, 2013

Software Development process and business inquiries

Software travels into everything and changes anything it strikes upon. Software developers are working hard to keep going and develop better applications. Software Development is the process of developing software in a step by step and organized way. Here are the finest procedures that turn any software development process & business into a successful one.

  • A thorough Market research - This helps us to pinpoint & study market needs and to find out what people want/need.
  • Be choosy on Clients - When you are selective on your clients, you can do better business and get more profits.
  • Gather detailed requirements - It is indeed important to interact with the client and get all three types of requirements (functional, environmental and performance requirements). While gathering requirements focus on user point of view rather than your point of view.
  • Create Scope (range of the project) Document - Investigate scope of the development and create scope document. This will help you and your client to understand precisely the expectations from both sides to be encountered during the course of the project.
  • Think as a user and not programmer - This thought process helps the programmer to develop user-friendly applications.
  • Coding standard - Set up an ideal coding standard. You can even enhance the system by automating the coding standard.
  • Simple Coding - At times Complex codes make the programmers to discard the existing code and write a new one. Hence every developer should focus on simplifying the code they produce (by using advanced technologies). This greatly reduces tons of complexities to be faced in future and increases the maintainability of the code
  • Document everything -  This allows us to uphold the history of the project at various cycles which can be used in future by the maintenance people.
  • Improve the software process by analyzing and measuring the complexities.
  • Flexible Software architecture - Software architects with deep knowledge of the entire system should be assigned to create the architecture of the application. He/She should focus on the flexibility of the architecture and should be designed in a way to accommodate any upcoming changes.
  • Reusable components - The team should likely opt for Component based software. The programmers should develop more general and reusable components so that many other programs can use them.
  • Developer testing - The developers are the best white box testers for their own code.  Hence the application needs to be tested by the developer itself before passing to the Quality Assurance team.
  • Customer testing - This kind of testing is very important as it provides feedback on how the real users are using the system and to make the correct decisions after testing.
  • Eventually make the software release process to be simple and reliable.

Piece of Software History

Years back the Computer Hardware companies offered software at free of cost bundled with their hardware. This has been changed in the 1960s as a solution for the dispute between the companies ADR and IBM. In 1965 ADR developed the first licensed software product and patented their software in 1968. ADR was competing against a free software provided by IBM. ADR accused that IBM was "retarding the growth of the independent software industry". In 1969 the US Department of Justice charged IBM with ruining businesses by bundling free software with IBM hardware. Hence IBM unbundled its software. And then software became independent from hardware product. This is a milestone behind today's multibillion dollar software industry.





Friday, June 14, 2013

Jump-start with Wordpress

WordPress is one of the well-liked online blogging platform which serves a wide diversity of bloggers for different kinds of purposes. WordPress has plenty of advanced features presented with simplicity and flexibility which elevated it better than many of the other blogging tools. Do you want to start up with WordPress?

The first stride is to sign up with wordpress.com and this allows you to create as many blogs you want to publish under a single account. Have a look at this Video before proceeding.





Go to the wordpress sign up page https://signup.wordpress.com/signup/.



Enter your

E-mail Address: Your primary email address as it is needed to activate the account and for further correspondences from wordpress.

Username: The logon name you want to use to sign in your wordpress account in future.

Password

Blog Address: This will serve as the prefix of the URL address of your blog. Consider a name that is closely related to your content and this will help you greatly in Search Engine listing of your blog.

Wordpress will do a primary validation of your details entered above and will enable the "Create Blog" button for free subscription. Click on the "Create Blog" button. An activation email will be sent to your email address given above. Login to your email and click on "Activate Blog" link available in the WordPress email.

It's all set and done now.

Here is a snap of my wordpress account landing page with significant areas highlighted.

.

Reader:  This tab provides room for all of your favorite blogs (even other than wordpress blog) you follow. You can Like and Reblog your favorite posts.

Stats:  Your stats page displays the data about the number of visitors, their place, the popular posts etc of your blog in the form of graphs and charts.

My Blog:  This tab lists all of your blogs and you can click on each one of them to reach their individual dashboards.

Freshly Pressed:  Everyday this tab brews out new blog posts with unique content to entertain us.


- Create new posts and be notified about your likes, comments and followers.


My Activity: This allows you to see the likes and comments you have made.

Recommended Blogs:  List of blogs on all categories recommended by wordpress to you.

Find Friends:  This helps to find your friends from Twitter, Facebook and Google who are blogging with wordpress.

This section allows you to explore the popular subjects in wordpress with recently published posts under each topic. Click "Follow" to add a topic to your reader and keep track of all the posts under the topic of your interest.



WordPress suggests these blogs for you.










Ready to make a start!

Thursday, May 16, 2013

Feel smashing via customizing Windows

Here are few tips to personalize Windows 7 and enhance your Windows experience.
  • Change the Windows theme -> Right click an empty space in the desktop and click Personalize to open the "Personalization Window".




You can download new themes from http://windows.microsoft.com/en-us/windows/themes
  •  Set the screensaver.

"Wait:" is to specify the computer idle time after which the screensaver should be appeared. Check the "On resume, display logon screen" box. This allows the system to ask for password when someone is interrupting the screensaver.
  • Customize variety of items using Window color and Appearance Dialog Box.
 

Select the item you want to customize. Change the color of the object selected and format the text.
  • Choose the right picture for your account.
  • Change the sound theme.
  • Add gadgets to your desktop.

Get more gadgets from  
http://windows.microsoft.com/en-US/windows/gadgets
  • Change the "Mouse Pointer" scheme.

Doing these simple changes in Windows provide a great change in the look and feel of the PC.

Tuesday, May 14, 2013

Facebook and Workplace

    How Facebook can be used beneficial within Workplace?


    • Connect with your co-workers through Facebook. There exists a myth that it is a very bad idea to friend your co-workers on Facebook. This may be true or false to some extent. By being aware of some norms, Facebook can potentially be used in the workplace with a bunch of positive use.
    1. To start with, understand the security settings of your Facebook profile. This is the Facebook page with key info about the Privacy settings of your profile http://www.facebook.com/help/privacy and its mandatory to be familiar with all those access settings completely.
    2. "Who can see What" - We should always keep in mind that, We, the central players of the Facebook portal are the one who decide what information to share and with whom. It is absolutely under our control. We can create customized groups of friends list (a separate list for colleagues) and have the autonomy to share something to specific people or hide something from specific group.
    3. We have to be alert and concerned about the fact that "Many Employers are currently watching their employees through Facebook". This should be ethically and legally questionable action of employers, but it is far beyond the topic to talk over in this particular post.
    4. Be conscious about every single piece of info (particularly about your office politics/colleagues/clients) you share with your co-workers on Facebook. "You own your own words and their impacts".
    • Company specific events like Tournaments for employees, weekend trip, pizza party etc can be hosted to maintain cooperative relations among coworkers with the help of Facebook. Create a Facebook event providing details about the event and invite your co-workers. The event can be in person or online.
    • Fundraising social cause campaigns like Go Green, Book Sale, Craft show etc can be run within the workplace which is beneficial in constructing the workplace community. Facebook facilitates this process.
    • You can build a powerful professional network. Facebook aids you to establish your professional identity and to collaborate with networks specific to your field of work. This can be achieved by maintaining your profile updated, complete and appropriate.
    • Create Facebook Groups having members from the workplace with similar interests and passion like Writing, Walking, Yoga, Hiking etc. When you find people with similar interests within the workplace, it becomes easy to explore the passion to next level, accompanied by your workplace friends.
    • Instant messaging through Facebook becomes a effective tool within the organization as it paves way to increased interaction and communication and instantaneous information sharing among the employees.
    • Collaborate and learn through Facebook. Employees can learn together within networks of knowledgeable people by sharing their interests, sharing helpful videos, engaging with peers, having meaningful conversations which leads to quick learning and success.
    Hence within the workplace, the employees can acquire extensive benefits from Facebook by handling it with appropriate responsibility

    We welcome you to discuss in depth on this topic by conversing in the comment section.

    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.