Wednesday, May 30, 2007

Back from a week in Europe - a travelogue

I have a been a very busy boy. Just spent the last week living in (well, visiting anyway) a different hotel every evening, moving between six cities in four countries in Europe as follows: Frankfurt, Dusseldorf, Zurich, Munich, Stockholm, Copenhagen.

Some might find that exhausting, but I am a lucky fellow: my body and mind are not much affected by jet lag nor by many hotel changes. Plus, I try to stay very disciplined about exercising each day and eating lots of fruit and vegetables, avoiding meat. So I made it back home without getting sick, without getting tired, actually returning totally energized by my time in Europe, because....

I gave my latest best practice presentation, now titled Practical Best Programming, to a total of over 400 developers (with the single largest turnout - over 150! - taking place in Dusseldorf, at an event cosponsored by Quest Software, the German Oracle User Group, and Trivadis). You can download this presentation at:

http://oracleplsqlprogramming.com/PracticalBestPLSQL.html

How bad can a trip be when I spend a big chunk of it talking to lots of people who actually seem to want to hear what I have to say, laugh at lots of my jokes (so kind!), and show proper appreciation for my (Quest's) amazing new tool: Quest Code Tester for Oracle?

Can't be bad at all. Here are some highlights:

* First, the weather. It was sunny and warm, even hot, throughout. The downside of this fact is that I felt absolutely compelled to abandon my laptop and hotel room and go outside whenever possible to enjoy the real world.

* The Das Stadel and Modern Art
(MMK) Museums in Frankfurt were very enjoyable. Lots of the art in the MMK was whimsical and amusing. Some of it seemed, well, ridiculous. Blobs of formless clay strewn about on the floor. Dates ( "12 OCT 1997") painted on small canvasses, filling a whole room. Not my cup of tea. But others...well....check out the photos: Frankfurt

* A lovely run along the Isar River in Munich, very close to the Hilton, where I stayed and presented. A very beautiful park, full of mothers and their children enjoying the outdoors, people riding bicycles....I wish that my legs and lungs were stronger so I could have covered more territory and breathed in even more of that clean air...photos:
Munich

* Hotel breakfast buffets: while I am trying to lower the importance of food in my life (with the intention of reducing the quantity of food I ingest), I definitely take every possible opportunity to eat fresh fruit. Most business class hotels in Europe feature extensive breakfast buffets containing a wide variety of fresh fruit, yogurt, healthy cereals, fresh juices and so on. Eating fruit makes me feel great!

* My friends at Quest, in particular Daniela, Calle and Patrick. Daniela and Calle worked very hard to organize my week of events and she is clearly a professional - very organized, great attention to detail, strong commitment to carrying out the highest quality programs. Patrick, an SC, shared the agenda with me for three days, showcasing critical best practice functionality in Toad, including CodeXpert, SQL Optimizer and Benchmark Factory.

* Raffling my books: O'Reilly Media generously provided books to raffle off to participants at each location. That wasn't the highlight, though it was certainly a great thing for those who won. What I liked most about the raffle is that we used PL/SQL technology to pick the winners! At first, I used this simple block of code to pick winners (we had a number forevery name):

BEGIN
DBMS_OUTPUT.put_line (ROUND (DBMS_RANDOM.VALUE (1, 70)));
END;
/

But that led to duplicates (randomly!) and also since there some no-shows at each event, I would have to run this block lots of times to give everything away. It was a bit clumsy. So I enhanced this simple block into a stored procedure with this header:

PROCEDURE pick_winners_randomly (
total_count_in IN PLS_INTEGER
, winner_count_in IN PLS_INTEGER
, ineligible_in IN VARCHAR2 DEFAULT NULL
, delimiter_in IN VARCHAR2 DEFAULT ','
)

With this procedure, I pass in the total number of attendees, the total number of possible winners (how many prizes we have), the list of ineligible numbers (those next to the names of people not in attendance) and delimiter for the inelgibile list. Then we could pick and immediately show all raffle winners in a matter of a second or two with a block like this:

BEGIN
pick_winners_randomly (50, 10, '4,22,27,33,47');
END;

If you would like to see the code for this handy program and possibly use it yourself, click here.

* I am now flying back and was lucky enough to get an upgrade. So I can work for 6+ hours on the way home! Very exciting. Really. Sadly, at this point in my life, I am SO busy and traveling so much, that I feel like I need to stay in my hotel room and order room service to minimize time spent on meals. And I try to fill every available chunk of time with typing on my laptop. Sigh....well, I have a great life and I chose to take on all the work I am doing. Anyway, I just learned something very interesting and useful: on American Airlines, odd numbered flights mean that the flight attendants ask Business Class passengers for their menu preferences from "aft to forward" - meaning if you don't eat meat, like me, then you want a seat towards the back so they won't have run out of fish or vegetarian meals. And on even-numbered flights, ask for a seat up towards the front. Now that's the sort of information I would rather not have be important in my life. But there you have it.

* My last day on the trip was spent in Copenhagen. We finished the morning seminar and lunch at 1 or so. After visiting the Quest offices nearby, I went out for a long walk, meandering through several really nice parks and ending up at the Statens Museum of Art. I've gotten tired of seeing paintings of crucifixions and little baby Jesus from the Middle Ages, but I always enjoy finding the relatively few modern paintings that affect me deeply. On the way back from the museum, I found the Assistens Kirkegard, an enormous cemetery containing the graves of many famous Danes, like Soren Kirkegard and Hans Christian Anderson. It is a truly beautiful, incredibly peaceful place. And that evening I visited the expansive Frederiksberg park. Most striking there were the raucous nesting birds - and I am talking big birds like herons. They made a LOT of noise and it was very fascinating. Photos:
Copenhagen

* Another unusual and troubling site at the Frederiksberg park was this . As far as I could tell, it was used by parents to hang items that belonged to a child who had died, as a way of saying goodbye. Pretty darned spooky.

Oh and by the way, if you are looking for some entertaining ways to pass the time and still use your knowledge of PL/SQL, check out the brand new Toad Squared Flash game:

http://www.toadworld.com/LandingPages/ToadSquared/tabid/168/Default.aspx?qac=ToadSquaredBloggers

Sunday, May 27, 2007

Google's goal to organise your daily life

As I traversed Germany this past week (more on that in my next blog entry), I came across an article in the Financial Times (May 23) with the title:

Google's goal to organise your daily life

I found the lead paragraph quite alarming:

"Google's ambition to maximise the personal information it holds on users is so great that the search engine envisages a day when it can tell people what jobs to take and how they might spend their days off."

Someday, according to Eric Schmidt, Google CEO, we could head over to Google for answers to the question: "What shall I do tomorrow?"

Does that sound good to you? Frankly, I find it a bit terrifying.

My feeling is that one of the biggest problems facing humanity today is that so many people have abandoned critical, self-aware thinking. Instead, they absorb hours of high-bandwidth programming in the form of ads, sponsored links, pop-ups, and brand-saturated television and movies. They rely on the narrowest sources of information conceivable to "educate" them about what is going on in the world (and they are getting narrower and more focused and directed all the time).

And they, we, all of us, are completely overwhelmed by data. We have more "information" available to us than ever before, but it is not making us better-informed or more sophisticated in our thinking. Instead, we act more and more like sheep, being led about with gentle prodding and the occasional nip at our heels. We voluntarily give up our privacy in the form of personal information, in search of a "free" search engine or a "free" video or a "great deal" on another electronic gadget.

Every step along the way, we come closer and closer to the ideal world -- for corporations and marketers, that is. A world in which our every move is closely tracked (voluntarily) and our every purchase is driven by, virtually determined by, tightly-beamed messages that enter our brains through ever "richer" formats (amazing graphics, extraordinary resolution, fantastic sound) that are impossible to ignore (we are wired that way).

And so at some point, when we need to decide what our next job should be, we will ask Google what we should do. Hell, by that time, Google will probably wake us up at 7 AM Monday morning and tell us: "You are dissatisfied with your job. It's time to move on. And Coca Cola is offering some fantastic positions for people just like you!"

Not interested?

Then opt out from the Eyeball Economy: Don't click on any sponsored links. Don't click on pop-ups. Don't give up any personal information and take every opportunity to turn off a company's gathering of your data. Seek out varied sources of information (check out thenation.com - that should give you a different perspective on life and politics in the US and around the world).

AND TURN OFF THE TELEVISION! Don't watch commercial TV. I think that television is much too powerful, compelling and addictive -- we are hard-wired genetically to respond to and be drawn to human voices speaking to us, to react to moving images that closely resemble the real world. We really can't turn away from the tube once it is blaring into our faces. Best to stay away.

Instead, go out and do something instead: exercise, walk around the nearest park, visit your public library (one of the most precious resources any free society has to offer and support), hang out with friends, play board games, discuss politics instead of sports and weather (ask yourselves: why did we, the citizens of the "greatest democracy on earth" let George Bush steal two presidential elections - Florida in 2000 and Ohio in 2004? That should be good for an hour of two of animated talk).

So much to do, so little time to watch.

Lots of photos for your viewing pleasure....

I finally got around to loading up photos on Flickr from my recent international trips, so if you would like to see what catches my eye as I travel, here are some links:

Buenos Aires
Bogota
Medellin
Frankfurt
Munich
Copenhagen

Enjoy!

Sunday, May 13, 2007

Where in the world was Steven Feuertein?

I have decided to keep track of the places I've visited around the world, focusing primarily on those locations outside the United States.

On the one hand, I have no reason to think anyone but me would be interested.

On the other hand, I realize that the fact that I have been able to see so much of the world (and there is so much more to see) is a privilege that most others can never experience. I want to honor and acknowledge that privilege by publishing my WITWWSF.

You can see it here. Enjoy!

An Ode to Oscillococcinum

Oscillococcinum - a strange name for a very wonderful medicine!

I just spent a week in Latin America, performing (it does seem these days that I perform as much I inform) Best Practice seminars organized by Quest Software and its partners in Buenos Aires, Bogota and Medellin.

On Friday, two hours before my talk in Medellin, I came down with flu symptoms: bad headache, every inch of my skin sensitive to the touch and painful, very tired. This was bad news. I had a three hour talk to do.

Fortunately, I was carrying a dose of Oscillococcinum in my bag for just this situation. I quickly poured the first dose of a hundred tiny white pills under my tongue.

It didn't help me over the next few hours; it doesn't take effect that quickly, but afte taking the other two doses over the rest of the day, I woke up Saturday morning at 4:30 AM ready to head to the airport and home, completely free of flu symptoms.

Oscillococcinum had done it again, for me! Incredible....

Oscillococcinum is a homeopathic remedy made by Boiron. It is incredibly effective and the fact that you probably don't know about it says a lot about the power of the pharmaceutical industry.

I urge you to find Oscillococcinum at your nearest natural food store and stock up. Also, visit your nearest drugstore (CVS, Walgreens, etc.) and if they do not carry Oscillococcinum, ask them to do so.

When AP is the enemy, who is our friend?

AP = Associated Press

AP is one of the major news content providers to newspapers, websites, etc.

In April 2007, Tom Curley, AP president and CEO, said this about reporting in Iraq, and particularly the Anbar province: "It is about the Associated Press. We are the target. Freedom of the press is the target....There has been an extreme effort to shut down coverage from an out-of-control place. That is what the facts show.”

I read this quote in today's Sunday Tribune's column by Clarence Page, Held without charges.

Page informs us that two journalists, including Bulil Hussein of AP, have been detained and held without charges, by the US military. In the case of Hussein, AP has thoroughly investigated his activity in Iraq and can find no evidence to back up even the vague speculations made public by the Pentagon regarding Hussein.

If people like the CEO of Associated Press, must now openly declare that he and his company are the targets of the US government and military, we are in a very bad, very dark moment in our history.

And it is going to get darker and worse, unless U.S. citizens find their voices and do more than elect a Democrat in 2008.

Our nation is not perfect. But it is surely one of the best efforts to create a society of humans in which the rule of law holds sway over the actions of its individual members. That rule of law establishes the foundation for our democracy (also very imperfect), and it is something of which we should all be proud.

George Bush and Dick Cheney trample on those laws and undermine our democracy. They lie to us and barely even bother to cover for those lies. They hand over billions of our tax dollars to their friends in companies like Halliburton and Blackwater, even as those companies provide the most corrupted, degraded services in exchange for those funds.

And we let it happen. Well, I don't know that there's much I can do about it, but I will state publicly and add my name to whatever efforts are going on towards this end:

George Bush and Dick Cheney should both be impeached. They should be removed from office as quickly as possible. Indictments should be brought against them, and they should be arrested for their crimes.

Impeach Bush
Impeach Cheney


Saturday, May 05, 2007

$100M worth of sand?

I can still remember many years ago when, after I sat through a "blockbuster" (and quite dull) Schwarznegger movie with an enormous budget, I vowed not to go to the theaters to watch any movie with a budget of $100 milllion and higher. Talk about ridiculous uses for so much money!

So when I read the following juicy details about the special effects in Spiderman 3, well, I felt a little bit ill:

http://www.wired.com/wired/archive/15.05/pl_screen_p78.html

Blockbuster season's
most expensive movie star isn't a clean-cut actor. It's a pile of sand. It took a 30-person f/x team two years of CG-heavy lifting to crank out Thomas Haden Church's villainous Sandman. The laborious supporting character is also rumored to be a big reason Spider-Man 3 ran an estimated $100 million over its original $200 million budget. "This isn't just an effect like a twister or a tidal wave," says Scott Stokdyk, visual f/x supervisor. "Because it's a character, each particle of sandpile has to roll and have a direction and a target and start forming in and be part of a flow that forms into a volumetric shape." The illusion meant a crash course in developing software simulators that made sand behave like a fluid or a gas one instant and a sack of tiny marbles the next. Sand supervisor Doug Bloom says: "We did six years of R&D in two years. We honestly started the project not knowing how we'd be able to finish it." But will Spidey 3 hit box office pay dirt? Only time will tell.

They spend $100M just on getting the special effects right for the Sandman villain? What the hell is wrong with them, and wrong with us, with humans, that we would tolerate such a disgusting expenditure of money at a time when there is so much pain, so much need?

I know, I am such a whiner. Fine. Whiner, I will be. I will not see Spiderman 3 in the theaters. Maybe I will bother to watch it someday on an airplane, or at home.

Thursday, May 03, 2007

What is wrong with this picture?


I was in Las Vegas (Mandalay Bay Hotel and Convention Center) for the Collaborate07 Oracle User Group (s) conference. As usual, a very surreal experience, which was certainly driven home by this poster in the hotel elevator.

So....do you notice anything odd about the poster?

Wednesday, May 02, 2007

Quseful #2: The String Tracker Package

What's the point?

Sometimes you need to be able keep track of strings (names of some sort, usually) that you have used, so you do not use them again. I ran into this need, in fact, when I was building some backend code for Quest Code Tester for Oracle. We generate test code (a PL/SQL package) for the tests you described through the UI. That generated code includes declarations of variables. I can't declare a variable with the same name more than once. So I need to remember what I previously declared. To do that I built the qu_used package, which evolved into the string_tracker package.

The package requires Oracle Database 9i Release 2 and above, since it takes advantage of string-indexed collections. It is, I believe, an excellent demonstration of the elegance possible in one's code through the use of this structure.

I hope you can get as much value out of this package as I have.

Show me the code!

Sorry, rather than show you all the code here (very clumsy), I offer the source code and any supporting files in this zip file.

You can also download my entire "demo zip", containing all the scripts and reusable code that are part of my regular trainings. The zip for this Quseful is inside that zip as well.

Here are the files in the Quseful2.zip:

string_tracker3.pks - the lastest and greatest specification of the string_tracker package

string_tracker3.pkb - the lastest and greatest body of the string_tracker package

string_tracker.sql - a demonstration of using this code (also found below)

q##STRING_TRACKER.qut - a Quest Code Tester export of the test definition I built to veirfy that string_tracker works. You can import this into an installation of Code Tester and confirm for yourself that string_tracker works as advertised.

How do I use it?

The package contains several programs:

string_tracker.clear_all_lists Deletes all lists you may have defined in string_tracker in your session.

string_tracker.clear_list Deletes just the list specified in the call to clear_list.

string_tracker.create_list Creates a new list. Provide the name of the list, whether or not you want the strings in the list to be case-sensitive, and if you want to overwrite a list that already exists with this name.

string_tracker.mark_as_used Mark the specified string as "used" in the specified list.

string_tracker.string_in_use If the specified string is currently "used" in the specified list, return TRUE. Otherwise, return FALSE.

Examples

Here is an example of using string_tracker that mimics my own actual application of this package inside Code Tester.

I have a collection of outcomes (the tests I will perform after I test is run). For each outcome, I need to declare a local variable to hold the data. Since I can create more than one outcome for a particular OUT argument, I must be sure to avoid duplicate declarations.


DECLARE
/* Create a constant with the list name to avoid multiple,
hard-coded references. Notice the use of the subtype
declared in the string_tracker package to declare the
list name. */
c_list_name CONSTANT string_tracker.list_name_t := 'outcomes';

/* QCGU: A collection based on a %ROWTYPE associative array type */
l_outcomes qu_outcome_tp.qu_outcome_tc;
BEGIN
/* Create the list, wiping out anything that was there before. */
string_tracker.create_list (list_name_in => c_list_name
, case_sensitive_in => FALSE
, overwite_in => TRUE
);
/* QCGU: get all the outcome rows for the specified test case. */
l_outcomes := qu_outcome_qp.ar_fk_outcome_case (l_my_test_case);

/* For each outcome... */
FOR indx IN 1 .. l_outcomes.COUNT
LOOP
/* IF the string has not already been used... */
IF NOT string_tracker.string_in_use (c_list_name
, l_outcomes (indx).variable_name
)
THEN
/* Add the declaration to the test package. */
generate_declaration (l_outcomes (indx));

/* Make sure I don't generate duplicate declarations. */
string_tracker.mark_as_used (c_list_name
, l_outcomes (indx).variable_name
);
END IF;
END LOOP;

/* Clean up! */
string_tracker.clear_list (c_list_name);
END;


Gotchas

Keep the following in mind:
  • With string_tracker, you can keep track of multiple (approximately 4.3 billion) of lists of used strings. Each list may contain approximately 4.3 billion strings in it.
  • These lists only persist for the duration of your session (they are stored in package variables), and they consume PGA memory.
  • The package requires Oracle Database 9i Release 2 and above, since it takes advantage of string-indexed collections.
Do you like it? Do you use it?

I'd love to hear what you think of this utility and, in particular, if you found it useful. So please don't hesitate to post a comment on this blog or send me a note at steven@stevenfeuerstein.com.

About Qusefuls

A Quseful is a Quick and Useful (as opposed to Quick and Dirty) tip on now to write programs in the Oracle PL/SQL language more effectively. I will publish Qusefuls on my blog (feuerthoughts.blogspot.com) on a regular basis. Each Quseful contains a description of the tip ("What's the point?"), some PL/SQL code you can install in your environment to implement the tip ("Show me the code!"), an example of how to use the code to help you get your job done ("How do I use it?").