Sunday, March 30, 2008

The threat of the millenium?

This is an interesting article about the potential risks of prolonged cell phone usage.

If it turns out that long term exposure to cell phone radiation is indeed cancerous (and I'm going to guess that it is), it'd likely become a debate as heated as those about global warming. The major difference is that with wireless radiation, there are major stakeholders in the telecommunications industry, and there could be deep implications to freedom of communication as we know it today.

Of course, I could be totally off here.

Opera Acid 3 update

We can now download a public build of Opera that passes Acid3.

Friday, March 28, 2008

Bashing Apple is trendy now

It's the bandwagon effect. There, I said it. I think we can expect this sort of negative infosec press a lot from now on.

I'm not saying they're great at security; in fact, obscurity has been historically one of the main reasons macs are more secure than PCs. If Apple doesn't do something about its underdog-style infrastructure, it'll simply continue to get beaten up like Microsoft was. As Sun Tzu would say, that's the tao.

Thursday, March 27, 2008

Ruby on the browser

Ok, this is really cool. Someone wrote a Ruby interpreter in javascript, which essentially means you can run ruby on any javascript-enabled browser. I'd love to see more work on this field and hopefully get other languages in the browser. Then, maybe in a not so distant future, browser makers would consider implementing these interpreters natively.

Apple is turning into the new Microsoft

Come on, guys. This is one of the first things any hacker or quality control specialist would try and it broke. What a shame.

Opera and Safari pass Acid3

My favorite browser never ceases to impress me. The Opera team just announced Opera now passes Acid3. One concern I have is that apparently there was a bug in the test itself, so we'll see how that rolls out.

Btw, Safari just announced that they pass too.

Wednesday, March 26, 2008

Robbing is ok, when everyone does it

This is a really bizarre story: you could post a fake Craigslist ad saying someone is giving away all of their belongings, call the person out for some fake emergency meeting, and then join the mob of people who come and grab stuff from the person's house. And you won't be prosecuted even if you get caught with your hands in the dough.

Tuesday, March 25, 2008

Future forecast for big IT companies

You may or may not have heard this before. In a way, I think it does hold true to some extent (I'm personally growing more and more dissatisfied - and sometimes downright annoyed - with Apple products).

On the other, I can't help but point out that this whole shift of perception is only really going to apply to techie zealots. I mean, we live in a world where people think the E icon on the desktop is the Internet, that Macs are just pretty white PCs, and where a lot of people who think "Microsoft sucks" never used anything but Windows (and continue to use it, for that matter).

I don't think it's the size of the company that makes it less likable, it's how well it lives up to expectations. Microsoft has failed numerous times, notoriously in the security realm. I can see Apple failing on the customizability front, since virtually all of its products are monopolistic vendor lock-ins, but I don't see Google losing face because of privacy.

The thing about privacy, as it relates to advertising, is that what advertisers know about you affect the relevance and quality of their ads in a positive way. What could theoretically break Google is pushiness (like the Google search toolbar in Firefox, which I personally never meant to install), but their latest dip in stock prices shows they aren't as concerned with money as they are with not pissing off their users.

In summary: I expect Apple to end up somewhere close to Microsoft when it gathers a bigger client base, but I think Google is a bit smarter and forward-thinking than that.

Language popularity

Neat article about the psychology behind programming language popularity.

Steve Yegge had blogged about this around a year ago.

Thursday, March 20, 2008

Denno Coil IRL

If you ever thought Denno Coil's "augmented reality" goggles were awesome, check this out.

More speed optimization goodness from the Yahoo folks

20 more rules to speed up your sites.

Today must be room temperature day

Two noteworthy announcements: A silent solid state microchip fan (with no moving parts) and a new compressed-silicon-hydrogen compound that allows room temperature semiconductors.

Saturday, March 15, 2008

A clean javascript foreach loop

Here's a somewhat unusual way to write a foreach loop, using the old plain vanilla for statement:

var items = ["Apple", "Banana", "Strawberry"];
for (var item, i = 0; item = items[i]; i++) {
  console.log(item);
}

There are three advantages for using this syntax over calling Array.forEach() or whatever other library foreach implementation:

  1. There's no function call overhead. I've already talked about this here
  2. You can use break and continue statements:
    var items = ["Apple", "Banana", "Dice", "Strawberry"];
    for (var item, i = 0; item = items[i]; i++) {
      if (item == "Dice") continue;//no dice!
      console.log(item);
    }
    
  3. You have full control over the iterator cursor:
    var items = ["John", "Apple", "Mary", "Banana", "Jane", "Strawberry"];
    //for every second item, starting from the second item
    for (var item, i = 1; item = items[i]; i += 2) {
      console.log(item);
    }
    

One word of caution though: the "item" variable I declared is still in scope after the loop terminates, unlike a foreach loop that calls a function.

Friday, March 14, 2008

Background images not showing in IE6

The scenario: You're trying to change the background of the element by clicking on it. You write some quick code:

/*css*/
#my-element { background:url(expanded.gif) no-repeat; height:10px; width:10px; }
#my-element.collapsed { background-image:url(collapsed.gif); }

//js, using Ext
Ext.onReady(function() {
  var e = document.getElementById("my-element");
  e.on("click", function() {
    e.toggleClass("collapsed");
  });
});

The problem: IE6 makes the background image disappear when you click on the element. What gives?

Solutions: There are several ways to fix this problem:

  1. Use sprites. Instead of having two separate images, create a single image that combines both, and then set the background-position via the class name.

  2. Add the second background image to the parent element. This isn't ideal, but if for whatever reason you can't have sprites, the second background will show if the background in your element fails to render. The key here is that the second background must be hidden behind the initial background of your element.

  3. And the crazy hack I found today. In case you haven't seen the pattern, only images that are computed as a style parameter on page load will work properly.

    So if you can't use sprites and you can't use your parent element as a fallback, you can simply apply the background to anything that gets its styles computed on page load. Yes, that means you can do stuff like this:

    html {background:url(cacheme1.gif) no-repeat -5000px;}
    meta {background:url(cacheme2.gif) no-repeat -5000px;}
    script {background:url(cacheme3.gif) no-repeat -5000px;}
    

Thursday, March 6, 2008

Why is IE8 not passing acid 2??!1

Seems some people are having problems with IE8 beta not passing acid2. What impressed me was how quickly the IE team addressed this concern in their blog and the depth they went into to explain it.

Communication is good :)

Wednesday, March 5, 2008

IE8 readyness toolkit

Some really impressive stuff going on with IE8. Twas about time.

NIN sells out $300 deluxe edition in two days

Exploitation of the Law of Supply and Demand at its finest.

Equal distance columns in css

Neat.

Singularity

It’s not the next Windows: Microsoft Research releases its Singularity source code for academic and non-commercial use, with hopes that a prototype operating system built to improve software dependability will foster inventive research.

Tuesday, March 4, 2008

Yay

I'm free!

Back to table based layouts?

Kevin Yank writes about the possibilities of using display:table when IE8 comes out. Personally, I don't see this being feasible for a good 3 years, seeing how IE6 is still a major browser despite IE7 being out for a while now.

Acid 3 is out

And safari 3 nightly is winning.

2 months later

Finally, the IE team made it official that they'll enable standards compliance mode by default in IE8.

Can someone remind me why the US is still in Iraq?

Apparently someone set fire to some luxury houses as a form of ecoterrorist protest.

I wonder what was the point of setting all of that smoke up into the atmosphere. I bet they used aerosols with ODS to draw the message on the sheet too <_<;

Wikileaks back online

I don't know about you, but I had never heard of wikileaks before the whole shutting down hubba-bubba. Apparently the judge reversed the order to take the domain offline because the press the action caused did the opposite of what he intended.

Nokia is getting Silverlight

With all the talks about how w3c standards compliance sucks on mobile platforms, could it be that the proprietary formats will end up becoming de facto standards all over again?

Monday, March 3, 2008

Vista cracked

Thanks for making the world a worse place, Pantheon.

Generics in Javascript

Apparently, there are talks about adding generics to Javascript.

I'm not sure why people would want generics in a dynamically-typed language.

Personally, I like:

var EmpList = []
over
var EmpList:List.<Employee> = new List.<Employee>();

The one thing I really dislike about static typed languages is this naive assumption that a language should restrict the "damage" a programmer can do. I think that's just plain bad design, because people end up relying on the software when it's really the programmer's job to unit-test their code in the first place.

Making generics invariant is just silly. In the EmpList example, writing

EmpList[0].bark()
is going to throw errors regardless of whether you have type constraints or not. This whole thing about object sniffing has been discussed enough times already and this sounds like a pompous version of the same thing. When you have no control over the environment where your code will run (e.g. a browser), you can't just go and do
var a = new List.<Array>([]);
a[0].forEach(doSomething);

At least they're suggesting an unambiguous token (".<"), instead of copying Java literally, so implementation should be a little less hellish, and thus, a little faster to parse through.