Friday, February 22, 2013

Get Up and Read

As the phrase goes, life happens.  I had an epiphany recently, in that it is impossible to keep things perfect, and neat, and in working order.  Life is not a new car, where a periodic oil change and tire alignment keeps things running smoothly.  Life is very much like a clunker, where the A.C. can break even when you just went through all of winter and know for a fact you hadn't turned it on once.

My life used to be care-free and easy going.  Life in College is liberating, apartment life was just as much fun, save for the occasional utility bills that hit.  Then, before you know it, you're married, have a 30 year mortgage, working 50+ hours a week and have a 2 year old running around the house.  Now, all of my responsibilities are now making my wants and potential needs secondary.  If I didn't *need* to eat food to survive, I have no doubt my home life would overtake the 15 minute break at night time that is spent inhaling my dinner.

My outlook on life isn't grim, it's just very real at the moment.  Yes, I do get time for "fun", and yes my wife ensures that we all get our fair share of R&R from time to time, it's just that life has a way of ensuring that I don't have much time to be bored, that's all.

So what things do I *need* to do, and feel I need to do?  Well, I *need* to eat, sleep and occasionally shower.  I feel I need to decompress, drink an occasional beer, get some cardio in to work off all the beer, and read.  Of course, these items don't include the every day items of life that also take place, namely attending my job on a daily basis, and spending time with my wife and little girl. 

So with the above items in mind, I've learned that the old plan of action just isn't good enough.  I love to stay up late, but when you chase around a 2 year old after a day at the office, you wear down pretty quickly.  You can't just go home and do what you feel like doing, like just lay on the couch and catch up on Sports Center.  You can't just decide to go for a run, rinse off, then cook dinner in the middle of the week, as by that time its after 7 and the wife is getting more stressed out than usual.

So given my epiphany, my fix is very simple, if you can't beat em.. join em.  If you can't get everyone else in your family to shift their schedules to accomodate your needs and wants, just take advantage of the gaps.  My wife and daughter are typically sleeping when I leave for work each day.  I learned a refreshing method to start my day, to get up early and read.  This little sacrifice just makes so much of a difference on my outlook of my day.  I don't feel like I'm squeezed to take advantage of the few minutes free while my daughter's getting a bath, or that I need to worry about her getting to bed early so I have some free time at night.  In other words, why leave things to chance?  Instead, just knowing that that time in the morning is mine for the taking, go ahead and grab it. 

Need further proof that the answer to more time is less sleep?  Here's a hint, there are no phone calls at 6:30 AM.  There are no text messages asking for favors "when you have 5 minutes" (which you never do).  Getting ready for work is much more fun when you dont squeeze getting ready into a 5 minute window, and it's nice to be able to read the news, weather and sports BEFORE you get to work, not while you're checking email and making a task list for the day.

So if you find yourself squeezed for time, challenge yourself to look for when free time is available.  I don't particularly consider myself a morning person, but I personally realized that it's juvenile and ignorant to think that I can use Saturdays and Sundays as days to "sleep in".  Instead, I can use days and weekends to get an extra 1-1.5 hours in for me, knowing my time with my family is much more guilt-free when I get home, focusing on them rather than focusing on the things I feel I *need* to do.

Thursday, February 21, 2013

Book Review: SuperFreakonomics

SuperFreakonomics: Global Cooling, Patriotic Prostitutes And Why Suicide Bombers Should Buy Life InsuranceSuperFreakonomics: Global Cooling, Patriotic Prostitutes And Why Suicide Bombers Should Buy Life Insurance by Steven D. Levitt

My rating: 3 of 5 stars


This is a thought provoking, fun book to read, I just found it much more drawn out and random than it needed to be. Freakonomics was very good and discussing the generation of insight from mountains of data, and explaining the process along the way. Superfreakonomics has a similar approach, but with much more information that is well outside the boundaries of what you'd expect. It's almost as if the authors go from A -> C -> D -> Q -> V -> to get to point B. It's not that I didn't enjoy the discussion of topics, it was just so round about and long, it was hard to remember why you started reading the chapter in the first place.

