Wednesday, February 9, 2011

Sunday at Bear Creek

My buddies prefer to play Bear Creek, which is not trying to be one of the 100 Greatest Golf Courses in the United States. There are times it might not be the best course near my home. The greens are barely alive and the tee boxes tend to be uneven and overgrown. The fairways are flat and the rough can hide a ball.
They have one course that is mostly par 3s that Ron likes. He says that we can play them quickly, and that's true. It does have water that is like a magnet for Ron's ball. In the span of a year, you could easily count the number of times that Ron hits over water on the first try.
I'm sometimes better, but not last Sunday. I hit a very nice drive on the 10th and immediately put my second shot in the water. It happens.
We played the back nine twice because the course was busy. The starter told us to start on the 10th and we raced around. When we made it to the 18th, there were 7 carts lined up at the 1st hole. Ron and I agreed to play the back nine again. He had a Super Bowl party and we would have spent at least 2 hours waiting to do something on the front nine.
Another feature of Bear Creek is that it's patrons seem to be unable to hit the ball straight. I think it's a prerequisite to get a tee time. There are a few holes on the course that you hurry through because you are in the firing range of another tee box. Luckily, most are right-handed and their preferred slices are flying the other direction, but sometimes you duck someone who has discovered a hook.
The greens were soft instead of the usual rock hard because of the frost from the cold front. That made green reading more of an art because your ball navigated other pitch marks. The ball would also stop rolling, which made downhill putts very difficult to play.
We had a good time. We didn't worry too much about the score. It's Bear Creek.

Back to Aikido

January was not a fun month.
February will be better, but we've been hit with two solid cold fronts that make travel something to be avoided.
I made it Aikido once in January. I planned to go at other times and either work or slippery roads changed my mind.
I talked to Sensei and we are back on track. I spent most of the class practicing ukemi, which teaches balance.

Monday, January 3, 2011

Aikido from Tomiki to Aikikai

I have always been interested in Aikido. In 2001, I joined a dojo for six months, which was Aikikai ( a later variation of Aikido). I quit because I hurt my hand falling to the mat, I made the mistake of trying to catch myself instead of falling correctly, and things were changing in my life. I had recently been laid off from my programming job, I had moved so that the dojo was a long drive, and it was easier to be on the couch.
In 2007 I started again. I joined a Tomiki Aikido dojo in Houston. It sounded interesting. This type of training can be very formal. I liked the people in the dojo and stayed long enough to be promoted to second level (nikyu), which is two levels below a black belt. I liked it but for various personal reasons I wanted something different.
In June I joined an Aikikai school. My experiences with Tomiki have helped me but it has also been a sea change.
Aikido has an emphasis on posture and using the large muscles. Working through it has improved my golf game.

Writing in the new year

OK, I am writing more for myself this year.
I have spent the past four years working as a technical writer for one of the largest software companies in the world, creating user manuals, white papers, and other customer-facing documentation. My team broke up last year and I am now the sole writer here, which is good and bad.
My buddy, Ian, has returned from Arizona. He and I play golf at least twice a month on the weekends. He's better than I am by about 10 strokes a game. I picked up a set of Callaway wide sole irons and a Cobra driver in the past six months, which have improved my game.
Now I'm working on the short game. I say that every year.
More on that later.
I changed schools in Aikido. That was a big change for me.

Monday, November 3, 2008

How SQL compiles

All SELECT SQL statements have this format:


SELECT [ALL/DISTINCT] target list

FROM table/view

WHERE criteria

GROUP BY target list

HAVING criteria

ORDER BY target list



You can have a select statement using only the SELECT. The statements below are legal.



SELECT 'Hello';

SELECT 2 + 2;


This is an example of how SQL parses your statement. You write:



SELECT HP.Member_Id, HP.Prim_Mem_Id, HP.Carrier_Id, HP.Seq, CA.Add1, CA.Add2, CA.City, CA.State, CA.Zip

FROM dbo.Eligibility_HealthPlan HP

INNER JOIN Carrier C ON ( HP.Carrier_Id = C.Carrier_Id )

LEFT JOIN Carrier_Address CA ON (CA.Carrier_Id = HP.Carrier_Id AND CA.Address_Code = HP.Address_Code)

WHERE HP.Member_Id = '10076' and (HP.seq = -1 or HP.seq = 9)

GROUP BY HP.Member_Id, HP.Prim_Mem_Id, HP.Carrier_Id, HP.Seq, CA.Add1, CA.Add2, CA.City, CA.State, CA.Zip

HAVING COUNT(HP.seq)> 0

ORDER BY HP.member_ID


The SQL parser begins with the FROM part of the statement.

FROM

