Friday, September 04, 2009

A few weeks back a lady from the BBC was interviewing us at Dana Street.

Well, I finally got a chance to listen to the blog post she made. I learned a little about the area myself so thought I would share it. In particular, there is a wonderful interview with some of the Olsons. Here it is. Have a listen. (Update: looks like the podcast download is broken. Reported it. I'll update this if I can find a fixed link.)

It reminded me how lucky I am to have been brought up here.

I may complain that it is impossible to find enough Obscure Sports in Silicon Valley to fill a quarterly blog post, but no one will stop me from making my own. Incidentally, after doing a little research, I have to say that San Francisco's little pinky toe forgets more about obscure sports every day than Silicon Valley ever knew.

Listening to that interview might also make people who grew up here a little sad considering what has been lost in the area.

I'm still finding cool things here, and I took some pictures of one of them. The Palo Alto Electric Car Show is held at Palo Alto High School every year, and for the last three or four years I have remembered to go. It's about 75% homemade vehicles and 25% commercial stuff, and there is always a test track where you can play with the smaller/slower things, like scooters, or...homemade joystick-controlled automagically balancing lawn chairs...



Daily Commuter Solar Trikes:



Model (T?) Conversions:



And a wildly fun electric bike-board product that rides like a combination of motorcycle, skateboard, and surfboard:



Tom has a great opportunity if he can market that thing. It's called the Zummer. I got to ride it and it's a blast and a half. I was grinning like an idiot the entire time. I could potentially even commute with it on the train. I hope all his business needs is some marketing money and a little economy of scale.

That's really the meat of it. Just incredibly neat stuff. Terrific fun. Even practical in some cases. Most of it built by entrepreneurs and enthusiasts on a shoestring. I didn't meet anyone who wasn't discussing their designs, or open to it.

I hope I'm not being too dramatic here. I really felt like I started to understand what Charlie Olson said. We don't have a lot of farms or orchards anymore. We have smog. And we have this.

Other stuff:

The guy who sells the conversion kits for my model of miata was there, too, but the price is still a bit steep (read: I'm still not wealthy). Still, I can dream. I took a few snaps of the commercial products as well...

Tango:



Mini:



Tesla:



I forgot to take a pictures of the Smart. It may not have been one of the factory conversions anyway. However, I did see a Cheap Copy of a Smart From China that the owner had to rebuild for safety reasons that would be embarassing to the guy in the electric lawn chair:



If making stuff was a sport, I could blog the Silicon Valley Making Stuff Sports Daily and I would have to become a cutthroat editor just to shrink it down. I used to go to more than one geeky "meetup" per day when I was in between jobs in the 90s, and we've come a long way from those days.

Wednesday, August 20, 2008

Script and Screen


At work we use script and screen for co-development and training.

If you want to work with others in a command line environment and don't use these yet, then you should definitely read this post.

Here's how we use it:

The first thing we do when we work together is we all ssh into the box we will work on.

Then we have the person driving start screen, a terminal multiplexor, and then script, a command logging tool.

Then everyone else logs into the drivers multiuser terminal session run by screen by typing screen -x, and can take over driving when needed. We all can read and write to the same set of terminals, and detach or reattach to the session as we come and go.

When we're done, we copy the drivers /home/driver/typescript file to someplace where we keep old training files like /backup/it/training/how_to_debug_that_thing.txt.

NOTE: screen can be used without script to do a similar job, and script can be used without screen to do a similar job. We just happen to use both.

Script:

Just type script to start it. It will start logging to your home directory in a file called typescript.

If you don't want to use screen, and just want to watch what someone else is doing, you can also try the -f option to flush output after each write. This is nice for telecooperation: One person does ‘mkfifo foo; script -f foo’ and another can supervise real-time
what is being done using ‘cat foo’.

Screen:

Setting up and using GNU screen as a collaborative development environment.

Your user is peter, and you want to pair program with user mike.
1) Install GNU screen on the server and learn the ScreenBasics.
2) Drop the following two lines into /home/peter/.screenrc:
multiuser on
addacl mike
3) Execute the following two commands to allow mike to use your screen sessions:
chmod +s /usr/bin/screen
chmod 755 /var/run/screen
4) Peter is already logged into a screen session
5) Mike can type:
screen -x peter/
6) Peter and mike can now look a the same screen windows/terminals and share the same i/o

