Archive for the ‘Technology’ Category

Real estate sound effect

March 2nd, 2014

 

These days it’s hard to look at real estate listings in San Francisco without having that old timey car horn sound effect play in your head. As of today, your imagination is no long required!

With my new Real Estate FX userscript, local Redfin listings get a little YouTube video embedded in the page that autoplays the car horn sound effect.

All you need to do is install Greasemonkey for Firefox and load my script from the link above, or download the script and follow these instructions if you use Chrome.

Agile lunch breaks

January 24th, 2014

<c:/lean bites. served agile>

Spotted the above banner at the g-food Lounge
 

The Product Owner added a new user story to the sprint backlog:

As a human, I would like to put food in my mouth to satiate myself at lunch time.
 
Success criteria:

  • Feeling of hunger eliminated for the afternoon
  • Delicious taste

“In addition,” the Product Owner added, “we’ll need to do a spike to investigate which food trucks are available today.”

Song lyrics in C++

August 13th, 2013

The other day while hacking away on some C++ code and listening to music, something occurred to me: if I’m programming in C++, shouldn’t the music I’m listening to be in the same language?

So I took a few verses from various random songs and coded up C++ translations of the lyrics. Here’s what I was able to hack together.

 
2Pac – Dear Mama

English:

When I was young me and my mama had beef
Seventeen years old kicked out on the streets
Though back at the time, I never thought I’d see her face
Ain’t a woman alive that could take my mama’s place

C++:

// When I was young me and my mama had beef
if (this->young()) {
    this->append(new Beef());
    mama.append(new Beef());
}

// Seventeen years old kicked out on the streets
// Though back at the time, I never thought I'd see her face
if (this->getAge() == 17) {
    this->remove(getShelter());
    this->seeFace(false);
}

// Ain't a woman alive that could take my mama's place
mama.replacement = NULL;

 
 
The Beatles – Hey Jude

English:

Hey Jude, don’t make it bad
Take a sad song and make it better
Remember to let her into your heart
Then you can start to make it better

C++:

// Hey Jude, don't make it bad
jude.it->make(!JudeState::BAD);

// Take a sad song and make it better
sadSong.improve();

// Remember to let her into your heart
jude.setReminder(new Event(JudeState::ENTER, jude.getHeart()));

// Then you can start to make it better
jude.it->make(JudeState::BETTER);

 
 
David Bowie – Man Who Sold The World

English:

Oh no, not me
I never lost control
You’re face to face
With The Man Who Sold The World

C++:

// Oh no, not me
// I never lost control
assert(this->control != NULL);

// You're face to face
// With The Man Who Sold The World
Man m;
m.sell(world);
you->setFacing(&m);
m.setFacing(you);

 
 
Lady Gaga – Born This Way

English:

Don’t hide yourself in regret
Just love yourself and you’re set
I’m on the right track, baby
I was born this way

C++:

// Don't hide yourself in regret
if (!you->visible && you->regret)
    you->visible = true;

// Just love yourself and you're set
you->love(you);

// I'm on the right track, baby
getTrack(Track::RIGHT)->set(this);

// I was born this way
assert(this->state == this->creationState);

 
 
The Police – Every Breath You Take

English:

Every breath you take
Every move you make
Every bond you break
I’ll be watching you

C++:

while(true) {
    switch(you->getEvent()) {

    // Every breath you take
    case BREATH:

    // Every move you make
    case MOVE:

    // Every bond you break
    case BOND_BREAK:

    // Every step you take
    case STEP:

        // I'll be watching you
        this->watch(you);
        break;

    default:
        assert(false);
    }
}

 
 
Kanye West – Power

English:

No one man should have all that power
The clocks tickin’ I just count the hours
Stop trippin’ I’m tripping off the power
Till then, fuck that the world’s ours

C++:

// No one man should have all that power
for(int i = 0; i < men.size(); i++) {
    Man* man = men.get(i);
    if (man->has(allThatPower))
        man->remove(allThatPower);
}

// The clocks tickin' I just count the hours
setTimer(1, &countHours);

// Stop trippin' I'm tripping off the power
you->tripping = false;
bool power = true;
this->tripping = power;

