Skip to main content

Posts

10 rules about the interview

I attended several interviews recently, and one of my colleagues also gave me very good advice about the interview, I consolidate them with below 10 Rules, hope you can enjoy them:) Rule 1: Always be in the place 5mins before the interview. If you reach there 30 mins again, it will be bad to just wait there. Or the interviewer may thought you are not good at time management. Rule 2: Don't show off, Just answer the question Rule 3: Give the answer directly, and provide and good and bad solution if you have Rule  4: Being honest, if you don't know, just tell them you don't know, or let the interviewer to tell you more about that, then try your best to answer the question Rule 5: Make sure you can show interviewer an image of what it is when you try to provide some information to them Rule 6: Basic knowledge(e.g. data structure and algorithm) is very important Rule 7: Should be familiar with Design Principle(e.g. Open Closed Rule, Programming to the interface) ...

Struts2 vs Struts 1

Struts 2.x  is very simple as compared to struts 1.x,  few of its excelent features are: 1.  Servlet Dependency: Actions in Struts1 have dependencies on the servlet API since the  HttpServletRequest  and HttpServletResponse  objects are passed to the  execute  method when an Action is invoked but in case of Struts 2, Actions are not container dependent because they are made simple POJOs. In struts 2, the servlet contexts are represented as simple Maps which allows actions to be tested in isolation. Struts 2 Actions can access the original request and response, if required. However, other architectural elements reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse directly. 2.  Action classes Programming the abstract classes instead of interfaces is one of design issues of struts1 framework that has been resolved in the struts 2 framework. Struts1 Action classes needs to extend framework dependent abstract ba...

The 10 Best Jobs of 2011 | CareerCast.com

It is great to know the career I am working with(Software Engineer) is the best job of 2011. According to  careertrack.com  the best rated job in 2011 is Software Engineer, at least in the US. 200 professions across various industries, skill levels, and salaries have been surveyed to calculate the ranking which is determined by taking the work environment, physical demands, outlook, income and stress into account. Computer Systems Analysts ranked at 5th position, software programmers at 27th position. Wikipedia.org defines a software engineer as an engineer who appies the principles of software engineering to the design, development, testing, and evaluation of the software and systems that make computers or anything containing software, such as computer chips, work. Software engineers are employed in different industries such as creation of systems for medical, scientific, or industrial purposes. Thus, there is a high diversity of working environments and industrie...

Memcached

Memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for  use in speeding up dynamic web application by alleviating database load. Memcached server is an in memory cache that stores anything from binary to text to primitives associated with a key as key-Value pair.  You saves a lot of load of your backend systems, leading to high scalability. since the data is stored in memory, it is generally faster than making an expensive backend call too. Limitation: The key in memcached should be less than 255 chars and each value shouldn't exceed 1MB What it does? Memcached allows you to take memory from parts of your system where you have more than you need and make it accessible to areas where you have less than you need. With memcached, you can see that all of the servers are looking into the same virtual pool of memory. This means that a given item is always stored and always retrieved from the same lo...

GWT - Calling remote procedures

Today's browsers include a special JavaScript object called XMLHttpRequest that allows communication between the browser and server without forcing a page refresh . This special JavaScript object is the basis for making browser-based Remote Procedure Calls(RPCs). GWT provides two tools that sit on top of the XMLHttpRequest object.  The first is the RequestBuilder class, which is essentially a wrapper around this object, although it's a bit more Java-like in its usage.  The second tool, GWT-RPC, is more elaborate and lets you send and receive real Java objects between the client and server. RequestBuilder class lets you create a request to be submitted to the server, gives you the ability to fire off the request, and provides access to the results sent back from the server. String url = "/service/search"; RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url); try { Request request = rb.sendRequest("term=GWT+in+Action", new RequestCallback...

GWT - Using JSNI to execute JavaScript from java

Although GWT code is written in Java instead of JavaScript, sometimes you need to write code that can make direct JavaScript calls.  The JavaScript Native Interface(JSNI) lets you execute javaScript from Java as wll as execute Java from Java Script. Following example passes a Java List object to the method and uses JavaScript to add two items to it: public native void fillData (List data) /*-{ data.@java.util.List::add(Ljava/lang/Object;)('item1'); data.@java.util.List::add(Ljava/lang/Object;)('item2'); }-*/;

GWT - Java-to-JavaScript Compiler

The most obvious place to start looking at what GWT provides is t he one tool that defines it. The GWT compiler's responsibility is to convert your Java code into JavaScript code, in much the same way the Java compiler compiles your Java code into bytecode. You compile your project by running the Java program by com.google.gwt.dev.GWTComplier, passing it the location of your module definition file along with some other parameters. It will use the JRE emulation library to parse the code. A module is a set of related Java classes and files accompanied by a single configuration file. The module definition typically includes an entry point, which is a class that excutes when the application starts. The compiler starts with the entry-point class, following dependencies required to compile the Java code. The GWT does not compile everything in the modules, it only includes what is being used. When your code is compiled to JavaScript, it results in a different JavaScript file for each...