768x90 Getting Online Shouldn't be Tough- $7.49 .com Domains at Go Daddy

Send SMS using Ruby by Integrating Clickatell

--------------------------
Summary
--------------------------
clickatell gem is served to you for sending sms from your ruby application or shell console. This way is only work in linux, BSD and OSX. To use this gem, you will need sign up for an account at the Clickatell website. Once you are registered and logged into your account centre, you should add an HTTP API connection to your account. This will give you your API_ID.


--------------------------
Proof of Concept
--------------------------

  • install gem : {$} gem install clickatell
  • import or checkout the clickatell trunk repositroy
svn co svn://lukeredpath.co.uk/var/svn/opensource/clickatell/trunk clickatell-trunk
OR

git clone git://github.com/lukeredpath/clickatell.git
  • You can now use the library directly. You will need your API_ID as well as your account username and password.
require 'rubygems'
require 'clickatell'

api = Clickatell::API.authenticate('your_api_id', 'your_username', 'your_password')
api.send_message('6285212345678', 'Hello from clickatell & teapoci')
  • Full documentation for the API is available in the RDocs. For debugging purposes, the API allows you to view gateway URIs as they are requested, printed to $stdout. You can enable this by turning on debug_mode.
Clickatell::API.debug_mode = true
.
  • The Clickatell gem also comes with a command-line utility that will allow you to send an SMS directly from the command-line.
  • You will need to create a YAML configuration file in your home directory, in a file called .clickatell that resembles the following:
# ~/.clickatell
api_key: your_api_id
username: your_username
password: your_password
  • You can then use the sms utility to send a message to a single recipient:
{$} sms 6285212345678 'Hello from clickatell & teapoci'
.
  • You can also specify a custom Sender ID – the name or number that will appear in the “From” label on the recipients phone. You can either add a “from” key to your .clickatell file or manually using the—from option:
{$} sms --from 'Luke Redpath' 447771234567 'Hello from clickatell'


For more information : http://clickatell.rubyforge.org/

Auto Complete Typing in Text Field [Ruby on Rails]


Before

After


-------------------------
Summary
-------------------------

Auto complete is used to find suitable words automatically with corresponding data you wanted while you type it into your text field (check images above). It's so easy to implement it.


-------------------------
Proof of Concept
-------------------------


Requirement : products_controller.rb (default scaffold script), product.rb (ActiveRecord), categories_controller.rb (for auto searching script), auto_complete plugin and index.js in folder views/categories/

  • Install plugin : ruby script/plugin install http://svn.rubyonrails.org/rails/plugins/auto_complete/
  • Modify your product.rb
class Product < ActiveRecord
belongs_to :category

def category_name
category.name if category
end

def category_name=(name)
self.category = Category.find_or_create_by_name(name) unless name.blank?
end

end

  • Create or Modify your categories_controller.rb at def index
def index

@categories = Category.find(:all, :conditions => ['name LIKE ?', "%#{params[:search]}%"])

end

  • Create a new file & add script below in views/categories/index.js.erb or index.rjs.
<%= auto_complete_result @categories, :name %>

  • Open your view which is containing form field for your production controller. Then add text_field_with_auto_complete to your wanted text_field, example :
<%= f.label :category_name %>
<%= text_field_with_auto_complete :product, :category_name, { :size => 15 }, {:url => formatted_categories_path(:js), :method => :get, :with =>" 'search=' + element.value" } %>

#if you get error for
formatted_categories_path
#go to your route.rb then add : map.resources :categories

#if get error on
text_field_with_auto_complete
#
go to your route.rb then add :
#map.resources :products, :collection => {:auto_complete_for_product_category_name => :get }

  • Don't forget to put script below into your layout example application.html.erb/rhtml or production.html.erb/rhtml
<%= javascript_include_tag :defaults %>


Please post me message if you have error. Good Luck.


implementation of http://railscasts.com/episodes/102

Create USA States List For Your Ruby on Rails

This way is very simple and fast to make us states list for your view or drop down menu.



Simple right? Enjoy and good luck

Create Country List for Your Ruby on Rails Quickly

There's many sites that provide you country list in sql file, so you can import it to your database. I would like to introduce you ruby way to create country list for your drop down menu. Let's we start :


  • gem install tzinfo
  • ruby script/plugin install tzinfo_timezone
  • Add the code below to your Application_helper.rb
def make_attributes(hsh)

