apocryph.org Notes to my future self

29May/0918

How to rename the ‘My Dropbox’ folder on Windows

I use dropbox to synchronize key files (like my KeePass databases) between home and work machines.  It works great, except for one thing that I really hate: the Dropbox developers have decided that I cannot be trusted to decide what to call my dropbox folder; only to choose where it goes.  Wherever I pick, the client creates a folder called ‘My Dropbox’ and puts my files there.  But I don’t want that.

In old builds of the client you could choose the name, but despite a number of complaints on the support forums, Dropbox developers have not seen fit to correct this oversight.

I set about to determine where this is stored and how to change it.  I found out the dropbox.db file in my <user>\AppData\Roaming\Dropbox folder on Windows 7 is a SQLite 3 database.  Using a SQLite database GUI I opened it up and found a table called ‘config’, with a value called ‘dropbox_path’.  The value appeared to base base64 encoded.

I exported the column to a file and opened that file in WinHex.  I had to drop an extra carriage-return from the file, then WinHex was able to do the base64-binary conversion.  The path was a little weird looking, with the backslashes escaped as Unicode character codes, but it wasn’t hard to change.  I then re-encoded the file to base64, imported the base64 encoded version back into the column in the SQL database, and voila!

I did have to manually copy over my dropbox files from the previous folder location, but otherwise it seems to work fine.

After I did all that, I noticed in the forums that someone already has a python script to do just that.  Oh well.  I still got the satisfaction of reverse engineering around a stupid limitation in the tool.

What blows my mind is that even after multiple users have written little tools to solve this problem, the Dropbox team still haven’t taken a fucking hint and incorporated back into the client.  If it wasn’t such a cool service I’d quit using it on the basis of that bullshit alone.

26May/090

Results of May 2009 IPSC Shoot at SEG

The scores are in for last week’s IPSC shoot at SEG.  At the time I felt I shot it well by my standards, and the scores bore that out.

In my division I placed 9th out of 24 shooters, with my final score being 61.74% of the first place shooter.  I completely cleaned two of the four stages (meaning, all shots were A zone hits), but I ran them slower than some of the other shooters.

Overall I was 17th of out 42 shooters, and my final score was 60.59% that of the top shooter.  

This compares very favorably to last month’s shoot, which featured a number of long-range stages that brought my score down to less than 40% of the high score, and too close to last place for comfort.  Hopefully next month is more like this one!

Filed under: Uncategorized No Comments
26May/090

Saw new Trek movie (Contains Spoilers)

I broke my own long-standing prohibition on movie theaters and saw the new Star Trek movie yesterday.  I went in with high hopes given widespread praise the film has received, but came out disappointed.

The movie opens with a temporal parodox event that branches the movie on to an alternate timeline, which then gives the film a free hand to ignore all the Trek canon and go in a different and unexpected direction.  While this is at least an attempt to pay homage to existing canon, something the asshat Rick Berman wouldn’t even bother with, it changes the movie completely.  

Going in I expected to see some some additional light shed on the background of TOS crew and perhaps a twist both unexpected and consistent with existing canon.  What I got instead was the groundwork for an entirely new universe of Trek, built on the somewhat shoddy foundation of a heretofore unknown time warp.  Not exactly the resounding reboot of the franchise I was hoping for.

Notwithstanding these structural deficiencies, I found the dialog between the characters to be somewhat formulaic for modern action films, as though the movie isn’t taking itself too seriously.  While I’ve enjoyed many films with this quality, it was overdone for this movie.

Finally, I thought the romance between Spock and Uhura strained credulity, even given the cover of an alternate timeline.

In all this is a disappointing addition to the Trek movie library.  It’s not the worst Trek movie ever (Star Trek: The Motion Picture clearly holds that honor), but it is far from the best.

15May/090

I am now an annual member at SEG

Last week  Ifinally broke down and got an annual membership at Silver Eagle shooting range.  I’ve been going on a daily pass for a while now, and still like it, so I figured $100 and $35/mo is worth it.  As long as I go at least twice a month I’m saving money over the $25/hr rate, and with IPSC going the way it is twice a month is quite doable.

