Blog / Tech

How to convert a Large Integer value to normal date format using PowerShell

December 6, 2010

My co-worker was wondering last week whether an old Windows domain user account was still being used by someone. Having managed Windows domain environments at my previous jobs, the first thing I did of course was go to Active Directory and check the LastLogonTimestamp attribute. This attribute is stored in the Active Directory database as a Large Integer so it will need to be converted to a normal date format to make sense of it. …

Python function for displaying a list of dictionaries in table format

December 3, 2010

I just spent like 2 hours writing this function, but it was worth it!

This cut down a lot of duplicate code on the project I'm working on. I figured I'd post it here in case someone is trying to do the same thing. I'm sure my code is not optimal so if you have any suggestions on how to improve it please feel free to comment :).

from operator import itemgetter

def format_as_table(data,
                    keys, …

How to retrieve the name of the calling module in Python

November 23, 2010

I was writing some Python code yesterday and I was wondering if there’s a way to retrieve the name of the module making the call to another module so I can log it automatically. I found this post that gives an example on how to do it using the built-in inspect module (I had to modify the sample code a little bit to make it work).

It looks like you can use this module to …

vi for Windows

October 6, 2010

You’re probably asking “Why in the world would I want to use viin Windows?”

Well, I didn’t have an answer to that until a couple of days ago. I was testing a software that seems to have been originally designed for UNIX and ran into an issue modifying a configuration file. I needed to add an entry to the config file so I used Notepad to do it but when I tried starting the …

Deadlock issue when using Python’s subprocess module

September 24, 2010

I ran into an issue yesterday when calling an external Java application from Python using the subprocess module. The Java application loaded but appeared to have stopped executing after loading its properties files (last entry in the log file is after loading the properties file).

My Python code looked something like this:

import subprocess

javaApplication = subprocess.Popen(["java", "-jar", "application.jar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

# The wait() function is actually not a good idea to use
# when …