Tech and travel

Posts

Using pyparsing

2007-10-24

The day after I hyped the Getting Started with PyParsing book, I got to use it. Here’s the script : from pyparsing import SkipTo, Suppress, CaselessLiteral import glob # Example to match # delete from TABLENAME # where CUSTOMER_ID = 'INTERNAL'; table_name = SkipTo("where") where_clause = SkipTo(';') delete_stmt = Suppress("delete") + Suppress("from") + table_name + Suppress("where") + where_clause + Suppress(";") for filename in glob.glob('*.sql'): f = open(filename) print '-- ', filename, ':' lines=f.

NLS_LANG settings

2007-10-24

To get the language setting of the current session : SELECT USERENV ('language') FROM DUAL; This returns the database character set, not the user’s though. The NLS settings can be found in the following list, in this order. If a value is specified in NLS_SESSION_PARAMETERS, it has preference over a value in NLS_INSTANCE_PARAMETERS. NLS_SESSION_PARAMETERS NLS_INSTANCE_PARAMETERS NLS_DATABASE_PARAMETERS

PyParsing

2007-10-22

I just bought and read the Getting Started with Pyparsing PDF book. And it’s good. PyParsing is a way of building a parser using Python code. You should think Yacc/Lex, but readable. It can be used to parse text, and it can also handle HTML. This is the example from the PyParsing website : from pyparsing import Word, alphas greet = Word( alphas ) + "," + Word( alphas ) + "!

TNS_ADMIN

2007-10-19

By default Oracle expects tnsnames.ora to be in the $ORACLE_HOME\network\admin directory. This is not always the most convenient place, especially because that directory is usually owned by the oracle user. To get around this, you can set the TNS_ADMIN variable. This points to the directory where you have put your own copy of tnsnames.ora . Like they say on TV : darn useful.

Greece

2007-10-11

I just spent a few days in Greece, visiting Athens, Sounio and Delphi.

The temple of Hephaistos in the ancient Greek agora in Athens

The temple of Hephaistos in the ancient Greek agora in Athens

Copyright (c) 2024 Michel Hollands