Using S3 for Media Storage on WordPress

This post, really, is for me more than anyone else. There is usually enough time between the set up of my WordPress sites using S3 for media storage that I forget one step or another and spend way too much time trying to figure out what I missed.

Create a bucket with an appropriate policy Amazon has a bazillion. I roll with a customized version, but Amazon has good options. Be sure to enable the static website check box in the bucket settings.

aws bucket preferences

Once you have the bucket, create a user and add user access info to the config and create a user policy. Again, Amazon has templates to choose from, so make sure you’re picking appropriately.

If you haven’t already, install WordPress on your server. Their 5 minute install is great. Then you need to install the AWS and WP Offload S3 plugins. At this point, double check and make sure that the uploads folder was created. This bit me for the first time in my last install. What I think happened was that I was working behind a firewall, and that interrupted my connection to the off-site server, and prevented the auto-creation of this folder.

Add a CNAME record to the DNS for the new media site on your server.

A final step is to make sure that the WP Offload S3 plugin is configured correctly.

wp offload s3 settings

Yours may be different, but these are the settings I roll with.

Even if I am the only person who this helps, I will be very pleased to have this anyway.

Have a step I missed? Something weird you’ve run into with these plugins? Drop it in the comments!

Work, Life, Learning

I’m going to tell you a secret. Are you sitting down? Are you ready?

stephen colbert eating popcorn in old 3D glasses

I’m exhausted.

Some of that comes from some personal reasons, which I will not get into here, but when I think about everything that there is to learn, to know, to keep up on, I need to take a nap.

Sleepy boo from Monsters Inc

The break-neck pace for technology is fun, it allows you to continually challenge yourself. But after awhile, how are you supposed to keep up on the new tech, maintain what you’re working on at work, and still have a life outside of code?

I love to code, I love my job, but I also love my life outside of work. Seeing family, friends, love interests, maybe playing a sport or two, and reading something for pleasure is a luxury that has become down right decadent. It seems that, no matter who you are, finding work/life balance is almost impossible in tech.

You may have a job that is good with balancing work/life but not work/life/learning. Not every job has set aside time for individual training, so keeping up comes outside of work hours. Which cuts into the life balance. Or sleep. Both of which are vital to having a sane and healthy workforce.

I don’t have an answer, but something has to change before the entire industry burns out from lack of sleep and too much time spent reading tech specs.

Coding and Rubber Duckies

♫ Rubber ducky, you’re the one! ♫

A nightmare of a week with competing deadlines and other issues ended with me explaining the rubber ducky theory of debugging to a marketing coworker who is also relatively new to the company.

For those who are not familiar with the idea, it’s the thought that when you have a problem in code, it doesn’t matter who or what you’re explaining it to, just that saying the issue out loud helps you see it in a different way.

♫ You make bath time, so much fun! ♫

Not even 24 hours later, all hell broke loose on a project we (the marketing coworker and I) thought was complete, and a month’s worth of work was given the deadline of yesterday.

♫ Rubber ducky, you’re so fine! ♫

The Monday after all hell broke loose on this project, that same marketing coworker, whom I work closely with, showed up at my desk with a gift bag because she felt bad for her part of the ton of work that had just fallen on me (and by extension, my team).

Lo and behold at the bottom of that bag full of chocolate, I find a family of rubber ducks!

♫ And I’m lucky, that you’re mine! ♫

I was touched by her thoughtfulness, and tweeted as such.

I went about by business, working on the giant project with a tiny deadline. I checked in on Twitter at lunch time, and never had I been so glad that I have a bunch of notifications turned off for my phone!

@SwiftonSecurity had retweeted me (jaw hits floor) and it quickly became my most popular tweet ever! I didn’t expect it to be so relatable, I was just sharing a coworker’s kindness.

♫ Rubber ducky, I’d like a whole pond of –
Rubber ducky I’m of –
Rubber ducky I’m awfully fond of you! ♫

A Lesson in Learning

This post didn’t turn out the way I expected it to, but it still drives the point I was going for.

——

Pain. Frustration. Irritation. Sadness. Regret. Losing.

Achievement. Accomplishment. Triumph. Happiness. Completion. Winning.

