General tips for web site design

Five Second Rule:
Most web visitors stay at page for 5 seconds, and if they have not seen anything interesting by then, they move on. Put anything you want people to see the upper left corner, where it catches their attention quickly.
*the five seconds includes the time it takes to page load.
The Simpler, the Better:
You will be attempted to put every menu ,button, and search engine on your site ,but fewer choices your visitor have to make, the less likely they will get confused ,and tha cleaner and more professional your site will work .
Name and address:
Put a link on every page that leads to “contacts us “ page, and page contain your e-mail, address ,your physical address ,and phone number.
Don’t use Color coded text:
Do not use color coded text to relay important parts of your message. May people can’t distinguish between colors and might miss the meanings that you intend.
Text Sizes:
Try not to use specific fonts or text sizes on your pages, unless it is necessary to the design of the page.
Writing for international Audience:
Remember that the web is worldwide resource, open to people from many different cultures and countries. what is acceptable in your culture might be vulgar in another culture.

How to Submit your task-3 or Create id folder in skoze ftp server

Open any folder ->
click in folder bar ->
copy this URL
ftp://skoze.com/wwwroot/bs10/
paste in folder bar
press enter.

if there a user prompt window appears please follow these instructions
User Name/Password : WXX /XXXXX3
wait few seconds…..
BS10 folder will be opened now paste your .rar or zip file in your id folder.

if you have not created your id folder,right click and create new folder with your id like folder name “084”.

Assignment – Task 3

Don’t forget to include following list in your HTML Pages:

  •  Schema.org
  •  JAVASCRIPT
  •  Images
  •  Videos
  •  Writing

Creative content development with researching and writing for assigned task is required.
Note: Cut/copy/paste is not allowed.

Deploy your pages on following URL after completion

http://web.skoze.com/bs10/yourid

You also need to make a post on  http://cssubjects.skoze.com  against category Task3 to provide following information.

