LBYL vs EAFP

So, it’s been almost a year since I’ve posted something, and it’s been a busy year.

ERATE twice, pushing my CCIE recert to the edge of losing it (23 days left in suspension when I passed), getting married to my best friend (Halloween if anyone is wondering), and yes still working to learn python.

One of my personal projects was a script that used FFMPEG to convert media files to X.265.
While I was doing this, I stumbled upon what appears to be a common…question? oddity? something anyway.

Look Before You Leap LBYL or Easier to Ask For Permission EAFP

Basically when you are getting ready to do something:
Do you check if a value/key is there first?
or
Do you just “try” and if it fails catch an “except” and do something else?

In my case, I was attempting to write a script that could take the base directory having the files in it directly, like:
/Movies/
or have the file in a folder like:
/TV/Constantine/
And expect to have “Season” folders

As I’m lazy, I don’t want to have two scripts to do this, or to have to modify code each time.

So the first thing I did was use split to create a list.(ok technically the second thing I did, as the first thing was to create a list of files that matched my criteria)

with open(found, 'rt') as shows:
for row in shows:
line = row.rstrip().split('/')

When the base is /Movies we only have line[0] = filename
When the base is /TV/Constantine/ we have line[0] = Season and line[1] = filename

Now that I have a list, I tried to check if element [1] exists

if len(line[1]) >= 1:

and if there was something there, it worked!!
if there isn’t anything there, it errors out….

Really? There is an else statement following…if it wasn’t true why didn’t it continue to the else?
after trying different things to make this work, and not being able too, I found a reference to

Once I did this:

try:
if len(line[1]) >= 1:

It actually worked!

Now, I still don’t fully understand why LBYL didn’t work, but a lot of code I found while searching for an answer seemed to follow EAFP using try/except method.

More Python goodness

Still working on learning how to use Python to do scripting and automation. I did hit a bit of a roadblock with one project as the documentation on the site had embedded links to some examples…and the links were broken. Kept trying to figure out how to get to them, tried different ways of creating the link from where the main documentation was at, nothing worked. Months of trying this off and on, and then I struck gold!! “Why don’t I just ask for them?” yeah, seems obvious and it should have been, but I had to do some digging to find an email address to send the question to. But wooo!! I finally have the schemas, so I’ll get back to that project eventually.

On to another subject kind of…

A friend of mine, posted some stuff a while back. Good resources to start learning with, so go take a look at Ashley McNamara’s blog.

And I’ve been working (trying too anyway) my way through the stuff on Cisco DevNet as well. Nice thing here as you go through the courses, they have links to their Cisco DevNet Github so you can clone the repo and have the scripts they use already. You’re always free to create your own, but if you are just using their sandbox server, they work great!

Token…anyone seen my token

Trying to learn python and scripting has lead me to using API calls. While some things are just fun to play with like FoaaS, others can be really useful.

Generally for a call to work, you need to have an API key. Some places may give you your API key, and some places you may need to generate one.

Generating one wasn’t really the problem, for the most part I was able to use my Google-Fu and find a ton of different ways to do this. Since I’m doing this with Python I decided to use requests for the OAuth2 piece. If you don’t have it already “pip install requests” will grab it for you.

What I was playing with a simple “Hello API” and the examples they had were all using curl.

Step 1 – Get your access token
curl -s -k -H “Content-Type: application/x-www-form-urlencoded” -X POST -d “client_id=” -d “client_secret=” -d “grant_type=client_credentials”

So reading man page/googling the options I was able to find out that “curl -H” is building the header and -d is the payload/data.

The easy part converting the curl to Python:

#! /usr/bin/env python

import requests

payload = {
    'grant_type': 'client_credentials',
    'client_id': "client ID",
    'client_secret': "client secret"
}

headers={
	'content-type': "application/x-www-form-urlencoded"
}

#-----------------------------------------------------------
	#Get access Token

r=requests.post("authentication url", data=payload, headers=headers)
print(r.text)

By doing this, I was able to login and generate the my access token and print it. So now I know what my token is.

Step 2 – Make the call

