Friday, 11 November 2011

Spring + mongoDB


Database side -
Step 1: Download mongoDB from the following location : http://www.mongodb.org/downloads
Step 2: Create folder /data/db in your drive in which mongoDB is intalled.
Step 3: Run mongod located in bin folder. By default it will start listening on port 27017.
Application side -
Step 4: Add the following dependencies in your pom.xml.

<!-- Spring Data mongoDB Module -->
<dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-mongodb</artifactId>
 <version>1.0.0.M2</version>
</dependency>

<!-- mongoDB Java Driver -->
<dependency>
 <groupId>org.mongodb</groupId>
 <artifactId>mongo-java-driver</artifactId>
 <version>2.5.2</version>
</dependency>
Step 5: Create a config file (e.g. spring-mongo-config.xml) in the resources folder and add the following:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:mongo="http://www.springframework.org/schema/data/mongo"
 xsi:schemaLocation="http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/data/mongo
          http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 <mongo:mongo host="localhost" port="27017" />
 <bean id="mongoTemplate" 
  class="org.springframework.data.document.mongodb.MongoTemplate">
  <constructor-arg ref="mongo" />
  <constructor-arg name="databaseName" value="company" />
  <constructor-arg name="defaultCollectionName" value="employees" />
 </bean>
</beans>
Step 6: Here is the SpringMongoExample class which connects to mongoDB and stores an employee object in the database:

package com.example.spring.mongo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.data.document.mongodb.MongoOperations;
import org.springframework.data.document.mongodb.query.Criteria;
import org.springframework.data.document.mongodb.query.Query;

import com.example.spring.mongo.model.Employee;

public class SpringMongoExample {
    private MongoOperations mongoOperation;

    public SpringMongoExample() {
         ApplicationContext appContext = new GenericXmlApplicationContext("spring-mongo-config.xml");
         MongoOperations mongoOperation = (MongoOperations) appContext.getBean("mongoTemplate");
         this.mongoOperation = mongoOperation;
    }

    public static void main(String[] args) {
        SpringMongoExample springMongoExample = new SpringMongoExample();
        Employee employee = springMongoExample.createEmployeeObject();

        springMongoExample.saveEmployee(employee);

        springMongoExample.findEmployee();
    }

    /**
     * Create data model
     * 
     * @return employee
     */
    private Employee createEmployeeObject() {
       Employee employee = new Employee();
       employee.setId(543);
       employee.setName("Ranjan Kumar");
       employee.setDepartment("Lab");
       employee.setDesignation("Architect");
       return employee;
    }

    /**
     * Save new employee in the database
     */
    private void saveEmployee(Employee employee) {
        mongoOperation.save("EmployeeDetails", employee);
    }

    /**
     * Find the newly added employee from the database
     */

    private Employee findEmployee() {
        Query query = new Query(Criteria.where("designation").is("Architect"));
        Employee storedEmployee = mongoOperation.findOne("EmployeeDetails", query, Employee.class);
        System.out.println("stored employee : " + storedEmployee.toString());
        return storedEmployee;
    }
}
And here is the Employee class:
package com.example.spring.mongo.model;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Employee", propOrder = { "id", "name", "designation", "joiningDate", "department" })
public class Employee implements Serializable {

    private final static long serialVersionUID = 1L;
    @XmlElement(name = "Id")
    protected int id;
    @XmlElement(name = "Name", required = true)
    protected String name;
    @XmlElement(name = "Designation", required = true)
    protected String designation;
    @XmlElement(name = "JoiningDate", required = true)
    @XmlSchemaType(name = "date")
    protected XMLGregorianCalendar joiningDate;
    @XmlElement(name = "Department", required = true)
    protected String department;

    /**
     * Gets the value of the id property.
     * 
     */
    public int getId() {
       return id;
    }

    /**
     * Sets the value of the id property.
     * 
     */
    public void setId(int value) {
         this.id = value;
    }

    /**
     * Gets the value of the name property.
     * 
     * @return possible object is {@link String }
     * 
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     * 
     * @param value
     *            allowed object is {@link String }
     * 
     */
    public void setName(String value) {
      this.name = value;
    }

    /**
     * Gets the value of the designation property.
     * 
     * @return possible object is {@link String }
     * 
     */
    public String getDesignation() {
         return designation;
    }

    /**
     * Sets the value of the designation property.
     * 
     * @param value
     *            allowed object is {@link String }
     * 
     */
    public void setDesignation(String value) {
       this.designation = value;
    }

