Friday, November 30, 2007

Media storage evolution

Floppy beginning
In the beginning of computing there was the 5.25" floppy. (ok, not exactly at the beginning of computing, but close enough, wacky things like tapes and 8" floppy weren't that available anyway). Then there was the "high density 1.4M" 3.5" floppy. All disk drives can read and write to it, no problem. That meg was massive storage place for little things like a WordPerfect docs and a couple program source files. Now people demand much more. Now there are fat document files, huge images, and needed a much higher capacity storage. And there was the 700Meg CD.

CD
But the problem with CD is that it is written with laser, so can't erase and write again like magnetic floppies. The CD has completely replaced the cassette as media for music. For a time, everyone was content with CD-ROM. CD writers/burners were not so common when they first arrive, until the thirst for portable data storage exceeded the floppies.

DVD
Then there is the DVD, ideal for storing videos. It is like a hyper CD that can store 4.7 Gig! Wow that's a lot of data, but still not a lot of video, because videos are BIG. Look, it takes at least 24 image files for a SECOND of video.

VHS tapes are gone like cassettes, being totally replaced by DVD. All videos are now in DVD, including things like home videos and wedding videos. I will need a DVD burner to make copies. I just bought one, an external one, so I don't have to fiddle with internals of a computer, and it is easy to use it on another computer.

My DVD burning experience
Whoa, it takes at least 10 minutes to copy an image of a DVD, and takes 20 minutes to write to a DVD! Almost half an hour to copy a DVD. Now that's slow.

I have a complain with Nero. What? you copy image by first selecting a recorder type of "Image Recorder" (which means the hard disk) by click the "Burn" button which actually "burns" the image on my hard disk, and then change recorder type to the DVD drive and then "Burn image" to the DVD?? Look, these steps ought to be on 1 screen, with clear instructions. I am disappointed at Nero.

Here is a shocker. the copied DVD can't play on my original DVD drive!! Waita minute, I copied it, and my original drive can't play it? Ok it is an old DVD drive. The copied DVD can play on the DVD burner (when acting as a reader) and on another computer and on the inexpensive Memorex DVD player so I am not complaining too loud. But I want an explanation. Also, there OUGHT to be just ONE type of DVD. Not non sense incompatiable things like DVD+R and DVD-R. One shall stand, one shall fall.

About things like 8x, 16x, 20x speed. Just what am I comparing to? what is 1x? Not clear for the regular customer.

Little USB Flash drives
Then there was the USB flash disk drives. It is an amazing product (due to research in some very difficult solid state physics I suppse). No need to fuss slow burning. It also exchange files much faster with your computer. Now they are very cheap to get. But I doubt you would be renting videos on USB flash disk one day. How about someone invent a DVD player (or media player) that you can plug in a USB drive?

I imagine one day all medias go obsolete. That is, no one owns any videos in the form of VHS or DVD or whatever. I predict one day everything stored on the computer or the internet and you load it from there. Want to get a copy of my home video? I upload on my server and you download from there. I simply give you a password. Ok, this isn't exactly the future, people are already doing this. I just predict everyone trust their storage on computer more than the trusty little portable storages like floppy, CD, and DVD.

Monday, November 26, 2007

Piems -- poems for pi

Mathematicians are fascinated by π. After seeing a few neat things about it perhaps you will be fascinated by it too. One quick fact about π is that it is irrational, that is, it cannot be represented fully in finite number of decimal digits. The first few digits are of course 3.14159... No one has yet found patterns within the digits, and daring people hold π reciting contests to test their memorization ability! The world record is 100,000 digits! Ok, I think it is an absolute waste of time to memorize any digits of π beyond perhaps 5 digits. But the trick they use is fairly interesting. They use humorous poems known as piems!

For example, here is one:
How I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics

Notice the length of each words: how = 3, I = 1, need=4, a = 1, drink = 5, alcoholic = 9, making 3.14159. This menomic poems make it easier to remember than remembering raw digits.

Besides the Every Good Boy Deserves Fudge and All Cars Eat Gas in music that privledged child piano players learned, it is interesting to see menomic in math.

See details at http://en.wikipedia.org/wiki/Piphilology

Menomic and memory... perhaps it is a serious psychology topic.

Some people apparently had too much time in their hands. Please don't spend time memorizing digits of interesting numbers such as π, e, or φ.

Tuesday, November 20, 2007

Zero to the zeroth power

Wiki is a great resource for almost every topic you can think of, including the academic topics.
There are vast resource on math for almost every topic there is out there.
I like the clearly formatted information in there, and nicely presented proofs for many interesting theorems there.

Reviewing my elementary math book on the problem of 00 here, I decided to see wiki says:


http://en.wikipedia.org/wiki/Defined_and_undefined#Zero_to_the_zero_power


