Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Friday, June 02, 2006

..this is something work looking into if you do high-end network stuff.

The basic concept behind this networking pack is that it enables NetDMA (DMA = Direct Memory Access) for network-aware applications - meaning they can access packet information in a shared ring buffer allocated by the network stack itself, software which works with NICs supporting a TOE (TCP Offload Engine) which effectively differs processing and storing of TCP-related bits on the NIC itself (which offloads work from the CPU), and a Receive-side performance scaler which works to evenly spread the load of processing network traffic across multiple processors.


kick it on DotNetKicks.com
Friday, June 02, 2006 5:56:59 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

A friend of mine asked me today how to set the images for each node in an ASP.net treeview control. It's quite simple, actually:

Dim root As New TreeNode()
root.Text = "root"
root.Value = "root"
root.ImageUrl = "http://www.google.com/intl/en/images/logo.gif"

Dim child As New TreeNode()
child.Text = "child"
child.Value = "value"
child.ImageUrl = "http://www.google.com/intl/en_ALL/images/images_hp.gif"
root.ChildNodes.Add(child)

Me.TreeView1.Nodes.Add(root)

This basically generates a treeview where each node has a seperate icon.
kick it on DotNetKicks.com
Friday, June 02, 2006 12:44:59 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

Busier than heck. I hope you understand!


kick it on DotNetKicks.com
Friday, June 02, 2006 12:40:59 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback

 Tuesday, May 23, 2006

So I have this friend named Brendan Goble who is 1) very smart and, 2) very persistent. The other day he and I were talking about odd facts and figures and he wrote me the following bit of text (posted with his permission) kind of poking fun at Ricketts. Have fun reading:

"Alaska's Arctic National Wildlife Reserve (ANWR), which contains enough estimated crude oil to replace approximately 50 years of oil imports from Saudi Arabia."
 
I did some checking to find out how he [Ricketts] could have come up with 50 years. From the Energy Information Administration which has the official energy statistics from the US government, I found out that we got 556 million barrels of oil from Saudi Arabia last year. I then looked around for estimates of the amount of oil in ANWR. There are multiple estimates and each estimate has a lower bound and an upper bound. The only way I could get 50 years was to look at just the upper bounds and take the largest upper bound of all the studies which gave me 29.4 billion barrels. This was from a study in 1987. Not only is this the largest upper bound, but it is an estimate of how much oil exists, not how much we can actually recover.
 
For amusement, I did exactly what Ricketts did, except in reverse. I took the smallest lower bound of recoverable oil. That gives an estimate of ...1 year.
 
The most recent estimates of recoverable oil were actually released by the current administration. They are 4.3 billion to 11.8 billion barrels with a 7.7 billion barrel most likely mean. This works out to 7.7 to 21.2 years with 13.8 years for the mean. These estimates are for technically recoverable oil (we have the technology to get it), not economically recoverable oil (is it worth getting). And by the way, Saudi Arabia only accounts for 11.3% of our imports. That's imports, not total consumption. We actually get more oil from Canada (and Mexico), but I guess Canadians don't produce quite the same gut reaction.
 
[...]
 
After watching his TV ads and reading his website, I'm reminded of the saying: "you don't want to see what goes into making a sausage". I can see how he tries to manipulate the voters and it's disgusting. Unfortunately, I think he might succeed. A lot of people just won't notice."

Source: Brendan Goble

Addendum: One correction though is that I said the latest figures were from the current administration. I think the numbers were actually released in 1998 while Clinton was president, but they have been cited by the current administration.


kick it on DotNetKicks.com
Tuesday, May 23, 2006 12:18:16 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Ranting
 Sunday, May 21, 2006

....which is now public, from here.


kick it on DotNetKicks.com
Sunday, May 21, 2006 10:34:15 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

A friend of mine and I are buying supplies for brewing beer at his house - if anyone has any experience with this, let me know. Thanks!


kick it on DotNetKicks.com
Sunday, May 21, 2006 11:09:27 AM (Central Standard Time, UTC-06:00)  #    Comments [1] - Trackback
Personal Adventures
 Monday, May 15, 2006

I'm going to continue digging into the UpdatePanel control since the last post I made on this subject, so if you haven't read it, I would recommend doing so first...

The UpdatePanel is a wonderful utility for quickly taking a non-Atlas'ized ASP.Net website and Atlas'izing it, as it empowers you to simply surround traditional controls with <atlas:UpdatePanel> tags to enable them for partial postbacks. However, UpdatePanels can be somewhat misleading too: most people fail to realize (at least I did at first) that the UpdatPanel itself does not post back to the server, instead it is updated on the client using clever DHTML tricks (all controls within an UpdatePanel are surrounded, on the client, by either a span or div tag which is easily identified and whose children are easily over-written and modified). What actually posts back to the server is the PageRequestManager control script which is aided by the dealings of the ScriptManager control on the server. This simple fact - that the UpdatePanel doesn't post back - is important to realize, especially when one begins to think in terms of setting up triggers to update the content of the UpdatePanel. It becomes more of a mindset shift, really...but one that's important to make....let me explain...

Triggers are client-side controls that give developers the ability to say, basically, "I want the content of the UpdatePanel to refresh when such-n-such happens". Out of the box, Atlas comes with two types of triggers: a ControlEventTrigger and a ControlValueTrigger, which "trigger" the update of the UpdatePanel when either a clientside event occurs (button click, etc.) or value changes (text box content) respectively. Asigning triggers to an UpdatePanel is simple and is done like the following:

            <atlas:UpdatePanel runat="server" ID="UpdatePanel3" Mode="Conditional">
                <Triggers>
                    <atlas:ControlEventTrigger ControlID="btnTrigger" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                    <asp:Label runat="server" ID="lblTime2" /><br />
                </ContentTemplate>
            </atlas:UpdatePanel>

