|
Sunday, May 29. 2011
After upgrading to Ubuntu 10.04, vimperator could not read or write its .vimperatorrc anymore. Although all permissions were set correctly, the access to this file was denied. The access is also denied to firefox if you want to save a file as '.vimperatorrc'. Strangely, this is true for any file named '.XYZrc' in your home directory. The error message in the logs is
May 29 12:34:27 quick kernel: [ 7021.689247] type=1503 audit(1306665267.160:49):
operation="mknod" pid=4195 parent=1 profile="/usr/lib/firefox-3.6.17/firefox-*bin"
requested_mask="c::" denied_mask="c::" fsuid=1000 ouid=1000 name="/home/andreas/.vimperatorrc"
The access is denied by apparmor, in particular because of a rule in the privacy settings that disallows read or write access to *.rc files in the user's home directory. I don't know, why this broad apparmor rule is necessary, but I found a workaround for the .vimperatorrc problem. Reading the vimperator sources, I found that the configuration file is expected as '.vimperatorrc' (which causes the aforementioned problem) or '_vimperatorrc' (for Windows machines). It turns out that if on both GNU/Linux and Windows platforms one of the files does not exist, the other one is tried instead.
So, to let vimperator read its .vimperatorrc file, just rename .vimperatorrc to _vimpeatorrc. And keep in mind that firefox cannot read or write any file named *rc in your home directory (such as .my-vimperator.rc).
Alternatively you can disable apparmor (which I don't recommend) or update the apparmor rules (which I don't know how to do without removing the offending rule in the privacy profile as the manual page is incomplete here as far as I can see).
Sunday, March 20. 2011
I've recently upgraded my system from Ubuntu 8.02 to 10.04 (Lucid Lynx). After the reboot, my wireless PCI card with Intersil Prism 2.5 Wavelan chipset (rev 01) did not work anymore.
First I thought the driver for this rather old card is missing. However, it turned out the interface was named wrong by the udev rules.
To fix the issue, I edited /etc/udev/rules.d/70-persistent-net.rules. There were two entries for my wireless card, one for the hostap_pci driver that named the interface wlan0 and one for the orinoco_pci driver that named the interface eth1. As eth1 showed up with ifconfig, but wlan0 did not, I figured orinoco_pci is working, but hostap_pci is not. So I changed the following lines in 70-persistent-net.rules from
# PCI device 0x1260:0x3873 (hostap_pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:09:5b:11:e2:c9",
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
# PCI device 0x1260:0x3873 (orinoco_pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:09:5b:11:e2:c9",
ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
to
# PCI device 0x1260:0x3873 (hostap_pci)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:09:5b:11:e2:c9",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1260:0x3873 (orinoco_pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:09:5b:11:e2:c9",
ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
That is, I commented out the section for hostap_pci and renamed the entry for orinoco_pci to use wlan0 as the interface name.
After a reboot, I could use my wireless network again.
Update: However, a new entry was added to the udev rules file so that after the next reboot, my wireless network card did not work anymore. The culprit was the udev rules generator file at /lib/udev/rules.d/75-persistent-net-generator.rules, which thought it still had to add a udev rule for the eth1 interface. I don't know how to debug udev rules, so the easiest way to fix this issue is to disable the rule generation once everything is set up nicely. For this, I added the following line at the beginning of the 75-persistent-net-generator.rules file, with the effect that no further rule generation for network cards happens:
GOTO="persistent_net_generator_end"
Of course, if you add or change your network cards, you should uncomment this new line to generate new rules.
Tuesday, October 5. 2010
Thank you Richard Stallman for 25 years of free software. And for the GNU/Linux system. That is all.
Sunday, November 29. 2009
I needed to plot data from a program in real-time for a demo, that is, as the program generates the data, I wanted it to show in some nice diagram.
A friend pointed me to Visualize real-time data streams with Gnuplot by Thanassis Tsiodras, which is very nice: you specify the number of streams to plot and where to plot them, and feed it with lines like '0:1.23', '1:2.3', etc. defining the data points for the individual streams (here: first point on stream 0 is 1.23, first point on stream 1 is 2.3, etc.).
However, I needed to plot several streams in a single window, which that version lacked. So I extended that program with the ability to plot several streams into a single window (download).
For this, you specify both the number of streams you want to plot and the number of windows you want to show. Furthermore, you specify in which window each stream is plotted. I kept as much as possible of the original command line interface to ease the transition to this new version. The result looks like this:
Continue reading "Plotting data with gnuplot in real-time"
Friday, January 30. 2009
Who's designing the error messages of g++? Anyways, here is a translation:
error: request for member ‘foo’ in ‘((Test*)this)->Test::_bar’,
which is of non-class type ‘C_bar*’
means: in class Test, you've written _bar.foo, but _bar is a pointer; you need to write _bar->foo, that is, change the dot to an arrow.
Happy C++ coding!
Tuesday, January 27. 2009
I just stumbled over my python code, similar to the following one, which raises an UnboundLocalError in the first line of push:
def func_stack1():
stack = []
def push(num):
print "stack before: ", stack
stack = stack + [num]
print "stack after: ", stack
return push
push = func_stack1()
push(1)
Continue reading "Global and local variables in python"
Thursday, November 6. 2008
I wanted to 'upgrade' my python from 2.5 to 2.6 on Ubuntu. Unfortunately, I could not find .deb packages for Ubuntu. Fortunately, the Python 2.6 sources (sig) are available, so I can compile it from source. Here's what I had to do to get it running. (Short version: apt-get build-dep python2.5 and apply this patch to disable unavailable and outdated modules.)
Continue reading "Installing Python 2.6 on Ubuntu 8.04"
Saturday, May 17. 2008
I gvim, if you set
:setlocal spell spelllang=en_us
gvim will spell-check your file and underline wrongly spelled words with a red line much like you know it from OpenOffice. If you
:set mousemodel=popup
you can even right click on any misspelled word to get a list of suggested corrections.
However, this sometimes did not work for me. I could not figure out a reason, until I read the help docs again, which clearly say:
Note for GTK: don't release the right mouse button until the menu appears,
otherwise it won't work.
They actually mean what they say: if I release the right mouse button too fast, the menu appears, but it does not replace the misspelled word with the corrected word. Only if keep the right mouse pressed until the menu appears, it works, for whatever reason. RTFM!
Tuesday, May 6. 2008
If you link a static library to your executable, the GNU linker ld (as many others) only adds those symbols that ld thinks are actually used in your executable (that's a feature). Unfortunately, ld can only check if the symbol is in use, but not if the side effects of the symbol's initialization is used. Thus, your program will fail if it depends on the initialization of an unused static object.
In my case, I have a factory (class module::factory<T> : public factory_plant {...} factory;) at which classes can register themselves with a name (module::factory<Group> f("Group")). If I call the factory with a name (factory.create("Group")), the factory returns a pointer to a newly created class associated with that name. The class registers itself via a static object (here: f) whose initialization code does the actual registration.
The problem arises if the class is not used directly and the linker throws the static object away. The registration does not happen and thus I can't use the factory to create an object of the class. There are several possibilities to work around this feature:
Use --whole-archive to tell the linker to include all symbols, no matter what (with gcc use -Wl,--whole-archive -lmylib -Wl,--no-whole-archive). The drawback is that symbols that I neither use nor care about are also included, resulting in increased code size.
Use -u<symbol> to tell the linker to treat <symbol> as if undefined and thus include it in the executable, even it is not used. The drawback here is to know what <symbol> looks like. Easy for C files, difficult (and not portable) for C++ files (see Name mangling in Wikipedia).
Use static initializers (thanks to Alex for this). This is my preferred method. I use a throw-away class, which I add to the header file:
static struct Init {
Init() {
static module::factory<Group> init("Group");
}
} init;
Thursday, January 10. 2008
I learned Scheme in my first semester at university and I liked it right away for its clearity and flexibility. However, I stopped using Scheme for my everyday tasks some long time ago. Recently, I wanted to practice some Scheme again a little bit and I thought, I could come back to scsh, which we used in the lectures, to write some small script that does something similar to rsync. Given that I wrote some fairly large applications in scsh, I thought practicing will be smooth.
However, turning back to scsh reminded me of why I stopped using scsh as a scripting language (as opposed to programming language or Scheme implementation).
Continue reading "Why I don't use scsh as a scripting language anymore"
Friday, December 14. 2007
I've just found a nice, small C compiler: tinycc. The compiler includes the actual compiler and the linker, so you don't need other external tools. The executable is only 122KB in size on my system (Fedora Core 6). I like tcc because it allows you to create C-scripts.
Continue reading "TinyCC -- a fast C compiler"
Thursday, December 13. 2007
I always have to look it up how to restrict access to some files or directories on my web server, so I write it down here. Two steps:
- You need a password file
- You must specify the restrictions
Continue reading "Restricting access to directories and files in Apache's httpd"
Wednesday, December 12. 2007
Jake Voytko posted an interesting article on string searching algorithms. He presented the three algorithms brute force, Boyer-Moore, and Rabin-Karp. However, his implementation has two small bugs and the Rabin-Karp can be improved considerably.
Continue reading "Fun With String Searching"
Wednesday, December 12. 2007
That's really cool: Johnny Lee uses the Wii remote to create a low-cost multi-touch screen, either on a whiteboard or your laptop or any other surface you like. You can even download his software at his homepage. That's great, check it out!
Sunday, November 25. 2007
When you connect to a host that you have not connected to before via ssh, ssh prints a message like
lava:~$ ssh lava
The authenticity of host 'lava (134.2.14.48)' can't be established.
RSA key fingerprint is 9e:1a:5e:27:16:4d:2a:13:90:2c:64:41:bd:25:fd:35.
Are you sure you want to continue connecting (yes/no)?
Usually, you say yes and enter your password. With this, you accept the encryption key the server sent you as the actual encryption key of the server (as opposed to an encryption key some eavesdropper might have sent you who sits between you and the server you connect to). You are supposed to accept the encryption key only if you compared the received encryption key with the actual encryption key of the server by comparing their fingerprints. However, how do you get the fingerprint of the actual encryption key?
Continue reading "How to get ssh server fingerprint information"
|