... all I'm offering is the truth. Nothing more. RSS 2.0
# Friday, March 23, 2007

I generally only blog and comment on stuff I am directly working but Don passed on this fantastic article that really brings the whole JSON vs XML into High Definition.

Currently all my work involves XML, we have not made the jump to AJAX in the banking world, and while I am sure that will change in the not to distant future, it appears that JSON really provides the light weight alternative. Unfortunately I can see this coming down to whatever Microsoft will decide to back.

People like me want mature IDE's and rich well supported tool set, so I will invariably go with the flow!

"Responsibility is the price of freedom." - Elbert Hubbard

Technorati tags: ,
Friday, March 23, 2007 4:58:45 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Programming
# Friday, March 16, 2007

I have been thinking about the detailed plumbing of calling an ASP.NET web page lately due to some weird things that have happened at work. So I thought it wise to refresh myself and my five two faithful readers about what actually goes into displaying a page. 

I briefly described the HTTP traverse from browser to server, and will not delve in at that level. However, when a page request is sent to the Web server it is cycles through a series of events during its creation and disposal. Being able to understand the events (and the order) is critical for any potential ASP.NET developer. Everyone knows we start with an aspx page and end up with a beautifully rendered HTML page, however, we need to know what happens in between.

1. Object Initialization
Controls on a given page are initialized, by declaring the objects in the constructor of the C# code-behind file. If objects are created from within the aspx file they have no attributes or properties available in the code-behind and there is no reliable way to verify the order the controls will be created or if they will be created at all. The initialization event can be overridden using the OnInit method.

2. Load Viewstate Data
After the Init event, controls can be referenced using their IDs only. During LoadViewState event, the initialized controls receive their first properties from the viewstate information (handled by ASP.NET) that was persisted back to the server on the last submission. The event is overridden using the LoadViewState method and is used to modify the data received by the control.

3. LoadPostData, Processes Postback Data
When a page submits a form, the framework will implement the IPostBackDataHandler interface on each control that updated its data. The page then triggers the LoadPostData event and goes through the page to find each control that implements the applied interface and updates the control state with the correct postback data. ASP.NET checks each control by verifying the control's unique ID with the stored name/value pair.

4. Object Load
All object are arranged in the Control Tree (formerly known as the DOM) and can be referenced easily in code. Objects are now at liberty to apply the client-side properties set in the HTML, such as height, visibility, etc. This is generally considered the hardest working event in the process. This event can be overridden by calling OnLoad.

5. Raise PostBack Change Events
This event occurs immediately after all controls that implement the IPostBackDataHandler interface have been updated with the current postback data. This operation flags each control with a true\false based on if it was changed since the last post. ASP.NET looks for this flag and raises RaisePostDataChanged event.

6. Process Client-Side PostBack Event
The object which initiated the postback is handled by the RaisePostBackEvent event. The object is usually a control that posted the page back to the server (autopostback) or a submit from a button. The RaisePostBackEvent is last in the series of postbacks.

7. Prerender the Objects
This event is a critical one, as it marks the last chance the developer has to make any persistable changes to the objects. Immediately after the PreRender event changes to objects are locked and can no longer be saved to the viewstate. This event can be overridden using OnPreRender.

8. ViewState Saved
The viewstate is saved after all changes to the page have finalized. At the SaveViewState event, values can be saved to the ViewState object, but changes to page controls are not persisted.

9. Render To HTML
During the Render event, the page coerces each object into rendering itself into HTML. The page collects the HTML for transport to the client browser. When the Render event is overridden, the developer can write their own HTML to the browser that will actually override the HTML gathered by the page. The Render method uses the HtmlTextWriter to create HTML that will be streamed to the client browser. Changes can still technically be made here, but they will only show up at client browser.

10. Disposal
The Dispose event is the opportunity to destroy any objects or references you have created during the creation of the page.

Phew that is a lot of steps ... Monorail anyone. I think at some point I should also go over HTTPModules and HTTPHandlers. They provide really slick ways of jumping in the middle of a page cycle without necessarily touching every page! During the MCP test I noticed they really flogged the server and user control horse to death. It is a wonder to me that HTTPModules\Handlers were not covered with equal passion.

