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.