FriendsFeedMe!

Last two weeks were very busy for me, and outlook for near future looks similar ;-) First, we have launched FriendsFeedMe which we call just FFM. It is application based on Facebook Platform which will process Your OPML file (containing list of Your RSS feeds). As result FFM will suggest You feeds which are read by Yours friends.

Current application state is beta, and it is being tested by our friends, however it is open to add this application to Your Facebook account. If You want, feel free to use it and submit Your feedback. We will welcome any, since it allows us to make better application.

Of course we have blog dedicated to this application: blog.friendsfeedme.com

My impressions on Facebook Platform are very positive, however we are using very small subset of possibilities – like get friends list, send some notfications. Our application works as standalone website, not as integrated page in Facebook account. We have own reasons for that, but… this will be future ;)

REXML and missing iconv

If You are parsing XML with Ruby, You probably have been using REXML to parse it. Well yesterday I was faced with error left by REXML:

/usr/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:90:in
`parse': No decoder found for encoding ISO-8859-2.  Please install iconv.>
(REXML::ParseException)

I was a bit surprised, since it was on FreeBSD box, which have installed iconv by default.

Solution is very simple – REXML was complaining about missing iconv gem! On FreeBSD it means You have install /usr/ports/converters/ruby-iconv.

Empty nil

Recently I have started to add one extension to Rubys NilClass, when creating new Rails application. It is empty? method. For me is obvious that result nil.empty? should be true. Adding such method allow to write:

if some_var_which_can_be_nil.empty?
   #code to handle nil/empty case
end

Instead of

if some_var_which_can_be_nil.nil? || some_var_which_can_be_nil.empty?
   #code to handle nil/empty case
end

Using first example without extending NilClass will result with NoMethod exception, when variable will be nil:

irb(main):001:0> nil.empty?
NoMethodError: undefined method `empty?' for nil:NilClass
        from (irb):1

If in some case I would need to distinguish between nil and empty cases it can be done with check against nil in code handling nil/empty case. And of course NilClass extension is trivial:

class NilClass
  def empty?
    true
  end
end

Result? More compact and clean code, which is good ;-)

Why I do hate IE – or just MS Script Debugger?

I have discovered some time ago that IE does treats Arrays and Hashes (JavaScript) a bit differently than Firefox when there is coma after last element. This is quite obvious ;-) and maybe IE is more standard compliant, but this is not the point.

Let’s take following JS code:

function loadSuggestions() {
   new Ajax.Updater ( 'suggestions', '/suggestion/',
      { method: 'get', })
}

As I said this case when there is not needed comma in option hash passed to Ajax.Updater. IE fails to compile this code and that’s OK. Problem is how it is shown.

loadSuggestions was placed in external .js file included with script tag and loadSuggestions was called in onload property of HTML body. IE7.0 with MS Script debugger stops on onload property with Identifier expected or something similar. Any tip that external .js file failed to compile.

Again – Firefox with Firebug sets developers expectations very high!

Facebook API – developer impressions

During last two weeks You may have observed significant decline in new posts from NetManiac. Well, nothing happens without reason. With my friend from non-formal group of polish web developers and designers – Yashke I have started work on application, which uses Facebook API. Social network information is core feature for this application.

My impressions as a developer are positive, however this API (from my personal experiences) is hard to start with. I had no prior experience with Facebook (F8 in Poland is not very popular to say at least) so my biggest obstacle was to overcome simple issues with setting up developer application. This is simple, but there some quirks when You have marked Your app as ‘developer only’ and it works in iframe (or as standalone one). Logging with Facebook account not associated as developer of this application results with many strange errors. It looks like most of them are fixed, but not all. For example in one controller I have troubles to get info from fbsession and fbparams, they are just empty variables. Of course there is the same include/require set and filters ran both in this and other controllers. Strange, but it waits for later to debug where I made mistake ;-))

So, stay tuned – in few days I expect we will announce our application to much wider audience (currently small set of testers is involved).