Wednesday, 23 February 2011

Mere globs of gas...

Poets say science takes away from the beauty of stars -- mere globs of gas atoms. Nothing is "mere". I too can see stars on a desert night, and feel them. But do I see less or more? The vastness of the heavens stretches my imagination - stuck on this carousel my little eye can catch one-million-year-old light. A vast pattern -- of which I am a part -- perhaps my stuff was belched from some forgotten star, as one is belching there. Or see them with the greater eye of Palomar, rushing all apart from some common starting point when they were perhaps all together. What is the pattern, or the meaning, or the why? It does not do harm to the mystery to know a little about it. For far more marvelous is the truth than any artists of the past imagined! Why do the poets of the present not speak of it? What men are poets who can speak of Jupiter if he were like a man, but if he is an immense spinning sphere of methane and ammonia must be silent?

-- Richard Feynman

I'm reading The Feynman Lectures on Physics and had to stop and share this quote. It's so perfect.

Saturday, 19 February 2011

Make it easy to be good

I'm trying to be good these days and eat a healthier diet. But doing it "the hard way" is just as difficult as going cold turkey. So I've been trying to find ways that actually make it easy to eat a healthy diet.

One way I'm doing this is through Riverford farm[1] - they deliver a box of fresh fruit and veg to your door once a week (or once a fortnight) for the same price (and much better quality) that you get in the supermarket.

I find that cooking then becomes a surprise instead of a drag. It makes eating your vegies a little bit fun. "What am I going to cook today? Lets see, what do we have here in box number 1?" :)

Something as simple as this helps with inspiration - which is often the only kick-start you really need. But I don't underestimate the "it's delivered to your door" aspect... No fuss, no muss. It really helps make it easy to be good.

On a similar vein, I also get myself graze.com[2] boxes twice a week. They send out a box full of delicious nibbles, randomly chosen from items that you've already rated as something that you've liked. It's novel, it's fun, it's generally pretty healthy. It's enough to eat for lunch and much better than the local greasy-spoon. ...but I don't do it every day, so I don't feel like I'm starving myself or denying myself all of life's pleasures. They also taste delicious. So it doesn't feel like I'm doing any stringent dieting.

Again - just making it easy to do yourself a little good.

How does this apply to programming?

Well, there are heaps of things we *ought* to be doing. Testing, code reviews, refactoring... But somehow it often seems like this stuff just never gets done.

In these cases, it really helps to make it easy to be good.

In my case, I've picked a language and framework where testing is assumed to be done as the default case. It's really easy to do proper testing in Rails. More than that - you're looked-at funny if you don't... like you're actually doing it wrong. So tests, in Rails, tend o get written more often than in other languages (where you often have a hard time justifying to people why you've got to write them).

Once you have tests in place, it's really easy to refactor - because you can do it, knowing that you have a comprehensive test suite to catch you if you break something - gives you the confidence to get it done.

and code reviews? well - if you've been regularly refactoring, then you won't be as ashamed to show off your code to other developers... because it won't be a horrible, hard-to-grok mess... and that makes it much less likely that the code reviews will be put off due to it being "too hard"

Each little step makes it easier and easier to be "good", which makes it far more likely to actually *happen*.


Notes:

[1] Riverford farm only deliver to the UK - but I strongly recommend them - I've been eating their small fruit+veg box once a fortnight (which is enough for just me), and they're always fresh and yummy.
[2]graze.com The graze link is an affiliate link - it will give you a free box so you can try it out yourself. Normally they're around £2.99 each. They ask for a CC to register - but it's easy enough to cancel.

Friday, 11 February 2011

Blind spots

Some people like to hang dingly-dangly things from their car-mirrors.

I always thought it was a bad idea, and it took a little reflection to figure out why.

If you get used to seeing something swaying back and forth in a certain sector of your vision, eventually you learn to ignore movement in that sector. This means that if/when the Bad Thing happens - and suddenly there's an accident happening right in that spot... it takes longer for you to recognise, and react to that accident, because you've learned to ignore stuff happening there.

