Thursday, January 28, 2010

Today on the Chromium blog they announced a bunch of new features for google chrome

The one that really caught my eye was the new notifications API. With this API Chrome can set OS notifications to appear in your OS notification area

For this to work you need the newest version of Google Chrome.

I whipped up a quick sample that shows Google Chrome Notifications in action. Works only with Google Chrome and Windows. View source to see the example code.

Posted By: Chris Burkhardt on January 28, 2010  #    Disclaimer  |  Comments [0]  | 
 Thursday, March 05, 2009
After getting some production errors I mad a small app to try and exaust the ports on my test box.

I was developing a pretty simple today that looped 1000 times getting the page from google, msn, and yahoo.

Everything was working, then I got the infamous "Works on my dev box but not the server."

When trying to open an httpRequest. I got a .NET exception System.Net.WebPermission.

The exact code was:
System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=failed
Turns out I opened a network share from the test machine to my dev machine. I was trying to run the app right from the share.

Applications run from a share run in a different security domain, and it did not have permission to open the connection.

I moved the app to the local machine and everything worked out fine.

Posted By: Chris Burkhardt on March 5, 2009  #    Disclaimer  |  Comments [0]  | 
 Wednesday, August 13, 2008
I was working on my fantasy football rankings when I ran into a quirk with excel.

I was trying to do a find and replace on a comma, and it would not let me.



1. I could see the comma was there.
2. I wanted to find it, and replace it with a blank.
3. Excel would not let me search the values, only the formulas.

When I did search the formulas for "," I got the message "Microsoft Office Excel cannot find the data you're searching for"


Now I was getting frustrated. I could see the comma, but I could not remove it. It turns out the comma really wasn't there.


1. In the formula bar you can see there is no comma.
2. Yet the comma is showing up in the cell value. It must be formatting.
3. Right click the column.
4. Format Cells.



Choose "Number" and set the decimal places to 0, and the comma is removed.
Posted By: Chris Burkhardt on August 13, 2008  #    Disclaimer  |  Comments [0]  | 
 Monday, April 21, 2008
This is unacceptable: search.live.com is down. I am getting a "We're sorry, this service is currently unavailable."

Here are screens, one if firefox and one in IE7 for added irony:


search.live down


unacceptable search.live   down in IE

Look, I'm a MS fanboy. I program with their technology and run their OS. But that also means I depend on them not to suck.

When Google is kicking your ass in search, and you unveil a new search site that sucks, it helps if it doesn't go down. Especially if you are the biggest software company in the world.

Posted By: Chris Burkhardt on April 21, 2008  #    Disclaimer  |  Comments [2]  | 
 Wednesday, October 17, 2007
Accessing properties on the document object is slow in Internet Explorer. I used to use the document object as a place to store globals, ie
function onclick() {
document.clicks +=1;
}

But this is slow in IE. Instead use:

var clicks;
function onclick() {
clicks += 1;
}
Here is a full page that demonstrates this idea. I use onmousemove to simplify doing an action over and over, and you can also FEEL how slow it is by moving your mouse around the page.

And the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Document Object Test</title>

<script type="text/javascript">
var totalObj = new Object();
var flag = false;
function loaded() {
document.onmousemove = useDocument;
}

function useDocument() {
document.total += 5;
}

function useGlobal() {
totalObj.total += 5;
}

function flip() {
if (flag) {
document.onmousemove = useDocument;
document.getElementById('styleType').innerHTML = '&nbsp;document object';

}

else {
document.onmousemove = useGlobal;
document.getElementById('styleType').innerHTML = '&nbsp;global object';
}
flag = !flag;
}

</script>
</head>
<body onload="loaded();">

<a href="#" onclick="flip(); return false;">Click to flip styles</a><span id="styleType"> document</span>

</body>
</html>

Posted By: Chris Burkhardt on October 17, 2007  #    Disclaimer  |  Comments [0]  | 
 Thursday, October 11, 2007
Today I downloaded IE7 and set it to my default browser, leaving Firefox after about 5 years of use. Firefox is still a good browser, but with IE implementing tabbed browsing I don't have to put up with the annoyances of Firefox to get tabs. Here are the 10 main reasons I am switching.

1. Tools-->Options-->Show Passwords-->Show Passwords WTF? I should have stopped using firefox when someone showed me this for the first time.

