To counteract my relative lack of skill with java, I use the smartest IDE I can find; Intellij IDEA. It is really helpful in getting syntax right (and lots of other things, too). Unfortunately, the CS labs do not have it installed, and at 170 MB, I can’t spare enough space to put it on my account.
To solve this problem, I have tried the following solutions:
- VNC using X11VNC
- X forwarding using ssh -X (with and without -C)
Unfortunately, although my ping time is 6 ms, both VNC and X forwarding are terribly slow. NX has some issues with my ssh configuration, and I have been unable to get it to work properly.
Today I built a little script to solve the lack of this excellent editor. Here is the first iteration:
scp -r username@bart:/tmp/idea-7590 /tmp
if [ -f /tmp/idea-7590/bin/idea.sh ]; then
scp -r email@example.com:/home/username/idea-7590 /tmp/
scp -r /tmp/idea-7590 username@bart:/tmp/ &
The script uses the /tmp folder to indefinitely store data. This data is not held against my account limit. Of course, it may be reset at any time, but that isn’t a really big issue, as 1st, it may be re-downloaded at any time, and 2nd, /tmp is normally cleaned at reboot. Most of the time, lab machines run at least a month between reboots.
First, the script attempts to get the desired files from bart, which I am using as a site cache. If they do not exist, I grab the data from my own box, then simultaneously copy it to the cache-box, and startup Intellij. If intellij is already local, then it starts up immediately. If intellij is on the site cache, it takes about 15 seconds to copy over the network. If intellij is on my personal server, it takes a full minute and a half to do the copy.
All in all, it is pretty decent. However, can it be improved? Definitely. I improved it in 2 ways; by allowing any user to use the script, and increasing the speed. Let’s grab the original tgz from Intellij’s website. Here is the result:
scp -r username@bart:/tmp/idea-7.0.2.tar.gz /tmp
if [ -f /tmp/idea-7.0.2.tar.gz ]; then
tar -xzf idea-7.0.2.tar.gz
tar -xzf idea-7.0.2.tar.gz
scp -r /tmp/idea-7.0.2.tar.gz username@bart:/tmp/ &
Now whoever runs the script doesn’t need to be me or have an ssh server running on their own box! I should note that the tgz takes about 7 seconds to transfer over the local network, or 30 seconds to 5 minutes to grab it from Intellij’s servers. Although the worst case is pretty bad, it should happen with some infrequency.
A further generalized and improved solution follows:
if [ ! -f $RUN_CMD ]; then
scp $CACHE$COMPRESSED_FILE /tmp
if [ -f /tmp/
scp /tmp/$COMPRESSED_FILE $CACHE &