They had previously stopped offering annual passes as a commenter here pointed out, but they opened up the rolls again in advance of the FNH event they had last Saturday.  I got in on that so now I’m set; I don’t know if they still have memberships available or not.

I asked the guy at the front desk about the membership rationing; he said they were looking to cap annual memberships at 500.  While this is good for me as an annual member since it reduces competition for lanes, I don’t see how it makes sense for them, particularly as they’ve already cut their hours across the board.

Now if only I can find ammo.  I’ve already gone through my two cases of Blazer 124gr 9mm, and am starting to shoot through my Lawman.   I managed to pick up a case of 115gr Brown Bear for the low low price of $0.24/rd, but that won’t last long either.  SEG are limiting 9mm to one box per person and charging some ungodly sum for it, so what am I to do?  This ammo shortage thing really needs to clear up.

15May/094

Simulating slow WAN links with Dummynet and VMWare ESX

At work I’m developing a feature that needs to be tested across a variety of WAN links like DSL, cable modems, T1s, T3s, etc.  There are commercial network impairment generators that do this for you, but they’re too expensive to be cost effective.

Fortunately I recalled that FreeBSD includes a module called dummynet, which interacts with the IP stack to queue and drop packets however you want.  Using this in concert with VMWare ESX 3.5, I was able to set up an environment in which two Windows machines communicate with one another through a dummynet bridge, thus simulating any sort of network performance I want.

It was not easy to get going, particularly since much of the dummynet info on the ‘net haven’t been updated to reflect the significant changes in FreeBSD 7.  Since I might want to do this again someday, I’m recording the secret handshake required to get this working.

Setup

The initial setup was quite a PITA, primarily because FreeBSD’s bridging functionality changed drastically recently, and most of the docs on the web are still gears towards the earlier implementation.  However, I finally got it going; the following describes my journey.

ESX Virtual Switches

There’s a default virtual switch, vSwitch0, on our ESX box, into which all VM NICs are plugged by default.  I created another one, ‘Bandwidth Wilderness 1′, which is not associated with any physical NICs.

The Windows VM that will be on the ‘LAN’ is plugged into vSwitch0, and the Windows VM that will be on the ‘WAN’ is plugged into ‘Bandwidth Wilderness 1′ (or whatever you call yours).

Oh, and the promiscuous mode policy for both switches must be Accept, which is not the default.  If you don’t set this, you’ll get some pretty fucking weird ARP resolution problems which will result in some pretty confusing behavior.

Firewalls

To simulate a secure WAN configuration, I’ve enabled the Windows Firewall on both sides, and removed all exceptions but Core Networking and the Visual Studio Debugger stuff.  This will break things like file sharing and pings.  Turn the firewall off temporarily if you’re having trouble with such things.

FreeBSD VM

You’ll need a VM with three NICs.  They will appear in FreeBSD as em0, em1, and em2.  em0 is the one the box will use to accept SSH connections and generally communicate with the network.  em1 will be plugged into vSwitch0 just like em0, but it won’t have an IP address assigned.  em2 will be plugged into Bandwidth Wilderness 1.  Once the VM is configured right, it will bridge traffic between em1 and em2, thereby allowing any VM plugged in to ‘Bandwidth Wilderness 1′ to communicate with anything in vSwitch0 transparently, with all packets running through the FreeBSD machine.  This is how dummynet is able to introduce packet losses and delays.

Custom kernel

You should start with a FreeBSD install that includes full kernel and userland sources, and a full development environment.  Instructions for building a custom kernel are here.  I called my custom kernel DUMMYNET instead of MYKERNEL.  I used the following kernel options in the config file:

options IPFIREWALL
options IPFIREWALL_VERBOSE
options DUMMYNET

I left all the existing options values unchanged.  I then built and installed the kernel per the instructions, and rebooted.

/etc/rc.conf

In FreeBSD much of the service enable/disable configuration resides in /etc/rc.conf.  Here’s what I put in mine (not including default stuff that was already there):

# Enable ipfw
firewall_enable="YES"
firewall_script="/etc/rc.firewall.anelson"