    /**
     * Gets the value of the joiningDate property.
     * 
     * @return possible object is {@link XMLGregorianCalendar }
     * 
     */
    public XMLGregorianCalendar getJoiningDate() {
       return joiningDate;
    }

    /**
     * Sets the value of the joiningDate property.
     * 
     * @param value
     *            allowed object is {@link XMLGregorianCalendar }
     * 
     */
    public void setJoiningDate(XMLGregorianCalendar value) {
          this.joiningDate = value;
    }

    /**
     * Gets the value of the department property.
     * 
     * @return possible object is {@link String }
     * 
     */
    public String getDepartment() {
        return department;
    }

    /**
     * Sets the value of the department property.
     * 
     * @param value
     *            allowed object is {@link String }
     * 
     */
    public void setDepartment(String value) {
         this.department = value;
    }

}


Thursday, 27 October 2011

JAXB Maven Plugin

It is used to generate Java classes from XML Schema (XSD). If you are using Maven, generating Java classes is very easy. Here is what you need to do: Add the following dependencies:

<dependency>
 <groupId>com.sun.xml.bind</groupId>
 <artifactId>jaxb-impl</artifactId>
 <version>2.2.4-1</version>
</dependency>
<dependency>
 <groupId>org.jvnet.jaxb2_commons</groupId>
 <artifactId>jaxb2-basics-runtime</artifactId>
 <version>0.6.0</version>
</dependency>
and then add the following under the build section in pom.xml:

<plugin>
 <groupId>org.jvnet.jaxb2.maven2</groupId>
 <artifactId>maven-jaxb2-plugin</artifactId>
 <version>0.8.0</version>
 <executions>
  <execution>
   <goals>
    <goal>generate</goal>
   </goals>
  </execution>
 </executions>
 <configuration>
  <extension>true</extension>
  <args>
   <arg>-XtoString</arg>
   <arg>-Xequals</arg>
   <arg>-XhashCode</arg>
  </args>
  <plugins>
   <plugin>
    <groupId>org.jvnet.jaxb2_commons</groupId>
    <artifactId>jaxb2-basics</artifactId>
    <version>0.6.0</version>
   </plugin>
  </plugins>
  <schemaDirectory>${basedir}/src/main/xsd</schemaDirectory>
  <generateDirectory>${basedir}/src/main/java</generateDirectory>
 </configuration>
</plugin>
Please note that -XtoString, -Xequals, -XhashCode etc are the arguments passed to the XJC compiler which override the toString(), equals() and hashCode() methods respectively of the generated classes. schemaDirectory : The location to your XSDs. generateDirectory : Generated code will be placed under this package.

Thursday, 20 October 2011

Exploring Deals Market in India


There are leaders in Indian online deals market like Snapdeal, DealsandYou, Mydala, SoSasta, GOAT and LivingSocial. Some more major players are KhojGuru, Dealivore, Koovs, OffersforShoppers, BagitToday and Timesdeal.

