Before I get too far into writing posts about code I’m playing around with and the latest learning resources I’m using, I wanted to touch on what resources I found very useful to get started.
Depending on your background, you might need to take a different path. I had programming classes in my college days and tend to be fairly analytical. With that said, I can understand the basic flow of code and have been able to troubleshoot other peoples code periodically as part of doing network/systems administration. Because of this very basic understanding, I started learning using the videos over at TheNewBoston.
The videos from the new boston are pretty good to familiarize yourself with the language. I’d say it’s like learning words in high school foreign language classes. By the time you are done, you’ll know some good basics, but you probably won’t be able to do anything spectacular with it unless you already know programming and you’re just picking up a different language. I’m not trying to knock the videos. They are quick and to the point. They are a great way to get ready for the next resource, Google’s Python Class.
With the familiarity of the basics from the new boston, you will be able to follow Nick Parlante as he takes you though training and exercises that will have you writing real code. The exercises are what really separates the Google videos from the other tutorials online. They are fairly challenging, although maybe that’s more reflective of me than the actual exercises. The exercises have you add your code to the python files you download from the course website. The cool thing about the files is they have test functions built into them so after you add your code and run it, the exercise will check and see if it gets the correct information back.
The exercises start off with string functions and by the end of the training you are grabbing html from the web, doing regular expression searches through it, grabbing pieces of a puzzle and building the puzzle by assembling them in the right order and outputting the layout via html. When completed, if you open you html file and see the proper image, you completed the exercise successfully. These exercises were actually extremely fun and you learn a lot.
After using these two resources, I jumped into write a few things for work. I wrote the following:
1. A script that takes a Dell service tag and returns the warranty expiration date. This can be used to go through all the Dell workstations and servers that we manage and populate our database with warranty expirations so that we can inform clients of the approaching expiration. Typically, clients don’t renew the workstations, but they do typically renew the servers. That’s some extra sales that we might have let slip by. I did not get to the database portion yet, as I haven’t learned that part of python yet. I’ll add onto this later.
2. A script that exports all the contacts from the Global Address List in Microsoft Outlook. For one of our clients, I had to export their address list using the get external data function in Access. Then I’d export it to Excel. Lastly, I’d have to clean it up as it would include a bunch of garbage and email addresses weren’t formatted properly. This took probably 30-45 mins each time, and I had to do this monthly to send it to their office in Shanghai. Now with the script, it takes 20-30 secs and anyone can do it.
3. Next I started writing some code to go through our PSA to find workstations for a client that is no longer with us and changing their workstations to inactive. After banging my head against the wall for a few days, I finally was able to talk to the API and get the workstation IDs back. I thought all I had to do now was change the XML to the appropriate format to update the workstations and send the XML string back the same way I got the workstation IDs. Unfortunately, I was mistaken. I played with the updating portion for another day and then decided to hold off till I learn a bit more about XML and Python. I had another task that would help us, so I moved on to it.
4. Lastly, I wrote a script to access our disaster recovery system via the provided API and grab the backup status of each server for each client via XML. Then it formats an email with each client broken out with their servers, the current backup status and the last successful backup date and time. This saved us from having to login and drill down on each client every day. It also prevents us from forgetting to look if we walk into firefighting first thing in the morning. No matter what, you always end up going through email.
Before I moved on to other things, I felt I needed to learn more. Coursera had a class coming up called Crafting Quality Code. I figured I’d try that next. I’m just getting started in the class, but so far, it’s fairly interesting. I bought the book that the professors who teach the class wrote, Practical Programming (2nd edition): An Introduction to Computer Science Using Python 3 as it goes with the class. I’m also working my way through that. I’ll put a post out on the book when I’m done with it.Author
Jason Vanzin is the CEO at Vanzin Consulting Corp. He has over 15 years of IT experience and lives in Pittsburgh, PA. He blogs on topics related to Business Continuity, Python programming, and technology in general.