2012-12-19

Multilingual-/Foreign character support

Over the course of time I got annoyed by how long it takes to properly install non-latin language support for a browser, so here's a (hopefully quick) way to get it working.
Note: For the changes to take effect, I had to restart my browser. I'm using Chrome 23 on Debian with XFCE.
According to Wikipedia's "Multilingual support (East Asian)", you need to install these packages for Simplified and Traditional Chinese, Japanese, Korean and Vietnamese.
sudo apt-get install ttf-arphic-uming ttf-wqy-zenhei ttf-sazanami-mincho ttf-sazanami-gothic ttf-unfonts-core
That worked perfectly for me, let's move on to Multilingual support (Indic). On my installation I was missing support for Kannada, Telugu, Tibetan, Khmer and Burmese.
sudo apt-get install ttf-kannada-fonts ttf-telugu-fonts fonts-tibetan-machine fonts-khmeros fonts-sil-padauk
You can also install a package called fonts-indic, which supposedly includes support for all Indic languages. I did not try that and don't know if it really includes everything. 
In the "Multilingual support" article you can also find a language or typeset called Deseret, which I didn't find a package for. I will leave it uninstalled for now.

2012-12-12

Detached Screens

If you want to start something automatically, you can use these commands either after logging in (user startup) or without logging in (system startup). But what if you want to run something from init.d/, you're going to have to exec it as a specific user. See my previous post on NCDC to see why anyone would ever need that. First off, I had to find out how I'd start a detached screen and execute a command. That was pretty easy:
screen -dmS screenname command
But since I wanted to create an init.d/ script, I had to change the user with su first - or even better, just execute a command as the user. This executes a screen as user username, which executes command in it. CMDEXECCEPTION OMG.
su -c screen -dmS screenname command username
Have fun! :)

Add Printer dialogue freeze

I had a really annoying problem on my laptop: When I wanted to add a printer, the window would freeze at some point and just not respond. I found the solution in a Debian bug report: you have to add the user to the lpadmin group.
sudo usermod -aG lpadmin username
After that, adding new printers immediately worked and was a matter of a few seconds.

Direct Connect with NCDC

A proper DC++ / ADC compatible implementation was one of the more important reasons I got my server. In a graphical environment I use EiskaltDC++ as a client, so I had no experience with text-based DC clients. Today, I finally had time to set up NCurses Direct Connect.
First, I compiled it myself. You should always compile things yourself if they aren't available in your repository.
Then I created a new user 'ncdc' to run the programme.
  • adduser ncdc
I created a very basic, simple init.d/ script that executes this line:
  • su -c screen\ -U\ -dmS\ ncdc\ ncdc ncdc
This will start NCDC with its own user (giving it limited rights) and in a UTF-8 enabled screen that is automatically detached. The screen command is highlighted in orange here, the not highlighted text is part of the su command.
Now to configure the client. I will not explain every single step; the official Ncdc Manual (man ncdc) does this quite well.
  • /nick your_nick
  • /set description your_description
  • /set connection your_upload_speed
Define your shares. If you have spaces in your share name, you can either use "name with spaces" or name\ with\ spaces.
  • /share "Archive" /storage/share/archive
  • /share "Temporary Folder" /storage/share/_dctemp
We also have to configure the active connection.
  • /set active_port your_port_here
  • /set active true
Connect to a DC++ or ADC hub.
  • /open Hub_Name Hub_Address
Switch to the hub tab (j to switch to left tab, k to switch to right tab) and define specific hub settings, like automatic connection on programme start.
  • /hset autoconnect true
This should be all for a basic configuration. If you have any feedback, additions or improvements, feel free to leave a comment.

2012-12-05

Edit XFCE menu with LXMenuEditor

I was searching ways to edit the XFCE menu with a GUI, because I didn't feel like messing around with all the .desktop files. I then got pointed to LXMenuEditor (or LXMed for short), a graphical menu editor designed for LXDE, but it works just as fine in XFCE.
Here's what you have to do to install it.
wget http://sourceforge.net/projects/lxmed/files/lxmed-20120515.tar.gz/download 
tar -xf lxmed-20120515.tar.gz 
cd lxmed
chmod +x install.sh 
sudo ./install.sh
That should be it, now you are ready to start the programme from the menu.

Debian on an Asrock E350M1

I recently built myself a neat little home server. I wanted it to be small compared to a desktop PC, while having a lot of storage space and a reasonable speed to manage smaller tasks. Here's what I bought:

Components

Case: Fractal Design Array R2 300W ITX
Mainboard: Asrock E350M1/USB3
APU: AMD E-350 (2 × 1.6 GHz) [Wikipedia]
RAM: 2 × GeIL 4GB DDR3-1066
Hard Drives: 4 × WD20EARX (Western Digital, 2 TB)

Installing Debian

I'm installing Wheezy from a FAT-formatted USB stick, which I created with unetbootin and the B4 Wheezy Amd64 netinst image. When I tried installing it from an Ext4-USB stick, it wouldn't mount correctly. The installation process is normal so far, I'm using a HD array configuration I found on the Debian forums.

Hard Disk config

/, Ext4: 3 × 5 GB [RAID5]
/boot, Ext4: 1 × 1 GB
swap: 1 × 4 GB
/storage, Ext4: 4 × (4 TB - 5GB) [RAID5]

X.org Window System

Linux boots up and then freezes with a weird-looking screen. It took me hours, if not days, to figure this one out. Thanks again to #debian and #debian-next, who helped me through this. The solution is incredibly easy though. When GRUB shows up, press E to edit the boot command. In the line that starts with linux, add nomodeset at the end. This will prevent Debian from unsuccessfully loading the video chip drivers. After you've done that, press Ctrl+X to boot with the selected GRUB entry. 
Log in as root. To download the necessary firmware, you need to edit the repositories. And since I'm a huge vim fan, this is what I did.
apt-get install vim
vim /etc/apt/sources.list
Now, you have to add "contrib non-free" to the end of your main Debian repository line. The final entry may look somewhat like this:
deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free
Update your repository cache and install the missing firmware.
apt-get update && apt-get install firmware-linux-nonfree firmware-realtek
Then you're all set to do a reboot in normal mode. You now have a functioning Debian.

2012-12-04

Sublime SFTP with SSH keys

I've been using Sublime Text 2 for a few months with Windows 7 at work. It's quite nice, maybe I'll write a post about it someday. So, I thought it was time to get my website development environment running on my laptop, which is running Debian 7 (Wheezy).
The server I wanted to connect to uses SSH keys and port knocking. On a side note: I'm still looking for a way to automatically knock the ports before connecting, on the other hand.. maybe I don't need everything done automatically.
Coming from Windows, I had the SSH key in Putty's *.ppk file format. Specifying it in the SFTP config didn't work, so to get it running, here's what I did.
First, you need to install puttygen. It's available in the Debian repositories.
sudo apt-get install puttygen
After you've done that, you can convert the *.ppk into OpenSSH format.
puttygen key.ppk -O private-openssh -o key
 Now, you can add this key to your SSH agent.
sudo ssh-add key
Now you should be set to use Sublime SFTP with that SSH key.