Tears.

Smiles.

I was raised to do better, be better, smarter, go farther, be more. My parents instilled a range of ideals in me to find what I wanted to do, then to go do that. Find out what I need to do, make a plan, and execute it.

For a while in high school and college, I thought that my calling in life was to be an athletic trainer. (To this day, if you call them “trainers” I will have to restrain the urge to snap your hands off.) I love [most] sports, and I wanted to help people, so of course, I would become an athletic trainer. Honestly, my mom mentioned it to me one day, and I latched on. It made sense.

I spent years taking classes I hated because I knew that I needed them to get into the program at Central, the oldest program in the nation, and one of the best. Because, in my mind, I thought once I got to Central (I started college at a university closer to home to save money) that I would be so much happier because I would be taking the classes required to get into the program. And, of course, once I got into the program, life would be a god damn cake walk. I got an associates in business at Ferris so that I could have a fall back. Plus, if I ever went into business for myself, I would be able to tell if someone was trying to take advantage of me.

As you can probably imagine, given that you’re reading this on my tech blog, life did not go as planned. I worked hard, I got in, I was thrilled. Everything I worked for, studied for, the late nights, practicing different tapings, had paid off. I was in.

And oh. my. god. I was bored. BORED.

Yeah, I loved going to the sporting events, working with the athletes, but I would go to class and not care one iota about what my professors were talking about.

I needed to graduate on time, and everyone says that all you need is the piece of paper, and it doesn’t really matter exactly what it says on it, just that you persevered and completed the four year degree. Which, honestly is pretty screwed up, but it is what it is — for now.

I resigned from the program, and changed my major to theatre.

I had always loved the theatre. Performing, singing, I was in drama club, sang in choir, and I’ve played flute for 17 years. It was something I could finish in the time I had allotted for my college education and enjoy it. Revel in it. It is certainly one decision that I have zero regrets over. I finished my BS in Theatre, Interpretation, and Dance in three semesters, taking 20+ credits each semester, plus some summer classes. It was hectic and insane, but I had a blast. The shows I had the opportunity to work on, and the people I got to work with gave me lessons and memories I will carry with me forever.

Despite all that, I knew I would never use it. Ever. I didn’t (and still don’t) think I’m talented (among other things) enough to make it in that business. But I finished. I didn’t fail, I finished college with two degrees. I have the picture of me receiving my BS pinned next to my desk on the bulletin board to remind me of this every day.

Fast forward a few years, I have a decent office job, but I still feel like I need to stretch, to learn. I start to learn to code. I get laid off from decent office job, and spend the next four months unemployed, hacking. I apply to my first tech job with a year and a half of coding under my belt. I felt so lucky (and relieved) when I got the job.

But I still feel like I’m missing something. Like I won’t be legit in coding until I have the degree in hand saying “I can hackz!” despite being told many (many) times that I didn’t need it to advance in my career. I heard them, I understood that, but still, I wanted it.

I applied to UIUC for a classwork masters with a focus in cybersecurity, and was rejected. But that’s ok, with my lack of math background, I knew it was a long shot. I could have applied to MSU, but I really, really, really did NOT want to have to take calculus, nor did I have a desire to haul my ass to campus four days a week and manage going to school for another bachelors while working full time.

Enter Udacity.

If you’re not familiar, it’s one of several massive open online course providers. I had started a java class, and an algebra refresher while I was unemployed. Well, they were rolling out new “nano” degrees, one of which was a full stack web developer track (FSND). Perfect. I am interested in the web, I like working in the back end, it’s a work at your own pace degree that wouldn’t cost an arm and a leg — plus my employer had a great tuition assistance program that they were willing to let me use for this non-traditional learning opportunity.

The program was something I could do to keep me engaged in my career path, because my job certainly wasn’t doing it for me, but that’s another post for another time.