A virtual table (vt1) is created by joining the first two tables in a Cartesian join. Every row of one table is joined to every row of the second table. All of the columns are qualified by the table or alias name.

ON
The ON is one of the filters. The other filters are WHERE and HAVING. Each row in the virtual table (vt1) where the join condition is true is saved and added to the second virtual table (vt2).

NOTE:
OUTER JOINS

If you are writing an outer join then you mark one or both of the tables as preserved. A preserved table has all of its rows returned whether or not the table fulfills the ON condition. To preserve a table, you select the type of join. The LEFT OUTER JOIN means the left table is preserved, RIGHT OUTER JOIN means the right table is preserved and FULL means that both tables are preserved. A virtual table, vt3, is created. The non-preserved table uses NULL to match the rows in the preserved table.

NOTE:
Adding expressions to ON statements.
You can add a logical expression to the ON statement. If you wanted all of the information from eligibililty_healthplan and carrier where the carrier_id are equal and the effective date is not today you would write either of the following statements:

FROM dbo.Eligibility_HealthPlan HP INNER JOIN Carrier C ON (HP.carrier_id = c.carrier_Id and HP.EFF_Date <> NOW())

FROM dbo.Eligibility_HealthPlan HP
INNER JOIN Carrier C ON (HP.carrier_id = c.carrier_Id )
WHERE HP.EFF_Date <> NOW()

Both statements are functionally the same. The statement works exactly the same in an INNER JOIN. You may have a problem with an OUTER JOIN statement.

FROM dbo.Eligibility_HealthPlan HP LEFT OUTER JOIN Carrier C ON (HP.carrier_id = c.carrier_Id and HP.EFF_Date <> NOW())

The eligibility_healthplan is the preserved table. In vt2 table, a row with an effective date that does not equal today is eliminated. In the vt3 table, the effective date rows are added back to the virtual table because that table is preserved.

If you use an outer join, write the query as follows to avoid cpu cycles:

FROM dbo.Eligibility_HealthPlan HP LEFT OUTER JOIN Carrier C ON (HP.carrier_id = c.carrier_Id )
WHERE HP.EFF_Date <> NOW()

WHERE

The WHERE filter is applied to the vt2 or vt3 table. A virtual table, vt4, is created and the rows where the criteria is true are added. You cannot use aggregate functions (COUNT (), MAX (), MIN ()) in a WHERE clause because the data has not been grouped. You cannot refer to an aliased column name because the SELECT statement has not been processed yet.


GROUP BY
The virtual table,vt5, is created. The rows from vt4 are arranged into groups. A single value for each group is generated. Each group is a unique combination of values based on the target list. With a GROUP BY, the rest of the steps expect each group to return a single value.

HAVING
The virtual table, vt6, is created. The HAVING clause filters on the groups. You can use any aggregate function in the filter. The HAVING clause is the only filter that applies to grouped data.

SELECT
The virtual table, vt7, is created. This is the step where the virtual table looks like a result set. Since this is one of the last steps, an alias that you have created in the SELECT statement may not be used in earlier steps. If you write the following:

SELECT YEAR(eff_date) as yearEffDate FROM claimapproved_det WHERE yearEffDate = ‘2006’

You see an sql syntax error.

If you write:

SELECT year(eff_date) as yearEffDate FROM claimapproved_det ORDER BY yearEffDate

The statement works because the ORDER BY step happens after the SELECT and can use the alias.

DISTINCT
This step removes duplicate rows from the vt7 to create vt8. A DISTINCT clause is redundant when there is a GROUP BY.

ORDER BY
The step where the vt8 rows are sorted by the specified columns. This step does not return a virtual table but returns a cursor.

By definition, a set of values does not have a predetermined order to its rows. The set is a collection and the order of the values within the set does not matter. Any query that applies a sort order to the rows is defined as a cursor.

The ORDER BY clause cannot be used in a view, table-valued function, sub-query, or derived table, or common tab
Publish Post
le expression (CTE).

Tuesday, December 4, 2007

Saturday 12 -1

One of the tenets of a lifelong practice is that sometimes you are awful. You reach a point while making progress and then slip back 10 strokes.

Five years ago I was a 15 handicap. I am now a 30 handicap. I stopped playing for several years because friends had moved, I was between jobs, and I didn't have the time or money to play. I started playing again this March. I was lucky to join two other guys who straddled my ability. We all have the same low-key attitude toward the game.

This year I set myself to be better. I want to be a 20 handicap. I took lessons. I learned from the lessons. I looked at other equipment. I have made progress in the past five months. I have been playing better.

Then, for the past two weeks, I slipped back into over-30 mode. It's frustrating but that's the game. I have to give myself more time.

Tuesday, November 20, 2007