Friday, July 15, 2011
Setting up sensors in linux
sudo apt-get install lm-sensors
after installation use this command to get the status of the cpu:
sensors
Friday, July 8, 2011
Changing brightness from ubuntu terminal
setpci -s 00:02.0 F4.B=10
value of F4.B can be changed (my limit is 99)
Thursday, June 30, 2011
Easiest way to determine "Follow Set"
E = TE'
E' = +TE' | e
T = FT'
T' = *FT' | e
F = (E) | id
Here,
First( E ) = { ( , id }
First( E' ) = { + , e }
First( T ) = { ( , id }
First( T' ) = { * , e }
First( F ) = { ( , id }
So, to get the value of Follow (E) we have to pick any one of Es from the right side of the equation. E is in the right side only here F = (E)|id , here right side of E is ')' which is a terminal. So Follow set of E would be ')'. And E is first one to get so $ sign would be in the follow set.
So Follow(E) = { ) , $ }
Now we have to get the value of Follow (E'). At first we have to take any one of the equations from the list where E' is in the right side. Lets take E = TE'
Here right side of E' is empty. So the Follow set of E' would be the Follow set of E (left side of the equation)
So, Follow(E') = { ), $ }
Now it's time to get the value of Follow(T). We can take E = TE', where T is in the right ride of the equation. Here the right consecutive value of T is E' which is a non terminal. So, we have to add it's first set's element to its follow set, adn if the first set has the value 'e' (empty set), follow set of the non terminal residing in the left side of the equation has to be added, Here the first set of E' is {+,e}, so the follow set of T would be {+, Follow set of E} that means {+,),$}
To get the Follow set of T' We can take the equation T=FT' and T' has not any right consecutive value, so the follow set of T' would be the follow set of the left sided non terminal T. That is {+,),$}
Follow set of F can be determined from the relation T = FT'
Here right consecutive value of F is T' which is a nonterminal. So the follow set would be {first set of T', if First(T') contains e add follow set of T}
Therefore, Follow(F) = {*,+,),$}
Friday, November 26, 2010
Ruby on Mint ;)
Ruby develoment:
To create new application , install ruby and gem and webrick from apt with this command
sudo gem install rails
install sqlite3 and its dev file from apt.
then create a sample application,
rails create blog
cd blog
rails server
Here rails generate controller home index
To edit configuration go to
app/views/home/index.html.erb
give this command:
rm public/index.html
Now, you have to tell Rails where your actual home page is located. Open the file config/routes.rb in your editor. This is your application’s routing file which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions. This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with :root to, uncomment it and change it like the following:
Blog::Application.routes.draw do #... # You can have the root of your site routed with "root" # just remember to delete public/index.html. root :to => "home#index"
The root :to => "home#index" tells Rails to map the root action to the home controller’s index action.
Now if you navigate to http://localhost:3000 in your browser, you’ll see Hello, Rails!.
For routing add get part
Blog::Application.routes.draw do
get "say/hello"
get "say/goodbye"
get "home/index" receive
Friday, May 28, 2010
EyeOS !!!! cloud in your local machine
// STORAGE
define('SQL_CONNECTIONSTRING', 'mysql:dbname=eyeos;host=127.0.0.1');
define('SQL_USERNAME', 'user');
define('SQL_PASSWORD', '123456');
you have to write your user name instead of "user" and your desired password will replace "123456".
Open mysql console and create a database named eyeos
Then go to /server directory/eyeos/eyeos/extras and open Calendar.sql from Calendar directory.
Run the queries in mysql console. If error is poped, then its okay, we've to come back to this queries after finishing other queries. Then openEyeosEventsNotification.sql file from EyeosEventsNotification directory.Remember, if any query shows error, don't be nervous, we will run them after executing other queries. Silmilarly run the queries of EyeosPeopleSQL.sql, EyeosTags.sql, EyeosUMSQL.sql, languageAdmin.sql, MailApplicationSQL.sql from EyeosPeopleSQL, EyeosTags, EyeosUMSQL, LanguageAdmin, MailApplicationSQL directories. Now it's time to get back to unexecuted queries of previous files.Run those queries and ready to use the cloud in your PC.
Run the eyeos from server and click on the New User link, register yourself and ready to take the taste of web desktop.

Friday, May 14, 2010
JDBC MySQL snippet
I created a database with this command in mysql :
create database test;
create table Name (FirstName char(10),LastName char(10));
insert into Name values ("Md. Rezaur","Rahman");
Now I used this code to test my connection:
import java.sql.*;
public class JdbcExample1 {
public static void main(String args[]) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///test", "sajol", "123456");
if(!con.isClosed()){
System.out.println("Successfully connected to MySQL server...");
Statement s = con.createStatement ();
s.executeQuery("select FirstName,LastName from Name");
ResultSet rSet = s.getResultSet();
int count = 0;
while (rSet.next ())
{
String FirstName = rSet.getString ("FirstName");
String LastName = rSet.getString ("LastName");
System.out.println (" First Name = " + FirstName+ ", Last Name = " + LastName);
++count;
}
rSet.close ();
s.close ();
System.out.println (count + " rows were retrieved");
}
}
catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
}
finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}