Expansion Request Reaction in Project

1- Reduce the remaining scope by removing an unimplemented item of the same cost from this release.

2- Increase the time allotted: request more time, and ask for more money.

3- Increase your manpower: ask for more money, and increase your team size.

Project-change-reaction

Project-change-reaction

Object to Bytes and Bytes to Object Transformer

  1. public static class Transformer {
  2.  
  3.  public static byte[] toBytes(Object obj) {
  4.  
  5.  byte[] data = null;
  6.  
  7.  try {
  8.  
  9.  
  10.  
  11.  oos.writeObject(obj);
  12.  
  13.  oos.flush();
  14.  
  15.  oos.close();
  16.  
  17.  bos.close();
  18.  
  19.  data = bos.toByteArray();
  20.  
  21.  } catch (IOException ex) {
  22.  
  23.  throw new IllegalStateException(Object is unreadable.”);
  24.  
  25.  }
  26.  
  27.  return data;
  28.  
  29.  }
  30.  

How do I speed up the gwt compiler?

Let’s start with the uncomfortable truth: GWT compiler performance is really lousy. You can use some hacks here and there, but you’re not going to get significantly better performance.

A nice performance hack you can do is to compile for only specific browsers, by inserting the following line in your gwt.xml:

<define-property name="user.agent" values="ie6,gecko,gecko1_8"></define-property>

or in gwt 2.x syntax, and for one browser only:

<set-property name="user.agent" value="gecko1_8"/>

This, for example, will compile your application for IE and FF only. If you know you are using only a specific browser for testing, you can use this little hack.

Another option: if you are using several locales, and again using only one for testing, you can comment them all out so that GWT will use the default locale, this shaves off some additional overhead from compile time.

Finally, there is a nice blog post on increasing compile-time performance:

Bottom line: you’re not going to get order-of-magnitude increase in compiler performance, but taking several relaxations, you can shave off a few minutes here and there.

How to set up Virtual Host in WAMP?

How to set up Virtual Host in WAMP?

You must have WAMP installed on your system and running on port 80.

To set up a virtual host and a local domain, follow the steps mentioned below:

1) In folder C:/wamp/www on computer1, we now create 3 folders associated with domain and 2 subdomains as follows:
C:/wamp/www/domain
C:/wamp/www/sub1
C:/wamp/www/sub2
2) In each folder, we create folder logs to store the log files, and make sure to have these logs folders in place or your wamp will not run:
C:/wamp/www/logs
C:/wamp/www/domain/logs
C:/wamp/www/sub1/logs
C:/wamp/www/sub2/logs
3) open file httpd.conf in folder C:\wamp\bin\apache\apache2.2.6\conf and find these lines:
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
4) uncomment the second line, and make sure there is no blank space in front of second line and in the end of first line or your wamp will not run:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
5) open file httpd-vhosts.conf in folder C:\wamp\bin\apache\apache2.2.6\conf\extra, delete everything in there and replace with these codes below. Make sure to put your main site on very first and localhost in very last.

NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias domain.com domain
DocumentRoot C:/wamp/www/domain
ErrorLog C:/wamp/www/domain/logs/error.log
CustomLog C:/wamp/www/domain/logs/access.log common
</VirtualHost>
<VirtualHost *:80>
ServerName sub1.domain.com
ServerAlias sub1
DocumentRoot C:/wamp/www/sub1
ErrorLog C:/wamp/www/sub1/logs/error.log
CustomLog C:/wamp/www/sub1/logs/access.log common
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.domain.com
ServerAlias sub2
DocumentRoot C:/wamp/www/sub2
ErrorLog C:/wamp/www/sub2/logs/error.log
CustomLog C:/wamp/www/sub2/logs/access.log common
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:/wamp/www
ErrorLog C:/wamp/www/logs/error.log
CustomLog C:/wamp/www/logs/access.log common
</VirtualHost>

6) open file “hosts” in folder C:/Windows/System32/drivers/etc on computer1; then, delete and replace those dummy codes with these codes:
127.0.0.1 localhost
127.0.0.1 domain
127.0.0.1 sub1
127.0.0.1 sub2

7) Now, you can access the domain on your local system as

http://domain
http://sub1
http://sub2
cPanel

HadoopMapReduce – Hadoop Wiki

How Map and Reduce operations are actually carried out

Introduction

This document describes how MapReduce operations are  carried out in Hadoop. If you are not familiar with the Google MapReduceprogramming model you should get acquainted with it first.

Map