2. The real last straw was Firefox's support for EV(Extended Verification) certificates. I can't find any solid information if they will be supported in FF3, or even when FF3 is scheduled to come out. I found this post, but this kind of attitude of denouncing a decision after it has been made rather than trying to help the process really bothers me. 

3. Auto update. I don't know why firefox updates in the background and then gives me a crap dialog box to "install now or later" nagging me every time I start it. Did they get bought out by Adobe?

4. Firefox still has memory problems. If I surf for 2-3 hours, opening a lot of tabs, and then trim down to 2-3 base tabs Firefox will still be around 200meg.

5. Buggy CSS. As much as firefox fans crow about how good their CSS is, there are still way to many bugs/inconsistencies.

6. Too many versions. There are too many versions and no clear road map. We don't really need 2.0.3, and all the versions give fan boys a crutch, "Well, have you updated to 2.0.3a? That will fix your problem"

7. Firefox crashes too much. I'm on my computer all day on XP and Server 2003 and programs don't really crash anymore. Sometimes I kill them, but Firefox crashes at least once a month.

8. Too much blame on extensions. Any problem with FF is shoved off to "its probably an extension". Extensions should not be allowed to crash the main program.

9. If I open a new tab and type the url too fast, it does not work. This, surprisingly, is my second biggest reason for leaving Firefox. I used to be able to Ctrl-T, and start typing. Now when I try the cursor is in the address bar blinking, but typing does nothing. I have to lose focus of the address bar and then put it back in.

10. If I have too many tabs open, copy/past breaks. That is, I cannot copy from Firefox to another app. I can copy from notepad to another app, but not Firefox. I cannot reproduce this on purpose, so I don't know for sure it is FF, but I suspect.



Posted By: Chris Burkhardt on October 11, 2007  #    Disclaimer  |  Comments [1]  | 
 Tuesday, October 09, 2007
If you have floated boxes followed by a cleared box, firefox will not honor margin-top on that box.

Here is a page demostrating the firefox bug (pops)

I think Firefox is assuming that the extended margins of float left and right apply to cleared boxes, while the specs do not say or imply that. Here is the relevent section from the spec for the clear property:

left
The top margin of the generated box is increased enough that the top border edge is below the bottom outer edge of any left-floating boxes that resulted from elements earlier in the source document.
right
The top margin of the generated box is increased enough that the top border edge is below the bottom outer edge of any right-floating boxes that resulted from elements earlier in the source document.
both
The generated box is moved below all floating boxes of earlier elements in the source document..
none
No constraint on the box's position with respect to floats.

Here is a baseline html/css sample:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Firefox css bug</title>
</head>
<body>
<div id="container">
<div style="background-color: Orange; width: 100px; height: 35px; float: left">
</div>
<div style="background-color: green; width: 100px; height: 35px; float: left">
</div>
<div style="background-color: black; width: 100px; height: 35px; clear: both; margin-top: 30px;">
</div>
</div>
</body>
</html>


Posted By: Chris Burkhardt on October 9, 2007  #    Disclaimer  |  Comments [0]  | 
 Wednesday, October 03, 2007
I just spent about 4 hours trying to debug this problem.

Here is the setup, a user with a slow connection was not able to view a .wmv on a site. The .wmv was 250mb and he was timing out at 11:34. Different browser, different computer, all that jazz. Our site runs on iis 5 with .NET 2.0 and the file is "hotlinked". That is, we are not using any kind of Response.Write to write to the stream, just linking to it and letting the client stream or download it.

I got a hold of dialup computer and account, and I was able to reproduce the problem, getting the server to send a RST about 15 minutes after starting to download the file. This looked like the .NET  Connection Timout setting, which is set to 900 seconds, or 15 minutes, as a default in iis 5.

However, when I made a new site to test this theory, setting the timeout to 20 seconds did not affect it at all. In fact, in the test site, I was not even able to reproduce the error. Besides, why could the .NET Connection Timeout have anything to do with iis sending the file over the wire?

After a ton of debugging, I found the culprit, wildcard application mapping.





The wildcard application mapping was telling .NET to handle ALL files. Because .NET was handling the file, the 900 second timeout was coming into play. This was a requirement for another part of the site to function, so we could not turn it off. What we ended up doing was making the "media" folder, where the wmv lived, its own application, and removing the mapping from there.

This solution was a lot better than upping the timeout because we didn't not want abandoned connections sitting around for ever.

Posted By: Chris Burkhardt on October 3, 2007  #    Disclaimer  |  Comments [0]  |