Using the bellow mechanisum, java applet can load jar file that locate in your local machine. This may very usefull when applet size is huge and applet have modules. By using this technique applet modules can load as jar files from the local machine.
CustomClassLoader.java
public class CustomClassLoader extends URLClassLoader {
public CustomClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
}
//You can set required permission for load jar file, by overriding bellow method
@Override
protected PermissionCollection getPermissions(CodeSource codesource) {
PermissionCollection perms = super.getPermissions(codesource);
perms.add(new java.lang.reflect.ReflectPermission("*", "read,write"));
}
}
............Try to load jar file from applet............
try {
// applet class loader try to load a class in the local machine jar file.
//but applet couldn't find this class inside the applet and throws Exception.
Class c = this.getClass().getClassLoader().loadClass("class_name");
Object loadClass = c.newInstance();
}
catch (ClassNotFoundException ex) {
try {
//location of the jar file
String jarpath = "jar_file_path";
URL jarfile = new URL("jar", "", "file:" + jarpath + "!/");
//Initialize the custom class loader
CustomClassLoader cl = new CustomClassLoader(new URL[]{jarfile}, Thread.currentThread().getContextClassLoader());
//load the class using custom class loader
Class c = cl.loadClass(implClass);
loadClass = c.newInstance();
}
catch (Exception e) {
}
}
Tuesday, June 14, 2011
Sunday, June 6, 2010
Use of face detection technique for power saving of a PC
Face detection is already solved problem area in computer vision. So face detection can be use to many application areas. In here I use face detection technique for power saves of a personal computer (PC). Computer monitor is the most power consuming part of a PC. So we can save lot of power if we can switch off the monitor when we go away from the computer. I did this task by automatically using face detection technique. In this program when we go away from the computer program can’t detect a human face. So it pass signal to the monitor for switch off. When we again come back program can detect a face so then it pass signal to the monitor for switch on. For this we only need a normal web camera no other additional hardware need for that. Bellow video shows how it is works.
Sunday, May 30, 2010
Real Time Sign Language Recognition System
These days i'm working on my final year project. I have been developed gesture and posture recognition system that is able to recognize the sign language and give the output. This system is fully automatic and work in real time. I used OpenCV (Open Source Computer Vision Library) with visual c++ for implement that system. In this system current frame rate is 20 frames/sec. Advantages of that system are no needing too much worry about the background and also no need to ware gloves for hands. In currently this system recognize 5 signs with 90-95% accuracy in the good lighting condition. When the lighting condition became bad recognition rate also rapidly goes down. And also problem can happen when skin-like colors present at the background. Those are the limitations of that system.
Monday, March 22, 2010
Configure OpenCV with Visual Studio 2008 in Windows Xp
These days I'm working on my final year project 'Real Time Sign Language recognition system' .I get the input from using a normal web camera and system will identify the hand posture or gesture.So in here i have to deal with technologies like Computer Vision,Image Processing and Machine Learning.Then I found a very powerful very powerful computer vision Library called OpenCV (Open Source Computer Vision).OpenCV library written mainly in C that focuses on real time video processing.In this post is about how to Install OpenCV in windows XP machine and and how to configure Opencv with Visual studio 2008
1. Download the openCV
OpenCv is available at http://sourceforge.net/projects/opencvlibrary/. For may project im using openCV 1.0. To download OpenCV 1.0 click 'View all Files' and then u can Download openCV 1.0 for windows.

2.Install Opencv

After install the openCV make sure that to set System Properties->Environment Variable-> Path to the bin folder in OpenCV

After that restart Your machine
Then go to ..OpenCV\samples\c folder.Then you can see lot of samples their.Try to run those samples.If those samples are run without an error your openCV installation is successful.
3. Opencv Configure with Visual Studio 2008
Create new Win32 Concole application.

Go to Properties

In the Project Properties Page go to Configuration Properties -> C/C++ ->General

