Archive for November, 2008

JavaScript (archaic) if-then-else Syntax Explanation

Sunday, November 16th, 2008

I wanted to add an explanation for a JavaScript phrase that a couple of you asked me about. When you encounter the a statement that looks like this:testpop = (defwin == null) || typeof(defwin) == “undefined”) ? true : false;

you should view this as you would an IF - THEN - ELSE statement in Visual Basic (or any other programming language).

First, I should explain the ” || ” symbol, which is known as a pipe. You create this by using the backslash key on your keyboard with the shift key down, where on the keyboard, it looks like the symbol I typed in above with a break in the middle for each line. In programming, the pipe stands in for the OR operator. Now that you understand this symbol, we can get down to the syntax of the IF statement above.

I decipher this by starting with the question mark and moving to the left and verbalize it as follows: if defwin is null OR has a value of undefined, then the IF statement is true. If defwin has any other value, the IF statement is false. The result of the IF statement is assigned to the variable testpop (and this is why the equal sign is referred to as an assignment operator in programming).

This type of IF statement is considered ‘old school’ since it derives from old scripting languages. However, you can still use it in .Net and other languages. Now, if you see it referred to elsewhere, you’ll know what it means!

JavaScript Errors - Capturing the Low Hanging Fruit

Sunday, November 9th, 2008

One easy thing you can do is look for a yellow triangle in the bottom-left corner of your browser window. If you see an error listed there, double-click the icon to open a small window that will tell you the error’s line number. Caveat: Keep in mind that sometimes one error often times leads to another error. So, the line number shown might not be the end of the story, only its beginning…

When your code is not working as expected, buckle down! Something is wrong. You just need to keep your wits, use your skills, and figure it out. You can do it!

Distance Vector Routing Protocols (Part 2) – CCNA

Sunday, November 2nd, 2008

RIP uses a number of timers to ensure that its routes are fresh and to avoid routing loops. A routing loop occurs when a router thinks it has a path to a destination, but it does not. In other words, if your cousin sends an invitation to you at your address in Chicago, but you don’t live there, you will never get it no matter how many times your cousin sends you the invitation.

 

Timers measure time in seconds and you can modify their default behavior. One of these timers, the update timer, controls how often a router sends a routing update to its neighbors. This is known as a periodic update. The default for a Cisco router is 30 seconds.

 

The invalid timer defines the length of time, 90 seconds by default, which must pass before a router considers a route invalid. In other words, if RouterA has a route to NetworkA, but does not receive an update from another router for the route to NetworkA for 90 seconds, RouterA considers its route to NetworkA to be non-existent.

 

Once a router determines a route to be non-existent, it begins a countdown as to when an invalid route should be purged (or flushed) from its routing table (which will trigger the router to send a routing table update to its neighbors). The flush timer has a default length of 240 seconds. Once this timer runs out, an invalid route is removed from the routing table.

 

Using a typical lab scenario of four interconnected routers (in circular fashion, with each router named Left, Top, Right, and Bottom), let’s look at what happens when Right informs Top that a network to its far right is down (since this is election week, why not!). I suggest you take out a paper and pencil and then draw out this network as you would do in the lab.

 

When Top learns of this update, it must protect itself from a false routing update from router Left. To understand this scenario, you must consider that electricity travels at about 70% the speed of light and that routers often handle millions of routing requests per second. Therefore, we need to slow this traffic down to about 5 MPH to understand how a router can receive information about a bad route and then tell another router about what it knows.

 

Slowing traffic down to an understandable level, let’s next suppose that half a second after Top learns of the bad route, Top receives a routing update from router Left. Left’s update does not include the update from router Right that its far right network went down (imagine that the network’s switch lost power). When Top examines Left’s update, it notices that the update contains (what appears to be) a valid route to the far right network through router Bottom. Of course, we know that this route is down, but router Bottom does not because half a second after it sent its update to router Left, it received an update from Right with the bad news about its far right network.

 

What should Top do with the update it received from Left, Top could conclude that it has a valid route, put this route in its routing table, and then send it to router Right. Can you see what a mess we would now have on our hands? If this scenario played out (again, slowing the clock down to a speed we can understand), when Right next receives a request to route to the far right network, Right will send the request to Top. Next, Top sends the request to Left, and finally, Left sends the request back to Right (who starts the loop all over again). This is an example of a routing loop!

 

Obviously, this can’t be allowed to happen. So, here’s what happens. Once Top learns from Right that it has an invalid route, Top invokes a principal known as split horizon and starts its holddown timer, which by default runs for 180 seconds. The concept of split horizon basically solves the problem I raised in the above scenario by forbidding router Top from sending an update to router Right about the route that is down. In other words, I can’t update you about a topic you originally told me about for a specific period of time (the holddown time). Once the holddown timer expires though, all bets are off. Cisco has a very detailed explanation of these concepts here in an EIGRP tutorial.

 

Newer implementations of distance vector routing protocols such as RIP and EIGRP add one more element to the intrigue by implementing split horizon known with poison reverse. Using poison reverse with our example above, router Top would receive the route update from Right and then send the invalid route immediately back to Right with an unreachable metric. RIP’s metric would be 16, which is its definition of an infinite path.

 

Finally, to conclude this discussion for this week, when router Top receives the update from Right, Top immediately recalculates its routing table and sends a triggered update to its directly-connected neighbors. A triggered update occurs when a router learns of a route change outside of its scheduled update time, sent when the router’s update timer expires.