curl -s -k -H “Accept: application/json” -H “Authorization: Bearer

So I have my token, but how do I use it. Again my example was using curl, and yes it worked…but I wanted to do this as a single script. Google to the rescue!!

Since the response is coming back in json, I should be able to do something with that information, but how? Requests has a built in json decoder. By adding the “r.json()” after the post, I was able to cram the response into an object.

from pprint import pprint

r=requests.post("auth url", data=payload, headers=headers)
d=r.json()

pprint(r.json())

pprint gave me:

{u’access_token’: u’token’,
u’expires_in’: 3599,
u’token_type’: u’Bearer’}

Further digging/swearing/searching/swearing and I figured out how to take that data and make it a variable:

r=requests.post("https://cloudsso.cisco.com/as/token.oauth2", data=payload, headers=headers)
d=r.json()

#pprint(r.json())
mytok=d['access_token']

Now I have my token stored as a usable variable for Step 2. It took me a bit to figure out what the header configuration needed to look like. As you see from the curl example, I needed the Authorization to be + and at first I was trying to push both the “Bearer” and “Token” as a variable, but why? For this usage the token_type will always “Bearer”.

headers={
	'accept': "application/json",
	'authorization': "Bearer " + mytok
}

h=requests.get("hello api url", headers=headers)
print(h.text)

SUCCESS!!! Once I put all the pieces together, I can call the script and it does the login, grabs the token, stores the token as a variable, then uses it for the final call.

#! /usr/bin/env python

import requests
from pprint import pprint

payload = {
    'grant_type': 'client_credentials',
    'client_id': "client ID",
    'client_secret': "client secret"
}

headers={
	'content-type': "application/x-www-form-urlencoded"
}

#-----------------------------------------------------------
	#Get access Token and store in json

r=requests.post("oauth url", data=payload, headers=headers)
d=r.json()

#pprint(r.json())
mytok=d['access_token']

#------------------------------------------------------------
	# Use json data to fill token information
headers={
	'accept': "application/json",
	'authorization': "Bearer " + mytok
}

h=requests.get("hello api url", headers=headers)
print(h.text)

{“response”:”Hello World”}

Scripting with Multiple Machines

I’ve been trying to learn python and scripting in general. If I can make certain parts of my job easier by writing a script why not?

With that I’ve taken to doing some customization on my environment.

    Using Zsh instead of bash (pulled from Homebrew)
    oh-my-zsh (customization of zsh)
    Homebrew (package manager, can install all kinds of fun things)
    Pathogen (runtime for VIM)
    help from friends! Tony Mattke, Teren Bryson and others.
    DropBox
    GitHub of course!

The problem I was having was how to keep my customization and scripts in sync between my work machine and my personal machine. The answer I found, well one answer that works for me, is DropBox! Though you could probably use any cloud storage provider you wanted. I created a folder in my DropBox called “sync” and I symlink the files/folders I want to keep in sync on both machines into it.

Now, when I make a change to my .vimrc, zsh custom folder, or basically anything else I have symlinked, the change gets reflected to the other machine.

Schools, Enterprise or Not

How important is education? We hear this question all the time. So, how important is our children’s education?

Most school networking departments are working on a shoe-string budget. With this budget, they need to upgrade computers both for students and administrators, classroom peripherals i.e. smartboards, projectors. They also need to use this budget to keep their infrastructure  wired and wireless, and cabling up to date…for 5-7 years at a time. Yes you read that right, 5-7 years at a time.

Most people that work for at least a medium sized company, know that they will get a new laptop every three years. After three years, ok 6 months, most laptops are out of date. Wired networks get faster, wireless networks get faster, display drivers change get updated etc. And schools, the places where our children are supposed to be educated, have to wait 5-7 years.

Let’s think for a second, what do schools use that equipment for? To educate the next generation. Indeed more and more educational content is being presented online instead of via text books. School assignments are saved to the cloud. Heck even YouTube has educational content on it.

This post goes into how the children are more engaged with digital learning.

So the big Question: Are schools an Enterprise?

