How to get Zotero IEEE style NOT to abbreviate with et al. in the bibliography

In my view, Zotero is currently the best reference manager available, and it’s also completely open source!

I had one niggling problem though with version 2.1.10 (latest stable at the time of this writing): When I would export (or Quick Copy) references in IEEE style, it would abbreviate the author list with “First Author, et al.” if there were seven (7) or more authors. When I’m building a bibliography list, this is of course never the right thing to do.

Here’s the simple workaround for this problem:

  • Go to Preferences | Advanced and click on the “Show Data Directory” button.
  • Edit styles/ieee.csl with your favourite text editor.
  • Look for the line starting with <bibliography et-al-min=”7″ … and change the 7 to a higher number, 100 for example.
Let me know in the comments if this helped!

A Windows console that does not suck

We’ve all been there: You’re used to the terminal on Linux or OSX, and then for some or other reason you need to work on Windows and you’re confronted with the half-baked monstrosity that is cmd.exe:

It's 2011 and this is Windows 7: Why does the console still make me want to gnaw off my fingers?

To summarise: You can only resize the window vertically (so you’re always restricted to 80 characters width which is just idiotic on modern widescreen displays), copy and paste is so painful that you’ll wish that they’d rather just not bothered with it in the first place and the cmd.exe interpreter itself is primitive when compared with any modern unix shell.

Enter the two-pronged solution of Console2 and Git bash! Console2 is a console that solves the UI problems (resizing! copy and paste! terminal transparency! tabs!) and you can use it together with any combination of command line interpreters, such as for example the existing cmd.exe, bash or anything else.

Here’s my setup, configured with Git bash (you get this for free with the Windows git installer, for this purpose it’s better than Cygwin as it’s a touch closer to Windows) as well as plain old cmd.exe. To configure a Git bash tab, set Shell to “C:\Windows\SysWOW64\cmd.exe /c “”C:\Program Files (x86)\Git\bin\sh.exe” –login -i” (including all quotes) and Startup dir to %HOMEDRIVE%%HOMEPATH%. I’ve also configured Ctrl-Alt-T to invoke Console2. With shift-mouse-drag I can select text (nice editor select, not cmd.exe block select, ptooey!), and I’ve set Ctrl-Shift-C and Ctrl-Shift-V to copy and paste so it’s like the Gnome terminal on Linux. Behold:

Console2 makes the pain go away.

My Windows experience is a lot more bearable now, perhaps even slightly pleasant! Did I just say that?!

Alternatives

  • PowerShell replaces cmd.exe, but by default still runs inside the Windows console. Still much suckage in other words, plus that I don’t feel compelled to learn PS yes.
  • Cygwin mintty is also often cited as a console replacement, but seems to cause problems (for example with git) as it’s not a full Windows console.
  • Cygwin itself is really fantastic, but due to that POSIX compatibility layer which is otherwise a useful thing, differs too much from the native Windows goodies so that sometimes native Windows behaviour is interfered with.

How to stop accidentally answering or declining calls when trying to fish your HTC Sense Android phone from your pocket

As you know by now, I really do love my HTC Desire Z phone. However, besides the miserable battery life which one tries to live with because it’s otherwise such a kickass phone, a major gripe was HTC Sense’s vertical swipe to answer or decline an incoming phone call. This has resulted in me accidentally answering or declining numerous incoming calls as I was trying to fish the phone out of my jeans pocket, as this fishing generally causes one’s fingers to slide vertically over the screen. The advice of turning the phone around so the screen faces one’s leg also doesn’t cut it, because the screen could get scratched on the various small studs one often finds in that area, but more importantly because I don’t like following semi-working rules like that.

I finally found a forum posting by a user named deetsvl with a solution to this problem that I’ve confirmed works perfectly on this HTC Desire Z. Behold:

All hail WidgetLocker, solution to the HTC Sense accidental answering problem!

WidgetLocker going to cost you a whole € 1.41, but it does the trick just perfectly, if you remember to change the following setting: In “Settings | Popups”, check “Hide Incoming Call”. When you receive a call, you’ll have to slide horizontally first to unlock WidgetLocker, then the normal vertical business for answering / declining a call. If you manage to do that accidentally, I know a good side-show agent, so give me a call. On my Desire Z, I also checked “Settings | Buttons & Inputs | Slide Keyboard Unlock” so that I don’t have to unlock Widget Locker when suavely flick-sliding open the keyboard on this baby.

I hope that you enjoy your new-found only-answering-and-declining-calls-that-you-really-want-to freedom!

Ubuntu 11.04 Natty Narwhal Annoyances (Dell E6410 with NVS 3100m GPU)

I recently upgraded my Dell E6410 with NVS 3100m GPU laptop from Ubuntu 10.10 (Maverick Meerkat) to 11.04 (Natty Narwhal), and I can’t shake this feeling that the distribution has taken a few steps back. I’m not even referring to the new Unity desktop, but to some super-irritating annoyances I had to fix or work around before being able to use the system. These annoyances were not present in 10.10, it had a whole different collection. :)

Wireless N connects, but no packets get through

The first annoyance was when I successfully connected to my wireless N access point, but couldn’t get a single packet through. After much searching, it turns out there’s a bug in the firmware for the Centrino Advanced-N 6200 wireless adapter that keeps it from getting any data through.

The solution is to disable wireless N on your laptop by creating a file etc/modprobe.d/inteldisablen.conf with the following contents:

options iwlagn 11n_disable50=1 11n_disable=1

and then to reboot. If you don’t want to reboot, just rmmod and modprobe the iwlagn kernel module. I’ve confirmed that this fix works.

Google Chrome scrolls excruciatingly slowly

After resuming and suspending, certain 2D and GPU-assisted graphics operations slow down. Scrolling in Chrome, even on a simple Google results page, is excruciatingly slow with head-explosion-levels of lag.

The solution is to disable hyperthreading, or at least to disable a number of CPU cores, at suspend and re-enable at resume. My laptop i5 CPU has 2 real cores, and thus 4 virtual cores due to hyperthreading. I’m using the following script, taken from this forum thread to do the necessary core disabling / enabling automatically:

#!/bin/sh

# Disable hyper-threading processor cores on suspend and hibernate, re-enable them
# on resume. Presumably helps for buggy nvidia behaviour.
# save this file as /etc/pm/sleep.d/20_core_i5_disable_cores and make excutable
# with chmod +x /etc/pm/sleep.d/20_core_i5_disable_cores

# from: http://www.nvnews.net/vbulletin/showthread.php?t=158091

case $1 in
        hibernate|suspend)
                echo 0 > /sys/devices/system/cpu/cpu1/online
                echo 0 > /sys/devices/system/cpu/cpu3/online
                ;;

        thaw|resume)
                echo 1 > /sys/devices/system/cpu/cpu1/online
                echo 1 > /sys/devices/system/cpu/cpu3/online
                ;;
esac

I’ve confirmed both the slow-down behaviour and the working of the fix.

Eclipse scrollbars don’t work

Natty’s new overlay scrollbars screw with Eclipse’s scrollbars, leaving you with 100% non-working scrollbars! You can either disable the overlay scrollbars completely, or comment out the GDK_NATIVE_WINDOWS line close to the start of the /usr/bin/eclipse shell script:

#export GDK_NATIVE_WINDOWS=true

On my setup, this fix works most of the time.

Conclusion

It’s a shame that these things don’t work out of the box, as some of them had been reported long before the Natty release. Before I forget, if you install 11.04 on this specific laptop, you might also have to follow my Ubuntu 10.10 howto if you see a black screen at bootup or resume.

The Django Book 2.0 in MobiPocket / Kindle format

I wanted to read the web preview of the Django Book’s second edition on my Kindle. Besides the fact that all image links are broken on that website and have apparently been so for some time, I prefer to have these things in the DRM-free MobiPocket / Kindle format. Of course I couldn’t find this anywhere, so I rolled my own based on the book’s SVN repository.

On this page you can download the MobiPocket version of the book and the HTML source files I generated to make it. You can also read on for the skinny on how you can do this yourself.

This procedure works best on a unix-like machine, as we’re going to use grep and sed along with some Python.

1. We start by doing a checkout of the reStructuredText sources of the book, moving the linked graphics into the same directory as the reStructuredText txt files and then creating a grepindex.txt file that will serve as the basis for our table of contents index.txt:

svn co http://djangobook.com/svn/branches/2.0/ 20svn
cd 20svn
find graphics/ -name *.png -exec mv {} . \;
grep -h "^Chapter [0-9]*:" *.txt > grepindex.txt

2. The grepindex.txt will now be converted to something more reStructuredText-like using this script, called grepindex2index.py:

# first do:
# grep -h "^Chapter [0-9]*:\|^Appendix [A-Z]:" *.txt > grepindex.txt
# then:
# python grepindex2index.py grepindex.txt > index.txt

import re
import sys

rst_header = """
===================
The Django Book 2.0
===================

Copyright 2006, 2007, 2008, 2009 Adrian Holovaty and Jacob Kaplan-Moss.
This work is licensed under the GNU Free Document License.

This ebook version was prepared by Charl Botha <http://charlbotha.com/> from
the SVN at http://djangobook.com/svn/branches/2.0/ on 2011-04-25, and is
hosted by <http://vxlabs.com/>.

"""

