Groovy find file pattern search in folder recursively

September 24, 2010

Groovy nugget for find a file recursively into a given file with a patterned search

Quite efficient and neat stuff..

modified from: http://www.javaworld.com/community/node/3881

def findFileRecursive( directoryName, filePattern) {
def fileFound
def directory = new File(directoryName)
if (directory.isDirectory()){
def findFilenameClosure = { if (filePattern.matcher(it.name).find()){  fileFound = it } }
directory.eachFileRecurse(findFilenameClosure)
}
return fileFound
}
Advertisements

Debugger point in Pharo Code

September 20, 2010

I have been meaning to post this with a little updated code but I its better to go with what I have and see if anyone else can help get it in shape, than wait for my spare time that never comes..!

The need to stop in a particular method is served by using self halt. but that is a little kludgy going and putting in this stmt through the code sections and cleaning it up. The standard debugger capability as in VW or VA with breakpoints is what is needed.

To be able to get started in a simple manner, i just hacked into the OBCommand hierarchy and put in this two cmds that help me insert a self halt. and remove it.. at the top of the method. but it is not good beyond a point..

* It creates history of method changes each time you put in the self halt and remove it.. I could not figure out an easy way to switch off the method changes log for such changes

* It is not currently supporting the right click insertion at the cursor point.. and removal by again the cursor point near/ before or after the self halt.

* Better still just simply a debugger point with capabilities of VA/ VW.

But for what it is worth I put this piece of code for anyone to tinker further with..

http://www.squeaksource.com/PharoGoodies/AddRemoveHalt-Skrish.2.mcz


Pharo XMLRPC kick start

September 19, 2010

Pharo / Squeak XMLRPC Project

Ok, I did have the push / or the shove coming in for the use of Pharo XMLRPC code with a colleague Vibhu M. putting in the effort to try out the old existing code, getting the tests to run on the first cut.

I have modified the XMLRPCTest and XMLRPCServerEchoTest to complete the loop.

Two issues that are from Komanche Server package:

BlockClosure >> processHttp

uses fixTemps message that is deprecated in Pharo, causes the server to freeze. Either run the server in a fork / or remove the call to fixTemps or override fixTemps to doNothing rather than the modal warning dialog.

This one I need nail it down, comes from some basic package one off: from:to: .. has the trailing colon missing.. probably in KomServices package, which I override by loading KomHttpServer later, This also helps in having HttpService available in order.

Prereqs:

* KomService

* KomHttpServer

* XMLParser

* DynamicBindings

all in this order works fine.. guess should have it in ConfigurationOfXMLRPCClientServer created to have dependencies marked.

http://www.squeaksource.com/PharoGoodies/Spy-Vm-Skrish.Pharo.5.mcz

http://www.squeaksource.com/PharoGoodies/XMLRPC-Server-vm-Skrish.15.mcz

Action items are:

* make it work in a performant manner against Groovy with a seaside front end picking values through Groovy to various DBMS using JDBC DB2/ Oracle/ SQLServer and others..

* Make it complete with respect to prereq/ dependency loading, all corrections as reqd even for fixTemp etc..

Per se it is ready to roll out for my enterprisy stuff.. all trials/ POCs can role out with this to the extent required.

* convert to VisualAge..? or is it already available there..?

* compare performance time against direct DB connection for RPC fetches localhost

* compress the server sends to achieve some performance improvements with both client/ server fixes to do compress/decompress.

Thanks to Vibhu to get it going.. I was prevaricating on getting on this for a while now..