In my opinion, they absolutely are, or at least should be thought of as one. Let’s think about a school district that has 3,000, 5,000 or 10,000+ students. That’s HUGE when it comes to networking. How many switches are needed? How many Access Points are needed? What are the uplinks back to the MDF? Security? Internet Access? Server/Storage/Virtualization? Software? There are a lot of points that need to be upgraded, but how can they do that on small budgets?

I’ve been in schools that have 20+ year old fiber MDF to IDF, it’s not uncommon, and they can’t upgrade it due to budget constraints. They do what they can, upgrade switches, upgrade Access Points so that our children can learn. But to use one of my favorite analogies:

You buy a brand new Jaguar. It’s sleek, it’s pretty and it’s fast. But you live out on a gravel and dirt road. Makes a lot of sense right?

Now expand that to school networks. The students and faculty get spiffy new equipment, whether district or self provided. We’ve given the children a device that can access educational content at the speed of light,  but have constrained them to an infrastructure that is old and slow.

How can we expect our children to learn, to stay engaged when the local Starbucks has faster access? Why are we not helping our schools upgrade their infrastructure out of the dark ages? We go to work and expect, no demand, that the network be fast and stable. Why is this not a demand of schools? Or more importantly the School Boards?

How do we get more funding to the schools? How do we ensure that the next generation(s) has the tools necessary to thrive and surpass us?

802.11ac Speeds

Faster, faster faster!!! That’s what we all want right? Faster cars, faster computers, faster Wireless?

Well, let’s put the brakes on that for a minute and talk about this.

Let’s talk about what happens when we go “faster” and how we achieve it. Let’s start with Channel Bonding. Wireless uses a 20MHz wide channel to pass traffic, let’s think of this like a 1″ hose. In 802.11n with 5GHz channel bonding, we can now take that single 1″ hose and join it with a second 1″ hose, and basically have a 2″ hose that can spray more data. Sounds great right?!

The other way we get faster is modulation. Modulation let’s you say more in the same amount of space.. Anyone remember The Micro Machines ManJohn Moschitta could say more in one minute than you could. Or if you prefer this analogy, the smaller you can write on a sheet of paper the more information you can get on it. 802.11ac allows for up to 256-QAM Modulation and we can take that bonding and go 20, 40, 60, even 80MHz wide!! ZOMG the speeds, the speeds!! STOP

Now we need to think a little bit about how this is going to affect the wireless network. So to start a little refresher. In the U.S. we have 3 non overlapping channels in the 2.4GHz spectrum 1/6/11. Now we all know that the 2.4GHz is “dirty”, lots of things can (and do) interfere with it. We also know that with the density that is needed to support BYOD/BYOT that even when the power is turned to it’s lowest setting there are issues with CCI (co-channel interference) and ACI (adjacent channel interference).

In the 5GHz spectrum, we have more channels (9-12 depending on the installation), and a “cleaner” spectrum. For the purposes of this post, we are going to assume we have 12 channels.

40MHz wide, if we go with 12 channels, that means we can have 6 channels to use. In most environments that should be fine, really dense deployments like Stadiums aside.

80MHz wide, again assuming 12 channels, we have only 3 channels that we can use. This puts us right back to one of the issues with 2.4GHz, we don’t have enough channels. So let’s hope you’re not doing this.

In the above infogram, you can see the max connected rate and throughput for a an 802.11ac client with 1/2/3SS. Remember this is “theoretical” and perfect world.

802.11ac wave 2 allows for up to 4 SS, and channel bonding of 80-80 or 160MHz wide. If we have issues going 80MHz wide, why would you want to go even wider and have only 1 usable channel? And “usable” it may not be depending on what your neighbors wireless is doing. Adding another Tx/Rx pair to a device is going to, probably, make it bigger. We all want to carry aroudn 17″ laptops and phablets right? That’s why what I’m really waiting for is MU-MIMO.

So for all the spiffy new speeds we can get, to achieve those “theoretical maximums” we have to sacrifice our spectrum, which we shouldn’t do. Channel reuse becomes a pain again, even if you are using some automagic channel/power settings.

Granted, this is all IMHO, take it or leave it.

