Sharing VirtualBox folders

You have Ubuntu running in Windows and you want to share a windows folder with Ubuntu. Do the following:

Make sure you have installed the Guest Additions

Configure the shared folder in my VirtualBox. Click menu option "Devices->Shared Folders" to configure the sharing

This has gotten much easier now, VirtualBox will just mount the folder; however, you need to make sure your user is part of the vboxsf group; otherwise, you will need to be root in order to copy or access the files, use the following command:

sudo usermod -G vboxsf -a jboss1

Older Instructions

Open terminal and created a directory called share under "mnt" so it looks as “/mnt/share”. This required "admin" privileges, and then run the following command.

sudo mount -t vboxsf sharename /mnt/share

There is a bug with VirtualBox 4.3.10 and mounting, the following commands will fix, after you mount the Guest Additions

$ cd /sbin
$ sudo rm mount.vboxsf
$ ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions/mount.vboxsfsudo usermod -G vboxsf -a jboss1

On Mar 26, 2014, at 10:17 AM, Bachtel, Michael wrote:

Hi all,

Some of us have had issues with Apache not serving some deployed files.

In short the issue is one with the OS's file context and was fixed by running
$ sudo restorecon -r /opt/<APP_DIR>

Longer version sourced from https://www.centos.org/forums/viewtopic.php?t=6834

"The issue is caused when you mv something from one place to another. It preserves the selinux context of the original when you move it, so if you untar something in /home or /tmp it gets given an selinux context that matches its location. Now you mv that to /var/www/html and it takes the context saying it belongs in /tmp or /home with it and httpd is not allowed by policy to access those files.

If you cp the files instead of mv them, the selinux context gets assigned according to the location you're copying to, not where it's coming from. Running restorecon puts the context back to its default and fixes it too."

~Mike

AngularJS – Dependency injection in services, factories, filters etc

Samples

app.filter('<filter>', ['$http', function(http){
    return function(data){
    }
}]);

Directive:

app.directive('<directive>', ['$http', function(http){
    return {
        ....
    }
}]);

Service:

app.factory('<service>', ['$http', function(http) {
  var shinyNewServiceInstance;
  return shinyNewServiceInstance;
}]);

Mounting SSH Connection on Ubuntu

You need to install SSHFS, can happend in "Software Center"

To mount:
mkdir ~/haldevjbs13
sshfs -o idmap=user jboss1@haldevjbs13.hq.halw.com:/ ~/haldevjbs13
sshfs -o idmap=user $USER@haldevjbs13.hq.halw.com:/remote-folder-to-mount/ ~/haldevjbs13

To unmount:
fusermount -u ~/haldevjbs13

Getting Eclipse to work with Oracle Java 1.7

Refer: http://stackoverflow.com/questions/10165693/eclipse-cannot-load-swt-libraries

On my Ubuntu 12.04 32 bit. I edit the command to:
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/

And on Ubuntu 12.04 64 bit try:
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

Not really what I wanted as a solution but important to note:

Because I had installed the Oracle Java 7 it had changed the default Java to Oracle Java 7, however it needed to be the Open JDK.

To fix, open up terminal and type

sudo update-alternatives --config java
This brings up a list of the different types of Java. Simply select the Open JDK.

 

Ubuntu Cleanup Steps

First thing first there is a few commands that can clean up your disc. I will explain them as we go. First command is the package autoclean. What autoclean does is remove partial packages from the system. To use autoclean type the following command in a terminal:

$ sudo apt-get autoclean

Then enact the package clean command. What this commnad does is to clean remove .deb packages that apt caches when you install/update programs. To use the clean command type the following in a terminal window:

$ sudo apt-get clean

You can then use the autoremove command. What the autoremove command does is to remove packages installed as dependencies after the original package is removed from the system. To use autoremove tye the following in a terminal window:

$ sudo apt-get autoremove