Thursday, August 30, 2012

Get rid of "3 more files to edit" warning in vim

The E173 "... more files to edit" error in vim drives me nuts.  To get rid of it, I added this to my .vimrc:

" Get rid of annoying 'more files to edit' error:
nno :q :qa

Saturday, August 11, 2012

Social status: the underground river

Status is a touchy subject in the West.  We spent a long time believing that nobles were fundamentally better than serfs, and nowadays most overt assertions of authority are considered gauche.  We don't bow to our president, and in most newer business settings we don't even use titles or honorifics: some companies take pride in everyone from janitor to CEO going by their first names.

But that doesn't mean that our society is an egalitarian utopia: parents are legally responsible for their kids, managers are responsible for their reports, police decide whether or not you get a ticket or go to jail.  And we expect people to be fair and judicious and limited in their exercise of authority, and to treat others as equals the rest of the time.  And overall I think that's a great way to operate.

More subtly, though, people also believe in respecting their elders, deferring to people with more experience, respecting "sweat equity", and special statuses like "I was here first".

This leads to a lot of ambiguity.  Should a rookie cop lecture a retired veteran about gun safety?  Should a new manager defer to a senior worker?  There are many stories about incautious Lieutenants trying to assert authority over salty old Sergeants.  Remember, all this has to be resolved without compromising our egalitarian ideals.
Contrast Asian languages, where you literally can't get through a sentence without expressing status!  

In Cambodian, for example, the generic word for "you" is only used in formal documents.  Otherwise it's always "older sibling", "younger sibling", "aunt/uncle", "grandma/grandpa", or a dozen other titles.

The very best leaders are good at keeping everyone pointed in the right direction without ever offending our sense of egalitarianism.  But it's a tough skill to cultivate: I've spent hours writing emails that try to balance a clear vision for how I think things can move forward, and what I need from other people, without sounding like I'm trying to order them around or subvert their own judgment.  Even in writing this article, it's hard to balance conveying my enthusiasm in a confident and engaging way, while still encouraging people to question my assertions and contribute their own insights.

Wednesday, August 08, 2012

Reflective street crystals

One of my favorite pieces of natural urban beauty are these "street rainbows" I see once in a while.

It's caused by a sandy powder on the roads.  I'm fairly sure it's a kind of retro-reflective crystal used to make white road lines shine brightly in car headlights, because as you can tell from my shadow in the photo, the effect only appears when the sun is almost directly behind my head.

Tuesday, August 07, 2012

Kingston v200 series SSDs have problems

From my research and testing, I'm going to be avoiding v200 series Kingston SSD disks.  (But I've had great success with the older v100 series disks).

Users complained about very slow write performance on the disks in the series smaller than 256GB, and Kingston released a firmware claiming to fix those issues, and also claiming that the 256GB disks are unaffected:

I picked up a 256GB unit from newegg (SV200S3N/256G) for $199 and tested it today in several machines.

In my Dell T3500 workstation with an 82801JI (ICH10 Family) SATA controller, running Ubuntu Lucid (10.04) linux, I couldn't get the disk to come up at all.  I got this in dmesg:

[1129999.229709] ata3: irq_stat 0x00000040, connection status changed
[1129999.229712] ata3: SError: { DevExch }
[1129999.229719] ata3: limiting SATA link speed to 1.5 Gbps
[1129999.229722] ata3: hard resetting link
[1130001.452632] ata3: SATA link down (SStatus 1 SControl 310)
[1130001.452643] ata3: EH complete
[1130001.458368] ata3: exception Emask 0x10 SAct 0x0 SErr 0x4000000 action 0xe frozen

Then I switched to another machine running Ubuntu Precise (12.04) with a supermicro motherboard, plugging into one of the onboard SAS ports (looks like Intel ICH10 82801JI).  I tested writing to the bare block device:
$ dd if=/dev/zero of=/dev/sdb bs=8M count=128 oflag=direct

And got 115MB/sec.  On a second run adding a seek=128 flag I got only 54.5MB/sec.  A third run with seek=1024 gave me 91.2MB/sec.  So it's fairly bizarre to see such wildly varying numbers on an SSD, and this is very worrisome.  In dmesg I saw lots of messages like this:
[67334.890127] mpt2sas1: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303)

Then I switched to a port on an LSI SAS2008 controller in the same machine, and consistently got 257MB/sec, which is excellent.

So from my brief testing, it looks like the disks may do okay if you put them on the right sata controller, but have significant and varied problems on other controllers.

Attempting to codify thought

I've been thinking lately that AI doesn't spend enough time trying to understand and emulate what it means to have a Train of Thought, or for that matter, what a Thought is.  So here's my best guess.  The next step is to try actually coding it up.

class Thought {
  // Rises when Fire()d, decays over time
  float activity;
  List(Association): associations;

class Association {
  Thought other_thought;
  float association_strength;

And a specific type of Thought would be a SensoryMemory, a sort of leaf node that has not only associations with other Thoughts but also a certain sensation unique to that SensoryMemory: a particular smell or sound or visual feature.

Sensory input threads: a Sensor is a thread that takes in sensory input and calls Fire() on the corresponding SensoryMemorys.

Thought::Fire() {

Thought::activate() {
  this.activity += approximately(1.0);

Thought::randomly_activate_nearby_thoughts() {
  related = choose_random_related_thought();  // Weighted by association_strength
  if ( >= 1.0) {
    // Maybe the Association threads make this unnecessary?

Association Threads: an Associator looks at active Thoughts and makes new thoughts that tie together chains of thoughts that are all active right now, or associates active unrelated thoughts:

Associate() {
  thought = choose_random_active_thought();
  chain = recursively_find_all_connected_active_thoughts(thought);
  // Associate the new thought with the entire active chain:
  if (chain.length > 1)  create_new_thought(chain);
  else {
    // A lonely thought!  Find it a friend.
    other = choose_random_active_thought();
    add_association(thought, other);

Decay threads reduce the activity level of thoughts over time.

Chaos threads (probabilistically) randomly activate Thoughts.

So your Train of Thoughts is the sequence of most active Thoughts over time.  What's missing?

TODO: perhaps we need some sort of global arousal level that treats pleasure and pain properly, causing us to shrink from pain and seek pleasure.  Or a notion of how much we are seeking: fatigue makes us sleepy, food increases our curiosity.