To ARGV or to To Variable, is it really a question?

Ok, so it’s not the best title ever, considering, but what the heck.

So still working through the Python lessons. So far it doesn’t seem too different from what I used to do with a shell/bash script ( I inherited some and learned what they did. Then created some new ones based on them). Though the ‘language’ does seem to be a bit easier, and I see how it might be easier to accomplish some things better.

That being said, most of the lessons so far, are calling for argv values, for lack of a better term. With this you call the script with arguments after the file name:

ex17.py old.txt new.txt

ex17

theirs

So that does seem to work, so long as the person who calls the script knows what they are supposed to do.

Personally I prefer something more like this:

ex17a

mine

Yes it is more lines of code, but to me at least, it seems more user-friendly. I could have anyone call my script and it asks them for the file names vs expecting them to know what they are supposed to do.

Oldie but a goodie

In the beginning was the word, and the word was God. In the beginning was God and all else was darkness and void, and without form, so God created the heavens and the earth. He created the sun and the moon, and the stars, so that light might pierce the darkness. The Earth, God divided between the land and the sea and these He filled with many assorted creatures.

And the dark, salty, slimy creatures that inhabited the murky depths of the oceans, God called sailors. And he dressed them accordingly. The had little trousers that looked like bells at the bottom. And their shirts had cute little flaps on them, and they wore funny looking hats. He gave them long sideburns and beards, nicknamed them “squids”, and banished them to a lifetime at sea, so normal folks would not have to associate with them. To further identify these unloved creatures, He called them “petty” and “commodore” instead of titles worthy of red-blooded men.

And the flaky creatures of the land, God called soldiers. And with a twinkle in His eye, and a sense of humor only He can have, God made their trousers too short and their covers too large. He also made their pockets oversized, so that they may warm their hands. And to adorn their uniforms, God gave them badges in quantities only a dime store owner could appreciate. And he gave them emblems and crests and all sorts of shiny things that glittered, and devices that dangled. (When you are God you tend to get carried away.)

On the 6th day, God thought about creating some air creatures for which he designed a Greyhound bus driver’s uniform. He discarded this idea during the first week, and it was not until years later that some apostles resurrected this theme and established what we now know as the “wild blue yonder wonders”.

And on the 7th day, as you know, God rested. But on the 8th day, at 0530, God looked down upon Earth and was not happy. God was just not happy! So He thought about His labors, and in His divine wisdom, God created a divine creature. And this He called Marine. And the Marines, who God created in His own image, were to be of the air, and of the land, and of the sea. And these He gave many wonderful uniforms. some were green, and some were blue with red trim. And in the early days, some were even a beautiful tan. He gave them practical fighting uniforms, so they could wage war against the forces of Satan and the evil. He gave them service uniforms for their daily work and training. And He gave them evening and dress uniforms…..sharp and stylish, handsome things, so they may promenade with their ladies on Saturday night and impress everybody. He also gave them swords, so that people who were not impressed could be dealt with accordingly.

And at the end of the 8th day, God looked down upon the Earth and saw that it was good. But was God happy? No! God was still not happy. Because in the course of his labors, He had forgotten one thing. He did not have a Marine uniform for himself. But He thought about it, and thought about it, and finally satisfied Himself in knowing that, well…………………..not everybody can be a MARINE!!!

Python Day 1

So trying to learn some python. I had a couple of people recommend this course.

So I started to run through it on Friday. First two lessons were not that bad. Basic “print” statements to start followed by “comments/#” usage.

So far so good right? In comes lesson three, math with python. Most of the basic functions were easy to pick up. Multiplication, division, addition, subtraction and of course the proper order of operations. It also goes into > greater than, >= greater than or equal to, < less than, <= less than or equal to, and finally % percentage/remainder. Or at least I think it’s supposed to be remainder.

It is this final piece that has been kicking my butt. So I get that the modulus (%) is for remainder, I can’t figure out how it works.
The formula for the exercise is ” 100 – 25 * 3 % 4″ the answer is 97.

So I’m still trying to figure out how this works before I move on. Of any of you out there can point out a good explanation feel free to let me know.

Or once I figure it out I’ll update.

 

Update

 

Ok, so with the help of a coworker it looks like I’ve figured this out.  So the “%” means divide by following number, but use the remainder for the next piece of the equation.

So what that means for the above equation:

100 – 25 * 3 % 4

100 – 75 % 4 ( which means 75 / 4 which is 18.75, but not using floating points yet, so it’s 18 remainder of 3)

100 – 3

97

 

And I’m sure my Algebra I teacher would be happy I showed my work…

Cisco Live 2013 aka Geeks in the Swamp

CLUS-Twitter

So being my first blog post, cause you know I heard somewhere this was the thing to do between tweets..thanks Amy (@CommsNinja) decided I’d revisit why I didn’t blog in the past, and why I’m going to be doing it in the future. So why is this titled “Cisco Live 2013 aka Geeks in the Swamp”? Well the picture above has a lot of tweeps and bloggers that finally made me rethink, and it’s where I was last week.

The Why I Didn’t

Basically, I could call it laziness and that would be a part of it, but not the whole truth. The biggest reason I didn’t blog was I couldn’t really find anything that “I” found interesting enough to blog about.

Let’s be honest, I work with wireless and oh yes it is definitely an interesting technology. But after ~5 years in TAC there wasn’t a whole lot I haven’t seen, broken, fixed, played with or snarked about. It was multiple conversation at Cisco Live this year, Tom (@networkingnerd) Andrew (@revolutionwifi) Colin (@colinmcnamara) Amy A.(@amyengineer), and way too many others to realistically list here, that made me realize it’s not what “I” find interesting, it’s what I can share to help others grow!! *facepalm* It really is that simple

The Why I Will

There are two main reasons why I decided I should kick off a blog, one is to share knowledge around wireless/BYOD which is kind of a passion of mine, and to help me document my learning of scripting (Python, Puppet etc).

Cisco Live 2013

Let’s call it what it is, Geek-vana! A bunch of really really smart people all getting together to share knowledge, see old and new friends, and let our Geek flags fly.

In years past (2006/2007/2008) I was stuck in TSC (Technical Solutions Center), and last year sitting in session after session. wHile I did learn a good bit during the sessions, this year I took a different tact. This year, it was all about the social aspects of the conference. I spent a vast majority of my time in the Social Media Hub. Chatting with new friends I met on twitter over the year, old friends I met at other events, and listening. Yes, I listened, amazing right!? Funny thing is when I did I heard the same thing. Blog, Bacon, Blog, Cloud, SDN, Blog, Unicorn and Bacon.

But being in the Hub also allowed me to be agile of calendar. I could go to the side meetings and briefings, there were a few where I thought I’d just listen and not have anything to share…turns out that I was incorrect about that.

To sum up, I learned a lot during the breakouts, where the network is going, why Engineers need to learn some scripting, what cloud can do for me, how many others enjoy bacon (really who doesn’t!), and that I should blog.

I call it a net win for the week.

So the long and short..pay attention kiddies.