2009/11/30

XMind as eclipse plugin

About XMind

Have you tried XMind? It is very nice, open source mind mapping tool. If you have not tried mind mapping at all, maybe it is a good time to start as it helps a lot to visualize any conceptualization and then conceptualize some complex matters even better.

XMind is built on top of Eclipse RCP and so far has been distributed also as eclipse plugin. However now this option is no longer supported. As I spend a lot of time in eclipse it is much more convenient to me, to have mind maps and code in the same tool.

Installation

I found the solution. Here is the script install-as-eclipse-plugin.sh:

#/bin/bash -e

if [ ! $2 ]; then
 echo "Usage ./install-as-eclipse-plugin.sh xmind_path eclipse_path"
 exit 1
fi

XMIND_PATH="$1"
ECLIPSE_PATH="$2"

if [ ! -d $XMIND_PATH/plugins ]; then
 echo "Error - no /plugins directory in $XMIND_PATH - probably not XMind directory"
 exit 2
fi

if [ ! -d $ECLIPSE_PATH/plugins ]; then
 echo "Error - no /plugins directory in $ECLIPSE_PATH - probably not eclipse directory"
 exit 3
fi

echo "Copying XMind plugins from $XMIND_PATH to eclipse at $ECLIPSE_PATH"

# remove old xmind plugins (if they exist)
rm -fr $ECLIPSE_PATH/dropins/xmind
mkdir -p $ECLIPSE_PATH/dropins/xmind/plugins

# exclude language variants, and os specific stuff
PLUGINS=`ls $XMIND_PATH/plugins | grep -v nl_ | grep -v linux | grep -v win32 | grep -v macos`
for PLUGIN in $PLUGINS; do
 PLUGIN_NAME=`echo $PLUGIN | cut -d "_" -f 1`
 FOUND=`find "${ECLIPSE_PATH}/plugins" -name "${PLUGIN_NAME}_*"`
 if [ "$FOUND" == "" ]; then
  echo "Copying: $PLUGIN"
  cp -r $XMIND_PATH/plugins/$PLUGIN $ECLIPSE_PATH/dropins/xmind/plugins
 else
  echo "Plugin already installed: $PLUGIN_NAME"
 fi
done

This script will compare XMind plugins with plugins already available on eclipse installation and copy only these missing. It will also exclude all localization resources (I don't need them) and macosx stuff. Adjust these lines according to your needs.

All the plugins will be copied to dropins/xmind directory - it will ease the upgrade, if you want to remove xmind functionality from eclipse just remove this directory.

The only problem I have encountered so far is that on fresh eclipse installation, when new node is added to the map, there is exception from spell checker. Opening and closing xmind spell checking preferences in eclipse fixes this.

Update: I updated the script not to copy specific plugins, even if their version do not match. All the platform dependent stuff is excluded by default. The solution is tested with eclipse helios (3.6) and XMind 3.2.0.

How to use XMind in eclipse

Thanks to some comments I realized it could be not obvious how to use XMind inside eclipse. If you already have XMind file in one of your eclpse projects you can just click on it and it should open inside eclipse. Apparently you can also use File > Open File... from pull down menu to open any .xmind file. However you will not see all the Markers and Overview windows unless you open so called Mind Mapping perspective. You have only one default perspective in XMind, but several perspectives in default eclipse installation. Use Windows > Open Perspective > Other... > Mind Mapping from the pull down menu. You can also open separate windows specific to this perspective - just use Window > Show View. In order to create new XMind file, just open File > New File > Other... > Mind Mapping > Mind Map Workbook

2009/11/19

wondershaper is a real wonder

Have you ever experienced "slow internet" when there is another ongoing transfer on your wire which fully saturates the bandwidth. Even if one can accept high latency of HTTP transfers (sooner or later the page will appear in the browser), in case of interactive sessions like SSH it is completely unacceptable. Wondershaper is a great remedy with minimal side effects - especially if your are running your router on Linux machine.

Wondershaper is using CBQ instead of HTB and I am aware that there are better approaches to traffic shaping in Linux. But "traffic shaping" is usually associated with the context of splitting the bandwidth of single internet link among many hosts. This is too much in my case and wondershaper does exactly what I expect.

My ADSL line is 1024/256kb officially. But in logs I can see different values:

ATM dev 0: ADSL line is up (1312 kb/s down | 320 kb/s up)

At first I tried to provide these values to wondershaper, however they were too high (high latency still and packet drops in addition). By using different values I finally established that official numbers give the best trade-off between latency and link speed.

In case of my link the average download rate is around 126KB/s. Now with wondershaper it is around 120KB/s - about 95% of the original speed - this the cost. However SSH sessions work like a charm when updates are being downloaded and the browser loads pages almost as fast as usually.

Now specific section of my /etc/network/interfaces (Debian specific) looks like:

auto ppp0
iface ppp0 inet ppp
    pre-up /usr/local/sbin/firewall.sh start
    pre-up while ! grep 'Line up' /proc/net/atm/speedtch:0 &>/dev/null; do sleep 1; done
    post-up echo "1" >/proc/sys/net/ipv4/ip_forward
    post-up wondershaper ppp0 1024 250
    pre-down wondershaper clean ppp0
    pre-down echo "0" >/proc/sys/net/ipv4/ip_forward
    post-down /usr/local/sbin/firewall.sh stop

Update

With the 1024 256 values I still had some latency where my uplink was fully saturated. The 1024 250 values seems to work OK.

2009/11/07

smartd.conf: the ultimate settings

By "ultimate settings" I mean options which suit my needs best ;) . I had problems finding comprehensive example of smartd.conf options. Here is what I finally came to:

/dev/sda         \ # The device to monitor
 -a              \ # Implies all standard testing and reporting.
 -n standby,10,q \ # Don't spin up disk if it is currently spun down
                 \ #   unless it is 10th attempt in a row. 
                 \ #   Don't report unsuccessful attempts anyway.
 -o on           \ # Automatic offline tests (usually every 4 hours).
 -S on           \ # Attribute autosave (I don't really understand
                 \ #   what it is for. If you can explain it to me
                 \ #   please drop me a line.
 -R 194          \ # Show real temperature in the logs.
 -R 231          \ # The same as above.
 -I 194          \ # Ignore temperature attribute changes
 -W 3,50,50      \ # Notify if the temperature changes 3 degrees
                 \ #   comparing to the last check or if
                 \ #   the temperature exceeds 50 degrees.
 -s (S/../.././02|L/../../1/22) \ # short test: every day between 2-3am
                                \ # long test every Monday between 10pm-2am
                                \ # (Long test takes a lot of time
                                \ # and it should be finished before
                                \ # daily short test starts.
                                \ # At 3am every day this disk will be
                                \ # utilized heavily as a backup storage)
 -m root         \ # To whom we should send mails.
 -M exec /usr/share/smartmontools/smartd-runner # standard debian script

2009/11/05

dropbear: scp does not work, here is poor man's replacement

The dropbear project provides very interesting implementation of SSH server. It has advantage of very low memory footprint, which might be crucial in case of embedded devices. Personally I use dropbear on NSLU2 device (aka SLUG).

I was a little bit disappointed when I tried scp command against dropbear server (on debian host):

$ scp .ssh/id_rsa.pub root@slug:authorized_keys
bash: scp: command not found
lost connection

Another try:

sftp root@slug
Connecting to slug...
bash: /usr/lib/sftp-server: No such file or directory
Connection closed

Dropbear comes without scp and sftp-server commands. On debian you can find them in openssh-server package. Installing it would bring a lot of unwanted dependencies not even mentioning that I would have to make sure that OpenSSH server is not going to start and compete with my little dropbear. Here is simple scp-like solution.

cat .ssh/id_rsa.pub | ssh root@slug 'tee authorized_keys >/dev/null'

I hope it will help someone.