WWS – Working While Sick

Being sick, it happens to all of us. But in todays society do we take care of ourselves the way we should? Do we take our sick days, and truly rest so that our bodies can heal?

I know that myself the answer is usually not. I know that when I don’t have to be in front of a customer I tend to work when I’m sick. Even this last week when I had the flu I worked for three days before I went to the doctor. So let me go over this:

Sunday afternoon my youngest called me and wanted to come home from her moms, so I went and picked her up. She wasn’t feeling good and wanted to be home with me. Monday was Martin Luther King Day and she didn’t have school, what she did have that morning was 103 degree fever… and an appointment with the doctor. Yup, she has the flu!! I had made her get a flu shot as usual, the flu shot this year was not effective. So one pharmacy visit later she’s posted up on the couch with her medication, orange juice, bear, fuzzy blanket and NetFlix. While I continued to work, feeling steadily worse each day. Come Wednesday, I woke up feeling like a hammered bag of nastiness.

I finally took my girlfriends advice and made myself a doctors appointment, and continued to work until it was time to leave. 3pm hits and apparently I’d been working with a fever, it was 102 when I saw the doctor (explains why I’d been freezing for two days I guess). So there I am with my prescriptions, and my doctor telling me to not work (WHAT? Don’t work, surely you must be joking). So what the hell am I supposed to do? I had no customer visits, but I had work that needed to be done.

 

I’m not kidding this is actually what I was thinking…I don’t have time to be sick, I have RFPs to respond to, BoMs to be built, SoW’s to write. And don’t lie, you know you think the same way.

 

In todays culture of ubiquitous connectivity “WFX” (working from anywhere) is possible, and do I love being able to work from everywhere! But what is this doing to us physically?

Just because we can work from home, does that mean we shouldn’t take the time if we are sick? Just because we aren’t in the office, and can’t get anyone else sick should we still work? Should we continue to push ourselves to get our tasks completed, even though we are having trouble concentrating and staying on task?

I felt horrible on Wednesday and Thursday, come Friday I couldn’t even talk and it still hurts to do so today. I took the sick days, but did I really? I was still responding to emails and text messages.

Are we too connected (perish the thought!) today? What ever happened to being sick and resting? I told my daughter to sit on the couch and relax, but did I take my own advice?

“Ugh. Somebody told me the other day to take it easy or I’d relapse. I should have listened. So tired of being sick and always have too much to do so slowing down isn’t an option”

Where does this feeling, that we need to always be working, come from? I know my boss would rather have me take the time and get better so that I’m thinking clearly and can be really effective.

 

Should we be onsite at a customers working because “no one on the team would step up and relieve us”?

 

Should we even be questioning the need to rest and take the time to heal? Should we wonder “How is this going to effect the project/timeline/company?” Maybe, but remember to flip that around as well. “How is this going to affect me?”

 

“Work Life “

I caught a post yesterday…ummmm ok maybe it was the other day…anyway when I saw it isn’t important what it was about is, “Work Life Balance”.

 

What is theWork Life Balance really? Well according to that wikipedia article, it is a concept of prioritizing work and lifestyle. Any less confused? yeah me either. What this sounds like to me is you work then you play…but make sure you make time to play.

Depending on your job, can you really balance work and life? Ok, sure if you have “desk job” an “8-5” or something where you are forced into standard set hours? Sure you can manage to balance it pretty easily. Once you the 5 o’clock whistle blows, you make like Fred Flintstone and don’t think about work until 8am ( ok 8:30am) the next morning. But to me balance equates to 50/50 work/life.

But what happens if you have a job that is not bound by set hours? What if you are doing more “project based” work? Well then we take a look at Work Life Integration….yup no link for this one, I couldn’t seem to find any singular article that really defined what it is/was/should be.

So from what I can infer from reading lots of articles, Integration means working when you need to. Don’t watch the clock, work when you are best capable of completing a task. Is that 6am, or maybe for you it is 10pm after the kids are in bed and the nightly news is over. If you want to go to the gym at 11am go. if you want to go for a bike ride at 2pm, go!

 

