Skip to main content

Posts

Gulp command not found on Mac OSX

Was getting following error after installing gulp on mac. Sachins-MBP:MyApp sachin$ gulp -bash: gulp: command not found After fighting for hours and searching on internet, tuned out to be a very simple fix. While installing gulp missed the parameter to install globally. Sachins-MBP:MyApp sachin$ npm install -g gulp Yay !!!! Its working, thought to write to save time for somebody else.

MQTT : Android step by step guide using Eclipse Paho

For MQTT integration, recently explored Paho Android project, very simple to use, here are the steps: Intialize a client, set required options and connect.     MqttAndroidClient mqttClient = new MqttAndroidClient(BaseApplication.getAppContext(), broker, MQTT_CLIENT_ID);     //Set call back class     mqttClient.setCallback(new MqttCallbackHandler(BaseApplication.getAppContext()));     MqttConnectOptions connOpts = new MqttConnectOptions();     IMqttToken token = mqttClient.connect(connOpts); Subscribe to a topic.     token.setActionCallback(new IMqttActionListener() {       @Override       public void onSuccess(IMqttToken arg0) {            mqttClient.subscribe("TOPIC_NAME" + userId, 2, null, new IMqttActionListener() {                 @Override                 public void ...

Parsing mailing address in Java

Recently came across a problem to parse postal address String using Java, did some research here are some findings. Given String s = "60 Strawberry Hill Ave Stamford CT 06901" Required Result Street = Strawberry Hill Ave City = Stamford Number = 60 zip = 06901 state = CT You can use  JGeocoder public static void main(String[] args) { Map<AddressComponent, String> parsedAddr  =     AddressParser.parseAddress("Google Inc, 1600 Amphitheatre Parkway, Mountain View, CA 94043"); System.out.println(parsedAddr);       Map<AddressComponent, String> normalizedAddr  = AddressStandardizer.normalizeParsedAddress(parsedAddr);         System.out.println(normalizedAddr); } Output will be: {street=Amphitheatre, city=Mountain View, number=1600, zip=94043, state=CA, name=Google Inc, type=Parkway} {street=AMPHITHEATRE, city=MOUNTAIN VIEW, number=1600, zip=94043, state=CA, name=GOOGLE INC, type=PKWY} There is ano...

Clean and Simple Email Sender Design

Recently review design for an email sender with following requirements: Build a service to send email Service must have failover recovery, in youcase if system goes down and comes back up it should still send out pending email reminders You are not expecting any acknowledgements for the messages sent. The design proposal in place was to use a funky framework with persistence store etc etc.  After going through the simple requirements stated above, used following clean and simple design and I am happy to say we made right decision: Use Java Mail API to send email reminders Create a table which stores reminders to be sent and update a flag after email reminder is sent In case system goes down, you can resend all reminders for which flag was not set. It was so simple and easy to implement and we have all control in our hand and there was no RAMP up time to learn new frameworks. So, if you are confused with n number of ideas available out there using x numbe...

Map Reduce Simplified

Yes it is about parallel and distributed computing, there are tonnes of web pages, books articles, diagrams etc. etc with nice buzz words to talk about Map Reduce, here is the most simplified explanation. Lets take a real life example. 1. Company CEO called all Program Manager's "I need total effort spent this month by noon". Program Manager's no problem sir. Why are Program Manager's not worried because they are going to distribute task :-) 2. Each Program Manager called their project manager asking for effort spent so far. 3. Each Project Manager pulled up effort sheet and provided it to their Program Managers. 4. Program Managers complied received sheet into one file and sent it to CEO. 5. Company CEO collated all the sheets and calculated total effort spent. Each individually broke its task to smaller tasks (Mapped its input task to smaller tasks), Program Manager was required to provide effort spent, he mapped his task to smaller tasks, this is...

Apache Roller Getting Started

If you are thinking to setup a blog website then apache roller is the quickest and simplest thing to do so, below are steps for getting started, though these instructions are present in documentation provided by apache, but hopefully following steps will make it very easy for you. Here you Go !! 1. Download apache roller http://roller.apache.org/download.cgi#roller50 2. Install Tomcat http://tomcat.apache.org/download-70.cgi 3. Download mysql http://dev.mysql.com/downloads/ 4. Unzip apache roller zip file and copy roller-5.0.1-tomcat.war from \roller-weblogger-5.0.1-for-tomcat.zip\roller-weblogger-5.0.1-tomcat\webapp to tomcat webapps folder 5. Create mysql database, dont worry about schema, that will be automatically created later. mysql -u root -p password: ***** mysql> create database rollerdb; mysql> grant all on rollerdb.* to scott@'%' identified by 'tiger'; mysql> grant all on rollerdb.* to scott@localhost identified by 't...

HTML5 Cool Features

HTML5 has come up with lot of features but coolest of them are MathML and SVG support. Tried few quick examples, they make web designing more fun: If you don't see a green circle, red rectangle and a blue line then your browser does not support HTML5, visit following URL to check your browser: http://html5test.com/ Good luck for rich GUI's.