Wednesday, September 19, 2012

SSL for tomcat 7

Let's configure ssl for tomcat 7.0.29 and ubuntu

remember to delete any old ~/.keystore file u have generated before, because this could cause an issue.

> keytool -genkey -alias tomcat -keyalg RSA -validity 365

Enter keystore password:  "changeit"
Re-enter new password: "changeit"
What is your first and last name?
  [Unknown]:  $REPLACE_WITH_FULL_MACHINE_NAME
What is the name of your organizational unit?
  [Unknown]:  Test
What is the name of your organization?
  [Unknown]:  Test
What is the name of your City or Locality?
  [Unknown]:  Test
What is the name of your State or Province?
  [Unknown]:  Test
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=$FULL_MACHINE_NAME, OU=Test, O=Test, L=Test, ST=Test, C=US correct?
  [no]:  yes
asdf

and uncomment the section with ssl connection from server.xml and restart your tomcat you're good to go.

Monday, July 2, 2012

Stop ubuntu ask password on shutdown


 sudo gedit /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy 

edit this section


    Stop the system when multiple users are logged in
    System policy prevents stopping the system when other users are logged in
   
      no
      auth_admin_keep
   
 

to:



    Stop the system when multiple users are logged in
    System policy prevents stopping the system when other users are logged in
   
      no
      auth_admin_keep
   
 


also check restart


 
    Restart the system when multiple users are logged in
    System policy prevents restarting the system when other users are logged in
   
      no
      yes
   
 

Monday, June 18, 2012

To generate UUID in javascript


function S4() {
  return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function generateGUID() {
  return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}

Tuesday, May 29, 2012

How to find drivers for Unknown Devices


Usually, when you buy any hardware the drivers come along with it on a disc. If you lose the driver disc you can always download the necessary drivers from the manufacturer's website. But what do you do when you are not sure of the manufacturer of the hardware? This is quite a possible situation and blogger Vinod Chandramouliprovides an excellent trick to deal with it.
Every device has a Vendor and Device id associated with it. If you can find this ID, you can find the manufacturer. In Windows it's easy to find the vendor and device id.
  1. Open Device Manager (Control Panel>System>Hardware>Device Manager)
  2. The hardware whose drivers are missing will appear as Unknown device, so it's easier to locate the device.
  3. Right click on the unknown device and click on Properties.
  4. Under the Properties window click on Details tab and select Device Instance Id from the drop down box.
  5. You should see a code similar to this

    PCI\VEN_8086&DEV_27DC&SUBSYS_30868086
    &REV_01\4&1E46F438&0&40F0

  6. The portion of the code highlighted in RED is the Vendor ID and the portion highlighted in GREEN is the Device ID. In this example:

    Vendor ID = 8086
    Device ID = 27DC 

  7. Once you have obtained both the IDs, proceed to PCI Database. There you can either search for the vendor from the vendor ID or directly get information about the device along with the vendor name by searching with the device ID.
Great isn't it? Now you will never have to go hunting for correct drivers.

Tuesday, March 27, 2012

Creating start up service in Ubuntu

I was trying to add startup script for my tomcat service, so wrote the following commands and it pretty much solved it.


update-rc.d FOO defaults
mv catalina-dmd /etc/init.d/
chmod +x /etc/init.d/catalina-dmd