The opening chapter on prostitution talked at great lengths about the plight of women in society. The last chapter in the book spoke for pages on end about some particular methods on how we can combat global warming. It's not that these points wern't necessary, they did feed into the theme of the chapter, it was just more story telling and investigative reporting than talking more-so about data and what the data proved... which was much more what they did in Freakonomics, and what I enjoyed about that book so much more than this one.





View all my reviews

Monday, February 18, 2013

Fixing The report server cannot process the report. The data source connection information has been deleted. (rsInvalidDataSourceReference)


In using SQL Report Builder (3.0) to place reports on my SharePoint 2010 install, I have been upgrading the reports to use stored procedures and reference newly created Data Source files, also hosted on said SharePoint 2010 implementation.  I have converted and improved a number of reports already, but received a new error message this time around when attempting to run a report within the designer to ensure my changes were working appropriately.  As the title indicates, my error was "The report server cannot process the report.  The data source connection information has been deleted.  (rsInvalidDataSourceReference)"

After searching the web a little bit, I came across a mention of this error here: http://ryandev.com/rsinvaliddatasourcereference-on-a-microsoft-srs-report/ - Ryan mentioned "There is a GUID stored in the rdl file for the data source".  As I read that line, I realized that I didn't create a new data source in my report, I only edited the properties of the existing data source, and as such some of the meta-data that allows the report builder to work it's voodoo must be off.

I've seen a number of potential fixes for this error, but for me, my fix was quite simple.  I just:

  1. Deleted the data source I had been working with
  2. Created a new data source, pointing to the same shared data connection I have on my SharePoint site. 
  3. Then, I connected my queries to use this data source, ran the report, and all was well once again.  
I suppose it's possible to have opened the RDL file within Visual Studio to muck around and see if I can find any missing data, but for me, it was easy enough to just recreate my data source reference.  Hope this helps!

Monday, February 11, 2013

Getting a performance boost to SQL Report Builder Reports on SharePoint - Its the little things that count

Where I work, for a number of years now our analytics team has made use of the SQL report builder to provide report subscriptions and high-level insight into sales performance.  With us recently launching our SharePoint-enabled intranet, we have been porting over some of these reports off of our dedicated report server (using "Native Mode" reporting services) and instead using the newer "SharePoint Mode" that provides web integration with our SharePoint site.

After migrating over some reports, I was somewhat disappointed and concerned at the speed, or lack thereof, of the report completion.  Looking at what could have changed in the reports from the "old" version to the "new" one, it was easy to think that it was my SharePoint implementation.  I performed some "research" (aka Googling) on the issue and came across a few blog posts, technical articles and discussion board posts all indicating that it's due to the level of HTTP requests and responses between SharePoint and the report file that is processing the query.  And to be honest, there is most certainly truth in that statement... but it shouldn't have been as drastic as what I was seeing.  How bad was it?  Well, report's that would take (on the old server) 17 seconds on average, while the reports on the new server were taking 2:58 on average.  In the beginning, I chalked it up to SharePoint and it's usage of returning the results to the client, but over time, I realized I was being lazy and pawning off the blame onto Microsoft... like it could be MY problem.. right?

So in an effort to make the RPT files more maintainable, I decided to look into storing the Dataset queries in a SQL stored procedure, instead of having them as flat queries stored within the RPT file itself.  Once I dug these up, I began to find my issue...

I haven't been at my current occupation much (I started here in August '12, which at the time of this writing is 175 days, 6 hours, 14 minutes at 22 seconds), and our IT staff here is on the smaller side, so we tend to make power users out of the user community when possible.  In this case, our analytics team has controlled and maintained the reports that I had been converting.  The member's of this team are very, very smart, it's just that some of the technical skill sets have been.. tunneled.  To explain, their solutions at times seem to be "I need a report, so I'll create a view and use that for my report".  Not that that's wrong, but from a programmers perspective, you should strive to make things modular and re-usable.  So it's not that they're wrong at all.. it's just created more work for me :)  So, when digging into the report queries, I found a few changes that made a world of difference.  How much?  That report that was taking 17 sec. on average, then up to 2:58, is now down to.. 22 seconds!  Not that I wanted to see these reports take "longer" on SharePoint.. but 5 more seconds due to HTTP chatter is much more paletable than 161 seconds :)

