Author Archives: stackAdmin

Back[b]logged

backblogged

 

Woah. So…that whole “I’m going to keep posting, archiving, documenting my dev life” thing sort of, um, fizzled. BUT! I think I have good reasoning and, even better, some takeaways from my past year of pushing my comfort level and diving into the unknown.

I think it all started to ramp up when I decided to attend the GIANT Conference in Charleston, SC. I beefed up my site a bit more to adequately represent my beloved “Stack Dog” name and even tackled a few more client projects to stay fresh. I grabbed my UXing bff, Liz, and we headed off to Charleston for a week of inspiration.

Oh, if we only knew!

GIANT Conference got us so jazzed up to do great errrr, I mean, RAD things! Liz and I were so jacked up on the energy that we were contemplating ways to start our own conference in Rochester to mimic the awesomeness. That is until a pink “GDI” sticker was placed on me during a post-talks hangout session.

GDI? Huh?

Girl Develop It! A nonprofit organization devoted to providing affordable and judgement-free opportunities for women interesting in learning software engineering and web development! </canned statement> No, but really. An organization devoted to teaching fellow women how to get into (and stay in) code? A way to find more like-minded women to share ideas and make cool things here in Rochester? A chance to provide opportunities for others in my city just as they were provided for me? A means of inspiring the next generation by creating role models? ::inhales:: Of course I’m interested! Liz was on board as well, of course, and together we decided we were going to bring a chapter to Rochester. Ready? Word montage!

Submit chapter request to HQ > Interview with HQ > Get chapter packet > Form interest group > Research future audience/members > Hold first interest meeting > Research local venues > CHAPTER APPROVAL! > Plan and host EPIC launch party at RIT > Teach first classes > Meet the founders and 50+ other chapter leaders at GDI Leadership Summit > GET CRAZY INSPIRED > Ramp up more courses and chapter ideas > Media attention / features in the news > Speaking at local events > Start Code & Coffees at local cafes > Rochester Mini Maker Faire (met TONS of new teachers/volunteers/brilliant folks) > New venues for teaching > Slack channels full of experienced and welcoming chapter leaders > Meetings and agreements with local startup groups (as Stack Dog) > New GDI org website in the works > Learned Ruby on Rails with various libraries > Moved from ‘spectator’ to ‘project lead’ for GDI website > Continued freelance projects with Stack Dog > Continuously inspired by my growing network and motivated to learn more each day.

All of that happened within nine months. Aweeeee a career baby!

This by no means justifies my inability to commit to a blog, journal, or diary-type thing whatsoever. [Note: my very first post was a warning.] The majority of my life has been spent getting super excited about new notebooks only to fill the first few pages with good intentions until they faded to doodles. If even. Mainly pre-shredded gum wrappers.

So I have a short attention span. Shoot me. Hey, at least I’m finally finding the right opportunities for my personality; something that I can’t just “fix” and move on. Nope! Girl Develop It and startup projects require some serious patience, staying power, determination, and an open mind. I am convinced that the folks I’ve met this past year will directly shape my future in so many ways and I cannot wait to see what is in store for all of us along the way!

Here’s the takeaway (and my slight justification for not keeping up with this thing): you need to get out of your comfort zone, push your [assumed] limits, and soak up as much as you can! Why is my blog so neglected? I’ve been busy collaborating with brilliant folks, seeing new places, facing big opportunities, getting inspired, being humbled, and ultimately learning how to grow beyond my existing thresholds. Even better! I got to experience the moment when my impostor syndrome slammed into the scene of extremely smart people nodding their heads after words poured out of my face — the type of moment in which you realize that you can offer something original and you do have a voice. Yowza! Having spent the recent years assuming I was too young, too new, too inexperienced, too this or not enough that —  this was all so addicting! I’m finding my people and I’m learning how to do meaningful things with them. Yes, I could have tried to settle down in order to articulate my thoughts for the sake of a new post, buuuuut I was too drawn to the idea of throwing it all back up into the air again to see what else could happen. Is there a glitter-throwing emoji? That’d be perfect right now. It’s a “ride the wave” sort of feeling, but I’m in control of how big the wave will be. Now THAT’S empowerment and it all started with a simple “why the hell not?!” So stop reading this, find something you’ve been wanting to do, and just jump in! Don’t worry about whether or not your ready; trust that you’ll figure it out along the way. Create your own wave and ride it! You’ll amaze yourself when you realize how much more you can do. GO!

Oh, and happy coding :)

WordPress and Mail-icious Logs

mariusz_mail

 

Remember a couple months back when I wrote about my ridiculous error log woes? Well, I must be the Queen of Crappy Logs because all that fun slammed back into my life in the form of mail log overload. So what gives!? I’ve cleaned my code on older CakePHP installations, added a new WordPress installation for a new project, swapped out any standard wp_mail() functionality for Mandrill API fun, and followed my usual routines for new websites. WHY IS MY SERVER ON FIRE!?

Apparently this hosting-space-savvy developer needed a lesson in managing a server on her own. I got to see first-hand what happens when you disregard any anti-spam precautions when firing up a new WordPress site. I’ve known about Akismet or Mollom, but never thought they were super necessary. I rarely see the deep admin side of my hosted servers so out of sight out of mind, right? NOT ANYMORE! This is now my server I need to protect; I can’t just turn a blind eye while the mail log file grows 1GB/half hour and crunches all CPU. MUST. SAVE. THE WORLD. THE SERVER!

At first, I didn’t realize this was spam. I naturally thought back to my error fun from weeks ago and approached this instance as another flare-up. I start by referencing my friend cat /dev/null >mail.log to help clear some space. This moment of clarity lasts seconds, as the spam attempts continue to overflow the screen. I figure, “Hey, I have Mandrill hooked up. Why is Postfix even trying to work without an active local mail server?” This thought leads me to turning off/stopping Postfix.

Nothing.

OKAY! I’ll completely unload Postfix so HA! Won’t even be an option for ya now, server. Take THAT. Wait…what’s it doing? It’s using a DIFFERENT mail option!? Ninety-two kill PID attempts later and holy hell I’ll put back Postfix. Cripes.

::spam logs continue and I swear they’re even faster/angrier::

WHY WON'T YOU DIE

 

…ugh okay. Now what!? Why is this thing so angry! I start to wonder if it’s in fact the WordPress installation. Maybe if I turn off the site for a moment? I flip the switch — silence. Mk, so it’s definitely this WordPress site. This pause gives me a moment to actually read the lines in this out-of-control log stream. That’s when I notice a bunch of phony email addresses using our WordPress site as a domain name. I definitely don’t have any emails listed for that domain name so finally the spam lightbulb goes off. Great! At least I have a clue!

Time to bust out the anti-spam guns. The most popular solution is Akismet so I went there and got a key. Back in my day ::shakes a cane::, Akismet was free to anyone. I can understand that their popularity and success has resulted in them asking for some maintenance help. Anything would be worth a quiet mail log at this point. I snag a key and pop it into place in my WordPress installation. I also decide to shove a Captcha plugin even though I disabled all commenting for good measure. It’s amazing how resilient these spam bots are even when all commenting/pinging functionality is turned off.

Welp! It’s not complete log silence, but I can see a shift in the log messages. Instead of trying to send these spam mails through a dormant mail server, I see Akismet doing it’s job of double-checking each one and rejecting accordingly. Lovely! I may still be racking up a sizable log file over time, but at least my server CPU is back to normal and free again. Hooray!

Now that I have some time to consider alternative measures, I can’t help but question if Akismet is the best solution for WordPress spam protection. They are very robust now and provide a great third-party check, but is that server-to-server jump so necessary for the sake of some phony email? For now, I believe it is. I can see myself shifting my stance once I get my feet wet and more familiarized with the whole spam front. There are many alternatives out there that can keep you within your own server; privacy-crazed developers rejoice! Be sure to check them out for yourself and save yourself from this chaotic, spammy mess!

That’s all for now! Happy coding :)

 

A Kick in the Bash

stack_terminal

 

Well, well, well. This “I-need-a-GUI-to-make-sure-I’m-not-hosing-files” girl was forced to dive off into Terminal/UNIX land to fix a rather daunting bug. Due to the successful outcome, I feel more than obligated to document it and save it for [hopefully unnecessary] later use.