def main():
    f1 = open(sys.argv[1])
    print rst_header

    # this will match on "Chapter 10: the title" or "Appendix B: another title"
    # groups 0: chapter 10 or appendix A; 1: 10 (or None), 2: A (or None), 3: title
    pat = re.compile('(^Chapter\s*([0-9]*)|^Appendix\s*([A-Z])):\s*(.*)$')
    chapters = []
    appendices = []
    for l in f1:
        # Chapter 10: Advanced Models -> `Chapter 10: Advanced Models <chapter10.html>`_
        mo = pat.match(l)

        if mo.groups()[1] is not None:
            chapters.append("* `Chapter %s: %s <chapter%02d.html>`_" % (mo.groups()[1],mo.groups()[3],int(mo.groups()[1])))

        else:
            appendices.append("* `Appendix %s: %s <appendix%s.html>`_" % (mo.groups()[2],mo.groups()[3],mo.groups()[2]))

    print "\n".join(chapters)
    print "\n".join(appendices)

if __name__ == "__main__":
    main()

Save this to a script called grepindex2index.py, then invoke it with:

python grepindex2index.py grepindex.txt > index.txt

3. We’ll then proceed to fix all chapter references with the following bit of sed:

sed -i "s/\.\.\/\(chapter[0-9]*\)\//\1.html/g" chapter*txt

(this will change all “../chapter??/” links to just “chapter??.html”)

4. Everything is now ready to be converted to HTML:

for i in *.txt; do rst2html $i `echo $i | cut -f 1 -d .`.html; done

5. After downloading this django desktop background as cover image, I dragged and dropped the top-level index.html file onto the free Calibre software to import it, and then used the edit metadata function to set the cover image. After this, I converted the imported files to MobiPocket remembering to add the word “appendix” to the chapter detection xpath expression in the “structured detection” section of the conversion dialogue.

That’s all there’s to it! Have a good read.

Sipura / Linksys / Cisco SPA3102 Voice Gateway in The Netherlands

After recently spending some hours configuring my new Cisco SPA3102 Voice Gateway with a Betamax SIP provider (voipbuster / voipstunt / voipcheap / and so forth, see http://www.backsla.sh/betamax for a full list of all Betamax providers) and the Dutch PSTN system, I thought I’d try and make your life easier by documenting the most important of the settings.

With this box you can stick it to the man!

The SPA3102 is connected to an existing router, so I have the Lan Setup set to Bridge, and have configured the Internet port (on the Router | Wan tab) with a suitable static IP. To be clear, in this configuration, one only connects up the Internet port and NOT the Ethernet port.

Voice | Regional

For the Voice | Regional tab I found the following Call Progress Tone settings on a voxilla forum page by users PJH and edokter:

Dial Tone: 425@-10;20(*/0/1)
Second Dial Tone: 425@-10;20(*/0/1)
Outside Dial Tone: 350@-19;440@-19;20(*/0/1+2)
Busy Tone: 425@-10;10(.5/.5/1)
Reorder Tone: 425@-10;10(.25/.25/1)
Off Hook Warning Tone: 1000@0;*(0/9.5/0,.1/.1/1,.1/.1/1,.1/0/1)
Ring Back Tone: 440@-19,480@-19;*(2/4/1+2)
Confirm Tone: 425@-10;1(.1/.1/1)
SIT1 Tone: 950@-19,1400@-19,1800@-19;30(.333/0/1,.333/0/2,.333/1/3)
MWI Dial Tone: 425@-10;1(.1/.1/1);20(*/0/1)
Cfwd Dial Tone: 425@-10;20(.5/.05/1)

On the same tab and from the same forum page, the following Distinctive Ring Patterns and Distinctive Call Waiting Tone Patterns:

Ring1 Cadence: 90(1/4)
Ring2 Cadence: 90(.3/.4,.3/4)
CWT1 Cadence: 60(.5/9.5)
CWT Frequency: 425@-16

To get caller ID working, I made the following changes (still on the Voice | Regional tab):

Caller ID Method: ETSI FSK
Caller ID FSK Standard: bell 202

Finally on this tab, set:

FXS Port Impedance: 270+750||150nF

(according to the Cisco admin manual, this is the standard for The Netherlands)

Voice | Line 1

This is the tab where you get to do most of the SIP configuration.

I have my primary betamax provider (12voip.com) setup under Proxy and Registration and Subscriber Information:

Proxy: name of your sip server e.g. sip.voipbuster.com
Display name: 0031xxxxxxxxx (number that you have verified and configured as callerid with the voipbuster software)
User ID: 0031xxxxxxxxx (same as above)
Password: hard to figure this one out :)
Use Auth ID: yes
Auth ID: your betamax (voipbuster etc.) username

My dialplan looks as follows:

