Experimental forum for "Technology" discussions (computers, cameras, etc).

Re: Learn to Program: BBCode

Postby Bob Kuczewski » Sun Dec 19, 2021 12:17 pm

OK, here's my "homework" for Exercise 5:

These are the general steps for getting safely into the air:

  1. Evaluate site and conditions
  2. Set up glider
  3. Preflight inspection
  4. Hang check
  5. Re-evaluate conditions
  6. Hook-in check
  7. Launch
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7623
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Learn to Program: BBCode

Postby Bob Kuczewski » Tue Sep 20, 2022 9:49 pm

Nested Quotes

We've already covered quotes in Exercise 3 (see page 3 of this topic), but let's take a look at nested quotes. These are typically quotes of other people who also quoted other people.

For example, if I were quoting Al who had quoted Bill who had quoted Carl, it might look like this:

Here's my quote of Al which includes the nested quotes of Bill and Carl:

Al wrote:Hi Bob,

I just heard from Bill that he and Carl might be flying this weekend. Here's what I got from Bill:

Bill wrote:Hi Al,

Carl and I are thinking of flying Saturday or Sunday. Are you up for it? Here are the details from Carl:

Carl wrote:Hi Bill,

The forecast looks good this weekend. What do you think about a bunch of us heading out around noon on either day?

Your friend in flight,
Carl


Carl has a good track record of picking good days, so I think I'm in.


If Bill can go, then I'm leaning toward joining them. How about you?

Al


As you can see from this example, the use of nested quotes is very helpful to show who said what to who. This is similar to what happens in a long chain of email messages where each person had quoted the message they got which included other messages as well.

The concept of one thing being completely within another thing is often called "nesting". To help make this clear, here's an animation of properly nested dolls:

Nested_Dolls_500.gif
Nested_Dolls_500.gif (1.67 MiB) Viewed 74 times


You'll notice that each newly exposed doll was completely inside of the previous doll. It would be difficult to imagine one of the dolls being physically both inside and outside of any of the other dolls at the same time ... without breaking them. So proper nesting is fairly natural in the real world. But we have to remember to do it in the computer programming world ... or unexpected things can happen.

We also find nesting in mathematics when using paired symbols to group the parts of an expression into different levels. Here's a simple example:

42 × { [ x × 3 ] + [ (2 + y) ÷ (7 - z) ] }


You'll notice that each pair of grouping symbols - { }, [ ], ( ) - are properly nested in that example. Here's an example where the symbols are NOT properly nested:

[ a × ( b + c ] ÷ d )


You'll notice in that example that neither the "(...)" grouping nor the "[...]" grouping are completely within the other. This is improper nesting, and you can see that it's much easier to do in the "computer world" than to improperly nest dolls in the physical world. So we have to pay attention to keep from doing it by accident.

Another example is in BBCode itself. We should generally properly nest all of our pairs of tags so that one pair is completely inside another pair:

[b] [u] Hello! [/u] [/b]  <--- Properly Nested

[b] [u] Hello! [/b] [/u]  <--- Not Properly Nested


You'll notice in the first (properly nested) example, the underline codes ([u] and [/u]) are completely inside the bold codes ([b] and [/b]). In most computer "languages" (including BBCode and HTML) we want everything to be properly nested so the computer knows what we want.

Now let's probe the depths of nested quotes on this forum. Here are 10 quotes:

Al wrote:
Bill wrote:
Carl wrote:
Dan wrote:
Earl wrote:
Frank wrote:
Gus wrote:
Hal wrote:
Irv wrote:
Joe wrote:Hi!


As you can see, the software cycles through 3 colors and then gets stuck. I personally think that's a bug (even with only three colors, they could be recycled), but it's what we have. Here's the BBCode that will produce that series of deeply nested quotes:

[quote="Al"]
[quote="Bill"]
[quote="Carl"]
[quote="Dan"]
[quote="Earl"]
[quote="Frank"]
[quote="Gus"]
[quote="Hal"]
[quote="Irv"]
[quote="Joe"]
Hi!
[/quote]
[/quote]
[/quote]
[/quote]
[/quote]
[/quote]
[/quote]
[/quote]
[/quote]
[/quote]


For clarity, I've indented each pair of matching [quote] and [/quote] tags at the same "nesting" level. So the top [quote] matches the bottom [/quote] and encloses everything in between. That happens at each level to create a properly nested structure.

OK, here's an exercise for anyone who wants to give it a try:

Exercise 6:

Post a series of nested quotes about anything related to hang gliding.
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7623
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Learn to Program: BBCode

Postby Bob Kuczewski » Tue Sep 20, 2022 11:27 pm

Here's my "homework" for Exercise 6:

A typical kingposted hang glider can be considered to consist of the following groups and subgroups:

Hang Glider
Sail
Cloth
Stitching
Frame
Keel
Leading Edges
Cross Bar
Control Frame
Down Tubes
Base Tube
King Post
Fittings
Cables
Battens
Hang Loop
Join a National Hang Gliding Organization: US Hawks at ushawks.org
View my rating at: US Hang Gliding Rating System
Every human at every point in history has an opportunity to choose courage over cowardice. Look around and you will find that opportunity in your own time.
Bob Kuczewski
User avatar
Contributor
Contributor
 
Posts: 7623
Joined: Fri Aug 13, 2010 2:40 pm
Location: San Diego, CA

Re: Learn to Program: BBCode

Postby Craig Muhonen » Fri Sep 23, 2022 3:17 pm

A says, "ever seen a deer with no eyes"?
B says, "no"
A says, noideer


TY Bob.
"You gotta' push the stick forward while you're lookn' at the ground
Craig Muhonen
User avatar
Contributor
Contributor
 
Posts: 696
Joined: Tue Nov 05, 2019 9:58 pm
Location: The Canyons of the Ancients

Previous
Forum Statistics

Who is online

Users browsing this forum: No registered users and 2 guests

Options

Return to Technology Forum