So what were my changes?  In all, there were 3 distinct differences I had to make.
1. Stored procedures are just "better", mainly because of their "execution plan retention and reuse" - among many other items noted here by our very good and respected friend Pinal Dave -http://blog.sqlauthority.com/2007/04/13/sql-server-stored-procedures-advantages-and-best-advantage/ (on a side note, if you do *anything* database related, you really should follow his blog, its excellent). 

2. Stored procedures provide flexibility in your database programming.  In my scenario, there were times I needed to read data from another table in a separate database.  With a stored procedure, it made the query that much simpler, because I was able to read into a table variable and use that data only when necessary, rather than relying on the "query builder" in the report builder, which allows for a query with some parameters, but not much beyond that.

3. Looking at the query really made me realize how innefficient the queries were!  I didn't realize it until I gave it a full look, but the queries had several repeated items in the where clause.  As an example, what's easier to read?

a.) WHERE contractNumber = '' And VoidValue = 'AK' Or contractNumber = ' ' and VoidValue = 'AK' or contractNumber = '' And VoidValue = 'AR' Or contractNumber = ' ' and VoidValue = 'AR' and contractOwner = @user

b.) WHERE contractOwner = @user and contractNumber NOT IN ('',' ') and VoidValue IN ('AK,AR')

This is an oversimplified example of what I ran into (because, frankly, you wouldn't care about the exact SQL used, nor would my company appreciate me posting actual database structure :), but you can see that the query was much more complicated than it had to be.  As a rule of thumb, if it's complex to read, it's complex to compute as well.   However, the largest performance boost I found was moving the "contactOwner" condition to the beginning of the where clause.  Rather than first testing for contract numbers and void values that weren't pertinent to my user, I was now testing for the records that would only pertain to my user first.. greatly speeding up my query.

So what did I learn here?  Well, sometimes it's easy to overlook, discount or even ignore the simple stuff with your technical issues, immediately resolving that the problem must be complex and highly technical.  In the end, with only 15 minutes of analysis and work, you too can find that it's some pretty basic things that can provide a performance boost to your work.

Friday, February 8, 2013

Bookstores - Death of an American Institution


Over the last 5 years, reading clicked with me.  I don't know the exact book that did it, but it all ties back to when I was studying for my M.B.A.  I was attending school part-time, but I truly didn't appreciate the opportunity to study, learn and grow until after I started studying for my graduate degree.  (To be honest, I didn't even have a good reason to go for my graduate degree, I already had a full-time career job lined up after college, but some part of me felt a need to keep learning.. which I am very greatful for... but I digress)

I attended Marywood University where I remember studying under Dr. Rex Dumdum for a few classes, and they were extremely reading intensive.  It was common to have 5-6 10+ page reading assignments - usually from Harvard Business Review - for homework each week.  While that may not seem like a great amount of reading, it was certainly imperative, as each following week all articles were discussed in great lenghts.  I also remember thoroughly enjoying each week's classroom discussions, as it was very enlightening to not only read such advanced concepts, but spend time in class dissecting these articles and reflecting on them, week after week.  As I finished up my degree, I reached out to "Dr. D" as he was affectionately called, asking him what I can read to continue to gain insight and knowledge.  He pointed me in the direction of Malcolm Gladwell, among others, and that was all I needed.. my reading button had been pushed.

Thinking back on it now, that was probably about 5 years ago or so.  Since that time, I haven't become a "huge" reader, I certainly find myself distracted at times to do other things than just read, but I definately have more of a passion for it than I ever had.  However, I have equally found pleasure in finding some reading spots nearby, since I learned that the siren call of a nearby Playstation, no matter how good a book I'm reading, is always tempting.  As such, I found myself at Border's a number of times over the years to get a nice cup of coffee, settle in on a heavily worn down leather sofa and dive into whatever I may have been reading at the time.  Then... Border's closed.  I can't say I'm surprised, I was one of the people that killed them with a death by 1000 cuts.  If you've read my previous post's, you've noticed my oft references to my beloved Kindle.  I don't go to bookstore's to buy books, I go for coffee and a quiet place to read.  For as brilliant a model it is to have a coffee shop in a bookstore, it's stupid to have a bookstore with all those amenities when you don't sell books.

OEDB.org published an article late last year regarding the state of bookstores (http://oedb.org/library/beginning-online-learning/12-stats-on-the-state-of-bookstores-in-america-today), and it's interesting.. it also cannot combat what Barnes And Noble has become:



I didn't take that picture, but I easily could have, that isn't just a store display, that is the first thing you see as you now enter B&N stores, which is what I witnessed first hand earlier this week (and has become the inspiration for this post).  Bookstores are dead, and large chains like B&N know it, they're just saving face while they can.  It's a shame too, I went into my local B&N, got a Starbucks coffee, sat in a worn down leather sofa, opened up my current book and chilled out for an hour or so.  I wasn't alone either, there were plenty of people in the store.. just nobody browsing\purchasing books.  I enjoyed being there, and it feels good to be a book nerd amongst fellow book nerds (which is an amazing social experiment, a group of bookies who all share a room yet don't make eye contact or speak to one another).

Retail stores won't die easy, but many die nonetheless, and it's a shame, bookstores seem to have always been that niche store, almost like a special club in any local town or city.  You never saw the skate-rats hanging out in Border's, they were too busy slurping Coke outside the food court or browsing punk CD's at The Wall (yeah.. remember that music store?).  However, take any reader to a local town, they'll sniff out a bookstore within 15 minutes flat, enter the joint and talk to the cashier like their Sam Malone in Cheer's.

So fight the good fight local Barnes and Noble, you and your fellow bookstores are beloved, but you're a dying breed losing the battle one e-book at a time.

Wednesday, February 6, 2013

SkyDrive - Embedding an Excel Worksheet - No more file downloads!


Incase you didn't know, I'm a huge fan of SkyDrive, a Microsoft based product that let's you store and share document's in the cloud, giving you access to your files no matter where you are.  As such, I have been deemed a member of the SkyDrive Insider's program.  Should you be interested in becoming an insider, learn more about it here: http://sdrv.ms/V0buD7
A co-worker of mine and I got into a discussion about retirement savings yesterday.  After writing a bunch of stuff on a whiteboard, we eventually realized performing iterative calculations on savings and compounded interest would be much better solved with Excel... nothing groundbreaking there.  After dancing around with some custom calculations, we eventually stumbled upon a well formatted template, complete with a simple to use form section and even a chart (hooray pictures!).


So last night, I went home and thought about that process, and got a little frustrated about it all.  I mean.. it's 2013.. do we really STILL have to Google\Bing\Yahoo!\WebCrawler "Excel Template Retirement", scroll through lists, download a file, un-zip it and open the file?  I mean, not that this is all that difficult, but it just seems so.. non-2013.

As mentioned above, I'm a SkyDrive enthusiast!  I also want the world to know that it's so much more than just storing-a-file-and-having-access-to-it-anywhere-at-anytime-as-long-as-you-have-Internet-access.. because.. you know.. that's so un-impressive.  It also has alot of features to make life simpler, such as not always needed to have a file handy, sometimes all you need is the Internet.  SkyDrive has some awesome features for the web browser that let's you use and interact with files, without the need for downloading them.

So in our instance above, let's say that you already built something like the retirement calculator, or that you found the spreadsheet of your dreams created by SpreadsheetZONE that was hosted on http://office.microsoft.com/en-us/templates/retirement-calculator-TC010370179.aspx, and let's say this thing is working beautifully, but you want to be able to access it from.. say.. a mobile phone or tablet.. or even without having to have a copy of the file.  With SkyDrive, you can EMBED an Excel file.  Very easily too.. here's how.

Within the SkyDrive web application (http://www.skydrive.com) I took the retirement savings calculator and uploaded it to my SkyDrive account within a public folder available here http://sdrv.ms/Wa3dLZ.  With my file SZ_RetirementCalculator1 uploaded,  I can choose the file by clicking on the icon.  Then, I can choose "Embed" on the options menu across the top, and choose to "Generate" HTML to embed the file in a webpage.  Why would I do this?  Well.. so now I can show the following:



Check that out!  I can now have a FULLY INTERACTIVE Excel Workbook available on the web, all by clicking a total of 3 buttons.  And of course, using various security settings within SkyDrive, you can configure this to only read\save access to select audiences if needed, but with very little work, we can now move away from the need of downloading and opening files, and re-searching for files when we lose then, and instead just make use of the web as it was intended!