As the Map operation is parallelized the input file set is first split to several pieces called FileSplits. If an individual file is so large that it will affect seek time it will be split to several Splits. The splitting does not know anything about the input file’s internal logical structure, for example line-oriented text files are split on arbitrary byte boundaries. Then a new map task is created per FileSplit.

When an individual map task starts it will open a new output writer per configured reduce task. It will then proceed to read its FileSplit using the RecordReader it gets from the specified InputFormat. InputFormat parses the input and generates key-value pairs. InputFormat must also handle records that may be split on the FileSplit boundary. For example TextInputFormat will read the last line of the FileSplit past the split boundary and, when reading other than the first FileSplit, TextInputFormat ignores the content up to the first newline.

It is not necessary for the InputFormat to generate both meaningful keys and values. For example the default output from TextInputFormat consists of input lines as values and somewhat meaninglessly line start file offsets as keys – most applications only use the lines and ignore the offsets.

As key-value pairs are read from the RecordReader they are passed to the configured Mapper. The user supplied Mapper doeswhatever it wants with the input pair and calls OutputCollector.collect with key-value pairs of its own choosing. The output it generates must use one key class and one value class. This is because the Map output will be written into a SequenceFile which has per-file type information and all the records must have the same type (use subclassing if you want to output different data structures). The Map input and output key-value pairs are not necessarily related typewise or in cardinality.

When Mapper output is collected it is partitioned, which means that it will be written to the output specified by the Partitioner. The default HashPartitioner uses the hashcode function on the key’s class (which means that this hashcode function must be good in order to achieve an even workload across the reduce tasks). See MapTask for details.

N input files will generate M map tasks to be run and each map task will generate as many output files as there are reduce tasks configured in the system. Each output file will be targeted at a specific reduce task and the map output pairs from all the map tasks will be routed so that all pairs for a given key end up in files targeted at a specific reduce task.

Combine

When the map operation outputs its pairs they are already available in memory. For efficiency reasons, sometimes it makes sense totake advantage of this fact by supplying a combiner class to perform a reduce-type function. If a combiner is used then the map key-value pairs are not immediately written to the output. Instead they will be collected in lists, one list per each key value. When a certain number of key-value pairs have been written, this buffer is flushed by passing all the values of each key to the combiner’s reduce method and outputting the key-value pairs of the combine operation as if they were created by the original map operation.

For example, a word count MapReduce application whose map operation outputs (word, 1) pairs as words are encountered in the input can use a combiner to speed up processing. A combine operation will start gathering the output in in-memory lists (instead of on disk), one list per word. Once a certain number of pairs is output, the combine operation will be called once per unique word with the list available as an iterator. The combiner then emits (word, count-in-this-part-of-the-input) pairs. From the viewpoint of the Reduce operation this contains the same information as the original Map output, but there should be far fewer pairs output to disk and read from disk.

Reduce

When a reduce task starts, its input is scattered in many files across all the nodes where map tasks ran. If run in distributed mode these need to be first copied to the local filesystem in a copy phase (see ReduceTaskRunner).

Once all the data is available locally it is appended to one file in an append phase. The file is then merge sorted so that the key-value pairs for a given key are contiguous (sort phase). This makes the actual reduce operation simple: the file is read sequentially and the values are passed to the reduce method with an iterator reading the input file until the next key value is encountered. See ReduceTaskfor details.

At the end, the output will consist of one output file per executed reduce task. The format of the files can be specified with JobConf.setOutputFormat. If SequentialOutputFormat is used then the output key and value classes must also be specified.

Resources Corporate Hospitality Jobs

Minimizing work – Google App Engine – Google Code

Paging without using offset

Paging is a convenient way of presenting users with a large amount of information without overwhelming them or exacerbating load times. The concept is simple—instead of displaying all data on a single screen, only a subset of the data is displayed, like a listing of search results in your favorite search engine. Users are able to “page” through the result set, seeing only a limited number of items on each page until there are no more items to display.

Many first-time App Engine developers choose to implement paging using the offset mechanism—fetching a large number of results for each request but then displaying a small subset of these from a specified offset. There are several problems with this technique. The most glaring issue is the fact that individual datastore queries can return a maximum of 1,000 results each. If you have more than 1,000 items to display, this approach is clearly inadequate. A more subtle issue is its inefficient use of resources. For example, assume your page size is 10, e.g. you are displaying 10 items per page. Using the offset approach, you run a query to get all items and then find the proper items to display using an offset parameter. Assuming you have at least 1,000 entities, your application is fetching 990 useless entities per request and is needlessly consuming resources in order to find the proper items to display.

