mardi 26 juillet 2011

MacOS X Lion and the restore function

Hello,

I don't know you but I don't like my browser to restore the last opened tabs...
same for preview!

good news, you can revert it.
open the terminal and type:

defaults write com.apple.Safari ApplePersistenceIgnoreState YES
defaults write com.apple.Preview ApplePersistenceIgnoreState YES

and that's like before, the "good old time" :-)

dimanche 24 juillet 2011

SQL Server with Oracle linked server

Hello,

last days I spent a lot of time to establish a link server to Oracle from SQL Server.
I thought that using instant client was enough but I was definitely wrong.
... what to install then for making it working?

I had to search a long time before I saw somewhere on a forum (sorry I lost the link) that we should install this one:
32-bit Oracle Data Access Components (ODAC)
with Oracle Developer Tools for Visual Studio

you can find it here: http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html

now it is easy:

add a tsnnames.ora in the folder ORACLE_HOME\Network\Admin\
and add your server like:

MY_SERVER =
 (DESCRIPTION = 
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 200.200.1.1)(PORT = 1521))
   )
 (CONNECT_DATA =
   (SERVICE_NAME = myserviceSID)
 )
)

now you should be able to connect with:
sqlplus MYUSER/MYPASSWORD@MY_SERVER

then create an ODBC connection to Oracle, choosing the driver "ORACLE in ../instant client/..."
the name of the ODBC connection will be for instance MY_SERVER_ODBC

then go to SQLServer and add the linked server:

exec sp_addlinkedserver @server='MY_SERVER', 
    @srvproduct='Oracle',
    @provider='OraOLEDB.Oracle', 
    @datasrc='MY_SERVER_ODBC'
EXEC sp_addlinkedsrvlogin 
     @rmtsrvname        = 'MY_SERVER'
    ,@useself           = 'False'
    ,@locallogin        = NULL
    ,@rmtuser           = 'ORACLE_USER'
    ,@rmtpassword       = 'ORACLE_PWD'

congratulations, now you should be able to make a select by typing:

SELECT TOP 10 * FROM MY_SERVER..MY_SCHEMA.MY_TABLE




vendredi 18 mars 2011

sylisa-csv2db is born

Hi everybody,

I am very happy to announce a new utility to import CSV file into SQLite.
http://gitorious.org/sylisa-csv2db

It can import any CSV that excel could generate as well as to normalize it during the import.
It creates the table if needed, and will create also the dimension tables if you want to normalize some fields.

I wrote it without Qt neither boost dependency to be able to compile it quickly on multiple platforms and to be self-contained by including SQLite inside.

I am using CMake to compile it, so it should be really easy to compile on all platforms...

Please send me your feedback if you find it useful and/or if you have any idea for improvement.

@+
Sylvain

jeudi 17 février 2011

c++ deletion of an incomplete type

Today I had an issue when I implemented a smart_ptr for my dblite project.
I wanted to move out the dependency for some reason (iphone,ipad).

In this library I am using the pimpl idiom and once I replaced the shared_ptr of boost by my version of it, I faced a warning of the compiler: 

warning: possible problem detected in invocation of delete operator:

Hopefully I found the solution to my problem here:
Private implementation using smart pointers and deletion trouble

I didn't understand clearly what was the workaround used by boost::shared_ptr to work on incomplete type, but it was surely useful. As far as I understood, the trick would be to instantiate an deleter object when the pointer is assigned so at this moment the type is complete.

ps: I found the trick!
using a function pointer to delete.
It is very well explained here: http://www.justsoftwaresolutions.co.uk/articles/genericptr.pdf

dimanche 23 janvier 2011

libxml2 and readline

using libxml2-2.7.8 on mac os x but probably also on linux,
we surely want to have the history when using the interactive mode in xmllint (xmllint --shell)

so we need to re-compile from the sources. Well it should be simple normally.
but ./configure does give an option --with-readline ... but no chance, it doesn't work.

after being stuck for few days, I decided to have a look in configure.in
and there, I discovered the option --with-history ...

so the right command line is:
LDFLAGS="-L/usr/local/lib" CFLAGS="-L/usr/local/include -L/usr/local/include/readline" ./configure --with-history

by default, I don't know why, it doesn't take the /usr/local directory to discover the existing libs.
so it is worth to add them. everything should work now.

Speak to you soon,
Sylvain