Yes I know, we should say good bye attachment_fu and hello papaerclip. But I don’t have much choice in my case, the project is to integrate facebook open graph into an existing web application. So my focus was to add on the facebook features not to review and enhance the current code. So how to save the facebook profile pictures as user’s avatar. In other word I need to get the photo from remote url using attachment_fu.
If you user paperclip, this can be done using paperclip url support. For attachment_fu you will need to add some code to your photo class.
class Photo < ActiveRecord::Base
require 'open-uri'
belongs_to :user
has_attachment :content_type => :image,
:storage => (Rails.env === 'production' ? :s3 : :file_system),
:max_size => 2.megabyte,
:processor => :MiniMagick,
:thumbnails => { :small => '100x100>', :medium => '150x150>', :large => '400x400>' },
:path_prefix => "public/images/#{table_name}"
validates_as_attachment
def source_uri=(uri)
io = open(URI.parse(uri))
(class << io; self; end;).class_eval do
define_method(:original_filename) { base_uri.path.split('/').last }
end
self.uploaded_data = io
end
end
And we need to create a new photo using the facebppk open graph profile picture url:
photo = Photo.new(:source_uri => "http://graph.facebook.com/#{current_user.facebook_uid}/picture")
For an other similar solution can be found at Coffee Powerred Blog click here.
Posted in Rails, Ruby, Technologies.
Tagged with Facebook, Open Graph, Raisl, Ruby.
By tyson
– July 21, 2010
So what’s new in iOS 4:
-
Multitasking
- Background audio
- Voice over IP
- Background location
- Push notifications
- Local notifications
- Task finishing
- Fast app switching
-
iAd
There will be better Ad service and display. I just wonder if this will hit Ad Mob. Anyway, most important to developer Apple will sell and serve the ads, and developers will receive 60 percent of iAd revenue.
Apple is going very fast to social network with game center. Basically connect the gamer together, provide a center platform so that information can be exchanged.
iOS SDK 4 contains over 1500 new APIs. I have to say the Apple are listing to their customer and everything just getting better and smarted after each release.
We have received our iPad and the experience is great. A lot of people are saying that iPad is just a big iPhone. And yes, it is exactly what I need. I am using iPhone for: email, banking, read news, play game, …and I need that big screen that iPads have and of cos there are so manything you can do on iPad that you are not able to do on iPhone
Posted in iPad, iPhone.
Tagged with Apple, iOS, iPad, iPhone.
By tyson
– July 15, 2010
1. Install git on windows:
I found that msysgit is the most user friendly git implmentation on windows. Download the msysgit installer from http://code.google.com/p/msysgit/
2. install heroku gem (Assume that you already have ruby, rails, mysql ready, if not please refer to the previous post):
$ gem install heroku
3. Generate SSH key ( if you have not done so):
- You can download and run puttygen.exe from here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- Follow the step and save the private key to /Users/username/.ssh/id_rsa.ppk (Yes, I am using windows 7)
- Paste the contents of the greyed out box into id_rsa.pub
4. Create heroku app:
$ gem heroku create <myapp>
and heroku will prompt for your email and password of your heroku account (please signup if you dont have one) and return to you:
Created http://<myapp>.heroku.com/ | git@heroku.com:<myapp>.git
Good luck!
Posted in Rails, Technologies.
Tagged with heroku, Rails, Windows.
By tyson
– June 15, 2010
1. Get the latest Ruby installer from www.ruby-lang.org
2. Update gem:
$ gem update –system
3. Install rails:
$ gem install rails
4. Install sqlite3 gem:
$ gem install sqlite3-ruby
5. Install mysql gem
$ gem install mysql
Done! You now can create your first application:
$ rails myprojectname
Posted in Rails, Technologies.
Tagged with Rails, Windows.
By tyson
– June 11, 2010
If you have used GotoMeeting you should experience how Citrix can bring an other dimension to the web. Citrix technology let you access desktop application through the web. There are many other Citrix applications available in Citrix Online: GotoView, GotoTraing, GotoAsists,… Citrix works with most platform Window and Mac, Smart Phone and even iPad.
Yes, Citrix is something very cool and many people thing GotoMeeting is really help them in their day to day business, but I seldom see and other business apply Citrix technology to their business solution until we started working with Dawson CPA. Dawson CPA provides virtual accounting services and it really virtual. It is not some kind of out-sourcing accounting services like we usually see. Customer can maintain their files repository, login to Quicbook through internet (using Citrix technology).
A challenging project is completed successfully, we have learn a lot on Citrix, Windows server system, integrating sites in php and .NET. And you can be innovative if you always want to create better solution.