Fortunately, there is a better way, as outlined in “How-To Do Paging on App Engine“. The approach calls for storing a property with each entity, either a count or a date, and using this property to determine which results to fetch. Using this approach, you never fetch items you don’t display and you can display as many entities as you have stored—there is no maximum of 1,000. Another strategy involves using the __key__ property to page when the order of items isn’t important. Both of these techniques are more efficient than the offset approach described earlier. Please see the article linked above for more information and sample code.

New Google Apps Channel API

The Channel API creates a persistent connection between your application and Google servers, allowing your application to send messages to JavaScript clients in real time without the use of polling. This is useful for applications designed to update users about new information immediately. Some example use-cases include collaborative applications, multi-player games, or chat rooms. In general, using the Channel API is a better choice than polling in situations where updates can’t be predicted or scripted, such as when relaying information between human users or from events not generated systematically.

Be Like a River

To be like a river that flows
silent through the night,
not fearing the darkness and
reflecting any stars high in the sky.

And if the sky is filled with clouds,
the clouds are water like the river, so
without remorse reflect them too”

http://paulocoelhoblog.com/

SAXParser Example

// —————————————————————————–
// SAXExample.java
// —————————————————————————–
// imports
import java.io.*;
import java.net.URL;

import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;

import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;

/**
* —————————————————————————–
* Demonstrate how to use SAX.
*
* @version 1.0
* @author Muhammad Abid (abidshafiq479@hotmail.com)
* @author http://www.techstop.abidshafiq.com
* —————————————————————————–
*/

public class SAXExample extends HandlerBase{

// Store the locator
Locator locator;

/*
** +———————————————–+
** | METHOD: main |
** +———————————————–+
*/
static public void main(String[] argv) {

try {

if (argv.length != 1) {
// must pass in the name of the XML file
System.err.println(“Usage: java SAXExample filename”);
System.exit(1);
}

// Create a new handler for the parser
SAXExample sample = new SAXExample();

//get instance of factory
SAXParserFactory factory = SAXParserFactory.newInstance();
// Get an instance of the parser
SAXParser parser = factory.newSAXParser();

// Convert file to URL and parse
try {
parser.parse(fileToURL(new File(argv[0])).toString(),sample);
} catch (SAXParseException e) {
System.out.println(e.getMessage());
} catch (SAXException e) {
System.out.println(e.getMessage());
}

} catch (Exception e) {
System.out.println(e.toString());
}

}

/*
** +———————————————+
** | METHOD: fileToURL |
** +———————————————+
*/
static URL fileToURL(File file) {

String path = file.getAbsolutePath();
String fSep = System.getProperty(“file.separator”);
if (fSep != null && fSep.length() == 1) {
path = path.replace(fSep.charAt(0), ‘/’);
}
if (path.length() > 0 && path.charAt(0) != ‘/’) {
path = ‘/’ + path;
}

try {
return new URL(“file”, null, path);
} catch (java.net.MalformedURLException e) {
throw new Error(“unexpected MalformedException”);
}

}

/*
** +————————————————————-+
** | ———————————————————– |
** | Sample Implementation of DocumentHandler Interface |
** | ———————————————————– |
** +————————————————————-+
*/

/*
** +———————————————+
** | METHOD: setDocumentLocator |
** +———————————————+
*/
public void setDocumentLocator(Locator locator) {
System.out.println(“SetDocumentLocator:”);
this.locator = locator;
}

/*
** +———————————————+
** | METHOD: startDocument |
** +———————————————+
*/
public void startDocument() {
System.out.println(“StartDocument”);
}

/*
** +———————————————+
** | METHOD: endDocument |
** | Receive notification of the end of the document.|
** +———————————————+
*/
public void endDocument() throws SAXException {
System.out.println(“EndDocument”);
}

/*
** +———————————————+
** | METHOD: startElement |
** +———————————————+
*/
public void startElement(String name,Attributes atts) throws SAXException {

System.out.println (“StartElement: ” + name);

for (int i=0; i String aname = atts.getLocalName(i);
String type = atts.getType(i);
String value = atts.getValue(i);

System.out.println(" " + aname + "("+type+") = " + value);
}

}

/*
** +---------------------------------------------+
** | METHOD: endElement |
** +---------------------------------------------+
*/
public void endElement(String name) throws SAXException {
System.out.println("EndElement:" + name);
}

/*
** +---------------------------------------------+
** | METHOD: chracters |
** +---------------------------------------------+
*/
public void chracters(char[] cbuf, int start, int len) {
System.out.print("Characters: ");
System.out.println(new String(cbuf, start, len));
}

/*
** +---------------------------------------------+
** | METHOD: ignorableWhitespace |
** +---------------------------------------------+
*/
public void ignorableWhitespace(char[] cbuf, int start, int len) {
System.out.println("ignorableWhitespace:");
}

/*
** +---------------------------------------------+
** | METHOD: processingInstruction |
** +---------------------------------------------+
*/
public void processingInstruction(String target, String data) throws SAXException {
System.out.println("processingInstruction: " + target + " " + data);
}

/*
** +-------------------------------------------------------------+
** | ----------------------------------------------------------- |
** | Sample Implementation of EntityResolver Interface |
** | ----------------------------------------------------------- |
** +-------------------------------------------------------------+
*/

/*
** +---------------------------------------------+
** | METHOD: resolveEntity |
** +---------------------------------------------+
*/
public InputSource resolveEntity(String publicID, String systemID) throws SAXException{

System.out.println("resolveEntity:" + publicID + " " + systemID);
System.out.println("Locator:" + locator.getPublicId() + " " + locator.getSystemId() +
" " + locator.getLineNumber() + " " + locator.getColumnNumber());
return null;

}

/*
** +-------------------------------------------------------------+
** | ----------------------------------------------------------- |
** | Sample Implementation of DTDHandler Interface |
** | ----------------------------------------------------------- |
** +-------------------------------------------------------------+
*/

/*
** +---------------------------------------------+
** | METHOD: notationDec1 |
** +---------------------------------------------+
*/
public void notationDec1(String name, String publicID, String systemID) {
System.out.println("NotationDec1: " + name + " " + publicID + " " + systemID);
}

/*
** +---------------------------------------------+
** | METHOD: unparsedEntityDec1 |
** +---------------------------------------------+
*/
public void unparsedEntityDec1(String name, String publicID, String systemID, String notationName) {
System.out.println("unparsedEntityDec1: " + name + " " + publicID + " " + systemID + " " + notationName);
}

/*
** +-------------------------------------------------------------+
** | ----------------------------------------------------------- |
** | Sample Implementation of ErrorHandler Interface |
** | ----------------------------------------------------------- |
** +-------------------------------------------------------------+
*/

/*
** +---------------------------------------------+
** | METHOD: warning |
** +---------------------------------------------+
*/
public void warning(SAXParseException e) throws SAXException {
System.out.println("Warning: " + e.getMessage());
}

/*
** +---------------------------------------------+
** | METHOD: error |
** +---------------------------------------------+
*/
public void error(SAXParseException e) throws SAXException {
throw new SAXException(e.getMessage());
}

/*
** +---------------------------------------------+
** | METHOD: fatalError |
** +---------------------------------------------+
*/
public void fatalError(SAXParseException e) throws SAXException {
System.out.println("Fatal Error");
throw new SAXException(e.getMessage());
}

}

