Tuesday, January 29, 2013

SaaS: The recruiter does not think you’re hot.

This is part of the SaaS series. Any connection to reality will be strictly denied.






I've only had one truly unbearable job.  It was awful - The
code base sucked, the boss had pointed hair, and to top it off I got a terrible
review. 


Let’s rewind. Four months prior I’d just aced a job interview with
HappySoft.  I nailed the questions, and the job was a nice fit for my
career. But, I 
wasn't ready to sign on the dotted line until I evaluated all my
options, namely my next interview with EbolaSoft.


My EbolaSoft interview was at 9am and it started off on the wrong
foot. The interviewer 
didn't know the answers to his own questions, and couldn't tell me what I’d be working on. With 15 minutes left in the interview
I’d given up on EbolaSoft. At that point the interviewer excused himself and
Rene entered the room. Rene was the recruiter for EbolaSoft, and my heart
skipped a beat when she smiled at me. As she discussed the company, she twisted
a long strand of brown hair around her fingers and I forgot how the interview
began.


That night, with a job offers from EbolaSoft and HappySoft in my
left hand, an IPA in my right hand, and Biff, my college roommate, sitting
across from me, I worked through the details.   “Sure the job might
suck, but Rene is hot, and man her smile...  Look if the job sucks, I’ll
work less and spend all my time seeing the city with my favorite
recruiter”.  Biff, knowing better than to argue after I’d made up my mind,
just paid for our beers and left. 


The next morning, I signed the job offer with Rene’s
company. 


I started work for EbolaSoft in September, in the middle of a long
death march. Too busy trying to get his feature out the door, my new boss 
hadn't spent any time thinking about what I’d be working, and he certainly didn't have the time to talk to me about what I should be working on.  Worst of all, even though I was always hanging
around recruiting I never saw Rene’s smile again.


Moral of the story 1: Do not take a job because your recruiter is
hot, I don’t care how much she smiles at you.


Moral of the story 2: Rene – if you’re reading this – You made the
biggest mistake of your life.




Sunday, January 20, 2013

Powershell in Real Life: Fixing an MP3 Album I downloaded

Powershell has some quirks, but all in all is awesome. Here's an example:



Today I downloaded an album from the internet...



PS C:\Users\idvor_000\Downloads\music> dir
Directory: C:\Users\idvor_000\Downloads\music
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 1/20/2013 11:47 AM 8648447 01-Loreena_McKennitt-The_Book_Of_Secrets-Prologue.mp3
-a--- 1/20/2013 11:48 AM 12194913 02-Loreena_McKennitt-The_Book_Of_Secrets-The_Mummers_Dance.mp3
-a--- 1/20/2013 11:47 AM 12026448 03-Loreena_McKennitt-The_Book_Of_Secrets-Skellig.mp3
-a--- 1/20/2013 11:49 AM 20341141 05-Loreena_McKennitt-The_Book_Of_Secrets-The_Highwayman.mp3
-a--- 1/20/2013 11:49 AM 10037007 06-Loreena_McKennitt-The_Book_Of_Secrets-La_Serenissima (1).mp3
-a--- 1/20/2013 11:47 AM 10037007 06-Loreena_McKennitt-The_Book_Of_Secrets-La_Serenissima.mp3
-a--- 1/20/2013 11:51 AM 16985204 07-Loreena_McKennitt-The_Book_Of_Secrets-Night_Ride_Across_The_Caucasus.mp3
-a--- 1/20/2013 11:50 AM 13847459 08-Loreena_McKennitt-The_Book_Of_Secrets-DantesPrayer.mp3
-a--- 1/20/2013 11:48 AM 252931 Loreena_McKennit_The_Book_Of_Secrets.pdf





I have two problems:


  1. I clicked some files twice, and now have duplicate files (La_Serenissima).

  2. The files have the wrong naming convention - I only want the MP3 to be named as the song.


I want to erase the duplicate files. I can find duplicate files by searching for any filename that contains (1), I do this by using the -match operator on each file. The match operator accepts a regular expression thus the funny escaping.

PS C:\Users\idvor_000\Downloads\music> dir | ? { $_ -match "\(1\)"}
Directory: C:\Users\idvor_000\Downloads\music
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 1/20/2013 11:49 AM 10037007 06-Loreena_McKennitt-The_Book_Of_Secrets-La_Serenissima (1).mp3


Since my regular expression matches the files I want, I can pass those files to Remove-Item:

 PS C:\Users\idvor_000\Downloads> dir | ? { $_ -match "\(1\)"} | Remove-Item



Next, I want to rename my files to only have the song name. I can do this by splitting the filename on '-', and using the last element. I suspect the following line should work, and test it.

PS C:\Users\idvor_000\Downloads\music> dir | % {echo $_.Name.split('-')[-1]}
Prologue.mp3
The_Mummers_Dance.mp3
Skellig.mp3
The_Highwayman.mp3
La_Serenissima.mp3
Night_Ride_Across_The_Caucasus.mp3
DantesPrayer.mp3



Good that works, now instead of echo'ing lets actually rename the original file to the new name..

PS C:\Users\idvor_000\Downloads\music> dir | % {rename $_  $_.Name.split('-')[-1]}
PS C:\Users\idvor_000\Downloads\music> dir
Directory: C:\Users\idvor_000\Downloads\music
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 1/20/2013 11:50 AM 13847459 DantesPrayer.mp3
-a--- 1/20/2013 11:47 AM 10037007 La_Serenissima.mp3
-a--- 1/20/2013 11:51 AM 16985204 Night_Ride_Across_The_Caucasus.mp3
-a--- 1/20/2013 11:47 AM 8648447 Prologue.mp3
-a--- 1/20/2013 11:47 AM 12026448 Skellig.mp3
-a--- 1/20/2013 11:49 AM 20341141 The_Highwayman.mp3
-a--- 1/20/2013 11:48 AM 12194913 The_Mummers_Dance.mp3


Yippy Skippy it works! Happy powershelling.