Wednesday, February 29, 2012

Django and Version Control for Multiple Environments/Developers

Ok so I recently started messing around with Django after getting my feet wet with a little python development. One thing that quickly became apparent was that if I was going to have a project that I write in django go live I would probably need a way to migrate code from one environment to another, or hopefully migrate my code to another developer to help with the development effort.

I searched around the web and most solutions I found had me keeping at least one file outside of my VCS (settings_local.py for instance). This was not a reasonable solution to me, as I am of the ilk that if I have a file in my project that gets edited, I want that file to have version control mechanisms in place :). I asked in the django irc chat and didn't really get the answer that I wanted but low and behold my good buddy Sean hooked me up from a linux chat I have been part of forever. Here is a quick tutorial/how to, to get the job done so you can keep your settings.py settings all in git/svn/nameVcsHere. I personally use git but that is not relevant to this discussion.

Step 1 - Create a settings_map

Create the settings_map.py file in the project folder (ie where your manage.py file is). The file is basically just a dictionary with key:value of the system -> settings. So for instance mine looks like this:

_settings_map = {
'BHM-LUS-V001':'settings_dev',
'BHM-LUS-V003':'settings_uat',
'BHM-LUS-V005':'settings_prod',
}

Using the first key:value for example 'BHM-LUS-V001' is the name of the server that I do my dev work on and I am going to put dev specific settings, like connection string info, in a file called settings_dev.py

Step 2 - Creating the various settings files

After I did this I made a copy of the settings.py file from inside my project folder and named it settings_common.py. This file will contain all the information that will remain the same no matter where I develop. Things like language_code, static_url, staticfiles_finders etc. I removed (read commented out for now) the sections I was going to extrapolate to the environment settings files.

Next I copied the settings.py file again but this time called it settings_dev.py. This file is FAR more sparse than the other file I copied. I basically removed EVERYTHING in this file except the database settings, ADMINS section, Debug info, etc. So it ended up looking something like this:

from settings_common import *

# Django settings for Dev Environment project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
('Paul J Warner', 'email@adddress.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db_name',
'USER': 'dbuser',
'PASSWORD': 'dbpass',
'HOST': '',
'PORT': '',
}
}

A KEY thing to note here is the VERY first line, from settings_common import *. This pulls in all the common settings and allows us to just deal with the settings that will change from environment to environment. This is also handy because as requirements change (ie multiple developers working in multiple timezones for instance) you can extrapolate from the settings common into the settings_env.

Step 3 - modify manage.py to use the new settings

manage.py is a pretty simple file, if you open it up, that does a TON of stuff. But that is outside the scope of my post. We are just going to modify it so that it can use our new settings files.

First you need to import our system_mappings dictionary
from settings_map import _settings_map

Next modify the DJANGO_SERTTINGS_MODULE sections to look like this:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", _settings_map[os.uname()[1]])

What this is doing is telling the django system to look at your settings map dictionary and use the VALUE from the one that matches the hostname of the system you are working on. This is the part to me that was just brilliant, and while Sean calls it a hack I think its a really elegant way of getting the job done. Now as long as the hostname of the computer that I am working on is called BHM-LUS-V001 django will use my settings_dev settings. When I add additional machines like BHM-LUS-V003 all I will need to do is create the settings_env file and map it to that in the settings_map file.

The benefits of all this work (after you do it its actually not that bad in retrospect) is that you can now keep all your settings in version control. This is pretty great when you are working with other developers as well so that they can easily create their own from yours as a template. After I got this all set up I moved into my UAT environment with very little issue.

If you stumble upon this post and have questions or comments (maybe I missed a step) let me know.

Tuesday, August 30, 2011

5 Old Network Admin Paradigms Revisited -- Revised

There are a lot of reasons that network administrators are the hard ass nose to the grind stone types. One of those reasons is that they deal with users (many of them like you reading) that have burned them in the past. These burns go deep and are hard to change the thought process after the fact. There are some things that network administrators still do today that they have been doing for the last decade for these exact reasons. I would like to revisit some of these policies and suggest ways to deal with them with today's infrastructure.

Email storage quotas

This is one of the biggest mistakes that I see in most enterprise environments. Network administrators placing a quota on the disk space that users can save in their email. With the relative low cost of storage these days this is really an obnoxious practice. Especially concerning the amount of times users rely on email to pull up things that clients have asked in the past. Email can be a great tool to get you out of a tough spot when a co-worker is pressing an issue that you have already addressed, or if you ever have to show proof that something was communicated.