Giants are taking dives into the sea of group buying or discount services with their own variants. Rediff joined the already jam-packed Indian daily deals market lately (http://dealhojaye.rediff.com/). This news comes concomittantly when the web giants, Google and Facebook, announced their entry into this territory with Offers (https://www.google.com/offers) and Deals (http://www.facebook.com/deals) respectively. Other global giants present are Yahoo (http://deals.yahoo.com), MSN (http://deals.msn.com/) and eBay (http://deals.ebay.com/).

The entry of such international big companies in Indian deals arena clearly shows that this business is burgeoning rapidly in India. So going to the core of it, why deals are working in India? They have especially immense response in the larger cities like Mumbai. People have got acquainted with using services like spa or restaurant. Redemption rate of coupons is seen to be high on such services. Going to resorts for outing, for a day or two has also become very common. If such resorts offer heavy discounts in off-season, they are definitely making money at no loss.

Some sites offer buying in group. When minimum number of purchases are being made then only the discount holds valid. This encourages you to provoke like-minded ones from your network to buy that. Indirectly you are marketing for a service or product. Sometimes you do this for free (because you want to avail the heavy discount for yourself) while sometimes the site pays you. You bring referrals and you get further discount or a fixed amount incentive! Win-win situation. Group buying is highly popular amongst youths.

These days people in India are also equally crazy about branded items. There is enough margin in branded items to offer them at considerable discount rates. From the merchant's side too these deals are profitable. The merchandise is being bought in bulk, so he can easily afford to give bulky discounts. Or the second is his merchandise is being sold in off-season. For sure the deals' site which has direct dealing with the manufacturers can offer the best and hence can attract maximum online customers.

I think it is the right time to enter into this business in India. As it is still in its infancy, business-owners have umpteen opportunities to make most out of it as well to expand their business.

Tuesday, 4 October 2011

Monthly Report(September 2011)


Peak Games is a fast growing social gaming company in Turkey and Middle East and North Africa and one of top 10 players in all. It raised $11.5 million in next round of funding which will be used for market expansion, additional game studio acquisitions, hiring, and user acquisition.
Blekko, which provides a clean search engine mechanism by use of slashtags, nabbed a funding of $30 million. This has added a big investor to their list- Yandex, a leading Russian internet company.
FirstFuel (earlier iblogix Inc.), the company providing software to track the energy consumption and savings, got $2.4 million in first round of funding. The funds will be utilized to expand its Rapid Building Assessment(RBA) platform.
Company providing high quality video conference facility, Vidyo, raised $22.5 million in series D funding round.
NoSQL is budding fast and we can expect more enhancements in the same. This is very clear from the fact that DataStax, commercial leader in Apache Cassandra, snagged $11 million funding in second round.
Opera Solutions, provider of Big Data analytics solutions, received $84 million. It is already a partner of Google in Cloud Transformation Program where analytics solutions will be on top of Google's IaaS offerings.
Lookout Mobile Security grabbed $40 million funding. It provides powerful solutions to stop malware, phishing, loss and theft.
Zimride received $6 million in series A funding round. Its blog tells in interesting way "we spend way too much time getting from point A to point B, often alone," adding to it, "Everyone should have the opportunity to travel, and no one should have to travel alone."
InMobi, the mobile ad network company, got whopping $200 million from SoftBank Corp. InMobi is back in back in picture this year, earlier for its partnership with Cooliris for iPad ads.

Seamless, the online food ordering company, has acquired Menupages. On Seamless you can browse menus, rate as well as read reviews of restaurants of a location. MenuPages holds a huge up-to-date data of restaurants, menus and pricing. Looks like a perfect win-win situation for both!
Deals are back in picture now. Rearden Commerce, an e-commerce company raised $133 million and acquired daily deals site HomeRun.
Twitter acquired Julpan- Julpan analyzes the way people share information on the social web. From this data, we are able to understand and follow the most popular topics and track the highest quality content.
Glam Media, which brings brand advertisers online and makes their online marketing spending effective, has acquired Ning. Ning is a large provider of service to create social networking websites.
Walmart has acquired OneRiot, which has developed "Social Targeting Engine" used in its mobile ad campaigns. OneRiot team will join WalmartLabs and develop new models for e-commerce integrating social, mobile and retail features.
Broadcom Corporation, a big name in semiconductor solutions for wired and wireless communications acquired NetLogic Microsystems, provider of  high-performance intelligent semiconductor solutions and on forefront in multi-core embedded processor solutions.
Google acquired Zave Networks- it provides fully digital incentive programs like coupons and loyalty rewards.

We've got two cool Chrome apps- News You Like and Your Favorite Bollywood Tweets. I'm pretty impressed with UI of Bollywood Tweets. You can follow, RT, mark favorite and reply from the same app page...with just an addition of logging in! Check them out...

Sunday, 4 September 2011

Monthly Report(August 2011)


Shocking Technologies, founded in 2006, raised $15.2 million. Shocking Technologies develops Voltage Switchable Dielectric materials that protect electronic components from harmful electrostatic discharge (ESD). This unwanted current can damage electronic devices.
MapR Technologies secured $20 million in second round of funding. MapR provides complete distribution of Apache Hadoop adding to it, its own breakthroughs which make Hadoop more reliable, affordable, manageable and easier to use.
Innovid, which provides interactive video ads solutions added $9.5 million to its funding. It is powered by its iRoll- the interactive pre-roll unit and DYNAMO- its Agency Video AdServer and Analytics platform.
DoubleVerify, the online media verification and monitoring service provider, got $33 million in series C finance.
Taptera, company developing apps for iPhone and iPad, nabbed $2 million in its first round of funding. So there we can expect to see them develop a gamut of applications in coming days!
Druva secured $12 million, which will be utilized to expand its services, sales and marketing in targetted regions, in second funding round. Druva’s Enterprise inSync software sets a new benchmark for enterprise laptop backup, including support for smartphones and tablets.
Sentilla, a provider of data center analytics and automation of its work loads, received $15 million in third funding round.
Centrify secured investment of $16 million. It provides security and compliance solutions to centrally control and monitor on-premise as well as cloud-based systems and apps.

CloudSwitch which provides solutions to Run your enterprise applications in the cloud simply and securely, without re-architecting the application or changing your management tools, has been acquired by Verizon Communications. Verizon provides broadband and other wireless and wireline communications services. Lets hope for some breakthroughs in the cloud-world with this merger!
Reddit acquired redittgifts.com, a large gift exchanging platform.
GroupMe, service which lets you create and groups from folks who are already in your contact lists, and communicate or share with them has been acquired by Skype. Ummmm.....I'm visualizing an advanced chat room from Skype in near future :)
Engine Yard, a giant PaaS provider, acquired Orchestra which is a platform for deploying, managing and scaling PHP applications.
oneforty, the developer of social media management platform- SocialBase, was acquired by inbound marketing software company HubSpot. I really love the marketing e-books by HubSpot. Hope this acquisition makes their contents richer.
In succession, this time also BuyWithMe has made the news in acquisition area. It acquired Scoop St., a social commerce site in NYC. And the scoop is that Scoop St. is now BuyWithMe NYC (I'm trying to recollect the name of figure of speech I've created in this statement;) )
Google bought Motorola Mobility, a dedicated Android partner, for $12.5 billion.

