Wednesday, January 30, 2013

Cool trick with contenteditable in HTML 5

I saw this post by Jose Jesus Perez Aguinaga via Hacker News yesterday - it basically allows you to turn your (modern) browser into a notepad by using the following in the address bar:

data:text/html, <html contenteditable>

If you then do a Save As you can save the resulting HTML page with content to your file system, and if you open it again in the browser, you can start editing it again (at least all that works in Chrome). A friend has found that Ctrl-B and Ctrl-I in the edit window work for bold and italics, and I then figured out Ctrl-U works for underlining, too. I thought that was pretty cool, and put the above as a bookmarklet link in my bookmarks bar.

Then, when talking about it with some friends, I decided to take it a bit further and created a bookmarklet that starts by copying over text you've highlighted on another web page (right now it supports just the text, not any markup) and opening the new editable window with that text in it (if you haven't highlighted anything, it just opens a blank, editable page). Here it is for your perusal. I have it as a bookmarklet in my bookmarks bar, and it works for me in Chrome.

javascript:(function(){var text="";if (typeof window.getSelection!="undefined"){text=window.getSelection().toString();} else if (typeof document.selection!="undefined" && document.selection.type=="Text") {text=document.selection.createRange().text;} window.open("data:text/html, <html contenteditable>"+text+"</html>", "_blank");}());

Note: That all needs to be on one line when you make the bookmarklet, hopefully it will copy and paste that way, but you should be able to just drag the link to your bookmarks bar to save it there.
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo

Friday, September 28, 2012

Zero-calorie comments

Just a quick post to hate on something that's been bugging me - "content-free," "information-free," "zero-calorie" comments. You know the type I'm talking about:
// Get MIME type. 
public string GetMimeType() { ...
A lot of times I'll see these for method comments that are then used to generate "documentation" (or I'll be reading that generated documentation, trying unsuccessfully to extract any value from it). Really? Do you really think that documentation has any value? Telling me as a possible consumer of your API that the GetMimeType method gets the object's MIME type? Huh. I would have never figured that out on my own - thanks. In fact, in some sense these are the worst - because I know that you, as a programmer, wrote exactly the code I show above, so that then you could claim there was "documentation." Well, [bad-word-elided] you, you lazy [bad-word-elided]!

This wouldn't be so bad except there are SO MANY APIs where 99.99% of all the "documentation" is precisely this (I'm looking at you, OpenText!) I am spoiled because in general the MSDN documentation for various Microsoft APIs is typically of high information content and getting better all the time. So the "jolt" from going from excellent documentation to virtually none at all is jarring.

So please, if that is your approach to "documentation," don't bother. Just work hard on having good method names and I'll figure it out. Your code will be cleaner, too, since it won't be cluttered up with all those meaningless comments, and I'll respect you more because I'll know you aren't writing comments like above.

Thanks. [/hate]
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo

Monday, September 17, 2012

Scott Hanselman achieves enlightenment

Well, sort of. In his post Everything's broken and nobody's upset, he correctly identifies the issue that all software is broken. The first step is admitting the problem. But then he ends with "I KNOW we can do better." So close! Then he lost me.

He's teetering at the edge of the The Realization - software is flawed and seems to not get any better...ever. Go re-read all the original ENES essays in the upper right corner of this blog for my take on the matter. The interesting thing is between the time those were written in 1999/2000 and now, we've seen:

  • Everything moved online
  • The rise and fall of "Web 2.0"
  • Dozens of languages, platforms and toolkits gain and lose popularity
  • The rise and fall of agile
  • The rise of "social" (the fall is coming)
  • The rise of mobile

Lots of stuff that wasn't even really a dream in 2000 is now a reality. I anxiously look forward to my first pair of Google glasses. It would seem in all of that we would be at least somewhat better at churning out software. But no.