It also serves as a temporary brain for most folks. They can pull up info from 4 years ago and get information out to the people they need it much quicker than if they had to go look the data up again. This can of course have its drawbacks due to the fact that people tend to not VERIFY the information they had from 4 years ago, that may not be entirely correct now. It is important that users know the difference.

Something else that should be stressed is that if you are using a 3rd party to host your email, if you ever have to re-download all your mail due to a new computer or a re-install of your mail client if you have 10GB of email saved then it's going to take a really long time to pull all that down and start going again. I personally archive off all mail at the beginning of every new year around February. All email Older than December of the previous year gets archived off to an external hard drive. If I ever need that info for what ever reason its an easy attach in Outlook.

Restricting personal devices from network
This is one that I am honestly on the fence about. Users in today's environments are bringing in iDevices Tablets, laptops, music players etc, and with today's increasing movement to cloud storage and access these devices are all needing and consuming valuable address space on the network. The problem is not that the devices are bringing in nasty virii etc, but that most environments haven't planned for the surge in devices. You can segregate the devices from the main network quite easily, and creating an address space of a few thousand addresses is nothing. Hell you can even just have a DHCP with a netmask of 255.0.0.0 and serve up all the devices you can imagine (at least for now). Just make sure users know that you aren't their personal geek squad, and they are on their own for figuring out how to use the device. This includes, in my opinion, setting up corporate email.

User storage quota
Users are pack rats, and any network administrator worth his salt will know this. Users keep the most obscure documents in the most obscure locations on the network. Documents from the late 90's can probably be found on any network that has been running since that time. And realistically how useful is that document. It isn't the space itself with this that network admin are trying to wrangle, its the pack ratting. In my opinion there are other way better ways to do this. For instance you can use a Share service like SharePoint and have all documents stored on that server. Space these days is so cheap that adding a few Terabytes isn't going to blow the budget. Additionally this keeps your network from have 8 versions of the same document floating around, which also reduces the chance that someone will send an errant document to a client.

Ultimately you shouldn't limit storage. It is entirely too cheap, you just need to have better ways of organizing it.

Account lock outs
How many people reading this type their password in 2 times and then cringe and type the password in the 3rd time REALLY slowly. Account lockout policies are completely chaotic and should never be that stringent. The old adage was 3 attempts and you're done. There are so many problems with this that to even start on them could be a new post. But I will give you a couple reasons to loosen the grip on account lockout policies.

One major reason is that if it is so low users can easily screw it up 3 times and cause you to have to go in and unlock them. Additionally it could make it really easy to DOS the network. Want to cause complete chaos? Just get a list of users on the network (easy enough if you are on the network) and then proceed to fail them all one at a time.

The other reason that it should be loosened up is that people are increasingly using their accounts for testing software that requires network access. If you have a policy to change the password every 90 days this can cause software related lockouts. If you are worried about brute force attacks having the lockout at something like 50 is a pretty reasonable limit. Brute force attacks are going to try THOUSANDS in the matter of a couple seconds, so 50 is still a low number in that scenario.

Limiting open source software/or software in general
Limiting employees from using software has it's place, and I fully understand you don't want users running bittorrent clients, but let's be realistic here. In the case of open source it's usually free (as in beer), and the users are comfortable with it, which makes them more efficient, which in turn gets their work done faster. Users should be aware that any software that they wish to have installed will not be supported by the Network Administrators or the Help Desk or whatever they are called in your organization. Users need to self help on this stuff. Obviously your team doesn't have time to support every piece of software known to man. None the less most of the OSS tools out there are better than the ones most enterprises rely on. Off the top of my head 7zip is able to compress WAY better than winzip. So give some of the tools a try and see if they can hurt anything. Most times they won't.

I hope you enjoyed this and I also hope that if you are a network admin you will take these into consideration in your own environments.

Should I buy a Tablet...and which one?

A question that I have been asked a lot lately from all of my friends is

Should I buy a tablet or not? Or should I buy one of those netbooks or a laptop.
If I should buy a tablet, which should I buy?
Should I wait for the next Apple tablet?

And other questions like that. As I usually do with regards to this type of question and when it relates to these sorts of things, let me preface this with saying that I like Google... But that doesn't mean that I don't appreciate what every other company is bringing to the table in this realm. So without further adieu let me get to answering these questions.

