Most people when doing any kind of presentation that use slide, prefer to use a wired or wireless mouse to control the flow of this presentation.
Others prefer to ask some one to control it and have to make some kind of sign during the presentation to ask for the next slide (in my last experience the sign was: next slide please!).
I use my cell phone to control my presentations, using this great piece of free software: mOOo Impress Controller
The Software was developer using:
What do you need to play with it?
Mobile:
Desktop:
Ok, it is cool, but what are the real benefits of it?
Think about, when people see that you are using your cell phone to control the presentation, you can talk about any shit, they wont hear you, they will be looking at your cell phone ![]()
Well, at least if your public is not reading it right now
I tested it here and it just worked like a charm!
After you test it, please give the developers some feedback using this form, event if it did not worked within your environment, this will help them a lot to improve this very cool thing
If you enjoyed this post, make sure you subscribe to my RSS feed!
Tags: bluetooth, cool factor, freeware, mobile, openoffice, opensource, presentation
As stated in the title: What do you think about turning your rails application into an executable? For example to show it to a client that has no environment (ruby, database) installed?
I just found that it is possible
To start we will need the following tools:
Let’s install them:
$sudo gem install tar2rubyscript $sudo gem install rubyscript2exe
Now let’s create a Ruby On Rails application, and as we want to carry everything with us, we will use the SQLite3 database (that way the client does not need to have a database server).
$rails demo $cd demo $ruby script/server
Now test the application pointing your browser to the address: http://localhost:3000/.
$irb
irb(main):005:0> require 'sqlite3'
irb(main):006:0> SQLite3::Database.new("demo_dev.db").execute(
irb(main):007:1* "create table books (id integer primary key,
irb(main):008:1" title varchar(255),
irb(main):009:1" author varchar(255));")
And now we copy the database to the production and test environments:
$cp demo_dev.db demo_test.db $cp demo_dev.db demo_prod.db
$vi config/database.yml
Replace the content of this file with something like this:
development: adapter: sqlite3 database: demo_dev.db test: adapter: sqlite3 database: demo_tst.db production: adapter: sqlite3 database: demo_prd.db
Let’s create the model and the controller:
$script/generate model Book $script/generate controller Book $vim app/controllers/book_controller.rb
And now lets change the controller code to something like this:
class BookController < ApplicationController scaffold :book end
$script/server
Now try this address in your browser to make sure it is working http://localhost:3000/book.
Now the real tip (Now talking serious, even my cat knows how to create a CRUD with scaffold
)
The Tar2RubyScript command creates a package for the application, but when it is executed , it unpacks every thing in a temporary directory and after the execution it cleans the temporary directory again. This is not exactly the behavior we wait for a database, so let’s move the database to a secure place before the execution…
$vi config.environment.rb
Let’s add the following code to the begining o the file:
module Rails
class Configuration
def database_configuration
conf = YAML::load(ERB.new(IO.read(database_configuration_file)).result)
if defined?(TAR2RUBYSCRIPT)
conf.each do |k, v|
if v["adapter"] =~ /^sqlite3/
v["database"] = oldlocation(v["database"]) if v.include?("database")
v["dbfile"] = oldlocation(v["dbfile"]) if v.include?("dbfile")
end
end
end
conf
end
end
end
It will change the way Rails looks for the database, it originally was this way:
module Rails
class Configuration
def database_configuration
YAML::load(ERB.new(IO.read(database_configuration_file)).result)
end
end
end
What exactly we did? When a RBA (Ruby Archive) is executed, it needs to handle two diferent directories, the one where the application is running (temp directory) and the one where the application really is, referenced by “oldlocation”. The presented code changed the configuration inside the database.yml file, pointing the databases to the full path to the database files (where the application really is), this way we do not loose the data after the end of the application.
The Tar2RubScript needs a file called init.rb, what will be the entry point to the application, so let’s create it with the following code:
$vi init.rb
at_exit do require "irb" require "drb/acl" require "sqlite3" end load "script/server"
The ‘require’ in the beginning are there just to make the script’s work a little easier, and the load “script/server” will start the Rails server (WEbrick or mongrel depending on your environment).
Now lets create the application package:
$cd .. $tar2rubyscript demo $cp demo/demo_* .
Almost ready, now we can test our Ruby Archive with the following command:
$ruby demo.rb
And again, test your application with the following URL: http://localhost:3000/book
Creating an executable to carry with you in your flash drive (outside Brazil it is called pendrive too?)
Creating the executable is very simple, you just need to run this command line:
$rubyscript2exe demo.rb
After the rails application starts up, navigate a little within your application and then press CTRL+C, it will create a file names demo.exe, or demo_linux if you are running a linux box like me.
Now just copy the generated file and the database file to your flash drive and run it on your friends computer of your client meeting to make some money
When you get in the meeting you do not need to install Ruby, RubyGems, Rails, and other Gems, …
Just an executable file and some database files and you are ready to demo your application to clients and friends
What do you want better than that?
Talking the truth, I still want the possibility to create windows executables into my Linux box, but it still a very good solution
If you enjoyed this post, make sure you subscribe to my RSS feed!
Tags: presentation, rails, ruby, rubyscript2exe, tar2rubyscript, tips