(112S0<:@gw0>|0800x.<:@gw0>|090x.<:@gw0>|<#9:>xx.<:@gw0>|<1601:>xx.|<0:0031>[1-7]xxxxxxxxS0|xxxxxxxxxxxxxS0|xx.|*xx)

Here is the commented version for your edification:

(112S0<:@gw0>| # emergency number goes through PSTN
0800x.<:@gw0>| # 0800 numbers go through PSTN
090x.<:@gw0>| # 090x numbers go through PSTN
<#9:>xx.<:@gw0>| # prefix number with #9 to force dialing through PSTN
<1601:>xx.| # throw away 1601 preselect still in some handset phonebooks. you won't need this.
<0:0031>[1-7]xxxxxxxxS0| # numbers without 0031 country code will get it added
xxxxxxxxxxxxxS0| # stock standard 00CCRRxxx 13 digit international telephone number
xx.| # all other numbers
*xx) # linksys codes

This is a concise howto (in Dutch) on writing dialplans. You can use other betamax providers in the Gateway Accounts and integrate them in your dialplan. The betamax providers don’t require registration.

Voice | PSTN Line

In order for your SPA3102 to realise that the call has been ended, you need to setup PSTN Disconnect Detection correctly:

Detect CPC: yes
Detect Polarity Reversal: no
Detect Disconnect Tone: yes
Disconnect Tone: 425@-30,425@-30; 2(0.5/0.5/1+2)

When I had “Detect Polarity Reversal” set to yes, I’d get immediate disconnects on incoming calls with my new Ziggo cable PSTN connection.

On the same tab, make sure your FXO Port Impedance is also set to 270+750||150nF (the Dutch standard).

Later I discovered that if we took longer than 10 seconds to answer the phone, the call would be lost. To fix this, set the “PSTN Answer Delay” to 60 seconds or something reasonable.

Conclusion

Please let me know in the comments if this worked for you, or if you have any questions on the instructions above!

International characters on the HTC Desire Z keyboard

I’m typing this up because it took me far too long to find, probably because I wasn’t using the right search terms, or because I was trying stupid key combinations…

Frustration (was: threesixtyfive | day 244)

In any case, if you want to make international characters (that is, characters with accent marks, diacritics, trema (plural tremata), umlauts, eat that google!) such as ë, é, ê or even ö or ï and so forth on the HTC Desire Z hardware keyboard, you simply long press the base character. A menu pops up and you get to choose the accented character that you would prefer to insert at that moment.

I sincerely apologise for interrupting your usual high IQ programming with this. If however you stumble upon this post and it helps you, why don’t you leave a comment just for laughs?

Ubuntu 10.10 x86_64 on your Dell E6410 with NVS 3100m GPU

Well howdy hoo! This is the fastest and most painless guide to installing Ubuntu 10.10 (Maverick Meerkat) x86_64 on your Dell E6410 laptop with NVS 3100m GPU.

More specifically, installing Ubuntu 10.10 on this specific hardware configuration poses two problems:

  1. Blank (black, no backlight) display when booting with the install media, or, if you manage to get Linux on the machine, with the installation itself.
  2. Blank (black, no backlight) display when resuming from suspend to ram after having installed Ubuntu.

Solving problem 1

  • Boot with the normal Ubuntu 10.10 x86_64 Desktop live disc. I usually do this from USB memory.
  • When you get to the first boot menu (“Try Ubuntu without installing”, “Install Ubuntu”, etc.), press F6 for other options, then ESC to kill the menu that appears. Move the menubar to “Try Ubuntu without installing”.
  • You can now edit the boot command-line. Replace “quiet splash” with “nouveau.modeset=0″
  • Press enter to boot into the live desktop, then install the whole business as per usual.
  • At the first boot after installation, press ‘e’ at the grub boot screen to edit the command line and again replace “splash quiet” with “nouveau.modeset=0″.
  • You should get all the way to the Ubuntu desktop.
  • Activate the NVidia drivers via System | Administration | Additional Drivers
  • Now edit /etc/default/grub, and replace “splash quiet” in the GRUB_CMDLINE_LINUX_DEFAULT with, you guessed it, “nouveau.modeset=0″.
  • Run “sudo update-grub” at the command-line.
  • Problem solved.

Solving problem 2

  • Edit the GRUB_CMDLINE_LINUX_DEFAULT variable /etc/default/grub again. When you’re done, it should read (we’ve added the acpi_sleep bit at the end):
    GRUB_CMDLINE_LINUX_DEFAULT="nouveau.modeset=0 acpi_sleep=nonvs"
  • Run “sudo update-grub” at the command-line.
  • Problem solved.
  • (if you really want to know more about this, including several other more painful work-arounds, read this bug report)

Generally, I’m really impressed with the general slickness of 10.10 on this machine. What impressed me particularly, was that powertop reported about 14W of power consumption at idle on this out-of-the-box setup (disregarding the two tweaks above). It used to take much more effort to get that low.