unless hsh.nil?
output = ""

hsh.each
do key, val
output << "
#{key}=\"#{val}\""
end
end
output
end



def country_code_select(object, method, priority_countries=nil, options={},
html_options={})


countries =
[TZInfo::Country.all.collect{xx.name},
TZInfo::Country.all_codes].transpose.sort

if
priority_countries.nil?
output = select(object, method, countries, options,
html_options)

else
output = "< id="'#{object}_#{method}'"
name="'#{object}[#{method}]'#{make_attributes">\n"


if
options[:include_blank] == true
output <<
""
end


priority_countries.each do pc
if options[:selected] ==
pc[:code] or options[:selected] == pc[:name]
output <<
"#{pc[:name]}\n"
else
output <<
"#{pc[:name]}\n"
end
end

output <<
"----------------------------\n"

output <<
options_for_select(countries, options[:selected])

output <<
"< / select >\n"
end
output

end


  • Add this code to your view :
<%= country_code_select(:order, :ship_to_country,
priority_countries=[{:code=>'US',:name=>'United
States'}],{:selected=>'DK',:include_blank=>true},{:style=>'border:10px
solid red;'}) %>

Good Luck

.

Types of Render in Rails

There's many render types that we can use for our view. Rails Render is a strong method that helps you to render your web pages. It comes with many flavors including:

  • Render Action : render an action in the current controller, you can specify if you want layout printed or not.

render :action => "show_home_page", :layout=> false

.

  • Render partial: it renders part of your web page.

render :partial => "left_menu"

.

  • Render template: render a page, the file path is relative to your application.

render :template=> "templates"

.

  • Render file: absolute path is needed

render :file => "#{RAILS_ROOT}/public/file.html"

.

  • Render text

render :text => "You can put any text here"

.

  • Render Json

render :json => {:name => "Teapoci"}.to_json

.


I hope the information above can be useful for you. Thank You.


.

HTML Editor or Rich Text Editor for Your Ruby on Rails Apps

1 . Nice Edit

  • Create your text area in your form_tag range

<%= text_field "demo", "tea_poci", "id"=>"myArea2", :rows=>10, :cols=>22%>

.
  • Create additional button for option of using text editor or not.
<%= submit_tag "Add Editor",:type => 'button', "onclick"=>"addArea2();" %>
<%= submit_tag "Remove Editor",:type => 'button',
"onclick"=>"removeArea2();" %>
  • Put this code under submit_tag "Remove Editor" :
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js">


</script>

<script type="text/javascript">


//<![CDATA[

var area1, area2;

function addArea2() { area2 = new nicEditor({fullPanel : true}).panelInstance('myArea2');}

function removeArea2() { area2.removeInstance('myArea2'); }


bkLib.onDomLoaded(function() { toggleArea1(); });


//]]>


</script>

  • Done !! You can see image below :



2. Textile Editor

  • [~] gem install RedCloth
  • [~] ruby script/plugin install svn://errtheblog.com/svn/plugins/acts_as_textiled
  • [~] script/plugin install http://svn.webtest.wvu.edu/repos/rails/plugins/textile_editor_helper/
  • [~] rake textile_editor_helper:installGo to yor Model / Active Record that is corresponding to your text_area and put :
class MyModel < ActiveRecord
acts_as_textiled :my_text

end

  • Enable your prototype.js.
<%= javascript_include_tag 'prototype' %>
.

  • Here's a short code for your rhtml or html.erb :

<%= textile_editor 'item', 'my_text' -%>
<%= textile_editor_initialize -%>



3. widgEditor

  • Extract the files
  • Copy the widgEditor.js file into your applications public/javascripts folder (you can configure it by changing this file)
  • Copy the widgEditor.css file into your applications public/stylesheets folder.
  • Copy all the images from the widgEditor distribution to your public/images folder.
  • Include the javascript and css files in your layout file.
  • Give any text field you want to be an editor field a class of “widgEditor”.
  • Here's a short code for your view :
<'HEAD'>
<'/HEAD'>
<% form_tag :action => 'what ever' do %>
< %= stylesheet_link_tag 'widgEditor' %>
< %= javascript_include_tag 'widgEditor' %>
< %= text_area 'node', 'content', :cols => "50", :rows=>"3", :class=>"widgEditor" %>
<% end %>
<% end_form_tag %>

List of Websites of Useful Ruby on Rails Tutorials

  1. AJAX powered chat in 3 hours on Ruby on Rails : Tutorial on creating simple Web chatroom
  2. Ajax on Rails : at ONLamp
  3. Beginner’s Guide to Rails, part 1 : series of tutorials at GodBit
  4. Building Ruby, Rails, LightTPD, and MySQL on Tiger : at Hivelogic
  5. Create a To Do List with Ruby on Rails - Beginner’s Tutorial : at thehua
  6. Distributing Rails Applications - A Tutorial : by Erik Veenstra
  7. Fast-track your Web apps with Ruby on Rails : at IBM
  8. Four Days on Rails : Tutorial in PDF at HomeLinux
  9. Getting Your Feet Wet With Ruby on Rails : at Webmonkey
  10. Installing Ruby on Rails with Lighttpd and MySQL on Fedora Core 4 : at DigitalMediaMinute
  11. Instant Rails : preconfigured Rails software
  12. Introduction to Ruby : for Perl programmers at SixBit
  13. Introduction to Ruby for Mac OS X : at IO
  14. Learning Ruby : by Daniel Carrera
  15. Many to Many Tutorial for Rails (PDF) : at JRHicks
  16. ObjectiveView Ruby on Rails Introduction (PDF) : at Ratio
  17. Really Getting Started in Rails : at Slash7
  18. Rolling with Ruby on Rails (Part1) : at ONLamp
  19. Rolling with Ruby on Rails, Part 2 : at ONLamp
  20. Ruby on Rails : at RegDeveloper.co.uk
  21. Ruby on Rails on Oracle: A Simple Tutorial : at Oracle
  22. Ruby on Rails Screencasts : at RubyOnRails
  23. Try Ruby : Try Ruby in the browser at Hobix
  24. Tutorial : a basic tutorial at RubyOnRails
  25. Really Getting Started in Rails : Despite being written back all the way back in January 2005, Amy Hoy’s short and sweet intro still manages to be relevant
  26. Rails for Designers : by Kevin Clark
  27. Ruby QuickRef : quick reference guide.
  28. Ruby Tutorials : at Tutorialized.com
  29. Using Ruby on Rails for Dev on Mac OSX : at Apple
  30. How to Build a Ruby on Rails Engine: In-depth Start-to-Finish Tutorial : at AlterLabs

thanks to : webdeveloper.econsultant.com

Top 29 Websites for Ruby on Rails Demos

  1. Ajax Scaffold : Generates a production ready, fully styled, interface for managing models
  2. AJAX Live Data Grid Example : Data sub-forms at Unspace.ca
  3. CalendarGrid : build output like a calendar at RubyForge.org
  4. CalendarHelper : methods are intended to make the use of the DHTML/JavaScript calendar as easy as possible ; at RubyOnRails
  5. Collaboa : a collaborative tool for developers using Subversion
  6. DynamicCalendarHelper : calendar with CSS ; by Jeremy Voorhis
  7. Eribium : a Rails CMS
  8. Hieraki2 : wiki engine / CMS
  9. HowToUseDragAndDropSorting : How to use drag and drop Sorting ; at RubyOnRails
  10. Instant Rails : Instant Rails is a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all pre-configured and ready to run.
  11. Integrate FCKEditor with your Ruby on Rails application : rich text editor integration ; by Joshua M Charles
  12. Integrating a Rich-text Widget with Struts : rich-text replacement for the textarea ; at OReillyNet
  13. Instiki : wiki clone ; at Instiki.org
  14. LiveTree : JavaScript/DHTML tree widget that loads data asynchronously ; at RubyOnRails
  15. Locomotive : simple tool to help you develop Ruby on Rails applications on Mac OS X
  16. LoginGenerator : add authentication, users, and logins to your rails app ; at RubyOnRails
  17. Movtable : sort table
  18. Open Source Ruby On Rails Shopping Cart : e-commerce platform at SubImage
  19. PaginationHelper : aids the process of paging large collections of Active Record objects ; at RubyOnRails
  20. Progress Bars with GD2 and Ruby : progress bars ; at Husney
  21. rmagick : file/image uploading ; at BigBold
  22. RubyInstaller : This is a “one-click”, self-contained Windows installer that contains the Ruby language itself, dozens of popular extensions and packages, a syntax-highlighting editor and execution environment ; at RubyForge
  23. Simple Ticket : trouble ticket system written using Ruby
  24. SortHelper 1 : SortHelper will create links for your users to sort tables.
  25. SortHelper3 : Helper to sort tables or result sets using clickable column headers.
  26. Substruct : The first and only Ruby on Rails open source e-commerce project.
  27. TinyFile : basic file uploads in a rails app
  28. Typo : Ruby blogging software.
  29. WebDAV Ruby On Rails Plugin : create Ruby On Rails controllers which will respond to WebDAV requests

Thanks to : webdeveloper.econsultant.com

List of request params

@request.env["name_of_params_object"]
.




source : http://wiki.rubyonrails.org/rails/pages/variablesinrequestenv

.

Pictures of VIP or Business Class from Any Airlines

click image to enlarge









Compare your face to celebirty face

Hey Guys,

This web is very fun and really can let your stress turn off. This site can compare your face to celebrity face and get your ancestor trough genealogy method.

To compare your face to celebrity, you can go here :
http://www.myheritage.com/FP/Company/tryFaceRecognition.php

Step 1:
click picture to enlarge

Step 2 :
click picture to enlarge



I dont want my handsome face like him

Create Photo Gallery less than 10 MINUTES

There's many ways to create photo gallery, i want share my experience with very instant photo gallery. Begginer or advance can do it, it's easy. I am using windows OS, Ruby ruby 1.8.5. Let's Start your ruby

  • Step 1 : Download Rmagick(2.3.0) & imageMagick(6.4.0) in 1 Package Here (Download Package).
if you use linux, install imageMagick Library (sudo apt-get install libmagick9-dev) and then install rmagick (sudo gem install rmagick), after that skip step 2.
  • Step 2 : extract package to /ruby/your_app/tmp, make sure that rmagick-2.x.x.tar.gz and rmagick-2.x.x-x86-mswin32.gem are in that tmp folder. After that run it:
gem install rmagick --local
.
  • Step 3 : Install attachment_fu plugin
ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/attachment_fu/
  • Step 4 : Generating the Scaffolding Code
ruby script/generate scaffold_resource Gallery
.
  • Step 5 : Create Gallery Table for DataBase or Gallery Migration, open your db/migrate/001_create_galleries.rb, then insert it :
class CreateGalleries < Migration
t.column :filename, :string, :limit => 255
t.column :path, :string, :limit => 255
t.column :parent_id, :integer
t.column :thumbnail, :string, :limit => 255
t.column :size, :integer
t.column :width, :integer
t.column :height, :integer
end
end

def self.down
drop_table :galleries
end
end
  • Step 6 : After that run this command : rake db:migrate
  • Step 7 : Set up your picture size, open app/models/gallery.rb
class Gallery < ActiveRecord

has_attachment :storage => :file_system,
:resize_to => '>550x>413',
:thumbnails => { :thumb => '>100x>75'},
:size => 0.megabyte..3.megabytes,
:content_type => :image,
:processor => 'Rmagick'
validates_as_attachment


end

  • Step 8 :Edit your controller gallery_controller.rb
def index

@gallery_pages = Paginator.new(self, Gallery.find(:all).count, 5, params[:page])
@photos = Gallery.find(:all, :order => 'created_at DESC', :limit => @gallery_pages.items_per_page, :offset => @gallery_pages.current.offset)

respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @gallery.to_xml }
end
end


def create

@gallery = Gallery.new(params[:gallery])
@galleries = Gallery.find(:all)

respond_to do |format|

if @galleries << @gallery flash[:notice] = 'Gallery was successfully created.' format.html { redirect_to(@gallery) } format.xml { render :xml => @gallery, :status => :created, :location => @gallery }
else
format.html { render :action => "new" }
format.xml { render :xml => @gallery.errors, :status => :unprocessable_entity }
end
end
end
  • Step 9 :Edit your uploading form to your new.rhtml
<%= error_messages_for :photo %>
<% form_for(@gallery,
:html => { :multipart => true }) do |f| %>

select a photo to upload

title:
<%= f.text_field 'title' %>

Description:
<%= f.text_area 'body', :rows => 6, :cols => 40 %>

Photo:
<%= f.file_field 'uploaded_data' %>

<%= submit_tag 'Upload Photo' %> or <%= link_to 'Cancel', galleries_path %>
<% end %>

  • Step 10 : Activate your server and run your application.

If you got error or problem please give me feedback. Enjoy and good luck.


.

 
powered by Blogger