First MySQL, now Virtualbox. Sun loves paying money for GPLware.
Sun grabs Innotek. Containers, xVM, LDOMS... virtualization hype ftw.
http://www.theregister.co.uk/2008/02/12/sun_innotek_virtualization/
Schwartz takes another spin on the strategy wheel...
Image from Ars Technica
Good news is you can now run VirtualBox on Solaris x86. There's a beta of Virtualbox for (Open)Solaris x86-64.
Tuesday, February 12, 2008
Sun buys Innotek - makers of VirtualBox
Posted by
cmihai
at
9:14 PM
0
comments
Labels: Open Source, Sun, Virtualization
Saturday, February 09, 2008
Windows Performance Tracing Toolkit
Windows Performance Tools Kit, v.4.1.1 helps diagnostic application start time issues, boot issues, deferred procedure calls and interrupt activity (DPCs and ISRs), interrupt storms, application resource usage and system responsiveness issues.
The toolkit includes xperf - a trace capture tool, xperfview - a visualization tool (Performance Analyzer) and xbootmgr - a boot trace capture tool.
It works great along side sysinternals tools (Process Explorer and Process Monitor) and krview for kernel tracing and profiling and Performance Monitor (perfmon.msc).
Here's a VERY simple trace (xperf -on DiagEasy, xperf -d trace.etl, xperf trace.etl). There's hunderds of knobs you can turn. You can use it for everything from getting VERY detailed system information (xperf –i trace.etl –a sysconfig) to getting advanced disk I/O info or pinpointing Registry Access bottlenecks.
Posted by
cmihai
at
8:19 PM
0
comments
Labels: Debugging, Microsoft, Software Development
Tuesday, February 05, 2008
Solaris Package Companion - Cool Solaris Tool
Cool little ksh script to manage Solaris packages and (meta) clusters:
http://opensolaris.org/os/project/svr4_packaging/package_companion/
Posted by
cmihai
at
7:19 PM
0
comments
Labels: Open Source, Solaris, Sun
MySQL, Oracle, DB2, PgSQL and Firebird versus Leap Years and Division by Zero
Oracle first:
SQL> CREATE TABLE leaptest (thedate date);
Table created.
SQL> INSERT INTO leaptest VALUES ('28-feb-2008');
1 row created.
SQL> INSERT INTO leaptest VALUES ('29-feb-2008');
1 row created.
SQL> INSERT INTO leaptest VALUES ('30-feb-2008');
INSERT INTO leaptest VALUES ('30-feb-2008')
*
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string
SQL> INSERT INTO leaptest VALUES ('29-feb-2007');
INSERT INTO leaptest VALUES ('29-feb-2007')
*
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string
SQL> SELECT * from leaptest;
THEDATE
---------
28-FEB-08
29-FEB-08
As you can see, Oracle knows 2008 is a leap year, and that 2007 is not.
Let's try another good database, PostgreSQL:
goods=> CREATE TABLE leaptest (thedate date);
CREATE TABLE
goods=> INSERT INTO leaptest VALUES ('28-feb-2008');
INSERT 0 1
goods=> INSERT INTO leaptest VALUES ('29-feb-2008');
INSERT 0 1
goods=> INSERT INTO leaptest VALUES ('30-feb-2008');
ERROR: date/time field value out of range: "30-feb-2008"
goods=> INSERT INTO leaptest VALUES ('29-feb-2007');
ERROR: date/time field value out of range: "29-feb-2007"
goods=> SELECT * FROM leaptest;
thedate
------------
2008-02-28
2008-02-29
(2 rows)
No problems here either. What about IBM DB2?
db2 => CREATE TABLE leaptest (thedate date)
DB20000I The SQL command completed successfully.
db2 => INSERT INTO cmihai.leaptest VALUES ('2008-02-28')
DB20000I The SQL command completed successfully.
db2 => INSERT INTO cmihai.leaptest VALUES ('2008-02-29')
DB20000I The SQL command completed successfully.
db2 => INSERT INTO cmihai.leaptest VALUES ('2008-02-30')
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0181N The string representation of a datetime value is out of range.
SQLSTATE=22007
db2 => INSERT INTO cmihai.leaptest VALUES ('2007-02-29')
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0181N The string representation of a datetime value is out of range.
SQLSTATE=22007
db2 => SELECT * FROM cmihai.leaptest
THEDATE
----------
02/28/2008
02/29/2008
2 record(s) selected.
Let's even try Firebird:
SQL> CREATE TABLE leaptest (thedate date);
SQL> INSERT INTO leaptest VALUES ('28-feb-2008');
SQL> INSERT INTO leaptest VALUES ('29-feb-2008');
SQL> INSERT INTO leaptest VALUES ('30-feb-2008');
Statement failed, SQLCODE = -413
conversion error from string "30-feb-2008"
SQL> INSERT INTO leaptest VALUES ('29-feb-2007');
Statement failed, SQLCODE = -413
conversion error from string "29-feb-2007"
SQL> SELECT * FROM leaptest;
THEDATE
===========
2008-02-28
2008-02-29
Well now, let's try MySQL:
mysql> CREATE TABLE leaptest (thedate date);
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO leaptest VALUES ('28-feb-2008');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> INSERT INTO leaptest VALUES ('29-feb-2008');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> INSERT INTO leaptest VALUES ('30-feb-2008');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> INSERT INTO leaptest VALUES ('29-feb-2007');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> SELECT * FROM leaptest;
+------------+
| thedate |
+------------+
| 0000-00-00 |
| 0000-00-00 |
| 0000-00-00 |
| 0000-00-00 |
+------------+
4 rows in set (0.00 sec)
As you can see, MySQL happily takes the input, but when we try to read it.. surprise surprise, your data isn't there! It should respond with an error code..
As Komal Shah points out, that's only due to an invalid date format, using ISO dates dates works fine.
INSERT INTO leaptest VALUES ('2008-02-28');
An invalid date will still generate a warning and a 0000-00-00 entry.
Here's another fine piece of MySQL behavior:
Division by 0:
Well, let's first see how Oracle and PgSQL handle this:
Oracle
SQL> SELECT 0/0 FROM dual;
SELECT 0/0 FROM dual
*
ERROR at line 1:
ORA-01476: divisor is equal to zero
PostgreSQL
goods=> SELECT 0/0;
ERROR: division by zero
IBM DB2:
db2 => SELECT 0/0 FROM cmihai.leaptest
SQL0801N Division by zero was attempted. SQLSTATE=22012
Firebird:
SQL> SELECT 0/0 FROM leaptest;
=====================
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
SQL> SELECT 0/1 FROM leaptest;
=====================
0
0
SQL> SELECT 1+1 FROM leaptest;
=====================
2
2
MySQL
mysql> SELECT 0/0;
+------+
| 0/0 |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
So there you have it, MySQL unexpected behavior.
If anyone cares, tested versions: DB2 9.5, Oracle 10g and 11g, PosgreSQL 8.2, 8.3 and Firebird 2. MySQL was 5.0.45.
Posted by
cmihai
at
2:22 PM
7
comments
Labels: Databases, Open Source, Software Development
Getting started with PostgreSQL - a Database Primer
A quick guide to getting started with the PostgreSQL database server:
Download and install PostgreSQL. If you're using some kind of BSD or Linux, it's probably already in the ports / packages repository. You may need to use initdb to create a new database cluster, and edit pg_hba.conf to grant your users / machines connect privileges to the server. If you're in a UNIX-like OS, you'll need to "su - postgres". After that:
Connect as postgres:
psql -U postgres
Create a role:
CREATE ROLE testuser LOGIN PASSWORD 'test123';
Create a database:
CREATE DATABASE testdb;
Note that the database is created in the cluster ENCODING. If you want to specify a different encoding (not recommended) you can use something like:
CREATE DATABASE testdb OWNER = testuser ENCODING = 'UTF8';
List databases, groups, users, quit:
\l+ \dg+ \du+ \q
Connect as the new user to the new database:
psql -U testuser testdb
Create a table:
CREATE TABLE test (ID serial PRIMARY KEY, name varchar(25) NOT NULL UNIQUE);
List table, relations, schemas, describe table:
\d
\dt
\dn
\d test
Insert some data:
INSER INTO test VALUES (default, 'quux');
Do a query:
SELECT * FROM test;
\q
Delete a database:
Once you've got the hang of things, you can use \? and \h for help:psql -U postgres
DROP DATABASE testdb;
\?
\h
\h CREATE DATABASE
You can now delete the testuser role:
psql -U postgres
DROP ROLE testuser;
Create your new username and database, and connect to it. Create a simple database schema.
Here's a fun PostgreSQL feature: HTML output. \H turns it on, \H again turns it of:
We have a very simple table with 3 entries:
goods=> \d countries;
Table "public.countries"
Column | Type | Modifiers
---------+-----------------------+-----------
country | character varying(50) | not null
Indexes:
"countries_pkey" PRIMARY KEY, btree (country)
goods=> SELECT * FROM countries;
country
---------
A
B
C
(3 rows)
\H
goods=> \H
Output format is html.
goods=> SELECT * FROM countries;