The specific technologies I mention in the essays all seem very dated (since 12 years is an eternity in tech - maybe I should change the fonts for those essays to some Olde English/Germanic/Gothic font to denote their age :), yet the underlying issues are all still there. At the end of the day, it's all still a massive pile of steaming compost. Sure, there's good, nutritive value in software, but it still stinks to deal with it on a day-to-day basis. I advise high boots and gloves.
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo

Wednesday, August 15, 2012

I like Pi

I finally ordered a Raspberry Pi last Friday and received it yesterday. I had it up and running in under an hour, and most of that was hunting down cables, etc. Some comments follow and then pictures.

  • I ordered it from Newark last Friday and received it on Tuesday (looks like they're out of stock again - bummer). No complaints whatsoever.
  • I made a case from Legos (of course). My son thought I was weird when I asked to borrow some of his Legos, but when he saw the results he was impressed.
  • I used Berryboot to install the Raspbian Wheezy distro on it. It doesn't get any easier than Berryboot, and I love how it is a boot loader that will allow multiple distros on one SD card. I highly recommend it!
  • I am using a stock Sandisk 2GB SD card for now that I had laying around. It works. Will upgrade to a higher capacity one at some point, although I am a little put off about how many of the SDHC cards seem to have compatibility issues.
  • A Logitech K520/M310 wireless keyboard and mouse combo works just fine (the dongle was plugged into a 7-port powered USB hub).
  • An 8 GB thumb drive plugged into the hub was also recognized without issue.
  • At home I ran HDMI through a DVI adapter to a stock Dell monitor (@1280x1024). At work I ran HDMI into our conference room Dynex 1080p HDTV and that also worked great (and HDMI sound worked on it right out of the box).
  • I have a USB-based Windows Media Center remote control at home I expect to "just work" if I end up putting RaspbMC on it.
  • Doom (Freedoom, installed using prboom) works, although I had to do an sudo apt-get update first before sudo apt-get install prboom would work.
  • FreeRDP works (sudo apt-get install freerdp), which is exciting for thinking about possibilities for similar devices at work (kiosks, etc. - especially since FreeRDP supports RDP protocol v7 against our W2008R2 terminal servers ) Performance seems quite adequate.

And now, some pics!

Here is the bare Pi plugged in and booted (credit card and battery for scale)

Here is the Lego case I made for it (again, credit card for scale)

Showing the Pi desktop with web browser pointing at their web site (Buddy Christ optional)

Set up in the conference room at work, showing a RDP session into a Windows terminal server

Fun times!
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo

Monday, August 13, 2012

Great idea I won't implement

Someone else needs to make this happen. It won't be me.

Consider how much time (time == money) is spent by millions of people every day logging into conference calls. This consists of:

  1. Calling a 10-digit number (in the US, anyway), which is actually an 11 digit number by the time you have added the "1" to the front and a 12 digit number if you have to hit "9" or similar to get to an outside line.
  2. Entering in a 4-10 digit conference id number.
  3. Optionally entering in a 4+ digit PIN.
  4. Identifying yourself and hitting "#" or similar.

All of the above easily eats up a minute, just from the dialing, waiting for voice prompts (sometimes you can dial over them, sometimes you can't), etc. And if you mis-dial during any part of it, or get knocked off or otherwise have to leave the call and rejoin later, you typically have to start over, increasing the frustration.

Now consider the following technologies, all available right now.

  1. Personalized URLs.
  2. The rarely (ever?) used "tel" URL scheme (which supports pauses, which would be useful for entering in the various parts of the sequence above).
  3. QR codes.

So my idea is simple - in the email you get when you are invited to a conference call there would be a tel URL or QR code (which would resolve to a tel URL) to dial the entire thing and also identify you. Because each invitation could be personalized, the URL could include a digit string that would identify you specifically without you having to "state your name, followed by the pound or hash sign." The whole process would then become clicking on the tel link in the email or, if the email was printed out for whatever reason, taking a picture of the QR code.

Any of the teleconference vendors could implement this and the rest would surely follow, or perhaps a third party could set up a service that allows you to forward an invite from any of the major vendors to that service and have it then send you an email with the info as a tel URL. If you were doing the service as a gateway you could have your account set up so it has a recording of you saying your name, and then the tel URL could take you to that service, which would then do the dialing for you and also say your name for you.

Any takers? Make it happen, PLEASE.
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo

Monday, June 25, 2012

Interesting replacement for CAPTCHA


Interesting idea. Instead of the ever-illegible CAPTCHAs we are being presented with, how about playing a game to prove you’re a human?


Of course, this doesn’t get rid of the underlying problem of proving you’re a human, which is there are organizations that pay cheap labor to solve CAPTCHAs all day long, and now they’ll get paid to play games instead. So the "CAPTCHA farms" worker bees lives just got better. So the problem isn’t “prove you’re a human.” The problem is “prove you’re a valid human” (“valid” meaning “legitimate, “profitable,” “customer,” or whatever else each business wants it to mean). This site does nothing to solve that, which is the real issue.

In related news, there was an article a few weeks ago showing how to build an open-stack Linux box that could solve the audio version of CAPTCHAs that many sites provide in case you can’t read their purposefully illegible visual CAPTCHAs (irony) with something like a 98% success rate.
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo

Thursday, June 14, 2012

Interesting behavior when forwarding mail to Gmail

I have my own domain, which for illustration purposes we'll call z.com (since I get enough spam as it is, thanks). I use Gmail to pull any mail that comes to my main email address (e.g., foo@z.com) via POP3, since I am using Gmail as my email archive (that may change). All well and good.

When I set up a new account on an online site, especially one I am just trying out and may not stay at, I will set up a new email address on my domain, for example, baz@z.com, and then have it forward to my Gmail account. I could use Gmail's cool "+" notation instead (my.name+baz@gmail.com), except I've found in practical use that many/most sites filter out email addresses with "+" in them as invalid, even though it meets the RFC. Once again thanks to overzealous programmers for doing what they think is right instead of doing what is actually correct.

Setting up a different address for each site allows all kinds of chewy goodness:
  1. It insulates my "real" address in case I want to stop using a service. I can then delete the mailbox from my domain and that email address becomes junk to the company that has it. They can sell it, but it won't increase my spam load any.
  2. It allows me to detect who sells my email address (or worse, who got hacked and lost it).
  3. Since email addresses are the equivalent of userids on most sites, it allows me to further separate risk by having both a separate, randomly generated strong password for each site and also a separate id for each site. If a site gets hacked and everyone's credentials get compromised the only thing I'm out are the credentials for that site.
All good.

When I set up a new email address on my domain it takes up to 15 minutes for it to take effect. I will then send a test email to it to make sure it's working before registering on the new site with my new address and randomly generated password. And here's where it gets interesting. I can't test those addresses by sending an email to them from Gmail. Gmail or something else somehow "eats" the email or otherwise "knows" when it gets the forward and doesn't show them in my inbox. Let me see if I can explain better:

Test Sent From Test Sent To Results
my.name@gmail.com my.name@gmail.com Success - email from my Gmail id (my.name@gmail.com) to my Gmail id shows up in my Gmail inbox
my.name@gmail.com foo@z.com Success - email from my Gmail id to my main domain mailbox (foo@z.com) shows up in my Gmail inbox (pulled via POP3)
my.name@gmail.com baz@z.com Failure - email from my Gmail id to a mail address on my domain (baz@z.com) that is getting forwarded to Gmail never shows up in my Gmail inbox (and no, it's not in the spam folder)
myid@work.com baz@z.com Success - email sent from any other account other than Gmail (myid@work.com) to a mail address on my domain gets forwarded and shows up in my Gmail inbox

I don't know whether to blame Gmail, my domain provider, or what. But it is odd behavior, don't you think?
BlinkList Delicious Digg Facebook Furl Google Bookmark LinkedIn Mixx Reddit StumbleUpon Technorati Yahoo