I started the program, and the first few projects, though taking a lengthy amount of time, because life, were pretty fun, and I learned quite a bit. For example, one thing I learned is that I don’t like python. That’s not the only thing I took away, of course, but that is a biggie. I got down to the last two projects, and started to run into big issues. Not just in my code, but in dealing with the program in general. I would sign up for 1:1s, and what had become an annoying lateness for every session I signed up for, turned into two times a TA just didn’t show. No cancelation email, no notification of any kind, just no-shows. I emailed several times, filled out the surveys they kept inexplicably sending me, and I heard back all of zero times. Tweeting at them didn’t seem to matter either.

I felt like I was constantly chasing pointless deadlines I would inevitably miss, and I had no desire to keep trying in a language I didn’t like, on a project I did not give a damn about.

Life kept happening, of course, because it does that, and I got a new job a few months ago. A job that has been everything my last job could have been, but wasn’t. I am engaged, I get to build websites, I am happy. I didn’t need the FSND to keep me from losing hope anymore.

But I wasn’t willing to quit. My momma and daddy didn’t raise no quitter.

I kept trying to get the project moving on my own, but all I was doing was spinning my wheels, frustrated, tired, and, let’s face it, stubborn. I am stubborn af.

So, last Monday, I am trying to finish this project, my laptop display is going crazy, my battery is about to die, and my charger (I only have one) is broken. I snap. Something had to give, and all of the reasons I listed above slammed into me. I don’t need this. I don’t need this stress. I can learn all of the things these classes have to offer and display those skills without paying for a damn piece of paper.

But my momma and daddy didn’t raise no quitter.

The ending to this story is ugly. It ends up with me crying sitting on the closed lid of the toilet in my bathroom. Huge, racking sobs, that I’m pretty sure scared the hell out of my boyfriend.

After I calmed down I had come to a decision. My sanity wasn’t worth it.

My momma and daddy didn’t raise no quitter.

And they still haven’t. This is the first time I’ve not finished a degree, in whatever form. But, sometimes walking away isn’t quitting. It’s self preservation.

It’s not easy, it’s hard, it’s really hard to know when to walk away.

It’s not time wasted, I still learned a lot, about coding, about how I learn, about a lot of things. Frequently, we want something to show for our work. A trophy, a piece of paper, a picture of you shaking hands with the Dean as you get your degree, something tangible, visible, and we forget the invisible part of what those tangible items mean, what they represent.

I was chasing a piece of paper, happy to accumulate knowledge along the way, but a piece of paper can’t tell me how big O notation works.

Jump in the Deep End

“Always apply for a job even if you only meet half their requirements. No one can fit them all, you can learn.” – A lot of people

When I wrote about Mental Shifts in development, it also had made me think about how much I was learning and struggling at the project I was working on.

I had interviewed and accepted this job based on the skills that I had, and my ability to learn new things. I knew that it was going to be a big shift for me, going from a developer who was not really a developer to an actual developer. Despite the amount that I have learned in the last ~3.5 years, I still have a lot to absorb. All devs do, but after many, many years of learning something new for work (or fun), more experienced devs have a better handle on time it will take for them to learn a new language or framework.

I am not there yet.

The project I was jumping into is written with Angular. A framework I had only done half a tutorial on, and then Angular2 was already hanging over the project’s head. In addition, although neatly formatted, the comments didn’t really give much information to why X was implemented in Y way in many different cases.

It has been a headache and a half, but the amount of learning that I have done has been incredibly valuable. There is something to be said for learning by jumping in the deep end, and panicking before learning to swim.

Even though this has worked out, and a lot of growth in careers and jobs comes from someone saying to you, “Here, this needs to be done by Friday.” you should still be cautious to not get taken advantage of or overwhelmed. Noticing the signs for that is as hard as realizing that you’ve bitten off more than you can chew.

Every new job is a place for growth, as is every project. Don’t be afraid of the deep end. With that in mind, some notes:

Be able to say no. If you don’t know how, learn.

Be able to say, “when” (or ask for help). This is a moving target, you’ll learn as you go.

If you see someone you supervise struggling, do not tell them to give up and let someone else do it, ask them how they are feeling about the project. Offer them help.

We all get better when we work together!

Mental Shifts

As a relatively new developer (aka not coding since I could talk) when I step into a new code base that I have had no hand in writing, I try to write new code and solve problems the way the code was already written.

It was such a project that I stepped into with one of the larger projects I picked up when I started my new job. It wasn’t until I hit a massive wall that I realized that I was stuck in the code’s way of thinking, when I should have used recently accrued knowledge to

  • give the stakeholder what they want
  • update the functionality as per the spec
  • get the work done faster, instead of overcoming issue after issue (though every approach has problems to diagnose)

My eureka(!) moment came right at the end of a day that I had spent arguing with the code, getting close, but not quite to what I wanted. I left my desk to wander around the office and let the back of my head work on it while the front of my head dealt with other stuff. Or at least got distracted by the beautiful view out the back of the building.

So often when we are coming into a legacy code base (I use this loosely in reference to the code I was in) we either want to rip it apart or stick to the style at hand. We don’t allow ourselves an in-between. In this case, I had gotten too deep in the stick-to-the-style camp. Being able to get to that moment was pivotal in my growth as a developer and in the momentum of the project.

Within minutes I had it working the way I wanted to, all because I took a step back. Many experienced devs are like, “well, of course!” But I think this is a lesson everyone needs to learn for themselves, and some people (me) need to learn it over and over again.

Don’t get so focused on the trees you forget to look at the forest.

Select a Mess: Choosing a CMS

At the tail end of last year, I wrote about Ooooh, Shiny Syndrome and mentioned that we were in the process of selecting a Content Management System (CMS). It has been one way hell of a way for me to hit the ground running.

homer simpson running

The CMS that was used when I was hired is clunky, difficult, requires IT to be a part of content publishing, and we wanted to allow Marketing to have full control over content, while we work on the rest. Completely normal, and what a good CMS usually does. Umbraco was not that solution for us.

So, the first months of the new job has been meetings, demos, specs, sandboxes, and chaos. Not to mention the duct taping to keep the web properties running while we research and rebuild. And one case after another of OSS. Which, as I’ve mentioned, is a bitch to come down from.

We’ve finally settled on a package, and it was an adventure to be sure.

Some lessons learned:

Someone will inevitably have already chosen something as the end all be all and most likely not care about other packages. A version of OSS, if you will.

stubborn baby crying

There will be an amazing thing that blows you away and if you’re lucky, it will be that baller shiny I mentioned before.

Elaine from Seinfeld celebrating

Do due diligence for packages with partners that you already do business with. The execs will ask and you don’t want to be standing in the pitch meeting and have it cut short because you didn’t explore all options. Even if you end up not going with that partner, it will be appreciated that you checked anyway.

cat caught getting into drawer

Spin up sandboxes. I know that some of you reading are like, “well, duh.” You have more experience than someone else who might be reading this.

sandbox castle

Make sure to include the people who will be using this, and get their input. You as a dev may love one solution, but marketing or sales may find it difficult to use. You don’t want to blow $25,000+ of the company’s money that doesn’t solve your problems.

counting money

LISTEN TO YOUR GUT. If you have squeamish feelings about something, explore why and SPEAK UP. A gut feeling is great, but sometimes you’re going to have to explain why.

buffy the vampire slayer grossed out face

Be willing to argue about it. If everyone leaves it on the table, then you should end up with a great CMS, instead of a mess.

max capricorn doctor who

Web, Windows, and Mac: A Story

Like many developers who prefer Mac to PC, I find myself in a position at a place where .NET is king, so having a VM is a part of every day life. That is all well and good, but switching between the two is a huge pain in the behind, especially since I am front to middle web, and my job can be done in either environment.

Enter Visual Studio Code.

This is a new code editor from Microsoft that you can use on Mac, Windows, or Linux. I was stoked to see that there was a version of VS for a system other than Windows. I installed it as soon as I discovered it.

Problem: it’s VS Super-Lite.

This is a little disappointing, because I am looking to be able to ditch the VM and save the company a little money on licensing. Plus, then I could say that I’m Windows OS free at work and at home.

This is what I discovered during set up of VS Code.

1. Code is really a very beautiful code editor, but that’s all that it is, really. I still prefer Sublime Text 3

2. It has some git controls built in, but to get the repos and my computer talking to each other, I had to use command line and set up each repo individually. This includes committing and pushing, it didn’t handle the authentication for pushing at all. Not a huge deal, but it was disappointing. This was compounded by #3.

3. The biggest disappointment was not having it be immediately clear where I could sign in with my MSDN credentials to get access to the company’s VS Team Services. I still can’t find it. My work around was using the command line in #2.

I can 100% see why Microsoft doesn’t want to have Visual Studio on Mac. I do, it makes sense to try and force people into the Windows funnel, more money, keep people in the ecosystem, etc. But, there are people like me who are never going to ditch Mac. I mean, it’s the OS where I first learned development, I’m more comfortable in Mac, and I just prefer Macs to PCs, in general, but this post isn’t about that. Plus, infinitely prefer Office Suite for Mac over the Windows version. So much so that I actually bought it and uninstalled Open Office.

On the other hand, I think Microsoft is missing a huge chunk of money they could have if they had a purchasable, fully functional Visual Studio for Mac use. “But DLLs and stuff!” I know, just let me have this one. Microsoft has a ton of brilliant people working for them, if anyone can figure it out, they can. Because now, with everything I discovered on Thursday/Friday while I futzed with VS Code, is that I did everything in iTerm, their team services website, and I can continue to use Sublime Text 3 to develop. I don’t even really need to have Code installed.

OSS: Ooooh, Shiny! Syndrome

Tech moves fast. Super hella fast. The best analogy I’ve heard was in a meeting recently, tech years are similar to dog years.

In a nutshell, if you haven’t noticed, a new technology is released and BAM they are already announcing the next major version, which probably broke half the things that you wrote in the previous version. This is especially true right now with Angular 2 being such a huge shift from Angular 1.x.

It’s great for innovation, but it also gives us a greater inclination to get “ooooooh shiny!” Syndrome (OSS).

This is good and bad. Good, because it encourages us to try new things, be adventurous. But it can go horribly wrong and cost businesses money. OSS is the rose colored glasses in a new relationship. It hides the minor, and depending on the severity of the OSS, major pitfalls of whatever language, software, tool, etc being evaluated. We are in the process of picking a new Content Management System (CMS) at work (more on that later) which is an interesting exercise in OSS.

The trick is recognizing you have OSS, and allowing yourself to see through the shiny to the iron underneath.

How do you know you have OSS?

Next time you’re evaluating (what will be known from now on as) The Shiny, notice how you’re feeling. Do you feel all bubbly inside as you watch the demo/read the spec/whatever? Like you want to play with it RIGHT NAO? That’s great, it’s a good feeling, and that’s a well done presentation of The Shiny.

What do you do now that you know you have OSS?
  1. Stop. Back away from the email you’re writing to All-Dev-Staff to proselytize about The Shiny.
  2. Take a day – at the very least – to read into more of the nitty gritty about The Shiny. Talk to other people on your team. Especially someone who may have a tendency to be more pessimistic than you are about new tools (it shouldn’t be hard, there are a lot of people who don’t like change) to ask them to take a look and talk the pros/cons of The Shiny.

If you both (or all are) still feeling rosy about The Shiny, congratulations! You probably have a baller Shiny to work with.

How do you prevent OSS?

Well, you really can’t. It’s human nature to get excited about sweet, sweet Shinies. They’re pretty! They fix all our problems! THIS IS THE BEST SHINY EVAR!

But you can take some steps to help prevent OSS blowing up a project and pitting your teams against each other Hunger Games-style.

  1. Have a well thought out project roadmap. Know your start date, end date, and major milestone dates in between. Thinking about how much time you have can really help take some of the shine off. (See what I did there?)
  2. Have your criteria for The Shiny laid out before you start looking at those beautiful shinies. That way you can easily see that “Hell YES this Shiny is awesome, but it doesn’t do half the things we require.”
What do you do if someone else has OSS?

Kindly point out the pitfalls and issues you see from the steps immediately preceding this section. Help them see it in a nice way. Because, if you’re a dick about it? They will probably double down on The Shiny, then you end up in the Arena.

Like this. You don’t want to end up on the business end of an arrow.

 

Your final step, and this is really, very, very important:

Prepare yourself for the come down.