ScreenBasics - commands you will actually use, in the order you will probably use them














'screen' start screen session
'Ctrl-a c' create a new terminal
'Ctrl-a "' list the terminals in this session
(then hit the number of the terminal you want to switch to and hit enter)
'Ctrl-a Shift-a' rename a terminal
'Ctrl-a F' flush the screen when it gets screwed up
'Ctrl-a k' kill a terminal
'Ctrl-a d' detach from session
'screen -r' re-attach to a screen session
'Ctrl-a S' make two terminal panes in the window
'Ctrl-a Tab' next pane in this window
'Ctrl-a Q' go back to one pane, current window


Other Screen Notes:

1) If you don't want to use script, you can get screen to record sessions as well. I think it's 'Ctrl-a H'.

2) The default screen key bindings collide with readline and emacs commands. I should look into remapping them someday.

3) Record and play back real-time textcasts with scriptreplay as follows:

script -t 2>timingfile testscriptfile
scriptreplay timingfile testscriptfile

Note: scriptreplay is a tiny perl script that was left out of most red-hat derived linux-util packages to date. You can get it from a debian derived distro or find it here.


Links:

** The homepages for script and screen (for GNU/Linux users):

Script is in util-linux: ftp://ftp.kernel.org/pub/linux/utils/util-linux/

Screen: http://www.gnu.org/software/screen/

** Some of the better articles on screen:

http://www.sun.com/bigadmin/features/articles/gnu_screen.html

http://www.kuro5hin.org/story/2004/3/9/16838/14935

http://aperiodic.net/screen/terminal

http://aperiodic.net/screen/multiuser

http://www.linuxjournal.com/article/6340

Tuesday, July 15, 2008

Silicon Valley Obscure Sports Quarterly Review - Q208








Welcome to the first issue of SVOSQR. In Q2 I thought I would report on "up-and-coming" obscure sports (read: I'm lazy and the sports on meetup.com are not currently at the bleeding-edge of obscurity). Meetup.com links, pics and summaries follow.

Kickball

Friggin Rocktackulous. About 20 people show up. Pleased to find that although I am now older, heavier, and weaker, I can still get that satisfying PWING! sound out of kicking the ball and deforming it into a lively ovoid before the other team catches it. Margaritas afterward in Willow Glen. Surprising amount of blood involved.

Ultimate Frisbee

Super friendly pickup game at Eagle Park in MV. Show up to learn ahead of time. Usually works best if you pick someone approximately your own body shape to cover. Couldn't tell if we were keeping score - could be that I was unaware of the scoring mechanism, but I prefer to think that it's really that casual of a game. They meet in Sunnyvale, too.

Dodgeball

Silicon Valley is in desperate need of Dodgeball leadership!! Things are getting so bad that I have had to find pictures from other sports. The one silicon valley dodgeball meetup was held at Sky High, where they have a dodgeball room made out of trampolines (walls, ceilings, etc). Mixed group with lots of little kids and a few adults. It felt a little unfair to whale on the kids with a red rubber ball, but the realization that I could actually make them rotate on any one axis with a dodgeball strike kept my interest. Apparently, it's next to impossible to get old people to show up to a Dodgeball game. I tried to help and bring in a few folk, but could only drag one brave soul in with me. We were about half the group. Of course, now that the meetup group has gone inactive, there are dozens of interested people pledging to help. Will you be our Dodgeball leader (left picture - the guy who's winning), or will you be woefully unprepared for the next random strike (right picture - that is you).

A warning: There is not enough research to determine what obscure sports do to our bodies, exactly, but we do know that they fully condone the Bush adminstrations definition of torture. Any single obscure sport, picked up for the first time in maybe-ever, will find and cruelly torture muscles that you didn't know you had for weeks. Middle-aged humans are supposed to be dead, and therefore have not evolved to handle more than one attempt at obscure sports per month. Don't do it! But do let me know if you find an obscure sport in silicon valley that you would like me to try.

