Wednesday, June 28, 2006

Cool Illusion

Nothing Oracle related this time. Just some fun. I received this nice little illusion today via email. Enjoy.

Thursday, June 22, 2006

10,000 Visits and Counting

Well, today my blog registered its 10,000th visit. While that is probably an average couple of days for Tom Kyte and a few others, I am kind of proud of my meager slice of the Oracle blogging pie. Of course, I get oodles of traffic from Google. But, that's not too bad is it?

Seriously, it has been a fun 4+ months of blogging. I haven't been able to blog as much as I would have liked over the past 2 months. The fact that I still desire to blog is a good sign though. Time and other constraints in life always crop up. Anyway, it has been really fun and I hope some of you have enjoyed your visits. I have received some very interesting emails and questions from Oracle enthusiasts all over the world.

I want to send one special thanks out to Tom Kyte for recommending I start a blog (and placing me on his metablog even though I stole the naming style of his blog) and another to Doug Burns who featured my blog on his site several months back, giving my traffic a jump start.

Actually, Tom, my first choice for a blog name was The Emusing Blog :)

Wednesday, June 21, 2006

Oracle Blooper

Well, instead of assimilating the suitable, albeit plentiful, Oracle manuals to cover the material required for the Oracle 7.3 -> Oracle 9i upgrade certification exam I opted to search for a single resource. I came across a third-party study tool that was recommended by Oracle and seemed to foot the bill. Very much to my surprise the material was disjointed, loaded with typographical errors and often flat out wrong.

I was willing to forgive the copious typographical mistakes per/page (which approached the Golden Ratio mind you) as I could deduce the intentions. I could stomach the disjointed word salads and sparse information. But I refused to read another page after encountering a heinously blatant, careless and nonsensical bit of misinformation. How could I possibly continue to use this material as a study reference if I could not trust the content? To the misinformation at hand, the material states the following verbatim:

PGA_USED_MEM - The process is using PGA memory.
PGA_ALLOC_MEM- The process has been allocated PGA memory.
PGA_MAX_MEM - The process has been allocated maximum memory.
PGA_GIBBERISH - The process has found gibberish in the PGA and wishes to purge. (OK, this was my invention)

I scratched my head. Re-read, scratched head some more. Finished beer and reached for another. Nothing seemed to alleviate my consternation. I was well aware of these attributes of v$process and was not so much concerned with the incorrectness, as I knew their meaning. It was the gross negligence that left my jaw drooping for a minute.

The values for these attributes are NOT Boolean as you well know. You don't query v$process and find a Y or N associated with the values for these attributes. The Oracle documentation defines these attributes in a very straightforward manner. Is there any other way?

PGA_USED_MEM number PGA memory currently used by the process
PGA_ALLOC_MEM number PGA memory currently allocated by the process (including free PGA memory not yet released to the operating system by the server process)
PGA_MAX_MEM number Maximum PGA memory ever allocated by the process

Simply stated, I was shocked that the author(s) and editor(s) put such little thought into the material and subsequent proof reading. Actually, I think the author's brain was tied behind his back while writing this material. If one aspires to put together training material and includes attribute definitions that are pre-defined for you in the Oracle documentation set, might I recommend taking a cursory glance at said documentation? You can't just feed me a heaping helping of documentation rubbish without expecting me to pitch the kindling into the nearest can - I know, I've seen me do it! Did I mention the material is several fold more expensive than any of Tom Kyte's or Jonathan Lewis' books? Lesson learned.

Sunday, June 04, 2006

Grapes of Math Puzzle

First, let me say that I was really excited about the title I gave to this post. It hit me while mowing my lawn and made me stop and laugh - thankfully the neighbors were not watching (as far as I know). Anyway, I did a quick Google search on the title Grapes of Math to see how original it was. While I had not heard of the title, it has many hits on the Web. Oh well, so much for absolute originality.

Tom Kyte has a really good puzzle on his blog. I enjoy a good puzzle and submitted my response, which I believe is the solution to the puzzle. But, for my personal satisfaction and to address Mr. Ed's concerns, I wanted to prove that my response was the only possible correct answer, given some conditions I have derived from Tom's post, the problem (picture) itself and intuition. If you are interested in the puzzle, please visit Tom's blog and try to solve it for yourself and skip the remainder of this post.

You mathematicians will please forgive any seemingly barbaric notations or proof layout :) Cary, Jonathan, Tom or any other mathematician lurking about, please feel free to critique the proof if it is incorrect.


Grapes of Math equation generated from picture:
(10(banana)+apple)/pear = 10(grapes)+peach+(strawberry/pear)

Prove the only solution set (banana, apple, pear, grapes, peach, lemon, strawberry) for the Grapes of Math is (9,3,2,4,6,8,1) given the following conditions:

Conditions

