Jeff and .NET

The .NET musings of Jeff Putz



My Sites


April 2005 - Posts

Inserting text into Firefox rich text editor
I'm trying to build a light-weight rich text editor that works in Firefox. So far so good, as I have the usual bold, URL, image, etc., stuff working. Where I'm stuck is inserting text. For example, if you want to insert "forum tags" for quotes, which we don't put in as HTML, how is that done? In IE, you can do it like this...

var box = document.getElementById(ctrl).contentWindow;
box.document.designMode = "on";
function makeQuote(cmd)
var edittext = box.document.selection.createRange();
var original = edittext.htmlText;

So in this case, selecting text in the editor then triggering the event would yield something like:
[quote]this is a quote[/quote]

How is this done in Firefox?
Posted: Apr 28 2005, 11:45 AM by Jeff | with 5 comment(s)
Filed under:
Power photo of the day
If you could have all of these people in the room with you at once, would you ever have enough time to ask them everything you wanted to ask?
Posted: Apr 28 2005, 11:35 AM by Jeff | with 4 comment(s)
Filed under:
On Microsoft and gay rights

There was apparently some confusion last week about whether or not Microsoft supported a bill in Washington that would protect gay rights there. CEO Steve Ballmer cleared the air in an e-mail to employees.

Then Robert Scoble, who is quickly moving beyond global blogging champion and into the realm of attention whoring, posted a response telling Ballmer that his response was half-assed. I totally disagree.

I have a number of gay friends and acquaintances. I've gone to bat as an advocate of these kinds of issues for years. I have the same personal position that I did ten years ago: Discrimination against homosexuals is not any better than racial or sex discrimination. That's basic human respect, and key to living in an increasingly smaller world.

However, Ballmer made the right choice. In a public company the size of Microsoft, you don't start picking battles on an issue that has already split the country down the middle (to say nothing of its employees, who likely follow a similar demographic). That's irresponsible to the shareholders. If you do something that could potentially put off half of your customers, you have no business running a company that size.

If I've learned anything since my college days, it's that you can create meaningful change by working the system, not just standing up in a crowd and pissing people off. While the latter can get you headlines and is exciting, in a lot of cases it just makes some people's position on a divisive issue that much more entrenched. There's a time and place. A wise leader knows the difference and can make the right decision sans chest thumping.

I've pushed my political views on my sites before, but those are businesses that affect only me. If I lose "customers," so what, I wasn't getting rich in the first place, and I have no one else to be held accountable too. That's a lot different than a company worth billions of dollars.

Posted: Apr 26 2005, 12:44 AM by Jeff | with 6 comment(s)
Filed under:
The Screen Savers... reunited

While the death of TechTV, and especially the The Screen Savers, is really sad as hell, it's really cool that several of the alumni from the show have come together to record an audio program. Leo Laporte announced the first show and you can download that MP3 show. He's also on with Patrick Norton, Kevin Rose and Robert Heron.

It's a really interesting show to listen to, especially the parts where they talk about working in TV and the old days.

This is pretty free-form stuff (although Leo sounds like he's using compression). It's so great that they get together to do this stuff. I hope it lasts. The biggest issue is that for the moment this is not something that they can monetize. Let's face it, this is cool and interesting, but they do need to make a living. For now they all have day jobs elsewhere.

It's still absolutely mind boggling how Comcast managed to completely tank a great, and presumably reasonably profitable, network.

Posted: Apr 21 2005, 11:54 PM by Jeff | with 3 comment(s)
Filed under: ,
Windows Media is still a poor video compression format
I was looking at some press release video today that was encoded with Windows Media and it's still pretty horrible compared to the alternatives. It does talking heads really, really well, but when it comes to video with a lot of motion, it's really horrible until you get into high bit rates.

For example, I recently compressed a few video clips for a client with high motion in QuickTime with Sorenson Pro (the codec generally used for movie trailers) and WM. I was able to get total bit rate with stereo audio at 320x240x30fps to around 120k with only a few minor compression artifacts. To get the same level of quality on WM I had to get the bit rate up to around 400k. What's up with that?

The funny thing is, Sorenson Pro 3 has been out now for at least three years.
Posted: Apr 15 2005, 10:25 AM by Jeff | with 7 comment(s)
Filed under:
I made Wired's Rants + Raves (re: IE)
So it has been sitting around my house for weeks, but I noticed today that I had the first letter in the Rants + Raves section of the April 2005 issue of Wired. Weird to see your name as the first thing in you read in a magazine.

Back in my more ambitious journalism days I used to write newspapers and magazines constantly, and I managed to get into virtually every one I wrote to. If I got anything out of being a columnist in college it was an understanding of how to push buttons, especially from the editors. Now I always think about writing but never do. The Wired thing was just a thing where my wife's iBook was sitting next to me so I pecked something out.
Posted: Apr 14 2005, 10:16 PM by Jeff | with no comments
Filed under: ,
Bloggers aren't all that
It might crush Scoble to hear it, but according to one survey, only a third of people even know what a blog is.

I'd hardly call that critical mass just yet. Calling for RSS feeds on everything with a domain name is still a little extreme if you ask me. All in good time..
Posted: Apr 13 2005, 11:25 PM by Jeff | with 2 comment(s)
Filed under: ,
Set a theme from a MasterPage?
Am I missing something ridiculously obvious? MasterPage has no Theme property, but it would certainly make sense to me to be able to set a theme at the MasterPage level. Searching the forums, it appears it can't be done.

Please tell me this will be changed for beta 2. I just can't imagine having this great feature and not being able to do it at the higher level.
Posted: Apr 12 2005, 10:16 PM by Jeff | with 9 comment(s)
Filed under:
My first bad book review
I got my first bad book review on Amazon. It doesn't bother me that much aside from the fact that the author is clearly not even remotely a part of the target audience. I see that quite a bit in Amazon reviews. I remember one ages ago, I think for one of Alex Homer's books, where the reviewer went on and on about how the book doesn't tell you about this or that, and it was a beginner book! I've always been a fan of his writing style, and if it wasn't for him I don't know if I would've ever started coding again.

Fortunately the feedback I've been getting via e-mail has been pretty good. A guy from Spain, despite an apology about having poor English skills (apparently he's never seen teen chat-speak by American kids?), simply said, "I get it now." That's the greatest compliment I could ever get, because that was always the intention of the book.

Now that I've been away from it for awhile, I think the one thing I would do differently is perhaps do another example chapter that applies basic OO concepts. I went with the data access/container object example because the thing I've seen more than anything in bad code is repetitive data access, though I'm kind of a hypocrite because I rarely combine data access and some kind of object representing the data into one thing anymore. Then again, perhaps that's a natural progression for a learning developer. It certainly was for me.
Posted: Apr 11 2005, 07:58 PM by Jeff | with 2 comment(s)
Filed under: ,
Spring fever is setting in
Now that we have our last snow storm out of the way (and the idiot driving that comes with it), it looks like we might finally be enjoying spring here on the North Coast.

This makes working a real pain, because being indoors in this kind of warm and sunny weather is absolutely intolerable. I'm only working this contract part-time and it's still killing me!
Posted: Apr 11 2005, 01:55 PM by Jeff | with no comments
Filed under:
More Posts Next page »