The bad news is, my main site is down and I’m too busy to update my blog.
The good news is, I’ve finally cooked up a tool which prevents me from procrastinating or getting distracted for days on end, so it’s only a matter of time before I’ve caught up to my real-life obligations.
The main site should be renovated and back online some time within the next month or two and, while I don’t want to promise anything, I’ll probably resume reviewing fanfics and commenting on interesting geeky stuff shortly afterwards.
I’m not really on top of my time management yet, but this was hard enough to find that I think it warrants a blog post anyway…
Have you ever tried looking up how to use Javascript to get the selected HTML in a browser window in a form that can then be sent via XMLHTTPRequest or fed into an ordinary form field? (eg. for POSTing to a quote-collector tool) It’s a surprisingly difficult piece of info to find. (Hence why I’m partly writing this as a reminder to myself)
First, you’ll probably end up visiting the QuirksMode Range Intro to learn about window.getSelection() in browsers like Gecko/Firefox and the equivalent Internet Explorer scripting, but all you’ll learn there is how to get the selection as plain text… and that’s no secret.
Once you’ve got the selection/range, things become a little trickier because, once again, Internet Explorer and everyone else do things differently. In Internet Explorer, it’s as simple as range.htmlText but in other browsers, it’s a little less obvious.
First, you call range.cloneContents() to get a DocumentFragment object. This is more or less equivalent to Copy (Ctrl+C) when copying and pasting things. Then you create a <div> element, use div.appendChild(clonedSelection), and then grab the HTML as text from div.innerHTML. Don’t go looking for ways to serialize DOM nodes to XML. It’s non-portable and a bit of a red herring.
Here’s my solution, descended from the complete code fragment I eventually found on a thread on the FCKEditor forums:
Now that you know, why not create some interesting bookmarklets?
Probably best to read the link above, since I definitely don’t have time to write something anywhere near as good, but in short, it’s an introduction to Dana Hunter’s Carnival of Elitist Bastards which attempts to combat (or at least provide some resistance to) the apparent American tendency towards anti-intellectualism and a tendency to disregard what the experts say if it contradicts what people want to be true.
As I mentioned, the above introduction is much better than this little blurb and I highly recommend that you read it.
Ever wanted to use a VoIP client to answer phone calls over your traditional phone line instead of getting VoIP service? (Surprisingly difficult since everyone seems to want to use their crappy old phones on VoIP instead) Well, here’s the trick: Buy an FXO card like the Voxzone X100P and install the open-source Asterisk PBX software.
Not only do you get to use the VoIP client and high-quality $7 Skype-certified, noise-cancelling microphone of your choice, you can trap telemarketers in a voice-mail maze of your own fiendish design. 🙂
In essence, an FXO card is the “voice” portion of a voice modem isolated and made Linux compatible so Asterisk users will buy them. As such, they’re cheaper than an equivalent voice modem and, since voice is the core function rather than an afterthought, their noise/echo-cancellation is usually better.
Oh, and if you want to plug traditional telephones into VoIP… perhaps to use Asterisk as a full-fledged PBX, you’ll want an FXS card (internal) or an ATA (external, Analog Telephony Adaptor). (FXO cards act as phones, FXS cards act as phone lines)
Update: Given how unpredictable quality can get when you have multi-process C++ compilation running in the background, I decided to use a dedicated box. If you like the idea of open hardware, take a look at the IP04 Open-Source PBX. (I use the one-port version with an FXO module and a bunch of Linksys PAP2T-NA ATAs)
I’m not really in the mood for blogging right now, but this took me a lot of googling, so I should probably share it.
Did you ever wonder what arcane incantations went into customizing that “ActionList: viewmode_toolbar” subsection in your Konqueror toolbar? Wonder no more.
First, anyone who has used both Kubuntu and another distro (eg. Gentoo) will notice that it’s possible to change the number of dropdown buttons. I’m happy with the three I have, so I didn’t really look into this very closely, but apparently this patch file will switch between the two configurations when properly applied:
http://launchpadlibrarian.net/4891395/un84.diff
Now that the difficult part is out of the way, here’s the part that is so typically “KDE voodoo”. Easy to do… but you have to know it’s there first. (Which is still better than GNOME in my opinion, but that’s just me)
If you want to change the order of the buttons, remove (or re-add) entries (but not change which ones go into which buttons), or re-order the entries within each button (Keep in mind that this also lets you control which one gets the ‘default for this button’ status), here’s what you do:
Go into the file association controls (Configure Konqueror –> File Associations is a nice quick way)
Choose inode/directory and click the Embedding tab
Re-order, add, and delete KParts.
It’s that simple. My suggestion is to install FileLight and then make it the top-most item in the right-most button with the traditional disk-usage viewer the bottom-most one.
Here are the relevant pages I ran across while googling. The rest was just experimentation on a hunch.