Jeff Makes Software
The software musings of Jeff Putz
-
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. -
GTA Hype: Typical American stupidity
So it would appear that now Best Buy is going to pull Grand Theft Auto: San Andreas off of the shelf following the discovery of some kind of nudie patch you can download to let you undress characters and make them do sex acts.
-
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!
-
The 20" Dell needs a replacement
I blogged last week about my shiny new 20" Dell widescreen, and alas, it needs to be replaced.
-
Microsoft dead in the water?
In the latest episode of This Week In Tech, John C. Dvorak and Leo Laporte think that Microsoft is "dead in the water" because the company is so stagnant. I'm not entirely in agreement, but they do have a point.
-
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.
-
Size does matter
Yeah, I bought the 20" Dell that I said I wouldn't.
-
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.