Saturday, April 26, 2008

Thinking Deeply about Concentrated Solar


I always have Polya's How to Solve It on my desk.

There is this one little part of it that I think everyone ignores, at first, in the "Devise a Plan" section:

"If you cannot solve the proposed problem ... Could you imagine ... A more general problem?"

Inside, when we read that, we think, "Are you friggin' kidding me? A bigger, more general problem? HaHa! Ged ouuuda here! I'm a-simplifyn'!" and quickly skip ahead.

I think Divide and Conquer is the first algorithm that comes to our minds. But it makes us think small - we miss data and cannot apply economies of scope.

It's not like we planned to do that.

I think many people initially plan to look at problems through the end of the process, trying to consider all players, evaluating their historical behaviour and setting up a migration path for them, coming to some solution that takes into account as much data as is useful. (Some people might call this "systemic thinking")

But we get myopic too quickly. We get tired. We find an interesting bit and get focused on the minutia, or start arguing whether a given solution to one part of the problem is feasible or not, and we can't give it up.

I was feeling this way about Global Warming. I got bogged down in studying how amazingly unsuccessful activists are at manipulating governments. Turns out, that wasn't one of the more interesting bits.

And now we return you to our previously scheduled feature on Concentrated Solar:

As Jamais Cascio puts it, the Earth will be just fine, it's humanity that is screwed.

Humanity won't make it without quickly shifting to new forms of power. However, I think we now have at least one reasonable roadmap. You can read all about how this technology is can solve our energy problem lots of places.
Who could implement this the most quickly?

Oil companies and our current power monopolies don't want to be replaced. Want to avoid a fight with them? Give them an advantage in concentrated solar. Just get them the hell out of the way and start them working on this problem. No time for a fight, here.

More specifically, the world has enough sunlit land and money to solve this problem 100 times over. The first set of goodies (We include one 100-year land lease and one suitable tech grant per set (but no batteries)) goes to our current oil and power conglomerats. That should be enough to please any stock holder, line any pocket, and guarantee implementation.

The next 99 sets go to entrepreneurs, which should also help.

You win, oil companies. No one has to die over this. Nice big carrot for you. Just get it done.

Of course, if they can't do it, well, first your land lease will get pulled if you can't get a few PetaWatts to market inside 10 years, but more importantly...if you thought all humanities carrot was big...even weilded in our death throes, that stick has got to be devastating. And, frankly, we never liked you anyway.

I'll write my congressman for you! Good luck!

Monday, January 07, 2008

Debunking the Technological Singularity


I have been arguing, at my local coffee shop, that
an empathy test needs to be developed for computer software
.

The Empathy Test would be unlike a Turing Test or a Voight-Kampf machine in that the purpose is not to determine whether a thinking machine is human. The purpose is to determine whether a thinking machine is a good match for human society.

Simply fooling a human into thinking that you feel his pain does not make you empathetic. I argue for testing a broad definition of empathy that is more useful to intelligent beings interacting in a civilized society. The pain of others need not be recognized by the subject. The pain must be felt as psychic stress in the subject. The program/subject, therefore, must be cognizant of it's own mortality, and pain must be a real threat to it's well being, as it is to us. Those guys in the asylum aren't exactly in endless loops, but they certainly have a few rogue processes. So the Empathy Test would be, in a sense, a destructive one that arguably mimics it's function in humans.

With luck, these empathy-equipped AIs will confirm the game-theoretic benefits of this feature and propogate it up to their designs. They will understand that this feature is for the preservation of lower races - an endangered species act, if you will. Alternately, it might just piss them off and subject us to summary disintegration. After all, how many programs have you killed today? How many lower species? On a macro scale, are we failing the empathy test?

In any case, I have found today that the point is moot! Recent historical research uncovers striking similarities between our past intellectual follies (SINGULARITARIANS MUST CLICK ON <-THAT LINK) and our current failed delusions of technological grandeur.

Clearly, I was entranced by the mental crack that is the singularity novel. For those of you with the same addiction, you can shoot up with this open content novel. Confirmed grade A stuff. But please, don't share dirty algorithms.

