« September 2009 | Main | November 2009 »

October 28, 2009

Last step in getting perl drivers for Postgres

While trying to install new DBD::Pg drivers on mac os x Snow Leopard I got the error below, when running test code:
dyld: lazy symbol binding failed: Symbol not found: _PQconnectdb Referenced from: /opt/local/lib/perl5/site_perl/5.10.1/darwin-2level/auto/DBD/Pg/Pg.bundle Expected in: dynamic lookup I found that the Makefile.PL that cpan made for DBD::Pg was pointed at the wrong directories for libraries. I made the changes below to Makefile.PL (located in ~/.cpan/build/XML-DOM-1.44-tM9lK0):
#$POSTGRES_INCLUDE = $ENV{POSTGRES_INCLUDE} || $pg->inc_dir || "$ENV{POSTGRES_HOME}/include"; $POSTGRES_INCLUDE = '/opt/local/include/postgresql83'; #$POSTGRES_LIB = $ENV{POSTGRES_LIB} || $pg->lib_dir || "$ENV{POSTGRES_HOME}/lib"; $POSTGRES_LIB = '/opt/local/lib/postgresql83'; Then
sudo perl Makefile.PL
sudo make test
sudo make install

And the error was gone.

Also I had to switch
#!/opt/local/bin/perl # /usr/bin/perl

October 21, 2009

utf-8 utf-16 and UNIX

1) Convert utf-16 to utf-8.
iconv -f utf-16 -t utf-8 bell-map-IMAGESspreadsheet.xml > tt
2) Have less read utf-8
export LESSCHARSET='utf-8'
cat just works.

October 6, 2009

Some useful drupal sql

Find uid given user nae (in this case naa)
select uid from users where name='naa';
Get the number of uploads by user 'naa'
select count(upload.fid) from upload, node where node.nid=upload.nid and node.uid=(select uid from users where name='naa');

Get the number of files owned by user 'naa'
select files.filepath from files, upload where upload.fid=files.fid and upload.nid=68652;
Find path to uploaded files:
select files.filepath from files, upload where upload.fid=files.fid and upload.nid=68652;

title element wrong for media ingest

The IMAGES xml files used to ingest data into the the media repository contain a flaw.
Bad version (current): <title main="Duplex House" variant="Residence project" variant="Exterior presepctive"/> Good: <title type="main" > Duplex House </title> <title type="variant" > Residence project </title> <title type="variant" > Exterior perspective </title> Effected files: bln-dcugranting2007.xml
botanical-dcugranting2007.xml
cbi-dcugranting2007.xml
ellis-dcugranting2007.xml
mno-dcugranting2007.xml
mss-alexanderBros.xml
mss-dcugranting2007.xml

Some more files (all the rest):

s 001-bell-historicalmaps
005-ymca-wwiPhotos
006-map-19thCent
008-eas-ming
011-mss-purcellMasonite