Ruby
-----------------------------
to check the path of the ruby
which ruby
/usr/bin/ruby
-------------------------------
If you executing ruby from shell script
go to vi mode ......and then type the programme and save it in .rb The file name should have extension of .rb and save it any where in !
vi trial.rb
#!/usr/bin/ruby
./trial.rb
--------------------------------
If you executing ruby from normal mode
vi trial.rb (assume that we save in desktop or file system )
ruby trial.rb (to compile the ruby code)
---------------------------------
comments in ruby
single line comment
#This is the single line comment in ruby
multiple line comment
==begin
to start with multiple line comment we have to start ==begin from beggining and ==end from ending
==end
----------------------------------
declaring variables in ruby
a=10
b=10
c=10
parallel way of assigning variables in ruby
a,b,c,d=10,20,30,45
------------------------------------
to know the what type of variables in ruby
a=25
b=45.0
c="welcome"
a.class()
b.class()
c.class()
to check whether it is integer/float/string
a.kind_of? Integer
b.kind_of? String
----------------------------------------
converting variables values
y=20
y.to_s #it converts to string
y.to_f #it converts to float
to convert the integer binary
y.to_s(2) #converts to binary base 2
y.to_s(8) #converts to base 8 (octal)
y.to_s(16) #converts to base 16(Hexa decimal)
--------------------------------
variable scope in ruby
ruby has 5 types of variable scope in ruby
$ --global variable
@-- instance variable
a-z--local variable
A-Z-- constant variable
@@---class variable
to know the type of the variable in ruby
defined? ($x or @x or x or @@x)
hi to all am kiran today our chandrashekar sir told the project details and start the session how the software software development life cycle SDLC concepts and how to implement agile development
Monday, November 29, 2010
Friday, November 26, 2010
Ruby with mysql
today
thiyagu
sir told the difference between ruby using ordinary mysql
and Ruby using ORM(object Relational Mapping)
create a database called student
Ruby code to access the table rubyists (ORM using Ruby)
i wondered here sql function not using anywhere in this programme
Let's write a Ruby program and name it as db_connect.rb
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:database => "students"
class Rubyist < ActiveRecord::Base
end
Rubyist.create(:name => 'Luc Juggery', :city => "Nashville, Tenessee")
Rubyist.create(:name => 'Sunil Kelkar', :city => "Pune, India")
Rubyist.create(:name => 'Adam Smith', :city => "San Fransisco, USA")
Then sir also told the ordinary way of connecting this programme through mysql
thiyagu
sir told the difference between ruby using ordinary mysql
and Ruby using ORM(object Relational Mapping)
create a database called student
Ruby code to access the table rubyists (ORM using Ruby)
i wondered here sql function not using anywhere in this programme
Let's write a Ruby program and name it as db_connect.rb
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:database => "students"
class Rubyist < ActiveRecord::Base
end
Rubyist.create(:name => 'Luc Juggery', :city => "Nashville, Tenessee")
Rubyist.create(:name => 'Sunil Kelkar', :city => "Pune, India")
Rubyist.create(:name => 'Adam Smith', :city => "San Fransisco, USA")
Then sir also told the ordinary way of connecting this programme through mysql
SLASHPROG TECHNOLOGIES
//started project in slashprog technologies //
monday---------------our sir introduces what are all the modules can be coming in our website
we started our ideas about our website details
who we are ...what we doing for website
in three ways we focus on our site
1) trainers side
2) client side
3) vendors side
tuesday-----------------we discussed what technology we going to be use a little argument whether we use jquery and Dojo
finally we decided with Dojo ...its an powerful opensource tool to develop javascript ajax based
applications Dojo advantage is it is compatible with all modern browsers it even work if javascript
not enabled in client side browsers...as a developer we knowing of just html and javascript is enough
not to know new language ...
wednesday -------------
Our team members are
Rajeswari
Yogesh kannan
rakesh
suresh
Rama chandran
and me
we started learning little about ..Dojo just to create a button and checkbox .....we need to install Dojo
and extract zip/tar file and untar it .....we get the files as dojo,digit,dojox,util these 4 files we save it in
js files so the path will be like this
under that js/digit
js/dojo
js/dojox
js/util
writing an application is easy its simple and straight forward ......
just load the dojo library in javascript
-------------------------------------------------------------------------------------
Thursday
we go through and play around some snippets of code in Dojo ..its fun and interesting we and our team members create some small small applications integrate and
finally created a login page and registration page for trainers module ..
we included the library stackcontainer in dojo to get the diaogue box and we created nearly 6 steps to register the trainers form
------------
Friday
our Sir gave introduction about UI flow diagram we discusses what are all the tools to implement whether code ignitor or CakePHP !
sir said how to play with www.960gs.com
and www.balsamiq.com
www.oswd.org
we discussed how the home page of our website look like the features were we include and disable we discussed
-------------------
saturday
saturday sir told what is mysql and how we connect mysql to php and how to create simple database and
to start mysql
just type mysql; it will start mysql in any
------------------------------------------------------
//****Trainers Home Page ***//
1) client requirements matching his skill
2) calendar
3) Update Profile
4)(client/vendor rate )--confidential
5) visitors
6) news ---< 1) location
2) whether
7)Training Statistics
8) Last minute update
9) Payment History *(Only trainer can view )
10)Share his experience
11)Articles/blog
12)How to colloborate with other trainers ?
13) Approve Client request ---------< 1) through vendor
2) Direct Client
14) Interact with Client/Vendor
----> Invoice
----> Training Prerequisites/resources
----> Feedback
Today we learning some basic exercises in ruby
#programme to find vowels in a file
vowels =%w[a e i o u]
count =0
open("a.txt","r").each do |line|
line.split(//).each do |character|
if vowels.include?character
count +=1
end
end
end
print "no of words #{count}"
------------------------------------------------------------
26/11/2010
[Friday]
Today i learning ruby myself practicing small exercises like how to declaring an array in ruby
x=["john","smith","joe","adam"]
x.each{ |i| puts i }
--------------------------------------------
pop it deletes the last element in array
x=["john","smith","joe","adam"]
x.pop
-----------------------------------------
to insert the elements from the beginning of the array
x=["array","range","rahul","sonia"]
x.pop
x.unshift("nickson")
puts x
---------------------------------------------
push to insert the elements in the end of the array
x=["array","range","rahul","sonia"]
x.push("nickson")
puts x
------------------
Deletes the first element of the array
x=["array","range","rahul","sonia"]
x.shift()
puts x
monday---------------our sir introduces what are all the modules can be coming in our website
we started our ideas about our website details
who we are ...what we doing for website
in three ways we focus on our site
1) trainers side
2) client side
3) vendors side
tuesday-----------------we discussed what technology we going to be use a little argument whether we use jquery and Dojo
finally we decided with Dojo ...its an powerful opensource tool to develop javascript ajax based
applications Dojo advantage is it is compatible with all modern browsers it even work if javascript
not enabled in client side browsers...as a developer we knowing of just html and javascript is enough
not to know new language ...
wednesday -------------
Our team members are
Rajeswari
Yogesh kannan
rakesh
suresh
Rama chandran
and me
we started learning little about ..Dojo just to create a button and checkbox .....we need to install Dojo
and extract zip/tar file and untar it .....we get the files as dojo,digit,dojox,util these 4 files we save it in
js files so the path will be like this
under that js/digit
js/dojo
js/dojox
js/util
writing an application is easy its simple and straight forward ......
just load the dojo library in javascript
-------------------------------------------------------------------------------------
Thursday
we go through and play around some snippets of code in Dojo ..its fun and interesting we and our team members create some small small applications integrate and
finally created a login page and registration page for trainers module ..
we included the library stackcontainer in dojo to get the diaogue box and we created nearly 6 steps to register the trainers form
------------
Friday
our Sir gave introduction about UI flow diagram we discusses what are all the tools to implement whether code ignitor or CakePHP !
sir said how to play with www.960gs.com
and www.balsamiq.com
www.oswd.org
we discussed how the home page of our website look like the features were we include and disable we discussed
-------------------
saturday
saturday sir told what is mysql and how we connect mysql to php and how to create simple database and
to start mysql
just type mysql; it will start mysql in any
------------------------------------------------------
//****Trainers Home Page ***//
1) client requirements matching his skill
2) calendar
3) Update Profile
4)(client/vendor rate )--confidential
5) visitors
6) news ---< 1) location
2) whether
7)Training Statistics
8) Last minute update
9) Payment History *(Only trainer can view )
10)Share his experience
11)Articles/blog
12)How to colloborate with other trainers ?
13) Approve Client request ---------< 1) through vendor
2) Direct Client
14) Interact with Client/Vendor
----> Invoice
----> Training Prerequisites/resources
----> Feedback
Today we learning some basic exercises in ruby
#programme to find vowels in a file
vowels =%w[a e i o u]
count =0
open("a.txt","r").each do |line|
line.split(//).each do |character|
if vowels.include?character
count +=1
end
end
end
print "no of words #{count}"
------------------------------------------------------------
26/11/2010
[Friday]
Today i learning ruby myself practicing small exercises like how to declaring an array in ruby
x=["john","smith","joe","adam"]
x.each{ |i| puts i }
--------------------------------------------
pop it deletes the last element in array
x=["john","smith","joe","adam"]
x.pop
-----------------------------------------
to insert the elements from the beginning of the array
x=["array","range","rahul","sonia"]
x.pop
x.unshift("nickson")
puts x
---------------------------------------------
push to insert the elements in the end of the array
x=["array","range","rahul","sonia"]
x.push("nickson")
puts x
------------------
Deletes the first element of the array
x=["array","range","rahul","sonia"]
x.shift()
puts x
Tuesday, November 23, 2010
Subscribe to:
Posts (Atom)