This is a bit shocking to me:

Modern textbooks often define 00 = 1. For example, Ronald Graham, Donald Knuth and Oren Patashnik argue in their book Concrete mathematics:


"Some textbooks leave the quantity 00 undefined, because the functions 0x and x0 have different limiting values when x decreases to 0. But this is a mistake. We must define x0 = 1 for all x, if the binomial theorem is to be valid when x = 0 , y = 0, and/or x = −y . The theorem is too important to be arbitrarily restricted! By contrast, the function 0x is quite unimportant."



I am no Donald Knuth or the other famous guys. A peak at Donald Knuth's multi-volume classic books on computer science will make most so called "computer science majors" faint. But I beg to differ on their view on 00.

Evaluate 00 on your calculator you will likely get an error.

Here are two conflicting rules about division when x=0:
Rule 1: zero raised to anything is 0. Zero multiply by itself, however many times, is still 0.
Rule 2: anything raised to 0 is 1.

Rule 2 works because you can write x0 as x1 - 1 = x / x = 1.
But watch out, this trick only works when x is non zero.

In the case of 00, there is a conflict here: which rule win? Since rule 2 involves a division by 0, an invalid move. So I think mathematics should not allow 00.

For binomial theorem, why bother define it for x and y = 0, or x+y=0?

Also, if you define exponents xy = exp(y ln x). Plug in x=0, y=0. ln 0 is undefined, so it doesn't work either. So I insist 00 is not defined.

Ok, back to real world, I am sure nobody cares whether 00 is defined or not.

Monday, November 19, 2007

Ebook

Today Amazon.com announced the Kindle, a ebook reader for a hefty price tag of $400. See http://www.amazon.com/gp/product/B000FI73MA
for details. For $400, I can get a lot of paperback books.

This thing is essentially a wireless computer without a mouse, or hard disk, with a high tech paper like screen. Is it black and white only?
So it is a specialized scaled down computer with wireless capability. So if you think that way, $400 is not a lot.
Can I play a round of space invaders on it? probably not. can I browse the web for things other than books? probably not.
But the goal of this product is probably not web surfing, but reading books.

Is nifty ebook readers going to replace paperback books and newspapers?

I hate newspapers. They are very environmental unfriendly and messy. It is not entire new idea to read news on a handheld PDA(it probably requires sync from a computer though). Many people don't have to read newspaper everyday, only whenever big news on the headline. Even then, they can just watch news or read the newspaper's website. Is everyone willing to pay a subscription service?

Replacing multiple volumes of thousands of pages with computer is also not entirely new idea. The PDA and the tablet PC (is it popular?) already attempted it.
Sometimes books have its advantage. I can highlight, make hand drawn notes on the margins, etc. I think it is rather hard to do it with a ebook reader. Although book is low tech compared to any computer, a bookshelf can also be a proud display at home. You can proudly display your love for English literature by showing a full set of Shakespeare, or your scientific knowledge with some Hawkings, Einstein, etc.

I perfer a more versatile device, like a full scale laptop, but not all the wiring (the mouse is a wiring). But a laptop won't be as lightweight as an ebook reader. I demand color on books. I want to interact with the book by tapping with finger or stylus.

The PDA is it! It can read PDF files. Though the PDA only has a small screen, it is easy to carry and it is more versatile. I prefer PDA over ebook reader. What I want to see is hyper-PDF files: where I can interact with it like Flash or java applets.

So my prediction is that eBook reader is not going to be real successful.

Friday, November 16, 2007

JSP and Error 500

Java Server Page (JSP) is hardly new. I do have some minor complains with it. First of all, how come the import syntax is so different? Ok I tolerate that.
I rather not mess with custom tags. Fact: if you let people do custom tags, they WILL write horrible code with it. So if something is broken, is it your JSP? the custom tag? where is it broken? Debugging other people's code is bad enough already, I don't need extra compiled stuff to look into. Fortunately I don't deal with a lot of custom tags.

Another thing, JSP is compiled into a servlet at run time. So if you have a syntax error like forgot to close a brace. It can be a nightmare to find where did you miss it. Ok this is fairly minor. A good editor may be able to detect your errors before you run.

The real complain is a Internal Server Error 500 when something goes wrong. Oh you got a null pointer assignment somewhere? boom, 500 Error. Nothing else you can see what's happening. I want to see the stack trace! It may say something in the log. Unfortunately it may not say anything, and you may not have access to it due to stupid security settings.

All JSP programmers should know about <%=variable%> as output, and know it is equivalent to out.println(variable). This displays the variable on screen. Use this to your advantage to show your stacktrace. Waita minute, how to get the stack trace? You need a try block and the important e.printStacktrace() method. Unfortunately, e.printStacktrace() writes to System.out, not the regular "out" you want...

