The Coding Humanist

Archives: 12/2006

New Books

-- Filed Under: Books
Comments: (0)

Hooking Up Slider Extender to Client-Side Code

-- Filed Under: Ajax
Comments: (0)

Now that the RC for ASP.NET Ajax is out, we're just around the bend from release. Thank goodness.

So I downloaded the RC and the control toolkit and started playing with the slider, since I would like to use it for a project. Unfortunately, it took me a while to figure out how to hook up clients-side javascript events to the slider. A forum post finally solved my problem. I figured I would share the solution.

            
Sys.Application.add_load(application_Load);

function application_Load()
{
var behavior = $find('funkyBehaviorId');

//$find('funkyBehaviorId').add_valueChanged(function() { onDoSomething(); });
//$find('funkyBehaviorId').add_valueChanged(onDoSomething);
//$find('funkyBehaviorId').get_events().addHandler("valueChanged", onDoSomething);

//behavior.add_valueChanged(function() { onDoSomething(); });
//behavior.add_valueChanged(onDoSomething);
behavior.get_events().addHandler("valueChanged", onDoSomething);
}

function onDoSomething(sender, e)
{
var div = $get('showMeSomething');
var textbox = $get('_sliderTarget');

div.innerHTML = "" + textbox.value + "";
}

<asp:Panel runat="server" ID="hi">
<asp:TextBox ID="_slider" runat="server" />
<toolkit:SliderExtender runat="server" TargetControlID="_slider" BehaviorID="funkyBehaviorId" ID="_sliderExtender" BoundControlID="_sliderTarget">
</toolkit:SliderExtender>
</asp:Panel>

<asp:TextBox runat="server" ID="_sliderTarget" />

<div id="showMeSomething"></div>


All of the lines in the application load method work. They are all just variations on the same theme. Use whatever style you like. Use the $find method to find the sliderextender based on its behavior id, and attach to some events. The key that I didn't figure out for quite a while was to hook up to the slider extender via behavior id, not to its id or the id of the target. Once I found that out, everything went pretty smoothly.

CNN's "After Jesus"

-- Filed Under:
Comments: (0)
Tomorrow, Wed Dec 20th 2006, CNN will be airing a special called "After Jesus: The First Christians". More info here. Looks interesting. We'll see how it turns out.

Thanks to Scot McKnight for the heads up.

ASP.NET Ajax RC is Here!

-- Filed Under: ASP.NET, Ajax
Comments: (0)
Yay! I can't wait to get started with it. You can download it from the MS website for ASP.NET Ajax. They are, as of this posting apparently, updating the website. Five minutes ago the images still said Beta 2. Now they say RC :)

Amazon Associates Program

-- Filed Under: General, Books
Comments: (0)
So I decided to sign up as an Amazon Associate and also create an aStore.

With the Amazon Associate program you can link to Amazon about books from your site and, if someone buys the book, you get somewhere between 4% and 8.5% commission on the purchase. Not bad.

The aStore is similar. It is a place where you can list and categorize books. If someone buys a book through your aStore, then you get some commission. Both seem like nice programs.

My aStore has books that I have liked in tech and Greek and would recommend, and lists of books that I find interesting but have not yet read.

I like books a lot. It is the main type of adornment in my study. When some people or sad about something they eat ice cream or chocolate. I either eat a steak or buy a book...or both.

Decompiling the ASP.NET Ajax Library

-- Filed Under: Ajax, Tech Review
Comments: (0)
So in an attempt to look deep into the bowels of the UpdatePanel of ASP.NET Ajax, I decided to employ one of my favorite geek tools, Reflector. Reflector has a nice interface, but Visual Studio's is a little better, so I tried out one of the addins that actually dumps the decompiled dll into text files. I ended up using this one. It actually creates the class library and pulled the javascript files out of the Microsoft.Web.Extensions library. Pretty cool.

But it didn't work perfectly. If you want to do the same, be prepared to deal with some issues.

  1. Private classes aren't handled well. This is actually a problem with Reflector, not with the plugin. Only two classes (that I could find) used them, so those had to be manually fixed.
  2. Enums were decompiled as their integer values. C# will not implicitly cast an int to an enum, so all of those ints had to be cast.
  3. Properties where not properly decompiled, but that's not a surprise. As you .NET geeks surely know, properties are syntactic sugar, and are compiled in IL to get_ and set_ methods. These showed up in the decompiled C# code, and had to be changed to properties manually.
  4. Ref and out were often switched.
After fixing a little over four hundred syntax errors, everything was fine :). It actually went pretty quickly, since most things fell into the above four categories, and those are easy to fix.

Now I have the MS ASP.NET Ajax library in code files.

So the plugin works pretty well, though things could be improved.


A Few Notes on the Logging Application Block

-- Filed Under: Tech Review, Development, .NET
Comments: (0)

We are switching a project I'm working on from a custom logging solution to the one built into the Enterprise Library, the "Logging Application Block". This is nice, because it means we can get rid of quite a bit of custom code (that's code we no longer have to debug or maintain). The logging application block is very well done as far as I can tell thus far. It makes it very easy to configure logging without having to change code.

Read More on "A Few Notes on the Logging Application Block" >>

"Fun" at the Carson and Barnes Circus

-- Filed Under: General
Comments: (1)
So a couple weeks ago we received some coupons in the mail for the Carson and Barnes circus. I don't ever remember going to the circus (maybe I did when I was really young...I'll have to ask my mom), so I thought this would be fun.

First, it was really small. It was held in a small rodeo arena in Mesquite. Are all circuses as small as this one? Unfortunately, I have no frame of reference.

Second, it was fairly pricey. As I expected, you get coupons to get in fairly cheaply so they can gouge you on pony rides, the bounce house, elephant rides, over-prices mediocre food, and little toy trinkets. The whole fam got in for $20. But we spent quite a bit inside on little things. We bought two flashy lighty things for the kids. One of them stopped working within about 10 minutes.

Third, unlike what they say, it is not fun for the whole family. Abigail (2) was pretty enthralled. It took a while for Jonathan (4) to get impressed. After about 10 minutes of the show he said he was ready to go. We stuck around a while and he eventually started enjoying himself. But for adults...well...calling it lame would be by association an insult to everything which has to this point been called lame. There was so much obviously fake sponteneity. It took about 10 minutes for the "acrobats" and such to actually do something that I didn't think I could do. That's pretty bad. I'm uncoordinated, a slight bit overweight, clumsy, and relatively weak. And I have no experience in gymnastics. The trapeze artists fell once. That was kinda funny.

The supreme act of lame circus-ing was the "volunteer" horse rider. A guy came out to the middle ring and rode standing on the back of two horses. They made a big todo about calling out a volunteer from the audience. The volunteer tried to get up on the horses and fell, and swung around by the safety harness that was attached. In shame she walked off, only to be goaded into doing it again by the ringmaster and the crowd. This time she actually climbed up the horses, but eventually fell off again. Then we saw the trickery. In mid-swing her pants fell off and she was wearing her gymnast-circus-leotard thingy underneath. SHE WASN'T EVEN A VOLUNTEER! That was just the last straw...

If you have really young kids, they might enjoy it. Otherwise, don't waste your time.