0) each fruit represents a distinct integer that must be in [0-9]. Negative integers don't really make much sense in this case - how do you ascribe a negative integer to any fruit but the pear?
1) the numerator concat(banana,apple) is in [00-99].
2) pear cannot be 1 because grapes * pear would equal grapes and it does not. grapes * pear = lemon.
3) pear cannot be 0 because x/0 is undefined for all integers x.
4) from 2) and 3) 9 >= pear > 1.
5) grapes cannot be 1 because grapes * pear would equal pear and it does not. grapes * pear = lemon.
6) grapes cannot be greater than 4 because that would yield a concat(banana,apple) that is > two digits, which cannot be (condition 1). For example, the integer portion of the quotient concat(grapes,peach) must be less than 50, based on 4).
7) from 5) and 6), 4 >= grapes > 1.
8) from 7) banana is in [4-9]. If the integer portion of the quotient (grapes) is 2, 3 or 4, then given 4) the numerator, concat(banana,apple), must be in [40-99] . The least the numerator could be is 40 given 4) and 7). The highest would be 99 by definition.
9) all fruits taste really yummy (This is for Mr. Ed)

Proof by Exhaustion (brute force method): Grapes of Math Puzzle

Case 1: grapes = 4

If grapes = 4 then banana can only be 8 or 9 because of 4).

Case 1.1: banana = 8

If grapes = 4 and banana = 8 then pear = 2 and lemon = 8. Lemon cannot equal banana by condition 0) and, thusly, banana != 8. Therefore, concat(banana,apple) is not in [80-89].

Case 1.2: banana = 9

If grapes = 4 and banana = 9 then pear = 2 and lemon = 8. Then by subtraction (banana - lemon ) = (9-8) = 1 = strawberry.

Case 1.2.1: apple = 0

If apple = 0 then peach = 5 and concat(grapes,peach) = 45 with no remainder. We know that there must be a remainder because strawberry is 1 in this case. Therefore, apple != 0 and concat(banana,apple) is not 90.

Case 1.2.2: apple = 1

If apple = 1 then apple = strawberry = 1. Therefore, apple != 1 and concat(banana,apple) is not 91.

Case 1.2.3: apple = 2

If apple = 2 then apple = pear = 2. Therefore apple != 2 and concat(banana,apple) is not 92.

Case 1.2.4: apple = 3

If apple = 3 then peach = 6 and concat(strawberry,apple) - concat(strawberry,pear) = strawberry = 1. Therefore, grapes = 4, banana = 9, pear = 2, lemon = 8, strawberry = 1 and apple = 3.

Therefore, concat(banana,apple) = 93 is a numerator solution.

Case 1.2.5: apple = 4

If apple = 4 then apple = grape = 4. Therefore, apple != 4 and concat(banana,apple) != 94.

Case 1.2.6: apple = 5

If apple = 5 then peach = 7 and pear = 4. But, pear is assumed to be 2 and cannot 2 != 4. Therefore, apple != 5 and concat(banana,apple) != 95.

Case 1.2.7: apple = 6

If apple = 6 then peach = lemon = 8. Therefore, apple != 6 and concat(banana,apple) != 96.

Case 1.2.8: apple = 7

If apple = 7 then peach = lemon = 8. Therefore, apple != 7 and concat(banana,apple) != 97.

Case 1.2.9: apple = 8

If apple = 8 then apple = lemon = 8. Therefore, apple != 8 and concat(banana,apple) != 98.

Case 1.2.10: apple = 9

If apple = 9 then apple = banana = 9. Therefore, apple != 9 and concat(banana,apple) != 99.

Therefore, for grapes = 4, the only solution for numerator concat(banana,apple) in [80-99] is 93.

Case 2: grapes = 3

If grapes = 3 then banana can only be 6 or 7 because pear > 1 from condition 4).

Case 2.1: banana = 6

If grapes = 3 and banana = 6 then pear = 2 and lemon = 6, and lemon = banana = 6. Therefore, banana != 6 and concat(banana,apple) is not in [60-69].

Case 2.2: banana = 7

If grapes = 3 and banana = 7 then pear = 2 and lemon = 6. This means apple can only be in [4-5] (cannot be 6 because lemon = apple = 6 violates condition 0).

Case 2.2.1: apple = 4

If apple = 4 then peach = 3, and peach = grapes = 3. Therefore, apple !=4.

Case 2.2.2: apple = 5

If apple = 5 then peach = 5. Therefore, apple != 5.

Therefore, concat(banana,apple) is not in [70-79].

Case 3: grapes = 2

If grapes = 2 then banana must be in [4-5] because of condition 4).

Case 3.1: banana = 4

If banana = 4 then lemon = banana. Therefore, banana != 4 and concat(banana,apple) is not in [40-49].

Case 3.2: banana = 5

If grapes = 2 and banana = 5 then pear = grapes = 2. Therefore, banana != 5 and concat(banana,apple) is not in [50-59].

Therefore, concat(apple,banana) is not in [40 - 59].

From grapes in [2-4], we have proved that only one solution (93) exists for the numerator concat(banana,apple) between 40 and 99. By condition 7), concat(banana,apple) is not in [00-39].

Conclusion

Therefore, 93 is the only solution for concat(banana,apple) in [00-99]. After exhausting all possible two digit values for concat(banana,apple) only one solution set (banana, apple, pear, grapes, peach, lemon, strawberry) was found:

(9,3,2,4,6,8,1)

and for Mr. Ed...

(9,3,-2,4,6,8,1) iff concat(grapes,peach) = -46

Solution set applied to equation of Grapes of Math:

(10(9)+3)/2=93/2=46 ½=10(4)+6+(1/2) quod erat demonstrandum

Note: lemon is absorbed in the equation, given the correctness of strawberry = 1.