Fortunately printStackTrace is overloaded with a flavor that takes a stream, but you need to convert it to a PrintWriter.
Here is the trick,

try {
// suspicous code
} catch (Exception ex) {
ex.printStackTrace(new java.io.PrintWriter(out));
}

Thou shalt handle the Back button

All web applications should handle the Back button, enough said.

How many times have you seen stuff like this? This is happening in even in renowned program such as PeopleSoft:

"Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. "

That's simply because they have a <form action="post">, on EVERYTHING. Even on going from page to page. If I see that warning you have a failed app.

How many times you see apps that says "do not use the back button"?
Losers who don't know how to work with the back button resolved by telling me not to use it.
Well you can't restrict me! Heck, there is no easy way to hide the buttons!
Some sad souls even use javascript's window.open to pop up a new window with no buttons to prevent that. Well I can STILL use the little known ALT-left arrow trick to simulate a back button. The solution is to handle it, not avoid it in some sad ways.

Tips to all web programmers out there: only use action=post when you actually have a form to input data, otherwise just use links! Make the action on the page process it (save it, do some searching, whatever), and redirect to another page, like a thank you page or display query data. That way the back button will go back to the original page, and not in an embarassing state which caused the warning. This is a simple trick that expensive corporate web apps should know.

Monday, November 12, 2007

Sequence and Series

Open a typical THICK calculus book, you will see the topic sequence and series.
(A sequence is a bunch of items, separated by comma: For example: 1,3,5,7,9,...
A series is the sum of such items: 1+3+5+7+9...)

The theme of calculus is using a breakthrough concept of the infinitely small. We use infinitesmal small changes in y over x to calculate the slope of the tangent line, and integrating area under curve by adding infinitely small rectangles. But it doesn't make sense to be adding up infinitely many things, even if they are small. In order for this to be fully defined, we need the limit.

The topic of sequence and series are often seen as an application of calculus and it also relies on limits.

But, why study sequence and series? Who cares if a certain series converge or diverge?
I see no need for regular calculus 101 and 102 students worry about this.

For the math aficionado, one may find the condition for divergence interesting. For the ever increasing odd series above, of course it diverges. But not all ever decreasing series converge, consider the following 2 series:

1+1/2+1/3+1/4+1/5+...
1+1/2+1/4+1/8+1/16+...

Both are decreasing, one may guess both will eventually converge. But no, the first one (known as the harmonic series) diverge. We can write a simple computer program to add a few hundred terms to see that. In the second series. each term is multipled by a factor smaller than 1, and one can show such cases always converge (these are known as geometric series).

What is really interesting is the following series:

1+1/22+1/32+1/42+1/52+...

This series converges... to π2/6! How does this relate to π? Oh my. Write a little program to verify this yourself. Ok, I give you the little routine.


public void zeta2() {
double sum = 0;
for (int i=1; i < 300; i++) {
sum += 1.0/(i*i);
}
System.out.println("total="+sum);
}

This series is known as the Zeta function. It is lengthly and no so trivial to show how this relationship work, but thanks to the internet, it is readily available. This is usually not covered in a typical calculus book, however THICK.

The neat stuff of math is what students need to see, not mundane boring exercises. Non-math majors should also be shielded from the ultra technical math formalism too. I suggest either take out sequence and series altogether from calculus curriculum or add this topic. This topic is my most recent entry in my book.

Wednesday, November 7, 2007

China moon probe and doomsday theory

Another major triumph of the advancement of the Chinese space program: China sent a probe to the moon: http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=99002.

You are probably not going to find this piece of news on CNN or American newspapers. We only hear the heroic reports of NASA astronauts fixing solar panel. America's "World News" don't report much about the world other than those of American interest.

So China has once again demonstrated its increased capability.
Last time when it blew up its own satellite, it is already making some people scare.

Was the intent of exploring space a scientific progress or demonstration of might?
I think it is sort of both.

Doomsday sayers would see this as a threat and predict East vs West major military conflict ahead (sparked by Taiwan's insistence on independence, which thankfully has been quite quiet lately). Such predictions is not helping anyone (so please stop even saying such predictions). We don't need doomsday theories.

I am not going to promote doomsday theory by saying the dragon has waken up and another Chinese dynasty is going to dominate the world either. China does not need to dominate the west. Although economy is booming in China it still have a LONG way to go to feed its billions AND getting gas for all the cars AND keeping its product safe. Don't worry, the dragon is not going to bite you.

The fact is this: America is no longer able to maintain its world leader position.
We are not able to win the war on terror and just keep pouring money and war weary soldiers out. The American dollar is so weak now. Oil at almost at whooping $100 a barrel. Congress is not able to change course and it focus on stupid issues like digging out some World War I stuff. America simply has no prominent effective leaders in sight and no good solutions to its problems. It is not looking good ahead for America.