# Set up a bridge beteen em1 and em2
ifconfig_em1=”up”
ifconfig_em2=”up”
cloned_interfaces=”bridge0″
ifconfig_bridge0=”addm em1 addm em2 up”

The above should be rather self-explanatory.  The bridging bit is a little dodgy, but I pulled it right from the if_bridge man page.

/etc/rc.firewall.anelson

The firewall rules I used are stored in a new file.  Make sure you chmod it +x so it’s executable; it is a shell script.  All it does is run ipfw (IP FireWall) to load the rule set which routes the bridged traffic through dummynet:

#!/bin/sh
ipfw -q /etc/ipfw.rules

/etc/ipfw.rules

The actual firewall rules are stored in this file.  It includes all possible bandwidth configurations, all but one of which must be commented out at all times:

#!/bin/sh
#
# These rules control the dummynet parameters which simulate shitty
# WAN links.
#
# em1 is the LAN interface, while em2 is the WAN interface
#
# This config file is set up so that bandwidth from LAN->WAN may be different
# than WAN->LAN, as in the case of an ADSL link
#
# The setup of the rules is pretty simple.  Traffic that comes in on
# em1 is bridged to go out on em2, and traffic coming in on em2 is bridged
# to go out on em1.  Thus, the rules for LAN->WAN traffic are attached
# to traffic coming in on em1 ('recv em1'), and the WAN->LAN rules are
# attached to traffic going out on em1 ('xmit em1').  So even though both
# sets of rules refer to em1, the LAN-side interface, they distinguish
# between LAN and WAN traffic by the traffic direction
#
# This setup is heavily influenced by the 2006-April-07 posting to
# the freebsd-ipfw list by John Nielsen titled
# "Notes on using dummynet with ip_bridge"

flush
queue flush
pipe flush

#
# traffic from lan (em1) to wan (em2) goes through pipe 1
# traffic from wan (em2) to lan (em1) goes through pipe 2
#

# No delay, max bandwidth both ways
#pipe 1 config delay 0
#pipe 2 config delay 0

# SDSL
# 40ms RTT, 0.1% round-trip packet loss, 1536Kbit/s bandwidth
# symmetrical (same both ways)
#pipe 1 config delay 20ms plr 0.0005 bw 1536Kbit/s
#pipe 2 config delay 20ms plr 0.0005 bw 1536Kbit/s

# Long-distance T1
# 40ms RTT, 0.1% round-trip packet loss, 1.5Mbit/s bandwidth
# symmetrical (same both ways)
#pipe 1 config delay 20ms plr 0.0005 bw 1536Kbit/s
#pipe 2 config delay 20ms plr 0.0005 bw 1536Kbit/s

# High-latency T1
# 200ms RTT, 0.1% round-trip packet loss, 1.5Mbit/s bandwidth
# symmetrical (same both ways)
#pipe 1 config delay 100ms plr 0.0005 bw 1536Kbit/s
#pipe 2 config delay 100ms plr 0.0005 bw 1536Kbit/s

# Long-distance T3
# 40ms RTT, 0.1% round-trip packet loss, 45Mbit/s bandwidth
# symmetrical (same both ways)
#pipe 1 config delay 20ms plr 0.0005 bw 45Mbit/s
#pipe 2 config delay 20ms plr 0.0005 bw 45Mbit/s

# 100Mbit local ethernet
# 0ms RTT, 0.0% round-trip packet loss, 100Mbit/s bandwidth
# symmetrical (same both ways)
pipe 1 config bw 100Mbit/s
pipe 2 config bw 100Mbit/s

# Add firewall exceptions for localhost
# Localhost traffic not on the lo0 interface is bogus and dropped
add allow all from any to any via lo0
add deny all from any to 127.0.0.0/8
add deny all from 127.0.0.0/8 to any

# Don't firewall anything on em0 which is used to talk to this box
add skipto 60000 all from any to any via em0

# direct LAN->WAN traffic through pipe 1
add pipe 1 all from any to any out recv em1
add skipto 60000 all from any to any out recv em1

# same as above but for WAN->LAN traffic through pipe 2
add pipe 2 all from any to any out xmit em1
add skipto 60000 all from any to any out xmit em1

#The above 'add skipto 60000' are like goto statements to this rule
#which allows everything
add 60000 allow all from any to any

