One of the first things I learned while being a TA is that when code is not working do not read the comments, read the code. Why is this? The comments lie, more often than not when something is not working the comments will not say the same thing as the code. Why is this? Well the person with the issue in the code does not fully know how to get the code to work and thus will not document the non-working code correctly. If they did know how to get the code to work right they would not need to see a TA.

I find reading the code not the comments to continue to be true in the corporate world. More often then not the comments in the code do not tell the full story of what the code does or the comments are out of date or the comments are just flat out a lie. It is normally, best to just use the code as your guide to what the software is doing (or not doing). This is even true in OSS Projects. These projects are not written by software Gods and more often than not the person doing the documentation is not the same person that wrote the code.

When in doubt (and even when not in doubt) have the code be your guide and pay no attention to the comments. Now this is not to say do not write comments. I myself write comments all the time in my code (even for software that I write for myself). I normally trust my own comments and find them to be helpful for to speak on the reasons I write one line of code over another, but I write my comments in such away as to still let the code speak for it self. After all if the code cannot be read, then it should be rewritten in a readable way.

## Saturday, August 15, 2009

## Thursday, August 13, 2009

### TAs and Samples of the Class

I got through Grad school at NIU by being a TA (and a GTA one semester). One thing I quickly learned was that the students that TAs see are by far not the cream-of-the-crop. If you think about it this would have to be true, if the student knew what they were doing they would not need to see the TA (unless they are smart and need some type of feedback about how smart they are). Now do no miss understand me, I not saying that see a TA makes you an idiot, but people that see TAs tend to be those that are having a hard time with the class.

One thing that most people that need to see TAs have in common is that they do not know how to figure out were their mistakes are. If these people could figure out where their mistake were they would stand a good chance of being able to find some help outside of asking a TA (e.g. Google). (This kind of thing contiues into the work place, with less apt people bugging compentent people for assistance.)

Every now-and-then, it does happen that a student will come in and say I am having such-and-such problem and I am very sure that the error is here. Most of the time these students are right, the TA can quickly assist them and explain to them what they do wrong and how to fix it. Normally this will be the last time that the TA has this student come in for office hours. More often than not a TA will see the same students coming in time-and-time-again saying that their program is not working and they have no clue why. The TA will have to read through all of the source code (or run it and see what is happening) to find what "looks" wrong. The TA will then either fix the issue for them and/or try to teach the student the solution to the problem. I normally did the later, I'd rather teach a person to fish than fish for the person.

Given that the students that see the TA are normally not the cream-of-the-crop, TAs tend to acquire the point-of-view that most of the students are idiots. The problem with this point-of-view is that it is very selective, the sampling is not repersentive of the whole.

One thing that most people that need to see TAs have in common is that they do not know how to figure out were their mistakes are. If these people could figure out where their mistake were they would stand a good chance of being able to find some help outside of asking a TA (e.g. Google). (This kind of thing contiues into the work place, with less apt people bugging compentent people for assistance.)

Every now-and-then, it does happen that a student will come in and say I am having such-and-such problem and I am very sure that the error is here. Most of the time these students are right, the TA can quickly assist them and explain to them what they do wrong and how to fix it. Normally this will be the last time that the TA has this student come in for office hours. More often than not a TA will see the same students coming in time-and-time-again saying that their program is not working and they have no clue why. The TA will have to read through all of the source code (or run it and see what is happening) to find what "looks" wrong. The TA will then either fix the issue for them and/or try to teach the student the solution to the problem. I normally did the later, I'd rather teach a person to fish than fish for the person.

Given that the students that see the TA are normally not the cream-of-the-crop, TAs tend to acquire the point-of-view that most of the students are idiots. The problem with this point-of-view is that it is very selective, the sampling is not repersentive of the whole.

## Thursday, July 16, 2009

### 4 out of 10

According to the Standish Group's just-released report, CHAOS Summary 2009; 32% of IT projects are on time, on budget, with the required business functions; 44% of IT projects are either late, over budget, and/or missing required business functions; the remaining IT projects (24%) are cancelled. This means in general a new IT has about a 4 in 10 shot of being a successful business project, which means that the odds are that it will most likely fail in some way. In fact out of 100 IT projects about 25 of them will be cut!

In fact it is even worst than it seems, these numbers are worst than last year's. Believe it or not, these are the lowest number in the last five years!

So what does this mean to you (assuming someone is reading this and that they work in IT)? Well, it means that most of the projects that you have work on in the resent pass have failed in some way. It also means that IT as a whole needs to improve their delivery of projects.

So what can IT do? We can try harder at understanding our business clients. The other day I saw a blog that got me thinking about how if you really want to understand your business clients you will have to become one, you will have to "Eat Your Own Dog Food". I read some where, that Amazon developers have to sometime every couple of years shadowing their business clients. I think this is a great idea, if you see how your business client really uses your software you will be better able to understand there needs and their pain points.

Now I do not think that sitting with your business clients every couple of years will allow IT projects to become more successful, but I think it would help.

In fact it is even worst than it seems, these numbers are worst than last year's. Believe it or not, these are the lowest number in the last five years!

So what does this mean to you (assuming someone is reading this and that they work in IT)? Well, it means that most of the projects that you have work on in the resent pass have failed in some way. It also means that IT as a whole needs to improve their delivery of projects.

So what can IT do? We can try harder at understanding our business clients. The other day I saw a blog that got me thinking about how if you really want to understand your business clients you will have to become one, you will have to "Eat Your Own Dog Food". I read some where, that Amazon developers have to sometime every couple of years shadowing their business clients. I think this is a great idea, if you see how your business client really uses your software you will be better able to understand there needs and their pain points.

Now I do not think that sitting with your business clients every couple of years will allow IT projects to become more successful, but I think it would help.

## Tuesday, July 14, 2009

### Use Real Business Function to Measure Progress

Today during lunch I attended the ThoughtWorks' Webinar "The Agile PMO". Not being a PM or anything like that I cannot comment on the content other than to say that I learned a lot about what PMOs do. But, that is not the point of this post.

At the Webinar Ross Pettit was talking about when a PM reports status to the PMO they should measure that status in terms of Business functions. To me this made so much since, I cannot believe I never thought of it before. I believe on most of my projects, many aspects of the project are 90% done for more than 90% of the project (this goes double for all the projects that fail or are late).