Google +1 Button chrome extension has come officially from Google, to +1 any page we visit.
FB has launched its Facebook Like Button plugin to like, recommend or share from any site/video.
So in coming days we can expect many more official chrome extensions (when Google and FB have stepped in, rest are sure to join the flock!)
There is buzz about CrunchFund- an early stage VC firm founded by TechCrunch founder and editor Michael Arrington and Patric Gallagher. It has raised $20 million as of now. Though its site is not available yet, you can visit CrunchBase profile (Siblings after all;) )

Monday, 1 August 2011

Monthly Report(July 2011)


Smartling raised $10 million in second round of funding. It provides copious scope to application providers and publishers to go multilingual. Its cloud-based platform is used by big companies like Foursquare, Scribd and SurveyMonkey.
CloudBees secured $10.5 million from LightSpeed Venture Partners. Currently it provides Java Platform as a Service. Also it has joined Eclipse Foundation to provide CloudBees Toolkit for Eclipse IDE.
LegalZoom snagged a huge amount, $66 million, in funding recently. It does not impart legal advice, but serves as a store for online legal documents and helps in filling them.
Badgeville, The Social Loyalty Platform, today announced it has closed a $12 million Series B round led by Norwest Venture Partners (NVP) and El Dorado Ventures, with participation from existing institution Trinity Ventures and Webb Investment Network.

Groupon, the deals' giant, acquired Zappedy. Zappedy site says, "We're excited to join the Groupon Team! Zappedy has been acquired by Groupon." (Since I'd not known this company earlier and neither of the sites provide any info, I'm clueless what this company is all about!)
There is one more acquisition in July from deals' service- BuyWithMe bought Edhance, provider of card-linked loyalty programs to merchants. Biggest advantage to users will be that they do not have to carry vouchers to redeem them. Since cards will be connected to an account, just swiping will do!
Adobe acquired EchoSign, a provider of electronic signatures and their automation. EchoSign’s pioneering electrynic signature solution will be a key component of Adobe’s document exchange services platform for reliably exchanging documents for universal access, review and approval. Its solution has more than 3 million users globally at present.
Live Gamer, which provides monetization solution for micro-transaction based businesses, acquired gamerDNA Media and BrandPort. gamerDNA Media a large gamer-focused ad network in the US. BrandPort allows to add innovative, highly engaging video ads. It rewards gamers watching video ads by asking questions about the ad. So a double win comes for Live Gamer!

American Express and Sprint announced to provide Sprint customers with easy access to Serve(sm), American Express' recently launched digital payments platform. Sprint is pleased to join with American Express to offer this convenient tool for sending and receiving money to friends, paying bills and making purchases online.

Sunday, 31 July 2011

Creating a Multi-Module Maven Project


Install Maven plugin for Eclipse:
























Once the plugin is installed we can create a maven project like this:




















Click on Next; enter group id, artifact id, version and package; click Finish.























Now as we want to create modules inside this project, we need to change the packaging to pom. Refer screenshot.















Create a new maven module.




















Click on Next; enter package name and click Finish.

















Similarly create other modules like 'view' and 'controller'. The final pom file will look like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

 <groupId>com.jbasics.maven.example</groupId>
 <artifactId>mvc-parent</artifactId>
 <version>0.0.1-SNAPSHOT</version>

 <packaging>pom</packaging>
 <name>mvc-parent</name>
 <url>http://maven.apache.org</url>

 <properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 </properties>

 <dependencies>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>3.8.1</version>
   <scope>test</scope>
  </dependency>
 </dependencies>
 <modules>
  <module>model</module>
  <module>view</module>
  <module>controller</module>
 </modules>
