TroyGrosfield.com TroyGrosfield.com

Headline

Django Production Environment Setup with MongoDB

Author
by Troy Grosfield
Date
November 22nd, 2011
Category
Developer
Story

Many developers are often curious on what a possible web environment setup looks like in production. That answer can vary greatly depending on what exactly you want your application to do. A few question to ask yourself: Are you expecting heavy traffic on the site? How will you be notified if something in your system … read more

Tags
Comments
1 Comment »
Headline

Django, Celerybeat and Celery with MongoDB as the Broker

Author
by Troy Grosfield
Date
November 22nd, 2011
Category
Developer
Story

Enhance your user experience by preventing your users from having to wait long periods of time for certain actions to occurs.  There are times when you want to send an email to many people or do other processor intensive work that you won’t want your user to have to wait on.  In cases like these, … read more

Tags
Comments
2 Comments »
Headline

MongoDB with RAID 10 on Ubuntu 11.04

Author
by Troy Grosfield
Date
November 8th, 2011
Category
Developer
Story

I recently setup RAID 10 on our MongoDB server. I thought I would share how and why I did it.  We’re using Amazon’s Web Services (AWS) and running Ubuntu 11.04. What is RAID 10 Why We Chose RAID 10 Setup RAID 10 with MongoDB on Ubuntu 11.04 Monitor the RAID Troubleshooting What to do When … read more

Tags
Comments
11 Comments »
Headline

Python Cheat Sheet

Author
by Troy Grosfield
Date
October 17th, 2011
Category
Developer
Story

Frequently used methods I use in Python with examples. Date and Datetime Lists and Sets Finding Intersection of 2 Lists Working with Urls Date and Datetime Useful links: http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior http://labix.org/python-dateutil String to Datetime Convert a string into a datetime object. >>> from datetime import datetime >>> datetime.strptime(‘Jun 1 2005  1:33PM’, ‘%b %d %Y %I:%M%p’) datetime.datetime(2005, … read more

Tags
Comments
No Comments »
Headline

Installing and Running MongoDB on a Mac

Author
by Troy Grosfield
Date
March 21st, 2011
Category
Developer
Story

MongoDB is a very powerful schema-free, document oriented database.  The following steps will show you how to get MongoDB up and running. Install MongoDB I used the Homebrew package manager to install mongodb. If you have Homebrew, run the following commands: $ brew update $ brew install mongodb You will see output like the following: … read more

Tags
Comments
3 Comments »
Headline

How to Find and Remove a Computer Virus

Author
by Troy Grosfield
Date
February 27th, 2011
Category
Developer
Story

For the first time in about 10 years my computer has been infected with a virus.  My first thought was “shit!”.  My second thought was “interesting”.  My third thought was “sounds like a challenge”.  So I set off to find ways to cure my computer of this virus. How I think I got the computer … read more

Tags
Comments
3 Comments »
Headline

Parsing XML with Python using ElementTree

Author
by Troy Grosfield
Date
December 18th, 2010
Category
Developer
Story

There are many ways to parse XML in python. I will show you the basics on how to parse XML using ElementTree. While ElementTree 1.3 and higher is not needed for this example, it’s nice to have because it has better xpath support than the earlier version.  pip install elementtree if you don’t already have … read more

Tags
Comments
5 Comments »
Headline

Installing easy_install and pip for Python

Author
by Troy Grosfield
Date
December 18th, 2010
Category
Developer
Story

easy_install and pip are python package installers that will make your life a lot easier when developing in python. Installation These steps assume you already have python installed and that python is in your windows environment variables. Download setup-tools according to your python version.  I’m currently running python 2.7 and running on windows so I … read more

Tags
Comments
No Comments »
Headline

Preventing an SQL Injection Attack in PHP

Author
by Troy Grosfield
Date
December 15th, 2010
Category
Developer
Story

I recently was asked to fix some bugs on a particular website.  While looking through the state of the code I noticed the site was susceptible to an SQL injection attack. Issue The site is taking the user input and directly inserting it into the SQL statement without escaping. PHP Code Issue $sql = “SELECT … read more

Tags
Comments
No Comments »
Headline

Preventing Character Input Using Javascript

Author
by Troy Grosfield
Date
December 1st, 2010
Category
Developer
Story

The objective here is to prevent a user from typing a specific character in a textbox. This can be accomplished with only a few lines of Javascript. Html Here we create a simple form with a single textbox: <form action=”#”> <input type=”text” /> </form> Javascript Now we add the Javascript to prevent characters from being … read more

Tags
Comments
2 Comments »