Sumstring’s funny here…

Given an arbitrary string of positive numbers separated by spaces, how can I produce the sum of the numbers using only SQL?  There can be any number of numbers in the string.

Examples:

’10543 959 20453′ should produce 31955
’4859 0 0 0 12314′ should produce 17173
’0 10 15        78      104′ should produce 207

Preferred solution uses Oracle 9i and does not require any PL/SQL functions…

Art, Science, Experience or Talent?

Recently I’ve had to deal with problems that appear ridiculously easy to me.  Stuff that appears incredibly obvious.

I’ve been trying to understand why these problems came to be.  Who planted and watered them until they became full grown monsters that “can’t be fixed”?

Most of these appear to be the result of either lack of experience, or lack of imagination (talent?).  And I’m a bit depressed because I’m not sure how to “teach” ways for people to suddenly acquire more experience or imagination / talent.

These kind of problems tend to fall into 3 categories:

  1. Re-usability
  2. Scalability
  3. Test-ability

The reusable problems generally appear to be in the art / experience / imagination category.  Most problems are due to the wrong amount of desired reusability.  Either something is “too” specific or super-generic — and in the end, not a good fit and not reusable.  We had a problem the other day with how and where to store a configuration parameter for our application — a simple cut-off date.  And for a full day with an email chain over 20 messages long, we debated on how and where to store this one value.  During this whole chain, no one stepped back and thought about a way to logically do this if we ever needed to do it again.  And when someone finally proposed a reasonably generic solution, it was immediately attacked for not being generic enough.  I need to come up with interview questions that identify people who can handle this kind of problem.

The scalability problems seem to be in the experience / talent category — maybe a little imagination to see that your system / application may become wildly popular.  Sometime’s it’s just ignored — the developers think performance is an ops problem, and the ops people think it’s an engineering problem.  Obviously it’s both, but when each group just wants the other one to make it go away, nothing gets done.  Scalability and capacity management aren’t hard — they just take rational people accepting portions of the responsibility.

Test-ability is my made-up word of the day.  It refers to building an application, process or structure that can be confidently exercised outside of the production environment.  Believe it or not, this also includes ops people as they may need to support / manage the testing environment.   The ability to specify scale models of production (data, platform, scope) is important, but few developers give it any thought.

I wish I could build an “experience” simulator — something video-game like that could teach newbies in an engaging manner…

"It’s not all you want to eat, it’s all you CAN eat! Hahaha!"

I seem to remember an SNL skit where people at an all you can eat restaurant got up to leave and the waiter restrained them, saying — no, it’s not all you want to eat — it’s all you can eat.  Cracks me up everytime I think of it.

Anyway, some of the ways companies try to get everything out of their employees can be just as creepy.  You think the free meals and dry cleaning are perks?  No, they’re sometimes just a way to make sure you don’t have any excuse for not working :-)

“What do you mean you need to go home for dinner?  We provide a full-service cafeteria and catering right here 24×7!”

Anyway, I promised a story on this…

A long time ago, I intereviewed with a small startup who wanted to make sure that everyone was highly intelligent and fully dedicated.  Every employee was issued a pager and was required to keep it on and with them 24×7 so that they could respond to their colleagues.  All personal errands were taken care of by a small staff — everything!  Dry cleaning, oil changes, visits by the plumber (the staff had keys to homes), food delivery.  They even would handle getting you an apartement and furnish it for you.  Needless to say, I found it a bit creepy.  But they definately wanted to harness the total creative output of their employees….

Phugoid

Those of you that follow my thoughts know that I tend to oscillate between geeking out about details like special optimizer hints and spending time musing on larger scope items like staff management.

Lately I’ve been on the staff management brainwave.  I’ve started reading Alvin Toffler’s PowerShift.  I know, it’s probably dated.  And I’ve seen how Toffler tends to believe his own press a bit much.  And yes, the book is repetitive. :-)

But one of the neat nuggets in there talks about how a company can be judged by the sum total of the IQ of its employees.  How companies are trying to get more than 8 hours of repetitive work out its workforce.

It’s an interesting problem.  You want employees to be creative and come up with their own ideas, but you also want them to be “team players” and work hard to implement ideas that they don’t always agree with.

Google’s famous for their “support” of “off-time” projects.  But I’ve seen that many places ignore their example, claiming that Google “can afford” to do that.

I’m not so sure that Google’s approach is the only one that can be successful.  I like to think that just by not “running the team” so hot you can give ideas room to grow.  I do think that the 20% number if probably right though — but it doesn’t need to be formalized.  Just run your people at 80% most of the time — and when they aren’t self-starters, just give them off-topic work exercises or ways to self-educate.

I’ve got a scary / funny story about a company trying to make sure it got every last creative ounce out of its staff…  I’ll save that for a later post.