To me Work Life Integration feels like “Get your work done on schedule, to the best of your abilities, be responsive to your team/customers and all is good”

 

With the amount of remote workers increasing, I hope that the above methodology will become more prevalent. Does it matter if i’m at my desk from 8-5 so long as I am reachable? Does it matter if I take a couple of hour break in the middle of the day, so long as I put in my time later(or earlier)?

I won’t go into how this can keep workers more focused, less stressed and in general happier. But I will end on this post that I like to read when I’ve been thinking about taking a vacation. US vs Europe

Books and Covers – Don’t judge me

We tell our children “Don’t judge a book by it’s cover”. Modern Day Adages But isn’t that what we do everyday?

If you’ve talked with me before, you know my stance on “suiting up”, I think it should be left to Politicians, Layers, Gangsters and other such scum. But that’s purely my opinion and, usually, said in jest to the lawyers in my family. I equate wearing a suit with those people, and since I tend to not trust Politicians and Lawyers..well why would *you* trust *me*?

 

But I digress. In this modern day, we are no longer locked into working in a hard office 8-5 with an hour lunch where we go and have a couple of cocktails with our co-workers. Today we work from home, Starbucks, the airport or anywhere else that we can get free wifi. So I ask you, does it matter what I wear? If there are not customers coming into the office, I’m not visiting customers that day and I’m getting my work done in a quick and competent manner, why does anyone care if I’m wearing Jeans and a Polo?

Business Casual

What I find the most interesting about this is:

There is no generally agreed definition of “business casual”.”

I actually hate the term “business casual”, because to me it means I can wear jeans and a polo. I also prefer that people be clear in their instructions. If you want me in khakis/trousers say so. I prefer the stance of  “As your customer or better”. It’s clear enough, but still gives you some flexibility in what you are wearing.

“Dress Professional”, what exactly does that mean? Does that mean that if I wear a suit I’m suddenly better at my job? That I am suddenly “Professional” because I’m wearing a suit, even if my job is to sweep the floors?(and no I’m not knocking on janitorial duties, trust me all young Marines are professional janitors).

I’m sorry ladies and gentleman, but professionalism always has and will always be a measurement of how well we do our jobs, and not how well we dressed while doing it. Don’t get me wrong, when I’m in front of a customer I wear slacks and a polo, tattoos are in full view. Back when I was a field person doing installs and move/add/change I wore jeans. I’d much rather rip a $20 pair of jeans on the keyboard tray someone left just far enough out to snag and rip my pocket, than a $60 pair of trousers, which has happened.

Are Doctors professionals? Last time I took my daughter into the doctors office, guess what? The doctor and nursing staff (professionals right?!) were wearing scrubs, not slacks, a button, tie and a white lab coat.

Bikers (not professional right?) big scary guys on loud Harley’s, nasty tattoos, and bad attitudes….not so much BACA

 

So I implore you, don’t judge me by how I’m dressed, my tattoos or piercings, my hair. Instead judge me on my work ethic, how well I perform, how easily I can make you laugh when I’m presenting.

The Importance of Social Media to the Network Engineer…Or I Tweet therefore I am

It takes a village to raise a child, it takes a Community to raise an engineer.

Over the last few years, more and more of us are using social media. And by “social media” I’m not just talking about email lists, support forums whether vendor supported or not (though they are important as well). No, I’m talking about Twitter, Facebook, Skype, FaceTime and all other forms of instant(ok semi-instant) communication.

This growing trend, from my perspective, has helped us grow more as engineers than anything else I’ve encountered in the 18 or so years I’ve been repairing/installing/designing systems.

In the beginning we all have a mentor. Someone that we are assigned to work with to help get us up to speed. Once you reach a certain level of competence you are thrust out into the big bad network to keep things moving smoothly. Of course you still have your co-workers you can rely on when you need help. But what happens when you encounter a problem they haven’t seen before? You can reach out to the vendors tech support group of course, but sometimes that can take days to get an answer from. I’m not bashing tech support, I spent the better part of five years doing it. But understand that tech support gets tons of calls, and you can only be so productive.

So what do you do? What should you do?

