Tuesday, 21 March 2017

Cron job to run a jar file


If the requirement is to run the jar file on daily basis, we need to create a cron job.
To create a cron job, follow below steps:


  • Open terminal.
  • Type crontab -e ,It will open an editor to edit cron job.
  • If you want to run your jar on daily basis , put 0 0 * * * java -jar Sample.jar
  • For ex: 0 0 * * * java -Dlog4j.debug -DlogDir=./ -jar /opt/appl/giftcard/valuelinkSimulator/valuelink-simulator.jar.
  • Save the cron job.
We can also view the job using crontab -l command.

Enjoy Learning.

How to indent XML files automatically when opened in Sublime Text 2


To indent and beautify XML, Use SublimeText Indent plugin:sublimetext_indentxml.

  • Download the Package and Extract to Sublime Installation directory,inside package folder.For ex:C:\softwares\Sublime Text 2.0.2 x64\Data\Packages.
  • Open any XML file or create a new file and paste any XML into it.
  • Press Ctrl-K, F to indent it.

Enjoy Learning.

Monday, 20 March 2017

MySQL Workbench Connection over SSH

Setting up MySQL Client

  • Install MySQL Workbench
  • To start MySQL in Local machine, Go To Start-> All Programs->MySQL->MySQL Workbench
  • OR
  • You can search in “Start” as MySQL Workbench in your Machine e.g Click OS Start button-> write MySQL Workbench
  • After MySQL started in your local machine you can see below page.
                     

  • Click on “+” button side to MySQL Connections as shown in below image
                   

  • It will open a new pop up page name “ Setup New Connection ” as shown in below image.
                   
  • Click on Connection Method dropdown, Choose “Standard TCP/IP over SSH” as shown below
                   


  • After selecting “Standard TCP/IP over SSH” you will see the below page.

                     


  • Note : If all options are not visible you can expand the small pop up page
  • Put these details in the new Pop up page ( Setup New Connection )
  • Connection Name : SampleConnection
  • SSH Hostname : servername.com
  • SSH Username : Your user name
  • Password : Your password
  • Password always needs to store in vault ( MySQL Secure place )
  • Follow same “Store in Vault …” Procedure as described above
  • Put password in the Password field
  • Press OK
  • MySQL Hostname : db servername.com
  • Username :db user name
  • Password :db password
  • Password always needs to store in vault ( MySQL Secure place )
  • Follow same “Store in Vault …” Procedure as described above
  • Default Schema : schema name(optional)
  • Press “Test Connection” You will see a connection success message.
  • Press "OK" Button
  • After Pressing "Ok" Button, SampleConnection will be visible in below MySQL Connection Area

Enjoy Reading.


Adding Wildfly Server Plugin in Eclipse Luna


When we try to add a Wildfly 8 server in Eclipse Luna,By default it does not show Wildfly Servers.
In order to add Wildlfy Server, Please follow below Steps:

  • Go to Help–>Eclipse Market Place 

  • Search for Jboss Tools.

  • Find JBoss Tools(Luna) 4.2.3.Final and select only JbossAs tools and Jboss Webservice tools.

  • Click Next, agree to the license terms, install, restart Eclipse.

  • After Eclipse restarts:

  • Go to your Servers view and right-click.

  • Select "WildFly 8.x", click Next.

  • Set the Home Directory appropriately.

  • Click Finish.

  • Enjoy Reading. 

    Creating a self-signed certificate on Windows 7


    Using the Internet Information Services(IIS)

    By default, IIS 7.5 is not installed on Windows® 7 Professional, Enterprise, or Windows® 7 Ultimate. You can install IIS by clicking Windows Features in Advanced Options under Programs in Control Panel.

    Installing IIS using UI

    1. Click Start and then click Control Panel.
    2. In Control Panel, click Programs and then click Turn Windows features on or off.
    3. In the Windows Features dialog box, click Internet Information Services and then click OK.


    Creating Self signed Certificate

    4. Click Start, and in the Start Search box, type inetmgr and press ENTER.
    5. Click the computer name (top of the tree on top-left).
    6. Double click 'server certificates' from center pane.
    7. Click on the option of 'create self-signed certificate' from the right pane.
    8. Give some name for the certificate and click Ok.

    Exporting the certificate to save locally

    9. In the IIS console under Server Certificates, you would be able to see the certificate you created just now.
    10. Double-click on the certificate that you created which will open up the certificate in separate window.
    11. Go to the details tab and click Copy to File.. which will open a Certificate export Wizard in separate window.
    12. Click Next.
    13. Select "No,do not export the private key" and click Next again.
    14. Select DER encoded binary x.509(.CER) and click Next.
    15. Give the name(eg: LocalSSLCertificate) and path where you want to save this certificate locally and click Next.
    16. Click Finish.
    17. Repeat steps 9-16 with step 13 as Select "Yes, export the private key" and step 14 as Select Personal Information Exchange -PKCS #12(.pfx)
    18. For exporting the the certificate as pfx, you will be prompted to enter and re-enter password. Remember the password which will be used later (eg:changeit)

    Creating the keystore file

    Very important do not miss this step --> Navigate to the bin folder of your respective JRE/JDK (i.e. C:\Program Files\Java\jdk1.6.0_37\bin for Windows 7).  Failure to follow this step will yield the following error: keytool' is not recognized as an internal or external command, operable program or batch file' when attempting to run the below command requiring the keytool.exe file to be present.

    Next Go to Start->All Programs->Accessories
    Right click on Command Prompt and select Run as administrator

    Run the following commands.

    keytool -import -keystore jboss.jks -file D:localSSLcertificate.cer
    Enter keystore  password: changeit
    Re-enter  new password: changeit
    Trust this certificate? [no]:  y
    Certificate was added to keystore

    keytool -importkeystore -keystore jboss.jks -srckeystore D:localSSLcertificate.pfx -srcstoretype PKCS12
    Enter destination keystore password: changeit
    Enter source keystore password: changeit

    You will need to put the jboss.jks file in a place where all your current and future JBoss 7 installations can use it, as follows:

    1. In your Projects directory, create the directory Jboss
    2. Create the directory certs in the jboss directory you created above
    3. copy the file jboss.jks  to the jboss/certs directory you created above.
    Enjoy Reading.

    GitLab Code Chekout,Checkin and Merge Request

    This summary is not available. Please click here to view the post.

    How to Check if MySQL Instance is read only


    In order to find out if your DB server in read mode or read/write mode.

    Follow the below Steps:

    • Login into your DB Server using MySQL Tools,Mysqlem etc.
    • Run below queries:
      • SELECT @@global.read_only;
      • If the Output is 1, it means DB server is read only.
      • else if Output is 0, it means DB server is both read/write.




    Enjoy Reading.