"Nothing contributes so much to tranquilizing the mind as a steady purpose - a point on which the soul may fix its intellectual eye." - Mary Shelley

Friday, March 16, 2007 4:57:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
ASP.NET

I do not have as much time as I would like to read all the great technical blogs out there so I have really pulled mine back to what I consider to be the real essentials.

I am really getting into Tess she is a troubleshooting extraordinaire. Really has the CSI thing going, I think she maybe closer to Columbo as she seems to know the answer before she starts! She stopped blogging for a while but has come back swinging. Also seriously consider Dare Obasanjo, he covers a wide range of topics and is not afraid to share his point of view regardless of whether it is for or against his Dark Overlord. Attwood is a very good writer if only a little "preachy". Hanselman remains the gold standard, however, I get the impression from his Hanselminutes podcast's that he is running out of things to talk about ... board games ... honestly!

<opml version="1.1">
<head>
    <title>Feeds</title>
</head>
<body>
    <outline text="Tech">
    <outline text="BCLTeam's WebLog" xmlUrl="http://blogs.msdn.com/bclteam/rss.xml" type="rss"/>
    <outline text="Brad Abrams" xmlUrl="http://blogs.msdn.com/brada/rss.xml" type="rss"/>
    <outline text="Coding Horror" xmlUrl="http://www.codinghorror.com/blog/index.xml" type="rss"/>
    <outline text="ComputerZen.com" xmlUrl="http://feeds.feedburner.com/ScottHanselman" type="rss"/>
    <outline text="Dare Obasanjo" xmlUrl="http://feeds.feedburner.com/Carnage4Life" type="rss"/>
    <outline text="greg hughes.NET" xmlUrl="http://www.greghughes.net/rant/SyndicationService.asmx/GetRss" type="rss"/>
    <outline text="If broken it is, fix it you should" xmlUrl="http://blogs.msdn.com/tess/rss.xml" type="rss"/>
    <outline text="Kim Cameron's Identity Weblog" xmlUrl="http://www.identityblog.com/?feed=rss2" type="rss"/>
    <outline text="Larkware News" xmlUrl="http://www.larkware.com/larkware2.xml" type="rss"/>
    <outline text="Mike Taulty's Weblog" xmlUrl="http://mtaulty.com/blog/Rss.aspx" type="rss"/>
    <outline text="Nikhil Kothari's Weblog" xmlUrl="http://www.nikhilk.net/Rss.ashx" type="rss"/>
    <outline text="Roy Osherove's Blog" xmlUrl="http://feeds.feedburner.com/Iserializable" type="rss"/>
    <outline text="ScottGu's Blog" xmlUrl="http://weblogs.asp.net/scottgu/Rss.aspx" type="rss"/>
    <outline text="shahine.com/omar/" xmlUrl="http://feeds.feedburner.com/omarshahine" type="rss"/>
    <outline text="Slashdot" xmlUrl="http://rss.slashdot.org/Slashdot/slashdot" type="rss"/>
    <outline text="The PowerShell Guy" xmlUrl="http://thepowershellguy.com/blogs/posh/rss.aspx" type="rss"/>
    <outline text="Welcome to The Metaverse" xmlUrl="http://blogs.msdn.com/richardt/rss.xml" type="rss"/>
    <outline text="you've been HAACKED" xmlUrl="http://haacked.com/rss.aspx" type="rss"/>
    </outline>
</body>
</opml>

You can copy this list into an OPML file and import it into your own favorite feed reader.

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters." - Margaret Halsey

Technorati tags: , ,

Friday, March 16, 2007 4:56:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Blog
# Tuesday, March 13, 2007

Within 24 hours I had two separate conversations about PC crashes that resulted in the loss of nearly all data. This got me frightened, and realized that I have not completed a legitimate backup of my system since I upgraded my PC's hard drive.

