Monday, April 13, 2009

Ldaptor, Python List, Django

LDAPtor - The king who never made it

I wanted to deploy ldap server on windows. Apache DS with a 200 simulated user environment went kaput and need frequents restarting/backup. Openldap on Windows via the berkeley db was prone to corruption as well. Nothing seems to work robustly under Windows for some of these open source projects, no matter how popular it was. 

Then i found Ldaptor, written completely in python via the Twisted framework. Wasn't really a big fan of the Twisted framework, heck, the only book on Twisted i saw by Oreilly, had examples that are "badly" coded in my personal opinion, works though. One can't doubt the benefit of having such a large ready made framework. 

After just 5 minutes trying out ldaptor, it bombs out, won't even run, turns out that some modules are referencing the previous Twisted "components.interface" and should be replaced with "zope.interface.Interface", then it runs. Now just have to figure out how to import the Ldif into it...documentation seems to be scarce on ldaptor..."Ldaptor will one day rise to world domination" 

Thats the problem with a LOT of open source projects, abandoned or left dying prematurely when the Initiator found something more profitable to do...

> Switch Channel ....

I am really grateful for some of python default implementation and behaviour, especially on its container. 

I wanted to get a list of files in a directory and process it according to its "creation time". i did a "glob.glog" on a directory, the return result  was anything but sorted.  The normal procedure would be something like this :-

1. get each of the files creation time
2. sort based on the creation time
3. process the file

In python that translates to :-

ActualFiles = [(os.stat(x).st_ctime,x) for x in GetFilesListing(path))]
ActualFiles.sort()
for x in ActualFiles : 
# do something with already sorted x[1]

When i wanted to remove some items from a list and yet continue to process the list :

for x in MyList[:] :
if x.value == "whatever_i_am_looking_for" :
MyList.remove(x)


If this was translated  to C++ it would be something like this  (warning: it won't work!)

for (ptr = listcopy.begin(); ptr != listcopy.end(); ptr++)
{
if  (ptr->value == "whatever_i_am_looking_for") 
{
listorg.erase(ptr)
}
}

Thus, someone who starts on python would probably find it hard to move to C/C++ but
someone who starts from C/C++ would  easily addicted to python and appreciate its fun way of working (lazy).


> Django

I wonder how does Python web building such as Django matches against premium platforms like ASP.Net. Just the other day some people working on PHP was amazed to see how building cool working websites was done in ASP.NET. All those ajax coding are so automated it makes similar offering in PHP looks primitive not to mention the state of the art Visual Studio IDE.

Frankly developing website is something that is out of my reach but it would be great to see how Python fare in this area. Better than PHP? Ruby on rails? Come on, it has to do better. 


 







No comments:

Post a Comment