Sunday, 29 May 2011

Weekly Report(21st-27th May 2011)


Kabam raised $85 million in series D funding round, with Google Ventures also joining in as one of the investors. So we can expect more of hardcore social games and more engrossing factors for players in those games!
Turkish social game developer Peak Games received $5 million in first round of investment. This will boom the continued growth in Middle East North Africa, one fastest growing markets.
Finnish game developer Supercell, founded in June last year, secured $12 million. Supercell will develop titles for gamers who want online browser-based games that are bigger in scope than the most social games, but less involved than massively-multiplayer games.
GigaOm raised another $6 million making it to be one of the heavily funded tech news sites. The funds will be utilised in research area.
BuzzLogic, an online media company that improves brand metrics and ROI through its scalable media index and analytics platform, has closed a $7.8 million round of Series C Funding.
This week online gaming industry clearly makes most of the funding news.

Reply! Inc., the leading online marketplace for local marketing acquired largest online network of local business of US for $60 million, MerchantCircle. The combo will greatly enhance its access to local merchants and consumers.
sQuid and ACT which make 85% of UK's smartcard-based, contactless payments markets have joined hands and will now work as Smart Transactions Group.
Google purchased Sparkbuy. Sparkbuy aims to make it ridiculously easy to find the perfect consumer electronics item for you. We're a dedicated search engine that just searches for one kind of thing, but tries to do that way better than any of the big guys.
BuyWithMe acquired Groop Swoop, a social commerce company. We look forward to helping you discover great deals and incredible local experiences from local businesses and our national partners.
Twitter acquired the largely popular third party desktop client Tweetdeck. Tweetdeck also offers free Android and iPhone apps and expected to launch its iPad version too.
Let me also cover up the big news of May which I missed because of missing past few Weekly Reports. Microsoft purchased Skype for $8.5 billion.

Most of the fields are inter-mixed and inter-related these days. The tech savvy actor Ashton Kutcher has given another proof for this. He has invested in Airbnb, a community marketplace for you to discover and book unique spaces around the world, and will be joining the team as a strategic advisor.
Google released Google Wallet http://www.google.com/wallet  Make your phone your wallet

Thursday, 19 May 2011

XMLEventReader

XMLEventReader provides the ability to peek at the next event and returns configuration information through the property interface.

Here is a sample employee feed which we will parse using XMLEventReader:


<employeefeed>
 <employees>
  <employee>
   <firstname>Anuja</firstname>
   <lastname>Kulkarni</lastname>
   <department>Development</department>
   <designation>J2EE Designer</designation>
  </employee>
  <employee>
   <firstname>Ruby</firstname>
   <lastname>Kulkarni</lastname>
   <department>HR</department>
   <designation>Recruitment</designation>
  </employee>  
 </employees>
</employeefeed>


And here is the parser:


package com.jbasics;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.events.XMLEvent;

public class CustomXMLEventReader {
 private static final String EMPLOYEE = "Employee";
 private static final String FIRSTNAME = "FirstName";
 private static final String LASTNAME = "LastName";
 private static final String DEPARTMENT = "Department";
 private static final String DESIGNATION = "Designation";
 
