I’ve recently started upgrading my projects to SourceForge’s new “forge” software Allura. Upgrading existing projects has been available for quite some time (IIRC since July), but I thought I didn’t have time to deal with it until now. From my short experience with the “new” SourceForge, I came away with two short insights.
Continue reading The New SourceForge
Separate Numbering for Problems in LaTeX
By default, when using amsthm to create environments such as theorems, claims, and problems, they all use the same numbering. Sometimes this is annoying, as the numbering for the problems should generally be unaffected by the theorems present (or the lack of them). For example, the default behavior produces:
Problem 1
Problem 2
Theorem 3
Problem 4
where the desired behavior would be (in my opinion):
Problem 1
Problem 2
Theorem 1
Problem 3
Fortunately, this can be done by redefining the problem environment.
letproblem@undefined % undefines the existing problem environment
theoremstyle{definition} % set the style of the new environment to 'definition'
newtheorem{problem}{protectproblemname} % (re)define the 'problem' environment
The theoremstyle can be one of three defaults: plain, definition, and remark, or some custom style defined using newtheoremstyle.
See amsthm‘s documentation for more information, such as subordinate numbering (numbering per section).
Annoying Outlook Error
Sadly, there are occasions when I can’t use my beloved Gmail account and have to use Outlook to connect to a corporate Exchange server. Due to Exchange’s inability to efficiently operate with large mailboxes (at least that’s what the tech support there tells me), I have to resort to moving messages to a local PST. However, some time ago I started encountering the following error whenever I tried moving messages into a PST file:
Cannot move the items. The item cannot be moved. It was either already moved or deleted, or access was denied.
I’ve tried changing permissions, moving my PST around, repairing it with some tools that come bundled with Office (I read somewhere that such an error can be caused by corrupted PST files), and even tried creating a new PST. But, alas, the not-so-helpful message just wouldn’t go away.
Continue reading Annoying Outlook Error
Scanning Lecture Notes – Separating Colors
Continuing my journey to perfect my scanned lecture notes, I’ll be reviewing my efforts to find a good way to threshold scanned notes to black and white. I’ve spent several days experimenting with this stuff, and I think I’ve managed to improve on the basic methods used.
In the process of experimenting, I’ve come up with what I think are the 3 main hurdles in scanning notes (or text in general) to black and white.
- Bleeding. When using both sides of the paper, the ink might “bleed” through to the other side. Even if the ink doesn’t actually pass through, it might still be visible as a kind of shadow when scanning, just like when you hold a piece of paper in front of a light and are able to make out the text on the other side.
- Non-black ink. Photocopying blue ink is notoriously messy. Scanning it to b&w also imposes challenges.
- Skipping. This is an artifact that is sometimes introduced when writing with a ballpoint pen. It’s a result of inconsistent ink flow and is more rare with more liquid inks such as rollerballs or fountain pens.
Those issues can be visualized in the first three images. These images are the originals I’ve tested the various methods with. The other images are results of the various methods explained in this post and should convey the difference between them.
Continue reading Scanning Lecture Notes – Separating Colors
Scanning Lecture Notes – Compression
A new semester is about to begin, so I again set out to organize lecture notes and scan them. This time I intend to invest more time in investigating and perfecting this process. Hopefully, I’ll present my conclusions in a few posts, each focusing on a different aspect.
In the first post, I’ll discuss the various ways to compress scanned lecture notes. Because lecture notes (at least mine) aren’t especially colorful, as I only use one pen at a time, I want the result to be black and white (line art). This allows for readable lecture notes while preserving a small size per page (as you can see in Some Tips on Scanning Lecture Notes).
Continue reading Scanning Lecture Notes – Compression
Hebrew Support in Hyperref – Situation Review
It’s been a bit more than three years since I wrote about a workaround for getting hyperref to play (almost) nicely with Hebrew. Over the past few weeks, I saw a rising interest in this, and a few people contacted me regarding this issue. So I thought it’s a good opportunity to better document the current situation and possible approaches that should be further investigated, which I believe might lead to better solutions.
Continue reading Hebrew Support in Hyperref – Situation Review
Sending Desktop Notification from Cron
Usually, when one wants to keep track of one’s cron jobs, one tells the cron daemon to email the output of the commands. While this is probably the best solution for servers, on desktop machines it is problematic. Many ISPs block outgoing traffic on port 25 (SMTP), and if you want to send the emails via an external SMTP server (such as Gmail), this requires you to store authentication details in plain text. A better solution for the desktop would be to harness the desktop notifications available in Ubuntu.
There is a useful tool called notify-send which is able to send desktop notifications directly from the command line. However, there are a few caveats:
notify-sendexpects its input on the command line; it can’t read fromstdin.- If you run it from cron, you must tell it which display to use.
The first issue can be worked around by using cat to pick up the input. The second issue is handled by adding a DISPLAY environment variable to the crontab. So your crontab will look something like this:
DISPLAY=:0
10 1 * * sun some_cool_command | notify-send "Backup Documents" "$(cat)"
The first argument to notify-send is the title of the notification. The second is the actual text to appear in it; in our case, it’s whatever comes in on stdin. If you want to store the output in a log file as well as display it in a desktop notification, you can use tee, which basically saves its input to a given file and also pipes it again to stdout.
DISPLAY=:0
10 1 * * sun some_cool_command | tee -a ~/some_log.log | notify-send "Backup Documents" "$(cat)"
WiFi won’t connect on Samsung Galaxy S2 with CyanogenMod 9 (ICS 4.0.4)
After upgrading to CyanogenMod 9 (ICS 4.0.4), I’ve experienced problems connecting to WiFi networks. Most of the time I’ve tried to connect to a WiFi network, it would try to connect and then fail. Often it would also show the network I’ve just tried to connect to as “Not in range.” This was extremely irritating, as I could stand by my router and have the phone report that there was no signal, while another Galaxy S2 phone would connect immediately; the only difference was that the other phone was running Android 2.3.7. Needless to say, I hadn’t made any major (or minor) changes to my WiFi equipment, and the problem wasn’t confined just to my home. Sometimes, it would connect after being idle for a day or so.
Back when I was using CyanogenMod 7, I had no problems with the WiFi on my phone, and I could also replicate this behavior on another Galaxy S2 I’d upgraded to CyanogenMod 9. Initially I thought it was some bug in CyanogenMod, but I came up with nothing. Over the weekend, I figured maybe the bug wasn’t specific to CyanogenMod, and I found this bug report WiFi freeze on Samsung Galaxy S2 with ICS 4.0.3. For some reason, many people have problems with WiFi on the Galaxy S2 with ICS. While the report relates to the WiFi freezing, which I didn’t experience, I decided to sift through the comments. Some people mentioned the “Wi-Fi frequency band” feature available in Wi-Fi settings -> Advanced (available by pressing the menu button), so I decided to try playing with the different settings there.
This setting allows you to choose the WiFi operating frequency between three options: 5GHz, 2.4GHz, and “Auto,” which, as you can guess, automatically figures out the right frequency: 5GHz (802.11a and 802.11n) or 2.4GHz (802.11b/g/n). However, it seems the phone (probably due to a problem in the driver) fails at the “Auto” thing. Instead of guessing the right frequency, it fails to connect. So I changed it to 2.4GHz, which is still a more popular choice in routers than 5GHz, and instantly my phone connected to my router.
For conclusion: If you have trouble connecting to WiFi on Samsung Galaxy S2 with ICS, you should probably set the phone to use 2.4GHz only (or 5GHz only) instead of the default “Auto” mode.
spass 3.0 Released
I’ve released today the new version of spass, a tool that creates cryptographically strong passwords and passphrases by generating random bits from your sound card.
On the user-facing side, spass can now create passphrases as well as passwords. The words for the passphrases are chosen from a list of 8192 words, which means each word adds 13 bits of entropy to the passphrase.
spass can now use one of three audio backends (the old version could only use OSS):
- Advanced Linux Sound Architecture (ALSA)
- Open Sound System (OSS)
- PortAudio
PortAudio support will hopefully make it easy to port spass to other platforms as well (such as Windows). The random number generator got an overhaul, and now there is an unbiasing step before applying the hash function. This should help produce consistent results in terms of entropy. Behind the scenes, I’ve migrated the project from autotools to cmake.
You can find more information, as well as both source and binary packages, at https://github.com/guyru/spass.
Auto-Detect Dependencies when Building .debs Using CMake
CMake (via CPack) has a great feature that allows you to automatically generate Debian/Ubuntu (.deb) packages. One of the annoying things to do when you create a package is list its dependencies. CMake asks you to do it via the CPACK_DEBIAN_PACKAGE_DEPENDS variable. For example:
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.7-18)")
But what happens when you work on a more complex project? Keeping track of all the dependencies by hand is a tedious task. Debian provides a tool named dpkg-shlibdeps, which makes this task easier by updating the debian/control file with dependencies extracted from the dynamic libraries needed by a given executable. Luckily, since CMake 2.8.3, CMake also supports running this tool automatically to figure out the required dependencies. The documentation is sparse, and I had a hard time finding how to do so (I actually found it via a bug report and a commit message, but afterward I’ve seen it in the official documentation too). To enable it, you need to add the following line to your CMakeLists.txt file:
# autogenerate dependency information
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)