Note: Don’t forget to link your task with appropriate category otherwise they (i.e http://cssubjects.skoze.com/category/uncategorized/) will not be evaluated

Dead Line:11/4/2013 11:59 PM

Roll No Name Topics
004-bs-10 SHAHERYAR SHAHID Computer and Electronics Hot Product
007-bs-10 HAFIZ AHSAN RAZA Travel Discounts
010-bs-10 M. AHSAN AFZAL Home and Garden
011-bs-10 ARIF ULLAH KHAN Health and Wellness Promotions
013-bs-10 SAAD ZULFIQAR Clothing and Apparel Sale
016-bs-10 SADAF IQBAL Sports and Fitness
019-bs-10 M. SOHAIB IQBAL TOOR Free Shipping
022-bs-10 KHUSHBU KHALID Art General Promotion
025-bs-10 SABREENA NAWAZ Coupons
028-bs-10 MADEEHA AKRAM Outstanding Deals
031-bs-10 MEHER-UN-NISA TARIQ Mobile Services
034-bs-10 USMAN SAEED Jewelry and Accessories
037-bs-10 HINA AZIZ Department Store
046-bs-10 AMEER HAMZA Telecom Promo Code
049-bs-10 MUHAMMAD USMAN ALI Sports and Fitness
052-bs-10 AMNA KHALID Department Stores and Malls
055-bs-10 SHAKEEB RAZA AKHTAR Beauty and Fragrance
058-bs-10 MUHAMMAD EHSAN Gift with Purchase
061-bs-10 MUHAMMAD ALI NAWAZ Electronic Equipment Deals
063-bs-10 CH. M. HASHIM BAJWA Home and Garden
064-bs-10 M. ZAHID AHMAD Travel and Vacations Deals
067-bs-10 MAHA NADEEM Online Free Shipping Services
070-bs-10 INAYAT ULLAH Recreation and Leisure
073-bs-10 MALEEHA SARWAR Automotive Promotions
074-bs-10 FURQAN ALI Online Game
076-bs-10 MUHAMMAD REHAN NIAZ Gourmet Food and Drink
079-bs-10 SAMEET KAMRAN Free Gifts
082-bs-10 SHOAIB MAQSOOD Apparel Sale
085-bs-10 MASHHOOD ADEEB Business Coupons
088-bs-10 MUHAMMAD HASSAN Appliances and Electronics
094-bs-10 MOAZZAM FARID Flowers and Gifts Deals
097-bs-10 REHAB ARIF Games and Toys
100-bs-10 M. ALEEM SARWAR Entertainment Promotions
103-bs-10 ALI SHAHZAD Sweepstakes
106-bs-10 M. RABEEL JAVEED Books and Media
109-bs-10 ASAD ALI Flower and Gift Deals
112-bs-10 WALEED BIN ARSHAD Shoes Discounts
115-bs-10 ADEEL SALEEM Women’s Apparel
118-bs-10 NUMERA PERVAIZ Outdoor Services and Products
121-bs-10 MUZZAMMIL HUSSAIN Men’s  Apparel
125-bs-10 MUHAMMAD AWAIS GHANI Air Deals
069-bs-09 M. AMMAR ZAHEER Consumer Electronics
003-bs-10 MUHAMMAD AHMED Buy x Get y Coupons
006-bs-10 KAMAL KHAN Black Friday
009-bs-10 NIMRA KHAN Discount on Music Products
012-bs-10 ASIM MUNIR Online Shopping Home and Garden
015-bs-10 ZAIN UI ABBADIN KAYANI Halloween Coupons
021-bs-10 AQSA RIAZ Apparel – Woman’s
024-bs-10 UMER BUTT Movies and Games
027-bs-10 USAMA ZAHEER Family Savings
030-bs-10 AHMAD JAMAL Gourmet Sale
033-bs-10 FARHAN ULLAH Books General Promotion
036-bs-10 SHEIKH ABUBAKAR Sports & Outdoor Deals and Discount
039-bs-10 HAJRA AZHAR Computers and Electronics Coupons
042-bs-10 M. BILAWAL KHAN Apparel and Accessories Sale
045-bs-10 MUHAMMAD BILAL ASIF Father’s Day
048-bs-10 ASIFA JAMIL House wares Ongoing Promotion
051-bs-10 ARUSA SARWAR Fragrance Products
054-bs-10 ANEEBA MASOOD Books and Magazines
057-bs-10 OMER ASIF Christmas Coupon Codes
060-bs-10 AMMAR HASSAN Hot Software Products
066-bs-10 M. AHAMD BUTT Hotel Deals and Offers
069-bs-10 M. UMAIR ANWAR Summer Clothes Sale Online
072-bs-10 HAZIQ HASSAN Discount on Educational Degree
075-bs-10 DANISH KAMAL KHAN Cosmetics Price Cut
078-bs-10 HASSAN SHAFIQ Site Wide Promotions
081-bs-10 MUDASSAR ALI Kitchen Hot Product
084-bs-10 M. ASHRAF NAZIR Professional Web Housting Plans
087-bs-10 MOHSIN ALI Jewelry Promo Codes
090-bs-10 FASIHULLAH Green Products & Services
093-bs-10 AROOJ ASLAM ADIL Office Supplies
096-bs-10 HIBBA TUN NOOR Percentage off on Music and Movies
102-bs-10 AMINA ARSHAD Equipment General Promotion
105-bs-10 HARIS ZEESHAN Health Equipment
108-bs-10 MUHAMMAD HASSAN Toys and Games
111-bs-10 MIR QASIM Best online Shopping sites for Electronics
114-bs-10 SIDRA GOHAR Property and  Vacation Rentals Discounts
117-bs-10 ZAEEM NAZIR Buying and Selling Discounts
120-bs-10 AUN RAZA ZAIDI Software Downloads and Reviews
123-bs-10 SANA SALEEM Clothing and Footwear Hot Product
002-bs-10 M. OBAID UR REHMAN Audio Video Prepaid Plans
008-bs-10 M. USMAN ASLAM Cameras and Photography
014-bs-10 NABEEL ANWAR Golf Deals
023-bs-10 ALI HAIDER National Free Shipping
026-bs-10 M. ABUBAKAR DAR Computers Free Shipping
029-bs-10 ANAS ZAHID Photography Deals
032-bs-10 MOHAMMAD SALMAN Special Memorabilia
035-bs-10 FAISAL ASIF Pet Care Promotions
038-bs-10 SHAHZAD ASHRAF Cyber Monday
041-bs-10 AGHA M. MUSA KHAN Medical Suplies Coupons
045-bs-09 HUDA IJAZ Car Rental
047-bs-10 HAFIZ M. ZOHAIB Outstanding Web Hosting Plans
053-bs-10 M. BASIT ALI GILANI Toys Deals
056-bs-10 HAFIZ M. SOHAIL Baby & Kid Deals
059-bs-10 M. HUSSNAIN BUTT Furniture Discount Sale
059-bs-08 TAHIRA RAHIM Shopping News
065-bs-10 PAROZE KHAN Party Goods
077-bs-10 UMER AYOUB Vacation Packages Exclusive
080-bs-10 MUHAMMAD TAYYAB Father’s Day
082-bs-09 MUTIULLAH MUGHAL Home Appliances Discount Codes
083-bs-10 TEHMINA LATIF Save Money on Your Wedding
086-bs-10 SHAHROZ KHAN Computer Hardware Deals
089-bs-10 HUMA BAIG Web Hosting/Servers
092-bs-10 SHARJEEL AHMAD Shopping Malls
095-bs-10 AYESHA YAQUB Free Shipping on Luggage
098-bs-10 M. FAHAD MALIK Outdoor Equipment Deals
101-bs-10 ASMA ARSHAD Handbags and Accessories for Women
107-bs-10 AROOJ QAMAR Back to School Discount Codes
110-bs-10 ZOHAIB SHOKET Easter Discount
113-bs-10 ZAIN UL EMAN Valentine’s day Promotion
116-bs-10 HAFIZ WAQAR AHMAD Mother’s Day Deals
119-bs-10 M. AATIF ISHTIAQ Health and Beauty Hot Products
121-bs-09 KAMRAN AZIZ Back to College Deals and Sales

Wrapper Classes In Java

Wrapper Classes:

Wrapper classes were introduced with the discussion of the primitive data types. Primitive values in Java are not  objects. In order to manipulate these values as objects, the java.lang package provides a wrapper class for each of the primitive data  types. All wrapper classes are final. The objects of all wrapper classes that can be instantiated are immutable, that is, their state cannot be  changed.

Although the Void class is considered a wrapper class, it does not wrap any primitive value and is not instantiable. It just denotes the Class object representing the keyword void.

In addition to the methods defined for constructing and manipulating objects of primitive values, the wrapper classes also define useful  constants, fields, and conversion methods.

When working with numbers, most of the time you use the primitive types in your code. For example:

int i = 500;
float gpa = 3.65f;
byte mask = 0xff;

There are, however, reasons to use objects in place of primitives, and the Java platform provides wrapper classes for each of the primitive data types. These classes “wrap” the primitive in an object. Often, the wrapping is done by the compiler—if you use a primitive where an object is expected, the compiler boxes the primitive in its wrapper class for you. Similarly, if you use a number object when a primitive is expected, the compiler unboxes the object for you.

All of the numeric wrapper classes are subclasses of the abstract class Number:

ammar

Primitive class 

int
char
float
boolean

Wrapper class coreesonding to their respective primitives 

Integer
Charecter
Float
Boolean

Example:

if(Character.isDigit(a[i]))
System.out.println(a[i] + “is a digit “);
if(Character.isLetter(a[i]))
System.out.println(a[i] + “is a letter “);

Byte class methods:

byteValue() – returns the Byte value as byte value
Ex : byte bvalue = Byte.byteValue();
parseByte() – returns byte value from a byte string
Ex: byte bvaue = Byte.parseByte(“93”);

Integer class methods:

intValue() – returns the Integer value as int value
Ex: int bvalue = Integer.intValue();
parseInt() – returns int value from a int string
Ex: int bvaue = Integer.parseInt(“73”);

Usage of Wrapper Classes:

They should be used in situations when primitives cannot be used. The main situation is when you want to store primitives in one of the Java collections (which cannot handle primitives).

The use of the wrapper classes is greatly simplified by something called autoboxing. This means that Java automatically determines whether a primitive or a corresponding wrapper should be used. So it’s rare that you need to use the wrapper classes explicitly.

Example:

ArrayList<Integer> al = new ArrayList<Integer>();

Integer is the wrapper for int. Thanks to autoboxing you can now store ints in the above Arraylist. Or rather Java will perform all necessary conversions back and forth between Integer and int.

Reason of using Wrapper Classes:

1) It is sometimes easier to deal with primitives as objects.
2) Moreover most of the collection classes store objects and not primitive data types.
3) The wrapper classes provide many utility methods also.
Because of these resons we need wrapper classes. And since we create instances of these classes we can store them in any of the collection classes and pass them around as a collection. Also we can pass them around as method parameters where a method expects an object.

