Friday, May 28, 2010

EyeOS !!!! cloud in your local machine

My home cloud

EyeOS is an Open Source web desktop operating system written in PHP and AJAX. The main problem of setting up EyeOS is running the sql queries, cause there are several files containing sql commands. To set up EyeOS, you've to edit the settings.php file in mail directory and edit this portion according to your configuration.

// 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 Eyeos
EventsNotification 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.


Screen shot of EyeOS

Friday, May 14, 2010

JDBC MySQL snippet

I'm working on my database project. Here is a tips to connect java with MySQL in Ubuntu. I downloaded MySQL Java connector with Synaptic. The downloaded file is mysql-connector-java-5.1.10.jar and located at /usr/share/java path. I copied that file to my java home's /jre/lib/ext directory, which is /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/ext

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) {}
}
}
}

Monday, May 10, 2010

Lexical Issues

I was given some sample source files and instructions to build a lexical analyzer. Though it is not a complete project but this flex file works pretty good job to identify the lexicon. Here is the lex file and the generated files: