Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Archives

Archives / 2005 / July
  • Component Art is good stuff

    If you haven't seen the beta version of the new Component Art Web.UI Suite, check it out.

    I was already planning on using this stuff for the project I'm on right now, and with the addition of their new Grid control, now I'm thinking I might want to get it even for my own stuff. It's not cheap, true, but I think their new Grid control beats the snot out of the Infragistics stuff (in part because half of their site doesn't even work in Firefox). The Callback control, wrapping pretty much anything into an AJAX control is sweet.

    These guys are really clever, and I look forward to seeing their source code too. Not a cheap subscription, but I think it will be worth it.

  • Upgrading with an Athlon 64

    I upgraded Stephanie's computer today with a shiny new Athlon 64 3000+. She's had a 2 GHz P4 for almost three years, so it was time for an upgrade.

  • The default button on enter on an ASP.NET form

    I haven't really thought about this in a long time, but after searching a bit and finding some really complex solutions, I figured out a way to fire a "click" based on pressing enter in a text field. It works OK in IE and Firefox, which is good enough for me, and it only requires one line.

    EmailTextBox.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + LoginButton.UniqueID + "','')");

    "EmailTextBox" is as you might suspect a text box control, while "LoginButton" is a link button. All it does is render an extra attribute in the rendered tag that checks for a key press, and if it's the enter key, it fires ASP.NET's __doPostBack method with the unique ID of the button that you want to virtually press. That in turn fires off whatever server-side event handlers you've wired up. You could pass in the eventargument as the second parameter in that Javascript if you wanted to.

    I can't understand why this wasn't included somewhere in v2. They did offer a default button for the entire form, but I think that only works if you have actual buttons (I use LinkButtons almost exclusively). You could actually wire up any control name here if you wanted.

  • Populating a ProviderCollection from custom config in beta 2

    I'm a little lost. I'm not clear on how to populate a ProviderCollection based on a custom configuration section. The way I first learned it (pre-beta) isn't possible anymore, and of course all of the docs appear to be placeholders.

    For example, in web.config, I have something like this:

    <mySection defaultProvider="PopForums">
            <providers>
                <add name="MyProvider" type="MyProvider, MyAssy" connectionStringName="Whatever" />
            </providers>
    </mySection>


    Then my custom config section looks something like:

    public class MySection : ConfigurationSection
    {
       [ConfigurationProperty("defaultProvider", DefaultValue = "Whatevah")]
       public string DefaultProvider
       {
          get { return (string)base["defaultProvider"]; }
          set { base["defaultProvider"] = value; }
       }

       [ConfigurationProperty("providers", RequiredValue = false)]
       public ProviderCollection Providers
       {
           get { return (ProviderCollection)base["providers"]; }
       }
    }


    Now how do I get this stuff initialized? The code I'm revisiting from a year ago doesn't even compile because the classes I used, some of them anyway, are gone. I can't find any newer examples.

  • Windows Vista... it's about time

    The next Windows has a name, and finally, I feel like we can at least get somewhat excited about it.

    The hype machine is important. Getting to beta 1 is important. Now it feels like a product that might ship some day.

  • Monitor swap quick and painless

    While getting the "support" guy from Dell to understand that I knew what I was talking about was a pain, the swap to a replacement was fairly painless. UPS dropped off the replacement today, and it included a DHL tag to put on the defective monitor.

    And here's a surprise too... DHL doesn't seem to suck as much, or maybe that was just the Airbrone Express component that sucked. I called for pick up and there was a guy at the door 30 minutes later. The attention I needed to give for the entire monitor swap was just over 30 minutes. Not bad.

    I'm enjoying burn-in free computing again... hopefully on a permanent basis.

  • Using WebResource.axd for embedded resources

    Wow, and actual .NET post. I must not be feeling well.

    Anyway, anyone that has tried to use embedded resources in compiled assemblies using ASP.NET v2 has probably had the urge to beat their head against the wall. The documentation, as of now, pretty much sucks. However, after using our friend Reflector, I think I get what's going on now.

    Say that you're building a control and you want to embed an image in the compiled assembly. Then you want to use the handy built-in HttpHandler WebResource.axd to serve that bad boy up. I've seen at least three different stories indicating the way it should work, but I couldn't get any of them to work. This is what worked for me:

    1. Add the image to your project.
    2. In the solution explorer, click the file, and in the property window, change build action to "embedded resource."
    3. Add the following to your AssemblyInfo.cs file:
    [assembly: WebResourceAttribute("MyNameSpaces.Resources.MyImage.gif", "image/gif")]
    Important note here... the "MyNameSpaces" comes from the default namespace indicated in the project properties. The "Resources" comes from the fact that I happened to put the image file in the "Resources" folder I made.
    4. In your control rendering code, you'll need the following to produce a usable URL for the image:
    Page.ClientScript.GetWebResourceUrl(typeof(MyNameSpaces.MyControl), "MyNameSpaces.Resources.MyImage.gif")
    Notice I used the same naming convention here.
    5. Compile away.

    This should produce a URL in your rendered control that looks something like:
    /WebResource.axd?d=PhPk80h_UWEcbheb-NHNP5WshV_47UOpWqAOl1_li
    UFfN4cNofL74cFlQ1fvpFSf0&t=632573240669964903


    Now, the issue that I have with this is that I'm sure it involves some kind of reflection or something, and frankly I don't know if it's caching the object/stream/graphic. One of the instructions I saw said to add the images as resources in the project property page, but doing so only generated a Properties\Resources.cs file with more mangled name spaces. So if there's a more "correct" way to do this, someone please share!


  • Why exactly did I write a book?

    In my last post, I think maybe I set myself up a little with regards to why it is that I wrote my book. So let me explain a bit.

    First off, I never suggested that I wanted to make a living as an author. I've worked in literally every form of popular media except film, and every one of them is a little like being a starving artist. You love what you do, but the pay generally sucks. I never expected writing a book to be any different. That's why I've still got a day job! (Well, not exactly... I'm a contractor, which isn't entirely like a day job. Or a job at all. What is it I do again?)

    That said, I'd like to make it worth my time as well. A-W let me write the book I wanted to write. I think I got a good contract and a good cut, but of course that means it has to sell. If it sells 10,000 copies, I'll be happy as a clam.

    While making a few bucks is nice, my true motivation for this endeavour has always been to teach. I coach high school volleyball and get all of $1,500 for my trouble, but I do it because I love it. I love showing a kid something and seeing the light bulb turn on. In face-to-face training, I get the same thing with developers.

    The truth is that the market I'm after, those people in transition form script monkey to OOP guru, is something that tens of thousands of developers are in. The feedback I get from people who have read it is almost universally positive, and at the level of "it changed my life." No joke. I'm as surprised as you are. Given my background as a professional communicator, I guess I had better get it right!

    The challenge is reaching those people. Ever show someone how to write a class by writing the test first? A practical reason to write an HttpHander? How to inherit and repurpose a drop down list? A simple way to turn Membership plumbing to your own data store? I had several moments like that with "the new guy" at my current project today. Somehow, we (me and the publisher) need to figure out how to reach those folks and convince them this will change their life. The very ad-hoc and reference-style books out there do little more than to reinforce script habits, and that's not helpful. I was that guy four years ago. If my book had been written back then, it wouldn't have taken me so long to get to where I am today.

    I think it has been slow out of the gate, but I do think it can get better. I obviously need to get off of my ass and start contributing more to the community, something I'm very guilty of not doing. With 700 to 1,000 people dropping by uberasp.net, someone must care about what I have to say. I guess I need to start saying something more.

    And I know that it might sound a little arrogant to say that I really get it and everyone should listen. But the thing is, a good teacher is confident, embraces their authority on the subject, admits they don't have all of the answers, and above all, never stops learning. That's me. Like I said... I was the audience just four years ago.

  • Book sales not what I had hoped

    I got some preliminary numbers on book sales in the first three months and they weren't nearly as strong as I had hoped. Feedback from customers has been extremely good, but I don't know that the publisher is reaching the right people, or anyone for that matter. That's frustrating.

  • Air pressure in your computer

    I was listening to This Week In Tech today and I think it was Robert Heron that mentioned a tip he got from Yoshi regarding your computer case. Keep the fan pressure of the intake fans higher than the output fans. By doing this, you don't get dust getting pulled in through every little crack in the case. In the case where your intake fans have a filter, that means you should have virtually no dust in the computer.

  • Simple rich text conquered

    I have a confession to make... I've barely touched POP Forums v8 in a year. Frankly, I'm glad I didn't get too involved because so much changed in .NET v2 beta 2. Anyway, one of the things I struggled with was making a very simple rich text editor that worked in Firefox and IE. I've had one for years that worked in IE, but I haven't even used IE myself in 18 months. Oddly enough, and as best I can tell, my forum was the first anywhere to include rich text editing.

    People ask me, "Jeff, why don't you just use FreeTextBox?" Annoying little bugs aside, the thing has just become too huge and cumbersome. There's a lot of bulk in that control, most of which I don't need.

    There's some philosophical debate I've had with, er, myself, about what kind of formatting to include. Most major forum packages now support text sizes and color, but I don't think I will. I'm not sold on size yet, but color for sure. In this day and age where we change the look of a site with a few CSS tweaks, it seems pretty stupid to allow color changes within the text. "Everybody's doing it" isn't a compelling reason for me to do it.

    So what I've settled on are the basics that are generally useful... bold, italics, links, lists, code and quotes (using the [quote] tag format).  In seven years of running online forums, I've never seen any need for other things that would enhance communication.

    In any case, after a great exchange on the official Mozilla forum, I got it straightened out, and I feel like I'm beyond a silly roadblock. The new control I wrote is fast and beautiful. The one thing I still need to figure out is how to embed graphics into the assembly, and the stream those out of the assembly via an HttpHandler. I'm sure a little Googling will get me there, but feel free to drop links in the comments if you see something.

  • J Allard is my hero

    I'm still a month behind on reading Wired, but there's a great article about Xbox 360 and J Allard. Seriously, this guy is my hero.

    Why? Because he's a badass that says what he thinks. I respect that. I respect that even more that he's able to do it in a huge corporate structure like Microsoft. (And by extension, I respect his superiors more that they'll put up with, and listen to, his foul-mouthed e-mail.) I get the strong sense that his personality is a lot like mine... strong opinions, not content with mediocrity, not concerned about others' perception of him, 30-something, and perhaps walks the line between confidence and arrogance. That's me.

    I tried to work that way once in a corporate environment, while at Penton Media. That didn't work out because it was a horrible yet classic example of a good old boys club, with a bunch of fat old white men that figured the status quo would continue to work. They didn't want to listen to some 28-year-old kid at the time tell them what the Internet really meant.

    What did I have to say? While it wasn't my idea, one of "our" people suggested building a Web-based CRM product for internal use and to sell to our customers. I mean, we were a B2B media company, why not? I pushed the concept around in the business units I worked in. They said it would never work and no one would buy into it (this opinion was largely based on their lack of sales of Web-based ads). Morons. Salesforce.com got there and made people rich. Those assholes all got canned, Penton was delisted from the NYSE, and that was the end of that. I left for other things before it went down.

    I wouldn't say I'm bitter as much as I hate that I worked in an environment where new ideas were never given a chance for discussion. You'd think they'd stand up and listen to the "kid" that sold a domain name for $100k, but they were so stuck in the print world that they didn't understand the company's evolving role for our customers. The key to success is a combination of identifying customer needs and innovating.

    But who knows, if it were a different company, maybe I would've had the kind of success Allard has had. I really admire the guy because, if you believe everything that has been written about him, he's never backed down from the winner-take-all attitude for risky business. Who in their right mind would create a business plan to take on Sony and Nintendo? And walk into a room with Gates and Ballmer to sell it? He's even smart enough to see the potential for other Xbox uses, even if he sees the thing as mainly a game machine. Frankly his vision makes a hell of a lot more sense than the whole Media Center approach. If he has Gates' ear, hopefully he's listening.

    So I raise my glass to J Allard... someone who really gets it.

  • Stuck on v2 ConfigurationSection class

    This will teach me to write a ton of code on the first beta...

    Back in "the day" of beta 1 of .NET v2, I could:

    XmlNode myNode = ConfigurationSection.GetRawXml().SelectSingleNode("myNode");

    Well, that GetRawXml() method has since gone away. How do I do the same thing? Brain hurts getting my head around the changes.

  • Inexpensive SSL, great support

    If you need an inexpensive SSL, try Instant SSL. I've been using them for a few years. When my latest renewal wasn't working, I e-mailed support, got a response in five minutes, on a Friday night (which would be overnight for them... I think they're in the UK). Turns out they updated their root certificate and I didn't install that on my server.

    It seems so rare these days to get that kind of service.

  • Microsoft's recruiting practices

    Interesting article on News.com today about Microsoft's recruiting practices. I wholly agree with some of the assertions made about the company, and it's probably the reason I've never bothered applying with Microsoft.

    The whole "brain teaser" thing in particular is annoying. Yeah, ask me about the obvious stuff that shows I know what I'm doing, but don't play games with me. I'm a grown up. In fact, I would go as far as to say that even a less knowledgeable person with the right personality beats the heck out of a PhD with the personality of a complete jackass. I just hired a guy for my current project who has only nine months of working in .NET in earnest, but it was the little things, some technical, some not, that sold me.

    A company selling itself really is important. This ain't 2001 anymore. The good people shouldn't be expected to feel lucky to have a job. I need to know up front why I should work somewhere, because life is too short to be wasting time in a place where I can't thrive and be happy. Frequently it's the intangibles that are more important than the money. Although money is still good. The more the better.

    I'm sure that the article doesn't represent the way things go everywhere in Microsoft, but still, I've heard enough stories like those to know I'm not sure I'd want to go there. And that's coming from someone that loves the company's products.

  • Annoyed with Enterprise Manager

    I'm really annoyed with Enterprise Manager. When I try to access a database properties dialog, it gives me the world-famous "Microsoft Management Console has encountered a problem and needs to close" error. None of the solutions I've encountered fix it. It seems to have developed since installing the SQL Express Manager, but I'm not positive of that.

    Has anyone else encountered this?