Monday, September 20, 2010

"IE9 is a great browser" is an oxymoron statement?

"IE can die in hell!"
"IE is for morons."
"IE is so slow!"
"IE SUCKS!"
"No! not you! ActiveX!"


There, google them. Each one of them will probably give you back billions and billions of results. 


If you are a web application developer, you know that IE has been more of an enemy than a friend in the past few years. And IE6 has quickly gone from Heaven-sent in the early 2000's to being the Devil's reincarnation in the past few years. 


Microsoft, often blinded by their power and market shares, thought they could implement anything in their own ways, and most of the Windows users were ignorant enough to actually accept whatever Microsoft did without holding pitchforks to Redmond or ask the Congress to dissemble Microsoft IE division. The common web standards to Microsoft were more like suggestions than requirements; pretty much like how the folks in Berkeley treat the traffic rules. 


However, IE9 is different. 


If you go to IE9, it is all about standards now. Just go to the IE9's website, and BOOM! Right in your face, they do not hide it. From ACID3 tests to HTML5 to a new JavaScript engine, Microsoft is now boasting its devotion and dedication to the web standards and the speed benchmark.  


The past weekend I downloaded and tried IE9's first public beta. Perhaps due to my Microsoft background and I am, in general, very bias towards Microsoft; I had to say I am very impressed. I like the minimalist design like Chrome. I like it tells me which extensions take too long to load, I like the improved developer tools. I like it is noticeably fast. And most of all, I like my company's pages still look and function the same. Being a developer, you should know how much of a relief that is. 


To convince web developers to start using IE again as their primary development browsers (by choice, not by requirement ;-) ), Microsoft comes up wit this site: http://www.beautyoftheweb.com/, again to demonstrate Microsoft's effort to follow HTML5. I believe some of these sites/pages are even made specifically for IE9!


After a weekend of nothing but IE9, I am convinced. This beta release is definitely a winner. 


Good job, Redmond. 
Now, just denounce the support for IE6, I promise I will bing instead of google for a week. Or maybe 5 days. At least 3. 




function SearchInBing (searchText){
    return SearchInGoogle(searchText); //we will keep it on the down low. 
}





Wednesday, September 15, 2010

Time to be famous

National Geographic's annual photography contest will start tomorrow till the end of November! $15 per photo entry, so.... I am gonna spend like $150 to get all of my proud pictures in! 

Tuesday, September 14, 2010

Damn the prefixes

So today I was playing a bit with the box shadows in CSS3, and as I was writing the code, I realized that in order for me to put some simple shadows around the a box, here is what I need to do:


-webkit-box-shadow: 0px 0px 10px #676767;
-moz-box-shadow: 0px 0px 10px #676767;
box-shadow: 0px 0px 10px #676767;


Now if you are using any browser other than IE, you can see shadows around the code block above. And if you use IE, all you see is a regular code block with just grey borders!

WAIT..... IE WHAT!?

Yes, I do need to have all these duplicate CSS code with the silly prefixes to make sure Firefox, Opera and Google-Chrome can put up some freaken shadows around the code block; and IE will simply do what IE does the best! Ignore all of them!

Am I the only one finding these pre-fixes borderline annoying? Actually I am somewhat disturbed. Or even outraged! For a simple thing like SHADOWS! You may as well split in my mouth and ask me if I can tell if you have chicken or fish for dinner!

Finally we have an easy and clean way to put shadows around a box, and all these damn browser companies can't even agree on one single simple box-shadow specification to conform to?
While I understand the prefix exists as a way for a company to claim that "silly boy who complains too much... it is only beta and it will only affect my browser only (*wink)", but come on, guys! At least figure out a way to standardize the very basic specifications and then "override-it-only-when-a-prefix-is-specified"!

While all these damn browsers are competing for the fastest speed, but at the same time, they shoot themselves in the foot by forcing users to duplicate code (and, thus, larger files to download) in order to have the multi-browser supports.

I guess what I am saying is that while I know the prefixes are useful/important for browser companies and developers who dare, but I just wish these companies can come up with a solution to reduce the repetitive CSS code due to the prefixes to get more developers to dare. And while they are at it, kill some of prefixes that just don't make sense to be prefixed anymore (if safe, of course)!

If the next United State President candidate can promise me web standard uniformity, I am voting for that person. Heck, it does not even need to be a person, it can be a possum, for I care.


