Daniele Esposti's Blog

Timestamp and microseconds on Windows platforms

The datetime.datetime object can return the current date and time with a resolution up to microseconds which is true on *nix platforms but not completely true on Windows platforms. The problem On both platforms, and at least with Python 2.7, the minimum resolution reported by datetime is 1 microsecond: >>>...


For loops in Windows command line

I’m working on a script on Windows to automatically install Python packages listed in a text file like pip does. Because easy_install doesn’t support a requirements.txt as a packages’ list I made a small Batch file to simulate the pip’s behavior, and I discovered the for loop of Windows’s command...


Distribution of wealth in a society of equals

In this blog I usually write posts related to information technology, but I stumble upon this post on NoiseFromAmerika (an italian blog about politics and economics) and I was surprised about how a concept backed by the common sense it’s so wrong when it’s analysed with scientific method. I made...


Multiple prefixes match

I’m not using often string manipulation (I usually handle SQLAlchemy’s queries and sometime XML/XHTML manipulation with the lxml library) but sometimes I need to analyse some paths expressed with a dotted notation comparing every path with a predefined list of path prefixes. The obvious solution is to compare in a...


Disassembly C code for fun – Part 5: if statement

Time to disassembly the if..then conditional statement. I’ll say in this post will be not exciting like the previous ones (except when we’ll disassembly the optimised code) but the if..then block is one of the base statements of every language so it’s important to know how it’s translate to assembly...