We can use \o to redirect the output to a file:
goods=> \o countries.html\q and view the file in your web browser :-).
goods=> SELECT * FROM countries;

Now that you've got the feel of psql, you can use PgAdmin III (or PHPPgAdmin or whatever interface you like, like OpenOffice.Org Base or Microsoft Office Access). PgAdmin III also shows the SQL commands it's going to run, so it's a good way to learn SQL.

Use this for a tutorial and this for reference.
Posted by
cmihai
at
12:41 PM
0
comments
Labels: Databases, Open Source, Software Development
Monday, February 04, 2008
Using OpenOffice.org Base to access PostgreSQL databases
Just like Access can connect to a PostgreSQL database via ODBC or JDBC, so can OpenOffice.org Base. But the good news is we don't need to use ODBC or JDBC, as there is a native PostgreSQL SDBC driver for OpenOffice.
Download the postgresql-sdbc-ver.zip file, start OpenOffice (if you start writer type Ctrl-W to close it) so you can access Tools - Extension Manager. Add the downloaded driver, then restart OpenOffice (you also need to exit the QuickStarter. Just right click the SystemTray icon - Exit).
Now you can start OpenOffice.org Base and connect to a PostgreSQL database:
In the Connections Setting type: "dbname=YourDBName host=YourDBServerIP"
Setup a username and password:
That's pretty much it for the database setup, now you can start creating your database. You can use data already available in the PostgreSQL server, or create new tables. You then build Queries, Forms and Reports based on those tables.
You can use the Table Design or Table Wizard to create tables:
You can use the Relationship Editor to create Foreign Key constraints:
You can use the Form Design and Form Wizard to create Forms and the Report Design / Wizard for Reports:
It's usually a good idea to take a look with psql every now and then. OpenOffice.org Base isn't exactly perfect when it comes to creating the database schema, and especially when it comes to constraints. Of course, neither is the SDBG drivers, so it's best to consider this "just for fun" for the moment.
Posted by
cmihai
at
9:11 PM
0
comments
Labels: Databases, Open Source, Software Development
Cracking the Kensington MicroSaver lock with toilet paper
I've seen plenty of "rip out the Kensington" or using a pen / screwdriver to crack the lock, but this is just ridiculous...
Posted by
cmihai
at
7:28 PM
1 comments
PostgreSQL 8.3 Released
PostgreSQL released version 8.3 of "the world's most advanced open source database".
Remember to dump/restore with pg_dump if you're planning to upgrade :-).
Here's a list of "What's new in 8.3".
Benchmarks also show a huge increase in performance from 8.2, some benchmarks even showing a 2.x performance boost from 8.2:
http://www.ajaxonomy.com/2007/sql/postgresql-83-vs-82-a-simple-benchmark
http://archives.postgresql.org/pgsql-general/2008-01/msg00417.php
Version 7.3.15 7.4.13 8.0.8 8.1.4 8.2.beta1 8.3beta1
tps 311 340 334 398 423 585
Improvements have also been done in terms of scalability.
Posted by
cmihai
at
6:17 PM
0
comments
Labels: Databases, Open Source
Sunday, February 03, 2008
Accessing PostgreSQL and Oracle with Access and SQL Developer
Microsoft Office Access is a RDBMS that uses a GUI interface and RAD tools and a Jet Database Engine backend. It can also use external data stored in SQL servers such as MSSQL or Oracle, PostgreSQL, DB2, etc. via ODBC.
PostgreSQL is "the most advanced" open source database. It is a BSD-style licensed ORDBMS that supports advanced SQL features such as referential integrity constraints (foreign keys, column checks, etc), full ACID compliance, ANSI SQL compliance, views, rules, sub-selects, transactions, triggers, sequences, inheritance and has a built in language (PL/pgSQL) similar to Oracle PL/SQL. It also exhibits almost linear scalability up to 16 cores, being much more scalable then say, MySQL. As of version 8.3 it gets a performance and scalability boost too. The pgbench benchmark here shows an almost 50% performance boost (under certain workloads) from 8.1.
Using an ODBC connection you can use Access as a Rapid Application Development interface to develop Forms, Reports and Applications using PostgreSQL as a backend database, via PSQLODBC.
Install psqlodbc on your Access machine, and all you need to get started now is a PosgreSQL server (if you don't have one on your network you can install one on your Windows machine from:
http://www.postgresql.org/download/
Fire up Access and open up a database. We are going to create the ODBC connection and save the settings. First, let's export some table to the PostgreSQL database via ODBC. We can later link or import the table (in any database).
Create a new Data Source using the "PostgreSQL Unicode" driver. The goods database was created using "CREATE DATABASE goods OWNER cmihai ENCODING 'UTF8'" and we are planning on storing Unicode data.
Once you've selected a Server hostname (or IP), username, password and database (like the newly created "goods" database in your PostgreSQL server) you need to set some advanced options. Uncheck the "Bools as Char" box.
Check "True is -1":
Now we can Import a table using an external data source (it will import the structure and data of a Table in PostgreSQL as a table in Access. The tables will not be linked).
We can also Link tables using an external data source. This means that the data and structure of the table (schema) is only modified in the PostgreSQL database. We can link multiple applications to the same database (and tables). Just use Get External Data - Link to Data Source and select the PostgreSQL ODBC connection.
As you have noticed, PostgreSQL is case sensitive.
The linked tables are shown in the Table view with a sphere icon.
While you can use the Query Builder (in Design view or SQL view) to query data in the Access database (it can use both access tables and ODBC connected tables), there is an option to pass the SQL query directly to PostgreSQL, in Pass-Through mode.
SELECT public_clienti.nume, public_clienti.prenume, public_tari.tara
FROM public_clienti INNER JOIN public_tari ON public_clienti.tara = public_tari.tara
WHERE (((public_clienti.nume)="Gigi"))
ORDER BY public_clienti.nume, public_clienti.prenume;
The PostgreSQL query wouldn't use the public_clienti prefix, we can just do a simple Pass-Through query:

You can use Pass-Through queries in your Forms and Reports too.
Of course, you can also use Access with Microsoft SQL Server 2005 Express (freely available) or even the free Oracle 10g Express, using the SQL Developer Quick Migration tool to export MDB files to Oracle.

You can use the Quick Migration Wizzard:

Or the full blown "Oracle Migration Workbench Exporter for Access" to export your .mdb file for SQL Developer and Oracle Application Express.
Posted by
cmihai
at
9:47 AM
0
comments
Labels: Databases, Microsoft, Open Source, Oracle
Friday, February 01, 2008
Hibernation File Forensics
The Sandman Project is a C library that allows you to read the Windows hibernation file like a standard memory dump.
Posted by
cmihai
at
1:09 PM
0
comments
Labels: Digital Forensics, Security

