Sunday, November 09, 2008

People that need to adapt SQL files to isql format, which means 1 SQL command per line (No "new line" characters are not allowed) can use this great tip from waldner & prince_jammys @ Freenode #awk channel :

awk '/^--|^$/ {print; next} !/;$/ {printf("%s ", $0); next} { print }'

This comes in handy for people that are happy with MySQL integrated into their Software where suddenly the big bad Oracle comes along and you need to do bells and whistles to make it tick.

isql is a great utility that can allow you from the command line work with every datasource UnixODBC supports.

Have fun...

Thursday, January 24, 2008

A quick note about python.

People anxious understanding lambda functions, take a look at this code:

#!/usr/bin/env python

# Define nameless (lambda) function.
# This means that we:
# a) Create a function object.
# b) Assign "f" a reference to this object (function).
f = lambda x: x+42

# Call this function, passing it 1 variable.
print f(0)

# Do the same thing, simply replace the nameless with a "FULL" function.
def func(x):
return x + 42

# Assign variables "g" a reference to function "func"
g = func

# Call this function, passing it 1 variable.
print g(0)