As a long time PC/Windows user I finally got my first Apple computer: a shiny white Macbook.
Macbook is not a complicated machine. It doesn’t overwhelm you with bells and whistles. But everything is there to work. The hardware design is truly the best.
The Mac OS X is a great OS. I didn’t have much learning curve to get familiar with it except to learn all the keyboard shortcuts since I want to stick with the touchpad without a mouse. I found out that you can put two fingers on the touchpad and scroll down a page, which is an awesome feature. One great thing about Mac OS X is that it is based on the Free BSD so I can always use a terminal to do the work. It is essentially a Unix machine with a nice GUI.
Mac app did crash once. My iTunes crashed and a message box popped up so I can end the program. However it didn’t bring down the whole machine and everything else was business as usual. There is another time that iTunes appeared to be in a runaway mode and I had to kill it manually. Seems that Apple has some work to do on the iTunes. But overall it synced with my iPod without any problems. The mac sleep mode also works flawlessly, which I always have problems with my Windows machine.
So here is my short review. I remember some famous people once said “simplicity is the ultimate sophistication”, and a Mac reminds me a lot of that.
We often check if a variable is defined or not in javascript before proceeding the next line of code. Usually the code somewhat looks like this:
var myUndefinedVar = 1;
if (myUndefinedVar) {
// do some stuff
}
Even the browser will throw out an Javascript error, the code works since there is no else statement or other intended logics beneath the if block in this case. Otherwise, we won’t be so lucky since the browser will stop executing the rest of the statements. A better way is using the typeof operator, which will not result in an browser error even the variable is undefined. Here is a code example:
if (typeof(myUndefinedVar) == ‘undefined’) {
// do this
} else {
// do that
}
Notice that, the following code will work whether the document element is there or not.
if (document.getElementById(’blah’)) {
}
The reason is that document is always a valid object and getElementById will either return an object or a null value, which in either case, will not cause the browser to throw up.
Google released Chrome yesterday, a new web browser, currently available for Windows XP only.
It is very simple to install and It is very fast based on my experience. I haven’t tried many sites though. So there are probably sites that don’t play well with Chrome. Chrome will not have a bookmark if you don’t import one from Firefox or IE. And also, I can’t use a drop down to see the sites I used to visit from the address bar (or so called omnibox in Chrome), which I think is a big inconvenience. However, upon opening a new tab, a bunch of sites that I have visited will be there to provide some kind shortcuts to the sites that I used to visit.
It is probably still early to say how dominant (or how irrelevant) Chrome will be in the future but it will certainly change the way people access the Internet. I am already using Chrome for my GMail, Google Reader and some other Google apps with Firefox opened for other web browsing and development work. When there are more and more browser based apps available, Chrome may be the perfect choice to run those heavy JavaScript sites.
I think besides the fresh look and some usability innovations of this new browser, the key is its open source root. Looks like the desktop app itself is on a good start, now the next thing is to extend it into other territories like mobile and smart devices, which is quite an open field to get into.
In the Desktop environment I think it is still too early to tell how long it will take to be adopted by the mainstream, considering 20-25% of the web users are still using IE6 today. Google might have to bundle Chrome with some really great browser apps to get it replace IE on people’s Windows desktop. In the meantime Microsoft will keep improving IE so it is still a long way to go for Chrome. But I think Chrome is a real threat to the browsers like Opera today and if when the development of 3rd party add-ons starts to catch on for Chrome, it will most definitely cut into Firefox’s market share.