For displaying list of running programs in panel (top or bottom), right click at panel
1. Select “Add to panel”
2. Search and select for “Window list” and add it.
For displaying list of running programs in panel (top or bottom), right click at panel
1. Select “Add to panel”
2. Search and select for “Window list” and add it.
Do you want to replace http://localhost/code/index.php/welcome/ to http://localhost/code/welcome/
So simple. Follow the rules below.
Create .htaccess file in root directory.
‘code’ is root directory
gedit code/.htaccess
And then add the below rules to that.
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
http://localhost/code/welcome/
Done
Why mongodb? My views on mongodb. Please share your views as comments.
1. Mongodb is open source database written in C++. It has drivers for most of programing
language Python, Ruby ( I am going to use ), Java etc.
2. Mongodb is not relational database like mysql, it is document oriented database
(NOSQL).
3. Data Storage: Relational database saves datas (columns) record in table (rows). But in
mongodb, it is document oriented, data are stored as JSON format (BJSON – Binary json).
Documents are like database and collection are like tables. Data can be accessed as
key-value. So it is very fast and reliable.
4. It does not have joins like RDBMS, it uses linking and embedding technique. So it does even
complex query faster.
Mr. Thyagarajan Shanmugam, CEO of open vidhya (my mentor) conducted workshop in Coimbatore institute of technology on September 1st and 2nd 2012. He took class on PHP and Ruby. Some basic on Ruby on rails. Students in CIT were eager in learning new technology. Me also helped some students by clearing some doubts. Here are some clicks http://openvidya.fossfactory.in/workshops/index.php/Workshop-on-Web-programming-with-Foss-Tools-CIT-coimbatore
Code was written in ruby,
Database: sqlite3
Download Files here
File: word.rb
Connecting database using sqlite3 adbapter and active_record ORM.
File: install.sh [only for debian package]
run install.sh
$sh install.sh
Others should install
ruby, rubygems
gems: sqlite3, active_record, nokogiri
File: upload.rb
You dont need to run this script. if you have word.db file. This ruby program scraps
all word and meaning from http://ta.wiktionary.org/wiki/%E0%AE%AE%E0%AF%81%E0%AE%A4%E0%AE%B1%E0%AF%8D_%E0%AE%AA%E0%AE%95%E0%AF%8D%E0%AE%95%E0%AE%AE%E0%AF%8D
and save into sqlite database.
File: word.db
This is database of all words and meanings which was saved by upload.rb script.
This application has autocomplete functionality.
This is first version of script. code was in repo, url: https://github.com/sathia27/dictionary
Feel free to edit the code. You can change to any languange instead of tamil by making some changes to upload.rb.
How to run
After installation,
Go to that folder and run dict.rb
$cd dictionary $ruby dict.rb
Screenshots
Hi friends,
Started creating translator script in ruby,
which will convert to english document file to tamil pdf file.
Main idea of script is to convert English pdf to Tamil Pdf
So its easy to translate e-book easily to our mother tongue language.’
I just now started with tamil font. This will translate English doc to
Tamil using google translator http://translate.google.com/
Current Status:
*Now it gets .doc extension file from user and it converts to tamil pdf.
Need to changed as English pdf to Tamil pdf.
Note: It has many grammar mistakes while translating. and this is translated to tamil by http://translate.google.com/ Code was in github account : https://github.com/sathia27/Translate-script
If you like to start working in this code. You can take code form github acconut.
If you feel any good method other than this, Please give me suggestion.
Thank you in advance.
#!/usr/bin/env ruby
=begin
Program name: Translation script
Date Written: 05/12/2011
Date Modified: 05/12/2011
Author : Sathianarayanan.S
License: GPL2.0
Version: 1.0
=end
begin
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'net/http'
require 'uri'
require 'prawn'
if ARGV[0]
puts "converting file '"+ARGV[0]+"' to tamil version!!!"
resume = File.open(ARGV[0]);
total_text = ""
resume.each do |str|
total_text += str
end
page = Nokogiri::HTML(open(URI.parse(URI.encode("http://translate.google.com/?langpair=en|ta&text=#{total_text}"))))
puts resume.readlines
result = page.search("#result_box")
Prawn::Document.generate("output.pdf") do
font "ttf-tamil-fonts/TAMu_Kalyani.ttf"
text result.text, :size => 20
end
else
puts "Enter file name. Filename can be .doc or .txt \n[Usage] ruby translate.rb filename.doc"
end
end
Simple Installation:
sudo apt-get install python-setuptools
sudo apt-get install python-beautifulsoup
Download code from github https://github.com/sathia27/e2t-dictionary
.Save code in file. then run below code. and then run code.
python tamildict.py
Features:
Bugs:
Code:
#!/usr/bin/python2.4
# coding=UTF-8
import urllib2
from BeautifulSoup import BeautifulSoup
import re
import codecs
try:
def alphabets():
while True:
try:
alphabet = raw_input("Enter the alphabet(eg. 'a' or 'b' to get all words.. Type 'quit' for quiting+): ")
if alphabet == "quit":
print "\nQuiting!!!\n"
break
url = "http://ta.wiktionary.org/wiki/சிறப்பு:PrefixIndex/"+alphabet
req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})
con = urllib2.urlopen( req )
soup = BeautifulSoup(con)
all_words = soup.find("table", {"id" : "mw-prefixindex-list-table"}).findAll("a")
print "="*40
print "Words listed for Alphabet %r" %alphabet
print "="*40+"\n"
for i in all_words:
print i.contents[0]
except KeyboardInterrupt:
print "\n\nQuitting!!"
break
except:
print "Sorry!! given alphabet %r not found" %alphabet
print " or some internet connection!!"
def words():
while True:
try:
word = raw_input("Enter the word:")
url = "http://ta.wiktionary.org/wiki/"+word
print url
req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})
con = urllib2.urlopen( req )
soup = BeautifulSoup(con)
meaning_of_word = soup.find("div", {"class":"mw-content-ltr"})
ul = meaning_of_word.findAll("ul")[1]
f = open("temp","w")
for li in ul.findAll(text=True):
print li
except KeyboardInterrupt:
print "\n\nQuitting!!"
break
except:
print "Sorry!! given word %r not found" %word
print " or some internet connection!!"
c = raw_input("Enter \n '1' for see all words for given alphabets \n '2' to get meaning of word in tamil\nEnter choice: ")
if c == "1":
alphabets()
if c == "2":
words()
except KeyboardInterrupt:
print "\n\nQuitting!!"
Output
TBus is script used to see bus routes inside cities.
Now this script is available for cities of bangalore and chennai.
Installation
sudo apt-get install ruby libxml2 libxml2-dev libxslt-dev ruby-dev
sudo apt-get install rubygems
sudo gem install nokogiri
code for TBus:
#!/usr/bin/env ruby
=begin
Program name: Lbus
Date Written: 06/09/2011
Date Modified: 06/09/2011
Author : Sathianarayanan.S
License: GPL2.0
Version: 1
=end
begin
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'net/http'
require 'uri'
puts 'Note: TBUS script. "x" in result denotes high frequency bus...'
print "Enter the city. enter \n '1' for chennai and \n '2' for bangalore \nchoice:"
city = gets.chomp
if city == "1"
print "Searching chennai..."
else
print "Searching bangalore.."
end
case city
when "1"
page = Nokogiri::HTML(open("http://en.wikipedia.org/wiki/List_of_MTC_Chennai_bus_routes"))
when "2"
page = Nokogiri::HTML(open("http://en.wikipedia.org/wiki/List_of_Metropolitan_bus_routes_in_Bangalore"))
end
while true
print "\nSource: "
source = gets.chomp
print 'Destination: '
destination = gets.chomp
source_up = source.capitalize
source_low = source.downcase
destination_up = destination.capitalize
destination_low = destination.downcase
result = page.search('table.wikitable tr')
result.each do |nodes|
if (nodes.to_s.include?(source_up) || nodes.to_s.include?(source_low)) && (nodes.to_s.include?(destination_up) || nodes.to_s.include?(destination_low))
puts nodes.content
puts '====================================='
end
end
end
rescue Interrupt
puts "\nQuitting.."
end
Output:
sathia@sathia27 ~/Desktop $ ruby tbus.rb
Enter the city. enter
’1′ for chennai and
’2′ for bangalore
choice:1
Searching chennai…
Source: villivakkam
Destination: adyar
47
Adyar
Villivakkam VIA T.NAGAR
x
=====================================
47B
Besant Nagar
Villivakkam Via Avvai Home, Adyar B.S,T.Nagar,Anna Nagar
=====================================
Source:
Hi .
Easily browse for meaning of words from terminal, than searching for word in dictionary or searching in internet (dont waiting for word till whole page loads). This script scraps word form http://dictionary.reference.com .
Dependencies:
ruby, rubygems, mechanize(gem).
we can have multiple search or one way search
Eg. dict.rb embattled
or run dict.rb and search for unlimitted words.
Note: It works with internet only.
#!/usr/bin/env ruby
=begin
Program name: Easy Dictionary
Date Written: 04/09/2011
Date Modified: 04/09/2011
Author : Sathianarayanan.S
License: GPL2.0
Version: 1.1
=end
begin
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
page = agent.get("http://dictionary.reference.com/")
puts 'Powered by Dictionary.com (dictionary.reference.com)'
puts "\n"
puts 'searching....'
puts "=========================================================================\n"
if ARGV[0]
word = ARGV[0]
end
while true
unless ARGV[0]
print "Enter the word: "
word = gets.chomp
end
form = page.forms.first
form.q = word
system("espeak #{word}")
page = agent.submit form
meanings = agent.page.search('.lunatext .body .luna-Ent')
if meanings.empty?
puts 'No results'
else
meanings.each do |meaning|
puts meaning.text
end
end
puts '=================================================================='
if ARGV[0]
break
end
end
rescue SocketError
puts 'Internet connection failed!!'
rescue Interrupt
puts 'Quiting!!!'
end
Usage:
sathia@sathia27 ~/Desktop $ ruby dict.rb embattled Powered by Dictionary.com (dictionary.reference.com) searching.... ========================================================================= 1.disposed or prepared for battle. 2.engaged in or beset by conflict or struggle. 1.to arrange in order of battle; prepare for battle; arm. 2.to fortify (a town, camp, etc.). to furnish with battlements. ================================================================== sathia@sathia27 ~/Desktop $
OR
sathia@sathia27 ~/Desktop $ ruby dict.rb Powered by Dictionary.com (dictionary.reference.com) searching.... ========================================================================= Enter the word: embattled 1.disposed or prepared for battle. 2.engaged in or beset by conflict or struggle. 1.to arrange in order of battle; prepare for battle; arm. 2.to fortify (a town, camp, etc.). to furnish with battlements. ================================================================== Enter the word:
In previous post, when I run gplus script it will display
the stream from circle we mentioned in command
eg. ruby gplus.rb username password circle_name
In this version , It will prompt for username and password .. and it displays all circle names of
current user .. and we can see streams of any circle shown
Dependencies:
ruby, rubygems, mechanize(gem), highline (gem for secure password)
=begin
Program name: Gplus script
Date Written: 16/08/2011
Date Modified: 17/08/2011
Author : Sathianarayanan.S
License: GPL2.0
Version: 1.1
=end
begin
require 'rubygems'
require 'mechanize'
require "highline/import"
print "Enter your username: "
username = gets.chomp
password = ask("Enter the password :" ) { |p| p.echo = "*" }
password = password.chomp
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
page = agent.get("https://www.google.com/accounts/ServiceLogin?service=oz&continue=https://plus.google.com/?gpcaz%3D94cd3e2c<mpl=es2st&hideNewAccountLink=1&hl=en-GB")
puts 'Logggig....'
puts "=========================================================================\n"
form = page.forms.first
form.Email = username
form.Passwd = password
page = agent.submit form
circles = agent.page.search('#content .c-j.a-nb-j.a-nb-Jh-j')
puts 'Streams:'
i = 1
circles.each do |circle|
puts i.to_s+') '+circle
i+=1
end
puts "=========================================================================\n"
while true
print "Enter circle: "
circle_name = gets.chomp
page = agent.page.link_with(:text => circle_name).click
streams = page.search('#contentPane div.sj')
i = 1
streams.each do |stream|
if stream.text != ''
puts i.to_s+') '+stream.search('span.kh').text+' shared:'
puts stream.search('div.eo').text
else
puts i.to_s+') '+'Video/photos...'
end
puts ''
i+=1
end
puts "=========================================================================\n"
end
rescue SocketError
puts 'Error in internet connection'
rescue NoMethodError
puts 'Invalid username or password or circle'
rescue Interrupt
puts "\n========================================================================="
puts "\nQuiting...."
end