Tuesday, September 6, 2016

Two way handshake in Java

I recently happened to work on two-way SSL handshake where client authorization will take place using certificate provided by trusted one. I got into lot of problems when I was trying to achieve this in Java. So I started reading about this and came to know that we can even enable SSL handshake debugging by just providing -Djavax.net.debug=all in your VM arguments. But trust me, again this log was a mystery to me to understand. Then again started asking Google about this. It gave me handful of blogs and stackexchange answers to get more details on this. I went through most of them and understood how to read this SSL debug log and finally solved the problem. May be if you are interested you can refer this simple blog 'http://www.smartjava.org/content/how-analyze-java-ssl-errors' explains step by step on what happens during SSL handshake process. Please share if you get into any such issues in this.

Sunday, May 17, 2015

Log4j configuration in Java applications

Hello Guys,
This time I come with a very simple, useful and very common requirement that all of our Java developers have.

I used System.out.println extensively when I was new to Java world but after few years(1 or 2 may be) :) I realized that it is not really a good idea to use it in production ready applications. Then slowly moved to Log4j for all logging requirements and made my life simple.

So here I am giving you the configuration file that I am currently using for all my applications. I don't change this file unless my application demands it. I know it is very simple and everyone knows about what I am writing here but I still feel that it would be handy when you guys really need it. I configure this based on my regular requirements and feel free to change this on need basis

Small notes:
  • You can see log4j internal debug statements by enabling  log4j.debug property
  • It basically writes all (INFO, DEBUG, ERROR) level logs into separate files
  • They role the files on daily basis
  • You can change the file paths based on your folder structures
  • Change the package name to enable DEBUG level to your application logging

#log4j.debug=true
# Root logger option
log4j.rootLogger=INFO, infoappend, debugappend, errorappend
log4j.logger.<Give your package name>=DEBUG

# Only DEBUG
log4j.appender.debugappend=org.apache.log4j.DailyRollingFileAppender
log4j.appender.debugappend.File=/opt/apache-tomcat-7.0.40/logs/app_DEBUG.log
log4j.appender.debugappend.DatePattern='.'yyyy-MM-dd
log4j.appender.debugappend.layout=org.apache.log4j.PatternLayout
log4j.appender.debugappend.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.appender.debugappend.filter.A=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.debugappend.filter.A.LevelMin=DEBUG   
log4j.appender.debugappend.filter.A.LevelMax=DEBUG
log4j.appender.debugappend.filter.A.AcceptOnMatch=true

# Only INFO
log4j.appender.infoappend=org.apache.log4j.DailyRollingFileAppender
log4j.appender.infoappend.File=/opt/apache-tomcat-7.0.40/logs/app_INFO.log
log4j.appender.infoappend.DatePattern='.'yyyy-MM-dd
log4j.appender.infoappend.layout=org.apache.log4j.PatternLayout
log4j.appender.infoappend.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.appender.infoappend.filter.A=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.infoappend.filter.A.LevelMin=INFO   
log4j.appender.infoappend.filter.A.LevelMax=INFO
log4j.appender.infoappend.filter.A.AcceptOnMatch=true

# Only ERROR
log4j.appender.errorappend=org.apache.log4j.DailyRollingFileAppender
log4j.appender.errorappend.DatePattern='.'yyyy-MM-dd
log4j.appender.errorappend.File=/opt/apache-tomcat-7.0.40/logs/app_ERROR.log
log4j.appender.errorappend.layout=org.apache.log4j.PatternLayout
log4j.appender.errorappend.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.appender.errorappend.filter.A=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.errorappend.filter.A.LevelMin=ERROR   
log4j.appender.errorappend.filter.A.LevelMax=ERROR
log4j.appender.errorappend.filter.A.AcceptOnMatch=true

#Redirect to Tomcat logs folder
#log4j.appender.file.File=${catalina.home}/logs/logging.log

# Direct log messages to a log file and role it based on it's size
#log4j.appender.file=org.apache.log4j.RollingFileAppender
#log4j.appender.file.File=C://app.log
#log4j.appender.file.MaxFileSize=10MB
#log4j.appender.file.MaxBackupIndex=10

# Direct log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n


Sunday, February 8, 2015

HUDSON + SonarQube