Posted in Business, Technologies.
Tagged with Citrix, php.
By tyson
– June 7, 2010
We are welcome www.eiflainternational.com to be lauched. We thank Mr Nigel J. Blanchard and his team to choosing us to host their website.

Posted in Business.
By tyson
– May 30, 2010
APAC CIO Forum 2010 have ended successfully. We proud to develop and host the website for such important event.
The portal is developed in Java, Struts, Spring, Mysql
Posted in Technologies.
Tagged with Java, mysql, Spring, Strut.
By tyson
– May 27, 2010
I have been developed rails application for the past 3 years. I have worked on different rails authentication libraries: Devise, Authlogic, & Restful Authorization.
Restful Authorization
Source: http://github.com/technoweenie/restful-authentication
Tutorial: http://railscasts.com/episodes/67-restful-authentication
Recomendations: Good to know but not good to use
Authlogic:
Source: http://github.com/binarylogic/authlogic
Tutorial: railscasts.com/episodes/160-authlogic
Recommendation: Quite a mature library which have many add-on libraries for facebook, twitter, open-id, LDAP integration
Devise
Source: http://github.com/plataformatec/devise
Tutorial: http://railscasts.com/episodes/209-introducing-devise, http://railscasts.com/episodes/210-customizing-devise
Recommendation: Cleaner and easier to use. I have manage to integrate devise with facebook open graph authentication, I will write up and post here when time permit.
Posted in Rails, Technologies.
Tagged with Rails.
By tyson
– May 11, 2010
When Tim Berners-Lee talked about Semantic_Web or many people call it Web 3.0. I think that will be great revolution for the Internet. The web will not only the place for us to share information but the web itself will understand the information and be able to gather information and marking decision.
Facebook has gone ahead many giants to provide an ontology for user to define ‘thing’ on their system. With Open Graph, Social Plug-in and OAuth 2.0, Facebook has a giant step forward to the web 3.0 revolution. Tons of information on facebook system will be link up together.
I am still waiting for the next revolution, when the web itself have a mechanism to provide weight-age to the source of information something a like what Stackoverflow is doing but for the whole Internet.
Posted in Facebook.
By tyson
– April 28, 2010
To programmer programming languages and frameworks are like religions. The more you go in-depth in a language or a framework, the more new and interesting you find out and that will strengthen your belief.
Speak on that perspective, I have been a Java follower for 7 years before moving to ruby on rails for the last 2 years. I used to think Java is the best programming language out there and Strut/Spring/Hibernate is the way to go for web application development; until I try out ruby on rails.
Well, I still strongly believe Java technologies are great for enterprise solution for banking, telcos,… but Java seems to be to heavy and painful for medium and smaller project. For most of web project which last less than 100 man-days, ruby on rails can be much more cost effective. I do miss a lot of powerful Java libraries and back-end technology and most of all “The JVM”. So the question is “Is there any way to continue to creating web application in the rails’ way and make use of what Java can provide?”. There are two solution out there: JRuby on Rails and Grails (with GWT font end)
Please check Matt Raible’s blog for some great web framework comparision:
http://raibledesigns.com/rd/entry/tssjs_2010_presentations_and_summary
And what is happening to Java?
http://raibledesigns.com/rd/entry/what_s_happening_in_the
Posted in Rails, Technologies, Trends.
By tyson
– March 30, 2010
Recent Comments