Exception Throwing Principles

Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional events requiring special processing – often changing the normal flow of program execution. It is provided by specialized programminglanguage constructs or computer hardware mechanisms.

In general, an exception is handled (resolved) by saving the current state of execution in a predefined place and switching the execution to a specific subroutine known as an exception handler. If exceptions are continuable, the handler may later resume the execution at the original location using the saved information. For example, a floating point divide by zero exception will typically, by default, allow the program to be resumed, while an out of memory condition might not be resolvable transparently.

Alternative approaches to exception handling in software are error checking, which maintains normal program flow with later explicit checks for contingencies reported using special return values or some auxiliary global variable such as C’s errno or floating point status flags; or input validation to preemptively filter exceptional cases.

            Throwing an Exception:

Various exceptions are thrown at the bytecode or system level, such as when an integer division by zero is attempted, when an attempt is made to access an invalid array index, or when Java’s object allocator runs out of heap memory. However, a program can also deliberately throw an exception. Many exceptions that occur are deliberately thrown by Java library code or by user code when they detect a particular error condition.

To throw an exception, the throw keyword is used, followed by the exception object to be thrown. The most common case is to create the exception object on the fly, so that the code to throw an exception looks as follows:

throw new IOException(“Some required files are missing”);

We can create an instance of any public exception class from the libraries, or we can create our own exception subclass.

            Exception Classes:

The hierarchy of exception classes commence from Throwable class which is the base class for an entire family of exception classes, declared in  java.lang package as java.lang.Throwable. A throwable contains a snapshot of the execution stack at the time it was created and also a message string that gives more information about the error. This class can be instantiated and thrown by the program. The throwable class is further divided into two subclasses :-

  1. Exceptions – Exceptions are thrown if any kind of unusual condition occurs that can be caught. Sometimes it also happens that the exception could not be caught and the program may get terminated. Remember that they are a member of Exception family and can be type ofChecked or Unchecked exception.
  2. Errors – When any kind of serious problem occurs which could not be handled easily likeOutOfMemoryError then an error is thrown. Well, errors are not something which is thrown by you rather they are thrown by the Java API or by the Java virtual machine itself i.e. only the exceptions are thrown by your code and not the errors. Also Remember that they are a member of Error family.
  3. The java.lang package defines several classes and exceptions. Some of these classes are not checked while some other classes are checked.
EXCEPTIONS DESCRIPTION CHECKED UNCHECKED
ArithmeticException Arithmetic errors such as a divide by zero YES
ArrayIndexOutOfBoundsException Arrays index is not within array.length YES
ClassNotFoundException Related Class not found YES
IOException InputOuput field not found YES
IllegalArgumentException Illegal argument when calling a method YES
InterruptedException One thread has been interrupted by another thread YES
NoSuchMethodException Nonexistent method YES
NullPointerException Invalid use of null reference YES
NumberFormatException Invalid string for conversion to number YES
  1. As you have come to know that exceptions are Objects that means an object is thrown when you throw an exception. Moreover only those objects could be thrown whose classes are derived from

