Tech and travel

Posts

Countries visited

2008-01-08

Beginning of the year, not much to do at work. So I’m planning my holidays. There are still some new places to visit : The ones in red are the visited ones. Update : a page called Countries visited was added to site.

Using twill to check my lotto numbers

2007-12-06

Twill is, according to their website, a simple scripting language for Web browsing. It’s a language in it’s own right, but all the command can be called from within Python. Here’s an example : from twill.commands import * my_numbers=[ [2, 4, 6, 8, 10, 12], [8, 10, 12, 14, 16, 18], ] config("use_tidy", "0") redirect_output("log.txt") go('http://www.national-lottery.co.uk/player/p/results/results.do') for row, l in enumerate(my_numbers): for i, value in enumerate(l): fv("quickCheckerForm", "longPlayslipForms[0].drawGameBoards[%i].numbersChosen[%i]" % (row,i), "%i" % value) fv("quickCheckerForm", "drawSubTypeID", "1") submit() try: find("Congratulations") print "Won something !

Kew

2007-11-05

On a lovely autumn day, I went to see the Henry Moore statues at Kew gardens.

Tree

Tree

Using pyparsing – 2

2007-11-02

Parsing sql statements like the following is dead simple with PyParsing. INSERT INTO table_a VALUES ('A', 'B', 'C'); INSERT INTO table_a VALUES ('D', 'E', 'F'); This is the program : from pyparsing import Suppress, delimitedList, sglQuotedString, removeQuotes sglQuotedString.setParseAction( removeQuotes ) stmt = Suppress("INSERT INTO table_a VALUES (") + delimitedList(sglQuotedString) \ + Suppress(");") f = open('some_file.sql') lines=f.read() for tokens, start,end in stmt.scanString(lines): print tokens f.close() PyParsing already knows about quoted strings. The sglQuotedString type matches a single quoted string, which is handy for strings in SQL.

Authomatic statistics gathering

2007-10-29

Oracle 10g has a feature where it gathers optimizer statistics automatically at night. This is done through a scheduled job called GATHER_STATS_JOB. If you want to disable this, you have to issue : EXEC dbms_scheduler.disable(’GATHER_STATS_JOB’); To enable it again : EXEC dbms_scheduler.enable(’GATHER_STATS_JOB’); The following query shows when this job was run : SELECT * FROM dba_scheduler_job_run_details WHERE job_name = ’GATHER_STATS_JOB’; There are other tables, all starting with dba_scheduler, that show the schedules and so on.

Copyright (c) 2024 Michel Hollands