Monday, December 29, 2008

Followup: IE6 PNG Alpha Transparency Fix

I, like many others, ran into the issue of <a> links not being click-able when they sit on top of an element upon which the alpha fix has been run.


A hint I got off of this site gave me the answer I was looking for: The element containing the filtered png must not have a position set, and the links within that element must have a position set.

Thursday, December 4, 2008

Vertically & Horizontally Centered <div>

Ran across this beautiful CSS example of a perfectly centered <div>:


#mydiv
{
position:absolute;
top: 50%;
left: 50%;
width:30em;
height:18em;
margin-top: -9em; /*set to a negative number 1/2 of your height*/
margin-left: -15em; /*set to a negative number 1/2 of your width*/
}

Wednesday, November 19, 2008

FTP/SSL through a NAT firewall

This was a helpful article in understanding connectivity issues when attempting to use FTPS through a NATed firewall:

http://geekswithblogs.net/Lance/archive/2005/08/23/50912.aspx

I'm using FileZilla Server to receive files from someone else and needed to set up FTPS. Specifying a particular port, and then opening that port, solved the problems I was having (i.e. 425 errors).

Monday, October 27, 2008

Using jQuery to make LI elements hover-able in IE6

Another necessary hack, this time to overcome IE6's non-support of the hover pseudo-class for LI elements.

This is to be used in situations where navigation is structured using UL, LI, and A elements and styled via CSS.  Please note that additional selectors will be required when implementing this solution: the standard selector (using li:hover notation) and the alternate selector (using li.over notation to support what this JavaScript is accomplishing):


$(document).ready(function() {
// Hack to make li's 'hover-able'
if (document.all && document.getElementById) {
$("#mainnav > .menu ul > li").each(function() {
this.onmouseover = function() { this.className += " over"; }
this.onmouseout = function() { this.className = this.className.replace(" over", ""); }
});
}
});

IE6 PNG alpha transparency solution

I know a bazillion solutions have been posted to the interwebs to solve this problem, but I wanted to make a note of one that I found to work quite well:

Thursday, September 25, 2008

JavaScript HTMLEncode function

Found this neat trick on another blog (http://lunarmedia.com/blogs/lunarmedia_blog/archive/2006/10/23/120405.aspx) to escape characters for presentation in HTML:

function escapeHTML (str)
{
   var div = document.createElement('div');
   var text = document.createTextNode(str);
   div.appendChild(text);
   return div.innerHTML;
}; 

Thursday, September 18, 2008

IDIOTIC WebResource.axd workaround

I was tasked with moving an ASP.NET 3.5 website from one web server to another.  Everything worked great on the second server, except I was getting 404 errors anytime an embedded resource was requested with a WebResource.axd URL.

I went all over Google looking for the answer, and found a workaround that works, but is absolutely ridiculous:

Place an empty WebResource.axd file at the location that is 404'ing.

I'm sure this has something to do with HTTP handlers and priorities and the like, but whatever the real issue is, it is so obscure that I'm going to use this workaround for now and move on.

Ugh.