Long story short, I had to compress and properly format thousands of large photos being used on my server without renaming/moving them. A recent update to a camera system caused photos to upload to the server as TIFFs and not JPEGs and this has been going on since November. Awesome! So here I am with thousands of enormous photos that are being used by a live site. Sweet setup, right?

So after pacing about for a while and considering the daunting task of manually fixing all the files i.e. my personal hell, I ‘hit the books’ and started sniffing out bash scripts and image conversion tools.

Fortunately, my coworker is rather familiar with the fun of bash scripting thus he had immediate tips to get me on the right path.

Step 1: ImageMagick (link to Mac installer)…Whew, does this thing do some work! Soooo many tools and tricks for playing around with image files. The ‘convert’ command is likely the ideal means of altering files, as you can maintain original files. Buuuuut we, too, like to live dangerously. Bring in Mogrify! I promise I remained calm while reading that “this tool is similar to ‘convert’ except that the original image file is overwritten.” ::cough:: No going back? GREAT! Sounds like a solid idea for a newbie. Yeesh. Unfortunately, it’s exactly what I want haha advocacy for heavy pre-testing? Sure, why not.

Step 2: Get a testing area and play! Get that mogrify up and running and see what happens.

Immediate issue #1: Our image filename convention is simple for dynamic functionality. Basically indexing six images sequentially with the unique product number for quick pulling. This seems to clash with the ‘update-in-place’ effect of mogrify. It did the trick for most files, but had a tendency of renaming the reformatted files to [filename]-0.jpg and creating a preview file called [filename]-1.jpg. So it’s clearly indexing, too; not ideal. I definitely needed the image names to stay the same! Meh, time for some extra script lines.

Immediate issue #2: We don’t want to alter ALL the files in this giant directory (100+GB of files), but just the ones that are large ‘n in charge. SO! We need to single out the files that are over 1.3MB and THEN run some script magic. This would essentially single out the mixed up files dating back to November. We have our friend “-size” to do the trick. Perfect!

The rest was just cleaning up the indexing mess from mogrify by deleting/chopping the files. Nothing some -exec and -delete commands couldn’t handle. After some tinkering with this guy, we managed to get a final, working script:

#!/bin/sh
cd /Path/To/Stuff/You/Wanna/Change
find . -size +1300000c -name "*.jpg" -exec mogrify -format jpg {} \;
find . -name "*-1.jpg" -delete
find . -name "*-0.jpg" -exec bash -c 'mv "$1" "${1//\-0}"' -- {} \;

Line 1: Get to the main photo directory.
Line 2: Find files that are over 1.3 MB that are JPGs and reformat them to true JPGs (again, these mixed up files are TIFFs with JPG extensions; nice ‘n messed up, right?).
Line 3:  Find all the extra files that now have the mogrify “-1.jpg” convention and delete them.
Line 4: Find all the reformatted, desired files with “-0.jpg” convention and simply chop the “-0” from the name. Voila!

We setup a few test runs on the Desktop to play it safe. Turned out nicely! Dropped files from 1.5MB to ~100kb in one swoop while maintaining the original filename. Awesome.

Time to saddle up and run the real deal, right? Wait!

Step 3: BACK UP EVERYTHING AND ITS MOTHER. Despite my surge of confidence and blatant excitement over this script, I knew things could still hit the fan. A simple download of Carbon Copy Cloner did the trick for us! After a nice ‘n safe back-up, NOW we can pull the trigger. If you are used to bash scripting, you can skip to Step 5. Otherwise…

Step 4: UNDERSTAND how bash scripts execute! This is an important step I missed prior to all of this fun. I really haven’t done anything drastic (or at least multi-lined) with shell scripting and thus missed the fact that each line loops through the entire directory before moving to the next line. I’m so used to languages looping through all steps before moving to the next index, but not the case here. This tidbit of info would have likely saved me a lot of unnecessary anxiety when I watched it run for real!

Step 5: HIT IT! Well, okay…make sure your ‘cd’ line is correct but then pull the trigger! Stop waiting and worrying; just do it. You have the right script lines, you did the testing, you have the clone…you’re good to go! Do it!