This 90% done for 90% of the time is not really any one's fault. You see most people in IT are optimistic (or they are very jaded and pessimistic). This leads people to believe that things will get done quicker than they normally do. That is why I think it is a great idea to report things in terms of how much Business functionality is done. If you report the status in terms of Business functionality, then all parties involved would be able to understand the status. This would help in avoiding the 90% done for 90% of the time, because either the Business functionality is available or it is not.

At the Webinar Ross Pettit was talking about when a PM reports status to the PMO they should measure that status in terms of Business functions. To me this made so much since, I cannot believe I never thought of it before. I believe on most of my projects, many aspects of the project are 90% done for more than 90% of the project (this goes double for all the projects that fail or are late).

This 90% done for 90% of the time is not really any one's fault. You see most people in IT are optimistic (or they are very jaded and pessimistic). This leads people to believe that things will get done quicker than they normally do. That is why I think it is a great idea to report things in terms of how much Business functionality is done. If you report the status in terms of Business functionality, then all parties involved would be able to understand the status. This would help in avoiding the 90% done for 90% of the time, because either the Business functionality is available or it is not.

## Saturday, July 11, 2009

### Is 0 positive, negative, or neither?

Zero as an idea that has a history of not being well liked (e.g. How can nothing be something?). You see people throughout history dislike the idea of nothing. Nothing is a scary and uncomprehensive idea for humans.

Despite all this, zero is said to be neither positive nor negative, instead it is neither (none of the above). Why is this? You see the idea of zero is that zero is a position on the number line. If you extended the number line out from negative infinite to positive infinite, zero would be in the exact middle. The best way to think of zero is as a place holder (in fact this is believe to be how zero got it start) between positive and negative numbers.

Despite all this, zero is said to be neither positive nor negative, instead it is neither (none of the above). Why is this? You see the idea of zero is that zero is a position on the number line. If you extended the number line out from negative infinite to positive infinite, zero would be in the exact middle. The best way to think of zero is as a place holder (in fact this is believe to be how zero got it start) between positive and negative numbers.

## Tuesday, July 7, 2009

### GOTO Hell

It seems that people have forgotten what Dijkstra said about GOTO. You see GOTO is actually being added to languages that did not offer it before (PHP5). Have we not learned that GOTO is too easy to abuse?

The argument against GOTO (as given by Dijkstra) is simple, when you use GOTOs you cannot tell without a great deal of work what a program executing has done. Example if you use the following:

n = 783

:start

i = 2

:loop

if n%i == 0

goto done

end

i = i + 2

if i > n

n = n + 2

goto start

end

goto loop

:done

print n

n = n + 2

if n < 100000

goto start

end

This program would not be very hard for most people to figure out what is going on, but what if somewhere deep in the source code called start or done--or even worst loop. What would happen if you call loop or done much latter in the code? Are you sure you know what the values of i and n would be? I agree GOTO does have it uses, I mean sometimes it can save you a lot of code (see the C code for ls). GOTO is at its best when it gets you out of a deep if/for/if/case/... structure, but you could always use private methods in order to get yourself out of those cases without a GOTO. You see there is no real reason to use a GOTO and as such I believe if the greater good it is best to leave it out of languages.

The argument against GOTO (as given by Dijkstra) is simple, when you use GOTOs you cannot tell without a great deal of work what a program executing has done. Example if you use the following:

n = 783

:start

i = 2

:loop

if n%i == 0

goto done

end

i = i + 2

if i > n

n = n + 2

goto start

end

goto loop

:done

print n

n = n + 2

if n < 100000

goto start

end

This program would not be very hard for most people to figure out what is going on, but what if somewhere deep in the source code called start or done--or even worst loop. What would happen if you call loop or done much latter in the code? Are you sure you know what the values of i and n would be? I agree GOTO does have it uses, I mean sometimes it can save you a lot of code (see the C code for ls). GOTO is at its best when it gets you out of a deep if/for/if/case/... structure, but you could always use private methods in order to get yourself out of those cases without a GOTO. You see there is no real reason to use a GOTO and as such I believe if the greater good it is best to leave it out of languages.

## Monday, July 6, 2009

### The Problem with Too Many Sites and Only One Password

If you are like most people then you have one password and log-in for all of your web accounts. This is a really big problem, since now your security on-line depends on every site you have an account on. Now if one of those site gets hacked, bam; the thief is off to every bank website there is. With more and more people on-line and people having accounts at more and more sites, this is becoming a real issue!

One way to protect yourself is to have a system. You could do something as simple as add a pre and postfix to your password for each site (a different one for each site). Most people are not very likely to play around with that kind of thing on different websites so you are somewhat more protected.

One way that I just saw on Hacker News today is to use Stanford PwdHash. PwdHash is the program I was going to write for myself to protect my passwords but never really got around to it. PwdHash is a JavaScript and browser extension tool which generates a hash key based on the password and domain enter into it. For example, for the site www.example.com and the password of password (a very bad password) PwdHash will generate the value of 4QAIn8SvaW, a very good password. In fact Microsoft's password checker gives it a strong (password gets a weak). If you paste the password in twice on Microsoft's password checker it will become a best (add a ! to make it even better).

PwdHash seems safe, since you are not storing anything on a remote machine. I am going to try it out some more before I give it my really important accounts, but I think it will be great for social networking site (which may not have the best security). Give it a try, it has to be better than using your dog's name and zip code for every website.

One way to protect yourself is to have a system. You could do something as simple as add a pre and postfix to your password for each site (a different one for each site). Most people are not very likely to play around with that kind of thing on different websites so you are somewhat more protected.

One way that I just saw on Hacker News today is to use Stanford PwdHash. PwdHash is the program I was going to write for myself to protect my passwords but never really got around to it. PwdHash is a JavaScript and browser extension tool which generates a hash key based on the password and domain enter into it. For example, for the site www.example.com and the password of password (a very bad password) PwdHash will generate the value of 4QAIn8SvaW, a very good password. In fact Microsoft's password checker gives it a strong (password gets a weak). If you paste the password in twice on Microsoft's password checker it will become a best (add a ! to make it even better).

PwdHash seems safe, since you are not storing anything on a remote machine. I am going to try it out some more before I give it my really important accounts, but I think it will be great for social networking site (which may not have the best security). Give it a try, it has to be better than using your dog's name and zip code for every website.

