## Sqwitter – demonstrating a Seaside app

Squser>>allSqweets
“returns messages from self and friends”
| allsqweets |
allsqweets := SortedCollection sortBlock: [ :a :b | a timestamp < b timestamp ].
myFriends do: [ :each | allsqweets addAll: each messages ].
^ allsqweets

———————-

allSqweets  is a simple 4 line method, but delivers the core feature of Twitter: displaying a timeline of all a user’s  and his friends’ messages.  And thus started my exploration into Seaside, a Smalltalk framework for developing web applications.

I started playing around with Seaside last year, but time constraints prevented me from getting too far.  But, I’m at it again.  This latest burst of energy was in part generated by the “fail whale” of Twitter.  Prompted by friends, I started using Twitter a lot from the early part of this year.  Pretty cool, simple application, yet, why does it keep crashing?  Hey, though, it’s got a million users, so give it a break.

I’ve been looking around for other web frameworks to develop in.  That’s why I’ve given Seaside a serious look.  On the prompting of other friends, I recently gave Ruby on Rails a look, and earlier had glanced over at Django.  Both, surprisingly, kind of gave me the shudders: pop in some code for your initial objects, and they auto-generate lots of code for you.  All code broken down into a clean separation of concerns: model files here (class definitions), view files there (web templates), controllers over there.  Nice, but now I’ve got lot’s of files, and I’ve got to navigate my way around to figure out what to modify where.  I’m sure once you get used to it, it’s easy to remember what directory has what files, but I’m impatient you see, and don’t have much spare time (see above).

All these files reminded me of my C development days, with scores of header files (.h), code files (.c), and my own make files, etc.  I’m not knocking these frameworks on the Ruby or Python languages – long ago, I learned that language wars are useless.  But, maybe it’s just my aesthetic:  I’ve always found Smalltalk super clean and easy to read and navigate, and it remains my fastest development language.  So, yeah, maybe Ruby and Python are “Rapid-Enough” Application Development environments, compared to, say Java or Visual Basic, but I yearn for truly Rapid Application Development again.

Then came Barcamp Houston.  Kind of creeped up on me.  It wasn’t til the morning of the conference when I suddenly got inspired:  I should present something here!  But, a late start to the day, and an already depleted laptop battery proved challenges for preparing any kind of presentation, much less something that wouldn’t embarress me.  I would need to spend a little time relearning the Seaside environment (which has undergone a few point releases since last year), and thinking through an application.

Then my thoughts went back to the Twitter applicaiton.  Wouldn’t that be a simple application to demonstrate within Seaside?  And sure enough, it was been: in fact, too simple to demonstrate some of Seaside’s more powerful features (like tasks and workflow – the real meat of “continuations”).  Nevertheless, a good test case to begin.

So, I still don’t have much time in my busy schedule, what with my own projects, my business, family, assisting in the launching of my wife’s new restaurant, etc., but I have been able to squeeze in a few hours here and there to develop Sqwitter, an implementation of Twitter in Squeak and Seaside.  The next several blog postings will walk through my development of Sqwitter, and should serve as a useful tutorial for Seaside (there are already some excellent tutorials on the web, and a book too).  When I finish the code, I’ll also roll the application out to a demonstration website for readers to play.

Next: Sqwitter objects and Seaside components.

## How to Cpk the SQL Way

As mentioned earlier, I’ve been involved in client’s Production Reporting application project, when the subject of Cpk came up.  After a lot of inconsistent references to the statistic and lot’s of code that approximated but didn’t exactly calculate it, I finally discovered the proper formula for  Cpk.  Here it is: Cpk  =   min (  USL - μ / 3 * $\hat{\sigma}$, μ - LSL / 3 * $\hat{\sigma}$) 
Where USL is the Upper Specification Limit, LSL is the Lower Specification Limit,  μ is the arithmetic mean of the results and $\hat{\sigma}$, sigma hat, is the estimated standard deviation (sigma hat is going to turn out to be the kicker in this equation).