To set 'Additional Include Directories' copy and paste the following text:
"C:\Program Files\OpenCV\cxcore\include";"C:\Program Files\OpenCV\cv\include\";"C:\Program Files\OpenCV\cvaux\include";"C:\Program Files\OpenCV\otherlibs\highgui"
Change above according to your installation path
Next Project Properties Page go to Configuration Properties -> Linker ->Inputs

To set 'Additional Dependencies' copy and paste following text:
"C:\Program Files\OpenCV\lib\cv.lib" "C:\Program Files\OpenCV\lib\cvaux.lib" "C:\Program Files\OpenCV\lib\cxcore.lib" "C:\Program Files\OpenCV\lib\highgui.lib"
In here is space separation, Instead of above semicolon (;) seperation
Now your all configuration is finish.Then you can copy source code from samples folder and and run in the Visual Studio 2008 environment
1. Download the openCV
OpenCv is available at http://sourceforge.net/projects/opencvlibrary/. For may project im using openCV 1.0. To download OpenCV 1.0 click 'View all Files' and then u can Download openCV 1.0 for windows.
2.Install Opencv
After install the openCV make sure that to set System Properties->Environment Variable-> Path to the bin folder in OpenCV
After that restart Your machine
Then go to ..OpenCV\samples\c folder.Then you can see lot of samples their.Try to run those samples.If those samples are run without an error your openCV installation is successful.
3. Opencv Configure with Visual Studio 2008
Create new Win32 Concole application.
Go to Properties
In the Project Properties Page go to Configuration Properties -> C/C++ ->General
To set 'Additional Include Directories' copy and paste the following text:
"C:\Program Files\OpenCV\cxcore\include";"C:\Program Files\OpenCV\cv\include\";"C:\Program Files\OpenCV\cvaux\include";"C:\Program Files\OpenCV\otherlibs\highgui"
Change above according to your installation path
Next Project Properties Page go to Configuration Properties -> Linker ->Inputs
To set 'Additional Dependencies' copy and paste following text:
"C:\Program Files\OpenCV\lib\cv.lib" "C:\Program Files\OpenCV\lib\cvaux.lib" "C:\Program Files\OpenCV\lib\cxcore.lib" "C:\Program Files\OpenCV\lib\highgui.lib"
In here is space separation, Instead of above semicolon (;) seperation
Now your all configuration is finish.Then you can copy source code from samples folder and and run in the Visual Studio 2008 environment
Tuesday, October 20, 2009
Ralis 2.2 with mysql Resolved errors
When you work in Rails 2.2 , with mysql you may get following error after installing mysql driver and trying to run the project.
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install
the mysql gem and try again: gem install mysql.
rake aborted!
126: The specified module could not be found. - C:/Ruby/lib/ruby/gems/1.8/gems
/mysql-2.8.1-x86-mswin32/lib/1.8/mysql_api.so
The problem for above error is, MySQL 5.1 client library doesn't play well with Rails.
Solution is
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install
the mysql gem and try again: gem install mysql.
rake aborted!
126: The specified module could not be found. - C:/Ruby/lib/ruby/gems/1.8/gems
/mysql-2.8.1-x86-mswin32/lib/1.8/mysql_api.so
The problem for above error is, MySQL 5.1 client library doesn't play well with Rails.
Solution is
- download older MySQL client library, for example one from InstantRails: http://instantrails.rubyforge.org/svn/t ... bmySQL.dll
- copy the downloaded file to C:\Ruby\bin (or wherever you installed Ruby)
- restart MySQL server
Wednesday, October 14, 2009
Rails Set the Index Page
Follow the steps given bellow
1. Delete public/index.html
2. Add 'map.root :controller => ""' to routes.rb
3. and then of course create the controller with the action index.
1. Delete public/index.html
2. Add 'map.root :controller => "
3. and then of course create the controller
Java Script Validations in RESTful Ruby on Rails Form
We can validate ruby on rails form using java script.It is show in bellow example
java script function
function validate()
{
//validation code
if (valid)
return true
else
return false
}
function validate(){
//validate code
if (valid){
return true;
}
else{
return false;
}
}
ruby on rails form
<% form_for(@patient_details,:html=>{:onsubmit=>"return validate();"}) do |f| %>
<%= f.error_messages %>
#form
<%end%>
java script function
function validate()
{
//validation code
if (valid)
return true
else
return false
}
function validate(){
//validate code
if (valid){
return true;
}
else{
return false;
}
}
ruby on rails form
<% form_for(@patient_details,:html=>{:onsubmit=>"return validate();"}) do |f| %>
<%= f.error_messages %>
#form
<%end%>
Switch statement in ruby on rails
In other languages switch case statement use for avoiding many if else conditions. In ruby also use these type of tack-tick for avoid many if else conditions.
try this code
exapmle 1
try this code
exapmle 1
case nameexample 4
when "banusha"
#some_code
when "kamal"
#some_code
else
#...
end
example 2
case number
when 1
puts "number is equal to 1"
when 2..9
puts "number is between 2 and 9"
when 10
puts "number is equal to 10"
end
example 3
case number
when 1 then puts "number is equal to 1"
when 2..9 then puts "number is between 2 and 9"
when 10 then puts "number is equal to 10"
end
case number
when 1 ; puts "number is equal to 1"
when 2..9 ; puts "number is between 2 and 9"
when 10 ; puts "number is equal to 10"
end
Ruby on Rails -try catch fainally block
Ruby On Rails in more human readable language than other languages. So ruby use try catch finally block also human readable form as follows.begin,rescue,ensure same as try catch finally
begin
somecode()
rescue
puts "error"
ensure
all_ways_execute_code
end
Acts_as_Authenticated Plugin in Rails
In ruby on rails environment by using this plugin we can built a login system with all most all the function, with in few minitues. Follow the steps in bellow
1.Install the plugin: script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
2. Generate the user and account models: script/generate authenticated user account
3. Rake the DB to add the users table: rake db:migrate
4. Finally, add this line to application.rb controller so you can use the gem: include AuthenticatedSystem
Type Url -http://localhost:3000/account/signup
Then you can see the sign up page
Type- http://localhost:3000/account/login
then you can see tha login page