Well - I was thinking recently about things that were less obvious. Things that I'd put somewhere in my life for amusement value - or even for a good purpose... but which are also serving as a blind-spot. As a place where I "should ignore what's going on".

One of those spots (for me), is in "standing up for myself".

You see, I'm a geek... but more than that, I'm a geek *girl*. I engage in activities that are traditionally considered the province of males... and I get funny looks for doing so. Not from everybody, but enough that I've had to continually resist assumptions (and even outright contempt) all my life.

For years, I've had to work *very* hard to stand up to people that treat me like some kind of weirdo for actually having an interest in things like science, maths, science fiction, martial arts, role-playing games... the list goes on.

I treat any criticism of my choice to pursue these interests as an infringement of my individual rights... and rightly so. It's my business whether I enjoy these things or not. Your opinion does *not* count.

But I've come to notice that it does lend me to have formed a particular blindspot. It's the "don't infringe on the way I do things" blindspot.

I find I'm quicker to resist, to stand up and fight-back, to take offense at people that try to press the boundaries of "the way I do things".

Needless to say, this heuristic can sometimes be misapplied.

After all, I am not perfect, and the way I do things can very well be stupid, wrong or otherwise detrimental to the health and happiness of other people.

But when I'm "called" on it - I currently still have to fight the impulse to fight back. To resist because "I have the right to do my things my way"... and sometimes I lose that internal fight.

So - if I've ever done that to you - my apologies. I'll try to do better next time.

Sunday, 6 February 2011

gotcha: Unpacked gem in vendor/gems has no specification file.

Ok, this one had me stumped for a little while. When I was running rake, I'd get these warnings:

  config.gem: Unpacked gem difftmp in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
  config.gem: Unpacked gem difftmp in vendor/gems not in a versioned directory. Giving up.

I'd seen this one before - when I'd thoughtlessly unpacked a gem into vendor/gems, then patched it. But for some reason rails doesn't like it when you unpack gems without using rake gems:unpack. I've never been in the habit of using that, because I didn't want to unpack everything. Later, of course I discovered that you can pass "GEM=blah" and it'll only unpack a single gem... but I thought I had done I this time around...

So I blindly followed the instructions to run rake gems:refresh_specs

However, that then spewed on me with an equally-familiar exception message:

rake aborted!
undefined method `installed_source_index' for #<Gem::SourceIndex:0xb76aa218>
... much stacktrace garbage follows...

I sighed deeply and googled the exception... to get the usual suspects, which suggest that I need to refresh the specification file. So I went back to the original error message to see which actual gem was causing the problem.

... then stopped.

You see it became pretty clear that I'd never actually *read* the original error message. "difftmp" is obviously a temporary diff-file showing me the patch I'd made on one of the gems. Now, you could argue that rake shouldn't be stupid and assume that a flat text file is a gem (requiring a specification)... but it was then also quite clear what to do to fix the "bug".

rm vendor/gems/difftmp

Problem solved

Friday, 4 February 2011

assert_difference for any value

I like assert_difference. It does exactly what it says on the tin - and in a nice, rubyish way.

However, I noticed that you can't assert a difference in something that isn't numeric. You can assert that creating a Customer will change the Customer.count, but you can't assert that updating the customers name will actually change the customer's name. Or, conversely, that updating a customer's name with *bad* data *doesn't* change the customer's name.

In my mind, it shouldn't really matter if the thing doing the changing is an int or a string or some complicated object. If the changing-thing responds to "==", you should be able to check if it changed. As long as you don't actually care what the exact change is that occurred - just whether or not a change *has* occurred.

So I wrote one that did.

assert_any_difference/assert_not_any_difference

Example tests. Note that you can pass a whole array of tests. These should nest, just like assert_difference

    should "not change anything if the account is active" do
      @cr = customer_records(:active)
      assert_not_any_difference ['@cr.customer_number', '@cr.is_active'] do
        assert @cr.register!
      end
    end
    should "update active status if registering a non active customer" do
      @cr = customer_records(:in_active)
      assert_not_any_difference ['@cr.customer_number'] do
        assert_any_difference ['@cr.is_active'] do
          assert @cr.register!
        end
      end
      assert @cr.active?
    end

And the assertions. You'll need to add these to test_helper.rb

  def assert_any_difference(items, &block)
    actual_diff(false, items, &block)
  end
  def assert_not_any_difference(items, &block)
    actual_diff(true, items, &block)
  end

  def actual_diff(test_if_equal, items)
    # save the old values
    old_vals = {}
    items.each {|item| old_vals[item] = eval(item) }
    # run the block
    yield
    test_fn = test_if_equal ? :assert_equal : :assert_not_equal
    # check each one
    items.each do |item|
      new_val = eval(item)
      send(test_fn, old_vals[item], new_val, "should #{'not' if test_if_equal} have been a difference for #{item}, but had: #{new_val}")
    end
  end

Wednesday, 19 January 2011

Rails namespacing test gotchas

We have some controllers that are namespaced as Admin controllers eg: Admin::ProductController.

...and this is a legacy system, and never had any functional tests created for those...

So I was trying to get started on adding some functional tests. I created a test/functional/admin folder, then added a product_controller_test.rb under that, with the usual:

class ProductController < ActionController::TestCase

At first, the tests wouldn't even load properly, and I was getting the following error:

uninitialized constant ActionController (NameError)

That, apparently, is solved by explicitly putting:

require 'test_helper'

at the top of the file. After which it loads fine, and the null-test runs. but after that, I kept getting the following error:

RuntimeError: @controller is nil: make sure you set it in your test's setup method

It seems that you need to namespace your tests too, so instead of the class declaration I have above, you need:

class Admin::ProductController < ActionController::TestCase

The admin folder isn't enough.

Sunday, 16 January 2011

Link: Building mazes with Ruby

JamisBuck has started writing a whole bunch of posts on techniques for maze generation, with examples in Ruby.

It's a fascinating read, and I love the little javascript visualiser for the technique (pretty!).

His idea is that maze-building algorithms are a great way to learn a new language - small projects, but fascinating. I agree.

Friday, 14 January 2011

Bosses prefer overconfidence to accuracy

Well, this should come as no surprise, but it's confirmed that bosses prefer overconfidence to accuracy when asked for estimations.

I've spoken before about how I personally prefer Truth over Harmony, with estimation as a prime example. Mainly because, when it turns out that an estimate was inaccurate... you know who's going to get the blame for "coming in late".

And yet I've found in the past that if I try for accuracy, the truth is taken as "pessimism" (by comparison with the overconfident, optimistic estimates given by others).

What I found particularly scary (and accurate) was the final quote of the article:

"Thus bosses of software managers take accurate estimates to be a signal of a lack of competence."

This is not how the world should work :(

Friday, 7 January 2011

Seven signs your company is really a cult

I just read this article on signs you might be in a cult and Eliezer Yudkowsky's article on cultish countercultishness (where he discusses the cultishness of all groups of humans, and a few theories on how to fight against it happening) and realised that most of the places I *didn't* like to work in - displayed strong cultish tendencies.

Here's a list of the common tendencies I noticed in companies I didn't like working for:

1 - Hierarchical authoritative structure

While hierarchy is inherent in almost all businesses, it was particularly strong in the ones I didn't like working for. What got me was the fact that these companies *stressed the importance* of the hierarchy - ie, the higher up you were, the more important you are and the more you should be faithfully obeyed, rather than, say, the more responsibility you were taking onto your shoulders.

I follow the spider-man principle that "with great power, comes great responsibility"... rather than "with great power comes greater ability to boss everybody else around".

Of course, exaggerated hierarchy goes hand-in-hand with "exaggerated adoration of the respected leaders" (one of the cultish-signs in the articles).

I find this especially the case in companies with strongly charismatic CEOs (or even just one or two managers). Especially so if they can name-drop other big names of the business world they've worked with/for (whether human or corporate)

When you start feeling that you cannot criticise anything that the CEO/manager says simply *because* he's your manager/CEO - then something is rotten in the state of Denmark.

Nothing is absolute - even the perfection of "our great leader". Everybody has faults, and everybody has the potential to learn, yea even from the mouths of babes. So when people are literally told off for having the gall to question "orders from above", you've got something fishy going on.

Sometimes, this idea can affect the whole company:

2 - Absolutism about the company

Either you adore the place with tears-of-joy staining your face, or else you're suspect, "not a team player".

How do you expect the company to improve if you start from a position where everybody must repeat the mantra "the company is perfect and can do no wrong"?

Unfortunately, I've seen this particular problem run hand-in-hand with the next one:

3 - Total immersion

Absolutism can be taken to a personal extreme when you get the sense that you are being told that you are a better person, the more you do for the company. If you spend all your waking hours at work - it shows how virtuous you are, how much of a "team player"... conversely, if you show yourself to be less than ecstatic at a chance to work unpaid overtime, then you must be "not a team player", and thus are suspected of being against the company (somehow)... rather than just, say "a normal person who likes their homelife".

4 - In-groups vs out-groups

AKA "group members encouraged to distrust outside criticism as having hidden motives"

While all companies will of course have in-groups (ie members of the company) vs out-groups... some companies go on to demonise those in the out-groups. I've noticed two obvious groupings that fit in this category:

4a - The inter-company version

"We're much better than *that* company - our competitor over there... everyone there is evil... I mean, they create poor quality products, are trying to take our profits away from us, and are bad for business. They are out to get us! We must beat them and laugh in their faces!"

IMO it is not necessary to demonise your competitors to deal with them. They are just trying to get along in the world, just like "our" company - so they are quite deserving of being treated with the same respect that we'd like to be treated. For example, one should not take every opportunity to take advantage of them. It is certainly not necessary to revel in (or even to actively bring about) their destruction.

4b - The intra-company version

See also: "absolutism about the company" and "total immersion". Especially the use of derogatory phrases for out-groups such as "not a team player".

I've worked in companies where people that resign (even on good terms) are considered to be traitors. Yes, literally traitors, as though you are betraying the trust invested in you by the company. Sometimes they are treated as having taken advantage of the company for money (as though the company did not receive equal value for said money). If you're still working in that company, you're no longer allowed to associate with the "traitors" without also being tainted by the brush of distrust.

Clearly this is pathological behaviour.

In my opinion, healthy companies respect the fact that you are a person first, and a company-member second. People leave companies for reasons other than "betrayal" - and that should be respected, in the same way that an amicable split-up can occur.

Some (good) companies even go on to actually care about what happens to you *after* you leave the company - for example, the well-known google alumni program.

Still, the cultish companies tend to view this as a thought-stopper. If you leave the company, you are now part of the out-group and, by definition, evil. You are simply not allowed to think about it in any other way, or else you are also suspected of being part of the out-group.

Other ways of thought-stopping are inherent in:

5 - Thought-terminating cliches

Some companies are full of these. There are many things that you are *not* allowed to think. Taboos that you shouldn't break or be stigmatised, and they are often hidden behind a cliche that is intended to stop thought in the matter.

The best (general) case I can give is that of "the way things are done here". If this is uttered by anybody at your company, it is intended as a way to stop you from continuing the discussion. It's a big, flashing sign that says "Just don't go there". Trying to show the limitations of such taboo areas just puts you under suspicion.

IMO this is not a healthy attitude towards your company. If you have things that "are just the way we do things here"... then the question naturally arises as to *why*, and whether or not there might actually be a better way. Sure, we shouldn't needlessly poke holes in everything for the sake of it, but somebody asking why things are the way they are isn't trying to tear everything down.

It's also perfectly reasonable to answer the question with "well, it's not optimal, but the time it'd take to change it would outweigh the benefits gained".

That would be an honest answer, and would actually answer the question, instead of "Just don't ask alright?"

6 - Isolation from people not in the in-group

Not as common, but some companies try to keep everything in-house. I've found that the more cultish companies are more likely to look at you strangely if you decide to take lunch outside (you know, with regular people, instead of just with your team-mates every single day of every week...).

I find that this one tends to lead on from strong inter-company in-groupishness. ie, if you view all outsiders as suspect... then anybody that associates with outsiders must also be suspect.

It's also related to the "total immersion" idea. If you truly are a "team player", then surely you want to spend all your waking hours at your beloved company, rather than going out and having a break.

7 - All forms of individuality must be de-emphasized

This is more about the fact that individualism is actively quelled. If you're in a company where the only individual expression you are allowed is in what photo to sit on your desk, and what the trite saying is on your coffee-mug... then you're in trouble.

Cubicles, rules about personal items and the wearing of business-attire certainly all contribute to quelling individuality, but even if these are not present, individuality may be de-emphasised in purely psychological ways.

There are even interesting-but-weird cultural forms of this effect where you are expected to share the passions of your colleagues regardless of whether you, say, don't actually enjoy watching sporting events in favour of reading physics textbooks... or prefer to spend your lunchtime reading rather than discussing said sporting-games (or hairstyles and office gossip, in the case of one set of women I worked with).

It's ok to invite team-members to join into these activities. It's *not* ok to treat people as pariahs if they choose not to participate.

I've even had one company tell me off at my annual review because I wanted to abstain from the company "tipping competition"... regardless of the fact that I have no clue about the sport in question (I was advised to choose randomly... and that <the secretary> had found this strategy very effective to win.)

The most insidious individuality-repression I've found is with excessive worship of groupthink. Where you are expected to agree with all the decisions of your colleagues - and dissuaded from (or actively told off for) finding flaws in "the plan". This especially occurs in conjunction with leader-adoration.

I've spoken about the pitfalls of this in The two faces of optimism.

But it's all just a game isn't it?

Now, I recognise that even in the companies that inculcate these tendencies, the actual people involved (at least at the lower levels) realise that it's all kind of a game... That you don't have to actually *believe* any of this bullshit - just to play along and pretend, in order to "win".

but my response is: why do we have to pretend?

Surely it'd be healthier (for all of us) if we just admit that it's all bullshit and get on with actually enjoying our life?

Especially when a lot of the things we have to pretend actively work against you.

I do not want to pretend that I love unpaid overtime - because I actually hate it - as do most people in the vast majority of jobs that exist in this world.

I really do have better things to do than marching up and down the square... and I think that everyone can actually come up with something or other they'd rather be doing with their life. So why go through the charade? Why force me to lie to you about it? What does that gain?

There are actually companies that don't.

They are unfortunately few and far between... but they do exist.

I've noticed that smaller companies are actually far less prone to cultishness. Perhaps because there are so few people that everyone's more accountable, perhaps because they're too new to have an ingrained cultish culture... I don't know.

There are also companies who have purposely adopted a culture that leads to a good work-life balance.

I do like Eliezer's Cultish countercultishness post because it gives a good overview of the problem (with reference to his particular group), with the final moral being that almost all groups have a tendency to cultishness... that you have to actively work against these natural tendencies to make sure you don't fall into the trap.

So, in short, if you're in a company that is not cultish - my advice it to work hard to make sure it stays that way.

If you find that you are in a company that is irreparably becoming a cult... look elsewhere.

Saturday, 1 January 2011

Link: How to ask a blogger for backlinks

An excellent new post on kissmetrics about How to ask a blogger for backlinks and reviews.

It gives some great tips about how to be professional and non-spammy, and stands in stark contrast to my own recent experience.

...and no, they didn't ask me to write this :)

Thursday, 30 December 2010

Simple private messaging

Ran across this plugin the other day. It gives you very simple, private messaging for Users on your app.

Needs some fiddling to make the messaging private - otherwise anybody can read anybody else's message... but otherwise, pretty neat. It basically does most of the heavy-lifting for you, and lets you get on with the customisation... which is the point of using other people's plugins.

Friday, 24 December 2010

Gotcha: db index name must be a string

Might just be Rails 2.3.8 - an exception is thrown whenever I use a symbol for an index name. I get:

rake aborted!
An error has occurred, all later migrations canceled:
undefined method `length' for :my_index_name

