Sunday, January 29, 2012

Spring Modules


Saturday, January 28, 2012

Jar Required for Spring (Basic)


 For Typical Application

  • spring-asm-3.0.2.RELEASE
  • spring-beans-3.0.2.RELEASE
  • spring-context-support-3.0.2.RELEASE
  • spring-core-3.0.2.RELEASE
  • spring-context-3.0.2.RELEASE
  • spring-expression-3.0.2.RELEASE
  • spring-web-3.0.2.RELEASE
  For Using AOP, ORM, TAGLIB, JMS,STRUTS, JDBC etc...

  • cglib-2.2
  • commons-logging-1.1
  • jstl
  • spring-aop-3.0.2.RELEASE
  • spring-aspects-3.0.2.RELEASE
  • spring-instrument-3.0.2.RELEASE
  • spring-instrument-tomcat-3.0.2.RELEASE
  • spring-jdbc-3.0.2.RELEASE
  • spring-jms-3.0.2.RELEASE
  • spring-orm-3.0.2.RELEASE
  • spring-oxm-3.0.2.RELEASE
  • spring-struts-3.0.2.RELEASE
  • spring-test-3.0.2.RELEASE
  • spring-tx-3.0.2.RELEASE
  • spring-webmvc-3.0.2.RELEASE
  • spring-webmvc-portlet-3.0.2.RELEASE
  • standard
  For Include External Resource Such as CSS,JS,IMAGES,ICON etc...
  • org.springframework.js-2.0.2.RELEASE

    Friday, January 6, 2012

    Always Leave Office On Time.......

    Always Leave Office On Time
    Why ?

    1. Work is never ending process. You can never finish the work.

    2. Interest of a client is not more important than your family.

    3. If you fail in life your boss or client will not be the person to offer a helping hand but your
    family and friends will do.

    4. Life does not mean coming to office, going home and sleeping. There is more to a life. You
    need time to socialize, entertainment, exercise and relaxation. Don't make your life meaningless.

    5. A person who sits in office till late is not a hardworking person. He just don't know how to
    manage work within the stipulated time.

    6. You did not study hard and struggle just to have a meaningless life.

    Have a balance life. We work to live , not live to work.. :)

    Thursday, December 29, 2011

    Ajax Request

    function constructXmlHttpRequest(url,data,funName)
    {
    if (window.XMLHttpRequest)
    {
    req = new XMLHttpRequest();
    req.onreadystatechange = function()
    {
    constructResponse(req , funName);
    };
    req.open("POST", url, true);
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    req.send(data);
    }
    else if (window.ActiveXObject)
    {
    isIE = true;
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req)
    {
    req.onreadystatechange = function(){
    constructResponse(req , funName);
    };
    req.open("POST", url, true);
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    req.send(data);
    }
    }
    }

    function constructResponse( req , funName)
    {
    if (req.readyState == 4)
    {
    if (req.status == 200)
    {
    var callBackFunction = funName +"(request)";
    var newFunction = new Function("request",callBackFunction);
    newFunction(req);
    }
    else
    {
    alert("There was a problem in retrieving the data:\n" +req.statusText);
    }
    }
    }

    Get a SystemInfo (VBSCRIPT)

    On Error Resume Next
    logLocation = WScript.Arguments.Item(0)
    Set logFile = CreateObject("Scripting.FileSystemObject")
    Set logger = logFile.OpenTextFile(logLocation,2,True)

    Set ADSysInfo = CreateObject("ADSystemInfo")
    logger.writeline "ComputerName : "&ADSysInfo.ComputerName
    logger.writeline "UserName : "&ADSysInfo.UserName
    logger.writeline "SiteName : "&ADSysInfo.SiteName
    logger.writeline "DomainDNSName : "&ADSysInfo.DomainDNSName
    logger.writeline "DomainShortName : "&ADSysInfo.DomainShortName
    logger.writeline "ForestDNSName : "&ADSysInfo.ForestDNSName
    logger.writeline "IsNativeMode : "&ADSysInfo.IsNativeMode
    logger.writeline "PDCRoleOwner : "&ADSysInfo.PDCRoleOwner
    logger.writeline "SchemaRoleOwner : "&ADSysInfo.SchemaRoleOwner

    For Each var in ADSysInfo.GetTrees
    logger.writeline "Tree: " & var
    Next

    Set objWMIService = GetObject("winmgmts:\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

    For Each objItem in colItems
    logger.writeline "OS : "&objItem.Caption
    logger.writeline "ServicePack : "&objItem.ServicePackMajorVersion &"."&objItem.ServicePackMinorVersion
    logger.writeline "Build Version : "&objItem.Version
    logger.writeline "System Directory: "&objItem.SystemDirectory
    logger.writeline "OS Language: "&objItem.OSLanguage
    logger.writeline "Current Time Zone: "&objItem.CurrentTimeZone
    logger.writeline "CSD Version: "&objItem.CSDVersion
    Next

    Set Battery = objWMIService.ExecQuery("Select * from win32_battery")
    i = 0
    For Each objItem in Battery
    i = i+1
    Next

    if i = 0 then
    logger.writeline "System : Desktop"
    else
    logger.writeline "System : NotePad"
    end if

    Set tcpIp = objWMIService.ExecQuery("Select * from win32_networkadapterconfiguration where ipenabled = true")
    For Each objItem in tcpIp
    For Each ip in objItem.IPAddress
    logger.writeline "IPAddress : "&ip
    Next
    logger.writeline "MACAddress : "&objItem.MACAddress
    For Each gw in objItem.DefaultIPGateWay
    logger.writeline "DefaultIPGateWay : "&gw
    Next
    For Each ds in objItem.DNSServerSearchOrder
    logger.writeline "DNSServerSearchOrder : "&ds
    Next
    logger.writeline "DHCPEnabled : "&objItem.DHCPEnabled
    logger.writeline "DHCPLeaseExpires : "&objItem.DHCPLeaseExpires
    logger.writeline "DHCPLeaseObtained : "&objItem.DHCPLeaseObtained
    logger.writeline "DHCPServer : "&objItem.DHCPServer
    For Each ips in objItem.IPSubnet
    logger.writeline "IPSubnet : "&ips
    Next
    Next

    if Err Then
    logger.writeline Date()&" "&Time()&" "&Err.Number&" "&Err.Description
    End if

    Find a Machine on which Domain(WorkGroup)

    Dim sName
    Dim logFile

    '
    ' Logger
    '
    Sub Logger
    Set fso = CreateObject("Scripting.FileSystemObject")

    Set logFile = fso.OpenTextFile( "C:\ComputerList.txt", 8, True )
    End Sub


    '
    ' Get all the NetBIOS namespaces
    '
    Sub PullAllDomains

    Dim objNameSpace
    Dim AllNameSpaces
    Dim Domain
    Dim c

    c = 0
    Set objNameSpace = GetObject("WinNT:")
    For Each Domain in objNamespace
    AllNameSpaces = AllNameSpaces & VBCRLF & Domain.Name
    c = c + 1
    if Instr(sName, Domain.Name) <> 0 then
    logFile.writeline Domain.Name & " matches"
    else
    GetComputerList Domain.Name
    End if
    Next
    logFile.writeline "Namespaces :" & c
    logFile.writeline AllNameSpaces

    End sub

    '
    ' When passed a namespace returns all computers present in it.
    '
    sub GetComputerList( ContainerName )

    Dim Container
    Dim Computer
    Dim sTemp
    Dim filter
    Dim counter
    filter = "Computer"
    counter = 0
    Set Container = GetObject("WinNT://" & ContainerName)
    Container.Filter = Array(filter)

    For Each Computer In Container
    sTemp = sTemp & Computer.Name & VBCRLF
    counter = counter + 1
    Next

    logFile.writeline VBCRLF
    logFile.writeline "Machines in " & ContainerName & " : " & counter
    logFile.writeline sTemp

    End Sub

    '
    ' Finds the current workgroup/domain the local machine is present using WMI.
    '
    Sub GetLocalDomain

    sNode = "."
    Set oWMI = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & sNode & "\root\cimv2")
    Set colComputer = oWMI.ExecQuery _
    ("Select DomainRole, Domain from Win32_ComputerSystem")
    For Each oComputer in colComputer
    iDR = oComputer.DomainRole
    sName = oComputer.Domain
    Next

    If iDR = 0 Or iDR = 2 Then
    logFile.writeline "Computer is in workgroup " & sName
    Else
    logFile.writeline "Computer is in domain " & sName
    End If

    GetComputerList sName

    End Sub

    Logger
    logFile.writeline Date()&":"&Time()&":" & " Starting discovery ..."
    GetLocalDomain
    PullAllDomains
    logFile.writeline Date()&":"&Time()&":" & " End of discovery ..."

    ' Close the log file.

    logFile.Close

    Tuesday, December 13, 2011

    Login to FB from java

    package test;

    import javax.ws.rs.core.MultivaluedMap;

    import com.sun.jersey.api.client.ClientResponse;
    import com.sun.jersey.api.client.WebResource;
    import com.sun.jersey.api.client.WebResource.Builder;
    import com.sun.jersey.api.client.config.ClientConfig;
    import com.sun.jersey.api.client.config.DefaultClientConfig;
    import com.sun.jersey.core.util.MultivaluedMapImpl;

    public class CallWS {

    public static void main(String[] args) throws Exception {

    ClientConfig config = new DefaultClientConfig();
    com.sun.jersey.api.client.Client client = com.sun.jersey.api.client.Client.create(config);


    MultivaluedMap formData = new MultivaluedMapImpl();


    formData.add("charset_test","€,´,€,´,水,Д,Є");
    formData.add("charset_test","€,´,€,´,水,Д,Є");
    formData.add("default_persistent","0");
    formData.add("display","");
    formData.add("email","YOUR_FACEBOOK_ID");
    formData.add("legacy_return","1");
    formData.add("login","Log In");
    formData.add("lsd","");
    formData.add("lsd","");
    formData.add("pass","YOUR_FACEBOOK_PASSWORD");
    formData.add("return_session","0");
    formData.add("session_key_only","0");
    formData.add("trynum","2");
    System.out.println(formData.toString());

    WebResource resource = client.resource("https://www.facebook.com/login.php?login_attempt=1");
    // for GET
    //ClientResponse response = resource.type("application/x-www-form-urlencoded").get(ClientResponse.class);
    Builder builder = resource.type("application/x-www-form-urlencoded");


    // for POST
    ClientResponse response = resource.queryParams(formData).post(ClientResponse.class, formData);
    //ClientResponse response = resource.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);

    String en = response.getEntity(String.class);
    System.out.println(en);
    System.out.println("oks");
    }
    }

    Disqus for yogi's talk

    comments powered by Disqus