Turns out, Wolfram Alpha is really handy if you get curious about how many calories are in the lunch you packed for work. Check it out:
Back in 2007 Jeff Atwood ran the top 4 web browsers through the SunSpider JavaScript Benchmark and posted his findings. It’s been close to 2 years since then and I was curious to see how FireFox 3.5, IE8, IE7 (in Compatibility Mode) and Google Chrome 4.0.249.11 would fair.
So I did pretty much the same thing Jeff did and here is what I found:

* System specs: Windows 7 64-bit on a Dual-Core 2.53ghz CPU with 4gb of RAM with no browser extensions
- Chrome kicks some serious butt over everyone else with the entire test suite running to completion in under 1 second!!
- FireFox 3.5 has some serious improvements coming in at just over 1.5 seconds total, which is about 1/10 the time it took FireFox 2.0
- Internet Explorer 8 and Internet Explorer 7 (compat mode) are still bringing up the rear but they had a better showing than the 20+ seconds IE7 took when Jeff ran the test
Surprises?
The only thing I found surprising about the results was that if you removed the string test from both IE runs then IE8 in compatibility mode beats IE8 running normally. That doesn’t seem right to me and I seriously hope JavaScript performance is something that gets addressed in IE9. And by “addressed” I mean “fixed by replacing Trident with WebKit”.
So, what do these results actually mean? Well I guess it depends. If you use your browser to read blogs and check your gmail then you shouldn’t really care about these numbers. However, if you’re a web developer you should be paying strong attention to these numbers and how far they’ve come in just 2 years.
code · firefox · google-chrome · Javascript

Here we are with another excellent installment in the “Works On My Machine” series where I post some code, some thoughts and hopefully show you something interesting/cool/new.
Today I’m going to talk briefly about Project Euler problem #3. Problem 3 asks you to find the largest prime factor of the number 600,851,475,143.
My solution is pretty simple but it works:
var getLargestPrimeFactor = function(num)
{
var factors = [];
for ( var f = 2; f < num; f++ )
{
if( num%f == 0 )
{
factors.push(f);
num = num /f;
}
}
factors.push(num);
return factors[factors.length-1];
};
alert( getLargestPrimeFactor(600851475143));
You may have noticed that there isn’t a check for a factors optimus primeness anywhere in there.
Thats because the getLargestPrimeFactor() function is dividing the number by it’s smallest factor, and the smallest factor for any number is always prime so when we run out of factors we’ve got the largest prime factor. Yeah, that’s pretth cool IMO.
I read the discussion threads for problem 3 after I solved it and I was surprised that hardly anyone removed the prime checks from their code.
So, problem 3 is in the bag and I feel pretty good about coming up with the prime check optimization (or lack thereof). A small bit of proof that I know what I’m doing. Sometimes :D
code · Javascript · math
During the first round of development for JSOQ I needed a faster way to test than unit-tests alone could provide. What I needed was a dirt-simple page that I could run in a browser, enter some JavaScript code, click a button and see it execute.
I built the initial JSOQ Console (which is still included with the JSOQ source code) in about 20 minutes and it increased my productivity by 10x.
It was much faster to test JSOQ functions with the JSOQ Console than it had been with unit-tests. As a result I was able to prototype new functionality in about 1/2 the time.
I’ve finally moved v0.2 of the Jsoq Console to my blog here so you can use it to quickly test out your own JavaScript code!
How it works is pretty straight forward. If you’ve got a snippet of JavaScript, be it jQuery (for the moment jQuery is the only external library that is supported but that will change soon), JSOQ or any other javascript code, you can run it with the JSOQ Console.
Just navigate to http://tinyurl.com/jsoqconsole or http://codeimpossible.com/jsoq for those of you that like to type, paste your code into the textarea at the top of the page, press “Run” and your code will run!
So enjoy! If you get confused there are also samples that will show you how to use the more “advanced” features. Also, drop a comment or share the console with others if you thought it was useful!
16
Dear Sql management studio, just let me save my database table!!
2 Comments · Posted by Jared
If you’re like me, you recently upgraded to Sql Server 2008 (or just installed the Management Studio). If you’re really like me you found the “Saving changes is not permitted” dialog that pops up every time you try to save a modified table annoying.
You may not have found it annoying enough to investigate but I sure did. I don’t remember Management Studio 2005 complaining when I changed a table and saved it. Why the change in 2008?
Well, anyway, here’s your chance to get rid of that dialog once and for all.
In Sql Management Studio, go to Tools -> Options, expand down the Designers node, and select Table and Database Designers. In the Table Options section uncheck Prevent saving changes that require table re-creation and you’re done!
You can now change your database tables hassle free!