/etc/sysctl.conf

This file contains overrides for sysctl values, which control various kernel behaviors.  This is what I added to the bottom of the file:

#Only forward IP traffic across the bridge interface
net.link.bridge.pfil_onlyip=1

#Use IPFW for layer-2 filtering
net.link.bridge.ipfw=1

# Got this from BSD list “Notes on using dummynet with ip_bridge”
net.inet.ip.fw.one_pass=0

That’s pretty much it.

Testing

To test this I installed Cygwin on both the LAN and WAN windows boxes, and built iperf from source on them.  I ran this command on the WAN box:

iperf --server --len 1024K

And this command on the LAN box:

iperf --client 10.23.4.86 --time 60 --len 1024K

Where 10.23.4.86 is the IP address of the WAN box.  This sort-of accurately simulates a bulk transfer and shows you how fast it is.  This way you can verify that you set up the dummynet parameters correctly.

Changing the simulated bandwidth

To select the bandwidth configuration to use, edit /etc/ipfw.rules and comment out all the ‘pipe 1′ and ‘pipe 2′ lines except the two that correspond to the bandwidth config you want.  Once you’ve done that, run /etc/rc.firewall.anelson as root and it will apply the new settings.  Always test with iperf after you do this, to make sure you didn’t fuck something up and break network connectivity.

References

3May/096

Getting Mobility Radeon X1800 working under Windows 7 RC1 x64

I’ve lamented before the trials and tribulations getting new Catalyst drivers for Mobility Radeon hardware caused by asshat OEM laptop vendors insisting ATI not release the latest and greatest drivers for the Mobility Radeon GPUs, as ATI does so well with desktop Radeons. As a result, you’re stuck with your OEM’s craptastic two year old driver version.

This gets worse when you’re running Windows 7 x64 and your ratshit laptop manufacturer (Alienware, I curse your name!) offers no more than 32-bit Vista drivers from March 2007.

In the past I’ve used the excellent Mobility Modder to get around this problem, but I ran into a brick wall with the latest Catalyst 9.4 drivers from ATI.  Apparently this has been an issue since Catalyst 9.2.

I tried for literally hours to get Catalyst 9.4 to work.  Usually I’d run the driver installer and it would not detect any ATI hardware, as evidenced by the lack of an ‘ATI Display Driver’ line item in the custom install options.  Sometimes I’d get that to appear and install, but upon reboot the driver would be stopped with a useless Windows ‘code 43′ error.

I finally found a solution that half-works.  I downloaded the Catalyst 9.1 64-bit driver only package for Vista and used the beta version of Mobility Modder to patch it.  Upon doing that, I was able to install no problem.  I still can’t get Catalyst Control Center to install, but I don’t really need that.

Here are the steps in detail, for when I repave this box and need to do it again:

  1. Download the Catalyst 9.1 x64 Vista drivers here
  2. Run the self-extractor which will dump the files in C:\ATI\Support\whatever, but cancel the installer when it comes up
  3. Download and install Mobility Modder 1.1.1.0
  4. Disable UAC.  I thought I could get away with not doing that since this is Windows 7, but until I did the driver package didn’t work right.
  5. Download the updated MobilityDotNet.exe file here.  Open the zip archive and extract the new executable into the Mobility Modder install directory, replacing the previous executable
  6. Run Mobility Modder
  7. Point Mobility Modder to the folder where the ATI self-extractor put the files
  8. Click ‘Modify’ to let MM fix up the MSI and INF files
  9. Close MM
  10. Run Setup.exe in the ATI self-extracted folder
  11. Verify the ATI Mobility Radeon driver was installed
  12. Reboot
  13. Rejoice

This worked for me, when every trick on driverheaven to get 9.3 or 9.4 drivers working did not.  Unless you really need newer drivers, I don’t see it’s worth the hassle.

I’d also like to send out a big, wet FUCK YOU to the assclowns at the OEM laptop manufacturers who created this mess in the first place.  You assholes cost me hours of my life I’ll never get back.

Filed under: Uncategorized 6 Comments

Delicious Bookmarks

Recent Posts

Meta

Current Location