27 August 2013

502. Spell checking in WPS office on linux -- changing language by replacing the default files

To my great shame I am using a piece of non-FOSS to deal with MS Office files -- namely, WPS. As a junior faculty member it'd be professional suicide to try to force other people to deal with the mis-rendered libreoffice files in MS Office, and for some reason no-one uses PDF anymore when sending out forms...

Anyway, in spite of not being open source and not supporting any open formats, WPS can read and save .doc and .docx files in a way that works together with MS Office, and since it runs natively on linux it's a practical solution until the day libre/openoffice become viable alternatives.

There doesn't seem to be any simple way of changing language beyond replacing the default dictionary files. It ain't pretty, but it works.

In my case I wanted Australian English, so I first installed the myspell dictionary:
sudo apt-get install myspell-en-au
mkdir ~/.dictionaries
sudo mv /opt/kingsoft/wps-office/office6/dicts/main.aff /opt/kingsoft/wps-office/office6/dicts/en_us.aff
sudo mv /opt/kingsoft/wps-office/office6/dicts/main.dic /opt/kingsoft/wps-office/office6/dicts/en_us.dic
sudo cp /usr/share/hunspell/en_AU.dic /opt/kingsoft/wps-office/office6/dicts/main.dic
sudo cp /usr/share/hunspell/en_AU.aff /opt/kingsoft/wps-office/office6/dicts/main.aff

Start WPS and it should now speak 'Strine.

24 August 2013

501. Briefly: Adding a new node to SGE

I've done this a couple of times by now, and I always forget one step or another. Most of the information is on http://verahill.blogspot.com.au/2012/06/setting-up-sun-grid-engine-with-three.html but here it is in a briefer form:

In the example I've used krypton as the node name, and 192.168.1.180 as the IP.
My front node is called beryllium and has an IP of 192.168.1.1.

0. On the front node
Add the new node name to the front node/queue master

Add execution host
qconf -ae 

which opens a text file in vim

Edited hostname (krypton) but nothing else. Saving returns
added host krypton to exec host list
Add krypton as a submit host
qconf -as krypton
krypton added to submit host list
Doing this before touching the node makes life a little bit easier.

1. Edit /etc/hosts on the node
Leave
127.0.0.1 localhost
but remove
127.0.1.1 krypton
and make sure that it says
192.168.1.180 krypton
instead.

Throw in
192.168.1.1 beryllium
as well.

2. Install SGE on node
sudo apt-get install gridengine-exec gridengine-client

You'll be asked about
Configure automatically: yes Cell name: rupert Master hostname: beryllium
3. Add node to queue and group
I maintain separate queues and groups depending on how many cores each node has. See e.g. http://verahill.blogspot.com.au/2012/06/setting-up-sun-grid-engine-with-three.html for how to create queues and groups.

If they already exits, just do

qconf -aattr hostgroup hostlist krypton @fourcores
qconf -aattr queue slots "[krypton=4]" fourcores.q

to add the new node.

4. Add pe to queue if necessary
Since I have different queues depending on the number of cores of a node, I tend to have to fiddle with this.

See e.g. http://verahill.blogspot.com.au/2012/06/setting-up-sun-grid-engine-with-three.html for how to create pe:s.

If the pe you need is already created, you can do
qconf -mq fourcores.q

and edit pe_list

5. Check
On the front node, do
qhost
HOSTNAME ARCH NCPU LOAD MEMTOT MEMUSE SWAPTO SWAPUS ------------------------------------------------------------------------------- global - - - - - - - beryllium lx26-amd64 3 0.16 7.8G 5.3G 14.9G 398.2M boron lx26-amd64 6 6.02 7.6G 1.6G 14.9G 0.0 helium lx26-amd64 2 - 2.0G - 1.9G - lithium lx26-amd64 3 - 3.9G - 0.0 - neon lx26-amd64 8 8.01 31.4G 1.3G 59.6G 0.0 krypton lx26-amd64 4 4.01 15.6G 2.8G 14.9G 0.0

23 August 2013

500. Changing language in Debian (GNOME 3, terminal) to e.g. fr_CH

This is both obvious, and tricky at the same time.

1. Install locales
The first step is to install the languages you need
sudo apt-get install locales
sudo dpkg-reconfigure locales

2. Optional: language packs
If you want e.g. libreoffice to use the new language, you'll need to install the corresponding language pack. Most programmes will NOT need this, but libreoffice and iceweasel do. The same goes for KDE.
sudo apt-get install libreoffice-l10n-fr iceweasel-l10n-fr icedove-l10n-fr

Basically, search for packages with l10n in their names.

3. GNOME
Select the new language in GNOME 3 by gong to Region and Language:
Now, here's the trick: even if the language you want is listed, click on the "+" sign in the bottom left corner, and select it like this:
While you now have two 'French' items, this is necessary or the language will not be correctly set. If you do NOT do this some things will change language, some won't (e.g. Activities won't change to Activités). In that case, if you log out, then back in and go to Languages you'll find that the language is set to "Unspecified [ANSI_X3.4-1968]". See the screenshot at the very  bottom of this post for an example of what it looks like.


Log out of GNOME and log back in again. Et voilà.
And...we have French! French everywhere.


4. Optional: set it in terminal
If you set the language in GNOME as shown above you shouldn't need to do this. However, if you are not using GNOME 3 you may want to set the language explicitly in your terminal by sticking the following in your ~/.profile or ~/.bashrc
export LANG="fr_CH.utf8"

When it's NOT OK:
Note how it says 'Pays et Langue' but still says 'Activities' i.e. the language for some items has been changed, but not all.
See step 3 for an explanation of what's going on.