Sunday, August 11, 2013

Hurray ! I am one of the top 5% most viewed LinkedIn profiles for 2012!


200 Million

Hi Sagar,

Recently, LinkedIn reached a new milestone: 200 million members. But this isn't just our achievement to celebrate — it's also yours.

I want to personally thank you for being part of our community. Your journey is part of our journey, and we're delighted and humbled when we hear stories of how our members are using LinkedIn to connect, learn, and find opportunity.

All of us come to work each day focused on our shared mission of connecting the world's professionals to make them more productive and successful. We're excited to show you what's next.

With sincere thanks,

Deep Nishar

Senior Vice President, Products & User Experience

P.S. What does 200 million look like?

See the infographic





Ciphers problem: Request over ssl


Recently, I was trying to make an HTTP request to  openmrs
web-app. When I was trying to connect over HTTPS, I was getting following
exception. Basically my php-client was sending HTTP request to
https://localhost:8443/openmrs using HTTP/Request2.

"   : Unable to connect to ssl://localhost:8443. Error: stream_socket_client():
unable to connect to ssl://localhost:8443 (Unknown error) stream_socket_client():
Failed to enable crypto stream_socket_client(): SSL operation failed with code 1.
OpenSSL Error messages: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert
internal errorstring(339) "Unable to connect to ssl://localhost:8443. Error:
stream_socket_client(): unable to connect to ssl://localhost:8443 (Unknown error)
stream_socket_client(): Failed to enable crypto stream_socket_client(): SSL operation
failed with code 1. OpenSSL Error messages: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1
alert internal error "

After struggling alot for possible solution, I came to know about allowed ciphers in openjdk which
was being used by tomcat7. To allow tomcat7 to run on https, I used

$ ssh-keygen -t RSA -C 'user@example.com'
 which will generate an RSA SSH(2) key. I added allowed ciphers in tomcat7 server configuration
 located at /etc/tomcat7/server.xml

<Connector port="8443" protocol="HTTP/1.1"
               SSLEnabled="true" maxThreads="150"
               scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               keystoreFile="/home/XXXX/.keystore"
               keystorePass="XXXX"
               ciphers="SSL_RSA_WITH_RC4_18_SHA"/>

Thats solved my problem. Hope that helps others too !

Tuesday, April 30, 2013

Kernel modules simplified !

View Sagar Gugwad's profile on LinkedIn

This blog gives idea to develop simple kernel module. Information contained
here, is based on   linux foundation tutorial. This tutorial introduces about
basic kernel module,  to write a simple kernel module, compiling the kernel
module and injecting the module in to the kernel. In this tutorial,
we will be dealing with the following  set of commands.

*) lsmod
   lsmod command is used to list all the kernel modules that are loaded.
*) insmod <modulename>
   insmod command will insert the module into kernel.
*) dmesg
   dmesg command is used to obtain the kernel logs.
*) modinfo <modulename>
   modinfo provides information about the module such as author, license,
   version and description.
*) rmmod <modulename>
   rmmod command removes the specified command from the kernel.

Now its time to write your simple kernel module which says

*) "Loaded test module into kernel successfully" upon loading
*) "Unloaded test module from kernel successfully"  upon unloading.

Open your favorite editor (vim is my ravorite)
and type in the following code:

/**
 * Simple kernel module program, which outputs some string when
 * loaded into kernel.
 * Copyright (C) 2013 Sagar Gugwad <saagar.gugwad@gmail.com>
 *
 *      This program is free software: you can redistribute it and/or modify it
 *      under the terms of the GNU General Public License as published by the
 *      Free Software Foundation; either version 2 of the License, or (at your
 *      opinion) any later version.
 *
 * Derived from usb_tutorial driver
 * Copyright (C)  2013  Greg Kroah-Hartman, Linux Foundation @ linux foundation.org
 *
 * V0.1 (mh) Initial version
 */

#include<linux/kernel.h>
#include<linux/init.h>
#include<linux/module.h>
                                                                                                                                                                                 
static int __init gotemp_init(void)
{
        printk(KERN_INFO "Loaded test module into kernel successfully");
        return 0;
}
static void __exit gotemp_exit(void)
{
        printk(KERN_INFO "Unloaded test module from kernel successfully");
        return 0;
}
module_init(gotemp_init);
module_exit(gotemp_exit);

MODULE_AUTHOR("Saagar Gugwad");
MODULE_DESCRIPTION("Test device driver");
MODULE_LICENSE("GPL");


The function gotemp_init will be called whenever the module is loaded into
kernel. The corresponding message passed for printk method will be logged.
KERN_INFO is used to debug the moduke by  printing messages. We can use
other possible macros which are:

*) KERN_EMERG
*) KERN_ALERT
*) KERN_CRIT
*) KERN_ERR
*) KERN_WARNING
*) KERN_NOTICE
*) KERN_DEBUG

Similarly, gotemp-exit will be called, whenever the module is exited from the
kernel. All the logged messages can be obatained by dmesg command.
Save the file with <yourfile>.c.

Now it is time to compile our code. Kernel module compilation is done
using the make utility. The make command defines part of the kernel module to

be re-compiled. Open your editor type in the following code:

obj-m := <yourfile>.o
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

all:
        $(MAKE) -C $(KERNELDIR) M=$(PWD)

obj-m specifies the kernel module to be recompiled. We specify the make command
with kernel directory to be used to re-compile and current module directory as
arguments. Save the file as Makefile.


Now type in the make command  which run the instructions specified within the
Makefile. It will generate yourfile.ko kernel object  which can be loaded in
to the kernel. You can load your module into kernel using
$ sudo insmod yourfile.ko
To see the all the loaded modules you can type in
$ sudo lsmod
You should be able to see the your module name.
$ dmesg
will show the logs by kernel, upon successfully inserting the module, you should be
able to see "Loaded test module into kernel successfully".

Now to remove the module inserted, we can run
$ sudo rmmod yourfile.ko
which will unload the module, within the kernel module you should be able to see
the message "Unloaded test module from kernel successfully".

Thats it you just wrote your first kernel module !

Friday, December 7, 2012

Installing Git

View Sagar Gugwad's profile on LinkedIn
This blog provides guidance to install git on  the Ubuntu. After that we will follow the instructions to setup the project on the local machine.

  1.  Press Ctrl + Alt + T on your Ubuntu machine. This will pops up the terminal in your machines. There are multiple ways to open a terminal. Please note that using commands is powerful and a good practice, therefore we will stick to commands rather than GUI.                                                           
  2. Type in the following command
    • sudo apt-get install git-core
  3. Verify the successful installation by command, which should fetch you installation path
    • which git
  4. Configure your username using following command
    • git config --global user.name  "yourname"
  5. Configure your email using following command
    • git config --global user.email "your@email.address"
  6. Configure your diff tool by setting it upto meld (you can also use other editors, I prefer meld)
    • git config --global merge.tool meld
  7. Cloning the project in your preferred directory 
    • git clone git@github.com:geekgugi/mSIS.git
  8. Change your branch (by default it will be pointing master branch)  to dev branch by following command
    • git checkout -b dev -t origin/dev
  9. We are ready to launch for few git commands
    • git branch -a shows the branch you are in
    • git status shows changes you have made
    • git commit used to commit your changes to local 
    • git log shows commit done by other developers
For more details,  you can go through http://git-scm.com/book/en/Getting-Started which will give you clear idea to work with git.








      Building Infrastructure

      This blog assists  setting up the development infrastructure for creating mobile applications  in collaborative development. The tools used within infrastructure are mainly open source tools. Hence all are available freely on the internet. All the tools required for building the development infrastructure are mentioned below. It is better to read some concepts before downloading the tools for installation.
      1. Ubuntu is freely dialect of linux operating system. It is available for free from the website http://www.ubuntu.com/download/desktop. Please install the latest Long Term Support (LTS)  which is now 12.04. Please follow the instructions during installation. There are different available ways to install but I suggest you to install along the side of the windows if you tend to use windows in between.  It does not matter to me, since I just use ubuntu. There are also many good blogs available explaining installations for newbies. Please dig them out by yourself. People who dont love ubuntu may also install other dialects like mint, kubuntu, fedora, but it is purely matter of choice. 
      2. Git is version control tool. Assuming that we have successfully  installed ubuntu (or any other), we will move on to installing Git tools. Many of you may be aware of version control system like Clear case, SVN, Perforce etc. Similarly, Git is powerful distributed version control system available freely with opensource. Git is designed to handle different kinds of projects. Compared to remaining all tools, Git is efficient and speeder.
      3. Eclipse is free available open Integrated Development Environment. It is availble for free   http://www.eclipse.org/downloads/.  Again, it is matters of choice to install the version I suggest to go for Java EE version.
      4. Android SDK  is freely available from the google android website.
      5. Android NDK is also freely available from the android website.
      6. AgileFant  project management system used with agile scrum methodlogies, we do not need this as of now.
      7. Gerrit is freely available code review tool.
      8. Jenkins is freely available build environment tool.
      9. Bugzilla Freely available bug tracking tool. 
      In the next post, I will explain installing Git on ubuntu along with details for setting up the project.