HTML Forms

HTML Forms
Forms are a very important tool for the webmaster to collect information from the web, like: name, email address, credit card, etc. A form will take input from the viewer and depending on your requirements; you may store up that information into a folder, place an order, gather user information, register the person to your web forum, or maybe subscribe them to your weekly newsletter.


Text Fields

Before we teach you how to make a complete form, let’s start out with the basics of forms. Input fields are going to be the meat of your form’s sandwich. The
has a few attributes that you should be aware of.

  1. type – Determines what kind of input field it will be. Possible choices are text, submit, and password.
  2. name – Assigns a name to the given field so that you may reference it later.
  3. size – Sets the horizontal width of the field. The unit of measurement is in blank spaces.
  4. maxlength – Dictates the maximum number of characters that can be entered.

Code

Name:
Password:

HTML Radio Buttons
Radio buttons are a popular form of interaction. You may have seen them on quizzes, questionnaires, and other web sites that give the user a multiple choice question. Below are a couple attributes you should know that relate to the radio button.

  • value – specifies what will be sent if the user chooses this radio button. Only one value will be sent for a given group of radio buttons (see name for more information).
  • name – defines which set of radio buttons that it is a part of. Below we have 2 groups: shade and size.
What kind of shirt are you wearing?
Shade:

Dark

Light
Size:

Small

Medium

Large

HTML Check Boxes
Check boxes allow for multiple items to be selected for a certain group of choices. The check box’s name and value attributes behave the same as a radio button.

Select your favorite cartoon characters.

Goofy

Donald

Bugs Bunny

Scooby Doo

HTML Drop Down Lists
Drop down menues are created with the
is the list itself and each

College Degree?

HTML Text Areas
ext areas serve as an input field for viewers to place their own comments onto. Forums and the like use text areas to post what you type onto their site using scripts. For this form, the text area is used as a way to write comments to somebody.

Rows and columns need to be specified as attributes to the