Throwing and catching exceptions:

For throwing and catching exceptions in java, try and catch blocks are really simple. The basic syntax follows. For this example, we’ll try to read a file that doesn’t exist. (The details of file I/O comes later in this tutorial; the important part is just that this code is risky: if the file “myfile.txt” doesn’t exist, the FileReader constructor throws a FileNotFoundException.)

System.out.println(“Ready? Go!”);

try

{

System.out.println(“I think I can…”);

FileReader reader =newFileReader(“myfile.txt”);

System.out.println(“I knew I could!”);

}

catch(FileNotFoundException ex)

{

System.out.println(“File not found.”);

}

System.out.println(“All done.”);

Whenever a method of some class could throw an exception, you should use the try/catch block. The compiler tries to run the code in the try block. If any statement in the block throws an exception, the JVM jumps to the appropriate catch block; that is, the catch block that names the thrown exception. If no code in the try block throws an exception, the catch block is skipped.

Consider the code above. If the named file exists, the try block runs to completion, and the catch block is skipped. The output is

Ready? Go!

I think I can…

I knew I could!

All done.

If the file does not exist, however, the try block halts at the FileReader constructor, and the catch block is run:

Ready? Go!

I think I can…

File not found.

All done.

Defensive Programming

Defensive programming is a form of defensive design intended to ensure the continuing function of a piece of software in spite of unforeseeable usage of said software. The idea can be viewed as reducing or eliminating the prospect of Murphy’s Law having effect. Defensive programming techniques are used especially when a piece of software could be misused mischievously or inadvertently to catastrophic effect.

Defensive programming is an approach to improve software and source code, in terms of:

  • General quality – Reducing the number of software bugs and problems.
  • Making the source code comprehensible – the source code should be readable and understandable so it is approved in a code audit.
  • Making the software behave in a predictable manner despite unexpected inputs or user actions.

Prototyping

In the progressive phase of developing a project, instead of designing and then building the completeapplication in one massive leap, prototyping can be used to examine parts of a system.A prototype is a version of the application where one part is simulated in order toexperiment with other parts. For example, one can implement a prototype to test agraphical user interface. In that case, the logic of the application may not be properlyimplemented. Instead, we would write simple implementations for those methods thatsimulate the task. For example, when calling a method to find a free seat in thecinema system, a method could always return seat 3, row 15, instead of actuallyimplementing the search. Prototyping allows us to develop an executable (but notfully functional) system quickly, so that we can investigate parts of the application inpractice.

Prototypes are also useful for single classes to aid a team development process. Often,when different team members work on different classes, not all classes take the sameamount of time to be completed. In some cases a missing class can hold upcontinuation of development and testing of other classes. In those cases it can bebeneficial to write a class prototype. The prototype has implementations of all methodstubs, but instead of containing full, final implementations, the prototype only simulates the functionality. Writing a prototype should be possible quickly, anddevelopment of client classes can then continue using the prototype until the class isimplemented.

 

Documentation

Moving towards the documentation of a project or application, afterclassifying the classes and their interfaces, and before starting to implement themethods of a class, the interface should be documented. This includes writing a classcomment and method comments for every class in the project. These should be defined in adequate detail to identify the overall purpose of each class and method.

Along with analysis and design, documentation is a further area that is often neglected by beginners. It is not easy for inexperienced programmers to see whydocumentation is so important. The reason is that inexperienced programmers usuallywork on projects that have only a handful of classes, and that are written in the spanof a few weeks or months. A programmer can get away with bad documentation whenworking on these mini-projects.

However, even experienced programmers often wonder how it is possible to write thedocumentation before the implementation. This is because they fail to appreciate that good documentation focuses on high-level issues, such as what a class or method does, rather than low-level issues, such as exactly how it does it. This is usuallysymptomatic of viewing the implementation as being more important than the design.