For a quick and dirty solution all I actually needed was to backup my digital music files so that I could recover from a catastrophic hardware failure. As I had no money in the budget I decided to rely on the XP's Backup Utility.

 

 

Now with XP Home Edition this is not installed by default and will have to be updated manually. You do this by going to D:\VALUEADD\MSFT\NTBACKUP on the XP Home CD and installing the NTBACKUP.MSI. XP Professional will have this installed by default.

I did not use the Wizard but the Advanced Option is pretty straight forward. Select the folders that you want to backup and/or the System State and away you go! To backup my critical files, which include a metric crap load of wave files (and excluded system state), took an 1 hour 48 minutes. At almost 14 gb of information that was not bad at all.

 

 

 

If you are so inclined this application can be set up from the command line, but I did not have the time to get into that ... the sky was falling for me!

The biggest drawback for this solution is that I could find no way to make the backup file conveniently sized for burning to CD, however, as I have an  additional drive connected this was no big hassle for me.

Backup Utility also gives you the opportunity to Append or replace the backups, and also provides the ability to execute Incremental and Differential backups.

There remains no excuse for anyone out there to lose critical data! Unless you have the resources for a RAID configuration you may want to consider this stop gap solution!

"Adversity is the trial of principle. Without it a man hardly knows whether he is honest or not." - Henry Fielding

Technorati tags: ,
Tuesday, March 13, 2007 4:54:05 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Tools | Windows | XP
# Wednesday, March 07, 2007

I have been using ieHTTPHeaders recently as my HTTP sniffer of choice, it installs as an explorer tool bar for Microsoft Internet Explorer bar.

 

 

I find it necessary to explain the very basics of HTTP for some reason, it struck me that there are probably many developers who have added a button and a text box to a ASP.NET page without really thinking about the plumbing between the browser and the web server. While these additional layers are designed for ease of use and rapid application development, I do fear the collective is being dumbed down ... so ...

 

HTTP is a request/response protocol between clients and servers. An HTTP client initiates a request by establishing TCP connection to a  port on a web server (port 80 by default). A HTTP server (e.g. IIS) listens for these afore mentioned requests message on the selected port.

Upon receiving the request, the server will send back a status line e.g "HTTP/1.1 200 OK", and a message of its own, the body could be the the requested file or some other information. Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs/URLs) using the http: or https URI schemes.

The request message from the above, requests a JavaServer Page from the /scores directory as follows:
GET /scores/SimpleScoreboard.jsp HTTP/1.1

 

"Knowledge is the life of the mind." - Abu Bakr

Wednesday, March 07, 2007 5:49:04 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
IE | Tools
# Tuesday, March 06, 2007

My "Field Museum, Chicago!" posting was originally to be entitled the "Soup Nazi" after the famous Seinfeld episode. However, when I clicked the Publish button I was confronted with the following message.

 

My item contains profanity? I never use profanity ... ever. I realized after a while that in fact the word "Nazi" itself was considered profane. In fact while you can create a blog with the "N word" in it you are not permitted to put the "N" word in the title.

I completely understand why we would not want someone insane Neo Nazis to be blogging hate speech with tools created by Microsoft, I am just curious about all the words that are on the black list ... or maybe I should not ask too many questions just in case...

GEORGE: "I didn't get any bread."
JERRY: "Just forget it. Let it go."
GEORGE: "Um, excuse me, I, I think you forgot my bread."
SOUP NAZI: "Bread two dollars extra."
GEORGE: "Two dollars? But everyone in front of me got free bread."
SOUP NAZI: "You want bread?"
GEORGE: "Yes, please."
SOUP NAZI: "Three dollars!"
GEORGE: "What?"
SOUP NAZI: "No Soup for you!"

"Those who flee temptation generally leave a forwarding address." - Lane Olinghouse

Tuesday, March 06, 2007 5:47:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Tools
Blogroll
Statistics
Total Posts: 330
This Year: 18
This Month: 2
This Week: 0
Comments: 30
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 2010
Mark Downie
Sign In
All Content © 2010, Mark Downie
DasBlog theme 'Business' created by Christoph De Baene (delarou)