## Thursday, July 2, 2009

### Focus

Christopher Alexander noticed that in Mexico building such as La Casa de los Azulejos in Mexico City attention is not paid to the laying of a single title. In fact most of the titles are not even straight. You see the craftsmen in Mexico pay attention to the over all picture, the relationship of one title to another. The collection of all the titles is what people notice, not the straightness of a single tile. The big picture is what matters, not one small detail.

In software, most of the time we fall into this trap (I know I have fallen into this trap more than a few times). We worry about the spacing in the source code, the placement of comments, the use of an UML Activity diagram over a BPMN diagram, etc. Most of the time the big overall picture is not looked at.

We should take a advise from the Mexican craftsman and focus on what matters. Does this code meet the requirements of the clients? Will this code fit into the overall enterprise? ...

-----------------------------------

Idea based on this 37signals post:

http://www.37signals.com/svn/posts/1778-christopher-alexander-on-the-perfection-of-imperfection

In software, most of the time we fall into this trap (I know I have fallen into this trap more than a few times). We worry about the spacing in the source code, the placement of comments, the use of an UML Activity diagram over a BPMN diagram, etc. Most of the time the big overall picture is not looked at.

We should take a advise from the Mexican craftsman and focus on what matters. Does this code meet the requirements of the clients? Will this code fit into the overall enterprise? ...

-----------------------------------

Idea based on this 37signals post:

http://www.37signals.com/svn/posts/1778-christopher-alexander-on-the-perfection-of-imperfection

## Wednesday, July 1, 2009

### Better than UML, the Next Big Thing, AML (Arbitrary Markup Language)

I got to say when I first saw Neal Ford's blog on AML (Arbitrary Markup Language) on Hacker News I knew I had to read it. AML is about the only design layout and style I've seen in the real world. When I see UML in the real world, most of the time is it not UML which follows the OMG standards. Instead the UML I see in the real world are diagrams which use the UML symbols in Visio, but I do not think the Three Amigos would call it UML. You see most people do not really understand UML and even if they do, they do not understand UML 2.0. Most people do not know about most of the symbols and diagrams that are part of UML 2.0. Most of the time in the real world you will get a Use Case Diagram, Class Diagram, a Sequence Diagram, and sometimes a Activity and Deployment Diagram. On these diagrams the symbols are close to being right, but they are not the official UML 2.0 symbols (most of the time they are the first options in for a symbol in Visio). To confuse things even more, most of the time if you have more than one person doing designs you can tell during a review that multiple people did the over all design.

Truth be told there is nothing wrong with this. The reason that you communicate is to pass on understanding and ideas from one person to another. So if the diagrams are not a 100% correct OMG official UML 2.0 diagrams, that is OK in my book. If the diagram can communicate what you want to say, then it is good.

What really stood out in Neal's blog on AML was when he said, " I'm a fan of AML, because it cuts down on irrational artifact attachment: you have nothing except the last 5 minutes invested in the diagram, making it as transient as possible". I never really thought about it, but the amount of time I spend on a design document is inversely related to my willingness to make major changes to it or throw it away. I find that this seems to be true with most other IT people too (I'd assume it is true for all fields). This attachment is completely irrational, it does not really matter how much time was spent on something, if it does not meet your client's needs (be it the business, another area, customers, etc.), then it should be changed to meet those needs.

That is the nice thing about AML, it is quick, direct, and to the point (said in my best Use Car Sales Man voice). You see AML is just boxes, circulars, arrows, lines, and whatever else is need to communicate your design and ideas in as clear and concise as possible. If you have spent any time in IT, you have by now seen a few different takes on AML and that is the whole point. If you can understand what the other person is drawing and trying to convey then the diagram is good.

Ever since cameras have been a common feature on most cell phones, I have been finding that most meetings in which a design in AML is drawn on the white board someone will take a few pictures of it and send it out in the meeting notes. If the design is really good, someone will draw it up in Visio really quick. To me this is the best way to design. Remember only you can fight irrational artifact attachment.

Now do not get me wrong, I am not saying that you should not think about your designs. If anything, I think that as much time as possible should be spent on designs (they are the cheapest thing to change and fix). What I am saying is that you should spend time figuring out what needs to take place and how to do it. You should spend as little time as possible on the symbols and layout of the design and as much time as possible thinking about all of the different things that you have to worry about in any design.

Truth be told there is nothing wrong with this. The reason that you communicate is to pass on understanding and ideas from one person to another. So if the diagrams are not a 100% correct OMG official UML 2.0 diagrams, that is OK in my book. If the diagram can communicate what you want to say, then it is good.

What really stood out in Neal's blog on AML was when he said, " I'm a fan of AML, because it cuts down on irrational artifact attachment: you have nothing except the last 5 minutes invested in the diagram, making it as transient as possible". I never really thought about it, but the amount of time I spend on a design document is inversely related to my willingness to make major changes to it or throw it away. I find that this seems to be true with most other IT people too (I'd assume it is true for all fields). This attachment is completely irrational, it does not really matter how much time was spent on something, if it does not meet your client's needs (be it the business, another area, customers, etc.), then it should be changed to meet those needs.

That is the nice thing about AML, it is quick, direct, and to the point (said in my best Use Car Sales Man voice). You see AML is just boxes, circulars, arrows, lines, and whatever else is need to communicate your design and ideas in as clear and concise as possible. If you have spent any time in IT, you have by now seen a few different takes on AML and that is the whole point. If you can understand what the other person is drawing and trying to convey then the diagram is good.

Ever since cameras have been a common feature on most cell phones, I have been finding that most meetings in which a design in AML is drawn on the white board someone will take a few pictures of it and send it out in the meeting notes. If the design is really good, someone will draw it up in Visio really quick. To me this is the best way to design. Remember only you can fight irrational artifact attachment.

Now do not get me wrong, I am not saying that you should not think about your designs. If anything, I think that as much time as possible should be spent on designs (they are the cheapest thing to change and fix). What I am saying is that you should spend time figuring out what needs to take place and how to do it. You should spend as little time as possible on the symbols and layout of the design and as much time as possible thinking about all of the different things that you have to worry about in any design.

## Monday, June 29, 2009