Finally: Sit in fear for the duration unless, of course, you went through Step 4 haha. I nervously watched the system churn its way through thousands of files. Skipping some and drastically and irreversibly altering others. All in hopes that it’ll come out smoothly in the end. Keep an eye on what it’s doing and where it’s venturing, as you may have some slight cleanup for directories that fit the mold of those you wanted to fix. Plus, you should watch out for any permissions clashes, which could easily hose all alterations. Fortunately, the script covered 95% of the necessary changes and I was able to clean-up the last 5% within a few minutes.

So that was it! My first true-blue run with a hefty bash script. My website is happy again with its proper images restored and I can relax knowing that everything is in working order. Back to laid-back PHP for now; I need to decompress!

Happy coding!

Moving Old Sites to Mavericks Server

I recently upgraded a web server from Snow Leopard to Mavericks (subtle upgrade ha) and naturally anticipated a few headaches. Fortunately, the upgrade went rather smoothly! Mavericks loaded right up; server app made everything simple; a quick MySQL download got my databases in place; and the existing websites got nestled nicely in their proper locations. All gravy!

::one day later::

Server is crashing! What!? What is going on? Ah, maybe it’s that 90GB apache error_log file! FUN! So what gives?

Should have figured that moving CakePHP files circa 2009 to a brand new server with the latest PHP would be a BIT of a clash. A ‘bit’ = monumental. PHP recently bundled their E_STRICT error reporting with E_ALL. You used to be able to segment them off or call them separately, but now you’re getting ALL strict reports in one swoop. Needless to say, the default settings in all my older CakePHP sites are not up on this change. Holy logging, batman! Every little move on each website is logging at least 10 PHP Strict errors at a time. The log viewer is struggling, the OS is lagging, everything is taking a hit. Fortunately, my little friend “cat /dev/null > error_log” was my savior! Cleared out that bad boy in one hit and bought myself some time to fix the error reporting.

IMPORTANT NOTE: I understand it’s bad practice to turn off/ignore error warnings. I’ve seen plenty of condescending users on Stack Overflow throw that jab. The issue is the lack of time to fix ALL the errors (many rather useless) before the server crashes. So! If you need to buy time or just don’t have the threshold to weed out every single warning, then this post will help. I simply believe that silencing some overkill warnings is far better than corrupting your databases/crashing your hard drive. That’s just me. Onwards!

I likely could have updated the php.ini file, but that requires an Apache restart and I wasn’t sure I wanted to hide reporting from ALL sites on the server. I just know which sites are most clunky so I opted for code-based changes. Here’s the thing: anything on Stack Overflow made it sound like one simple code change would fix everything. What a thought! It got my hopes up until I realized it didn’t work haha (at least for me).

I kept seeing “all you need to do is put ‘error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);’ in your website/cake/bootstrap.php!”…sounded lovely and super easy, but I still saw craploads of errors in my logs even after clearing all forms of cache/tmp folders. No dice. Per usual, I assumed I wasn’t doing something right so I tried mannnnny variations of the reporting settings. Remove the ~, put ‘E_ALL ^ E_STRICT’ instead, change the order, etc. I even decided to move the error reporting changes from the bootstrap and put it into the core files instead. Nothing. After a while, I decided to just double up my efforts and put the logging changes in the core file AND bootstrap files. So aside from the bootstrap.php error_reporting line, I went to website/app/config/core.php and swapped the defaul error logging settings, “Configure::write(‘log’, true);”, with “Configure::write(‘log’, E_ALL & ~E_NOTICE & ~E_STRICT);” One last refresh of everything, cleared the log file one more time, and opened the server app while wincing.

…silence…

FINALLY. The logs ceased, my OS resumed normal speeds, and the server app wasn’t churning! Success! 24 hours later, any my error_log file is a mere 2MB with 3 of 9 sites updated with logging changes. Much better. Plenty of time to work on things!

So to conclude, here’s how you buy time with old CakePHP websites and PHP 5.4:

  1. Keep the “cat /dev/null > error_log” handy! You can always use this with ssh from a different computer if your computer starts to lag too much or crash. Just remember to be in that apache directory first, of course.
  2. In yourcakesite/cake/bootstrap.php, change existing error_reporting line to “error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);”
  3. In yourcakesite/app/config/core.php, change default “Configure::write(‘log’, true);” to “Configure::write(‘log’, E_ALL & ~E_NOTICE & ~E_STRICT);”
  4. Clear tmp cache files for kicks; never hurts.
  5. Enjoy a quieter log stream!

