Guy Rutenberg

Keeping track of what I do

Archive for the ‘Errors’ tag

Python’s base64 Module Fails to Decode Unicode Strings

without comments

If you’ve got a base64 string as a unicode object and you try to use Python’s base64 module with altchars set, it fails with the following error:

TypeError: character mapping must return integer, None or unicode

This is pretty unhelpful error message also occurs if you try any method that indirectly use altchars. For example:

base64.urlsafe_b64decode(unicode('aass'))
base64.b64decode(unicode('aass'),'-_')

both fail while the following works:

base64.urlsafe_b64decode('aass')
base64.b64decode(unicode('aass'))

While it’s not complicated to fix it (just convert any unicode string to ascii string), it’s still annoying.

Written by Guy

May 3rd, 2010 at 9:18 pm

Posted in Uncategorized

Tagged with ,

NVidia driver fails to initialize after X restart

with 2 comments

This is mainly a note to myself. Sometimes when the X server is restart it complains that nvidia driver couldn’t be initialized and that no screens were found. This may be a result of a version mismatch between X11′s and the kernel’s nvidia module. The solution is to

modprobe -r nvidia

before restarting the X server.

Written by Guy

November 14th, 2009 at 5:19 pm

Posted in Linux

Tagged with

\lyxframeend Undefined when Using Beamer with Lyx

with 8 comments

I’m using LyX for the first time with Beamer. Making the title page was smooth. But when I’ve tried adding a new frame (using BeginFrame) I was confronted with the following error

 \lyxframeend
                 {}\lyxframe{Outline}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

After comparing my document to example (working) beamer documents I’ve found out that you must have an EndFrame command after your last frame.Too bad it wasn’t documented anywhere I’ve found as this little thing drove me crazy.

Written by Guy

July 22nd, 2009 at 5:40 pm

Posted in LaTeX,Tips

Tagged with , , ,

Kernel Configuration for acpid Issue

without comments

I’ve installed acpid on my system some time ago (Gentoo package: sys-power/acpid. However each time I tried to start it it complained:

acpid: can't open /proc/acpi/event: No such file or directory

Apparently acpid requires you to enable ACPI_PROC_EVENT, which in it’s labels states “Deprecated /proc/acpi/event support”. I really wonder why such tool only support the deprecated way to receive the ACPI events.

Written by Guy

October 15th, 2008 at 3:55 pm

Posted in Linux

Tagged with ,

LaTeX Error: Command \textquotedbl unavailable in encoding HE8

with 6 comments

I was testing today the SVN version of LyX 1.6.0 and 1.5.7. Due to a change in the way the double quotation mark (“) is handled, adding it to Hebrew text resulted in the following LaTeX error:

LaTeX Error: Command \textquotedbl unavailable in encoding HE8

Read the rest of this entry »

Written by Guy

October 12th, 2008 at 8:08 pm

Posted in LaTeX

Tagged with , ,

Alpha Channel Problems When Creating .ico Files Using ImageMagick

with 3 comments

I’ve tried to use ImageMagick to create .ico files for Open Yahtzee, out of PNGs of various sizes. The command as it should have been:

convert openyahtzee16.png openyahtzee32.png openyahtzee64.png openyahtzee.ico

resulted in the alpha channel being reversed. I’ve used ImageMagick 6.4.0, and I didn’t remember this misbehavior happening in the previous versions.

While this annoyed, and was due to no apparent reason, it could be easily solved using the ImageMagick switches to reverse the alpha channel:

-channel Alpha -negate

So the command that produces a correct .ico file was:

convert openyahtzee16.png openyahtzee32.png openyahtzee64.png -channel Alpha -negate openyahtzee.ico

Written by Guy

October 5th, 2008 at 6:30 pm

Posted in Tips

Tagged with ,

NVRM: not using NVAGP, kernel was compiled with GART_IOMMU support

without comments

For the past several weeks I had a strange problem. Sometimes when I booted my computer, it would refuse to start the X server and would give the following error in dmesg:

NVRM: not using NVAGP, kernel was compiled with GART_IOMMU support!!
NVRM: failed to allocate stack!

The weird thing about it is that normally if I rebooted the computer it would magically work again. So this error only showed up once-in a while and seemed to disappear at will. Today, it happened again, so I decided to fix it.
Read the rest of this entry »

Written by Guy

August 2nd, 2008 at 9:24 am

Posted in Linux

Tagged with

usb 1-4: device descriptor read/64, error -71

without comments

When I try to connect my Sansa Clip MP3 player to the linux box I see the following error in dmesg:

usb 1-4: device descriptor read/64, error -71

and the device recognition fails. The player’s battery gets reloaded but I can’t mount it and transfer songs.
Read the rest of this entry »

Written by Guy

June 26th, 2008 at 2:28 pm

Posted in Linux,Tips

Tagged with

Notes About Using amsmath split Environment In Hebrew Documents

with 4 comments

Recently I’ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:

Package amsmath Error: \begin{split} won't work here.

Read the rest of this entry »

Written by Guy

April 9th, 2008 at 7:25 am

Posted in LaTeX,Tips

Tagged with , , ,

Resolution Problems in clock()

with 2 comments

While playing recently with clock() in order to time the performance of different kinds of code and algorithms, I found an annoying bug. clock() just can’t register work that has taken less than 0.01 seconds. This is pretty unexpected as clock() should return the processor time used by the program. The man page for clock() states:

The clock() function returns an approximation of processor time used by the program.

Read the rest of this entry »

Written by Guy

September 10th, 2007 at 10:50 pm

Posted in C/C++

Tagged with