Should I buy a tablet or not? Or should I buy one of those netbooks or a laptop.
This is a tricky question and I am pretty sure that it is why I get asked it so much. First and foremost the thing you need to understand about tablets is that they are CONSUMPTION devices. What do I mean by this? If you need a portable computer that you are going to be using to write blog entries at the coffee shop, or if you plan on doing emails and such, then you are not going to be primarily CONSUMING data with this device. You will be using it in a hybrid fashion of input and consumption, and I would suggest the netbook.

If on the other hand you want a device for viewing large amounts of data, then a tablet may be for you. I personally own a Samsung Galaxy Tab 10.1. I can honestly say I love the device. I have had it now for right at 2 months now. I personally use it to consume information such as news, twitter, google plus, facebook, and the occasional IMBD. I use it while I am laying around the house to check email, but I rarely use it to reply to emails, unless they are short and sweet. The keyboard on the Galaxy is actually quite useful for any good typist. I use the home keys and everything. I do consider myself to be a power user, but I don't do my "power user" activities on this device.

So ultimately if most of what you do is consuming data streams like twitter and facebook or playing games like fruit ninja, then you will find that you will get a lot of use out of a tablet. If on the other hand you are going to be doing activities that require a great deal of typing or the likes then a netbook may be your pony.

Monday, July 11, 2011

My early stance: Google+ vs Facebook




::Disclaimer::
I am by no means an expert, but I know tech. People keep asking me where I stand on Google+(G+ hence forth) and Facebook(FB hence forth). I am also a self-proclaimed Google fanboi from gmail all the way to android, so take my thoughts with a grain of salt maybe. But to clarify the last statement, I am a Google fanboi because I agree with most of what they do and how they do it. I can not honestly say that about many large corporations. With that said lets get to it.
::Disclaimer::

Circles/Groups
Big surprise I like G+ (did you even READ the disclaimer), but here is why. G+ has taken the time to really see how we interact as human beings. What do I mean by that? When I was probably 16 one of my best friend's grandfather told me something that I today hold close to my heart. That if you want to go places in this world you have to know how to switch hats. You have to know when to be Professional Paul, Fun Paul, Strict Paul, etc. G+ actually gives me that option with the roll out of circles. I can have "circles" of friends that I can share things with. I don't need my work friends watching me take shots at the bar with my out-of-work friends, work people reading this, I don't go out and do shots...out-of-work friends shh.

Another fantastic thing about circles is that I can share information about myself to select groups. I LOVE social check-in features of twitter and the likes, I HATE that anyone can see that stuff, thereby letting everyone know that I am not at home, or that I am traveling, etc. But I really enjoy posting "Hey I'm in Boston", and getting a response from someone that I may not have seen in 5+ years "OMG lets meet up and do dinner." Yes I do understand that someone can in turn "share" this info from the circles that I share this with, thereby allowing more people to see it. But guess what, if I tell you a secret face to face, what is stopping you from telling someone else...mostly social norms, it's taboo...G+ implements this by telling you when you are re-sharing, that the person that shared it with you initially may not want that info going to other groups. This I LIKE.

On top of all this, I think that adding people to circles is REALLY easy. FB groups on the other hand, while it is easy to add people to groups as you add them to your contacts, its not really intuitive to add them to those groups after the fact, also it is not really THAT apparent what those groups can and can't see. This to me is a huge problem, and is also a huge problem for most FB users. I know I have around 20% of my friends that have at some time changed their FB name so that if couldn't be searched for on google etc. They do that when they are searching for jobs, when they are applying for college etc. Circles makes this far easier, if you don't want the general public to see it, don't post it to the +Public circle.

Hangouts
This is something that kind of made me laugh. I have been trying to use various video chat clients for at LEAST the last decade. It just never really caught on, till now of course. Hangouts let you video chat with up to 10 ppl. 10 PEOPLE. Every other service is 1-on-1 with the best I ever saw was through Meebo which allowed 4, but it was ugly. Even FB rolled out FB chat for 1-on-1 via Skype. Skype has always had the video chat, and you upgrade for the "conference" chat.

I can't really comment on FB video chat right now though. There is one of two problems on that front. I either haven't had the feature rolled out, OR I am far to freaking technical to figure out how to initiate it. I have done everything I can think of to get it to work and it isn't working. Maybe I will figure it out this week.

Hangouts seemed pretty natural to me, my wife had a bit of trouble but was easily coached through the setup. And I have done a few hangouts. I even had a hangout with a buddy from Finland. I was amazed at the audio quality as well as the video quality. I can see myself using this in the future without a doubt.

Sparks
Haven't used this feature TOO much yet, as I have other ways that I tend to get my news, but neat feature to have. The results in my opinion are a bit rough on the edges, but it is still really early.

