Internet Explorer z-index fix

Posted by Grubersauce

If you have an HTML element that you are showing and hiding you may have some problems in Internet Explorer.  IE decides to reorder your z-index depending on whether the elements are positioned relative based on some arbitrary context.  Whatever.  Here is a quick fix using jQuery:

$(document).ready(function() {
     // Following fixes IE z-index bug so tooltips can work
    var zIndexNumber = 1000;
    $('div').each(function() {
        $(this).css('zIndex', zIndexNumber);
        zIndexNumber -= 10;
    });
 
}); 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 12/23/2009 at 3:51 AM
Tags: , , , ,
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Using MVC with IIS 5.1

Posted by Grubersauce

If you're installing a website which uses Microsoft MVC for ASP.NET on a machine running IIS 5.1 (Windows XP), server requests without extensions explode.  The "fix" for this is setting a default (*) extension mapping to use ASP.NET.  We wrote a small .exe which we call from a custom action in InstallShield.

 
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.DirectoryServices;
using System.IO;
using System.Linq;
using System.Text;
 
namespace SetExtensionsForMVC
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                FileVersionInfo verinfo = null;
                if (File.Exists(@"C:\WINNT\system32\inetsrv\inetinfo.exe"))
                    verinfo = FileVersionInfo.GetVersionInfo(@"C:\WINNT\system32\inetsrv\inetinfo.exe");
                else if (File.Exists(@"C:\Windows\system32\inetsrv\inetinfo.exe"))
                    verinfo = FileVersionInfo.GetVersionInfo(@"C:\Windows\system32\inetsrv\inetinfo.exe");
 
                if (verinfo != null)
                {
                
                    Console.WriteLine("Major: " + verinfo.FileMajorPart);
                    Console.WriteLine("File version: " + verinfo.FileMinorPart);
 
                    if(verinfo.FileMajorPart == 5 && verinfo.FileMinorPart == 1 )
                    {
                        String ourApplication = args[0];
                        String strPath = "IIS://localhost/W3SVC/1/Root/" + ourApplication;
                        var iisEntry = new DirectoryEntry(strPath);
                        PropertyValueCollection applicationMappings = iisEntry.Properties["ScriptMaps"];
                        if (!applicationMappings.Contains(
                                 @"*,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1"))
                        {
                            Console.WriteLine("Writing extensionless mapping...");
                            applicationMappings.Add(@"*,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1");
                            iisEntry.CommitChanges();
                            Console.WriteLine("Complete!");
                        }
                        else
                        {
                            Console.WriteLine("Extensionless mapping already exists.");
                        }
                    }
                }
 
            }
            catch(Exception exception)
            {
                Console.WriteLine("An error occurred: " + exception.Message);
            }
        }
    }

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 12/17/2009 at 7:09 AM
Tags: , , , , ,
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Modal Window Caching

Posted by Grubersauce

So you just implemented that neat new window fix to share the parent page's session... but it doesn't seem to update when data changes.  WTF mate?  Those modal windows love to cache.  Here's a quick fix:

 var linkURI = linkToOpen + "&random=" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);

Appending an unused querystring parameter which is different each time (for the most part) will prevent the new page from loading from the cache.  I know this isn't a TRULY random number or guid, but it should do the trick.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 12/3/2009 at 5:47 AM
Tags: , , , , , ,
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Popup Window Loses ASP.NET Session Variables

Posted by Grubersauce

In one of our apps, we have the ability to comsume our website through Windows Forms and open our website in a Windows WebBroswer control.  Everything works great until one of the links opens a new window for printing.  We were doing something similar to

window.open('someurl', ....);

The problem is, the new window loaded the page using content stored in our session variables.  The new window started a new instance of IE (or whatever the default browser is set to) and therefore created a new session for the page.  Scouring the Internets lists some ways to share the session via storing session in the database.  This just wasn't feasible for several reasons

  • The performance hit we take by storing variables in session rather than inproc
  • Having to mark all of those objects as serializable
  • A lot of work for something simple like getting the print button to work

The solution is to change how we are opening the new window to be a modal dialog

window.showModalDialog('someUrl', ....);

Using a modal dialog we still share the session with the parent page.  You may encounter some styling issues, but all in all, a lot better than changing where your session is stored and all the headaches involved in that.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

The Mancave

Posted by Grubersauce
Still have some work to do on Bud's Bar, but for the most part its about done. Photobucket Photobucket Photobucket Photobucket

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 11/15/2009 at 3:36 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

MSTest Shenanigans

Posted by Grubersauce

Repeatedly running tests within Visual Studio can get really annoying when you start to see this error: 

 


Or you get a bunch of Inconclusive test results and tests aren't run.  I hate that.
You have to manually go in to task manager and kill the process to be able to run your tests again.

Tim that I work with created a quick PowerShell script to quickly get things up and running again.   Save the PowerShell script off somewhere then create a shortcut to it in your taskbar:

  $ErrorActionPreference = "Continue"
  get-Process VSTestHost | stop-process
  get-process vsperfmon | stop-process

  start-sleep -s 2

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Gruber Beans

Posted by Grubersauce

AKA Oklahoma Joe's Best Beans on the Planet

Recipe courtesy of joedavidson.com

This is one of those recipes that really embody true BBQ. Simple is always best and this bean recipe has proven that for years.  Note: You’ll need cooked brisket for this recipe! It’s the secret ingredient that really makes these beans the best on the planet!

Ingredients:

2 - 15 oz cans of pork & beans
1 - 15 oz can of dark-red kidney beans
1 - 15 oz can of black beans
1 small red onion, diced
1 green bell pepper, diced
1 red bell pepper, diced
1 jalapeno pepper, seeds removed and diced
2 cups golden (light) brown sugar
18 oz of your favorite tomato-based barbecue sauce (I use Montgomery Inn )
1 lb chopped barbecued brisket (optional but recommended for best results)

Preparation:

* Preheat oven or grill to 350 degrees.
* Drain beans and mix with all the remaining ingredients in an aluminum-foil pan.
* Place the pan on a cookie sheet and cook at 350 degrees for 2 hours.
* Let stand 30 minutes before serving. nom nom nom

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 8/26/2009 at 2:07 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (7) | Post RSSRSS comment feed

It's been a while..

Posted by Grubersauce

 since my last post.  I have been busy, as you can see...

 









Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 8/21/2009 at 8:27 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (2) | Post RSSRSS comment feed

Big Brother in Westerville

Posted by Grubersauce
This isn't how I like to see my beloved hometown make headlines, not only in the Columbus Dispatch (in an article, here but also in the extremely popular blog over at BoingBoing.com. Frank Brusca, an Instructional Technologist at Otterbein College submitted this article to Cory Doctorow (who has been mentioned in several XKCD comics). Apprently, Westerville Police have asked banks and credit unions to post signs to ban people from wearing hoods, sunglasses, hats and to not use cellphones while at the bank. Sure, doesn't seem like too big of a deal, but what about when they start requiring fingerprint/retina scanning to get into the bank? And not just banks, but grocery stores, gas stations, anywhere there is cash on hand. We are slowly letting our civil liberties be etched away. At least it appears that none of the banks or credit unions have complied and put up the signs... yet.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 5/19/2009 at 8:17 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (7) | Post RSSRSS comment feed

MotherLover

Posted by Grubersauce
From the guys who brought you D*ck in a Box.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 5/11/2009 at 8:57 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (4) | Post RSSRSS comment feed