</project>



Wednesday, 27 July 2011

Java Updates Summarized

  • Java 7 (codename Dolphin) is an upcoming major update to Java, it has been launched on July 7 of 2011 and will be made available today (July 28, 2011) . Here is the list of JDK 7 features:
Java programming getting simplified: Strings in switch statements, try-with-resources statements, improved type inference for generic instance creation ("diamond"), simplified varargs method invocation, better integral literals, and improved exception handling (multi-catch).
Concurrency and collections updates: A lightweight fork/join framework, flexible and reusable synchronization barriers, transfer queues, concurrent linked double-ended queues, and thread-local pseudo-random number generators.
New APIs for filesystem access, scalable asynchronous I/O operations, socket-channel binding and configuration, and multicast datagrams.
Upgrade the components of the XML stack to the most recent stable versions: JAXP 1.4, JAXB 2.2a, and JAX-WS 2.2
Upgrade to JDBC 4.1 and Rowset 1.1
Upgrade the supported version of Unicode to 6.0
        
  • Spring Integration 2.0.5 Released
Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns. It enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters. Those adapters provide a higher-level of abstraction over Spring's support for remoting, messaging, and scheduling. Spring Integration's primary goal is to provide a simple model for building enterprise integration solutions while maintaining the separation of concerns that is essential for producing maintainable, testable code.

  • Spring Roo 1.1.5 Released
SpringSource and Google are working together to combine the speed of development of Spring Roo with the power of the Google Web Toolkit (GWT) to build rich browser apps. Try out the exciting GWT and Google App Engine support now available from Spring Roo.

  • How I Became a REST "Convert"
Representational State Transfer, commonly known as REST, is a style of distributed software architecture that offers an alternative to the commonly accepted XML-based Web Services as a means for system-to-system interaction... when I needed to implement the Services I had already determined were necessary, I faced a choice: use Web Services or REST-based styles as the means to interact with the Services. For the reasons I outline below, REST was a clear winner for my particular use case.

  • Real Time analytics for Big Data: Facebook's New Realtime Analytics System
The massive transition to online and social applications makes it possible to track user patterns like never before. The correlation between the quality of data that providers track and their business success is closely related: for example, e-commerce customers want to know what their friends think about products or services, right in the middle of their shopping experience. If sites cannot keep up with their thousands of users in real-time, they can lose their customers to sites that can.

  • Secure your code against the finalizer vulnerability
Finalizers can cause a vulnerability in Java code when used to create objects. The exploit is a variation of the well-known technique of using a finalizer for resurrecting an object. When an object with a finalize() method becomes unreachable, it is put on a queue to be processed at some later time. This tip explains how the exploit works and shows how you can protect your code from it. All of the code examples are available for download.

  • Session and Clustered Java Web Apps
Session can be a headache to work with in Java web applications. For that reason, most developers now use MVC frameworks, such as Java Server Faces, that hide the use of session and allow you to work with simple Java beans and configuration instead. But, that’s not always the case, especially where you have plain servlets that you have to maintain. With servlets, you have the power to put objects into and take objects out of session yourself. Alone, this presents thread-safety issues, but manually managing session in an application that is clustered presents more problems.

  • Will HTML5 kill the mobile app?
For a couple of years now, we've been talking about apps for a multitude of purposes. Mobile apps continue to be the preferred way to deliver new services or content to mobile devices. But, with a powerful new upgrade to HTML now emerging, developers may opt for apps that run in mobile browsers.

  • NoSQL should be in your business, and MongoDB could lead the way
Although NoSQL databases like Cassandra (originally developed and used by Facebook) or CouchDB get a lot of media attention, MongoDB appears to be the product to catch in this hot market. As evidence, worldwide Google searches for various NoSQL product names shows the marked increase in MongoDB and Mongo searches since January 2011. Google searches for MongoDB and Mongo exceeded searches for CouchDB, Couchbase, Membase, Cassandra, and HBase combined. And according to Indeed.com, open positions seeking MongoDB or Mongo skills have outpaced other leading NoSQL products. MongoDB and Mongo now represent the most sought-after NoSQL skills among companies hiring on Indeed.com. Finally, recently announced PaaS offerings from Red Hat and VMware featured MongoDB at the data services layer of their respective offerings.

Friday, 15 July 2011

Test REST Service Using soapUI

Step 1:

  Go to File > New soapUI Porject (ctrl-N), enter name of the project, select the option to add the REST service and hit ok (refer screenshot 1).
















