Tuesday, September 30, 2014

Comprehend the difference between Block and Inline Elements of HTML

There are three major types of HTML elements.
  1. Structural Elements
  2. Block Elements
  3. Inline Elements
Structural Elements

The Structural Elements are <html>, <head> and <body> tags.

Block Level Elements
  1. All Block elements occupy a rectangular space within the web page and the content before and after the element are separated with the help of line spacing (in other words line break) i.e they represent a separate section from the elements preceding and following them.
  2. The block elements provide structure to a particular web page. 
  3. Examples of Block Elements: Headings, Paragraphs, Body, <table>, <div> etc.
  4. HTML5 introduced new block elements for every sections of the web page like section, header, footer etc.
  5. A Block element should never be inside an inline element.
  6. Many of the block elements can be nested. A block element can contain other block elements. But the exceptions are <p> and <pre> and they can contain only inline elements and plain text.
  7. They never overlap or overlapped by other elements.
  8. They change the content flow.
  9. Block elements occupy the full width available and just enough height to accommodate the content.
  10. They have the CSS box properties.
Inline Elements
  1. They are the elements within a line. Examples: <span>, <em>, <img>, <a> etc.
  2. Inline elements can contain inline elements but no block elements.
  3. Inline Elements are mostly used to format words and characters.
  4. Inline elements take only as much space as their content requires.
  5. They do not change the content flow.
The below HTML and Image differentiates between block and inline elements.

<h1>Block Level Element - Heading</h1>
<p>Block Level Element - Paragraph1
<span>Inline Span Element</span>
<a href="">Inline Anchor Element</a>
</p>
<p>Block Level Element - Paragraph2</p>

 

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.