Codeine .Net RSS 2.0
# Sunday, 11 March 2007

Well I realize that I have fallen extremely far behind and have not finished my tutorial on putting together y DVR setup.  Hopefully I will get to it someday, but now that the steps are no longer fresh in my head it may not happen until I need to build a new box.  If you do have any questions feel free to post a comment and I’ll help you out the best I can.

What I will post about are the steps I need to take to update my box for the new DST settings.  (I hope the energy savings from the change makes up for the pain in that it has been, and the old electronic equipment I have that will now always be off.)

First off check to see what your system is currently set to:

#zdump -v /etc/localtime | grep 2007

Using this command from root will provide you with the dates your system has set for daylight savings time.  If it isn’t set to start in March then continue.

Go to the home directory for root, use ‘cd $HOME’ if you are still logged in as root and download the patch:

#wget http://debian.oregonstate.edu/debian/pool/main/t/tzdata/tzdata_2007b-1_all.deb

Now you just need to install the patch.:

#dpkg --install tzdata_2007b-1_all.deb

Finally, if you run the check again:

#zdump -v /etc/localtime | grep 2007

You should get the following output:

Sun Mar 11 07:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 CST isdst=0 gmtoff=-21600

/etc/localtime  Sun Mar 11 08:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 CDT isdst=1 gmtoff=-18000

/etc/localtime  Sun Nov  4 06:59:59 2007 UTC = Sun Nov  4 01:59:59 2007 CDT isdst=1 gmtoff=-18000

/etc/localtime  Sun Nov  4 07:00:00 2007 UTC = Sun Nov  4 01:00:00 2007 CST isdst=0 gmtoff=-21600

If only it was as easy to do with all my other equipment.  Specially thanks to everyone at the KnoppMyth Forums for posting the information on this.

Sunday, 11 March 2007 06:00:00 (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
Original Posts
# Sunday, 07 January 2007

    Well, the guy who has taught me everything I know about .NET, Bigyan, has taken off for a month to go back to Nepal to get married, leaving me with some very big shoes to fill while he is gone.  While he is gone I have adopted a new philosophy that I am trying to follow, WWBD, What Would Bigyan Do?
    While working on some bug fixes for a web application that we currently have in pilot testing for a client, I found myself working hard trying to prevent a post back, which I knew is exactly what Bigyan would do to increase the quality of the user experience.  I needed to create a custom validator in ASP.NET and could have easily just made it a server side validation, but this would require a post back before telling the user that there was an input error.  The way to eliminate this post back is to create a client side validation function using  JavaScript.
    This first thing that is necessary is to add a CustomValidator control to your page and to associate it to a control on the page by setting the ControlToValidate property. 
    Next, I would typically set the text of the CustomValidator control to an *.   This is the text that shows up on the page where the custom validator exists.  I normally position the CustomValidator either next to the control I am validating or next to the label for the control I am validating.  The * then indicates to the user that there is an error with that field. 
    Following setting the text I set the ErrorMessage property of the CustomValidator to the error message I want to display.  This message will then appear in the validation summary control if you have placed one on the page.
    Now its time to do a little coding.  First thing you will want to do is code up the server side validation for the validator.  This part of the validation is important in case the user's browser doesn't support JavaScript or the user attempts to bypass the script on the client side.
    In my particular case I was validating a rich textbox control that was required.  In my particular case the control would be blank either if it was actually blank or if it had "<p>&nbsp</p>", hence I could not just use the RequiredFieldValidator.  To code the server side check you use the ServerValidate event of the CustomValidator control and check the value property of the args objects that is passed in by the system.  Perform your logic and if the value passes set args.IsValid = True, otherwise set it to False. 

Protected Sub CustomValidator1_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

            If String.IsNullOrEmpty(args.Value) Or args.Value = "<p>&nbsp;</p>" Then
                args.IsValid = False
            Else
                args.IsValid = True
            End If


        End Sub

   


   This function will then execute when a button that has its CausesValidation property set equal to true is clicked.  Then, at any point in time if you want to check if all the validators on a page are valid you check if Page.IsValid is equal to true.

            That’s it for handling the server side validation, but the next step is to handle the client side validation so that the client is not forced to look at a post back before knowing that they have an invalid input field.

            To handle the client side validation you just need to write a simple JavaScript function that takes two parameters, sender and args.  You can then evaluate args.Value against your logic, and set args.IsValid equal to either true or false.

           

  function TxtQuestionValidate(sender, args)

   {

     if (args.Value == '' || args.Value == '<p>&nbsp;</p>')

         {

            args.IsValid = false;

         }

              else

         {

            args.IsValid = true;

         }

    }

 

 

 

You have a couple options for placing the javascript function.  The simple way would be just to put it right into the .ascx page.  Whereas this is easy, I try to steer away from this as you would then need to place this function in every page where you need it.  I prefer to write a service layer function that returns it to me as a string and then insert it into the page on the page load event as follows:

 

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "TxtQuestionValidate", Services.GeneralService.GetTxtBoxValidateJavascript(), True)

 

            Finally, you need to tell Studio to use this function as the client side script so on your custom validation control simple set the ClientValidationFunction to the name of your JavaScript function.  You now have a custom validation with a client side script to prevent a post back, which I am pretty sure is what Bigyan would do.  I hope he’s having a good time in Nepal, but I’ll be happy to have him back in 25 days.  Its boring going to Starbucks by myself!

           

 

Sunday, 07 January 2007 07:00:00 (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
Original Posts
# Friday, 05 January 2007

     Well, I've been slacking on getting the next blog post out on the steps I used to build my DVR.  I will hopefully get time to post the next steps soon, but for now I just wanted to post an updated on my hardware setup.  Like I had posted earlier, I been wanting to increase the memory in the computer.  It started out with 512MB which was working fine, but I am sure the system would suffer if I was recording two shows and watching a recording.  I went ahead and added 1GB more of memory, giving me a total of 1.5GB.  I didn't do any specific benchmark testing, but the picture did seem to look a little better.  I really wanted this memory boost for when I add an HD tuner card to the system, which I hope to do in the next couple months.
     The other thing I added was another fan to the system.  I have been experience system lockups about every 2 to 3 weeks and I think it is because the system is overheating.  The box lives on the bottom shelf of a wood entertainment stand so I have a feeling the heat is building up in the enclosed space.  I hope this extra fan with resolve the issue.
     That's about it for now.  For those of you keeping track of the total investment so far that I have put into the system, the fan was $2.99 and the memory was $89.99.  I got both from Newegg.com and including shipping they came to $99.27.  Hopefully I'll have time to get the next few DVR steps up soon.

Friday, 05 January 2007 07:00:00 (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
Original Posts

Navigation
Archive
<2007 March>
SunMonTueWedThuFriSat
25262728123
45678910
11121314151617
18192021222324
25262728293031
1234567
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2024
David A. Osborn
Sign In
Statistics
Total Posts: 70
This Year: 0
This Month: 0
This Week: 0
Comments: 33
Themes
Pick a theme:
All Content © 2024, David A. Osborn
DasBlog theme 'Business' created by Christoph De Baene (delarou)