Today I'm searching for a way to mount a remote directory on my local machine, such that it acts like a local machine. The sole reason is to run the remotely compiled code locally.
I've found a nice article on it and would like to blog it here.
Here we go:
  • Install SSHFS:
sudo apt-get install sshfs
  • Add root to the fuse group: 
sudo adduser root fuse 
  • Create the local backup director

mkdir backup
  • Then mount the remote /home directory to backup:
sshfs -o idmap=user <username>@<remote system's ip>:/home backup
  • Let's check if the remote directory got mounted to /backup:
mount
df -h
  • To unmount the directory
fusermount -u backup
Check the backup folder to see your remote directory...

Source: howtoforge
java
Sometimes we would like to save the output from console into a file and to do this we use some stream writer/reader to read from console and write to a file.

But this can be done in much easier way as follows. Add the following code at the beginning of the program:
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(out);
Now the default behaviour of out is changed to PrintStream out, and the output is redirected to the file provided above.

Edit:
To reset the standard behaviour, add the following code
System.setOut(stdout);

Popular Labels

Featured Post (TOP)

Flickr Images

Follow Me on Facebook.com

Follow on Google+

Recent Posts

AD (728x60)

Pages

Powered by Blogger.

Labels

Followers

Popular Posts

Popular Posts

Subscribe Via Email

Sign up for our newsletter, and well send you news and tutorials on web design, coding, business, and more! You'll also receive these great gifts: