Pages

Tuesday, March 25, 2014

Kill a process on a port in ubuntu


sudo kill `sudo lsof -t -i:8080`

If the above does not work, try

sudo kill $(sudo lsof -t -i:8080)

Monday, March 24, 2014

Install tomcat 7 manually in ubuntu and integrate with eclipse

  1. Download Tomcat 7 tar.gz
  2. Run the following commands
  3. 
    cd /path/to/downloaded/file
    tar xvzf apache-tomcat-7.0.52.tar.gz
    sudo mv apache-tomcat-7.0.52/ /usr/share/tomcat7
    sudo gedit /usr/share/tomcat7/bin/catalina.sh
    
  4. Add following two lines after the first line and close gedit after saving the changes
  5. 
    JAVA_HOME="/usr/lib/jvm/java-6-openjdk-i386"
    JRE_HOME="/usr/lib/jvm/java-6-openjdk-i386/jre"
    
  6. To integrate with eclipse
  7. 
    cd /usr/share/tomcat7
    sudo ln -s /var/lib/tomcat7/conf conf
    sudo ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
    sudo ln -s /var/log/tomcat7 log
    sudo chmod -R 777 /usr/share/tomcat7/conf
    
  8. Start the Tomcat server using following command to check if it is working
  9. 
    sudo /usr/share/tomcat7/bin/catalina.sh run
    
  10. Stop the server by pressing ctrl+c
  11. To change the port number, open server.xml in gedit
  12. 
    sudo gedit /usr/share/tomcat7/conf/server.xml
    
  13. Change all the occurrences of <connector port="8080"> to <connector port="8081">
  14. Verify installation at: http://localhost:8081/

Sunday, March 23, 2014

Configure tomcat 6 for eclipse in ubuntu

  1. Install tomcat 6 in ubuntu by running the below commands
  2. 
    sudo apt-get update
    sudo apt-get install tomcat6
    sudo service tomcat6 stop
    cd /usr/share/tomcat6
    sudo ln -s /var/lib/tomcat6/conf conf
    sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
    sudo ln -s /var/log/tomcat6 log
    sudo chmod -R 777 /usr/share/tomcat6/conf
    
    
  3. In the eclipse main menu go to Help ->Install New Software...
  4. Make the settings as below by selecting the highlighted plugins under Web, XML, Java EE and OSGi Enterprise Development select option
  5. Select Windows -> Preferences -> Server -> Runtime Environments
  6. Click on Add…
  7. Select "Apache Tomcat v6.0" and click on Next
  8. Enter “/usr/share/tomcat6″ into the “Tomcat installation directory” field
  9. Click Ok
  10. Now Right click on your project and Run As -> Run on Server

Create dynamic web project in eclipse for ubuntu platform

  1. Install eclipse from Ubuntu Software Center
  2. Open eclipse and select the required workspace
  3. In the main menu go to Help->Install New Software...
  4. Make the settings as below by selecting the highlighted plugins under Web, XML, Java EE and OSGi Enterprise Development select option
  5. Make sure to select 'All Available Sites' in the dropdown
  6. Now on click of File->New->Project.. a select wizard shows up
  7. Scroll down to find Web option. Click on the arrow to find 'Dynamic Web Project' option. Click on it to create a new Dynamic Web Project

Wifi not working in ubuntu

  1. Connect to a wired internet connection to first install the additional drivers.
  2. Check if all the hardware drivers are installed. Go to System Settings -> Additional Drivers (Under Hardware Group). It will automatically check for missing drivers and ask to activate.
  3. If the above method does not work, go to Ubuntu Software Center and type 'additional drivers' in the search box. There will be results like Additional Drivers (jockey-kde) and Additional Drivers (jockey-gtk). Make sure both are installed.
  4. Go to Network Connections either from Dash Home or by clicking the network icon at the top right menu of the desktop.
  5. Under Wireless tab click on 'Edit...' if the connection details has already been added else click on 'Add'.
  6. Under Wireless tab enter SSID as given by your internet provider. Leave all the other settings as is. Make sure 'Connect automatically' is checked.
  7. Then under Wireless Security tab, select WEP for Security dropdown and enter the key as given by your internet provider. Leave all the other settings as is.
  8. After the changes click on Save.
  9. Wifi connections must now be detected automatically.

Thursday, March 6, 2014

Resize an existing virtualbox hard drive in guest windows xp using host windows 7


  1. Create a new hard disk 
    1. Click on Settings in virtualbox 
    2. Select Storage tab 
    3. Click on Add Hard Disk icon
    4. Set a sufficient amount of dynamically expanding disk space
  2. Clone your old hard disk
    1. Check the location of VBoxManage and your old hard disk .vdi file [ex: in my computer i have VBoxManage at G: and old_hard_disk.vdi at C:\Users\acer\VirtualBox VMs\old_hard_disk_dir\old_hard_disk.vdi]
    2. Open up cmd in windows 7, go to the location of VBoxManage and type as below:
    3. 
      C:\Users\acer>G:
      G:\>VBoxManage clonehd "C:\Users\acer\VirtualBox VMs\old_hard_disk_dir\old_hard_disk.vdi" "C:\Users\acer\VirtualBox VMs\old_hard_disk_dir\new_hard_disk.vdi" --existing
      
    4. You see something like this:
    5. 
      Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
      (C) 2005-2010 Oracle Corporation All rights reserved.
      0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
      Clone hard disk created in format 'VDI'. UUID: ee28ab8b-8232-4c76-8c1b-184afdd1dd27
      
  3. Replace the old guest hard disk with your new hard disk (i.e. new_hard_disk.vdi)
    1. Go to the settings for the guest VM and choose the “Storage” options
    2. Select the new disk created and make it IDE Primary Slave under the Attributes column
    3. Select the old disk and remove it by clicking on - icon at the bottom
  4. Start the guest os i.e windows xp
  5. Resize the Guest File System
    1. Install partition manager tool in windows xp
    2. Select the newly created drive. Right click on it and select Resize Partition
    3. Follow on screen instructions to finish the partitioning
  6. Restart the guest os if required

Tuesday, March 4, 2014

Eclipse menus are cut off in ubuntu 13.10


  1. Open your eclipse.desktop file
  2. 
    sudo -H gedit /usr/share/applications/eclipse.desktop
    
    
  3. Replace the Exec= line with this
  4. 
    Exec=env UBUNTU_MENUPROXY= eclipse
    
    

    (If you can't find it in this path, try in ~/.local/share/applications/eclipse.desktop. Otherwise, you could have to find yours using locate command).

    NOTE: If you can't find your eclipse.desktop file, you can simply create one from scratch in the above path, and fill it with these lines:

    
    [Desktop Entry] 
    Type=Application 
    Name=Eclipse 
    Icon=eclipse 
    Exec=env UBUNTU_MENUPROXY= eclipse 
    Terminal=false 
    Categories=Development;IDE;Java;
    
    
  5. Save the file