Why, reach out to the social media channels! Tweet out your question or issue! You would be really surprised by who will reply to your issue and how fast a response you can get. I’ve seen engineers in the US work with engineers in the UK, Australia, Germany (you get the picture?) to resolve issues. If someone doesn’t know an answer, they can retweet it to their followers as well:

twitter_help

We have study groups that run across social media, shooting out questions and scenarios they have in their books, and getting responses and explanations from other studiers or people that already have that certification. Being able to reach out to the people that create the materials, like Joe Onisick and Ron Fuller.

From Denise “Fish” Fishburne

In 2001 I tripped into what seemed to be the perfect job for me. I learn, I teach, I help people, and I get to play detective. Had anyone heard of “Denise Fishburne” (aka “Fish”) before 2013? Not really. Did I care? 🙂 Not really. It’s hard to care about not being “known” when you are a lab rat having tons of fun with great co-workers.

Social Media

In 2011 a friend of mine setup introductions with Network World. I submitted 2 sample blog posts and they picked me up. Network World suggested I sign up on this “Twitter” thing. Like many people who aren’t on twitter I had my own notions and ideas of what it was and I hadn’t voluntarily joined it. But I signed up. Didn’t do much with it. Just signed up.

In the spring of 2013 I started playing more with this “twitter thing” prior to CiscoLive. I still remember Jeremy Filliben coming up to me at CiscoLive in 2013 and saying “hi” as if he already knew me. He was my first “in real life” twitter connection.

**January, 2014** – yup… That’s when it all happened. John Spade had asked me on twitter to do a “Cisco Helpout – Women in Network Engineering” podcast. I said yes. Amy Lewis @commsninja was also on the show. Soon after I become a Cisco Champion. Then?

CiscoLive 2014
Met awesome and incredible other Cisco Champions
Hung out at the Social Lounge with the fabulous “tweet-up” gang
Went to my first customer appreciation party ever
Had a lot of fun playing with others with sparkly bats, bacon, tiaras, and masks
Got lots of hugs
After CiscoLive 2014? I have now moved over to writing for PacketPushers and Networking Computing. Admittedly I still pinch myself about Packet Pushers.

I’m your basic lab rat. I like playing in the lab. I come out of the lab about once a year for CiscoLive. Not really the type of job that screams “name recognition OUTSIDE of Cisco comes with this job”. The name recognition outside of Cisco truly has its root in social media. Social media allows me the best of 2 worlds: the lab rat job I love and the interaction outside of Cisco with awesome incredible people I would not have otherwise met.

Dennis Smith
I’d say being active in social & community help me move from Dell to EMC. Never hurts when ppl know who you are before you apply.

Jeremiah Dooley
It’s fair to say that Social and Community have been at the center of every professional opportunity I’ve had since 2010.

I was a Director at a regional service provider in February of 2010 when I initiated the first SP POC for the then new Vblock, long before there were “Acadia” or “VCE” organizations to support it. EMC drove it, with most of the original group of vSpecialists jumping in to assist. Needless to say, there were…issues. I got frustrated, and shared with Chuck Hollis one of the internal e-mails I had sent to my management, and his suggestion was that there were lots of people who would appreciate me sharing my experience publicly. He asked if I’d ever thought of standing up a blog.

From there, things snowballed. My sharing with the community led to relationships, that led to me being hired by Acadia/VCE, that led to me moving into a very visible position with the company. I’ve gotten to travel the world multiple times over, I’ve gotten to work with some of the best and brightest individuals and companies. I’ve been rescued when I needed it, and able to rescue others when they needed it. I’ve found incredible people who I want to learn from, learned to treasure mentoring and helping new people in the community and had fun creating new ways to give back. Being in the right place helps, but it was the community and my willingness to engage them directly that made those things happen. No one is an island in this industry. No one.

The community is the gateway to knowledge. It’s the gateway to resources. It’s the gateway to people and access to technology. Social is how the community interacts. You can’t separate the two, and without them my life would be very different, and my horizons and aspirations would be much smaller.

Heck, I even asked for help writing this blog post!:
twitter