01 March 2013

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&

22 February 2013

Sound Blaster Play on Ubuntu

Haven't been able to listen to audio for quite awhile on my Ubuntu.
I finally got myself a Sound Blaster Play.
It didn't worked by just simply plugged.
Calling alsamixer, the sound card used by the system is the default Intel one, not recognizing the Sound Blaster.

So, I tried changing the default sound card, by what's instructed in this post
1. cat /proc/asound/modules
see your default sound card name
2. sudo gedit /etc/modprobe.d/alsa-base.conf
# Prevent abnormal drivers from grabbing index 0
options snd_hda_intel index=1 #change default sound card index to 1

3. reboot

After rebooting, I still couldn't here any sounds.
I couldn't even open alsamixer anymore... =____=;;;
And finally it was solved by opening gnome-volume-control and unmute the sound
I'm using wmii, so I don't have any sound bar, I wonder if the problem was just because it was muted...
But oh well, now I can listen to audio, nevermind what was it...

18 February 2013

Lapack in Mac OS X

I previously used this when compiling:
gcc ... -llapack
It worked, but I came into error for these two:
 dgetrf_
 dgetrf_
It was solved by using
gcc ... -framework Accelerate

Using Posix Threads in Mac OS X

Got into an EMFILE error
Too many semaphore descriptors or file descriptors are currently in use by this process.
when trying to run a program which runs on Ubuntu well.
The problem is that apparently Mac creates a file for every semaphore, and there's a limit for the number of opened files at one time, and it's set very low for Mac...
This can be fixed by
ulimit -n 10000
do not use sudo.

06 February 2013

Put picture in absolute position in Latex (x,y)


\usepackage[dvipdfm]{graphicx}
\usepackage{mediabb} %for putting in jpg images
\def\Put(#1,#2)#3{\leavevmode\makebox(0,0){\put(#1,#2){#3}}}
...

\begin{document}
\Put(320,-254){\includegraphics[height=3.5cm]{p.jpg}}
% 320 is x to the right at increasing value
% -254 is y to bottom at decreasing value

31 January 2013

r plot


Saving the plot beforehand
jpeg('rplot.jpg')
plot(x,y)
dev.off()

If error for above, save current active plot
dev.copy(png,'myplot.png')
dev.off()