Not sure if anyone is carrying older sites forward like we are at this point, but hopefully this helps if so! Always something to learn when upgrading servers and sites.

Now for a calm Wednesday! Happy coding!

Asana to the Rescue!

I thought about writing a drawn-out, comparison-based post about my experiences with project management software, but this seems like a better idea:

asana_snag

That’s right. Stack Dog fully endorses (and chews on) Asana! This is NOT to be taken lightly, folks, because I am queen of “eh, I don’t need to make a list.” I really struggle to justify the use of time for to-do lists when I’m pretty good at prioritizing/executing without any sort of reminder. I’ve been told, “Oh, you just don’t have enough things to do,” which I find to be hysterical. My personal secret is an amazing guilt pattern; I can make anyone’s request seem as though an innocent puppy will be slaughtered mercilessly should I dare forget about doing it. Despite my stubborn tendency to adopt these tools, I listened to a fellow programming colleague and tried Asana.

Yay for simplicity with a smart twist! You can fire up Asana in minutes with a Google account and have a running project list shortly after that. The nice part, too, is you can quickly share your project with someone without them seeing all of your projects/tasks. That right there is what won me over; I can essentially move annoying, convoluted email threads out of my inbox and into an organized, constructive layout while allowing my clients to comment/add tasks as they please. You can even upload files/images as needed, which helps for drafting and designing processes. Again, it’s all rather simple and light, but intuitive with the purpose of crossing things off and collaborating to get things done.

Previously to Asana, I have worked with Basecamp, Zendesk, Jira, etc. and they all have their own wonderful traits. The only issue is they can quickly become a nightmare for people like me who just want to jot something down and show that it has been crossed out. Those platforms are so robust and extremely customizable, but you can lose hours to data entry about something that, frankly, you should just be working on right now. Yes, there is a great payoff in the form of amazing analytics and visuals for your projects, which can translate to an improved process in the future, buuuuuut it sometimes eclipses the project itself. Plus, some of the bigger software are simply lacking that intuitive flair and therefor cannot be quickly shared with a less-than-savvy client. Asana rocks the socks in that department. Seriously, try it out and share a project with your [insert technologically incapable family member here]; you’ll hear the pause as they start to ask a question because they realized they figured it out. It’s a lovely moment.

So, again, if you’re all “I-hate-lists-but-I-think-I-need-to-be-more-organized”, then go here now. You can come back and yell at me if you don’t see what I mean.

Happy coding!

 

My Partner Can’t Hang…

Oh, ya know…just staying up rather late because I’m fixated on a dynamic functionality for my [beloved] pet project when I noticed my REAL pet/partner-in-dev-crime can’t hang:

late_night_fail_1

Seriously?! How do dogs sleep this way?!

Perhaps I’ll need to get a human dev partner one of these days. Or crack the whip on the boy! Just kidding, just kidding; he’s too friggin’ adorable.

Can’t wait to release a glimpse of this project! Hint: a clue lies in my “about” blurb at Stack Dog Solutions …oh, and :P

K, so that’s probably a crappy hint, but I just need a bit more time to ‘get it right.’ This site is something I’ve envisioned for a long time and I hope I can pull off what I’ve had in my head.  So far I’ve pushed myself to new levels, created some fun features, and streamlined a lot of my everyday dev processes. Not too shabby. Worst case, I keep it in dev and continue to learn from it. Though, I can assure you that I’m trying hard to make sure I have at least a few friends or my parents (inadvertently the best site testers) taking it for a spin in the near future!

Time to put my head to rest for a bit. Happy coding!

 

MySQL a.k.a. MyHEADACHE

Okay, I’m subjecting myself to developer shame and scrutiny, but I’m tired of hitting these little snarls. In other words, this post is more for myself than anyone else. Plus, the other point of this blog is to document my trials and solutions so brace yourself.

I’m simply trying to get a new installation of MySQL up and running on a Mavericks-based server. There are 20,398,430,284 (maybe fewer) articles regarding the process, but I somehow manage to slam into walls. Part of me believes it’s the fact that there ARE too many articles and it’s so easy to get on a wrong track vs. following one installation process. Either way, I think I have the combo that did it for me once and for all.

