Scripts posted recently by txus in Kelpi

1- 5 of 5.

scape blanks javascript

to javascript scape regular expression by txus

function cleanBlanks(source){
	temp_string = source;
	source = (temp_string.replace(/^\W+/,'')).replace(/\W+$/,'');
	return source
}

parse MySQL log file

to python sql file parse stats by txus

#Open the file
f = open('26.log','r')
#some variables
ITEMS = total_log_lines = TAGS = BOOL = SELECT = POWCounter = 0 
for s in f:

View python environment

to python library sys path by txus

>>> import sys
>>> sys.path

Zope zsql method like clause

to zope zodb zsql like by txus

<dtml-comment>
When your database supports SQL ,with this function you can use the Like % string % clause from sql. 
</dtml-comment>
select count(FIELD1) from TABLE1 where FIELD2 = <dtml-sqlvar PARAM1 type="string"> and FIELD2 like <dtml-sqlvar "'%' + PARAM2 + '%'" type="string">
hits counter