It’s a bitch. It feels like the air being let out of the balloon.

Things that combat Coming Down from OSS (CDFOSS)

  1. Coffee.
  2. Chocolate.
  3. Something that is actually shiny that you can play with.
  4. A big snuggly blanket. Swaddle yourself right up in that!

Have you suffered from OSS before? How do you talk yourself down? How do you talk others down?

Ok. Ok. Breathe. I’m ok.

It’s true, I finally carved out time to write a script for Trello!

With my recent change of jobs, I finally had the energy and interest to write the script I’ve tweeted/written about in my previous Trello posts.

This script handles creating my weekly to do list card with seven checklists (one for each day of the week), my monthly sanity check of what bills I have to pay, and an annual card with a general grouping of things I need to remember to do at the end of each year.

The weekly and monthly checklists are created two weeks and one month ahead, respectively. This allows me to add things to the weekly checklists that are one offs, and check things off of the bills card as they auto-charge to my credit card. I am in a big push right now to be debt free by 30, so I’ve become rather obsessive about where every penny goes, this helps me feel better about that.

A couple of things about the creation of this script. First, it wasn’t a high pressure script, so even though I wrote the script a week ago, I didn’t really try to debug in any serious manner until yesterday. I just threw it up on the server and let the cron job run and send me the errors when it ran at midnight every night.

Second, it’s been ages since I wrote any php, but that’s the server scripting language I am most comfortable with. I’ve been working on several school projects in python, so the context switch came back to bite me more than once. Forgotten semi-colons, curly braces, you name it.

Plus, the Trello API is pretty insistent that it’s ‘idList’ when you’re creating a card array, not ‘idlist’. Crazy to have to follow directions, I know.

$card_data = array(
    'name' => ('To Do for Week of: ' . date('j F Y', strtotime('+2 weeks'))),
    'idList' => '<redacted>',
    'labels' => 'yellow',
    'pos' => 'top'
);

Another hitch I ran into was that I am dumping getdate() into a variable, and had used numeric index instead of key value pairs to access the array.

$date_array = getdate();

//is it Sunday, first of the month, or 1 December?
if ($date_array['wday'] === 0 || $date_array['mday'] === 1 || ($date_array['mon'] === 12 && $date_array['mday'] === 1))
{...

This caused the date evaluations I was using to determine whether it was Sunday, the first of the month, or December 1 to pass no matter what. My conditionals failed to gate anything, because $date_array[4] == 0 always evaluated to true because it was coming back as NULL, which can equal 0. So, it passed and then it failed on the fact that ‘l’ should have been ‘L’ in idList. Isn’t coding fun!?

"Invalid idlist value"

I would be remiss if I didn’t mention Clark Rasmussen here. He saw the bugs I missed in a few places, and also allowed me to use his Trello API script that gets the idList numbers for your columns, as well as his script that handles creating connections to the Trello API, so that was a load off my plate and allowed me to focus on creating the functionality I wanted. You can read more about his adventures with the Trello API here.

He also pointed me towards the date() function in php that replaced about 50-60 lines of logic to just get the date for the card’s title in my weekly card and the due date on my monthly card. Yay for learning!

'due' => date('Y-m-01 12:00 PM', strtotime('+1 month'))

Now that I have properly debugged this script and it works, I have able to ditch my “Perma Cards” column, and since I figured out how to ditch the “food to try” column, I now have only 10 columns instead of 12. In addition, I weekly have my to do list created for me.

weekly

As well as my monthly bills card.

monthly

And my annual clean up/to do list.

annual

All of which get placed at the top of the correct column with my ‘up next’ yellow label. It’s such a little time and space saver, but I am super glad to have finally written something I’ve been thinking about for months.

My next steps are going to be add my grocery list (because, yes, I am that lazy. Most programmers have little hacky scripts that automate the smallest things.) look at making it so that the script looks at which labels are where so that it can drop the cards directly under my green ‘in progress’ label cards, and I’m going to take a look at the Google Calendar API so that if I have one off things like my therapy, doctor, or other appointments that they will be added to my to do list card automatically.

Names of labels in listed cards is done via Chrome Extension, CSS Stylebot.