Let’s say you have a product you have to make that must be within some specifications: like, the length of a sub sandwich.  It should always be 12″ long, but it’s acceptable if the final sandwich comes out between 11″ (LSL) and 13″ (USL).  Cpk is the minimum of either the average deviation from the upper limit divided by 3 times the estimated standard deviation, or the average deviation from the lower limit divided by 3 times the standard deviation.

All this would be easy to calculate using SQL if just plain ole standard deviation were involved.  However, using standard deviation instead of estimated standard deviation (sigma vs. sigma hat), and you have the equation for Ppk, a  different statistic.   Always one to be lazy, I ask our client: “would it be okay to report just the Ppk statistic?”  Of course, the answer was no! Continue reading How to Cpk the SQL Way

## Computing Cpk statistics using SQL

Part 1 – Introduction

For the past several years I have performed a myriad of projects for this favorite chemicals company client of mine.  Recently, I was called in to help design and develop a Production Reporting application for them, to meet new requirements from their new, German-based, owners.  The application reports on things like how much product is produced, what was consumed to produce it, production yields, etc.  Several factories are involved, so we’re tieing all the data into one database.

The first challenge involved converting all the English-based measurements into metric.  Yes, I did say it was one of those metric-loving European countries, right?  So, we’ve been going over different conversion equations – some of them are interesting, because they’ve involved variable factors like the energy content of natural gas and the specific gravity of  oil.

Still, though, a piece of cake – just linear equations to convert from one unit of measure to another.  Had more problems with the quality of data (often missing from several plants) than the equations themselves. So, we’re progressing fine on the application; then, one day I’m in a meeting with all the plant managers, and they start talking about CPK statistics. They talked like of course everyone knows what this statistic is.  I’m sitting there, though, going “huh?”  I have a computer science undergraduate degree, with oodles of calculus, differential equations and statistics, and a economics graduate degree with its own heavy mathematical load in correlation analysis and statistics.  Yet, I’ve never heard of Cpk (properly, that’s how the statisticians spell it, C sub pk.  I still don’t know what the initials mean).

## Cultural Recreation

The Houston International Festival has for a long time been one of our favorite family events to attend. Even before we had kids it was a great weekend of fun, food, and music. We’ve attended most every year that we’ve lived here in Houston. We even slugged it through the years it was held at Reliant Park. Vast parking lots have absolutely no character, so we were very happy when it moved back to downtown!

2005 was an especially good year for iFest – that was the year we participated as a vendor! Connie and Alyson started planning their business venture, Té House of Tea, in 2004, and by January 2005 started searching for a suitable location for the tea house. This took longer than expected – so many locations just didn’t have the right amount of parking, the right rent, or just the right feel for a peaceful, contemporary tea house. Then we noticed the featured country for iFest this was was India, and since Connie had developed an authentic Indian chai recipe (with the help of our dear friend Hema), we decided to throw up a booth at the festival.

Luckily, we got a booth in the India Food Court.

These were the early days of our business planning, and we didn’t have a lot of extra cash for extracurricular adventures, so we made do with hand-painted signs and logos. We were very proud, though, of the final result for our sign, which was pitched above our booth. I hand cut some graceful, Indian architecture-like curves with my trustworthy jigsaw, and Alyson and Hema laid on the paint and paisley patterns. It was gorgeous!

We only had enough time and energy for one weekend, so a boba-tea shop took our booth location the weekend. The weekend we set up was sunny and humid. The crowds were still there, though, and our teas were an instant hit – especially with all the Indian-Americans! All the neighboring Indian restaurants were pitching our chai to their customers, as “fresh and authentic”. Come 5 pm, and suddenly the Indian crowd was in line eight-deep at our booth – Tea Time! It may have been a hot day, but they still wanted hot chai – it’s only right.

We completely ran out of all that we had prepared in the morning, so Alyson and Connie stayed in the back to boil some fresh brew. Mmmm, it was good, the aroma of boiling milk, black tea, and fresh spices filling the air around our little tent.

We completely ran out of our two days worth of tea supplies in just one day, so on Saturday midnight I was at Fiesta buying fresh spices – cardamon, cloves, ginger, etc. – so we could be prepared for the Sunday crowds.

Sunday was just as busy for us, but we are able to keep ahead of demand this time. 5 pm was still a rush, and we were ready.

