Friday, September 28, 2007

Scrollable Table with fixed header using CSS

Scrollable Table with Fixed Header, repeat print header and ... This frozen / locked HTML table header is a usability advance done without HTML fakery such as hidden tables, frames, or JavaScript. Tested in (Windows) Mozilla-spawned browsers (incl. Netscape 6+ and Firefox) and IE5+. IE has problems with the screen behavior of the footer—but thanks to a clever expression provided by Renato Cherullo, even IE6 can have a modern footer. Mozilla self-induces display problems cramming the scrollbar into the last column, which can be corrected with advanced selector syntax. Surprisingly, both render the printed version of the table consistently well, including the repeated headers and footers. --------------------- Ever wanted to create a table to display data which head frozen headers and/or frozen footers like MS Excel allows? read this article to find out how. I have searched long and hard for a solution like this and now that I found such a simple one it is rather embarrassing that I didn't think of it myself.

using .resx files to localize asp.net web applications

How to use application resource files (.resx) to efficiently... You can use application resource files (.resx) to efficiently create a localizable Microsoft ASP.NET Web application. By using resource files, you can store localized values for controls. The localized values are based on a user’s language and culture. When you store localized values in resource files, ASP.NET can select the appropriate value at run time. ----------------------- This page describes how to create a localized resx file in Visual Studio.NET. essentially after the first resx default file is created you just copy it and insert an extension for the language code you are looking to support, make sure localization is turned on in your app and .net handles the rest.

Thursday, September 27, 2007

New method of hanging onto notes

I recently discovered Google's Bookmark feature which allows me to put a really cool javascript button on my toolbar. It isn't a complete replacement for the blog as it lacks easy access and search features, but as a basic and transportable bookmarking system it works really nice.

It's these extra little features that keep popping up that keep me with google.

SQL Where clauses: Avoid Case, use Boolean logic

SQL WHERE clauses: Avoid CASE, use Boolean logic As some of you may know, I recommend to avoid using CASE expressions in the WHERE clause of a query to express conditional logic. I prefer to have everything translated to simple ANDs, ORs and NOTs to keep things a) portable, b) easier to read and c) efficient. ------------ Apparently Coalesce() in the Where clause removes the queries ability to use an index for evaluating that column. Makes the code a tad bit messier but really good to know when to use boolean logic.

Tuesday, September 25, 2007

Download IE6 standalone dll's

dhtmldev.com - Standalone IE6 for Testing Most users still use Internet Explorer 6, while most developers have upgraded to ie7. So how do you test in ie6? Most people designate another machine as an ie6 box, and then turnoff automatic updates. Oops, it was upgraded by the new guy. Nice. Anyway, for one reason or another it would be sweet to run both ie6 and ie7 on the same computer. After a lot of googling "ie6 side by side install" and "ie standalone" etc., and reading a bunch of crap, I found a nice standalone version at browsers.evolt.org and a nice added dll from positioniseverything. So I zipped everything (link at bottom) and wrote these instructions. Enjoy!

Tuesday, September 18, 2007

Cast varchar to datetime

CodeGuru Forums - Convert a Varchar in a DateTime SELECT * FROM tab_val WHERE (CASE ISDATE(val) WHEN 1 THEN CAST(val As DateTime) ELSE NULL END) > CAST('2003-05-05 08:00:00.000' As DateTime) ------------------- When casting a varchar to a datetime it is critical that all the datetime pieces (such as minutes, seconds...) are in the string. Otherwise an error will be thrown.

Aspnet Membership Password manipulation

Brian Mishler on .Net - Asp.Net Membership Password Administ... The Asp.net membership provider was designed to allow for self-service password management but through an understanding of the configuration options as well as a combined use certain provider methods, web site administrators can effectively manage member passwords. This article briefly summarizes the various settings and methods which can be combined to administratively manage passwords in an Asp.Net membership system based on the default SQLMembershipProvider. ------------------ This article give a good summary of how to manipulate passwords in the aspnet membership framework, including retrieval which is what I needed this time.

Friday, September 14, 2007

Portable Software on USB

PortableApps.com - Portable software for USB drives | Your D...

Convenient

Now you can carry your favorite computer programs along with all of your bookmarks, settings, email and more with you. Use them on any Windows computer. All without leaving any personal data behind.

A very nice way of being able to carry some convenient pieces of software around on a USB drive for troubleshooting others systems.

Thursday, September 13, 2007

T-SQL Sproc timeout in .NET but not Management Studio

I recently had a rather odd problem which I have been unable to solve to my satisfaction so far.

Problem:
The problem involves stored procedures which are compiled and cached. When calling the sproc from a c#.net 2.0 web application the call would timeout; however I could capture the call in SQL Profiler, run it in Management Studio and it would run great in sub second times.

Solution:
The only solution I have found so far is to re-compile the sproc manually.
You could also try adding WITH RECOMPILE to the sproc and deal with the performance loss. This was suggested in a sqlteam thread:
A similar suggestion is on SQLServerCentral.com

After reading Ken Henderson's WebLog I am guessing that the cached plan is somehow getting corrupted and that running the code manually in Management Studio somehow uses a different cached plan. Perhaps plans are different for each user? Hopefully I can find and post a better solution.

Publish WebSite - precompiled

ASP.NET Deployment Tool

An avanced and robust Deployment Tool for precompiling your ASP.NET Websites! Pre-Compilation gives your site a performance boost and secures it. Precompile and deploy your Website for speed improvements and security, specific Error Panel, FTP Support, Deploy to Network, Merge Assemblies, easy to use.
----------------------------
A free addon type utility that can be used to precompile a .net website. Basically it compiles all the aspx and dll code into what the webserver typically does on first site access. The two benefits of this are: 1. no code aspx or cs is visible 2. website first load doesn't have any extra overhead downsides are: 1. the site has to be recompiled for any change 2. there are no relative paths anymore so moving the site or changing its directory could have disasterous results.
-----------------------------
http://msdn2.microsoft.com/en-us/library/1y1404zt(VS.80).aspx
Microsoft has a built-in tool which has almost as many features as this tool, the big difference is that theirs doesn't come with the free edition of visual studio.

Wednesday, September 12, 2007

asp.net - Display inline PDF on webpage

Embed PDFs into a Web Page with a Custom Control - The Code ... This article describes an approach to embedding and displaying PDF documents in a web page through the use of a simple ASP.NET 2.0 custom server control. The approach indicated herein allows the developer the opportunity to control the web page content surrounding the embedded PDF; this is in contrast to linking directly to a PDF which uses the entire web page to display PDF but does not otherwise permit the developer to control the appearance of the page.

-----------------------
Honestly I think that this approach is an error prone and overbloan method of creating an IFrame. A much simpler method of accomplishing what I needed in this instance is:
System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath(cPage.RedirectURL));

Response.Clear();
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/pdf";
Response.WriteFile(file.FullName);
Response.End();

Tuesday, September 11, 2007

Friday, September 7, 2007

CSS2 Reference

CSS2 Reference This page has a complete listing of all CSS properties and the values they can be set to. Very useful. It also has the well known and legendary w3schools.com name to add value to the content.

Left Join vs Left outer Join - Join vs Inner Join

Join vs Inner Join - dBforums Hi all, Can someone please describe whats the difference between: 1) Join vs Inner Join 2) Left join vs Left Outer Join TIA Falik ------------ According to this thread, the words Inner and Outer are optional in the Join syntax. This is something that wasn't ever really clear to me before so it is good to have it cleared up. The shorter code the better so I will happily stop using the non required words.