02 March 2013

Icon in login screen of Ubuntu 12.04

Having many custom xsessions with blank icons are confusing...
To change the white circular icon:
source
gimp /usr/share/unity-greeter/unknown_badge.png
save as
/usr/share/unity-greeter/custom_SESSIONNAME_badge.png

Install chrome 12.04

downloading .deb from google didn't work (maybe I forgot sudo)

source
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable

01 March 2013

Webserver on Ubuntu 12.04

I wanted to have my own wiki on my Ubuntu.

1. install apache
sudo apt-get install apache2

2. install php
sudo apt-get install php5 libapache2-mod-php5

3. restart
sudo /etc/init.d/apache2 restart

4. test with /var/www/info.php at localhost/info.php
<?php
phpinfo();
?>


5. using home folder instead of /var/www
sudo mv /var/www /var/www-backup
sudo ln -s /home/username/Sites /var/www


And then I can have my sites also backed up on Dropbox! Yay!

Moving Pukiwiki on PHP 5.4.6

source

The frontpage was blank, I thought I was doing something wrong with my website settings.
But turns out pukiwiki wasn't working well on php 5.4 without changes.
It can be seen on the blog above, I'll rewrite it again here:

1. lib/func.php
Comment out bin2hex() function
// Inversion of bin2hex()
/* 
function hex2bin($hex_string)
{
// preg_match : Avoid warning : pack(): Type H: illegal hex digit ...
// (string) : Always treat as string (not int etc). See BugTrack2/31
return preg_match('/^[0-9a-f]+$/i', $hex_string) ?
pack('H*', (string)$hex_string) : $hex_string;
}
*/


2. plugin/ls2.inc.php
array_walk($args, 'plugin_ls2_check_arg', & $params);
to
array_walk($args, 'plugin_ls2_check_arg', $params);

It already worked at this stage, but just in case, I also did this

3. lib/convert_html.php, lib/link.php, lib/init.php
change all & new to new

When moving pukiwiki to a new server, need to do:
chmod 666 *
chown username:username *

for wiki/ backup/ diff/

Tar newly changed files

find /home/user/Dropbox/ -name '*pdf' -mtime -2 | xargs tar -rf ttt.tar; gzip ttt.tar

file changed 2 days ago

Locate command not finding

When the locate command not finding something, it may need to be updated.
sudo updatedb

Preventing Gnome to override Xmodmap Settings

Calling gnome-settings-daemon causes xmodmap keyboard settings to be override. To solve:
1. Dirty way, put sleep after calling gnome, before calling xmodmap
gnome-settings-daemon&
sleep 1; xmodmap ~/.Xmodmap

2. Put into .bashrc, but this causes weird message xmodmap: please release the following keys within 2 seconds
if [ -f ~/.Xmodmap ] ; then
xmodmap ~/.Xmodmap
fi

3. I ended up using this method, but this should also be used with caution, since it seems to remove some custom shortcut settings...
gsettings set org.gnome.settings-daemon.plugins.keyboard active false


Warning: do not use combination of Mod4+p, it's mapped to some display setting by something... Just map the key to Mod3 or others.

Japanese Input on Ubuntu 12.04

Uses ibus
sudo apt-get install ibus-anthy
Add Anthy in Input Method
ibus-setup
in .xsession add
ibus-daemon&