We were very proud of our success, and our acceptance by the local Indian community. We had recreated a bit of their own culture in the form of local food and afternoon tea traditions, and it fit the general atmosphere of Indian dance and music all around us.

Last weekend, I had the honor of being invited by iFest for a sneak peek of one of their own cultural recreations: a model of a 13th century underground church in Ethiopia. This in preparation for the coming International Festival’s focus on Africa.

I visited iFest art director’s Kati Ozanic-Lemberger home and studio on a recent Saturday, along with a lot of other excited bloggers.  We got a see a bit of cultural recreation in action: the construction of the underground caves leading to the church (the church itself had already been carted away).  With paint and plaster, Kati and team are bringing a touch of this exotic African history right here to Houston, for visitors to see and touch.

It’s not the real thing, but that’s not the purpose.  Visitors get to see and read a bit about something they probably knew very little about before, learn a little history, and ponder.    That is, by crawling in a cave, they’ll get to leave their own little cave.  And that’s good.

Should be a good two weekends: everyone get out and enjoy iFest this year!

## Pseudoscience vs. Science

Boiled down:

• Science = testable hypotheses
• Pseudoscience = exploiting anomalies in Science

I had the misfortune of running into a 9-11 Truther last week, on a bridge in Houston. I was gracious enough to accept 4 DVDs from him, and was open minded enough to even start viewing one of these videos (along with my son, who’s getting old enough now to actual be curious about politics). 30 minutes in, though, I just had to shout out “Arghh!” and throw my hands up. These guys don’t engage in science, or even scientific dialogue. If you chance to argue with them, to point out alternative, feasible, Occam’s Razor-limited hypotheses, along with the supporting evidence – or even dare to point out the anomalies in their own data and theories – then you’ll be immediately branded as a apologist, a shill for the State, or worse.

I mean, heck, I’m like any other guy: I like good conspiracy theories. It’s great entertainment! And yeah, perhaps “we” have planted evidence or created events as excuses for going into wars before (USS Maine, anyone?). But Controlled Demolition, Missiles, Remote-Controlled Planes, Holographic Plane Images, even UFOs? This isn’t science, falls flat on so many fronts. I’ve got better things to do than read up or view all this. And, better things to blog about. So, I’m off …

## A Social Media Drinking Game

Here’s my random thought of the day:

After reading this article: The web, the politician and the prostitute, I was inspired to imagine the following game:

1. Get with a few of your friends at your favorite bar. One with wireless access;
2. Start drinking;
3. When everyone’s getting good and happy, pull out your special deck of cards. You’ll be the first player, the Prosecutor;
4. The Prosecutor points out one person in the group. He/she is the Accused (got to come up with cuter names, though);
5. The Prosecutor draws a random card from the deck. These cards have a single crime written on them, stuff like Murder, Rape, Child Molester, Embezzlement, Prostitution, etc. The more heinous, the better;
6. He shouts, “YOU NOW STAND ACCUSED OF _______ !”;
7. Everyone else in the group is a Journalist. It is now their job to mine the accused’s social networks for all the juicy bits they can find: incriminating photos, random quotes etc. The more they support the crime the better;  the most outlandish out-of-context statements that prove the accused’s proclivities gets the most points. Digging into obscure connections and long-past history (archive.org is allowed) gets even more points;
8. Be prepared for a lot of teasing.

This game is good for sobering up before you head home for the weekend.  It’s sobering to see how much privacy we’re willing to give up these days.  🙂

## Bridges and Phones – Social Media Economics

In microeconomics, economists like to talk about substitution goods and complementary goods. A classic complementary good to peanut butter is jelly: both are usually consumed together in that delectable sandwich known as PB & J. Economists care about this, because when consumption goes up in peanut butter, you’ll likely see an increase in jelly too, if the goods are tightly complementary. Price changes in one will likely lead to price changes in the other.

A substitute good, well that’s kind of obvious, it’s a good that can easily substitute for another. Soy drink is a substitute for milk – at least, if you’re in my household. Natural gas is a substitute for electricity, when heating your house. If the substitute is easy to switch, a price increase in one will lead to increased demand in another – a nice, easy economics predictive tool. Continue reading Bridges and Phones – Social Media Economics

