A few updates for the FriendFeed plugin

Thank you to everyone who’s installed the FriendFeed plugin.  The feedback has been very helpful. I got svn access for the WordPress Plugin hosting, so the plugin now exists on the WordPress plugins site.  The upshot of this is that it will now be included in the WordPress automatic updates, so if your version of WordPress supports that, you should start seeing updates for it on your plugin pages. 

Speaking of updates, I’ve just checked in an update that shows the likes as well as the comments.  So you will now get a list of the people who ‘liked’ your post as well as the comments. I’ve also tweaked the HTML it generates a bit, so if you’d setup some CSS rules around the plugin, you might want to check they all still work after updating.

image

I’ve got some default styling rules that you can apply to get started, otherwise the plugin is just going to give you two vertical lists, which probably isn’t what you want

#togglefriendfeedcommentslink { color: #333; font-size: 10px; font-weight: bold; }
#friendfeedicon { float: left; border: none; padding: 0 4px 0 0; }
#friendfeedlikeslist ul, #friendfeedlikeslist ul li { display: inline; }
#friendfeeddiscussions { margin: 10px 0 0 0; clear: both; }

Can I recommend the Cross-theme Stylesheets plugin to make this simpler.  You can create a stylesheet just for this plugin that can be edited inside the WordPress admin section, independent of the theme’s styles.

Update: Just got my first TechCrunch link!

FriendFeed Comments WordPress Plugin

Well, FriendFeed released their API yesterday, along with pre-written php & python libraries.  It’s a really good API, got access to all the data you see on the site.  So I’ve written up a WordPress plugin that will pull back comments from FriendFeed & show them on your site.  This plugin will allow you to display on your own site the comments that people make on FriendFeed about your post. 

I keep trying to think of a more succinct way of writing that but I can’t.  I always sounds more confusing than it is. See the plugin page for more details, this is an early beta I can’t stress that enough.  It will have bugs, it may very well break. 

image

Anyone who is willing to help beta test would be very welcome, you can download the zip file here. Unzip that into your plugins folder & activate it.  You’ll then need to go into the options (or settings if you’re running WP2.5) and click on FriendFeed.  Put your FriendFeed nickname in & save.  You’ll then need to drop the new template tag <?php wp_ffcomments(); ?> on to your single post template somewhere inside ‘the loop’.  I put mine just above the <?php comments_template(); ?> call.

Much thanks to Corvida for being my first guinea pig tester.  It seems to be working on her site, and she gets a lot of comments! 

Google's moving in next door

image Google really is busy here in Australia.  First they announce Transit for Perth (and other states to come soon), and now I hear they’re building their new headquarters next door to my office.  They’re currently across Darling Harbour from us over in Darling Park here, but they’re moving here. It looks like a big block of concrete there, but it’s actually a construction site now.  Pyrmont is turning into a media hub, with Channel 7 next door too, and a whole bunch of other small media agencies near by.  Channel 10 is just up the road too.

The new Google building is been billed as a new ‘green’ style of building, apparentlyWorkplace6, a joint venture between site owners GPT and builder Citta Property Group, will generate one-quarter of its own power supply, take in harbour water to release heat and recycle sewage to flush toilets and irrigate nearby parks”.  Makes sense, sounds like Google is expanding its solar power scheme. Wonder if we’ll get a monitoring page like that for Sydney.

 This Lifehacker article has an image of what it’s going to look like.

Sydney’s Googlers will move into the new building in 2009. The press release was long on “dull but worthy” details such as “Workplace6 is NSW’s first 6 Star Green Star building, going above and beyond green office standards for Australia.”
We can only assume from the brevity of the press release that Google Australia has conceded that Google Zurich – which features a fireman’s pole or a slide to get you down to the  ground floor in a quick and  fun fashion – reigns supreme as the “cool” Google office. Aww.

Everything old is new again

What with all the, um, unpleasantness around FriendFeed this week, it reminded me about something that I’ve been thinking on for a while now. There have been a lot of new sites starting up in the last couple of years that are primarily focused on social communication over the web. Facebook, FriendFeed, Tumblr, Pownce, Twitter, Orkut, Jaiku, about a billion blogs, and so on. The social web it’s being called.