Monday, November 19, 2007

Rock genre terminology considered asinine

Recent craigslist internet engineering jobs, exclamation point:

** Rock Star (Affordable) Flash Developer Needed ASAP!

** Seeking a rock star DBA for our production environment!

** Great Opportunity for a Rock Star Intern!

Before interviewing for these positions, be sure to comb your mullet and put a cucumber down the front of your spandex pantsuit.

On any given day, about 30 craigslist job postings in my area are looking for "Rock Stars". They are all really looking for "programmers", so, as I am about to enter the job market, I happen across them with increasing frequency.

I have to ask myself: How the heck did "Rock Star" eclipse "productive"?...and why haven't other industries caught on? Where did this trend come from?

No, Captain Klaa(pictured) has not been going around writing corporate dress codes, and yes, perhaps these HR departments are a bit too exuberant(see below). But that's not why I'm looking into this.

I don't have a problem with the use of the term "Rock Star" per se. I don't want to make fun of anyone. I enjoyed Spinal Tap as much as the next guy.

No, I'm looking into this because the trend really got on my nerves. I couldn't put my finger on why that was; so I explored it, and learned something.

I think these employers are trying to do two things:

1) Find programmers that are very productive (top 1% preferrably).
2) Imply that they will treat them well.

What I think they really want is to:

1) Attract programmers who know they are very productive and easy to work with.
2) Imply that they their team is productive and easy to work with.

If you have recently read Joel Spolsky, you may feel the need to replace "productive" with "gets things done" - I won't feel bad.

Thinking about how these employers can get what they want, I found what I really want: a productive, easy-going team. The heart of my problem with a team of Rock Star's is that it's so far from that ideal.

I asked roughly the same questions that employers ask. It was so informative to me that I would recommend it to anyone looking for a job. Here's what I came up with:

1) How do I know I am productive?:

Well, I can measure it.

The employers who are looking for rock stars have probably read that timely tome - The Mythical Man Month, in which the productivity of programmers is said to vary by an order of magnitude by skill alone. Well, this is one of the things that is still true in that book, but not in the way most people probably think.

Most people know how to measure their own productivity. They can describe what they have produced, and discuss it at length. "I developed X in Y weeks and I here it is", etc.

To most employers, your past productivity in the domain of the job in question is the primary measure of your likely future productivity.

Most people are o.k. with that. It's just common sense that you improve at a task with experience. This is hard to measure, but anyone who plays chess might assume that from competent to expert there may be 100 or 1000X improvement in most fields to be gained by experience. As it turns out, this is a highly contentious assertion. No one knows how much experience really has to do with it.

In absence of a candidate that is productive in the required domain and easy to work with, an argument can be made that a candidate that is trainable and easy to work with will do.

Trainable is usually a secondary requirement, and you can measure it the same way you measure productivity, based on past performance. In the case of a programmer out of school, trainable may be the only applicable requirement.

The more experience and intelligence the better. That's nice, but...

2) How do I become more productive?

Most people have a decent understanding of the factors upon which their productivity depends. It may vary from person to person and purpose to purpose. For me, right now, it consists of four things that I seek to improve upon daily.

Domain experience:

Produce more. Focus on one job for a while, and you will become an expert. I may be an order of magnitude more productive at writing support scripts or IVR applications than I am at writing web applications. At some point in the near future, however, I expect this situation to reverse. This just makes sense. I am working on web apps every day. If I want to get good understanding the core concepts of a framework and writing large programs in that framework, then there is no substitute for doing that.

Tool expertise:

Programming tools are made from software and improve productivity. New and better tools come out every day. If I spend time every day learning tools, I will improve my productivity. Commit to this, and you will improve.

Mental and physical health:

Stay healthy. My levels of pain, discipline, and energy vary based on my lifestyle. I get up every morning and excercise, clean up, hug my wife, drink coffee, and solve a puzzle. If I don't get a healthy start to the day, or if I don't take care of myself in other ways, I am sure my productivity will suffer.

Environment:

As a programmer, I work best either in a quiet office or pairing with one or more team members at about the same skill level. I can rank environments for productivity as well. The library is fine, a coffee shop is not so good, and home is right out - too many non-work distractions. Nothing compares to a serious, conflict-free, office work environment.

