What Does Me.dium Do?

Mediumlogo
I’ve been using me.dium for a few weeks now, and it’s a really interesting service I think more people should try, so I thought I’d try and explain what it’s all about.

The first hurdle I ran into when I installed it was understanding what on earth it was! It adds a sidebar, with a radar screen at the top showing website icons, that mysteriously shift around when you move between pages, and an area at the bottom for IM-style chat. It took several days of use before it really clicked, and it’s still hard to explain, so I’ll just give some concrete examples of what it can do for you:

Uber-StumbleUpon . The radar screen shows you sites that it believes are related to the one you’re currently on, using some kind of algorithmic black magic. This led to some fun website-hopping, SU-style, as I discovered new sites that were similar to others I already visited. What really impressed me though was when it showed a technical site that had exactly the answers I needed, while I was researching a tricky coding question. It saved me days of work, since I’d been searching hard and that site never came up through Google.

IM with Context. As well as showing you sites on the radar, it also has icons representing your friends who are visiting those sites. This adds a new dimension to IM, since you can see which sites your friends are visiting, have an idea if they’re busy or bored, and generally get a bit of the same implicit social information that’s so important when you’re in the same room as someone. It’s as if you can glance over each other’s shoulders and see what you’re up to. This obviously has privacy implications, but I see it being pretty similar to the real-world. There’s times and people you’d be happy seeing what sites you’re visiting, but you want control over that. In the real-world you’d do this by keeping your screen out-of-sight if needed, and controlling who wanders around your house or office. In me.dium you can do the same by turning off sharing, and limiting your friends to those you don’t mind seeing your surfing habits.

Give Every Website a Comments Section. As well as showing related sites on the radar, the sidebar shows conversations that were written by people visiting the same or similar pages. This is really handy for annotating websites, either just shooting the breeze with strangers, or having an in-depth discussion about the content of a site. This is something I’ve wanted for a long time, there’s never been a simple, universal way to see this sort of user content on a site. Even when comments are allowed, the machinery is always fairly clunky and heavyweight, usually requiring moderation to defeat spam, and some mental effort to compose a ‘post’, which excludes the spontaneity of IM style chat. I don’t think me.dium will replace traditional comments, since the conversations are not part of the public net for posterity, but I think this really fills a gap.

Make New Friends. This is another place where me.dium is more like the real world our primate social skills were developed for. If you see there’s someone else on ilovealbinopygmyllamas.com while you’re visiting, you’ll see an icon, with no identifying information unless they’re a friend. You might well strike up a conversation, just like you might if you bump into somebody reaching for the same book in the library. The key to this is that there’s almost no effort involved, you will naturally see people who share your interests, and might get to know them better.

As you can probably tell, I’m pretty excited about the future of the service, especially as more people begin to use it. If you have Firefox, try it for yourself! Don’t worry if you’re on IE, there should be a version for you in a few weeks.

PeteSearch now on addons.mozilla.org

Addonlogo
PeteSearch has finally made it through Mozilla’s review process, and is now on the main add-on site. It’s great to see it on such a high-profile site, but one of the really nifty things is that you now don’t have to go through the two-step process of adding petesearch.com as a trusted site in Firefox to install the addon, since mozilla.org is trusted by default.

It was a long and rocky road getting approval, since they recently added a new sandbox system, and require user reviews before they’ll allow an addon onto the public site. This does make sense, but unfortunately there’s almost no users writing reviews in the sandbox, I think at least partly because it’s tough to get to even if you know about it, and almost impossible to discover if you don’t.

Luckily Pavel Cvrček, Mike Shaver and Shawn Wilsher came to my assistance, and helped me work out how to get the user reviews from news sites and blogs taken into account when they’re evaluating my addon for publication. Shawn has a post explaining the policy in more detail, but in simple terms you need to add links to the external reviews in the  ‘Notes to Reviewer’ section before you nominate it. You get to that section by clicking on the  version number link, eg
Versionnumber

Thanks Pavel, Mike and Shawn, I really appreciate your help!

BHO Examples

Blueprint
One of the problems I ran into when I started looking at converting PeteSearch from a Firefox plugin to an Internet Explorer extension was finding good example code. There are a couple of great articles on MSDN that cover how to write a BHO, but neither include complete source code. Here’s the list of all the code samples I managed to find, and a couple I wrote myself:

A very simple skeleton BHO that I wrote:
http://petewarden.typepad.com/searchbrowser/2007/05/porting_firefox_1.html

A more complex example based on my Firefox add-on:
http://petewarden.typepad.com/searchbrowser/2007/06/porting-firefox.html

From Sven Groot, the source to his FindAsYouType extension:
http://www.ookii.org/software/findasyoutype/
http://www.ookii.org/download.ashx?id=FindAsYouTypeSrc

The SurfHelper pop-up blocker from Xiaolin Zhang:
http://www.codeproject.com/shell/surfhelper.asp

