Archives

Archives / 2005 / April
  • 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;
    edittext.pasteHTML('['+cmd+']'+original+'[/'+cmd+']');


    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?

  • 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.

  • 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.

  • 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 asp.net 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.

  • 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.

  • 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!

  • What do you do for miscellaneous data buckets?

    What do you do when an application has to store extra data that varies? For example, some customer data requires number of cats, others require number of felonies. This is not data I need to search, and I can obviously sort it pretty easily in business objects.

    How do you store it? I thought that the ASP.NET v2 scheme for profile data was kind of clever. I also suppose you could dump some simple XML into a text field in the database.

    What would you do?

  • Software rights... you have only one

    My last post about the wacky open source nuts wanting to rewrite their BIOS brought out the typical responses. One of the recurring themes was about what you have a "right" to do. Bah. You have only one right with ANY product: To not buy it.

    Whether it's software or a bag of Idaho potatoes, the only implied agreement between you and the vendor is that you don't have to buy it.

    Software comes with an agreement, terms of use. Software vendors invest money into creating something, and to ensure that they get a return on their investment they have conditions for its use. If those are terms you can agree to, you can buy the software. If not, you don't buy it. All of these peripheral discussions about being able to "fix" it or whatever are irrelevant. If I want to sell software, I'll do my best to accommodate the end user and meet his or her needs, but at some point I'll make some level of compromise to ensure that my neighbor can't duplicate what I did and cut into my revenue. I've got a mortgage and cats to feed.

    Clearly a lot of people don't agree with that, and that's why we have things like Linux out there. I'm cool with that. I say it's great that the market can accommodate that. However, if the rest of the world really wanted or needed that, then we'd all be code monkeys and we wouldn't buy software.

    Let's get something straight here... I work with Microsoft products. Not only will I admit that, I'll proudly declare it, and I even wrote a book about ASP.NET. That said, in my entire career, technology has never been the reason for any business failure I've encountered. Not even once, and I've been laid-off more times than I care to mention. People tank businesses and fail. Rarely is software, or any technology, the stumbling block. If you really want to look at business risk, look at the people.

  • Open source isn't any less evil than corporations

    Inspired by the story on News.com about people wanting open source BIOS (and the ensuing discussion), it occurred to me that the open source zealots aren't any more evil than big corporations, except that the corporations actually get paid. :)

    What is all of this nonsense about freedom and power anyway? Richard Stallman, who has left the realm of computer science and actual consumer markets and migrated to religion, wants the ability to do whatever he wants to his BIOS. Well good for him, but what does that have to do with consumers? I can't get computer users to find the power button, and this guy wants people to have access to their BIOS? Good God, I'm a developer and I don't care about the BIOS, or even the innards of Windows for that matter. Thanks, but I'll gladly plop down my $80 for Microsoft to figure out how to build an OS for me.

    The whole notion that Microsoft is inherently evil is stupid. Stallman says he wants to "escape" from the evil companies. Huh? If you have to escape from something, that implies you're trapped. Anyone here feel that their computer has trapped them? Sure, I could use open source software, but there isn't anything I can't do with my Windows computer or my iBook. Seeing as how I'm a developer, and I have higher demands than John Q. Consumer, I'd say that's far from being trapped. Even my parents, running Windows 95, seem to be able to do whatever they need.

    And that's where Stallman doesn't get it. The market dictates what it needs, and companies make products to meet those needs. The open source folks are like a loosely coupled company too, and if they'd spend less time waving their flags and find leadership that can stand up and say, "Hey, the market needs this," then we'd all be using Linux and Microsoft would be shaking in its boots.

    Here's a newsflash... every year computers and other devices become less about geeks and more about everyone. The success of things like the iPod came about because it solved a problem and a pre-schooler could use it. Linux has had no impact on the desktop because the average person can't install it and can't maintain it. I'm not suggesting that a Windows install is easy and flawless, but your chances sure are better with it.

    Imagine for a moment that consumers could change the firmware on their toasters or refrigerators. Do you think anyone would care? Of course not! The market reality is that people don't care about the innards of a machine, and computers are becoming more and more like that every year. Consumers want it to turn on and work. Gates has been saying for years that people want stuff that just works (so has Jobs, for that matter). If you can do that better than Microsoft and Intel/AMD, then I'll use your product.

    Until then, keep the religion in church and come back to market reality.

  • Real work getting in the way of community work

    I got all inspired and wrote a quick article yesterday because there are so many things that I learn, practically every day, that I'd like to share.

    But this contract gig I'm on... it kind of gets in the way of sharing. By the time I get home I just want to watch TV or read something from dead trees. The work isn't hard... I've yet to write any code or even requirements after billing north of 80 hours. It's just that leaving the house and being around software all day makes me less interested in my little pet projects. I hate that, because my personal projects allow me to both share expertise and serve as the foundation for bigger picture things (like a long-overdue CoasterBuzz rewrite).

    Alas, this is still the first gig I've been on in five years that I feel is interesting and has good people to work with. While I could afford it financially to just up and split, it's not professional and I don't want to leave these people high and dry. They've been dealing with bad software for years, and I want to save them.

    A month ago I was planning out how to waste time this summer, and somehow I got sucked into working for a client I like. What a strange world. This fall, one way or another, will still be all mine.