Tuesday, December 23, 2008
.Net Resource Files
Resource files in .Net will allow you to create customized values for either different languages or if you are using an the same app for multiple people on different servers, you can store things like titles, names, and other specific version info that you don't want to hard code.
You can store the resource file (resx) in either the App_GlobalResources or the App_LocalResources folder depending on the scope of the resource.
The values in the resource file are stored as XML as key/value pairs. Pretty easy stuff, and you can store pictures, text, icons, or audio...anything really in here.
To get things out of the resource file you can either bind it to a label (or any other bindable control)
<asp:label id="label1" text="'<%$resources:ClassName,Property">' runat="Server" />
Where ClassName is the name of the resource file without the .resx extension on it, and Property is the key.
Or if you wan to access the key value pair programmatically you can access a global resource by using this
HttpContext.GetGlobalResourceObject("ClassName", "Property")or you can access a local resource by using
HttpContext.GetLocalResourceObject("virpath", "Property")where you pass in the virtual path of the local resource object.
I used
these two articles as reference
Labels: .NET
posted by Tom Becker at
|

Tuesday, December 16, 2008
Visual Studio Tips: Task List Comments
I don't know about a lot of you but when I code sometimes I will leave this on a page to come back and do later, or I have some hack that I am using temporarily that I am going to need to come back and change. I am a bit scatter brained and sometimes I forget to come back and fix these.
That is why when I'm working through these I leave myself notes, in the Visual Studio task list. You can manually type things in there or you get things in there directly from your code comments by using comment tokens.
There are a few built in (TODO, HACK, and UNDONE) that I use all the time, but you can
add your own, or just use the built in ones by just adding the prefix in front of your comment. ex:
'TODO: find more elegant solution
'HACK: hardcoded
These will show up for you to come back to in your task list so you don't have to go searching around double click the task and away you go. A big time saver.
Labels: Visual Studio
posted by Tom Becker at
|

Deciphering IE Release Numbers
So I am researching a very weird issue for my app. And it led me to having to decipher
IE release numbers.
So my release (or version) number is: 6.0.2900.2180.xpsp_sp2_gdr.080814-1233. I'll break it down bit by bit.
- 6.0.2900.2180 is the build number, check here for a full list.
- xpsp_sp2_gdr stands for Windows XP sp2, and not to sure what the gdr stands for, and can't really find a good answer out in the internet
- 080814 is August 14, 2008, so it is YYMMDD date format (the part i was interested in)
- 1233 is a mystery to me, much like the gdr.
So that's the release version. Some parts are unknown to me, but at least I know a little bit more and it helped me figure out my user's error.
Labels: IE, Microsoft
posted by Tom Becker at
|

Wednesday, December 3, 2008
Max versus Greatest in Oracle
So I was trying to figure out the greatest of three dates in oracle. They were coming from 3 different columns across three different tables. So I figured I could do something like the following
SELECT MAX(A.date, B.date, C.date) FROM. . .etc
But apparently that doesn't work. The max function will not work across multiple columns. That's when I learned about the greatest function. Does the same thing as max, but lets you do it across multiple columns. The above query became
SELECT GREATEST(A.date, B.date, C.date) FROM . . .etc.
So, Max = one column, Greatest = multiple columns.
Labels: Oracle
posted by Tom Becker at
|

Tuesday, December 2, 2008
Theming with SkinID
A month or so ago I made a post about
theming in .Net, and towards the end of it I said that sometimes on a page you may need to override the theme and create your own style and the example I gave was of a button having a specific style different from the rest.
What I left out of that post (and I actually spent the morning updating my code to reflect this) were SkinIDs. Inside of a skin file you can have multiple definitions for a single control. One of these will be set as default and the rest will be given a SkinID to denote it at the page level. So in my example with the button
<asp:Button ID="btnClear" Text="Clear" EnableTheming="False" CssClass="Button Clearbtn btn100"
CausesValidation="False" runat="Server" />
Would change to
<asp:Button ID="btnClear" Text="Clear" SkinID="ClearButton" CausesValidation="False" runat="Server" />
And I would have in my Skin file the following line.
<asp:button cssClass="Button Clearbtn btn100" SkinID="ClearButton" runat="Server"/>
One of the nicest things about this is all of your skinIDs will show up on your aspx pages, so Intellesence picks up your IDs so you don't have to remember all of them. It also cleans up the code a bit and you don't have so much repetition.
Labels: .NET
posted by Tom Becker at
|