The code causing this would be something like:

add_index :widgets, [:colour, :weight], :name => :index_by_colour_weight

it’s solved by just using a string instead:

add_index :widgets, [:colour, :weight], :name => 'index_by_colour_weight'

Sunday, 19 December 2010

Dosbox and old games

So... my favourite game of all-time is still X-Com: terror the deep. I've been playing it off-and-on now since it first came out 15 years ago.

It is a game with extraordinarily long game-play time. Come to think of it, I think I still haven't actually completed a game yet... it takes months of gameplay to complete... but it's still fun enough that I like to play it anyway.

Now, the thing is, it's a really old game now - it's a DOS game that was able to be played on the then-new Win95... but it hasn't transferred well up the line. I've had to keep around an old laptop for the precise (and only) purpose of playing this game.

For obvious reasons (including the bulk of said ancient laptop), I did not bring that laptop with me to the UK. Which means that I've been deprived of my favourite game for some time.

Lately, however, I learned of Dosbox - which I can now rightly praise as an awesome DOS emulator that actually works on Linux (as well as other, lesser O/Ss). ;)

I had some issues with getting the game to play and save - before realising that I hadn't properly "installed" the game before trying to play it straight of the CD - and thus it didn't have write-privileges, causing it to fail to save a game... or to write the sound-file etc.

