Util: Folder Compare Tool


I have recently developed a python utility to compare files with same name stored in the root of two folders.

Few Usage of the tool:

  • Validating the dynamic reports before and after migration of database
  • Validating the text files between two servers after sync.
  • Validating the text files between two version of application.

The python scripts can be download from http://sourceforge.net/projects/pyfoldercompare/

Advertisements

Tips: wx.Python: Animated Gif in


import wx

import wx.animate # ..\wx\animate.py

class MyPanel(wx.Panel):

“”” class MyPanel creates a panel, inherits wx.Panel “””

def __init__(self, parent=None):

wx.Panel.__init__(self, parent)

self.SetBackgroundColour(“white”)

ag_fname = r”progress.gif”

self.ag = wx.animate.GIFAnimationCtrl(self, -1, ag_fname, pos=(0, 0), size=(64,64))

self.ag.GetPlayer().UseBackgroundColour(True)

self.ag.Play()

#self.ag.Stop()

if __name__ == ‘__main__’:

app = wx.App(redirect = 0)

frame = MyPanel(None)

frame.Show(True)

app.SetTopWindow(frame)

app.MainLoop()

Tips: Python : wxFormBuilder v3.1.67-beta (Febuary 18, 2010) Python Update


Latest version of wxFormBuilder does not support wxAdditions fully, thus I have updated few XML files to support FlatNotebook & wx.propgrid widgets.

  1. Download wx.propgrid and install it.
  2. Download the XML.Zip folder and extract it in plugins\wxAdditions\xml folder.
  3. Restart the wxformbuilder.

I did not tried to update these files for other widgets but it should be similar.

Tips: MSI: Save differences between two msi as MST file using ruby & python


Ruby

require ‘win32ole’
msiClass = WIN32OLE.new(“WindowsInstaller.Installer”)
msidb = msiClass.OpenDatabase(“C:\\temp\\MountPointGenerator.msi”,0)
newmsidb = msiClass.OpenDatabase(“C:\\temp\\updatedMountPointGenerator.msi”,0)
transform = newmsidb.GenerateTransform(msidb,”c:\\temp\\newtest.mst”)

Python

import win32com.client
import os
import sys

msiOpenDatabaseModeReadOnly=0
msidb=r”c:\temp\MountPointGenerator.msi”
msiupdb=r”c:\temp\updatedMountPointGenerator.msi”
mstdb=r”C:\temp\MNPtrans.mst”

installer = win32com.client.Dispatch(“WindowsInstaller.Installer”)
database = installer.OpenDatabase(msidb, msiOpenDatabaseModeReadOnly)
updatedDB= installer.OpenDatabase(msiupdb , msiOpenDatabaseModeReadOnly)
updatedDB.GenerateTransform(database, mstdb)

TIPS: SQLite: Python: How to get the details of a table


There are two ways you can achieve it.
1.
cursor.execute(“PRAGMA table_info(tablename)”)
print cursor.fetchall()

2.
sql = sqlite3.connect(self.cFile)
c = sql.cursor()
query = “select * from preferences”
c.execute(query)
col = [tuple[0] for tuple in c.description]
print col

Note:
cur.description returns a tuple of information about each table. The entire tuple is : (name, type_code, display_size, internal_size, precision, scale, null_ok)