Hello,
In my last post i mentioned about HUDSON and now I am going to extend this to get best out of it

  • I configured HUDSON to poll my SVN repository for every 5 minutes to check any recent changes are there and to prepare a build with those changes and deploy it to Tomcat container (It is pretty straight forward. i certainly used HUDSON's plugins)
So building and deploying changes continuously task is given to HUDSON and it is happily doing without any rest. Now it is time to automate QA checks to make sure that builds are having valid and quality code. 

SonarQube is an open platform to manage your code quality. It is a one stop solution for all your quality related tasks( static checks, dynamic checks, quality reports, code duplicates, comments, coding rules, complexity..etc) It covers more than 20 programming languages like Java, C, C++...etc. You can basically analyze code by it's own Sonar analyzer or you can even use Maven analyzer(can configure to analyze with many plugins like Findbugs, PMD...etc ) and then your results will be stored into your favorite database automatically. You will be provided a nice dash board where you can see all the reports at once and take actions accordingly. Actually you can do a lot better with this great combination.

I will write another blog on how to setup SonarQube. Please do visit again.

Thursday, January 29, 2015

Configure HUDSON CI tool in Tomcat

I thought of automating the build and deployment process to reduce  the efforts that my team spends and minimize the errors that we see later while integrating and deploying to production by adopting one Continuous Integration (CI) tool into my project. I chose HUDSON as it is very simple to configure, opensource, widely adopted and I used it in one of my previous projects (5 years back). Here are the steps to configure Hudson in Tomcat

·         Download Hudson.war file from http://eclipse.org/hudson/download.php
·         Go through the best practices http://wiki.eclipse.org/Hudson-ci/Hudson_Best_Practices
·         Deploy the war file into your favorite web container(Tomcat, JBoss..etc)
·         You may need to tweak your JVM memory options like set "JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx1024m -XX:MaxPermSize=256m -server" https://docs.oracle.com/cd/E40518_01/integrator.311/integrator_install/src/cli_ldi_server_config.html
·         Start your web container and open it in browser (http://localhost:8080/hudson-3.2.1/)
·         Select or unselect required plugins and enter your proxy details if you are under proxy

·         It will download those plugins and will be ready to start play around it

Thursday, November 20, 2014

Netgear N150 WNR612 classic wireless router unboxing




Box contains: Router (WNR612), Ethernet Cable, Power Adapter, User Manual and CD
Network frequency: 2.4GHz

Setup Bower in windows machine and run angular seed projects in Netbeans.



1.     Download and install nodejs from http://nodejs.org/
a.     You can verify this by typing 2+3 and enter in the nodejs command window. It should return 5.
b.      If you are under proxy then you may need to set it using
                                                              i.       npm config set proxy http://”username:password”@proxyserver:port
                                                            ii.       npm config set https-proxy http://”username:password”@proxyserver:port
2.      Install git from http://git-scm.com/ all default options except one change as  shown below

a.     If you are under proxy you may need to specify proxy details as environment variables
                                                              i.      set HTTP_PROXY http://domain\username:password@proxyserver:port
                                                            ii.      set HTTPS_PROXY http://domain\username:password@proxyserver:port
                                                          iii.      set all_proxy http://domain\username:password@proxyserver:port
                                                          iv.      git config --global http.sslverify false
3.      Install Netbeans IDE 8.0.1 if you don’t have one
4.      Create HTML5 project using angularjs seed.
5.     You can see red mark on the project folder which you can resolve by right clicking on the project folder and selecting ‘Resolve project problems’
a.     If you are under proxy you may need to set proxy details in /.bowerrc as below
                                                              i.      "registry": "http://bower.herokuapp.com",
                                                            ii.      "proxy": "http://”username:password”@proxyserver:port".
                                                          iii.      "https-proxy": "http://”username:password”@proxyserver:port",
                                                          iv.      "strict-ssl": false.
6.     Now you can simply run this project in Netbeans just like any other project.



Thursday, July 21, 2011

SwiftkeyX application is free for today

Guys,
Have you ever bored of the default keys in your Android mobile or Tablet?
Are you looking for a better app which learns your key strokes and eases your typing next time you type?
Are you looking for an app, which understands your lazy short-cuts even?
Then I can suggest you to try SwiftkeyX application for your own Android.  But it it not a free app. I can tell you an easy way to get it free for today only. It is available for free in Amazon app store, so go and grab it immediately. Have style and fun in typing :)






Monday, July 18, 2011

Google extended transit service in hyderabad and chennai

Google has already launched their transit service in india a couple of days back and now they extended this service in Hyderabad and Chennai. Transit is really a useful feature to those who comes to city newly. If you enter source and destination and clicks on get directions, then the google maps will show you the best roots availabe and the local bus numbers also. Sounds cool?

Monday, July 4, 2011

Google+ will be in developer's hand soon..

Hi All,
I know many of you have known about Google+ by this time. I know what makes you crazy about Google Plus. It is a rock solid Social networking application from the Legendary Google. Till now I can say , I love FB in social networking but now Google+ is added to the list and heading towards top. It is really cool.

As a developer, I can even think about making some cool plug-ins or add-ons or whatever you call it is, to make Google Plus more yummy... :) . But Google  not released any API publicly  :(  So waiting eagerly for it. I know the developer inside you is  also waiting for this. You can even register to get updates on API whenever it is available. So you never miss the opportunity to spice it up. 

Sunday, February 13, 2011

Instant chrome

Have you tried the instant chrome yet?? As every one of us know, chrome gives search results instantly while we are typing in the search box. The interesting thing is it gives web pages also instantly while you are typing in address bar. Seems cool right.. You can try it by enabling instant check box in basic tab of chrome options.

Wednesday, January 26, 2011

Google Cloud printing on the go

Imagine your document is waiting for you at printer when you step into the room. Yes now you can print your documents from anywhere. Google has launched Cloud print  mobile version so you can give print command from your own mobile.

Wednesday, January 12, 2011

hide command window while running batch files

Guys this time it is completely out of Android. One from my organization asked me on "how to hide command windows while running batch files".So here i want to share the same answer to you all.
It is quite common question to all who runs batch jobs . Always those black ugly screens spreads across all over the screen. So to get rid of that, follow these tips
  1. Minimize:
    • create a short cut to the batch file
    • right click on the short cut and select properties
    • click on run dropdown and select minimized
    • click ok and double click the short cut. That's it from now on , when you run the shortcut it runs the command window in minimized state.
  2. Invisible:
    •  Create one *.vbs file and paste the below given code and save it . Eg: invisible.vbs
    • "CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False"
    • create a short cut with the location as C:\Windows\System32\wscript.exe "fullpath of .vbs file" "full path of .bat file"
    • save it and run it. It will never shows those black screens.

Wednesday, January 5, 2011

Market your Android applications with Amazon

Amazon is well known in marketing and merchandising. Here is a chance to market your Android apps with Amazon.Amazon today announced the launch of appstore. So developers can submit their android applications to Amazon and once its is get approved, you can see your application in Amazon appstore.Developer can earn 70% percent of income and remaining 30% will be taken by Amazon.Developers will be paid once in a month.So register today and submit your application to start earning with Amazon, which is well known for it marketing and merchandising.

For details
https://developer.amazon.com/welcome.html

Monday, January 3, 2011

Handling User Interaction with Android App Widgets

We can add user interactions in Activities but when it comes to a screen widget it is very difficult to do more things as it gives you very limited access to widgets. So have you ever think about adding buttons in scree widgets and make it more interactive. If you try this then you will probably come to know that , you can't do this directly in AppwidgetProvider class.
But still you can do this in a different way using pendingIntent. So place all interactions in another activity and make it as a pendingIntent. Then only thing left is pass the data from Appwidgetprovider class to this pendingIntent class and get results back on click of the buttons in screen widget. To do this you can use onClickPendingIntent method on remoview object.
You can get the complete example here in this link
Handling User Interaction with Android App Widgets - Developer.com

You can download the complete source code of Widget development tutorial source codes at
http://code.google.com/p/android-widget-development-tutorials/

Android Development Tutorial - Gingerbread

Guys... A simple and clear tutorial on Android development for those who want to learn it quickly

Android Development Tutorial - Gingerbread

Saturday, January 1, 2011

New year with new hopes

Hi all, This is my second post in this year. i have already blogged once in this new year. Because i just wanted to start this new year with some good post. I would like to take this opportunity to wish all my blog readers a very happy new year and also want to give some positive note.

Each one of us has to face lot of challenges in one's life. So keep moving, energize yourself. Life is like a 'Treasure hunt' game . No clue waits for you. You have to identify all the clues and find the treasure.So take up each and every challenge in your life and have fun in that. I don't know why many people like to play some challenging games and even they would like to see some adventurous movies also but the same people don't like to take challenges or at least they don't find fun in taking challenges in their's own lives. So play well in your own life and win. Finally don't forget to thank the game master, that is none other than the GOD for giving all the clues and for staying with us all the time. So only thing left with us is just PLAY the game and have FUN.
I have two questions here.

  • Do you think that these highlighted two words are not familiar in you life???
  • Anybody would dare to say yes???
I am very sure that  no one is existed in this galaxy who can say yes( lol....Except those who does not know those little English words ... just kidding guys)

So my ending note is:
Why do you worry... Lets start playing and have fun all your life... Enjoy :)
i am wishing you all a  happy new year.
with lots of love
Raju

Wikipedia celebrations

We know how the wikipedia became a part of our daily life.It is the 5th most visited site across the world.Wiki is a non-profit charitable foundation. Jimmy Wales,Founder of Wikipedia, is conducting fund raising program for this year. You too please contribute for this non-profitable foundation. You can find the key note on this from Wales at
http://wikimediafoundation.org/wiki/Jimmy_Thank_You/en?utm_medium=sitenotice&utm_campaign=20110101TY002_EN&utm_source=20110101_YETY001_EN&country_code=IN

Now wiki is celebrating its 10th anniversary. You too can participate in that.
http://ten.wikipedia.org/wiki/Main_Page

Thursday, December 30, 2010

Geinimi Trojan in Android apps

Android apps are coming like any thing now a days. As a we are enthusiastic to install many apps in our mobiles and test it we should be very care full and selective in loading new applications in our Android mobiles . There is a chance to leave our personal information to others.Trojans can be installed along with our newly installed application. It can transfer our important information like IMEI, location based information to hackers.Look at the below article.

Geinimi Android trojan piggybacks 3rd-party apps & sends personal info to hackers Android Community: "be at risk. Still, it’s a good idea to check the security"