Instant Upload
Some people will be a little leery of this feature. Any pictures and video I take from my phone/tablet get instantly uploaded to a private album that is accessible by G+. I love this, it makes sharing VERY easy. Now I am not going to lie, even if FB rolled this feature out I would disable it... Odd and hypocritical some may say, but the key difference here is my level of trust in what G+ provides over FB. I just don't trust FB farther than I could throw it. That pretty much is the gist of it.

Integration
Ok, I admit this is something that FB just can't compete with at the moment. G+ has the advantage that Google has all these things to integrate with it from gmail to reader. While that integration is not here completely YET, I am pretty sure that the integration is on its way...it just can't survive without it, there is to much info that can be shared in all of Google's other services that I know they don't want to miss out on.

Conclusion
There was a time when I said Google Wave was going to change the world, and it didn't. It still has TONS of potential, and that is why Google is making it open source and allowing people to have public/private personal waves, but still it didn't change the world. I think G+ has a chance to change the way we share, that is for damn sure. Here is what I currently use my Social Media Stuff for.

Google+ - Sharing with people that are on Google+, hoping to make this my default sharing service.

Facebook - Getting in touch with people, I don't really share there too much...but will share this post :)

Twitter - Following people I want to know about, what they are reading, what they are posting etc. as well as tweeting interesting things in my life.

Yammer - Internal Work posts

That is pretty much all I use. Facebook lets me keep in touch with people and stalk their pictures. I am hoping G+ allows me to share with people the way I have ALWAYS wanted to share...

Wednesday, February 09, 2011

Two Weeks In - No Satellite TV


So it's been about 2 weeks since the wife and I cut the cord to our Satellite provider. While it is pretty hard to say for sure, I think we are doing quite well with the change. We haven't had any shows come up that we haven't been able to watch either online, or that we can't live without so I take that one in the old win column. One thing that I failed to mention in my previous post was that I also have an Over the Air Digital Antenna. For whatever reason, every time I tell someone that I have one of these they go "What is that?" Well I personally bought the TERK HDTVa Amplified Directional Indoor HDTV Antenna. Basically think the old school rabbit ears, only these are capable of picking up FREE digital channels. You can also read that and say that it gets free HD channels. Yep there are signals floating in your house with that HD greatness and it’s all for the grabbing.

Either way, I used www.antennaweb.org to find out the best way to point the antenna. Basically in my house to get the most use of the indoor antenna I need to point the antenna at around 60 degrees. Once I accomplished that and hooked it up to my TV, then let the TV find out which channels were available, I ended up with about 17 channels. This gave me all the normal channels (FOX, ABC, NBC, and CBS) as well as a few obscure ones like PBS, Country music channel, and Speed TV or something like that. The only channel that is giving me grief right now is ABC. And even that channel comes in pretty good.

Here are the caveats of the setup so far. Over the Air HD is all or nothing. Unlike the rabbit ears of old where you could get a snowy signal, with digital you either have a signal capable of producing a signal or you don't. So for instance on ABC there will be times when it blanks. The wife was watching The Bachelor on Monday and every 10 mins or so the screen would go blue for all of 2 secs. Not a huge deal but for some people this could be a deal breaker.

PlayOn and Netflix have been everything and more than what I expected. Hulu is almost a digital DVR, and the Quality more than meets my expectations. Using PlayOn I have my Hulu queue set up so that any time a show comes on, if we miss it live over the air, its ready without wading the sea of shows that Hulu has. Oddly enough Jill has found some really great shows that are only on Hulu and Netflix, as they were discontinued and are now DVD only that we never heard of. Some of those are "Dog bites Man", "Better off Ted", and "Parks and Rec" to name a few. While Parks and Rec isn't canceled it allowed us to catch up and we now watch it with everyone else :).

All I can say is that while it is very early in the game as Jill is still in busy season, and I don't really care for TV that much in general, we are coping WAY better than I ever thought we would. The jump was scary, and I never imagined a life without Cable/Satellite, it’s a good time to be going without. Oh and did I mention that this ala carte offering is saving us around $100 a month? Yeah...Cable and Satellite can suck it, I don't need them anymore!

Link to the original post
*EDIT* I fail at spelling

Monday, January 31, 2011

Sloss Furnace Shoot