function isVotingForCandidate(candidate){
    var isVoting = false;

    Ext.each(candidate.proposedPolicies, function(i, x, a){
           if (i.indexOf('the world should only use one browser only, darn it!') > -1){
               isVoting = true;
               return false;
        }
    });

    return isVoting;
}

Saturday, September 11, 2010

LITTLE TRICKS

Hopefully my blog will not be taken down. 


Why? because have you noticed that you don't see any of the annoy default sign-in header nor the "power-by" footer anymore? See the attached image below. 





How did I do that? 

Well... since I was allowed to add/modify my blog templates, so I included ExtJS (a powerful JavaScript Library, you can use JQuery or any other decent JavaScript library out there, or skip this step and just do a good ol' getElementByID) from a CDN, used firebug to find out the elements that were responsible for the annoy and useless things, and with a simple element.remove function from ExtJS, then voila! No more contents that I don't approve! 


That's right! This is a totalitarian blog, everything that shows up must be approved by ME and ME only. 


Take that, Google!

It's 3:21am. I guess I am really excited for my blog and I am really awake. 


function removeUselessElement(el){
     if (el.usage === usage.useless){
         Ext.get(el).remove();
     }
}

Friday, September 10, 2010

TO VAR OR NOT TO VAR

If you ever do anything in JavaScript, I am sure you have created functions like this:  


var myFunk = function () { 
 return 'hello, i need a hug.'; 
};
myFunk();  // hug me!


function yourFunk () { 
 return 'get away from me';
}
yourFunk(); // no love from you


And then you said to yourself: "hmmm... AWESOME!"
However, let say if there is a really magical coding earthquake that somehow magically, of course, switches your code around like this... 


yourFunk(); // away you go even before you ask
function yourFunk () {  
 return 'get away from me.';
}


myFunk(); // i need a hu... wait... ERROR!!!!
var myFunk = function () { 
 return 'hello, i need a hug.'; 
}; 

And all of sudden your online "Which-Sailor-Moon-Character-Are-You Personality Testing" site breaks when executing myFunk() while yourFunk() executes correctly! WTF!?
Children, gather around as I am about to break it down. The reason is at the JavaScript parse time, the browser will learn about the definition of yourFunk function and knows what to do. However, the anonymous function to var myFunk assignment will not happen until the run-time; and since myFunk is called before the anonymous function assignment happens, the browser will have no idea what myFunk is and it will throw an exception and start to sob uncontrollably! Isn't JavaScript wacky and interesting and mildly amusing!?

Think about it for a second, it will all make sense in a minute or two... ... ... ahhh... now I see what the VAR is going on. 

function whatsMyAlias(user) {
   if (user.Name === 'badallen'){
      return "Tuxedo Mask";
   }
  else {
     return "sorry you are not cool enough to have an alias.";
   }
}

HELLO WORLD

I actually feel kind of lame for using "Hello World" as the title of my first blog because I am sure this blog entry title is also shared by millions of blogs that are written by developers. Well... but I also feel kind of lame that I am an Asian person who self-proclaims photography is my passion, since it is mandatory for all of the Asian males to go through a period of car-loving or photo-loving. Therefore, because I feel so lame already, what's a little hello world gonna do to my blog's reputation. Plus, blending-in is a special skill that I am encouraged to acquire as a Chinese immigrant. My mom has always told me that I shouldn't cause any trouble, I shouldn't do anything that other people wouldn't do... so hello world it is. 

Anyhow... this blog will be written in bad English, as in it will be filled with bad grammars and misspelled words. If you are an English Professor with severer heart-issues, please make sure you have your heart medicines within arms reach if you have to read my blog. 

This blog will mostly be about three things (or just whatever I feel like): code, photography and my rant to the world. If you think c# is a musical notation, then perhaps this blog is not for you. If you think closure in JavaScript is what you do with your boyfriend/girlfriend when you breakup with him/her at a coffee shop, then perhaps is blog is not for you. If you think photography is lame, then definitely this blog is not for you. If you are a useless politician or an obscure religious leader who does stupid things in the name of religions, then perhaps this blog is not for you. 

If you are someone who enjoys discussing .NET/JavaScript best practices, random technologies, or small business developments, then I hope you can find something useful here. If you enjoy film photography, black & white photos, or Leica, then I hope you can find something that speaks to you here. If you are a person I just happen to work with, you will definitely find something useful here, because I will quiz each one of you. 

function BlogEntryTitleGenerator(){
    if (getCurrentEntriesCount(this) < 1){
       return "Hello World";
    }

    else {
       // TODO: not sure yet
    }
}