- Firesizer
- Lets you change your browser size to 800x600, 1024x768, etc.
- Lets you create your own custom sizes
- Always shows you the current dimensions of your browser
- IE Tab
- Lets you view pages using an IE browser right inside Firefox.
- This not only lets me stay in Firefox all day, but also lets me instantly switch browsers to see how a page looks in one or the other.
- You can even run active-x controls when viewing in IE mode.
- Firebug
- This one should just be called 'awesome'.
- Lets you debug code, add, modify, or delete page elements while you're looking at the page
- Lets you hover over any part of the page and see the elements and style hierarchy
- I'll say it again: This one should just be called 'awesome'.
Thursday, June 12, 2008
Firefox add-ons
There are 3 Firefox add-ons I use daily. Together, they save me a lot of time during web development. I don't know how I ever lived without them.
Labels:
Web Development
Tuesday, June 10, 2008
JavaScript endsWith() and trim()
Today I needed a new JavaScript string function to see if the end of a string matched something. In ASP.NET, when controls within other controls get written as HTML, the id's get prepended with a bunch of junk from the container controls. So, for your JavaScript functions to find a particular control, it's useful to use document.getElementsByTagName('input') for example to get a list of input tags, then iterate the list testing the end of the id attribute to find a particular control. Anyway, I used 'prototype' to add an endsWith(x) function to strings.
Here it is. I hope you find it useful.
String.prototype.endsWith = function(txt,ignoreCase)
{
var rgx;
if(ignoreCase)
{
rgx = new RegExp(txt+"$","i");
}
else
{
rgx = new RegExp(txt+"$");
}
return this.match(rgx)!=null;
}
For example: 'hello'.endsWith('LO',true) returns true. Notice I passed in a true value for the ignoreCase parameter.
Or with a variable: var x = 'goodbye'; then x.endsWith('bye') returns true.
While I'm here, here's a cool one liner that will do a trim() on both sides of a string.
String.prototype.trim = function()
{
return this.replace(/(^\s*|\s*$)/g,'');
}
For example: alert('.' + ' blah '.trim() + '.'); shows ".blah."
Labels:
Web Development
Wednesday, June 4, 2008
Response.Redirect ResolveUrl fails
I had a Response.Redirect fail today. The url was something like this: "~/blah/blah.aspx?id=5&time=3:30". Response.Redirect, when it sees the "~" character, does a ResolveUrl() call under the hood. That's really what was failing. It wouldn't resolve my url, so I kept removing parameters until it worked. It was choking on the ":" character.
The solution was to do a myUrl.Replace(":","%3A"). I don't know why it can't handle the ":" and wonder if there are other characters it has a problem with.
Labels:
Web Development
Friday, May 30, 2008
Aftermarket helmet lock
The saddle bags on our bikes cover the stock helmet lock rendering it completely useless, so we went for an aftermarket solution. Here's the site where we got it. I installed it today, and hung my helmet for the first time...pretty cool.


Labels:
Motorcycles,
Off Time
The Office & B.J. Novak
I'm so jazzed right now. I'm a huge fan of "The Office" and tonight I'm going to see B.J. Novak (Ryan) do stand-up. He writes for the show and produces too. This is going to be good!
Labels:
Off Time
Wednesday, May 28, 2008
Ordering columns in a GridView - it's not magic
I (and others) have found a bug in ASP.NET's new GridView control. Something that worked with the old DataGrid doesn't work in the new version.
Scenario: I had to reorder my gridview's columns at runtime to support custom report views for users. I have a list of columns that the person wishes to see, and a bunch of predefined columns built into the grid using the standard declarative syntax. So, in code, I loop through the user's requested columns and find them in the grid, then move them to the end of the grid by calling myGrid.Columns.Add(theColumn) and myGrid.Columns.RemoveAt(x) methods. I then set the visible property to false for all other columns. The columns reorganize just as I want, but any columns of type TemplateField end up with blank data (actually empty control collection) when the grid is rendered. Ouch! Apparently the template column data is saved in the viewstate, but not the template column's control tree, so when you move the column, that part is lost and the grid looks empty for those columns.
Unexpected solution: I'm using the gridview's built in sorting and paging....which is awesome, and surprisingly not dependent on EnableViewstate being set to true. Turning off EnableViewstate fixed my disappearing template column stuff and the sorting and paging still magically work.
Scenario: I had to reorder my gridview's columns at runtime to support custom report views for users. I have a list of columns that the person wishes to see, and a bunch of predefined columns built into the grid using the standard declarative syntax. So, in code, I loop through the user's requested columns and find them in the grid, then move them to the end of the grid by calling myGrid.Columns.Add(theColumn) and myGrid.Columns.RemoveAt(x) methods. I then set the visible property to false for all other columns. The columns reorganize just as I want, but any columns of type TemplateField end up with blank data (actually empty control collection) when the grid is rendered. Ouch! Apparently the template column data is saved in the viewstate, but not the template column's control tree, so when you move the column, that part is lost and the grid looks empty for those columns.
Unexpected solution: I'm using the gridview's built in sorting and paging....which is awesome, and surprisingly not dependent on EnableViewstate being set to true. Turning off EnableViewstate fixed my disappearing template column stuff and the sorting and paging still magically work.
Labels:
Web Development
Monday, May 19, 2008
Hangin' out & riding
Here's a pic of Rich, Kayleen, Stephanie, and me waiting to listen to Klementine play. That's a band that's playing at our wedding in October. Oh yeah, I guess I could've mentioned that earlier! Stephanie and I are engaged. Woohoo! Jes, the lead singer, took the photo.
We all rode motorcycles to the bar. Don't worry, I drank a virgin rum & coke (aka a diet coke). Then we got home at midnight, woke up early the next morning and over Saturday and Sunday Steph and I rode 400 miles...yeah...wow. Saturday was blazing hot, about 90 degrees, which no matter how fast you're going is still hot. Sunday was cooler, under 80 degrees and going on the highway produced enough of a breeze for a really comfortable ride.
Labels:
Motorcycles,
Off Time
Subscribe to:
Posts (Atom)