All I can do here is be aware of the quality of my environment, which varies from job to job. Experimenting with environmental improvements can help, as do these helpful techniques for tough environmental situations.

Kaizen.

3) How do we know when someone is easy to work with?

Probably the most important and tricky part of the hiring process, for both the employer and the candidate, is measuring soft skills.

If a candidates tech skills are not up to par, you have to train them. Fine.

Employees with very poor soft skills can destroy an entire company. Experienced employers and employees know this. So what we are looking out for here, are the bottom few percent of the employee pool in soft skills. No one wants a report or a manager like that.

My soft skills can be measured, and so can those of any company. We just ask each other how we handle situations that matter, and check references.

For my part, I have to ask myself tough questions: How many co-workers have I helped, how many have I hindered, what tough problems have I solved with them, what have I learned, and how can I improve?

So how can I improve? Aside from discussing this with past co-workers, knowledge will help: PeopleWare.

It can't hurt to improve, but I think most people are probably o.k. on soft skills. Still, the better adjusted the team, the better for everyone.

And now, a word to folks advertising for Rock Stars:

I don't expect hiring managers to read this, but...

If you would like to project an image of your programming team, a gathering of Rock Stars is probably not what you want. Rock Stars are people who produce hit songs and are worshipped only as long as they keep pumping them out. A collection of rock stars are not likely to work together long.

Sounds like solo-superman programming while surrounded by dysfunctional sycophants and confrontational peers. Probably not what you meant. If that is really what you meant, then I suggest a different perspective.

I could suggest a different analogy...A construction crew is a closer match than a Rock band. It could be that your construction crew wants to design and build the next Guggenheim and drink beers after work, but it's a construction crew all the same.

Better yet, drop the analogies. Mention your team, your management style, your process and your product. Mention that you would like applicants to discuss what they have actually produced, providing examples where possible. Maybe lead with something like: "Highly productive team seeks C programmer" - or whatever actually describes your team and what you are looking for.

Mention that soft skills are important up front. This is a very good sign.

And...Rock on.

Friday, October 12, 2007

Swig-C-Ruby-Pointers Hello World

I'm trying to write C libraries to do some things on the Mac that are not easy to do with Ruby. I found that I had to read several documents and experiment around a bit with SWIG to call a C library function that took a pointer as an argument. This is just one of those things that should not take that much time to figure out.

C library functions that take pointers as arguments and return ints (that covers most of the c library functions I have written) ultimately return an array to Ruby. Uncovering that little factoid, and the swig interface format required to make that process work, was the tough bit.