...Note the <Triggers></Triggers> tags and the encapsulated instance of the <atlas:ControlEventTrigger>. Again, what this says to the Atlas runtime is that when the control btnTrigger is Click'd that the UpdatePanel ought to have its controls refreshed. Since the <Triggers> control exists "within" the UpdatePanel control (parent/child relationship in the XML), you can see how one would think the UpdatePanel is responsible for doing all clientside postbacks. The result of thinking this way would lead you to think you could simply point to any control you wanted and hook any event you wanted and the UpdatePanel will blindly post back for you, updating the content. The truth is, however, that the UpdatePanel relies on other controls to start the postback sequence in motion; this postback sequence gets "intercepted" by the Atlas clientside framework and re-submitted as a specially formatted postback (for the Atlas serverside framework to deal with). So, let me reiterate this fact: the control that has the trigger attached must initiate the postback!

Why is this important? If the control doesn't start a postback on its own then 1) the browser won't try to postback, 2) the clientside framework won't intercept the postback event, and 3) the framework won't be able to re-submit the post as a partial one and allow the serverside framework to take over, and so forth. As programmatic proof, take a gander at this XML Script statement declaring the PageRequestManager on a page with UpdatePanels and triggers for those panels:

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
  <components>
    <pageRequestManager id="_PageRequestManager" updatePanelIDs="Panel1,Panel2,Panel3" asyncPostbackControlIDs="AsyncPostBackButton,Panel3bButton" scriptManagerID="TheScriptManager" form="form1" />
  </components>
</page></script> 

Note the instance of the _PageRequestManager object of type pageRequestManager above between the <components> tags. It has a property, asyncPostbackControlIDs, whose value is a comma-delimited array of control names who, you guessed it, have triggers assigned to them from within UpdatePanels. When an event that triggers a postback is fired on the page, it goes through the follow method at one point in the client code base:

this._doPostBack = function(eventTarget, eventArgument) {
   ...
   _postbackSettings = null;
   var postbackElement = findNearestElement(eventTarget);
   if (postbackElement) {
      _postbackSettings = getPostbackSettings(postbackElement);
   }
   else {
      _postbackSettings = createPostbackSettings(true, _scriptManagerID);
   }
   if (!_postbackSettings.async) {
      _originalDoPostBack(eventTarget, eventArgument);
      return;
   }

   var form = _form;
   form.__EVENTTARGET.value = eventTarget;
   form.__EVENTARGUMENT.value = eventArgument;
   this._onFormSubmit(); 

   if (window.event) {
   window.event.returnValue = false;
   }
}

The _postbackSettings.async property holds a boolean value stating with (True) the control is flagged for partial postbacks or (False) it's not. A status of True is given to any clientside control within an UpdatePanel or pointed to by a trigger from within an UpdatePanel. If this boolean switch is False, then an old-style postback occurs (refreshing the entire page), else the _onFormSubmit method is called which spawns an asynchronous postback to the server, etc.

One final question exists, however - and that's how does the <PageRequestManager> gets its property values? Or, who sets the asyncPostbackControlIDs property on the <PageRequestManager> object for the page? The answer is the ScriptManager control when it renders on the server. After this control's PreRendering phase on the server, it calls the following method which, as you can see at the end, is responsible for setting the property names and values (the values were built using StringBuilder objects):

private void RenderPageRequestManager(ScriptTextWriter writer)
{
   GenericScriptComponent component1 = new GenericScriptComponent(new ScriptTypeDescriptor("pageRequestManager", ScriptNamespace.Default));
   component1.ID = ScriptManager.PageRequestManagerID;
   StringBuilder builder1 = new StringBuilder();
   if (this._allUpdatePanels != null)
   {
      for (int num1 = 0; num1 < this._allUpdatePanels.Count; num1++)
      {
         ...
         builder1.Append(",");
         ...
         builder1.Append(this._allUpdatePanels[num1].UniqueID);
      }
   }
   StringBuilder builder2 = new StringBuilder();
   if (this._asyncPostbackControls != null)
   {
      for (int num2 = 0; num2 < this._asyncPostbackControls.Count; num2++)
      {
         ...
         builder2.Append(",");
         ...
         builder2.Append(this._asyncPostbackControls[num2].ClientID);
      }
   }
   component1.AddValueProperty("updatePanelIDs", builder1.ToString());
   component1.AddValueProperty("asyncPostbackControlIDs", builder2.ToString());
   component1.AddValueProperty("scriptManagerID", this.UniqueID);
   component1.AddValueProperty("form", this._page.Form.ClientID);
   ...
}

Each trigger adds an entry for itself in theScriptManager's _asyncPostBackControls array when the control is being built and each trigger is being initialized on the server by its UpdatePanel.


kick it on DotNetKicks.com
Monday, May 15, 2006 1:14:02 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing
 Thursday, May 11, 2006

....is more than a name.


kick it on DotNetKicks.com
Thursday, May 11, 2006 11:57:57 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Ranting

Computers Blogs - Blog Top Sites

Archive
<June 2006>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
Blogroll
About the author/Disclaimer

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

© Copyright 2009
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 128
Themes
Pick a theme:
All Content © 2009, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)