Building Stuff the right way or the fast way?

Do you do things the way you have always known and you know you may get it done .. or do you want to learn a new way of doing things, which may take longer and properly give you better output in the future? 

Of course the usual decision would be to choose option 2. But people being people, tend to have a trait of impatience ... If we could just be a little bit more patient and open our minds to learn new stuff ... we may see something we have not seen before.

Comments (0)
Posted

Using Xmpp4r-simple for Superfeedr

I was looking for a simple way to integrate feeds subscriptions and unsubscriptions into my application and most of the wrappers that were on Superfeedr were sort of designed to be run as a daemon service, which really wasn't what I needed .. so I Googled around a little and found this nifty Ruby library called xmpp4r-simple .. and there were patches added to it to enable it talk pubsub .. 

But seems like the author has hardcoded the pubsub JID which starts with "pubsub." .. which doesn't work with Superfeedr.

So I changed the main library file a little to add another parameters so you can specify which JID it should talk to .. Here's what you need to do

  • Download my patched xmpp4r-simple.rb
  • Replace it with the same file on your downloaded xmpp4r-simple source (should be cloned from git as shown previously)
  • Build it into a gem and install it (Also shown in my previous posting)

 

Now that you have gotten the patched gem installed into your gem store, you can pass in the new default service JID in the new constructor. Sample code below :

require 'rubygems' 

require 'xmpp4r-simple'

Jabber::debug = true

im1 = Jabber::Simple.new "account@superfeedr.com" , "yourpassword" , nil , "Available" , nil , 5222 , "firehoser.superfeedr.com"

im1.pubsubscribe_to("http://somerssfeed.xml")


 

 

 

 

Comments (0)
Posted

Building and Install Gems from Gemspec files

I downloaded Xmpp4r-simple with the pubsub patches inside but since I'm a greenhorn in Ruby .. I had no idea how to install it because it wasn't in a Gem. 

Yeah, I know... I got too spoilt from all those gem install this, gem install that. 

So after some digging, I realized that I can build the gem from the gemspec file included in the package. 

So if there someone who downloaded such packages, hope I saved you some time.

 

First, we want to clone the entire git directory first.

# git clone git://github.com/spectra/xmpp4r-simple.git

# cd xmpp4r-simple

# gem build xmpp4r-simple.gemspec

 

At this time you should have gotten a gem in the same directory! Woohoo! And so to install the glorious gem into our gem store.

# sudo gem install xmpp4r-simple-0.8.8.gem

 

Check that its installed

gem list --local | grep xmpp4r

 

You should see

xmpp4r (0.5)

xmpp4r-simple (0.8.8)

I think xmpp4r-simple install xmpp4r as a dependency. If you got both of them, you're done!

Comments (0)
Posted

Installing RabbitMQ on FreeBSD 8.0

I needed to use AMQP for one of the apps which I'm hacking on right now .. so needed to install RabbitMQ. RabbitMQ is the fantastic, open sourced message queue application that is both high performance (I'm coming from SQS which is somewhat slow) and low taxing on your CPU, which is basically great for me since I'm running it in a VPS environment.

So I fired up SSH and installed Erlang first since RabbitMQ is written in Erlang

# cd /usr/ports/lang/erlang

# make clean install

I didn't need have an X environment so can safely uncheck Java apps, X, WX. It will start building .. after you are done .. time to install RabbitMQ.

# cd /usr/ports/net/rabbitmq

# make clean install

After you are done, RabbitMQ will tell you something like this

##############################################################################

Please note:The "rabbitmqctl" command must be run as the rabbitmq user,with a real shell, and

with the ${HOME} environment variable set to thatuser's real home directory.

su users can do

something like this: 

# env HOME=/home/rabbitmq su -m rabbitmq -c 'rabbitmqctl ...'

sudo users can do something like this: # sudo -H -u rabbitmq rabbitmqctl ...##############################################################################

 

Ok, great ! Now we have installed RabbitMQ. Remember to add an entry to your rc.conf so it will start automatically and also to allow you to start it manually now.

# echo 'rabbitmq_enable="YES"' >> /etc/rc.conf

 

If you are in your root directory (because you are su), and you try starting RabbitMQ, you will get some wierd errors .. error_logger, protocol error blah blah blah. Closer inspection seems to indicate that RabbitMQ does not have enough privileges to write to your current directory.

No worries, just go back to root and start it from there.

# cd /

# /usr/local/etc/rc.d/rabbitmq start

 

If all goes well, RabbitMQ will report to you that the node has started and you are ready to start on your MQ apps!

 

Filed under  //  freebsd   installation   rabbitmq  
Comments (0)
Posted

Moving In !

People who have seen my blog previously knows that I'm pulling my feed from twitter and masquerading it as blog post. I finally gotten around to moving in here (since Posterous have started allowing me to put my own domain name).

So, looking forward to communicating more with you guys in here.

Comments (0)
Posted