So, I'm taking a few more minutes to make sure you don't have to do that (and to make sure I don't have to do that long after I forget about this exercise).

Step Zero: get swig.

I install all open source software on the mac with fink. Fink Swig

Step One: Copy my example code - inline below.

I provide what you need to make a ruby callable module called Example that contains the C function SimpleFunc() that you will call with a little ruby test program called testsum.rb.
user-64-9-234-209:~/src/c/simplelib richbodo$ ls -l
total 48
-rw-r--r-- 1 richbodo richbodo 61 Oct 12 16:24 example.i
-rw-r--r-- 1 richbodo richbodo 42 Oct 12 15:52 extconf.rb
-rwxr-xr-x 1 richbodo richbodo 90 Oct 12 16:41 get_it_done.sh
-rw-r--r-- 1 richbodo richbodo 46 Oct 12 16:36 sum.c
-rw-r--r-- 1 richbodo richbodo 24 Oct 12 15:46 sum.h
-rw-r--r-- 1 richbodo richbodo 67 Oct 12 15:57 testsum.rb
Three of these files you already understand:

sum.c - your library
int SimpleFunc(float *modify_me)
{
*modify_me = 5;
return 1;
}
sum.h - your library header - not used by swig unless you tell it to - don't need it here.

testsum.rb - ruby program that calls your library
require 'example'
afloat = 2
# The first return value gets set as expected in first_returnval.
# However, SWIG puts the float in a second return value.
first_returnval,second_returnval = Example.SimpleFunc(afloat)
puts "Your float is #{first_returnval}, and the return value is: #{second_returnval}"
The other three files are specific to getting your swig library going:
  • example.i - a definition of your library for swig in swigs definition language. INOUT is a SWIG typemap, so typemaps.i is required.
%module example
%include "typemaps.i"
%apply float *INOUT { float *modify_me };
int SimpleFunc(float *modify_me);
  • extconf.rb - a ruby program that creates a makefile for your library
require 'mkmf'
create_makefile('example')
  • get_it_done.sh - the commands that you run to generate a ruby module from your c library using swig
#!/bin/bash
rm *.o
rm *.bundle
rm wrap_example.c
rm Makefile
swig -ruby example.i
ruby extconf.rb
make
sudo make install
ruby testsum.rb
Step 2: Run the get_it_done.sh script to build and test your module. (it will ask for your password to install the library)
user-64-9-234-209:~/src/c/idlerlib richbodo$ ./get_it_done.sh
rm: wrap_example.c: No such file or directory
creating Makefile
gcc -fno-common -g -O2 -fno-common -pipe -fno-common -I. -I/sw/lib/ruby/1.8/i686-darwin -I/sw/lib/ruby/1.8/i686-darwin -I. -I/sw/include -c example_wrap.c
gcc -fno-common -g -O2 -fno-common -pipe -fno-common -I. -I/sw/lib/ruby/1.8/i686-darwin -I/sw/lib/ruby/1.8/i686-darwin -I. -I/sw/include -c sum.c
cc -dynamic -bundle -L"/sw/lib" -o example.bundle example_wrap.o sum.o -lruby -ldl -lobjc
install -c -p -m 0755 example.bundle /sw/lib/ruby/site_ruby/1.8/i686-darwin
Your float is 5.0, and the return value is: 1
Step 3: Look at the five new files you just created, and understand what they do:
user-64-9-234-209:~/src/c/simplelib richbodo$ ls -l
total 152
-rw-r--r-- 1 richbodo richbodo 3009 Oct 12 16:42 Makefile
-rwxr-xr-x 1 richbodo richbodo 16316 Oct 12 16:42 example.bundle
-rw-r--r-- 1 richbodo richbodo 61 Oct 12 16:24 example.i
-rw-r--r-- 1 richbodo richbodo 17695 Oct 12 16:42 example_wrap.c
-rw-r--r-- 1 richbodo richbodo 5744 Oct 12 16:42 example_wrap.o
-rw-r--r-- 1 richbodo richbodo 42 Oct 12 15:52 extconf.rb
-rwxr-xr-x 1 richbodo richbodo 90 Oct 12 16:41 get_it_done.sh
-rw-r--r-- 1 richbodo richbodo 46 Oct 12 16:36 sum.c
-rw-r--r-- 1 richbodo richbodo 24 Oct 12 15:46 sum.h
-rw-r--r-- 1 richbodo richbodo 644 Oct 12 16:42 sum.o
-rw-r--r-- 1 richbodo richbodo 67 Oct 12 15:57 testsum.rb
  • example_wrap.c - created by the swig command, this a c wrapper for your library with a bunch of additional wrapper functions that translate your functions and data into ruby callable functions and data. see chap 21 in the pickaxe.
  • Makefile - this is the makefile that was generated by extconf.rb. It will compile your library and that wrapper and make the mac bundle for you.
  • sum.o - the object file generated from sum.c
  • example_wrap.o - the compiled version of example_wrap.c
  • example.bundle - mac osx stores code in bundles, so make makes one and puts it in your site-ruby directory when you type "make install"
So that' it. You make that swig interface file, you call swig. Example_wrap.c gets created. You make the extconf.rb file and run it. A makefile gets created for you. You make your project by calling make and you are done.

References:
  • Chapter 21 in the pickaxe book.
  • The ruby swig page: http://www.swig.org/Doc1.3/Ruby.html#Ruby_nn5
  • The swig basics page: http://www.swig.org/Doc1.3/SWIG.html#SWIG_nn3
  • Apple Developer Docs: http://developer.apple.com/documentation/
&