Step 2:
 
  A dialog to add a new REST service will appear on the screen. Enter Service Name, Service Endpoint and choose the option to extract resource and method from the specified Endpoint (refer screenshot 2).

 














Step 3:

  Once you click ok, another dialog to add a new REST resource will appear on the screen. Enter the resource name as per your choice (refer screenshot 3).

 




















Step 4:
 
   Next step is to add the name of REST method and click ok(refer screenshot 4).

 






















Step 5:
 
    A dialog to submit the request will appear. Click submit button to submit the request to specified Endpoint URL and you will get the response (refer screenshot 5).

Friday, 8 July 2011

Monthly Report(5th June-7th July 2011)

Missed writing weekly tech reports for about a month. I just happened to get involved in some other interesting stuff like bringing my passive vocab into my functional dictionary. So thought of writing this tech report for a month, covering major happenings.

I felt it was a Google month! Google Plus was released. You can now think of your social network as actual set, its subsets and intersection. You can simply manage your various Circles, can also share pics with all or specified circles using Instant Upload.Hangouts provide you live chat. You can join in a hangout of a circle you are involved in. Similarly you can use Huddle as a way to group chatting. Now you've got a way to tell what your interests are. Search in Sparks and save it as your interest. As and when you like you can check out updates related to your interests.

Google+ bar, a black navigation bar, has started appearing on top of google pages. +You is your shortcut for Google Plus. You can also have a quick access to various Google apps from here.