## First thoughts on presentation at HTC

This Wednesday I did a short presentation at the Houston Technology Center’s “Starting a Web-Based Business” lunch series.  My presentation was on “Open Source Tools for Software Development”, and I highlighted several tools that my development team uses regularly.

I’ll post that presentation shortly, but here I just wanted to jot down a few notes from reactions to the presentation – feedback I got after the talk.

•  One manager, owner of a well-established software firm here in Houston, liked the idea of wikis for organizing his team; but he’s still looking for a better project management tool, something “larger” than Poi, the issue-tracker I demonstrated.  Something that could track milestones, and keep the team on track.

Yes, I’d like to see better tools for PM too.  Traditionally, we’ve used MS Project.  Problem is, it’s not easy to share – at Interliant, we tried the Lotus Notes-based Project Gateway, but ultimately found it awkward to use.  Basecamp, an online service, looks attractive – not sure yet how well it scales, and compels your team to use it.

One thing we do, though, when a project gets hot and heavy, is that we fix the milestone dates at regular intervals: once a week or once every two weeks there’s going to be a build.  That stays fixed; what adjusts, though, are which features that make it into the build.  Our only rule is that the feature must be a tangible end-user benefit – we can’t “deliver” just background architecture or design in the next release, and expect that to be considered progress by our client.  Managing at this point becomes simpler, as the project schedule just shows a set of period milestones; ts in the status meetings we discuss which features will make it into the next build – the customer, of course, sets priorities, and there’s some give-and-take on features that may slip because of their complexity, or unexpected problems.

Still need a tool, though, to capture and display these milestones and feature deliverables!  Must search more …

• One manager of IT at the Houston Chronicle mentioned they use Capistrano for deployment, instead of Ant.  It’s Ruby-based, but you can use it for automating all sorts of things.  It looks very promising, so I’ll have to check it out.  Ant is cool, is built into Eclipse, and does the job, but it’s XML.  Rather a yicky way to write out deployment scripts!
• Another fellow approached me after the talk and said his friend is involved in a large-scale application that uses, of all things, Smalltalk!  It does heuristics, and I think it was oil field-related.  I’m hoping I’ll get to meet this guy, and learn more.  I still love Smalltalk … just can’t find any projects where it’s a winner here in town  🙁

## Cultural Awareness

OK, I guess I won’t really fault the local tech community for sponsoring not one, but TWO events, both falling on the first day of Chinese New Years. Did anyone check their calendars?! Yeah, yeah, I know … you can’t pick any date without landing on some sort of holiday, be it National Pickle Day or International I-Miss-My-Mommy Month. But, this one day is perhaps a bit more important than others – it’s at least a day where you can expect a lot of family commitments if you happen to be Asian.

So, I’ll be missing the Up Experience, though I’ll likely make it for a short while to the Houston Startup Happy Hour – the latter is always a great chance to catch up with my business friends, in our often very busy schedules. After that though, it’s off to a grand ballroom for a big New Years feast with other friends and family. I think we have booked 3 large tables so far. Should be fun, and filling too!

## Objective Journalism is a Myth

Forget what you were taught in school about journalistic ethics. There is no objectivity in the news. Journalists, editors and news corporations come to every story with their biases intact, and select and produce stories that reflect their leanings.

OK … actually, the situation is more subtle and complex than that. I’m not talking about the left-leaning media, or the “vast right-wing conspiracy”. Sometimes the biases are more mundane than that: news stations, to keep their ratings up, must produce entertainment in their news, to keep the viewers watching. And, we all know how this works: shock and gore, gossip and controversy are all grist in the entertainment mill, so stories with shock value will more likely get air time. And, a journalist who can throw in a controversial twist will get more attention from the editors, etc., increasing chances an article will be run.

This “entertainment influence” on journalism seems to be more a factor of TV news than print.

Maybe journalists like to hide behind the cloak of objectivity, but we as savvy consumers of news information need to weigh in on all the influences – economic as well as ideological — Continue reading Objective Journalism is a Myth