Alternative view: by date.
I noticed a while ago a Perl script file included on my blog wasn’t
served properly, since the charset wasn’t announced and web browsers
didn’t display it properly. The received file was still valid UTF-8
(hello, little ©
character), at least!
First, wrong intuition
Reading Apache’s /etc/apache2/conf.d/charset
it looks like the
following directive might help:
AddDefaultCharset UTF-8
but comments there suggest reading the documentation! And indeed that alone
isn’t sufficient since this would only affect text/plain
and
text/html
. The above directive would have to be combined with
something like this in /etc/apache2/mods-enabled/mime.conf
:
AddType text/plain .pl
Real solution
To avoid any side effects on other file types, the easiest way forward
seems to avoid setting AddDefaultCharset
and to associate the
UTF-8
charset with .pl
files instead, keeping the text/x-perl
MIME type, with this single directive (again in
/etc/apache2/mods-enabled/mime.conf
):
AddCharset UTF-8 .pl
Looking at response headers (wget -d
) we’re moving from:
Content-Type: text/x-perl
to:
Content-Type: text/x-perl; charset=utf-8
Conclusion
Nothing really interesting, or new. Just a small reminder that tweaking
options too hastily is sometimes a bad idea. In other news, another Perl
script is coming up soon. :)
While building and testing LiveCDs, QEMU and
VirtualBox can speed up development cycles…
until a bug is encountered: apt-get update
hanging on a rename
operation. Maybe aufs is at fault? Its
author then asks for some data, including what happens when some SysRq keys are
pressed. What they are is already quite extensively explained in
Documentation/sysrq.txt
(Linux sources), but I’d like to point to a nice trick for people using
emulation and virtualization tools (ever tried to send Ctrl+Alt+Delete
to
a virtual machine?):
# echo $letter > /proc/sysrq-trigger
where $letter
is any of the supported SysRq keys. As an example:
# echo d > /proc/sysrq-trigger
# dmesg | tail -1
[558193.423427] SysRq : HELP : loglevel0-8 reBoot Crashdump tErm Full kIll
saK showMem Nice powerOff showPc show-all-timers(Q) unRaw Sync showTasks
Unmount shoW-blocked-tasks
VirtualBox (available in Debian as
virtualbox-ose
with a m-a
-buildable kernel driver:
virtualbox-ose-source
), is quite interesting, and works great on
both sid
and lenny
. [Why OSE
? Open Source Edition.]
Example: X freezes sometimes when gtk-2.11
is installed, maybe due
to bugs like xfwm4's Debian bug #442053, which is quite
annoying since epiphany's trunk needs it. Then develop in a virtual
machine and restart it when needed, leaving the host system
unaffected. It is also quite easy to duplicate, pause, resume, etc.
the virtual machines.
Note: Virtual machines are stored in .vdi
files (Virtual Disc
Images). Copying them isn't the way to clone images, since a UID is
stored inside them. Use vboxmanage clone original.vdi clone.vdi
instead.
An annoying bug in VirtualBox is Debian bug #443500: the AltGr
key
isn't passed to the virtual machines. Fortunately, upstream's
changeset 3939 fixes that.
Now {
, }
, [
, ]
, @
, |
, #
are available! \o/
A while ago, IP forwarding was being set through /etc/network/options
, which
has been deprecated.
It is possible to play a bit with /etc/sysctl.conf
:
net.ipv4.conf.default.forwarding=1 # Or 0...
This sets the default forwarding state of network devices without explicit configuration. It only affects the devices that will be registered in the future.
A similar setting is the following:
net.ipv4.conf.all.forwarding=1 # Or 0...
This applies to all the network devices (even those not in the UP
state), but
doesn't apply to the devices that will be registered in the future.
Another setting is the following, which acts as an alias of the previous one:
net.ipv4.ip_forward=1
Then just run sysctl -p
to take this parameter into account.
These settings can also be specified replacing the dots by slashes, and are
available under /proc/sys
.