iG:Syntax Hilter MANUAL

Filed under:wordpress — posted by admin on December 30, 2007 @ 6:48 am

iG:Syntax Hilter MANUAL is here

How to Develop a Hit Facebook App with RoR (Ruby on Rails)

Filed under:Uncategorized — posted by admin on @ 6:13 am

Here is a good article to talk about it

Facebook, RFacebook, Rails and url_for

Filed under:rails — posted by admin on December 29, 2007 @ 2:47 pm

It caused me trouble to use url_for when developing applications on facebook with RFacebook. After tracing the source code both in RFacebook and Rails; I found I didn’t configure facebook.yml correctly and didn’t use url_for(is aliased by url_for__RFACEBOOK) correctly. Please take a look at the source code lib/rfacebook_on_rails/controller_exceptions.rb in the following and pay attention to my comment(GOOD and BAD).

[ruby]
def url_for__RFACEBOOK(options={}, *parameters) # :nodoc:
# fix problems that some Rails installations had with sending nil options
options ||= {}

# use special URL rewriting when inside the canvas
# setting the full_callback option to true will override this
# and force usage of regular Rails rewriting
if options.is_a? Hash
if options[:mock_ajax]
RAILS_DEFAULT_LOGGER.info “** RFACEBOOK DEPRECATION WARNING: don’t use :mock_ajax => true in your link_to anymore. Instead, use :full_callback => true.”
end
fullCallback = (options[:full_callback] == true) ? true : false
options.delete(:full_callback)
end

if ((in_facebook_canvas? or in_mock_ajax? or in_ajax?) and !fullCallback) #TODO: do something separate for in_facebook_frame?

if options.is_a? Hash
options[:only_path] = true if options[:only_path].nil?
end

# try to get a regular URL
path = url_for__ALIASED(options, *parameters)
# replace anything that references the callback with the
# Facebook canvas equivalent (apps.facebook.com/*)
if path.starts_with?(self.facebook_callback_path)
#GOOD! Go to here if you set the right facebook.yml in the common case
path.sub!(self.facebook_callback_path, self.facebook_canvas_path)
path = “http://apps.facebook.com#{path}”
elsif “#{path}/”.starts_with?(self.facebook_callback_path)
path.sub!(self.facebook_callback_path.chop, self.facebook_canvas_path.chop)
path = “http://apps.facebook.com#{path}”
elsif (path.starts_with?(”http://www.facebook.com”) or path.starts_with?(”https://www.facebook.com”))
# be sure that URLs that go to some other Facebook service redirect back to the canvas
if path.include?(”?”)
path = “#{path}&canvas=true”
else
path = “#{path}?canvas=true”
end
elsif (!path.starts_with?(”http://”) and !path.starts_with?(”https://”))
#BAD! Go to here if you set the wrong facebook.yml
# default to a full URL (will link externally)
RAILS_DEFAULT_LOGGER.debug “** RFACEBOOK INFO: failed to get canvas-friendly URL (”+path+”) for ["+options.inspect+"], creating an external URL instead”
path = “#{request.protocol}#{request.host}:#{request.port}#{path}”
end

# full callback rewriting
elsif fullCallback
options[:only_path] = true
path = “#{request.protocol}#{request.host}:#{request.port}#{url_for__ALIASED(options, *parameters)}”

# regular Rails rewriting
else
path = url_for__ALIASED(options, *parameters)
end
return path
end[/ruby]

For instance, we configure facebook.yml in Rails config directory as the following. When we call url_for(:controller=>’facebook’, :action => ‘test’), it actually calls url_for__RFACEBOOK. url_for_RFACEBOOK will replace /facebook/test with /netvibez/test. However, if we call url_for(:controller=>’somethingelse’, :action=> ‘test’), url_for_RFACEBOOK will generate http://www.netvibez.com/facebook/test which is NOT canvas friendly URL.

p. p.s. However, url_for(:controller=>’facebook’,:action=>’index’) will return http://www.netvibez.com/facebook. This is NOT what I expect. The reason is url_for_RFACEBOOK will only replace /facebook/ with /netvibez/. The ’slash’ makes big difference. If anyone knows how to fix, please drop me a line.

[code]development:
key: xxxxxxxxxx
secret: xxxxxxxxxx
canvas_path: /netvibez
callback_path: /facebook[/code]

Rails Migration Cheat Sheet

Filed under:rails — posted by admin on July 17, 2007 @ 3:05 pm

Rails CMS Rubricks

Filed under:rails — posted by admin on July 14, 2007 @ 3:38 pm

I am trying to setup up a CMS site based on Rails. I installed Radiant and Rubricks. Although Radiant is very succint, but I love Rubricks more because of features. But I hardly find useful document for Rubricks. Any comment?

OpenID in Rails

Filed under:rails, security — posted by admin on June 22, 2007 @ 8:46 pm

After reading Dan Webb’s article about OpenID , I decide to have a bash at supporting OpenID in Rails application.

First of all, install ruby-openid gem.

  • gem install ruby-openid -y

You can unpack them into vendor directory

  • gem unpack ruby-openid

Web of Trust + OpenID +FOAF

Filed under:security, semantic — posted by admin on June 21, 2007 @ 11:12 pm

OpenID ,WOT adn FOAF. Can we combine them together?  Whitelisting gives us some direction.  Any comment is very welcome!

Mashup Site for YouTube and Flickr – Netvibez

Filed under:rails, web2.0 — posted by admin on May 29, 2007 @ 11:33 pm

The great YouTube and Flickr Mashup site can be found in http://www.netvibez.com. It is very easy to watch Video on YouTube, AOL, Yahoo, Metacafe, asterpix and ‘hide me’ is freindly at work:>

Great Rails Mashup Site

Filed under:rails — posted by admin on December 9, 2006 @ 8:06 pm

Netvibez is an YouTube/Flickr mashup for finding video, images(photos) and music.


previous page


image: detail of installation by Bronwyn Lace