A simple example covering all the BHO events from René Nyffenegger:
http://www.adp-gmbh.ch/win/com/bho.html

More posts on porting Firefox add-ons to IE

Search Tips for Internet Explorer 7

Ie7logo_3
Firefox still has a lot more features to speed up your searching, but IE 7 is a big improvement over older versions.

  • Use the search toolbar. Press Control+E to switch to the search toolbar, which now works just like Safari’s and Firefox’s.
  • Use FindAsYouType for in-page searches. IE’s default Control+F search isn’t as flexible as Firefox’s in-page searching, but this IE add-on from Sven Groot gives you a lot of the same great features.
  • Open results in tabs. If you hold down Alt when you press Return in the search box, the results page will open in  a new tab. You can then switch between tabs using Control+Tab to go forward, and Control+Shift+Tab to cycle back. Holding down Control and clicking on a result will open it in a new background tab, or if you press Shift as well, it will pop to the front. This is most useful when you have a lot of slow-loading results, or you want to compare many result pages.
  • Use PeteSearch! Watch this space for the release of PeteSearch for IE, which already offers hot-keys, split-screen previews and link checking for Firefox users.

More Search Tips…

Porting Firefox extensions to Internet Explorer – Key Commands

Pianokeys
After getting the basic page analysis working, I wanted to use the information I was gathering, so the next step was to get the hot-key commands working.

In Firefox I’m able to set up command key-bindings in the XUL files of my add-on, and call back into the extensions Javascript. Internet Explorer doesn’t have this pre-packaged support for adding key commands, so instead I have to catch the system key events, detect the combinations I’m interested and call the right functions manually.

There are different ways to do this, depending on what you need. Sven describes how to capture all key events in IE from a BHO, even if the focus is on the address bar. Looking at that made my head hurt, it needs some thread-local variables and mapping to remember which thread is associated with which document.

Luckily, I realized that my needs were a bit simpler. I’m happy to have my commands only work when the focus is on the document itself, which meant I could use the DOM event handlers exposed through IHTMLDocument2 to capture key events.

Attaching a C++ callback to an event handler in the MS DOM is not trivial, and involves some COM boilerplate, but I had a helper class I use to capture onclick events for elements. I’ll cover that along with the rest of my DOM helper functions in a future post.

Reusing that, getting called when a key event occurred was quite easy, though one wrinkle I hit was that onkeypress doesn’t get called for all keys, such as those produced when control is held down. I worked around this by synthesizing an equivalent using onkeydown/up, since they do get called for all keys.

One odd thing about these handlers in IE is that they don’t get passed the event information directly as a parameter. Instead you have to ask the current window what the last event was, and pull the information from that. To get the current window, you have to ask the document, and to get the document, I had to query the browser, since that’s all I store in my class, so the code is a bit verbose. It does the job thought, even if it is uglier than I’d like.

The next hurdle was working out the key codes for the events I was interested in. Here’s what I found for the unusual keys I needed:

  • Left Arrow = 37
  • Up Arrow = 38
  • Right Arrow = 39
  • Down Arrow = 40
  • Control+Equals= 187
  • Control+Forward Slash = 191

I then added a giant switch statement to handle all the key combinations I was interested in, and call the right functions. Once that was wired up, I also implemented saving the enabled state of the add-on in the registry, so users can turn it off when they’re not using it, and it will still be off when they restart IE.

More posts on porting Firefox add-ons to IE

XMLHttpRequest in C++ using IXMLHTTPRequest

Lightbulb_3

Sven Groot, whose IE BHO development tips I mentioned earlier, has another great post on using the IXMLHTTPRequest object asynchronously in C++. He explains exactly how to use that object’s callback from C++, with a code example. This was the problem that forced me to write my own implementation, since the official documentation had no explanation of how to do this. The other examples I could find had the bits I was interested in mixed with a lot of other functionality, and I didn’t have the knowledge to disentangle them.

I’d highly recommend taking a serious look at Sven’s example if you’re looking for a way to do XMLHttpRequest’s in C++, it really helped me understand what was going on!

More posts on porting Firefox add-ons to IE

In-page Search for IE

Ookiilogo
I just discovered an addon for IE I didn’t know about, Find As You Type. Even better, Sven Groot, the developer has some technical notes up on the under-documented issues he ran into while developing it, the solutions he found, and the source code to the add-on.

The add-on itself looks like it brings a lot of the useful Firefox functionality I love for in-page searching to IE, including highlighting all terms, and searching as soon as you start typing.

In a nice twist, I actually discovered this using the me.dium Firefox extension. It’s been a fun social tool, but in this case it figured out that the site was related to the MSDN extensions forum I was browsing, and showed it on the radar. Very, very useful, great job by the guys who wrote that algorithm!

More posts on porting Firefox add-ons to IE

More Search Tips…