Creativity and Innovation

Just another weblog

Leave a comment

Marathi Jokes

Hello Friends if you like to laugh and smile then please Marathi Jokes. Containing the marathi jokes. Try to add and share it.




Leave a comment

Java Windows Authentication

To do Windows Authenticate in java you need jna.jar and platrofm.jar library

Below code is useful to do authentication

import com.sun.jna.platform.win32.Advapi32;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinBase;
import com.sun.jna.platform.win32.WinNT;

public class AuthWindowsUser {

public static void main(String[] args) {
boolean isWindowsUser=false;

isWindowsUser= authWindowsUser(“A563627″,””,”test@Pass123″);
if(isWindowsUser) {
System.out.println(“User is authenticated”);
} else {
System.out.println(“User is not authenticated”);

public static boolean authWindowsUser(String user, String domain, String password) {
WinNT.HANDLEByReference handle = new WinNT.HANDLEByReference();
boolean successful = Advapi32.INSTANCE.LogonUser(user, domain, password,WinBase.LOGON32_LOGON_NETWORK,WinBase.LOGON32_PROVIDER_DEFAULT, handle);
if (successful) {
return successful;


1 Comment

Configure SonarQube for non-Maven based Java Project

I am curious to analyze my Java code quality using SonarQube. SonarQube help line have given on SonarQube website. You can do code analysis of various kind of project for that you have to see the help line here. I am unable to find the guideline to do code analysis of non maven based java project. I faced too much problem but finally I solved it and here it is.

  1. Download SonarQube 5.6.3 zip file and extract it on your machine.
  2. Download SonarQube Scanner 2.8 zip file and extract it on your machine
  3. Create file. sample file is given here sonar-project-properties in word document format. Copy file content and make necessary changes like sonar.sources=C:\\Users\\workspace_Mars\\JavaStudy\\src (put the double slash) and save it under your java project root directory like C:\Users\workspace_Mars\JavaStudy\ as shown in the figure.
  4. I am using Windows 7-64 bit, Java8-32 bit and Eclipse Java EE IDE for Web Developers (Version: Mars Release 4.5.0) 32 bit application.
  5. To run SonarQube server go in the directory C:\Installed Sonar\sonarqube-5.6.3\bin\windows-x86-32 and run StartSonar.bat file.
  6. Do not close the SonarQube console window.
  7. Hit the url http://localhost:9000/ on your favorite web browser (Here I am using Mozilla Firefox).
  8. Default login credential is admin/admin. You can see the SonarQube home page as shown in above figure. You can see none of the project is added in SonarQube.
  9. Open command prompt and go into your project directory and run sonar-scanner.bat file like this C:\Users\workspace_Mars\JavaStudy>”C:\Installed Sonar\sonar-scanner-2.8\bin\sonar-scanner.bat” (wrapped in double quote because space exists in my SonarQube installation folder name)
  10. You can see the Sonar Scanner start running on your project. It is analyzing your project. Go on http://localhost:9000/ and refresh the page (hit F5)

    You can see your project under Projects list. Now you can see code analysis on web.

  11. To see the code analysis in eclipse. Installed SonarLint plugin in Eclipse.
  12. Go Eclipse>Window >Show view> Others.. and open SonarLint issues, SonarLint Rule Description, SonarQube Servers
  13. Go in SonarQube Servers and Click to connect to a SonarQube server….
  14. Put down the server configuration details as show in figure. Press the Test connection button. sonarlint-connecting-to-sonarqubeIf everything is fine then it’s show the successfully connected message.
  15. Press Finish button.
  16. Right click on your project and select SonarLint> Bind to a SonarQube project…
  17. Select your SonarQube project.Project bind to SonarQube.png
  18. Press Auto Bind selected projects button or type SonarQube project name. Here my java project name and SonarQube project name (JavaStudy) is same. Eclipse intellisense detect and showing ‘main’ on server ‘localhost’.
  19. Press PressFinish button
  20. If you open any class then SonarLint showing the issues in SonarLint issues tab.Project issue in SonarLint.png

Leave a comment

Invoking JAVA SOAP webservice from VBA

  1. Requirement
    1. Tomcat Apache Server 7.0
    2. JDK 1.6
    3. Apache CXF 2.0 Webservice jar library
    4. Eclipse Indigo for Web Development
  2. Steps
    1. Configure your Eclipse for Apache CXF Webservice
    2. Import the ‘MyWebService’ Project in your eclipse Excel file content the embedded object Click here to get the Excel file Calling JAVA SOAP webservice from VBA
    3. Run the ‘TestPrintingInterfaceServer’ program in eclipse on Tomcat Server
    4. Run the ‘TestPrintingInterfaceClient’ program in eclipse to test the webservice is running or not
    5. Go in Excel VBA editor
    6. Consume the webservice
  3. Note
      1. Open Excel File.
      2. Press Alt+F11 button here to go in VBA editor.
      3. Create module ‘WebService_Module’
      4. Add the below code in that

    Option Explicit

    ‘Add Microsoft XML V6.0 library in reference
    Sub invoke_JAVA_SOAP_WebService()

    On Error GoTo ERROR_BLOCK

    Dim sURL As String
    Dim sEnv As String

    ‘Endpoint address
    sURL = “http://localhost:8020/MyWebService/services/TestPrintingPort”

    ‘SOAP envelope for submission to the Web Service
    sEnv = “
    sEnv = sEnv & “<soapenv:Envelope ” sEnv = sEnv & “xmlns:xsi=”””&#8221; ” sEnv = sEnv & “xmlns:xsd=”””&#8221; ” sEnv = sEnv & “xmlns:soapenv=””””>&#8221;
    sEnv = sEnv & ” ”
    sEnv = sEnv & ” ” ‘Java function name ‘ChangeCaseToUpper’ and ‘Target namespace’
    sEnv = sEnv & ” ganesh bhagat” ‘Function argument Name in webservice is ‘arg0’
    sEnv = sEnv & ” ”
    sEnv = sEnv & ” ”
    sEnv = sEnv & “”

    ‘Invoke a web service which requires authentication
    ‘ObjHTTP.Open “Post”, sURL, False, “username”, “password”

    ‘Invoke a web service which doesn’t require any user authentication
    ObjHTTP.Open “Post”, sURL, False

    ObjHTTP.setRequestHeader “Content-Type”, “text/xml”
    ObjHTTP.send (sEnv)

    Debug.Print ObjHTTP.responseText

    On Error Resume Next
    ‘clean up code
    Set ObjHTTP = Nothing
    Exit Sub

    Debug.Print Err.Description
    Resume EXIT_BLOCK
    End Sub

Leave a comment

Authenticate User and Password with Active Directory

Option Explicit

Sub Test()
Dim status As Boolean

status = authenticateWindowsLogin(“GANESH”, “pass@1273”, “home”)

If (status = True) Then
Debug.Print “User is authenticated successfully”
Debug.Print “User is not authenticated”
End If

End Sub

‘Authenticates user and password entered with Active Directory.
Private Function authenticateWindowsLogin(ByVal strUserName As String, ByVal strpassword As String, ByVal strDomain As String) As Boolean


Dim oADsObject As Object, oADsNamespace As Object
Dim strADsPath As String

strADsPath = “WinNT://” & strDomain
Set oADsObject = GetObject(strADsPath)
Set oADsNamespace = GetObject(“WinNT:”)
Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & “\” & strUserName, strpassword, 0)

authenticateWindowsLogin = True ‘ACCESS GRANTED

On Error Resume Next
Exit Function

Debug.Print “Error Source:<” & Err.Source & “>,Function Name:”
Debug.Print “Error Number:<” & Err.Number & “>,Error Description:<” & Err.Description & “>”
authenticateWindowsLogin = False ‘ACCESS DENIED
Resume Exit_BLOCK
End Function

Leave a comment

बघ माझी आठवण येते का

बघ माझी आठवण येते का

मुसळधार पाऊस खिडकीत उभं राहून पहा
बघ माझी आठवण येते का?

हात लांबव, तळहातांवर झेल पावसाचं पाणी
इवलसं तळं पिऊन टाक
बघ माझी आठवण येते का?

वार्‍याने उडणारे पावसाचे थेंब चेहर्‍यावर घे
डोळे मिटून घे, तल्लीन हो
नाहिच जाणवलं काही तर बाहेर पड, समुद्रावर ये
तो उधाणलेला असेलच, पाण्यात पाय बुडवून उभी रहा
वाळू सरकेल पायाखाली, बघ माझी आठवण येते का?

मग चालू लाग, पावसाच्या अगणित सुया टोचून घे
चालत रहा पाऊस थांबेपर्यत, तो थांबणार नाहिच, शेवटी घरी ये
साडी बदलू नकोस, केस पुसू नकोस, पुन्हा त्याच खिडकीत ये
आता नवर्‍याची वाट बघ, बघ माझी आठवण येते का?

दारावर बेल वाजेल, दार उघड, नवरा असेल
त्याच्या हातातली बॅग घे, रेनकोट तो स्वतःच काढ़ेल
तो विचारेल तूला तुझ्या भिजण्याचं कारण, तू म्हणं घर गळतयं
मग चहा कर, तूही घे
तो उठून पंकज उधास लावेल, तो तू बंद कर
किशोरीचं सहेलारे लाव, बघ माझी आठवण येते का?

मग रात्र होईल तो तुला कुशीत घेईल, म्हणेल तू मला आवडतेस
पण तुही तसचं म्हणं
विजांचा कडकडात होईल, ढ़गांचा गडगडाट होईल
तो त्या कुशीवर वळेल, त्याच्या पाठमोर्‍या शरीराकडे बघ
बघ माझी आठवण येते का?

यानंतर सताड डोळ्यांनी छप्पर पहायला विसरू नकोस
यानंतर बाहेरचा पाऊस नुसता ऐकण्याचा प्रयत्न कर
यानंतर उशीखाली सुरी घे, झोपी जाण्याचा प्रयत्न कर
येत्या पावसाळ्यात एक दिवसतरी, बघ माझी आठवण येते का?

गीतकार :सौमित्र चित्रपट :गारवा