but after I figured that out - it's worked just fine. Awesome!

Monday, 13 December 2010

The perils of pagerank

Now that RubyGlasses has gained a bit of PageRank, I've noticed a marked increase in the amount of people emailing me requesting "Link swapping".

I've generally been deleting these along with most of the spam... google doesn't like linkswapping, and I won't do it. (all hail oh mighty google!)

However, I've also received one or two offers of advertising... and, to me, that's different. I'm happy for an advertiser to pay me to put ads on my site that are relevant to my audience.

However, after a recent email-conversation, I now have to make it clear to potential advertisers that these ads are going to be obviously ads.

I will freely confess that I don't get very many offers of advertising. I've had two so far... one that I've accepted (see if you can spot them) and one that I have most definitely not.

The first did want me to *not* use certain ad-like keywords in proximity to their ads... no doubt they're after a bit of my pagerank "link juice" as well as the actual click-throughs that are likely to accrue (yes, I actually asked them about this). That was ok to me, as long as it was obvious to my readers that what was going on was actually an ad... ie paid-for content inviting people to purchase something.

The reason I turned down the second offer, however... was different. In fact, I didn't even need to turn them down - just stated what I was and was not going to do.

The second exchange began with an offer to "have cooperation in marketing". I'll admit that maybe I didn't completely read the email in question because it also explained that they expected me to "add our product information with links to < thecompany > on your blog"... I read this and thought "advertising"... but in the following exchange (I asked if that's what she meant), discovered that she expected to write articles about her products... and put them on this blog.

After explaining that I write my own articles she responded with (and I paraphrase) "Oh ok, so *you'll* write articles about our products on your site, and put links to our products"

I had to then explain that I write articles about Ruby-on-Rails or web-development or freelancing... if her products were relevant to that then I might write an article on them... but I would *not* promise to be favourable.

She then responded with a "suggestion":

I have read your email, I have one suggestion, how about we write articles suitable for your site, and you put it on your site. We can also pay for you on adding them, but how much per article will you charge?

I mean, what does it take to get through to these people? My final email to her reminded her that I write my own articles, and that I will happily post paid advertising at the bottom of my articles - and that she could even dictate the text of the advertising... but that I would not post fake articles written by somebody else about her products.

She said she'd stay in touch...

Saturday, 11 December 2010

NaNoWriteOff

*sigh* I admit defeat.

Though I've "won" three years in a row, this year, I quit after a week... it's kinda sad, but I felt it was a necessary decision.

After a week of the usual noveling, I realised I had so many other commitments this year that one more was really piling on the stress a bit too thick. I weighed up whether or not I needed to complete this one time - and decided I didn't need to prove to myself that I *could* finish a novel as I've done it three times already.

So, for the first time since I discovered the wondrous new world of NaNoWriMo, I failed to finish.

I'm sad about it because this year I actually had a full plot. Most years I just began with an idea and a few characters... It was a Romance (I try a new genre every year) - which lent itself to easy plotting... but I realised a week in, that I just wasn't satisfied with that, and had already begun to add action/adventure elements (the hero was captured by desert pirates... leading to a chase...).

In any case - it'll be there, waiting for me in January - when hopefully I'll dig up a bit more spare time.

Wednesday, 8 December 2010

Less Wrong: the art and practise of Rationality... and Harry Potter

I just found an amazing website that basically constitutes a broad exploration (with much discussion) on the art of "being less wrong".

What's interesting is that I happened upon it because my sister pointed out to me the most interesting Fanfic I've ever read: Harry Potter and the Methods of Rationality.

I don't read fanfic, as a general rule... it's usually just somebody's personal fantasies, and almost never as good as the original fiction.

But this one had me hooked from chapter one. It seems to constitute a kind of course-by-example into the Art of Rationality. No doubt more poignant if you've actually read the original, but fascinating none-the-less. Try it and see for yourself.

If you're not into fanfic at all - then feel free to cut to the chase - skip it and go straight to the Less Wrong wiki.

All this stuff is brought to you by the Singularity Institute which is dedicated to making sure that the predicted technological singularity is Friendly, rather than unfriendly, towards us mere mortals. Less Wrong was created in order to build a community of rationalists that would be able to improve the world in general (including, but not limited to the singularity). The soundbite mission statement being raising the sanity waterline

Thursday, 2 December 2010

I'm not a militant feminist

I assume non-gender bias at the start; I don't care what pronouns you use, and most of those "war of the sexes" ads are just plain funny.

Which is why I was totally surprised by an ad I saw today which suddenly made my "feminism" detector spike off the charts.

I can't find a pic of it online, so I'll have to describe it.

It's for some kind of smartphone.

A smug-looking geek-boy is standing there, with a gorgeous-looking girl with her arm wrapped around him.

The caption: "It's about how smart you are".

...

In case I need to state the obvious - clearly, being totally smart means that if you're a smart guy you get the hot-looking bird... but what makes him look smug is just as clearly *not* about how smart she is.


Disclaimer...

I like geek-boys, and for me it *is* more about how smart they are... but I'd hope that for the geek-boys it'd be about how smart *I* am too!


On further reflection, I think I'd be almost as scandalised if the ad showed a smug geek-girl with an Adonis draped over her.

What mostly annoys me is that it implies that the main benefit of being smart is to be able to entice the beautiful people to hang with you despite how plain-looking you are. In other words - even though it says it's about how smart you are... it's still about how pretty you are... :P

Tuesday, 30 November 2010

Gotcha: heroku with git+svn pushes your working copy

For the MatchFounders website, I've been working with svn on Heroku using git just as a deployment tool... and I came across a bit of a gotcha the other day.

git commit will add your *working copy* to your next deployment.

Luckily it didn't turn out too badly for us - I was just mucking about with some pagination links... and quickly fixed the bug I'd been working on before deploying again... but if I'd been right in the middle of some big hairy code refactor, or something... I'd have had to go find heroku's docs on rollbacks pretty darn quick.

So - just be aware that if you use this method, to add a step to your process-control to make sure you only deploy from a 'clean' working copy.

Tuesday, 23 November 2010

Ruby median

Was trawling through the google analytics search keywords and noticed somebody was looking for an Enumerable#median method when they came to this site. Got me thinking...

I went googling for solutions and found that some of them were just plain wrong... can't have that.

module Enumerable
  def median
    # trivial cases
    return nil if self.empty?

    mid = self.length / 2
    if self.length.odd?
      (entries.sort)[mid]
    else
      s = entries.sort
      (s[mid-1] + s[mid]).to_f / 2.0
    end
  end
end

This one isn't the most time-efficient (the sort can get long). I'd need to implement the selection-algorithm for the most optimal solution... but it'll do for a quick fix. I'll post again here if I get around to the better one.

Friday, 19 November 2010

MatchFounders hits 500

MatchFounders.com hit its first milestone today: 500 registered members. I'm pretty pleased with that, seeing as how it's been a part-time on-the-side project that started on what's basically a hackfest.

Still got heaps to do before it becomes a world-dominating site, of course... but I'm pretty happy with that amount of activity after only a month and a half. Enough to post about it on the matchfounders blog... along with our upcoming dastardly plans.