Andrew Clunis

Trending towards more awesome.

Bufferbloat Demystified

This is my attempt to distill the lore of bufferbloat, and describe how you can mitigate it on your network. It seems an appropriate inauguration post for my once-again resurrected blog.

Symptoms

Saturation of network links causes massive amounts of latency and slowdown, particularly on slow uplinks of asymmetric residential internet service (however, it can and does occur on the downlinks of the same). Network applications doing big bulky downloads can cause lots of latency on the network, causing real-time applications (VOIP, gaming, or SSH) to lag badly or outright fail.

Announcing Sharpify

Hey folks,

I’m pleased to announce Sharpify, a type-safe, asynchronous, object-oriented .net 4.5 adapter for the Shopify API, derived from Colin McDonald’s original lightweight dynamic adapter.

In fact, it’s not far off from being an entire ActiveResource equivalent for .net. I may factor the generic bits out into a separate library at some stage.

It works pretty nicely with .net MVC 4, so if you’re in the Microsoft camp and developing a Shopify App, give it a try!

A Reply to Marc Garneau’s Post About Telecom Competition

Marc Garneau just made an encouraging post about freeing telecom markets in Canada. Here’s the comment I left for him:

Hi Marc,

I whoteheartedly agree that free human action in markets is the best thing for our ailing telecommunications sector. CRTC can declare regulation mandating “fair” contracts all day, but in the end government regulation is can only hamper innovation and be wielded as a tool by monopolistic incumbents to prevent competition. No matter how well-meaning, large-scope government control restricts individuals’ ability to solve problems and provides a juicy target for those who want to capture value rather than create it (like our incumbent telecom carriers).

Tony Clement’s decision to override (as Industry Minister) the CRTC and permit the mostly foreign-funded WIND/Globalive Wireless (and DAVE/Moblicity, as well) to purchase spectrum access in Canada at auction has already given us a taste of what competition in freer markets can do. Of course, specific access granted to one company is still not a great example of a free market, but it was still a step in the right direction. WIND is awesome: it has simpler contract agreements, simpler amortized-over-contract phone financing, excellent data plans, and decent customer service. As a younger carrier, it has less overland penetration, but that will steadily improve as they earn enough profit to justify expanding their network.

It is worth noting that the CEP union is lobbying against freeing of telecom markets (alongside Bell, Rogers, and Telus), as political special interest group that stands to continue benefiting from government control of the telecom industry. Watch out for these guys and their misleadingly named “Own it!” campaign.

PS. However, I would like to make one remark about your other comment stating support for government regulation of broadcaster ownership in order to attain Canadian content production for cultural objectives”. I suggest that it is more effective for individual Canadians to decide which sort of content they value (and gaining access to their valued content grows ever easier, entirely thanks to technological improvements that markets deliver). Lots of us value home-grown Canadian talent and content, but we shouldn’t impose our choices on other Canadians.

Cheers!

Getting Power Button Events With HAL

I needed to teach the product I’m working on about the ACPI power button, so fired up dbus-monitor –system to see what events I get when the button is pressed. It was easy to find the device in question in d-feet afterwards. Unfortunately, the HAL device objects (/org/freedesktop/Hal/devices/computer_logicaldev_input_N) that emit the events change between machines and even between reboots, so it’s necessary to properly discover it.

This little spike solution prints out messages to stdout whenever certain special ACPI keys on your keyboard are pressed (on my Lenovo ThinkPad T61, it shows the power button, the volume buttons, the Fn-key chords for changing backlight, etc.):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gobject
import dbus
import dbus.mainloop.glib

def getButtonCondition(event, btn):
    print "Event: %s, arg: %s" % (event, btn)
    mainloop = gobject.MainLoop()

dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()

hal_manager_proxy = bus.get_object('org.freedesktop.Hal',
                                   '/org/freedesktop/Hal/Manager')

hal_manager = dbus.Interface(hal_manager_proxy,
                             dbus_interface='org.freedesktop.Hal.Manager')

button_paths = hal_manager.FindDeviceByCapability('button')

button_proxies = []
buttons = []

for p in button_paths:
    button_proxy = bus.get_object('org.freedesktop.Hal', p)

    button = dbus.Interface(button_proxy, dbus_interface = 'org.freedesktop.Hal.Device')
    button.connect_to_signal("Condition", getButtonCondition)
    button_proxies.append(button_proxy)
    buttons.append(button)

mainloop.run()

So, How Much Does Vista’s UAC Really Solve?

So, I was hacking on some code on Windows the other day. The DRM for a piece of proprietary software I had a legitimate license for wasn’t working, and thus I had to seek out some… licencing facilitation software. Since such software usually originates from the sketchier regions of the Internet, I ended up infecting my copy of Vista with a trojan horse. That’s one demerit point on my Geek Licence!

Here’s the manifest from the executable:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="1.0.0.0"
     processorArchitecture="X86"
     name="Installer"
     type="win32"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="asInvoker"
          uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

For those without Windows-fu, the manifest is basically a PE resource containing some XML metadata that describes the executable. They first found use with the release of XP, where they were primarily used by software developers to ask Windows to dynamically load version 6 of the Common Controls library (which also saw its debut in XP) instead of the venerable version 5. The practical upshot of all this was that it gave you the nice new Windows themed controls, without any ABI changes. Microsoft obliged developers to explicitly specify their desire for version 6 so that they could basically ship version 5 as is, to avoid any compatibility issues.

Returning to the trojan hourse, I assume they were trying to intentionally prevent Vista’s UAC feature from asking the user for extra permissions. This actually makes sense because most malware authors’ goals do not include completely compromising the user’s machine, but rather the purpose of creating botnets, which don’t need administrator access to commit their nefarious deeds. All they need to do is stay resident and use the network, all of which the regular Windows limited account allows them to do.

Setting Emacs 22 for Windows’ Font to Consolas

Emacs 22 for Windows, unlike its X11 counterpart, supports anti-aliased TrueType fonts.

Thus, it looks much better if you set it to use the shiny new Consolas monospaced font included with Vista (or indeed, any other TrueType font you care to use):

Add this to ~/.emacs:

1
2
(set-face-font 'default
"-outline-Consolas-normal-r-normal-normal-15-112-96-96-c-*-iso8859-1")

It Lives!

My broken-yet-cached copy of Mephisto has been repaired. Turns out it was frozen to an old version of Rails, d’oh!

(it had also gotten stuck half way between two migrations)

Zimbra

So, I’ve finally set up Zimbra, after a bit of equivocating on whether to use it in the first place.

It’s really slick; imagine a Free Software[1] replacment for GMail, Google Reader, and Google Gears, along with all the enterprisey management stuff that the likes of Active Directory/Exchange, Groupwise, and Notes have. It takes care of all the thorniness of setting up a the Postfix MTA, and gives you advanced calendaring features (and it can sync up with webcal ics calendars, too!).