The idea is that the new web, ‘Web 2.0′, is introducing the concept of social networks to the internet as opposed to the ‘old’ web which was just corporate marketing.  Of course this is ridiculous.  If the internet has ever had a single defining feature, it is its social nature.  The internet was originally nothing but interpersonal communication. Anyone remember bulletin boards, Usenet?  Even with the advent of html and the font tag we had newsgroups and forums.  Myspace? It’s just Geocities with music. It was only in the very late 90s that the internet started turning into the corporate marketing platform that people seem to think it is.  The new social platforms are just newer, shiner versions of newsgroups.  Bulletin boards with animated emoticons and super poke.

image So why does everyone think that the internet is just one giant marketing tool? And if social isn’t new, what is it that the new “Web 2.0” brings that is actually, well, new?  The simplistic answer to both questions is this: volume

The sheer volume of people using the internet now on a daily basis is enormous.  The advent of broadband and its relative cheapness (unless you’re in Australia that is) means that pretty much anyone can load up a page within seconds.  I’m old enough to remember waiting minutes for things to load.  Minutes!  And I’m not really that old (don’t ask my kids).  Now, if your website takes more than 5 seconds to load, people from above start asking questions.  Your average office worker now has super high-speed access to the internet. And while offices often block non-work related sites, they can’t block them all, and there are always ways around the blocks if you know what you’re doing.  The fact is that a lot of people are spending a lot of time online, and they’re bored.  Why bother with solitaire when you can load up Kongregate?  Not only do you get more entertaining games, you get to broadcast your l33t skillz through the high score lists (and parade your achievements on your Facebook account with their app).

But it’s not so much the number of people online that led to the idea that corporations own the net.  It’s the rate of growth …

Continue reading

Google Transit is coming to Australia

Google Transit will provide directions for travelling to and from locations using local public transport.

Its Australian launch, in Perth using data from the Western Australian transport authority’s online service Transperth, will be the first in the southern hemisphere.  Mr Noble said the company would seek to work with authorities in other states to launch Google Transit across Australian cities.

Google to launch transport tool in Australia: News.com.au

Nice, I wondered when they’d roll this out to us.  Google has a history of not abandoning us here in Aus like some other IT companies do.

Google Maps (and Earth) have super-high res for Sydney

image(via Simon Job) Google Maps now has maximum resolution images for Sydney.  Not just Sydney actually, here’s the Penrith Regatta Centre.  How about the Three Sisters at KatoombaNewcastle’s covered too, and it looks like everywhere in between is covered too!  This is a huge update.  Doesn’t goes so far south though, the high res layers seem to stop at Waterfall.

Cool things we can now see:

Oh and sorry, but Melbourne doesn’t have this yet.

Comparing two arrays (or IEnumerables) in C#

Much to my surprise I found that .NET 3.5 doesn’t seem to have a native method for comparing two arrays or collections of any type.  The LINQ extension methods offer a whole lot of added functionality for IEnumerable<T> collections, but not native comparison.  The Equals method is still the base object.Equals method that does a reference equality (i.e. Are these two the same object?) not a value equality (do they contain the same values?)

So, finding myself needing an equality comparison between two arrays, I’ve written the following extension method:

   1: /// <summary>
   2: /// Checks whether a collection is the same as another collection
   3: /// </summary>
   4: /// <param name="value">The current instance object</param>
   5: /// <param name="compareList">The collection to compare with</param>
   6: /// <param name="comparer">The comparer object to use to compare each item in the collection.  If null uses EqualityComparer(T).Default</param>
   7: /// <returns>True if the two collections contain all the same items in the same order</returns>
   8: public static bool IsEqualTo<TSource>(this IEnumerable<TSource> value, IEnumerable<TSource> compareList, IEqualityComparer<TSource> comparer)
   9: {
  10:     if (value == compareList)
  11:     {
  12:         return true;
  13:     }
  14:     else if (value == null || compareList == null)
  15:     {
  16:         return false;
  17:     }
  18:     else
  19:     {
  20:         if (comparer == null)
  21:         {
  22:             comparer = EqualityComparer<TSource>.Default;
  23:         }
  24:  
  25:         IEnumerator<TSource> enumerator1 = value.GetEnumerator();
  26:         IEnumerator<TSource> enumerator2 = compareList.GetEnumerator();
  27:  
  28:         bool enum1HasValue = enumerator1.MoveNext();
  29:         bool enum2HasValue = enumerator2.MoveNext();
  30:  
  31:         try
  32:         {
  33:             while (enum1HasValue && enum2HasValue)
  34:             {
  35:                 if (!comparer.Equals(enumerator1.Current, enumerator2.Current))
  36:                 {
  37:                     return false;
  38:                 }
  39:  
  40:                 enum1HasValue = enumerator1.MoveNext();
  41:                 enum2HasValue = enumerator2.MoveNext();
  42:             }
  43:  
  44:             return !(enum1HasValue || enum2HasValue);
  45:         }
  46:         finally
  47:         {
  48:             if (enumerator1 != null) enumerator1.Dispose();
  49:             if (enumerator2 != null) enumerator2.Dispose();
  50:         }
  51:     }
  52: }
  53:  
  54: public static bool IsEqualTo<TSource>(this IEnumerable<TSource> value, IEnumerable<TSource> compareList)
  55: {
  56:     return IsEqualTo(value, compareList, null);
  57: }
  58:  
  59: public static bool IsEqualTo(this IEnumerable value, IEnumerable compareList)
  60: {
  61:     return IsEqualTo<object>(value.OfType<object>(), compareList.OfType<object>());
  62: }

