Monday, November 14, 2005

Ubuntu Linux get IBM seal of approval

Yay for Ubuntu Linux!

See story:

http://www.cbronline.com/article_news.asp?guid=99632EF5-C67F-4A53-A69B-FF8F21DE59D4

Friday, October 21, 2005

No Reason for MS Office

One reason Open Office 2.0 is out!

The formulas are translating as they should so it bye bye Excel and
Hello open office 2.0.

http:///www.openoffice.org

Nuff said.

Saturday, October 01, 2005

Fedora Core 4 dependency Issue

Because I had upgraded my version of Fedora from Core 3 to core 4 there
were some dependency problems that I ran into when I ran yum update. The
issue I had wa seventually resolved by uninstalling the hardware
abstrction layer "hal" and reinstalling it by the following

yum remove hal
yum install hal
yum update

Now Fedora Core 4 is happy and I am happy

Red Hat Dependency Hell

Yum update is on my RedHat Fedora Core 4 is returning errors on
missing dependencies. This reminds me of DLL Hell on Windows. I am at
the verge of switching back to FreeBSD :( once I can confirm java is
working fine on FreeBSD I am outta here.

Monday, September 19, 2005

South Africa looking for open source suppliers

The revolution has begun!

South African government is tossing proprietary
software for open source!

http://www.tectonic.co.za/view.php?id=605

Monday, September 12, 2005

Tsuro naGudo CGI animation!

Someone suggested that some of our folk tales that we were tolded as
we were growing up may need to be animated. That sound like a splendid
idea.
We just need to storyboard a simple Tsuro naGudo story and get
cranking on the rendering. Any artists out there?

Blender (http://www.blender.org) and Gimp (http://www.gimp.org) can
help with this big time and they are FREE!

Wednesday, September 07, 2005

Where the hell is opensource in Zimbabwe?

While opensource has provided other developing nations Such as india, Brazil and China unparalleled flexibility and regaining if control of their IT futures. The question still remains to be answered where is the legislation to bring sweeping infrastructure changes to a country that already is strapped for capital?

We need government to give opensource a chance in rebuilding technology infrastructure.

South Africa with Mark Shuttleworth and Ubuntu have made phenomenal strides in this respect http://www.ubuntu.org. This version of Linux really kicks tail, Redhat et al.

The following list delves into replacement options and new software that you may have never heard of that is free. On the left is the package that is proprietary and costs a lot of money in licencing and on the right is the FREE alternative.

MS Office Word, Excel and powerpoint - Open office at http://www.openoffice.org
Web Browser - Firefox http://www.mozilla.org
Mail - Thunderbird or Evolution http://www.mozilla.org
databases - mysql (http://www.mysql.org) or postgresql (http://www.postgresql.org)
Web Servers - Apache (http://www.apache.org)
Graphical editor - photoshop equivalent - The Gimp (http://www.gimp.org)

Blender is a cool animation package that has been used in movies like of Spiderman for some of the graphics
check it out at http://www.blender.org - Get some artists to start producing some Zimbabwean animation for crying out loud!

Open Movie project (http://orange.blender.org/cms/Home.553.0.html)

Check some of these out before you dismiss this opensource, this ain't your grand daddy's opensource. This stuff works!

ENJOY!

CSS Tables

Ran into some cool Cascading Style Sheets table design repository.

http://icant.co.uk/csstablegallery/index.php

Slick!

Thursday, September 01, 2005

Free as in Beer PL/SQL to java converter

I think writing a PL/SQL to java converter makes sense. I can't seem to
find any free ones.

Technology and Zimbabwe book shortage

In Zimbabwe there is a huge shortage of books in schools and i was
thinking about how best that this can be alleviated.

Could all books be converted to a PDF or any internet downloadable
format to allow them to be printed to ordinary paper by ordinary printers?
That way a teacher when he goes to a growth point where they have
internet connectivity can download the latest course material and
teaching guides. Well this is a bit far fetched but I think having books
as open courseware may allow some of the disadvantaged schools to have
access to some of the best material for the best schools like Goromonzi,
Gokomere, Mazowe, St Ignatius, Eaglesvale, Chisipite, Arundel, etc in
the form of simple paper printouts. Would this work?

Saturday, April 23, 2005

Migrating popular Databases to Mysql

No need for convoluted code to migrate to MySql now you can use the Migration tool that they offer. Cool!

http://www.mysql.com/products/migration-suite/

Wednesday, November 17, 2004

Converting from Oracle to Mysql

Below is the code you can cut paste and use for converting Oracle structures and data to mysql.
You need additional libraries

Classes12.zip oracle jdbc driver from oracle freely downloadable,
jakarta-oro.jar from apache.org and
mysql jdbc driver from mysql.com

Enjoy!

/*-----------------------------------------------------------------------------------------------------------------------------------------------------
* Program: oracle2mysql.java
* Author: Sib
* Date : 11/17/2004
* Purpose: Program to move specified schema from Oracle to mysql
* This is a quick and dirty method its not the best way but it works and gives you an idea
* of the steps involved. If you make modifications please advise so I can post them too
* You are free to use this as you please.
----------------------------------------------------------------------------------------------------------------------------------------------------*/
import java.sql.*;
import org.apache.oro.text.perl.Perl5Util;


public class oracle2mysql {

public static void main(String args[])
{
// create oracle connection
Connection OracleConnection = null;
// create mysql connection
Connection MysqlConnection = null;
String stmt = "";
int columnNumber=1;
//String columnDescription = null;
String dataType = null;
String dataScale = null;
//String ColumnString;
boolean isCreateOk;
try {
// Load the JDBC driver
DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver());
// Create a connection to the database
// replace local host with your database server name also change user scott and password tiger to reflect your
// This should be turned to some parameters or something

// You need classes.zip from oracle to establish the connection find it here otn.oracle.com
OracleConnection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");

// Load the JDBC driver
DriverManager.registerDriver( new org.gjt.mm.mysql.Driver()); // MySQL MM JDBC driver
// Create a connection to the database
// This database should already exist with the particular user and password setup too
MysqlConnection = DriverManager.getConnection("jdbc:mysql://localhost/testdatabase", "test", "test");

System.out.println("Created oracle and mysql connections ...");
//read oracle table structures
System.out.println("Reading Oracle table structures ...");
Statement sql=OracleConnection.createStatement();
Statement columnStmt=OracleConnection.createStatement();
Statement mySql=MysqlConnection.createStatement();

ResultSet rsColumns = null;
ResultSet rsTables = sql.executeQuery("select table_name from user_tables");

while (rsTables.next())
{
// map the column types
System.out.println("Mapping types...");
stmt = "select column_name, data_type, decode(nullable,'N','not null',' ') NULLABLE, data_length,nvl(data_scale,0) DATA_SCALE, DATA_PRECISION from cols where table_name='" + rsTables.getString("TABLE_NAME")+"'";
rsColumns = columnStmt.executeQuery(stmt);
columnNumber=1;

StringBuffer sbCreTable = new StringBuffer();
StringBuffer sbColumnList = new StringBuffer();

sbCreTable.append("CREATE TABLE ")
.append(rsTables.getString("TABLE_NAME"))
.append(" (");

while (rsColumns.next())
{
StringBuffer sbColumnDesc = new StringBuffer();
if (rsColumns.getString("DATA_TYPE").equals("NUMBER") && rsColumns.getInt("DATA_SCALE")<=0) dataType="INTEGER"; else if (rsColumns.getString("DATA_TYPE").equals("NUMBER") && rsColumns.getInt("DATA_SCALE")>0) dataType="FLOAT";
else if (rsColumns.getString("DATA_TYPE").equals("VARCHAR2"))
{
dataType="VARCHAR";
if (dataType=="VARCHAR" && rsColumns.getInt("DATA_LENGTH") > 255) dataType="BLOB";
}
else if (rsColumns.getString("DATA_TYPE").equals("LONG")) dataType="BLOB";
else if (rsColumns.getString("DATA_TYPE").equals("DATE")) dataType="DATETIME";
if (dataType=="DATETIME" || dataType=="BLOB")
sbColumnDesc.append(rsColumns.getString("COLUMN_NAME"))
.append(" ")
.append(dataType)
.append(" ")
.append(rsColumns.getString("NULLABLE"));
else
{
if (rsColumns.getInt("DATA_SCALE")==0)
{
sbColumnDesc.append(rsColumns.getString("COLUMN_NAME"))
.append(" ")
.append(dataType)
.append("(")
.append(rsColumns.getInt("DATA_LENGTH"))
.append(") ")
.append(rsColumns.getString("NULLABLE"));
}
else
sbColumnDesc.append(rsColumns.getString("COLUMN_NAME"))
.append(" ")
.append(dataType)
.append("(")
.append(rsColumns.getString("DATA_PRECISION"))
.append(",")
.append(rsColumns.getInt("DATA_SCALE"))
.append(") ")
.append(rsColumns.getString("NULLABLE"));
}
if (columnNumber == 1)
{
sbCreTable.append(sbColumnDesc);
// get column name
sbColumnList.append(rsColumns.getString("COLUMN_NAME"));
}
else
{
sbCreTable.append(", ")
.append(sbColumnDesc);
// get column name
sbColumnList.append(", ");
sbColumnList.append(rsColumns.getString("COLUMN_NAME"));
}

columnNumber++;
} // while (rsColumns.next())
sbCreTable.append(")");

// drop and create mysql table structure

try {
//isCreateOk =mySql.execute("DROP TABLE "+ rsTables.getString("TABLE_NAME"));
isCreateOk = mySql.execute(sbCreTable.toString());

}
catch (SQLException e)
{
System.out.println(e);
System.out.println(sbCreTable.toString());

}
insertRows(rsTables.getString("TABLE_NAME"),sbColumnList,OracleConnection,MysqlConnection);
// read oracle index structure
System.out.println("going for next table");
// create mysql index structure

} //while (rsTables.next())

rsTables.close();
//close connections

System.out.println("Closing connections ...");
OracleConnection.close();
MysqlConnection.close();
System.out.println("Connections closed - Goodbye!");

} catch (SQLException e) {
// some problem oocured at the database
System.out.println(e.getMessage());
}
}
public static void insertRows(String tableName, StringBuffer sbColumnList, Connection OracleConnection, Connection MysqlConnection)
{
try {
Statement oraStatement=OracleConnection.createStatement();
Statement mySqlStatement=MysqlConnection.createStatement();
Perl5Util regExpression = new Perl5Util();
StringBuffer sbQuery = new StringBuffer();
sbQuery.append("SELECT ")
.append(sbColumnList)
.append(" FROM ")
.append(tableName);

// Copy data
System.out.println("Copying " + tableName +" data from oracle ...");

try {
ResultSet rsRows = oraStatement.executeQuery(sbQuery.toString());
rsRows.setFetchSize(100);
ResultSetMetaData rsRowsMeta = rsRows.getMetaData();
while(rsRows.next())
{
StringBuffer sbInsertLine = new StringBuffer();
sbInsertLine.append("INSERT INTO ")
.append(tableName)
.append(" ( ")
.append(sbColumnList)
.append(" ) values (");
// Extract fields from the recordset
for(int i = 1;i <=rsRowsMeta.getColumnCount(); i++)
{
if (i==1)
{
//Determine whether to put quotation marks around the field
if(rsRows.getObject(i)!=null && (rsRowsMeta.getColumnType(i)==java.sql.Types.VARCHAR
|| rsRowsMeta.getColumnType(i)==java.sql.Types.CHAR
|| rsRowsMeta.getColumnType(i)==java.sql.Types.TIMESTAMP))
{
sbInsertLine.append("'")
// search object content for quotation marks and remove
.append(regExpression.substitute("s/\'//g",rsRows.getString(i)))
.append("'");
}
else
{
sbInsertLine.append(rsRows.getObject(i));
}

}
else
{
if(rsRows.getObject(i)!=null && (rsRowsMeta.getColumnType(i)==java.sql.Types.VARCHAR
|| rsRowsMeta.getColumnType(i)==java.sql.Types.CHAR
|| rsRowsMeta.getColumnType(i)==java.sql.Types.TIMESTAMP))
{
sbInsertLine.append(", ")
.append("'")
//.append(rsRows.getObject(i))
.append(regExpression.substitute("s/\'//g",rsRows.getString(i)))
.append("'");
}
else
{
sbInsertLine.append(", ")
.append(rsRows.getObject(i));
}
}
}
sbInsertLine.append(")");
// Execute the generated string
System.out.println(sbInsertLine.toString());

mySqlStatement.executeUpdate(sbInsertLine.toString());
mySqlStatement.executeUpdate("commit");
}
//close the resultset
rsRows.close();
}
catch (SQLException e)
{
System.out.println(e.getMessage());
}
}
catch (SQLException e)
{
System.out.println(e.getMessage());
}
}
}

Red Hat Fedora core 3

After tinkering with FreeBSD 5.3 for a little bit I switched to my new Fedora Core 3 box and this is currently hosting my website until I get real problems with it. I am more familiar with RH and also I like the threading there especially with regards to java so now I am running Fedora Core 3 for my laptop and servers.

I will be putting up some draft java source for copying tables and data from Oracle to Mysql. Please feel free to modify and share this code I have used it to just copy tables and the data into my own instances of mysql try it out it should be fun! I will add some more features if enough interest is shown , index structures, stored procedures and functions for mysql 5.

Tuesday, November 16, 2004

Java on freeBSD 5.3

I am running freeBSD on one of my servers but I uncomfortable with the hoops you have to go through to set java up on this platform. I would like to deploy some java applications on the freeBSD and I am hoping that the threading issues that used are gone we will see.

I am thinking of going BSD with my desktop too. The only problem I think I will have with BSD is that I will no longer have fun trying to figure out what is wrong with the system because this thing runs solid, all I can say is impressive.

Thursday, October 14, 2004

Zimbabwe should develop Opensource policy.

I have been doing a lot of comparisons of different opensource database offerings. CA made their Ingres database opensource! What does this all mean for mysql, with postgres and cloudscape all in the mix there is a real choice in databases to use for developing your products. I wish that this had all happened a couple of years ago it would have saved an old client of mine thousand of dollars compared to the proprietary solution they went with and are dealing with the impact of a lack of support from that Vendor in Southern Africa.

Opensource is REAL in the Third world. I can give an example of Microsoft scaling back their operations from Zimbabwe, so who do they think will fill the void created by that, huh? Linux and the rest of the good stuff of course. Only if the government there can have a real policy on Opensource being the system to be chosen over Microsoft for disinvesting in Zimbabwe!

Opensource in Africa

Thursday, September 09, 2004

Phew!

After several years of watching the world blog by I have finally decided to start a blog of my interesting day to day events...

Hope you find it interesting as I find living it...

Yesterday I found out some really interesting things about Boston that I would not have evr known. I have been living here for 4 years now and I took the trolley tour with a Boston harbor cruise. Interesting , I recommend it for all new Bostonians.