 public List getEmployees(String employeeFeed) {
  List employees = new ArrayList();
  try {
   XMLInputFactory inputFactory = XMLInputFactory.newInstance();
   InputStream in = new FileInputStream(employeeFeed);
   XMLEventReader eventReader = inputFactory.createXMLEventReader(in);

   Employee employee = null;
   while (eventReader.hasNext()) {
    XMLEvent event = eventReader.nextEvent();
    if (event.isStartElement()) {
     if (event.asStartElement().getName().getLocalPart().equals(EMPLOYEE)) {
      employee = new Employee();
     }
     if (event.asStartElement().getName().getLocalPart().equals(FIRSTNAME)) {
      event = eventReader.nextEvent();
      employee.setFirstName(event.asCharacters().getData());
      continue;
     }
     if (event.asStartElement().getName().getLocalPart().equals(LASTNAME)) {
      event = eventReader.nextEvent();
      employee.setLastName(event.asCharacters().getData());
      continue;
     }
     if (event.asStartElement().getName().getLocalPart().equals(DEPARTMENT)) {
      event = eventReader.nextEvent();
      employee.setDepartment(event.asCharacters().getData());
      continue;
     }
     if (event.asStartElement().getName().getLocalPart().equals(DESIGNATION)) {
      event = eventReader.nextEvent();
      employee.setDesignation(event.asCharacters().getData());
      continue;
     }
    }
    if (event.isEndElement()) {
     if (event.asEndElement().getName().getLocalPart().equals(EMPLOYEE)) {
      employees.add(employee);
     }
    }
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
  return employees;
 }

 public static void main(String[] args) {
  String employeeFeed = "F:\\jbasics\\examples\\employee.xml";
  CustomXMLEventReader reader = new CustomXMLEventReader();
  List employees = reader.getEmployees(employeeFeed);
  for (Employee employee : employees) {
   System.out.println(employee.getFirstName() + " " + employee.getLastName());
   System.out.println("Department : "+ employee.getDepartment());
   System.out.println("Designation : " + employee.getDesignation());
   System.out.println("---------------------------------------");
  }
 }
}

Monday, 16 May 2011

Employee Initiatives


As an employee we are habituated to doing the tasks which have been assigned to us. Will the company not benefit if employees look beyond this defined scope? Say in a services company a suggestion or alternative is being liked by the client. Client might want to opt for that solution. This will bring more work to the employer. In product based company employees' views can prove to be beneficial. Idea originator (most likely the founder) might keep thinking in a single direction. Employees' views can add real users' perspective to it. In short it is for sure that any initiative by employee is definitely going to prove useful.

Now lies the big question- Will the employees take such initiatives? If yes then when? This is where the work environment plays a vital role. Only when the employee is highly motivated and knows that his initiative/work is being appreciated by seniors. On the contrary if no heed is being paid to good work, or depicted so, employees will make it a routine to do exactly what has been assigned to them. Appreciation can be in a tangible form like good appraisal  or a pat on the back. Intagible forms can be- manager wishes to exchange words with or discuss features or consult you before finalizing. 

There are times when your manager encourages you to take such initiatives but you get no tangible/intangible result over a period of time. Even the company owner (in case of a startup) or senior manager does not know you......your manager had been collecting the credit of your innovativeness or work as his own! There will hardly be any employee who will continue with his initiatives even after realizing this bitter fact. This again brings the employee back to the routine to do precisely what he is being paid for!!
 

Custom Action Mapper (Struts 2 + Axis 2)

Consider your Web Application Deployment Descriptor is configured in such a way that all your urls (/*) are mapped to struts framework and you want the urls of the pattern "/webservice/*" to be handled using web service framework. If this is the case then your web.xml will look like this:


<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
    ......................................
    ......................................

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>AxisServlet</servlet-name>
        <url-pattern>/webservice/*</url-pattern>
    </servlet-mapping>
    
    ......................................
    ......................................
</web-app>

Now to ignore the web service requests from struts side you need to write a custom action mapper:


package com.jbasics;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;
import com.opensymphony.xwork2.config.ConfigurationManager;

public class CustomActionMapper extends DefaultActionMapper{

    @Override
    public ActionMapping getMapping(HttpServletRequest req,
                            ConfigurationManager configMgr) {
        String uri = getUri(req);
        if(uri != null && !uri.isEmpty() 
                        && uri.contains("/webservice"))
            return null;
        else
            return super.getMapping(req, configMgr);
    }
}
Finally you need to add an entry for this in the struts.properties file:

struts.mapper.class=com.jbasics.CustomActionMapper

Saturday, 14 May 2011

Google App Engine + JDO (Java Data Objects)

First step is to do the JDO setup. This requires creating the jdoconfig file in the application's war/WEB-INF/classes/META-INF/ directory.


<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
    <persistence-manager-factory name="transactions-optional">
        <property name="javax.jdo.PersistenceManagerFactoryClass"
            value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
        <property name="javax.jdo.option.ConnectionURL" value="appengine"/>
        <property name="javax.jdo.option.NontransactionalRead" value="true"/>
        <property name="javax.jdo.option.NontransactionalWrite" value="true"/>
        <property name="javax.jdo.option.RetainValues" value="true"/>
        <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
    </persistence-manager-factory>
</jdoconfig>

Next step is to create the persistence manager factory in the data access layer part of your application.


import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;

public final class PMF {

 private static final PersistenceManagerFactory pmfInstance = JDOHelper
   .getPersistenceManagerFactory("transactions-optional");

 private PMF() {
 }

 public static PersistenceManagerFactory get() {
  return pmfInstance;
 }
 public static PersistenceManager getPersistenceManager(Object obj) {
  return JDOHelper.getPersistenceManager(obj);
 }
}

Now using persistence manager you can access the data by executing JDO query like this:


import java.util.List;
import javax.jdo.PersistenceManager;
import com.gifito.server.dao.entity.EmployeeMaster;

public class EmployeeDaoImpl implements EmployeeDao {

 @SuppressWarnings("unchecked")
 public static List getListOfEmployees() {
  PersistenceManager pm = PMF.get().getPersistenceManager();
  String query = "select from " + EmployeeMaster.class.getName();
  List employees = (List) pm.newQuery(
    query).execute();
  return employees;
 }
}

The last step is to call the close method on persistence manager instance.

Monday, 9 May 2011

Job Change and Startups


In bigger organizations recruitment is an ongoing process. So even if you are leaving such an organization finding your replacement is not a tough task(Of course in companies like Google too if a key person is leaving it is a difficult situation!). There are buffer resources within the project. Also you can peep outside the project and get a person from 'bench'! While you are leaving the company you transfer knowledge to other fellow members of project or a new comer...in neither situation is it a big deal! Not a great resource crunch is felt.

Is it equally easy to handle attrition in startups as with giant organizations? Definitely not. It might take some time to find a right fit for the project (A wrong especially hasty choice becomes a bigger burden!). Search for another resource begins only after a present employee has resigned. Even if a perfect replacement is found immediately, the company has to bear salaries of both the resources at a time- the one serving notice and the new one. For bootstrapping startups especially this becomes heavy. On the other hand if no person is found to shoulder the responsibilities and tasks, the responsibilities are divided and distributed among rest of the members. They already have lot of tasks and a timeline to meet (This add-on may discourage them!).

Regular/higher attrition will obviously affect the release/delivery of product. The release is tightly bound with revenue...delay in delivery is delay in getting paid for work from customers.

Theoretically it is easy to chalk out plans like signing bond of minimum duration to serve and so on. But practically it does not work out well. Binding employees with such contracts can prove to be turn offs for joining an organization (may be 'bond' sounds very legal :) ). So rule of thumb- better leadership, better planning and better management to keep employees happy and satisfied with work!

Sunday, 8 May 2011

Weekly Report(30 April - 6 May 2011)


Disqus, the commenting system snagged $10 million funding....good gift on its fourth birthday :)
AppDirect, developer of Business Application Network secured $3.25 million seed funding from iNovia Capital.

Rotten Tomatoes along with its parent company Flixter, was acquired by Warner Bros. Home Entertainment Group. We can expect to get more and better all about movie reviews and news!
Sophos acquired Astaro, both the companies provide solutions for IT security threats.
DealADayOnline(DADO) has been bought by BuyWithMe, which along with deals also offers referral discounts. Again group buying and group discounts!
RIM- Research In Motion- has bought ubitexx, which has apps for varied mobile devices. Just last week RIM was in picture due to its acquisition of Tumgle.me.
eBay acquired MissionFish The combination of our technology and nonprofit expertise, plus eBay's active global community, forms the eBay Giving Works program. If you have a PayPal account you can donate without buying/selling anything :)

Amazon launched MYHABIT.com, which is dedicated shopping of branded fashion items. Its sale ranges upto 60% off.
TransferWise, online currency exchange system is now open for business. Its blog reads We've been open for a while now, starting now we are also open for business customers to transfer money. When we launched the business late in January we started of by targeting private customers as a start.
Disqus has rolled out a very interesting feature of @mentions. The suggestions are smart- it shows folks already in the conversations while others under 'elsewhere'...interaction to the next level!

Thursday, 5 May 2011

CXF | JAX-RS | REST client

JAX-RS (Java API for RESTful Web Services) is an API specification for creating web services in the REST format.

First step is to create the client factory bean:
JAXRSClientFactoryBean clientFactoryBean = new JAXRSClientFactoryBean();
Set url of the web service and the service class definition like this:
clientFactoryBean.setResourceClass(OrderService.class);
clientFactoryBean.setAddress("http://example.com");
Create binding factory:
JAXRSBindingFactory bindingFactory = new JAXRSBindingFactory();
bindingFactory.setBus(clientFactoryBean.getBus());
Register binding factory for JAX-RS:
BindingFactoryManager bindingManager = clientFactoryBean.getBus().getExtension(BindingFactoryManager.class);
bindingManager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, bindingFactory);
Create web client to access service APIs.
WebClient webClient = clientFactoryBean.createWebClient();
Add authentication if any to the web client header.
String authorizationHeader = "Basic " + org.apache.cxf.common.util.Base64Utility.encode("user:password".getBytes());
webClient.header("Authorization", authorizationHeader);
Get response(order) from the web client.
Order order = webClient.path("order/orders").accept("text/xml").get(Order.class);
System.out.println("Order ID : "+order.getOrderID());

Tuesday, 3 May 2011

Google App Engine: SOAP Client Using JAX-WS

First step is to be familiarized with the wsimport tool. It is used to generate SOAP client from a WSDL file(alternative to it is to use eclipse WTP). To understand what all arguments this tool can take simply type "wsimport -help" in the console and hit enter. It will show you a list of valid arguments.
-d is used to specify the location for generated output files and -s is used to specify the location for generated source files. Refer screenshot below for the complete list of arguments.


Now its time to generate the SOAP client. Execute the following command along with your WSDL file as mentioned below:
wsimport -d "C:\gae\soap_client\bin" -s "C:\gae\soap_client\src" "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"

Once the client is generated it will look something like this:


Now here is the code for a sample servlet which calls the web service API:
package jbasics;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.webservicex.Currency;
import net.webservicex.CurrencyConvertor;
import net.webservicex.CurrencyConvertorSoap;

public class ServiceCaller extends HttpServlet {
    private static final long serialVersionUID = 8882886813585460639L;

    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
 String strFromCurrency = req.getParameter("fromCurrency");
 String strToCurrency = req.getParameter("toCurrency");

 Currency fromCurrency = Currency.valueOf(strFromCurrency);
 Currency toCurrency = Currency.valueOf(strToCurrency);

 CurrencyConvertorSoap convertorSOAP = new CurrencyConvertor().getCurrencyConvertorSoap();
 double conversionRate = convertorSOAP.conversionRate(fromCurrency, toCurrency);
 System.out.println(conversionRate);

 resp.setContentType("text/plain");
 resp.getWriter().println(conversionRate);
    }
}

Add mapping for this servlet in web.xml:
<servlet>
 <servlet-name>conversionRate</servlet-name>
 <servlet-class>jbasics.ServiceCaller</servlet-class>
</servlet>
<servlet-mapping>
 <servlet-name>conversionRate</servlet-name>
 <url-pattern>/conversionRate</url-pattern>
</servlet-mapping>

Once you are done with the changes its time to deploy it to Google App Engine. After it is deployed successfully, test it with the following URL (my app url is ext-app.....you should use yours :)):
http://ext-app.appspot.com/conversionRate?fromCurrency=EUR&toCurrency=USD

Google App Engine fully supports JAX-WS for SOAP clients. So it is same as creating client at any other place. But for creating SOAP server for GAE we need to use certain tricks...will cover in upcoming posts. Stay tuned!

Sunday, 1 May 2011

Weekly Report(23rd-29th April 2011)


Inspirato, launched in Jan this year raised $11 million funding. It is redefining luxury travel and destination club! Funds will be used for new partnerships and branding.
Spiceworks snagged $25 million in series D funding. By marrying social networking, IT management and commerce, we're transforming how businesses will discover, research, and buy products and services in the trillion dollar IT industry.
Clarizen, provider of project management tools, secured $12 million funding.
Crisp Media, exceling cross-platform rich media advertising grabbed $6 million. The recently launched rich media ad management platform will be expanded further with this capital.
ideeli, founded in 2007  the leading U.S. membersonly flash sale retail company in the mass-affluent segment, today announced the completion of its Series C financing of $41 million
Pixable raised $3.6 million in its second funding round. It plans to expand its app Photofeed (the one that got quickly popular!).

Coradiant which provides tools for performance monitoring of web apps and managing physical/virtual/cloud-based web apps was acquired by BMC Software. This acquisition will expand the horizons of BMC's BSM platform with end user experience of apps.
PayPal bought Fig Card, which provides easy solution to accept payments using mobiles using Fig app. It requires a low-cost USB device at merchant's end. (Credit cards era going away??)
Tungle.me which is a scheduling app that syncs with your existing calendar, has been acquired by RIM( Research In Motion), the company behind BlackBerry family.
The most interesting acquisition of the week I found was Delicious. Avos, founded by the founders of YouTube, has bought the social bookmarking service from Yahoo!!(First exclamation is Yahoo's, second one is mine ;) ) Delicious will continue to serve users :)
IntoNow has been acquired by Yahoo! IntoNow makes sharing easy and fun. Just tap the green button and IntoNow will identify what you’re watching—even if it’s being aired for the first time.
Google acquired Talkbin, where customers can send feedback, suggestions and queries to business owners in the form of SMS.
VMware acquired SlideRocket, the providers of online presentation software which covers right from designing the slide to publishing and performance measurement.
Daytum founded by Ryan Case and Nicholas Felton as an elegant and intuitive tool for counting and communicating personal statistics has been acquired by Facebook. They'll join the product design team of FB.
eBay is to acquire WHERE, founded in 2004 and heading the space of location media and local discovery mobile app.

F-cards have been introduced on Facebook by Team Coco of Conan O'Brien. Instead of a status message you can choose to send this card. Conan will do the talking for you! There are already millions of users liking F-card fan page.
Kixeye launched a new game of Facebook Battle Pirates.
LetsLunch service has been launched in NY this week- You fill in your social profile (can pull info from sites like LinkedIn or Twitter), for setting up lunch mention max distance to destination, dates, time. Lunch gets scheduled for you with someone else using this service. Two days prior to scheduled lunch you get informed about lunch details.
Google Chrome 11 is now available for download. Yes I'm having it! It brings the new 2D icon along with features like GPU-accelerated 3D css.
Viewdle has launched SocialCamera that allows you to tag mobile photos and share them. Currently the app is available for Android.