Updated: Jugen (see comment below) made some quality suggestions that I’ve used to improve the code here.  To see the state of the code when the comment was made, see here.

It gives you an extension methods on any collection that implements IEnumerable<T>.  There is an optional parameter of type IEqualityComparer<TSource> which if not null will be used to compare each item in the collections.  Otherwise it will use the default comparer for TSource. It will also work for untyped IEnumerable collections, the overloaded method passes the collections through to the IsEqualTo<TSource> method with object as the TSource.  This is really just there for backwards compatibility.

As far as speed goes, I ran a test with 2 collections of 10,000,000 (I stopped there because I started getting out of memory exceptions when I was populating the test collections after that!) items & it took 0.89 seconds, so I think that’d do for most scenarios.  If you want to use this code you can grab a copy of it here.

New version of Firebug works in Firefox 3 beta

Sweet.  I didn’t see this before, but Firebug has a new beta version too, which means that it works in Firefox 3 beta 4.  Grab it from the releases page under the Firebug 1.1 Betas heading.  Possibly the single most useful Firefox plugin for me, the fact that it wasn’t working in the beta releases of FF3 was what was stopping me from switching to the beta. No more excuses now, the Adblock Plus plugin even works.

Mozilla Firefox 3 beta 4 available

Mozilla has released the 4th beta of the upcoming Firefox 3 browser.  Check out the review of the new beta by Mozilla Links.  Updates in this release:

  • Improvements to the user interface: better search support in the Download Manager, ability to zoom entire page or just the text, continuing look and feel improvements on Windows Vista, Windows XP, Mac OS X and Linux.
  • Richer personalization through: location bar that uses an algorithm based on site visit recency and frequency (called “frecency”) to provide better matches against your history and bookmarks for URLs and page titles, as well as an adaptive learning algorithm which tunes itself to your browsing habits.
  • Improved platform features such as: support for HTML5’s window.postMessage and window.messageEvent, JavaScript 1.8 improvements, and offline data storage for web applications.
  • Performance improvements: changes to our JavaScript engine as well as profile guided optimization resulted in significant gains over previous releases in the popular SunSpider test from Apple, web applications like Google Mail and Zoho Office run much faster, and continued improvements to memory usage drastically reduce the amount of memory consumed over long web browsing sessions.

There’s a link to the download site at the bottom of this page.

It has also been announced that there will be a 5th beta release, with the code freeze on the 18th of March, which means the beta should be available around March 31st. Or they may release it on 1st April just to screw with everyone :)

Google adds site search underneath site links

imageI hadn’t noticed this before, but Google has added a site search box underneath the site links in their results.  

Not sure what criteria they’re using to generate this, because it doesn’t work for every site.  The SMH gets it, but Drive doesn’t.  It seems to be based on sites that are listed on Google News and their size.  That’s a total guess just based on the couple of dozen of searches I’ve checked out.

Not sure how I missed this seeing as it was posted on the official blog site.  The official word on what sites it will show up for is:

This feature will now occur when we detect a high probability that a user wants more refined search results within a specific site. Like the rest of our snippets, the sites that display the site search box are chosen algorithmically based on metrics that measure how useful the search box is to users

Not sure what that means in real terms, but as I said, I’ve only seen it show up for sites that exist in Google News.  That may simply be coincidental though, as people are often searching those sites too.

Update: Strike my theory. The search box shows up for gimp.org & ubuntu.org & they’re not in Google News.  I guess it’s just down to the pigeons then.