2006-06-29

Quote: about the documentation

Took it here

So far there's a couple of dozen HOWTOs, but a poor selection of WHENTOs and only some abstract WHYTOs

2006-06-28

U-U-U-UbuntU

At last I've received DVD with Ubuntu Dapper, which I ordered at filepost.ru.

I updated without the Internet, to get the fastest result I had to remove some old packages from universe/multiverse.

Three days... so far everything is OK. Gdm now loads a little bit earlier but it seems that the whole systems loads faster. Gnome, video driver i810 and Eclipse are still cramped in 256M. Go on living on vesa.

Now I'm planning to run Ubuntu on Windows using coLinux, get familiar with apt work through proxy and using a small utility download required dependency packages.

2006-06-27

Oracle burrs

It will work only if to remove small Russian letter p (sounds like r)

declare
buffer varchar2(2000);
parser xmlparser.Parser;
xmlClob CLOB;
begin
parser := xmlparser.newParser;
buffer := '<?xml version="1.0" encoding="ISO-8859-5"?>'
||'<root>абвгдежзиклмнопрстуфхцчшщьыъэюя</root>';
dbms_lob.createtemporary(xmlClob, TRUE);
dbms_lob.open(xmlClob, dbms_lob.lob_readwrite);
dbms_lob.write(xmlClob,length(buffer),1,buffer);
xmlparser.parseClob(parser, xmlClob);
xmlparser.freeParser(parser);
end;

2006-06-22

Why should I test the code, if it works all the same?

I'm wild about it:


Almost pseudo code:

databaseAdapter.open(UID,PWD);
databaseAdapter.execute("select 2 from dual");
databaseAdapter.close();
databaseAdapter.open(UID,PWD);
databaseAdapter.execute("select 2 from dual");
databaseAdapter.close();


It falls on the second select.

2006-06-19

Python-inotify on Ubuntu

By hook or by crook I've stuck into my system the package python-inotify.

There is a library in Python for building rmp packages. What's a pity that it's not for deb.

I've come across a strange roughness, fixed it by explicitly setting the folder with h files.

file: setup.py

module1 = Extension(
'_inotify',
sources = ['inotifymodule.c'],
include_dirs = ['folder where source has been unpacked'])

python setup.py bdist_rpm
fakeroot alien python-inotify-0.1.0-1.i386.rpm


I have to see if it is possible to build python libraries in Scons.

2006-06-13

CPPUnit Addon

I had to dig CPPUnit a little to have a possibility to inspect values of MFC CString in case of test failure.

#include <cppunit/TestAssert.h>

CPPUNIT_NS_BEGIN
// specialization for the CString type
template<>
struct assertion_traits<CString>
{
static bool equal( const CString& x, const CString& y )
{
return x == y;
}

static std::string toString( const CString& x )
{
// adds quote around the string to see whitespace
OStringStream ost;
ost << "\""<<(LPCSTR)x<<"\"";
return ost.str();;
}
};
CPPUNIT_NS_END


When I'll have enough time I'll readjust CompilerOutputter a little to have nice green and red lines in the console :)

2006-06-08

Setter returns this

I've spied in new Eclipse a new feature or even pattern of beautiful code.

Void is useless. When every expression has a value it's cool.

/**
* This class provides a convienient shorthand for creating and initializing
* GridData. This offers several benefits over creating GridData normal way:
* The same factory can be used many times to create several GridData instances
* The setters on GridDataFactory all return "this", allowing them to be chained
*/


For example:
// Example : Typical grid data for a wrapping label
// GridDataFactory version
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.CENTER)
.hint(150, SWT.DEFAULT)
.grab(true, false)
.applyTo(wrappingLabel);

// Equivalent SWT version
GridData wrappingLabelData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
wrappingLabelData.minimumWidth = 1;
wrappingLabelData.widthHint = 150;
wrappingLabel.setLayoutData(wrappingLabelData);

2006-06-06

PLSQL Procedure Call in Python

I had some trouble. In cx_Oracle documentation there is nothing. Ours is here.

How to call PL/SQL function returning an array in python?

result = cursor.callfunc('getFoo', [cx_Oracle.STRING, 20])