### How Many Prime Numbers are There?

Prime numbers, most of us have heard of them. Primes are those special numbers which are only divisible by its self and 1 (i.e. 2 is only divisible by 2, 7 is only divisible by 7, 179424673 is only divisible by 179424673, and so on). It is believed that the Ancient Greeks were the first to study them and we today continue to use them for encryption and other important things to modern day life.

The Egyptians maybe able to lay claim to have discover prime numbers, but it is with the ancient Greeks that we get a lot of what we are thought in school about primes. Pythagoras' school study primes for their beauty and mystical and numerological properties. Euclid showed in his 9 book of Elements that there are infinitely many primes.

Simple proof of the infinite number of primes:

Assume there are only a finite number of primes, such that p1, p2, p3, ..., pn are all the prime numbers that exist. Given p1 * p2 * p3 * ... * pn + 1 = P, we know that P must be larger than any of the finite number of primes, therefore P must be divisible by one of our finite number of primes. Here lays the problem, if P is divide by any of the finite number of primes then there must be a remainder of 1 (i.e. 2 * 3 * 5 * 7 + 1 divided by either 2, 3, 5, or 7 would have to leave a remainder of 1 (go head try it on a calculator), the plus 1 is the issue). This is a contradiction, therefore there must not be a finite number of primes and thus we have an infinite number of primes.

This simple proof is similar to what Euclid gave in his 9th book of Elements. It is based on the fact that numbers keep on going and that giving a list of numbers we can create new numbers that are not on that list. So the argument is that given a list of prime numbers we can find a prime number that is not on the list by simply taking the prime numbers on the list multiplying them and adding 1 to the total (note, this does not mean that the multiple of a number of different prime numbers plus 1 is prime, just that is a good way of finding another prime number).

For example take 2, 3, and 5. (2 * 3) + 1 = 7, which is prime. (2 * 3 * 5) + 1 = 31, which is also prime. (3 * 5) + 1 = 16, which is not prime. (If you think that all you need is 2 and another prime, then try (2 * 7) + 1 = 15, which is not prime.)

I hope I have shown you that there are an infinite number of prime numbers. Now go out there and find them you could win money if you find a really large one!

The Egyptians maybe able to lay claim to have discover prime numbers, but it is with the ancient Greeks that we get a lot of what we are thought in school about primes. Pythagoras' school study primes for their beauty and mystical and numerological properties. Euclid showed in his 9 book of Elements that there are infinitely many primes.

Simple proof of the infinite number of primes:

Assume there are only a finite number of primes, such that p1, p2, p3, ..., pn are all the prime numbers that exist. Given p1 * p2 * p3 * ... * pn + 1 = P, we know that P must be larger than any of the finite number of primes, therefore P must be divisible by one of our finite number of primes. Here lays the problem, if P is divide by any of the finite number of primes then there must be a remainder of 1 (i.e. 2 * 3 * 5 * 7 + 1 divided by either 2, 3, 5, or 7 would have to leave a remainder of 1 (go head try it on a calculator), the plus 1 is the issue). This is a contradiction, therefore there must not be a finite number of primes and thus we have an infinite number of primes.

This simple proof is similar to what Euclid gave in his 9th book of Elements. It is based on the fact that numbers keep on going and that giving a list of numbers we can create new numbers that are not on that list. So the argument is that given a list of prime numbers we can find a prime number that is not on the list by simply taking the prime numbers on the list multiplying them and adding 1 to the total (note, this does not mean that the multiple of a number of different prime numbers plus 1 is prime, just that is a good way of finding another prime number).

For example take 2, 3, and 5. (2 * 3) + 1 = 7, which is prime. (2 * 3 * 5) + 1 = 31, which is also prime. (3 * 5) + 1 = 16, which is not prime. (If you think that all you need is 2 and another prime, then try (2 * 7) + 1 = 15, which is not prime.)

I hope I have shown you that there are an infinite number of prime numbers. Now go out there and find them you could win money if you find a really large one!

## Sunday, June 28, 2009

### 0^0 = 1, 0, undefined?

We all have been told that x^0 (x to the 0th power) equals 1, but few have looked at why this is true. What does it really mean when we say, take 5 to the 0th power? What does 0 to a power mean--or more to the point, what does 0^0 mean?

If I type x^0 in Wolfram|Alpha, the simple output is 1 (there are some series and integral representations of the answer too, but I have never really cared for that kind of thing (too messy)). But what are we really doing? A power function is short hand for saying take this number and multiply it by itself this many times (i.e. 3^3 = 3 * 3 * 3 = 27). So, when we say 3 to the 1st power, we are simply saying 3 in an abstract way. If you think about multiplication as a series of steps to get to an amount, this makes sense (i.e. 3 * 4 * 5 = 12 * 5 = 60). The easy way to think about powers is as a function. The first input to the function is the number you want to multiply by itself and the second input is the number of times you want to multiply the number by itself: hence 2^4 could be thought of as power(2, 4) = 2 * 2 * 2 * 2 = 16. Therefore, 3^1 is power(3, 1) = 3 not multiplied by anything else, so the value is simply the same as the first input into the function. This is easy enough (I know this is not true for negative powers).

So what does it mean to take something to the 0th power? The simple power function given above breaks down at this point (i.e. power(3, 0) = 3 * ? or something like that). So what does 3^0 equal? We have been told in school that x^0 equals 1, so 3^0 = 1. But why? One way to think about it is that 3^3 = 3 * 3 * 3 = 27, 3^2 = 3 * 3 = 9, and 3^1 = 3. Do you notice a pattern? When we are moving down the power chain, we are simply taking the previous answer and dividing it by the number, hence 3^2 = (3^3)/3. Therefore, we can say:

x^b = (x^a)/x, when a = b + 1 and where x is any number (Real or Complex).

This looks really complex, but it is not. What we are saying is that x to any power is equal to the value of x to a power one above the current one divided by x (i.e. 2^4 = (2^5)/2 or 2 * 2 * 2 * 2 = (2 * 2 * 2 * 2 * 2)/2 (cross off one of the 2s on the right side and you get 2 * 2 * 2 * 2 = 2 * 2 * 2 * 2, which we know is true)). Using this form, 3^0 = (3^1)/3, which is the same as saying 3^0 = 3/3 = 1. Thus, we state in general that:

x^0 = x/x = 1, where x is any number (Real or Complex) other than 0.

Why can we not say that 0^0 = 1? It would make our lives a lot easier. Well, we have also been told that 0 times any number is 0. As such, we can say 0^3 = 0 * 0 * 0 = 0, 0^2 = 0 * 0 = 0, and 0^1 = 0. Following this pattern, we get 0^0 = 0.

So does 0^0 = 0 or 1? Well we have another problem (D'oh). You cannot divide by 0 (I was told in my Number Theory class (MATH 480) that St. Peter keeps track off the number of times you divide by 0. If the number is too high you cannot get into heaven). Why can you not divide by o? We do not know what it means to take a number of things and place them in equal amount of sets that contain 0 of the thing (i.e. if Pirates are splitting up gold, and there is no gold to be split, how much gold does each Pirate get (I assume the answer is that the captain will get split in two)). Since we cannot split a number of things into equal sets containing 0 of the things, then 0^0 = 0/0, which I guess is undefined?!?

The problem is that 0^0 is an Indeterminate, which in the world of Mathematics is marked on the map with the words, "Here be dragons". You can argue that 0^0 = 1, since x/x = 1. You could also argue that 0^0 = 0, since x * 0 = 0. Or you can play it safe and say 0^0 = undefined. I like the third definition because I work in IT and it is safer to catch an error than to just assume an answer. At any rate, I hope you have a better understanding on how the power function works and on what x^0 means.

If I type x^0 in Wolfram|Alpha, the simple output is 1 (there are some series and integral representations of the answer too, but I have never really cared for that kind of thing (too messy)). But what are we really doing? A power function is short hand for saying take this number and multiply it by itself this many times (i.e. 3^3 = 3 * 3 * 3 = 27). So, when we say 3 to the 1st power, we are simply saying 3 in an abstract way. If you think about multiplication as a series of steps to get to an amount, this makes sense (i.e. 3 * 4 * 5 = 12 * 5 = 60). The easy way to think about powers is as a function. The first input to the function is the number you want to multiply by itself and the second input is the number of times you want to multiply the number by itself: hence 2^4 could be thought of as power(2, 4) = 2 * 2 * 2 * 2 = 16. Therefore, 3^1 is power(3, 1) = 3 not multiplied by anything else, so the value is simply the same as the first input into the function. This is easy enough (I know this is not true for negative powers).

So what does it mean to take something to the 0th power? The simple power function given above breaks down at this point (i.e. power(3, 0) = 3 * ? or something like that). So what does 3^0 equal? We have been told in school that x^0 equals 1, so 3^0 = 1. But why? One way to think about it is that 3^3 = 3 * 3 * 3 = 27, 3^2 = 3 * 3 = 9, and 3^1 = 3. Do you notice a pattern? When we are moving down the power chain, we are simply taking the previous answer and dividing it by the number, hence 3^2 = (3^3)/3. Therefore, we can say:

x^b = (x^a)/x, when a = b + 1 and where x is any number (Real or Complex).

This looks really complex, but it is not. What we are saying is that x to any power is equal to the value of x to a power one above the current one divided by x (i.e. 2^4 = (2^5)/2 or 2 * 2 * 2 * 2 = (2 * 2 * 2 * 2 * 2)/2 (cross off one of the 2s on the right side and you get 2 * 2 * 2 * 2 = 2 * 2 * 2 * 2, which we know is true)). Using this form, 3^0 = (3^1)/3, which is the same as saying 3^0 = 3/3 = 1. Thus, we state in general that:

x^0 = x/x = 1, where x is any number (Real or Complex) other than 0.

Why can we not say that 0^0 = 1? It would make our lives a lot easier. Well, we have also been told that 0 times any number is 0. As such, we can say 0^3 = 0 * 0 * 0 = 0, 0^2 = 0 * 0 = 0, and 0^1 = 0. Following this pattern, we get 0^0 = 0.

So does 0^0 = 0 or 1? Well we have another problem (D'oh). You cannot divide by 0 (I was told in my Number Theory class (MATH 480) that St. Peter keeps track off the number of times you divide by 0. If the number is too high you cannot get into heaven). Why can you not divide by o? We do not know what it means to take a number of things and place them in equal amount of sets that contain 0 of the thing (i.e. if Pirates are splitting up gold, and there is no gold to be split, how much gold does each Pirate get (I assume the answer is that the captain will get split in two)). Since we cannot split a number of things into equal sets containing 0 of the things, then 0^0 = 0/0, which I guess is undefined?!?

The problem is that 0^0 is an Indeterminate, which in the world of Mathematics is marked on the map with the words, "Here be dragons". You can argue that 0^0 = 1, since x/x = 1. You could also argue that 0^0 = 0, since x * 0 = 0. Or you can play it safe and say 0^0 = undefined. I like the third definition because I work in IT and it is safer to catch an error than to just assume an answer. At any rate, I hope you have a better understanding on how the power function works and on what x^0 means.

## Saturday, June 27, 2009

### How URLs Work

Uniform Resource Locators (URL), you know: www.google.com, www.amazon.com, etc. Believe it or not these strings of text hold a lot of information about the structure and design of the site you are connection to. URL are really paths which go down the file structure (like /home/mike/

or c:\windows\, more on this latter) to the resource (file in most cases) that you are remotely accessing. When you type www.twitter.com in your browser you are tell the site, the path of the resource you want to access.

The format of URLs are a bit odd (according to Wikipedia the creator of URLs, Tim Berners-Lee, regrets the format) . You see, it follows a reverse order before the first /. Lets break down an URL to illustrate how an URL works. Take this URL for an example:

http://comp-phil.blogspot.com/2009/06/using-just-addition-and-negation-to.html

The first part http:// says which Internet protocol you are using to access the site (other popular examples are ftp:// and https://). Every browser I have ever used assumes if you just type www.vanguard.com that want to use HTTP so it will prefix http:// to your URL.

The next part, comp-phil.blogspot.com, is a bit odd. You see it is backwards, the way it is parsed is from the last . (dot) to first . (dot)., comp-phil.blogspot.com, looks like this /com/blogspot/comp-phil to the web server you are connecting to.

The image above shows how (on a very small scale) the Internet is organized. The com tells the DNS server which branch of the Internet the site is on (org, gov, net, uk, etc.). The next part, blogspot, tells you which domain branch the site is on. In this example the comp-phil says which sub-domain the site is on. Last, the www says (basicly) that the sub-domain is www (World Wide Web). So, the example can be thought of as /com/blogspot/comp-phil/www/. There is an implied .:80 at the end of this section, so this section of the URL really looks like www.comp-phil.blogspot.com.:80, if you do not believe me try www.google.com.:80 in your browser, I'll wait. Welcome back, the . (dot) after the com, says that it is the root directory (think UNIX directory structure), the :80 at the end says that the server is listening to port 80. Port 80 is the IANA assigned port number for the World Wide Web HTTP (web sites).

The last section of the example, /2009/06/using-just-addition-and-negation-to.html, is just the directory structure from the server's sub-domain to the resource you are requesting. If you look on the server you would see that in the /2009/06/ directory of the sub-domain a HTML file called using-just-addition-and-negation-to.html.

That's it, not very comlicated at all (well the www.comp-phil.blogspot.com part is complex, but understandable). Next time you type in www.twitter.com/MikeMKH in your browser you will understand what you really doing (and while you are there follow me and say hi).

or c:\windows\, more on this latter) to the resource (file in most cases) that you are remotely accessing. When you type www.twitter.com in your browser you are tell the site, the path of the resource you want to access.

The format of URLs are a bit odd (according to Wikipedia the creator of URLs, Tim Berners-Lee, regrets the format) . You see, it follows a reverse order before the first /. Lets break down an URL to illustrate how an URL works. Take this URL for an example:

http://comp-phil.blogspot.com/2009/06/using-just-addition-and-negation-to.html

The first part http:// says which Internet protocol you are using to access the site (other popular examples are ftp:// and https://). Every browser I have ever used assumes if you just type www.vanguard.com that want to use HTTP so it will prefix http:// to your URL.

The next part, comp-phil.blogspot.com, is a bit odd. You see it is backwards, the way it is parsed is from the last . (dot) to first . (dot)., comp-phil.blogspot.com, looks like this /com/blogspot/comp-phil to the web server you are connecting to.

The image above shows how (on a very small scale) the Internet is organized. The com tells the DNS server which branch of the Internet the site is on (org, gov, net, uk, etc.). The next part, blogspot, tells you which domain branch the site is on. In this example the comp-phil says which sub-domain the site is on. Last, the www says (basicly) that the sub-domain is www (World Wide Web). So, the example can be thought of as /com/blogspot/comp-phil/www/. There is an implied .:80 at the end of this section, so this section of the URL really looks like www.comp-phil.blogspot.com.:80, if you do not believe me try www.google.com.:80 in your browser, I'll wait. Welcome back, the . (dot) after the com, says that it is the root directory (think UNIX directory structure), the :80 at the end says that the server is listening to port 80. Port 80 is the IANA assigned port number for the World Wide Web HTTP (web sites).

The last section of the example, /2009/06/using-just-addition-and-negation-to.html, is just the directory structure from the server's sub-domain to the resource you are requesting. If you look on the server you would see that in the /2009/06/ directory of the sub-domain a HTML file called using-just-addition-and-negation-to.html.

That's it, not very comlicated at all (well the www.comp-phil.blogspot.com part is complex, but understandable). Next time you type in www.twitter.com/MikeMKH in your browser you will understand what you really doing (and while you are there follow me and say hi).

## Wednesday, June 24, 2009

### UDP is Important

UDP (User Datagram Protocol) is a protocol which allows systems to send information. UDP is the quick and dirty way to transfer information, it does not use hand shakes (like TCP), it simply fires-and-forgets. Messages send by UDP are said to be transaction oriented, meaning that delivery and duplication protection are not guaranteed. This means that by using UDP to send a message anywhere from 0 to infinite amount of the same message maybe received by the receiver.

Often it is taught in school to think of UDP as junk mail, a junk mailer normally does not care if a piece of junk mail arrives at a home, instead the junk mailer cares about getting out a lot of mail at low costs. I prefer to think of UDP as an elderly man that does not have a good memory, often times this man will tell stories not knowing that they he has already told this story to the listener. The old man wants to convey some type of message (we hope), and to do this he tells a story. A young man listens to the story and normally will be polite (we hope) and allow the old man to tell the story even if he has already heard it. The old man could be thought of as UDP and the story as the packet being delivered. In this example the stories can be told to the young man 0 to infinite amount of times (we hope not infinite).

So, what good is UDP and why is it important? Well sometimes in order to save bandwidth and time a system will opt to use UDP over other protocols (like TCP) in order to transfer information. This is often used in application where a lot of data is being sent but if packets are lost or duplicated it is no big deal. Streaming media is an example of an application that would use UDP, most user are willing to accept a few blups in their Dramatic Chipmunk streaming video or their streaming "Beat It" by Michael Jackson on Grooveshark.

So why is UDP important? Well UDP is the protocol used by DNS (Domain Name System). So why is DNS important, well DNS is what allows you to use the internet. DNS translate the URL http://comp-phil.blogspot.com/ into 74.125.95.191 which is the IP address of comp-phil.blogspot.com. If it wasn't for DNS you would have to type in 72.21.210.250 every time you wanted to buy a book from Amazon. So you can say that UDP is important because DNS is import and DNS uses UDP.

Often it is taught in school to think of UDP as junk mail, a junk mailer normally does not care if a piece of junk mail arrives at a home, instead the junk mailer cares about getting out a lot of mail at low costs. I prefer to think of UDP as an elderly man that does not have a good memory, often times this man will tell stories not knowing that they he has already told this story to the listener. The old man wants to convey some type of message (we hope), and to do this he tells a story. A young man listens to the story and normally will be polite (we hope) and allow the old man to tell the story even if he has already heard it. The old man could be thought of as UDP and the story as the packet being delivered. In this example the stories can be told to the young man 0 to infinite amount of times (we hope not infinite).

So, what good is UDP and why is it important? Well sometimes in order to save bandwidth and time a system will opt to use UDP over other protocols (like TCP) in order to transfer information. This is often used in application where a lot of data is being sent but if packets are lost or duplicated it is no big deal. Streaming media is an example of an application that would use UDP, most user are willing to accept a few blups in their Dramatic Chipmunk streaming video or their streaming "Beat It" by Michael Jackson on Grooveshark.

So why is UDP important? Well UDP is the protocol used by DNS (Domain Name System). So why is DNS important, well DNS is what allows you to use the internet. DNS translate the URL http://comp-phil.blogspot.com/ into 74.125.95.191 which is the IP address of comp-phil.blogspot.com. If it wasn't for DNS you would have to type in 72.21.210.250 every time you wanted to buy a book from Amazon. So you can say that UDP is important because DNS is import and DNS uses UDP.

## Tuesday, June 23, 2009

### Separation Of Concerns Can Have an Effect on Your Company

In software engineering separation of concerns is a design principle which breaks down the characteristic of different elements in a design in such-a-way as to hide the design decision from other elements. Through the use of separation of concerns, a system can be broken down and layered into different spheres of concerns. This break down allows for more maintainable, flexible and, modifiable systems. In general it is a best practice to follow the separation of concerns design principle.

The separation of concerns also has another effect, but this effect goes beyond the system. The separation of concerns effects the way a system is built. The way that most systems are built, teams of people are broken down along the lines of which different elements in the system they are building. These elements are created when the separation of concerns design principle is followed and different spheres of concerns are created.

Like-wise, on a larger scale, whole companies can be broken down using the separation of concerns design principle. Think about it, most companies have different departments doing their accounting, legal issues, IT, etc. This brake down of a company along different departments follows the separation of concerns design principle.

As you can see the separation of concerns design principle effects more than just the design of a system. Separation of concerns, can, does, and will effect the organization of your team, area, department, and even the company as a whole.

The separation of concerns also has another effect, but this effect goes beyond the system. The separation of concerns effects the way a system is built. The way that most systems are built, teams of people are broken down along the lines of which different elements in the system they are building. These elements are created when the separation of concerns design principle is followed and different spheres of concerns are created.

Like-wise, on a larger scale, whole companies can be broken down using the separation of concerns design principle. Think about it, most companies have different departments doing their accounting, legal issues, IT, etc. This brake down of a company along different departments follows the separation of concerns design principle.

As you can see the separation of concerns design principle effects more than just the design of a system. Separation of concerns, can, does, and will effect the organization of your team, area, department, and even the company as a whole.

## Thursday, June 18, 2009

### How (Most) Computer Security Really Works

Prime numbers, you know those number the Greeks called πρώτοι αριθμοί.

First lets review what a prime number is, simply put a prime number is any number which cannot be divided by any number evenly except for its self and 1. Stated more formally, x is prime if and only if its x/y is not integer except for when y = 1 or y = x. This means that 2, 3, 5, 7, 11, 13, 17, 23, ... are prime number while 4, 6, 8, 10, 12, 14, 16, ... are not (4/2 = 2, 6/2 = 3, ...).

So what does this really mean. Well there is a theory, a theory which states that any positive integer greater than 1 can be represented by the product of at least one prime number. This means that every integer greater than 1 is made up of prime numbers.

Examples:

2 = 2

3 = 3

4 = 2 * 2

5 = 5

6 = 2 * 3

...

195 = 3 * 5 * 13

...

8961 = 3 * 29 * 103

...

121980 = 2 * 2 * 5 * 7 * 11 * 787

...

This theory is called the Fundamental Theorem of Arithmetic. This theorem is more than just fundamental to arithmetic, this theorem is fundamental to computer security.

You see computer security is based on encryption. Encryption is used to transform information into an unreadable form. Encryption is undone by decryption, which is used to transform the unreadable encrypted information back into the original form of the information.

Now is when prime numbers and the fundamental theory of arithmetic come into play, you see most encryption methods use the product of two prime numbers. As the fundamental theory of arithmetic shows us, the product of two prime numbers can only be dividable by those two prime numbers and 1. This product of two prime numbers is used in different algorithms in order to generate encrypted text.

Now you know the world of computer security's deep dark secret, most of computer security is based on the fact that it is hard to do prime factorization on very large numbers.

**Well they are important, in fact very important to the modern world. In fact the protection of all of the world's important data rest on their backs.**First lets review what a prime number is, simply put a prime number is any number which cannot be divided by any number evenly except for its self and 1. Stated more formally, x is prime if and only if its x/y is not integer except for when y = 1 or y = x. This means that 2, 3, 5, 7, 11, 13, 17, 23, ... are prime number while 4, 6, 8, 10, 12, 14, 16, ... are not (4/2 = 2, 6/2 = 3, ...).

So what does this really mean. Well there is a theory, a theory which states that any positive integer greater than 1 can be represented by the product of at least one prime number. This means that every integer greater than 1 is made up of prime numbers.

Examples:

2 = 2

3 = 3

4 = 2 * 2

5 = 5

6 = 2 * 3

...

195 = 3 * 5 * 13

...

8961 = 3 * 29 * 103

...

121980 = 2 * 2 * 5 * 7 * 11 * 787

...

This theory is called the Fundamental Theorem of Arithmetic. This theorem is more than just fundamental to arithmetic, this theorem is fundamental to computer security.

You see computer security is based on encryption. Encryption is used to transform information into an unreadable form. Encryption is undone by decryption, which is used to transform the unreadable encrypted information back into the original form of the information.

Now is when prime numbers and the fundamental theory of arithmetic come into play, you see most encryption methods use the product of two prime numbers. As the fundamental theory of arithmetic shows us, the product of two prime numbers can only be dividable by those two prime numbers and 1. This product of two prime numbers is used in different algorithms in order to generate encrypted text.

Now you know the world of computer security's deep dark secret, most of computer security is based on the fact that it is hard to do prime factorization on very large numbers.

## Wednesday, June 17, 2009

### Using Just Addition and Negation to Create All Mathematical Operations

Addition, Subtraction, Division, Multiplication, and Negation (Negative numbers); these are the basic operations we all learned in grade school. Truth be told you do not really need them. No, your grade school teacher did not lie to you or teach you something pointless (at least in this case). These operations make great short hand, but are not really needed.

You can create all of the operations you know from grade school to college level (including PhD level) with just simply using Addition and Negation. Given a set of numbers (Real or Complex), you can create out of the simple operation of Addition (+) and Negation (-x, where x is a number) any other operation you can thing of. For example, say you have set of 5 things and lose 2 of them, to find out how many of the set you still have you take 5 and Subtract 2 of them to get 3; but you could have taken 5 and Added the Negative value of 2 to them to get 3. You can think of Subtraction as simply the Addition of a Negative amount of something.

In more symbolic form:

x - y = x + -y

where x and y are members of a set of numbers

The same is true for Multiplication. Given 5 sets of 3 things, you have a total of 15 things (5 * 3 = 15). You could also say that given 5 sets of 3 things, you Add 5 to 5, 3 Times giving you 15 (5 + 5 + 5 = 15).

Again in more symbolic form:

x * y = x + ... + x

where ... represent y number of + x (I know the symbolic x + ... + x does not really look good for 0 or 1, but I do not want to introduce a function)

You may be thinking what about Negative numbers in Multiplication, well Negative numbers are not really any thing special. Say you owe 5 people 3 bucks and have no money, you have Negative 15 dollars (5 * -3 = -5 + -5 + -5 = -15). In the symbolic above either x or y can be Negative numbers.

Likewise, Division can be thought of as Multiple Subtraction, which is really just Multiple Addition of Negative numbers (as shown above). An example maybe needed, say you have 15 of something and need to give an equal number of the thing to 3 people (think of Pirates splitting up gold). Well, you need to give 1 of the thing to each person a number of times until you run out of them, meaning at the end you have give 5 of the thing to each of the 3 people (15 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 3 + 3 + 3 + 3 + 3). In another way, you have 15 of something and Subtract 3 from the 15 until you have 0 left (15 - 3 - 3 - 3 - 3 - 3 = 0, or 3 + 3 + 3 + 3 + 3 = 15). Or you have 15 of something and Add Negative 3 to the 15 until you have 0 left (15 + -3 + -3 + -3 + -3 + -3 = 0). All of these ways of thinking give the same result, 5 sets of 3. That is what Division really is, finding how many equal sets (if you are working with whole numbers) can be made out of a number.

In more symbolic form:

x / y = z + ... + z

where z is a number from the same set as x and y and ... represent y number of + z (again I know the symbolic z + ... + z does not really look good for 0 or 1, but I am trying to not introduce any new functions)

So what about Dividing by 0? Well as we know Dividing by 0 is undefined and here is why. Say you have 15 of something and need to split it equal among 0 groups what are you really doing? You are saying that you can take 0 groups of something and Add them up to be 15 of something. This is impossible since 0 + 0 = 0 and likewise 0 + ... + 0 = 0, where ... can be any number of + 0. Also, we all know that x * 0 = 0, since 0 Added to 0 an x number of times would still be 0 (as shown above).

What does any of this have to do with Programming? Well there are CPUs called RISC CPUs, RISC stands for Reduced Instruction Set Computer. The goal of RISC to have as few instruction as possible. On the computation side I would argue that all you need is Addition and Negation. My argument would be based on this post, as I have shown all of the mathematical operations we know can be express with just Addition and Negation operations. Thus, for computations RISC would only need the ability to Add and Negate.

You can create all of the operations you know from grade school to college level (including PhD level) with just simply using Addition and Negation. Given a set of numbers (Real or Complex), you can create out of the simple operation of Addition (+) and Negation (-x, where x is a number) any other operation you can thing of. For example, say you have set of 5 things and lose 2 of them, to find out how many of the set you still have you take 5 and Subtract 2 of them to get 3; but you could have taken 5 and Added the Negative value of 2 to them to get 3. You can think of Subtraction as simply the Addition of a Negative amount of something.

In more symbolic form:

x - y = x + -y

where x and y are members of a set of numbers

The same is true for Multiplication. Given 5 sets of 3 things, you have a total of 15 things (5 * 3 = 15). You could also say that given 5 sets of 3 things, you Add 5 to 5, 3 Times giving you 15 (5 + 5 + 5 = 15).

Again in more symbolic form:

x * y = x + ... + x

where ... represent y number of + x (I know the symbolic x + ... + x does not really look good for 0 or 1, but I do not want to introduce a function)

You may be thinking what about Negative numbers in Multiplication, well Negative numbers are not really any thing special. Say you owe 5 people 3 bucks and have no money, you have Negative 15 dollars (5 * -3 = -5 + -5 + -5 = -15). In the symbolic above either x or y can be Negative numbers.

Likewise, Division can be thought of as Multiple Subtraction, which is really just Multiple Addition of Negative numbers (as shown above). An example maybe needed, say you have 15 of something and need to give an equal number of the thing to 3 people (think of Pirates splitting up gold). Well, you need to give 1 of the thing to each person a number of times until you run out of them, meaning at the end you have give 5 of the thing to each of the 3 people (15 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 3 + 3 + 3 + 3 + 3). In another way, you have 15 of something and Subtract 3 from the 15 until you have 0 left (15 - 3 - 3 - 3 - 3 - 3 = 0, or 3 + 3 + 3 + 3 + 3 = 15). Or you have 15 of something and Add Negative 3 to the 15 until you have 0 left (15 + -3 + -3 + -3 + -3 + -3 = 0). All of these ways of thinking give the same result, 5 sets of 3. That is what Division really is, finding how many equal sets (if you are working with whole numbers) can be made out of a number.

In more symbolic form:

x / y = z + ... + z

where z is a number from the same set as x and y and ... represent y number of + z (again I know the symbolic z + ... + z does not really look good for 0 or 1, but I am trying to not introduce any new functions)

So what about Dividing by 0? Well as we know Dividing by 0 is undefined and here is why. Say you have 15 of something and need to split it equal among 0 groups what are you really doing? You are saying that you can take 0 groups of something and Add them up to be 15 of something. This is impossible since 0 + 0 = 0 and likewise 0 + ... + 0 = 0, where ... can be any number of + 0. Also, we all know that x * 0 = 0, since 0 Added to 0 an x number of times would still be 0 (as shown above).

What does any of this have to do with Programming? Well there are CPUs called RISC CPUs, RISC stands for Reduced Instruction Set Computer. The goal of RISC to have as few instruction as possible. On the computation side I would argue that all you need is Addition and Negation. My argument would be based on this post, as I have shown all of the mathematical operations we know can be express with just Addition and Negation operations. Thus, for computations RISC would only need the ability to Add and Negate.

Subscribe to:
Posts (Atom)