Saturday, September 26, 2009

My brain locked up

And all that came out was...WHUT?

It was this:

After the system specification is complete but before the design is coded in the actual programming language, portions of the system may be coded in what is called pseudocode, a design technique that lays out the processing in a simple but standardized language so that the logic can be examined before it is translated into the more complex programming language.

Before delving into pseudocode we must consider how expressions are processed in most computers. Expression processing uses concepts from algebra for computing the results of evaluating expressions. In most computer languages as well as in pseudocode the normal symbols + for add, - for subtract, * for multiply, and / for divide are used. Exponentiation, or raising a number to a power, has various representations in the different languages and for our discussion here we will use the symbol ** which is used in several languages and in pseudocode.

The expression A + B * C means to take the value of A, B, and C and perform the indicated operations. However, the rules of operator precedence apply when there are no parentheses in the expression. In the absence of parentheses the rule of operator precedence from highest precedence to lowest precedence is:
     1) any exponentiation is evaluated first
     2) followed by any multiplication or division in their order of appearance from left to right
     3) followed by any addition or subtraction in their order of appearance

So for our simple example, if A has the value 2, B is 3, and C is 4, the expression value is 3 * 4 + 2 which is 14.

However, if parentheses are added to the expression, expressions in parentheses are evaluated first, starting with innermost parentheses. Within parentheses, the above operator precedence rule still applies. If we rewrite our simple expression to (A + B) * C we now add A and B to get 5; then multiply by 4 to get 20

Continuing to use the same values, A is 2, B is 3, and C is 4:
     1) C – A ** 2 is 0
     2) A + B * C ** 2 is 82
     3) (A + B) * C ** 2 is 80
     4) ((A + B) * C) ** 2 is 400

Pseudocode resembles English and contains the following simple statements which are sufficient to describe any process:

• Sequence – an ordered series of simple actions like computations. The pseudocode code statement is SET.

• Decision branching – tests a relationship in the process (called a condition) and performs one sequence if the relationship is true and a different sequence if the relationship is false. The pseudocode statement is IF (condition) … THEN…ELSE…END IF.

• Repetition – the order to continue to perform a sequence of actions while a condition is true. Skip to the sequence following the repetition when the condition becomes false. The pseudocode statement is WHILE (condition)…END WHILE.

A condition can be a comparison. Possible comparisons are:
     = tests if the two values are the same;
     > tests if the left operand is greater than the right operand;
     <>= tests if the left operand is greater than or equal to the right operand;
     <= tests if the left operand is less than or equal to the right operand. 

A condition can use logical operators. The logical operators are AND, OR and NOT. 
     AND is true if both of the operators are true and false otherwise 
     OR is true if either or both of the operators are true and false otherwise 
     NOT reverses the value of true to false and false to true

Again continuing to use the same values, A is 2, B is 3, and C is 4:
     A = B is false 
     A > B is false
     A < B is true

The SET statement gives a value to a variable. An example of a sequence of pseudocode instructions using only SET instructions: 
     SET A TO 2
gives A the value of 2
     SET B TO 3
     SET C TO 4
     SET C TO A + B
changes C from 4 to 5
     SET A TO B * C
changes A from 2 to 15. Why? The previous SET statement changed the value of C. The statements are an example of a sequence of actions that, if they were written in a programming language, the computer would execute in order.

The IF…THEN…ELSE…END IF statement is a decision branching statement that tests the condition specified in the IF clause. If the condition is true, the sequence of statements in the THEN clause is executed and the sequence of statements in the ELSE clause is skipped. If the condition is false, the sequence of instructions in the THEN clause is skipped and the sequence of statements in the ELSE clause is executed. In either case, after the THEN or ELSE sequence, execution goes to the statement after the END IF. Using the values of A, B, and C from the last example,
     IF (A > B) THEN
     SET LARGER TO A
     ELSE
     SET LARGER TO B
     END IF
     SET A TO 0
     SET B TO 0
After this pseudocode is evaluated, what are the values of A, B, and LARGER? A started out as 15 and B was 3. Since 15 > 3 is true LARGER becomes 15, the ELSE clause is skipped and both A and B are set to zero. Which clause would be executed if A and B were equal? The condition (A > B) would be false so the ELSE clause is the one that would be executed.

Repetition is coded as a WHILE loop in pseudocode. The following example showing a WHILE loop in pseudocode instructions is from the CLEP sample test.

     SET A TO 1
     SET B TO 3
     SET A TO A + B
     WHILE A <>

An important point about using a WHILE loop is that some statement within the WHILE and END WHILE pair must change a value in the condition that is being tested to eventually make the condition false, otherwise the loop will run forever. In the above pseudocode A has the value of 4 when the sequence of instructions reaches the WHILE statement for the first time. Since 4 is less than 20, the condition is true and the sequence of statements within the WHILE loop is executed. The value of A changes to 4 * 4 / 2 which is 8. The sequence encounters the END WHILE and repetition causes the execution to return to the WHILE statement. The value of A is still less than 20 so the WHILE sequence is entered once again. This time A is set to 8 * 8 / 2 which is 32. The END WHILE is processed and repetition causes the WHILE to be evaluated again. This time A is greater than 20 and the processing skips to the non-existent sequence after the END WHILE. For this example, the final value of A is 32. 

