Thursday, March 23, 2006

use a batch script from cygwin

Yes you can start a batch script from cygwin. What did I use this for? Well, it's usefull to restart a windows service for example with the DOS command
net stop service_name
net start service_name
You can then login remotely with ssh in your cygwin shell and restart the windows service or start any command you can start from dos, just write the commands in a .batch script.

Monday, February 20, 2006

nevow ,the templating engine from twisted needs Zope.

I installed nevow, the templating engine from twisted to create web pages on windows. The problem was that I had to install zope for windows as well. I don't now why.
I plan to use this templating engine because my web page generating scripts are very ugly, with plenty of if, elif, elif and one cannot find the structure of a web page in there.

Monday, February 06, 2006

xls2csv, using python win32com and excel

This python script change a bunch of excel files in cvs files, needs Excel installed on the computer.

#
# Save all Excel files in the current dir as csv files
# (CSV = comma separeted values)

from win32com.client import Dispatch
import os,time

xlCSV = 6 #a vba constant for this fileformat
xlApp = Dispatch("Excel.Application")
xlApp.Visible = 1

def saveAsCSV(filename):
xlApp.Workbooks.Open(filename)
xlApp.ActiveWorkbook.SaveAs(filename[:-3]+"csv",xlCSV)
xlApp.ActiveWorkbook.Close(SaveChanges=0)

for root, dirs, files in os.walk(''):
for file in files:
if ".xls" in file:
print file
saveAsCSV(os.path.abspath(file))
xlApp.Quit()
del xlApp

If you need to do this on linux, you can try that program: xls2csv.

Saturday, January 28, 2006

Drupal cooperative website

I use Drupal as a cooperative website on aienstib.com. This engine has a lot of configuration option and it permits special authenticated users to post php code, now that is realy powerfull. I think it is important to follow the best practice guidelines