Credit to these folks:

Originally, I followed one guy’s take on it all and ended up with no mysql database and completely locked out of the root user (with or without password attempts; cute, I know). So! I decided to start over. But nooOOooo you need to COMPLETELY removed all MySQL fun from your drive before trying again. That uninstallation link above was the key to that. I missed a few files and especially the logged history notes. Time to put the Joe Schmoe blogs aside and stick to basics. (I know, I know — KISS). I stuck to the walkthrough suggestions and simply downloaded from MySQL dev site and followed those steps. To immediately avoid the root battles, I decided to try the “mysqladmin -u root -p ‘PASSWORD'” immediately. SEEMED to work from there, but I wasn’t convinced thanks to my earlier walls. I ran the mysql_secure_installation script in order verify my user settings and to get things locked down and cleaned up from the start. I was able to update the root password at this point if I’d like, which was NICE. This little process (much like CakePHP bake) helps you clean up your testing databases/usernames to prep for production. Given that I’m simply transferring servers, I’m all about getting the production replica in place and nixing the test gear. Sweet success!

Now I can finally put things back into place. Again, I’m fully aware that this isn’t something ‘hard’; it’s just finicky and my attention span can be rough. I found solace in the fact that most walkthroughs reference the notorious 2002 socket fix, which reminds me that there are still nuances in this whole MySQL process. I’m sure Oracle is battling to make it even tougher to fork out in the future, too. Apple always had MySQL in their Server Admin services list until the recent OS releases. I see a pattern! ::sigh:: Hello, MariaDB!

Well that’s all for now. Happy coding (now that you can)!

The Neverending Text Edi-Tour

I hope you read that title and immediately started singing like I did. No? Oooookay…

Eh hem…I was unexpectedly persuaded into trying a new text editor, Sublime Text 2, despite having downloaded the newly-released and highly-anticipated Coda 2 this year. While Sublime was downloading, I began to recap the “text edi-tour” that I inadvertently traveled throughout my career and debated whether or not an ideal editor actually exists for me. Yes, there are so many out there that can fit any particular niche, but I can’t help but notice that many editors are extremely gimmicky or bloated. “Look! This one fills in your pages with lines from Nicolas Cage movies!”, “Awesome!! This one visually renders any move or change you make!”, “OMG this one plays the entire Rocky theme song every time your function fires without an error!”

I realize that some folks love the extra bells and whistles, but I see them as a distraction from actually, ya know, writing code. Perhaps I’m just a creature of habit; why stop using the tool that lets me get right to the point? Why give that up to endure the learning curve in a new software that potentially sucks? Well, today I found out why it pays off to keep an open mind with editors.

I was going “oooOooo” within fifteen minutes of using Sublime Text 2. Despite using the spanking new Coda 2, I was still doing happy dances due to the subtle features and streamlined feel of Sublime. You mean I can add any sort of open-sourced package to my editor by using a shortcut and a quick download?! I can find designed themes that soothe my screen-squinting headaches!? You mean it writes big chunks of code in place of a simple word trigger?! Okay, I’m even going to get granular here and mention how happy I was to see that it would simply open a file on a single click, but would tab the file for further use if double-clicked. SO good! No more ongoing tabs of files that I barely edited.

Before I get ahead of myself, I will stay fair and mention the excessive number of questionable [hilarious] packages available to us. One in particular caught my eye and perfectly fits in with the “super unproductive” scenarios I listed: Hipster Ipsum

Yup! You read that right. “Hipster w/ a shot of Latin.” Ah yes. Just what the dev world needs. But I have to say that sometimes a grueling project full of boring content and repetitive functions could take a shot of this kind of nonsense. Dare I say I might use Hipster Ipsum someday? Eh, doubtful.

So from a pen and paper to Notepad, Dreamweaver, jEdit, BBEdit, TextWrangler, Vim, vi, Eclipse, Coda, and now Sublime — have I found my ideal text editor? I’m thinking yes! Seriously, I encourage any developer to try it out. I was very skeptical, but Sublime is truly a simplified yet super powerful means of streamlining your workflow. We may never reach the end of the edi-tour, but at least keep an open mind and help yourself find a decent resting spot along the way :)

Happy coding!