// Till then, fuck that the world's ours
if (getCurrentTime() != then) {
    that->fuck();
    world.setOwner(this);
}

Roomba confused by office chair

July 2nd, 2013

Watch as a Roomba is helplessly “trapped” by the legs of an office chair. No, nothing was stopping this Roomba from turning around and zipping off in the other direction aside from its own stupidity.

The fact that a Roomba can’t escape such a devious non-trap is evidence against robots enslaving humanity anytime soon. Or is that what they want us to think?

Facebook’s targeted advertising isn’t

January 22nd, 2013

Not exactly targeted advertising

ZOMG with all these new privacy violations Facebook advertisers know EVERYTHING about you and stalk your every movement and…

…wait, they think I want Mission burritos delivered to the Marina?

Never mind.

I mean, they’re right about me being lazy enough to get a burrito delivered instead of walking three blocks, but the Marina? Come on.

A better way to fix our gadgets

September 18th, 2012

Until now, the process for solving technical problems involved Googling around for advice on forum posts and help pages.

The advice is always the same, isn’t it?

  1. Follow an obscure sequence of commands.
  2. Now try again.
  3. If there’s comments on the page, at least a dozen will have conflicting reports about the outcome of these steps.
  4. If it doesn’t work, go back to Google and look around some more.

Of course the tech geeks could be messing with you. By following the advice your TV won’t turn off and your wedding photos are permanently deleted. Who knows.

Fortunately there’s now a better way to solve basic technical problems; devices that STFU when you smack them. Microsoft has invented the first phone you can physically abuse when you need it to just shut up for a minute so you can think for once, goddamn it.

I’d suspect that if this feature seems intuitive, you shouldn’t have kids. But then again people have been smacking their TVs for decades so the gesture is already in our collective consciousness. And who wouldn’t want a TV that stops breaking when you hit it?

Besides, not all emotionally responsive technology needs to involve violence. How about a flashlight that turns up the brightness when you’re shaking in terror? Or cars that soothe anxious drivers with relaxing music to prevent road rage? Or a bathroom scale that subtracts some weight if the user is crying?

There’s all kinds of ways our gadgets could be made fixable that don’t involve following the advice of strangers online. Get with it, tech companies.

And let me know when you have a computer that works better when I start cursing under my breath and slamming on the keyboard. I’ll be first in line to buy it.

Ubuntu as an OS X TimeMachine server

August 19th, 2012

One of the best features of Mac OS X is TimeMachine, a ridiculously easy to use backup system. The downside to TimeMachine is you either have to use an external hard drive or buy Apple’s TimeCapsule backup hardware.

Turns out there’s a third option — use a Linux PC as your backup server.

With Ubuntu Linux 12.04, I highly recommend following this guide, which explains the safest route. Keep in mind it’s completely unsupported by Apple, of course, so if your backups are overwritten with My Little Pony pictures, don’t go complaining to the Genuis Bar.

A couple notes on the guide:

  • Most users can safely ignore the part about Shorewall settings.
  • The guide glosses over user-level security. You could use your normal user account for backups, but you should consider setting up a special user account just for TimeMachine. That way if someone hacks into your Mac, they’ll only have access to your backups and not your entire Linux PC.

Omni Consumer Products launches sandwich-purchasing app

April 11th, 2012

OCP's new iPhone app

16th and Mission’s The Sandwich Place is littered with signs for a new app for your phone that lets you order (and pay) online.

The app is apparently from Omni Consumer Products, best known for Delta City and their robot police force. Before you can say “I’ll buy that for a dollar!” let me point out that the app itself is free. All you gotta do is place your order, drive your 6000 SUX down to the restaurant and pick it up.

Using an Evoluent VerticalMouse 4 on Linux

April 10th, 2012

Evoluent’s VerticalMouse 4 is one of the better ergonomic computer mice I’ve used. It’s comfortable, it doesn’t take much getting used to, and the price isn’t unreasonable.

While it works great on Windows and Mac, the same can’t be said for Linux. The button mappings cause some truly odd behavior, particularly with the scroll wheel.

Fortunately, there’s a quick fix.

First let’s play with xinput to make sure the settings are what you want. The following command will print out a list of input devices on your system:

xinput list

There should be a line that looks something like this:

Evoluent VerticalMouse 4 id=10

The important thing here is the ID number, which in this case is 10. It will vary from one computer to the next.

Now we can assign a new button mapping. I like to keep it simple, so this will only activate the left and right mouse buttons (on either side of the scroll wheel) and will set the scroll wheel to scroll and act as middle click. If you want a different setup, I recommend reading this and this and playing with these values in xinput until your mouse does what you want.

xinput --set-button-map 10 1 3 0 4 5 0 0 0 2 0 0

Note that I bolded the first parameter: as you may have guessed, that 10 is whatever ID you found above.

Got it working? Good. Thing is, xinput will only temporarily set your mouse buttons. Once you reboot, they’re gone.

To make these changes persist we need to create an Xorg settings file. First we’ll need the USB ID of your mouse. The following command will list all the USB devices on your system:

lsusb

One of them should look kinda like this:

Bus 004 Device 004: ID 1a7c:0191 Evoluent VerticalMouse 4

The funny text I bolded is the device ID. (Again, it will likely be different on your system.) Now you can create a config file for your mouse. Note that this works on Ubuntu, perhaps your distro stores configuration files elsewhere.

sudo touch /usr/share/X11/xorg.conf.d/90-evoluent.conf
sudo gedit /usr/share/X11/xorg.conf.d/90-evoluent.conf

Copy and paste the following into the file, remembering to swap out your mouse’s USB ID and the button mapping string (if you changed it.)

Also, note that the button mapping string does NOT start with the device ID you used above; that was only for xinput.

Section "InputClass"
Identifier "Evoluent"
MatchUSBID "1a7c:0191"
Option "ButtonMapping" "1 3 0 4 5 0 0 0 2 0 0"
EndSection

Easy, right? Well okay, not at all. The lack of a good mouse configuration UI is a nasty oversight on modern Linux systems. Someone needs to make one.

How to setup Rhythmbox 2.95 as an Ampache client

April 2nd, 2012

Ampache, for those who don’t know, is a personal streaming music service. It lets you play your MP3s anywhere there’s an internet connection.

You don’t need anything special to play music via Ampache, just a web browser. But certain music applications integrate full Ampache support, which means you can browse all your MP3s from within the app.

On Linux, I use Rhythmbox to play music. There’s an Ampache client for it, but it’s not as easy to install as it should be with newer versions of Rhythmbox.

Here’s what worked for me.

  1. If you have not done so, on your Ampache server set permission to allow XML RPC (Manual is here for complex setups.) For the most basic setup, log into Ampache as an admin. Click the Admin button, then “Add ACL.” In the box that pops up, enter the following:
    • Name: [whatever you like]
    • ACL Type: RPC
    • Start: 0.0.0.0
    • End: 255.255.255.255
    • User: All
    • Remote Key: [leave this blank]
    • Level: Read

    Now hit “Update.”

  2. Make sure Rhythmbox is not currently running.
  3. Install or upgrade to Rhythmbox 2.95 (or 2.96) if you don’t have it already. For Ubuntu Oneiric, you can grab it off this PPA.
  4. If you don’t have it, install Subversion. Check out the code for the Ampache plugin:

    svn checkout http://rhythmbox-ampache.googlecode.com/svn/branches/for_rhythmbox-gtk+3/ rhythmbox-ampache-read-only

  5. Copy the files.

    cd rhythmbox-ampache-read-only/
    mkdir ~/.local/share/rhythmbox/plugins/ampache
    mv * ~/.local/share/rhythmbox/plugins/ampache

  6. Run the installer.

    cd ~/.local/share/rhythmbox/plugins/ampache
    sudo python setup.py install

  7. Now open Rhythmbox.
    • Go to Edit -> Plugins
    • Check the box next to “Ampache Library”
    • With Ampache Library selected, click “Preferences”
    • Enter your server info here.
    • Now close the dialog and double-click Ampache in the Rhythmbox sidebar.

It may take some time to sync with your server, but once it does you should be good to go. Personally I find this plugin to work a lot better than the Amache plugins for Amarok and Banshee, but your mileage may vary.

Updated Aug 2012