Share the Knowledge
RSS icon Home icon
  • Windows Tip: Run applications in the background using Task Scheduler

    Posted on July 21st, 2011 webmaster No comments         Print Print

    I was working on a project a couple of weeks ago which involves Celery for processing tasks.  I wanted the Celery process to run in the background as a service but it didn’t come with a Windows service installer, we will have to write our own.  Since we were still just working on a proof of concept, I didn’t want to spend too much time on this at this point and then I realized I could probably just use the built in Windows Task Scheduler application.

    The reason I wanted Celery to run in the background as a service was because one of the worker nodes we’re using is shared with another group.  They may need to reboot the machine at any time or log off my user session which would kill the Celery process.  I wanted the Celery process to automatically start when Windows starts, run silently in the background using a user account I specify, automatically restart the task on failure, and manage it remotely without fully logging in to the machine where it runs.

    I was able to accomplish all of the above by simply using Task Scheduler.  Below are the settings I used. Read the rest of this entry »

  • How to set the proxy settings in Windows via command line

    Posted on June 11th, 2011 webmaster No comments         Print Print

    Once in a while I need to download and install Python packages at work and having switched to Linux (Ubuntu) at home, I find it quite annoying now to have to go to a website, download the package I need, then manually install.

    Fortunately, the pip installer works for Windows as well, allowing the installation of Python packages automatically with a simple command (pip install package_name).  But at work, we’re behind a proxy server so I have to set the HTTP_PROXY environment variable first before pip can connect to download the packages.

    You can set this environment variable permanently so you don’t have to keep re-typing it every time you open a cmd window, but since our proxy requires authentication I prefer not to hardcode it (plus I’ll have to remember to update when my password changes).

    Simply type this in the cmd window to set it (note that the setting will get deleted once you close the window):

    
    set HTTP_PROXY=http://user:password@proxy.domain.com:port
    
  • How to convert a Large Integer value to normal date format using PowerShell

    Posted on December 6th, 2010 webmaster No comments         Print Print

    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.

    The following PowerShell command can be used to do the conversion (forgot the website where I got this from, will reference it here if I find it again):

    
    $lastLogonTimestamp = "129358017032999046"
    
    [DateTime]::FromFiletime([Int64]::Parse($lastLogonTimestamp))