Tuesday, August 14, 2007

What is HanselMinutes?

Hanselminutes

What is Hanselminutes?

Hanselminutes is a weekly audio talk show with noted web developer and technologist Scott Hanselman and hosted by Carl Franklin. Scott discusses utilities and tools, gives practical how-to advice, and discusses ASP.NET or Windows issues and workarounds.

Monday, August 13, 2007

how to untar/tar

To get the files out of a tarball, you can use the following commands:

tar xvf something.tar

If the tarball has also been gzipped (compressed), you can use the following command:

tar xvfz something.tar.gz



The biggest thing that I always forget when trying to use this command is that it doesn't accept the "-" prefix before its modifiers like most other linux commands.

If you need to create a tar file
http://infohost.nmt.edu/tcc/help/unix/tar_build.html
tar -cvzf name.tgz subdir
the 'z' is optional and gzips the file.
the 'v' is optional and gives a verbose output.

Wednesday, August 8, 2007

The ASP.NET Page lifecycle

15 Seconds : The ASP.NET Page Life Cycle When a page request is sent to the Web server, whether through a submission or location change, the page is run through a series of events during its creation and disposal. When we try to build ASP.NET pages and this execution cycle is not taken into account, we can cause a lot of headaches for ourselves. However, when used and manipulated correctly, a page's execution cycle can be an effective and powerful tool. Many developers are realizing that understanding what happens and when it happens is crucial to effectively writing ASP.NET pages or user controls. So let's examine in detail the ten events of an ASP.NET page, from creation to disposal. We will also see how to tap into these events to implant our own custom code. The events that get fired are: 1. Object Initialization 2. Load Viewstate Data 3. LoadPostData Processes Postback Data 4. Object Load 5. Raise PostBack Change Events 6. Process Client-Side PostBack Event 7. Prerender the Objects 8. ViewState Saved 9. Render To HTML 10. Disposal



Excerpt from another page I found helpful:
http://msdn2.microsoft.com/en-us/library/ms972976.aspx
So, dynamically added controls must be programmatically added to the Web page on each and every page visit. The best time to add these controls is during the initialization stage of the page life cycle, which occurs before the load view state stage. That is, we want to have the control hierarchy complete before the load view state stage arrives. For this reason, it is best to create an event handler for the Page class's Init event in your code-behind class, and add your dynamic controls there.
Note You may be able to get away with loading your controls in the Page_Load event handler and maintaining the view state properly. It all depends on whether or not you are setting any properties of the dynamically loaded controls programmatically and, if so, when you're doing it relative to the Controls.Add(dynamicControl) line. A thorough discussion of this is a bit beyond the scope of this article, but the reason it may work is because the Controls property's Add() method recursively loads the parent's view state into its children, even though the load view state stage has passed.
Shortcut Summary:
1. Object Initialization
2. Load Viewstate Data (void LoadViewState( object o ) )
3. LoadPostData Processes Postback Data
4. Object Load (void onload(EventArgs e) )
5. Raise PostBack Change Events
6. Process Client-Side PostBack Event (void RaisePostBackEvent (string eventArgument) )
7. Prerender the Objects
8. ViewState Saved (void RaisePostDataChangeEvent() )
9. Render To HTML
10. Disposal (void OnPreRender( EventArgs e ) )

Tuesday, August 7, 2007

CAST and CONVERT (T-SQL) - datetime syntax

Without
century
(yy)
With
century
(yyyy)


Standard


Input/Output**
- 0 or 100 (*) Default mon dd yyyy hh:miAM (or PM)
1 101 USA mm/dd/yy
2 102 ANSI yy.mm.dd
3 103 British/French dd/mm/yy
4 104 German dd.mm.yy
5 105 Italian dd-mm-yy
6 106 - dd mon yy
7 107 - mon dd, yy
8 108 - hh:mm:ss
- 9 or 109 (*) Default + milliseconds mon dd yyyy hh:mi:ss:mmmAM (or PM)
10 110 USA mm-dd-yy
11 111 JAPAN yy/mm/dd
12 112 ISO yymmdd
- 13 or 113 (*) Europe default + milliseconds dd mon yyyy hh:mm:ss:mmm(24h)
14 114 - hh:mi:ss:mmm(24h)
- 20 or 120 (*) ODBC canonical yyyy-mm-dd hh:mi:ss(24h)
- 21 or 121 (*) ODBC canonical (with milliseconds) yyyy-mm-dd hh:mi:ss.mmm(24h)
* The default values (style 0 or 100, 9 or 109, 13 or 113, 20 or 120, and 21 or 121) always return the century (yyyy).

** Input when converting to datetime; Output when converting to character data.

CONVERT (data_type[(length)], expression [, style])

Monday, August 6, 2007

Javascript shorthand if statement syntax

Javascript Short-Hand IF Within Object Notation : Kinky Solu... var myVar = ( intDayOfWeek == 6 ) ? 3 : 0; Just a quick reminder for myself on how the short hand if statement syntax works for languages like php, javascript, and c#.

Wednesday, August 1, 2007

Password Reveal

A good little password finding utility that works on WinXP. It works by revealing the *****'d text that typically hides the text in a password field. This is not a password cracker.

Warning: It does try and connect to the internet when run for some unknown reason.