1.Install the plugin: script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated
2. Generate the user and account models: script/generate authenticated user account
3. Rake the DB to add the users table: rake db:migrate
4. Finally, add this line to application.rb controller so you can use the gem: include AuthenticatedSystem
Type Url -http://localhost:3000/account/signup
Then you can see the sign up page
then you can see tha login page
To protect pages so they require login, simply add this line to the beginning of your controller class:
before_filter :login_required
If you want to exclude certain views from requiring authentication, just add the list of exceptions:
before_filter :login_required, :except => [:show]
def show
# view stuff ...
end
Monday, September 28, 2009
Ruby on Rails Vs Java
Java is very popular programming language in the world but ruby on rails is relatively new and young programming language. To compare two programming languages normally SW Engineers consider about language performance, security, Development speed, Maintainability,Scaling and Development tools
By comparing with Rails and Java, Rails Development speed and Maintainability little bit higher than Java. Reason for that is ruby on rails is less configuration and also it practice agile development, further more lot of plugins are available for ruby on rails development.But consider about scalability rails is in far behind to java. Java supports multi- threading but ruby not that much.Clustering also good in Java but not that much in rails. Ruby on Rails is easy to learn and code is more human readable but Java is hard to learn and not that much human readable.
By comparing with Rails and Java, Rails Development speed and Maintainability little bit higher than Java. Reason for that is ruby on rails is less configuration and also it practice agile development, further more lot of plugins are available for ruby on rails development.But consider about scalability rails is in far behind to java. Java supports multi- threading but ruby not that much.Clustering also good in Java but not that much in rails. Ruby on Rails is easy to learn and code is more human readable but Java is hard to learn and not that much human readable.
Ruby on Rails Vs PHP
Ruby on Rails is a relatively new and young programming language. But Php is little bit older than ruby on rails and many people have experience with it. According to my view both languages are easy to learn.
Before select a language for a project SW Engineers normally consider about language performance, security, Development speed,Maintainability,Scaling and Development tools
By comparing rails and php , ruby development speed and maintainability little bit higher than php. Reason for that is ruby on rails is less configuration and also it practice agile development, further more lot of plugins are available for ruby on rails development.According to my view security is same in both rails and php.Because both lanuages are support SSL implementation.And Ruby has less code than php.And also ruby codes are more human readable than the php code..
What is the Best????????
Before select a language for a project SW Engineers normally consider about language performance, security, Development speed,Maintainability,Scaling and Development tools
By comparing rails and php , ruby development speed and maintainability little bit higher than php. Reason for that is ruby on rails is less configuration and also it practice agile development, further more lot of plugins are available for ruby on rails development.According to my view security is same in both rails and php.Because both lanuages are support SSL implementation.And Ruby has less code than php.And also ruby codes are more human readable than the php code..
What is the Best????????
Google Map With Ruby On Rails Application
In this post i like to describe integration of the google map with the ruby on rails application. Most of the time for our projects ,we have to use google map for find a place,mark some important locations ect..
Mark a location in a google map
Google map API is totally javascript. So convert to java script variable in to Ruby variable little bit difficult. So i use a trick for make life easy. Trick was i placed a hidden fields for both' lag' and 'lat'.And get those variables as 'params' when submit the form
Find Mark Locations
It is easy.You want to get lng and lat values from your database and Simlpy can disply by Using following code
For more informtaion- http://code.google.com/apis/maps/
Mark a location in a google map
Google map API is totally javascript. So convert to java script variable in to Ruby variable little bit difficult. So i use a trick for make life easy. Trick was i placed a hidden fields for both' lag' and 'lat'.And get those variables as 'params' when submit the form
Find Mark Locations
It is easy.You want to get lng and lat values from your database and Simlpy can disply by Using following code
Sending and Receiving SMS messages via a GSM modem or Mobile phone
Most of the time, we need to send and receive SMS messages in our University/School Projects. I Used Java library called SMSLib for my above requirement. SMSlib is a Java library for sending and receiving SMS messages via a GSM modem or mobile phone. It also supports some bulk SMS operators, by implementing their HTTP interfaces.
For more Information - http://code.google.com/p/smslib/
For more Information - http://code.google.com/p/smslib/
Friday, September 18, 2009
Date Time Formats in Ruby
strftime( string ) method of the 'Date' class can use for that purpose..
eg - t = Time.now
t.strftime("%m/%d/%Y") #=> "19/09/2009"
t.strftime("%I:%M%p") #=> " 12:22PM"
Format Strings
%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%m - Month of the year (01..12)
%M - Minute of the hour (00..59)
%p - Meridian indicator (``AM'' or ``PM'')
%S - Second of the minute (00..60)
%U - Week number of the current year,
starting with the first Sunday as the first
day of the first week (00..53)
%W - Week number of the current year,
starting with the first Monday as the first
day of the first week (00..53)
%w - Day of the week (Sunday is 0, 0..6)
%x - Preferred representation for the date alone, no time
%X - Preferred representation for the time alone, no date
%y - Year without a century (00..99)
%Y - Year with century
%Z - Time zone name
%% - Literal ``%'' character
eg - t = Time.now
t.strftime("%m/%d/%Y") #=> "19/09/2009"
t.strftime("%I:%M%p") #=> " 12:22PM"
Format Strings
%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%m - Month of the year (01..12)
%M - Minute of the hour (00..59)
%p - Meridian indicator (``AM'' or ``PM'')
%S - Second of the minute (00..60)
%U - Week number of the current year,
starting with the first Sunday as the first
day of the first week (00..53)
%W - Week number of the current year,
starting with the first Monday as the first
day of the first week (00..53)
%w - Day of the week (Sunday is 0, 0..6)
%x - Preferred representation for the date alone, no time
%X - Preferred representation for the time alone, no date
%y - Year without a century (00..99)
%Y - Year with century
%Z - Time zone name
%% - Literal ``%'' character
Fixed Length Random numbers Ruby On Rails
Generating Random numbers in Ruby On Rails is very easy even without gems.
If u want 6 Digit random number try bellow code.
rand(999999).to_s.center(6, rand(9).to_s)
If you want 5 digit try bellow
rand(99999).to_s.center(5, rand(9).to_s)
Like this we can generate any number of digits random number..
If u want 6 Digit random number try bellow code.
rand(999999).to_s.center(6, rand(9).to_s)
If you want 5 digit try bellow
rand(99999).to_s.center(5, rand(9).to_s)
Like this we can generate any number of digits random number..
Thursday, May 28, 2009
Setup Ruby on Rails in the Windows platform
1.First Download the Ruby setup. You can get the Ruby setup by following this link http://rubyonrails.org/download

