Friday, December 25, 2009

Vizio TV Remote Code for Samsung BDP 1590/1600 Blue Ray Player

The manual does not list a code for the Samsung BDP 1590/1600s remote so that it can control a Vizio TV. I found that the LG TV code worked for me:

Press and Hold the TV power button on the Samsung Remote. Press 1,9 (code 19). Release the power button. Your TV should shut off (or turn on based on whether it was on or off before you started this process). This means that you found the right code for your TV.

Only downside: the TV source button did not work for me. Yet, this is better than lugging around 2 remotes to watch a movie.

Next: Looking for the remote code to control the BlueRay player using my Comcast DVR remote. (any ideas any one?)

Thursday, December 24, 2009

Changing the SMTP server used by Team Foundation Server (TFS)

Go to the folder: [TFS_INSTALL_FOLDER]\Web Services\Services (typically this will be “C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services”)

Open up the web.config file and update the following to values under “appSettings”
<add key="smtpServer" value="smtp server address" />
<add key="emailNotificationFromAddress" value="from email address" />

Monday, December 21, 2009

Session state unavailable in Global.asax event Application_PostAcquireRequestState

Under some circumstances (typically application start up and shut down) I would get the following “Session state is not available in this context” error within the Global.asax event: “Application_PostAcquireRequestState” whenever I tried to access the Session object.

image

According to the documentation: “The PostAcquireRequestState event is raised after the AcquireRequestState event has occurred.” And the AcquireRequestState documentation states: “Occurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request.”

So I am not sure why the Session object was not available in the PostAcquireRequestStateMethod. The simple way around this issue is to wrap the access to Session state object in a try catch block and forget about it. But it bothered me, because I had the debugger set to break at all exceptions. So I wanted to find a better way.

And the better way is to wrap your access to the Session state object in the following if statement:

if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) {….}

Not sure exactly why the method gets called multiple times, but by making sure the ContextHandler needs the session state object, we can be sure that the session state object is available – as our access is from the PostAcquireRequestStateMethod event.

Reference:
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.acquirerequeststate.aspx
http://msdn.microsoft.com/en-us/library/system.web.httpapplication.postacquirerequeststate.aspx

Saturday, December 19, 2009

DenverGov.org 1999 – 2009 – An evolutionary tale

Yesterday, we released a new version of the City and County of Denver’s website. It is mainly a skinning change authored by our web-master (Chani Goering). (The site is also undergoing changes related to hardware as well as the technologies used by some of the applications hosted on the site).

At this point I thought it would be good to take a look at how DenverGov has evolved since 1999 (the earliest that I could find a historical archive for the website). It is a telling tale and clearly shows the major leap that yesterday’s update to the site made in to the Web2.0 age.

Here is a video of the presentation taking you on a tour from 1999 to 2009.

And here is the presentation as a GoogleDoc

Thursday, December 17, 2009

JQuery Print Plugin

Just found the Jquery print plugin “JQuery Print Element” by ErikZ – works great.

http://plugins.jquery.com/project/printElement

Demo: http://erikzaadi.github.com/jQueryPlugins/jQuery.printElement/Sample

Only thing that I had to change was the use of $ symbol in the JS code (as in my environment it conflicts with some other JS APIs that I use).

Saturday, December 12, 2009

Some Gmail features have failed to load due to an Internet connectivity

Google Chrome error: Some Gmail features have failed to load due to an Internet connectivity

The above error started happening since yesterday in Google Chrome whenever I tried to open an email. I found that clearing the browser history fixed it.

Click on Wrench Icon.
Click on Options.
Goto Personal Stuff tab.
Click on Clear browsing history, select everything and then Clear Browsing Data.

Shutdown Chrome and then restart it.

Thursday, December 10, 2009

CSS – Style Inheritance

I was wondering how I could get style inheritance so that I could derive new styles from an existing style.

Looks like that is not possible (please correct me if I am wrong).

But the next best thing is to realize that you can use multiple styles on an element. The style is applied left to right. This provides a behavior that would be similar to what inheritance would provide me.

example:

.style1 { color:red; }
.style2 { font-weight:bold; }

To apply them both on a DIV:
<div class=”style1 style2”>Hello World</div>

ASP.Net – Custom Validator – Setting the error message in client script

Question: How do you set the error message in the Client Validation Script.

Answer: If the client validation method is called CheckEntry, then your code would need to look like this:

<script type="text/javascript" language="javascript">
    function CheckEntry(sender, args) {
        ctrl1 = document.getElementById("<%=ctrlToValidate1.ClientID%>");
        ctrl2 = document.getElementById("<%=ctrlToValidate2.ClientID%>");

        if (isBlank(ctrl1 .value) && isBlank(ctrl1 .value)) {
                args.IsValid = false; 
                sender.errormessage = "Please provide atleast one search criteria"
                return;
            }
        }
        args.IsValid = true;
        return;
    }
    
    function isBlank(str) {
        str = ValidatorTrim(str);
        if (str == null || str.length < 1)
            return true;
        else
            return false;
    }
</script>

The error message is updated via the sender.errormessage property. The “ValidatorTrim” method is provided by a method from JavaScript that ASP.Net injects for you into the page whenever you use a validation control.

Simple and Easy!

ASP.Net - Custom Validator – Multiple Controls

In ASP.Net, when you use a CustomValidator, it is easy to make it validate one control. But how do you use it to validate multiple controls (for eg: you want to make sure that if the City field has been filled out then you want the State field to also be filled out).

You first create your custom validator. But you do not assign it a ControlToValidate. Instead you add the following code to your aspx/ascx file:

<script type="text/javascript">
<!--
    ValidatorHookupControlID("<%= ctrlToValidate1.ClientID %>",
     document.getElementById("<%= customValidationCtrl.ClientID %>"));
    ValidatorHookupControlID("<%= ctrlToValidate1.ClientID %>",
     document.getElementById("<%= customValidationCtrl.ClientID %>"));
    ValidatorHookupControlID("<%= ctrlToValidate1.ClientID %>",
     document.getElementById("<%= customValidationCtrl.ClientID %>"));
//-->
</script>

The “ValidatorHookupControlID” method used above, is automatically injected into the page for you by ASP.Net whenever you use a validation control in your page.

One thing that I found is that I needed to add the code to the end of an ascx control, or next to the end of the form tag in an aspx page. Otherwise it throws an annoying JavaScript error.

HTML – Nested tables – removing the space

If you have nested tables then you will notice that there is a space between the 2 tables.

Sample nested text
Sample Text

To fix this, all you need to do is set the cellspacing="0" cellpadding="0" for the 2 tables.

Sample nested text
Sample Text