Note that A, B, and C are just arbitrary names for the values. The name given to a value can be any letter or descriptive name like: 
SET AREA TO LENGTH * WIDTH


I think I need help.


Thursday, September 24, 2009

Festival of Art '09

I got so caught up in other things I forgot to mention something...

Last weekend was the Catalina Festival of Art! Between work, school, and various other unpleasant time sucks I didn't really get to enjoy it as much as I have in past years.  I did notice that instead of the pegboard & post contraptions usually set up with tables for the booth space, this year each booth was supplied with a nice white shade canopy and a sort of coated metal gridwork to hang things on the back wall of their space, along with the usual large table and metal folding chair. I'm guessing it made a positive difference for the artists, but I'm quite sure it made a tremendous impact on the overall look of the event. 
 

And you can see an overhead shot on the Art Association's home page here. (Not sure how long that linky will last!)

So, in no particular order, a few of my favorites:

Xavier's pottery, all gorgeous but I really love the mugs.



Oddly pretty and very delicately detailed bug watercolors, I have a friend who would probably love these.



Lorenzo's mosaics, the framed mirrors are nice but the pieced together images of the casino and the island are really clever and special.



Fused glass plates, sparkling in the sun - so pretty & so impractical!



Lastly, the art of Ed Arnold:



I like that he uses recycled materials - discarded bits of wood and mis-mixed house paint. 


Other than that, I don't know what it is about his creations that appeals to me but you can read more about the artist and a show he had last year here and see much more of his work here.

Someday, when I can afford it, I'd like to do more to support independent small artists. But for now - this will have to do! 

Monday, September 21, 2009

PSA: Awesome Yarn Alert

While, like many people these days, I am financially challenged and therefore on a yarn diet, I feel it is my solemn duty to bring to your attention, gentle readers, any extraordinary opportunities to GET SOME REALLY AWESOME NEW YARN!

See this:



Purple pink girly deliciousness = Violet Femme!

And my personal fave:



I love it for the color alone - but don't you need a Penny For Your Thoughts?

These and several more have just been added to Little Red Bicycle, as part of the new "Snowflake Yarn" line.  If you think the rush for Wollmeise is impressive, you ain't seen nothin' yet.  So do not pass go, do not collect $200, go directly to Little Red Bicycle and grab your own Snowflake Yarn before it's all gone!



Why are you still here?  Didn't I tell you to go? Go nowwwww.......

Sunday, September 20, 2009

The steepness of the curve

Late last week I went overtown to take a Dantes exam for Introduction to Law Enforcement. My trip over in the morning was perfect:



Water like glass - I couldn't ask for a smoother ride.

And on the way home we had just passed the Queen Mary:



When something interesting came into view:


Those are three different emergency vessels, lights flashing. 

Followed by this:



There wasn't a fire or anything else that we could see, so I'm guessing it was a drill and we just happened to pass by at the right moment.

Anyway, the strange list of phrases in my last post was part of my memory key for remembering significant U.S. Supreme Court cases and it must have worked because I passed the test with a comfortable margin. Another 3 credits down, 11 more to go. My goal is to knock out those remaining credits by completing four more Dantes or CLEP exams by the end of the year. It's not going to be easy but I think the trick is to select exams that cover the kind of material I can absorb quickly. I can't really explain why some subjects are easier for me to grasp than others - they just are.

But apparently there are some lessons that I take much longer to learn.  While I do know that I don't have the physical fitness level I used to have, that I have spent the past several years at a series of desk jobs, and that I am no longer in my 20's - still.  Every time I take on a new home repair project I make the same mistake.  I prepare and plan in advance and then on the day, dive in happily, crouching down or reaching forward or grasping tightly or...you get the idea. 

Then the next day I wake up, roll over, get out of bed and
HOLY MOTHER OF GOD!!!!!!

pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain pain...

This time was no exception.  And I had plenty of time to consider my own folly, as I lay face down on the floor, wondering what had possessed me to spend all those hours scraping layers of paint from my shower walls and wishing I had trained the cat to fetch the ibuprofen bottle.

*wimper*

Wednesday, September 16, 2009

It's awfully crowded in there

I sat down this evening with the intention of writing some sort of post to explain what I've been up to lately, and what I'm planning to do in the future. But my head is entirely too full of information that I will be needing in the VERY near future, as in tomorrow morning at 11:00am.

Here's a few snippets:
  • excluding this week
  • poison Lumber tree
  • map of the entire country
  • Preston's car impounded
  • Opperman property inventory
  • a locked well
  • Robinson heroin
  • terry stop
  • Smith stuff in a sack
  • attorney's gotta be dere
That gibberish actually does make sense to me and if you could see inside my overstuffed brain, you'd understand it all too. 

I think.