Originally uploaded by ruffyen.
So pretty much ever since I bought my camera I have wanted to go out to Sloss Furnace and take some photos of the place. First off the place has TONS of historic value for the city of Birmingham, secondly the old rusty fixtures there just seemed like something that was begging me to shoot. And I was pretty spot on. There were some really fantastic shots that I got out of this outting. The one here was in my opinion the best of the shots that I took. Very little editing was required of the image and ultimately I thought I really looked good. The rest of the set can be seen here
One thing that I was not aware of was all the red tape that you have to go through to take pictures at Sloss, even for "educational" purposes, or if you just think the place is cool and want to shoot photos. Basically they own all the pictures no matter what you do, and if you ever plan to sell them in a gallery or anything they get one complimentary piece of thier choice. It's pretty crazy if you read the entire document which turns out to be like 5 or 6 pages. None the less, none of it really mattered to me so not a big deal in the end.
Additionally my wife and I decided to make a day trip out of it and go explore downtown Birmingham camera in hand and see what else we could find. My second two favorite pics of the day came from the peanut gallery. The first image is of what I think is an antique roaster, and the second image is of one they actually use at the factory.
Overall I learned a few choice pieces of knowledge. If you are going to shoot somewhere that is protected by the Parks and Rec department, make sure you know what you are getting into. Secondly, when someone says they ask for donations, what they really mean is, " there is a fee to shoot here, but we wont tell you how much that fee is you just have to decide what it means to you.." to me it was $5 bucks :).

Monday, January 24, 2011

Pull the Plug


Ok, so I made the jump today and cut off the cable/satellite. You heard me right completely cut it off, didn't mess around with reduced price packages etc. that they try to do when you are pulling out of their services cold turkey. The service officially cuts off next Monday, as that is the end of the billing cycle. Now with that being said I am certainly not giving up TV. I actually put together a pretty sweet setup. I bought a Western Digital Live TV Hub which allows for netflix streaming and can pretty much play ANY codec that you throw at it. I coupled this with PlayOn which allows streaming of Hulu and various other services.

Truthfully PlayOn is where the setup really shines and is worth every penny of the $60 I spent on the life time subscription. I have had the setup running to make sure there would be no major hiccups when the connection to satellite finally goes black. The biggest hurdle was going to be some of the shows that Jill watches, but we were able to find those through various services that the PlayOn has.

Overall really satisfied with the setup. We will see how it goes in about a month and I will write up any pitfalls that happen along the way as well. If you have any questions etc either email me or leave one in the comments.

Thursday, January 20, 2011

Police officers Acquitted in Alabama Brutality Case



You have to watch the full video to understand both sides of this story in my humble opinion. Disregard the men talking just watch the video. It is my full belief that officers of the law should take every means they have available to them to be safe, they have families as well. But it is also my opinion that what happens in the last 11 seconds of the chase was completely uncalled for. The acts that they performed were, from my point of view, completely filled with emotion. I am an avid mixed martial arts fan (read UFC for most people), and even I am appalled by the actions I saw these officers take.

I have heard the argument that these officers are trained to think that every criminal of this stature is armed to the teeth and dangerous. But it would be my understanding that they are also trained to act without bias or emotion. They can't get wrapped up in the moment, they can't act on instinct, they have to act above the people they are serving and protecting. I cannot honestly believe that a panel of jurors watched this video and did not think that what the two officers, that were charged at a federal level, did no harm. While I am not 100% who the two men were, I am going to go on a limb and just say it was the initial officer with the night stick and the officer beating on the guys face.

There are good cops out there, I served in the Air Force with a guy who is now a cop up north, and I can honestly say that I would think he would have the presence of mind to not do what these officers did, and would have probably pulled the jack ass off that was pounding on the guys face.

Truthfully, the first guy in the image after the criminal is thrown from the vehicle(37secs in to the video) and laying face down, not moving, I can almost give him a pass. That was around 5 seconds after the man was thrown from the car and it is nearly impossible to see that he was knocked out in that time. The guy beating on the man's face came in at the 44sec mark of this video, and that is roughly 12 secs after the man is thrown from the vehicle. If anything that man should have had the book thrown at him.

None the less I am going to wrap this post up. I am not happy that both of these men were acquitted of their charges. While I am content with them losing their jobs over the matter (again it is a tough call on the guy with the night stick), I can not say that justice was served here. The man that ran the cop over, and lead AL police on a 22 min chase, should have been tried in front of a jury, not on the side of the highway by 5 armed men. We live in a society where laws are supposed to serve justice and while I do not agree with a vast majority of those laws, as stated here, I think those that blatantly feel they are above the law should be struck down with furious vengeance. Thoughts?