2.By using this setup you can install ruby on your windows machine...After install ruby you can check the ruby version by typing ‘ruby –v’ command in the dos prompt.

3.Then we have to install rails frame work. If you have online connection type ‘gem install rails’ in the windows prompt...Then we can easily install the rails frame work.

4.After install rails we can check the version of the rails by typing ‘rails –v’ on the command prompt.

5.Then we have to decide the database we going to use in this application. In this example I use postgreSQL database. Download the postgreSQL windows setup
(http://www.postgresql.org/download/windows), and install it.
6.Then we have to install Ruby-Postgres gem using the command ‘gem install ruby-postgres’ in the command prompt.

7.Now your basic installation of the Ruby on Rails in the windows platform has completed.
2.By using this setup you can install ruby on your windows machine...After install ruby you can check the ruby version by typing ‘ruby –v’ command in the dos prompt.
3.Then we have to install rails frame work. If you have online connection type ‘gem install rails’ in the windows prompt...Then we can easily install the rails frame work.
4.After install rails we can check the version of the rails by typing ‘rails –v’ on the command prompt.
5.Then we have to decide the database we going to use in this application. In this example I use postgreSQL database. Download the postgreSQL windows setup
(http://www.postgresql.org/download/windows), and install it.
6.Then we have to install Ruby-Postgres gem using the command ‘gem install ruby-postgres’ in the command prompt.
7.Now your basic installation of the Ruby on Rails in the windows platform has completed.
Thursday, May 21, 2009
Advantages of Ruby on Rails
Advantage of using Ruby on Rails is that it proves very useful while developing database driven websites and applications. It supports databases like Mysql, Postgresql, and Oracle etc. and also provides developers with detailed error logs so as to enable them to debug applications. Users have the facility to develop search engine friendly URL’s for dynamic websites (which have query strings and delimiters like question mark) using the RoR framework. Its MVC (model view architecture) enables data and logic to be separated from presentation. The wide range of libraries provided to developers helps in simplifying the coding of common programming languages tasks such as form validations, sessions management etc. The active record feature in rails simplifies data handling in databases as it automatically maps tables to classes and rows to objects. All these features have made Ruby on Rails a popular framework amongst the open source developers’ community as it helps in rapid application development.
Ruby On Rails

Ruby on Rails, RoR is an open source web development framework, which has taken the web application space by storm. Ruby has been popularly known as object oriented general-purpose programming and scripting language since 1995. Released in the year 1995, Ruby is being used in many sectors including artificial intelligence (AI) and Machine learning programs. Written in a simple syntax, Ruby is easy to create, maintain, and edit.
Rails web application development framework was written using the Ruby programming language. The benefit of using Ruby on Rails as a framework is that it allows applications to be developed faster using simple methods. Ruby as a programming language is known to be a hybrid between Perl and Smalltalk and is considered quite similar to the Perl and Python Programming languages. Applications developed using this open source technology framework. can easily run on any server, which implements CGI or FastCGI.
Subscribe to:
Posts (Atom)