Gmail has also come up with new features. There are new themes. You can choose 'Preview' or 'Preview(Dense)' themes for a very neat and clean look and feel(since not used to such a great deal of cleanliness, I'm not opting for this!). Of course you can create your own theme too.

In acquisition area too, Google made its move. Admeld entered into an agreement to be acquired by Google. Admeld provides expertise and technology to help to business publishers interact with buyers, sell smarter, and maximizing access to demand.
GoDaddy, the God and Dad of domain names registry, has been sold for $2.25 billion to group of firms consisting KKR & Co., Silver Lake Partners and Technology Crossover Ventures. GoDaddy is managing about 50 million domain names and millions of users! In the past few years it also grew largely in web hosting, eCommerce and related services.  Btw I'm pretty impressed with the blog of GoDaddy's founder cum CEO!
MySpace, the social entertainment and online media platform will have a shift of its parent company. News Corp. is in the final stages of selling the social network(not-so-great doing presently) to Specific Media. Specific Media is an interactive media company that enables advertisers to connect with their customers in useful and relevant ways.
eBay acquired Zong, with which you can pay for purchases with your mobile phone number. This is definitely going to strengthen PayPal. About a month ago eBay had announced buying of Magento, the eCommerce platform. Now Magento will form the kernel of open commerce platform- 'X.Commerce.'
Twitter acquired BackType, the social media analytics company. Its product 'BackTweets' helps publishers to understand where all their tweets reach and how those tweets covert to web traffic, sales and other KPIs.

Saturday, 11 June 2011

Weekly Report(4th-10th June 2011)


After Facebook's OpenCompute project it is now Joulex, a startup working on enterprise energy management systems for data centers and distributed office environments. It snapped $17 million for the mission.
Avantium, the company that develops and commercializes YXY, its own invented chemical building blocks for making green materials and fuels raised 30 million EUR. Funds will be used for building a pilot plant to demonstrate its YXY technology. The pilot plant will also be able to produce larger volumes of YXY building blocks for application development of new, green plastics, chemicals and materials.
Birch Communications, provider of IP-based telecommunications and managed services to SMBs secured $77.5 million funding.
Coupons.com received an investments of $200 million. Coupons.com Incorporated enables digital coupon programs – including online printable, Save to Card and mobile promotions. We can expect more shift of coupons from newspapers to digital world.
GrabCAD, place to connect manufacturing and product development companies with CAD engineers, snapped $1.1 million funding. The funds will be used for hiring and strengthening the team.
buuteeq, the Digital Marketing System (DMS) for hotels, grabbed $3.5M in series A round. With buuteeq's subscription-based service, hotels can easily create and manage high-performing web, mobile and Facebook sites, promotions and reservations, all from one place; eliminating the need for custom hotel website design.
eWise, provider of payments and online financial management solutions, raised $14 million. Funds will be utilised in expansion of its technology Secure Vault Payments.

Visa, a leader in payments is acquiring Fundamo, which has its platform for financial services for mobile network operators and financial institutions in developing economies. Visa seems to be expanding its horizons greatly. It has also signed an agreement with Monitise, a provider of mobile money solutions.
Facebook acquired Sofa(www.madebysofa.com), a company started in 2006 that makes useful and enjoyable products. Sofa's products- Kaleidoscope and Versions do not form a part of this acquisition.
Virsto, company that is transforming storage for virtual machines acquired EvoStor, a specialist in storage virtualization technology for VMware environments. Visto also received a funding of $12 million in series B funding round.

METISMO provides a platform to develop cross platform mobile apps. Once created it can automatically transform your application into various mobile device formats. Various data-types like audio, video etc from your mobile can be easily integrated. The way this platform works is- you write your application in java and it converts your java code into mobile device specific code.
It got acquired by Software AG. Software AG products include Adabas - where you can store any amount of data and it is the first high performance transactional database; ARIS Platform- the first business process analysis platform; webMethods - SOA based integration platform; NaturalONE- an eclipse based IDE to develop and manage your applications.

Friday, 10 June 2011

Conference On Cloud Computing

Recently I attended 2nd IndicThreads Conference On Cloud Computing.

About IndicThreads :
IndicThreads is one of India’s leading tech+media brands and has been successfully running the online magazine IndicThreads.com & hosting some of India’s finest independent technology conferences.

Speakers talked about various cloud platforms, cloud services in various forms, security aspects of cloud, cloud testing, monitoring your application in the cloud etc.

Here are a few highlights:

Scalable Architecture on Amazon AWS Cloud - Amazon Elastic Loadbalancing distributes incoming traffic to your app across several EC2 instances and reroutes traffic accordingly. Auto-scaling is enabled by Amazon CloudWatch. Amazon SimpleDB is schema-less with distributed key-value store and is scalable, has auto-indexing and has API based search. AWS Relational Database Service (RDS) lets you scale your DB layer with minimum administration. MySQLand Oracle are supported and you can import existing databases without any changes to app.

OpenStack Ecosystem and Xen Cloud Platform - Main idea behind OpenStack was to open source cloud computing platform that is simple to
implement and massively scalable. Available as OpenStack Compute(Nova), Storage(Swift) and Image Service(Glance). Openstack is built on a shared-nothing, messaging-based architecture using AMPQ based queues.
Xen Cloud Platform(XCP) is open source platform to build clouds, a cloud optimised version of Xen and has virtualization platform that consists of Xen hypervisor, network and storage support.
OpenStack supports XCP through XenAPI. OpenStack Compute interacts with the XCP hypervisor (XEN).

Processing massive amount of data with Map Reduce using Apache Hadoop - Map is applying a function to a list of elements and returning the modified list. Reduce/Fold reduces a list of values to a single value/element. With Hadoop MapReduce, you need to create your Mapper, Combiner(when the function to be applied is commutative and associative) to minimize the number of key value pairs that will be shuffled across the network between mappers and reducers, Partitioner that controls the partitioning of the keys of the intermediate map-outputs and Reducer

Easy ORM-ness with Objectify-Appengine- Entities, Operations(get, put, delete and query), Keys and Transactions form the basics of any datastore. Objectify supports these native features and provides type safe key and query classes. Objectify is light weight, maintains simplicity and transparency of low level API and does the work of converting to and from POJOs to Entity Objects.Certain practices will make Objectifying very easy: use of DAO to register entities, scanning only on demand, using batch gets rather than queries, lower usage of indexing and avoiding @Parent.

Cloud security - In public clouds you need to have strong identity management, secure keys, access to compliance and logging, wipeout policies. In private ones scope should be left for moving to a hybrid model and imposing SSO is preferred practice. Using hybrid ones segregate your data between clouds, use SAML, hHave your Federation set up correctly, enable SSO and ensure that enterprise credentials do not move into the cloud. Safe Browsing API and VM Safe API are the APIs useful in cloud security.

Cloud Lock-in and Interoperability - Locking in with a cloud would mean higher costs being paid and incompatible technology, for the customer. Portability will mean choice to move out of cloud or another cloud without losing any data or even the log-files. There are standards like Distributed Management Task Force(DTMF), Storage Networking Industry Association(SNIA) and Cloud Security Alliance(CSA).

Cloud development with CloudFoundry - CoudFoundry overcomes the issues that exists in present PaaS i.e. Google App Engine like: lack of cloud portability, tightly coupled with a certain environment and deployment on public clouds only. CloudFoundry is open source and with it you can to deploy on public or private cloud.

Monitoring Cloud Applications- There are various challenges at various levels involved such as at user, system and network level. You should be able to scale your app on cloud dynamically with no impact on monitored infrastructure. Monitoring tools should be portable and light weight.

AWS Elastic Beanstalk - Gives a handy way to deploy apps especially the ones using Tomcat stack. You have complete control over your AWS resources. Hence you can choose any database, access your Ec2 instances, create custom AMIs as well as move app out from Beanstalk with great ease. Apart from the command line tools and APIs, you can access Beanstalk using AWS Toolkit for Eclipse and AWS Management Console.

Apigee - API Management Platform : Apigee provides free API tools for developers and is the leading API management platform for enterprises.

loggly - Log Management in the Cloud : Loggly is a cloud based logging service. With Loggly, you can collect logs from your servers and then quickly search them with an intuitive user interface. We make looking at logs fast, fun and easy!

Thursday, 9 June 2011

When You Want Employees to Put Extra Hours...


Many a times employers/managers want employees to work on weekends or longer hours per day. Is it fair? This has no concrete answer as yes or no. If you are someone who is watching work hours more than productivity, it is likely that you want your team to put extra hours at office even without major task delivery.

If reaching the deadline is your main concern then yes asking for extra hours makes sense. But if you are making it as a regular practice you may need to review your strategies again. May be something unwarranted is consuming more time like status calls or meetings, or you are going wrong in project work and time estimation, or you give a lazy start and demand to cover up at the end. For sure if you make it a routine to come to office on weekends, most of the folks will not be willing to do so. But just that boss is boss, your wish is being treated as command!

If there were unexpected pot-holes and unexpected amount of time got consumed to fill them up, it is absolutely fair to ask team for extra hours. But how do you make that as a willingness and not just as an order? As a founder or person behind the idea you might want everyone in the team to have the same passion and spirit as you have. It will not come naturally though. Keep the team motivated and energetic. Your own enthusiasm towards work and efforts for it will be capable of injecting the same spirit in others. Value their inputs, suggestions. Appreciate their performance.....that gives you the right to express your unhappiness for a poorly performed task too. Everyone should be given the feeling of being equally important and indispensable for the project. Happy employees = productive employees (true most of the times).Team members should have the feeling that you view each and everyone under the same lens and no favoritism is being shown towards anyone.

You getting your team members involved more on all the fronts of project will help to feel the ownership. In many startups employees don't feel job security or delayed salaries form a major concern. Such insecurity naturally keeps them in the quiet loop of being in hunt for a better job. Such hurdles can be overcome by sharing updates like what all projects have been signed off and what is expected in pipeline. Of course you should be not be far away from ground reality!

Ultimately it is the feeling of loyalty towards you and the work that your team will go beyond the call of duty to help you out.

Saturday, 4 June 2011

Weekly Report(28th May-3rd June 2011)


UberMedia raised $5.6 million. Its various popular Twitter apps count to 13% of the total Twitter traffic. Ubermedia plans to utilize the funds in growing its partnerships.
OnSwipe, which provides 'Insanely easy tablet publishing' raised $5 million in series A, referred to as series Awesome by them. They plan to use the funds for hiring the best HTML5 team, apart from the their monstrous work.
MobileIron secured $20 million in fourth round of funding. It creates mobile device management tools and security tools for enterprise systems.
ValueAppeal, a company that helps home owners file appeals on their property taxes in US, raised $1.6 million. With the added capital the website is going to be enhanced further. 
Portalarium, the developer and publisher of premium online games and virtual worlds for popular social networks and mobile platforms, closed its second round of funding.
Appsfire, a French startup easing out apps discovery, secured $3.6 million funding.


Google acquired PostRank, a social analytics company. PostRank social engagement data measures actual user activity, the most accurate indicator of the relevance and influence of a site, story, or author.
The developer company of Angry Birds game- Rovio, acquired a leading Finland-based animation studio Kombo. This acquisition is a clear indication of Rovio's animation capabilities growing stronger. 
Twitter acquired AdGrok, that simplifies internet advertising for one and all. Using the grokbar, you’ll be following all the Google AdWords best practices automatically.
OpenX, the online advertising company grabbed $20 million in fourth round of funding. SAP is known to be interested in real-time enterprise products, which is why they have invested in OpenX.


Google released developer preview of WebRTC, a free and open project that enables web browsers with Real-Time Communications (RTC) capabilities via simple Javascript APIs. Developer community can integrate this technology in their own apps and products.
The advent of June 2011 marked the download number of games by Blackflip Studios to have crossed 100 million. For a small company having such a big number in mere 2 years is indeed a significant achievement.
Heyzap, an online popular network that lets check-in apps for games on Android devices has launched its app for iPhone now.

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.