How to get the Don Jones Powershell v3 book real cheap

If you have been toying around with the idea of buying the Ebook+MEAP+Printed Book combo for $49.99, let me bring some additional information to the table so that you can make up your mind.

From Manning Store here, price for the book is

MEAP + Ebook only – $39.99
MEAP + Print book (includes Ebook) when available – $49.99

I received an email alert from Manning today which goes like this.
37% off orders under $50–use code a2637
42% off orders over $50–use code a2642
50% off orders over $100–use code a2650
Offer applies to your entire purchase–eBook, pBook, or MEAP. Expires May 2. Only at manning.com

I got my $50 combo for $31.49. That’s cheaper than MEAP+Ebook.

Do you really want to sit this one out ?

Advertisements

An ode to Richard Thaler (or, How to Make a book stand for 300 pg books)

After much grief to my back, I decided to finally buy a Book-Stand.
Did some research on Amazon and selected this by Best Book Stand & Holder.

But its 2:30 AM in the night, and I need something now so that I can finish this chapter.

Imagination to the rescue.

Scanned the room and saw this Amazon box. Pulled out a scissor and made this.

This box book-holder fits small books easily. Tested it with Richard Thaler’s Winner’s Curse.

I think the test-case was appropriate for the occasion. After doing a 15 min research on Amazon, you find the perfect book stand for $30 (+$10 shipping) which weighs 4 lbs.

5 mins later, you grow so impatient that you decide to make your own.

Documenting Failure: Powershell with Windows Live Skydrive ? Anyone ?

I think I spent the whole day chasing weird ideas, testing out codes and none of them came to any fruition. I wanted to document my attempt at solving the problem, document my initial over exuberance and expectations, and may be irrationality in concluding it can’t be done – all within 10 hrs. I was looking for some structured format (maybe a form ?). I am going to probably attempt this from memory and update the post later with relevant links.

Googled How to Document Failure.
Binged. (Related Search result > How to document nursing Notes / How to document in nursing…Real classy.)
No luck.

There was a blog entry from Sybase about how important it is to document failure, but nothing else. There are PMI surveys of project failure, but I was looking for some type of a structure to document failure from the dev’s point of view. I spent a huge amount of time trying to R&D something with nothing tangible to show-off as achievement by the end of the day. I am super super-pissed on the amount of time I wasted on this.

Begin-State: How cool will it be if you can write a one-way log for all PoSH scripts and upload it on Skydrive ?

Why Skydrive ?

  1. 25 gigs free, more than enough for logs.
  2. Logging separate from the production system. In case your scripts blows up a building, there will be a log for that.
  3. There’s a good chance that there is an API for Windows Live. Might be a good idea to expand upon my Powershell+API’s approach and experiment with other REST API’s.

Why Powershell ? >> DUHHHH !!

Initial R&D (implicit but validated)

  1. Does Skydrive have an API ? Yes
  2. Is it documented. Are there code-samples. > Yes
  3. Are there sample-code from non-Microsoft sources – Github etc. > Yes
  4. Is there a Powershell version of it ? > Nope. But you do have C#, IOS, Windows Phone, Javascript.

Assumptions:

  1. API’s will have simple auth service / Tokenized. I should have thought of Windows Authentication and SSO’s before attempting this but I didnt.
  2. Didnt anticipate multiple layers.
  3. I thought you can take a .DLL and do an add-type and get cracking with it. [doug Finke source. Joel Bennett stuff from poshcode]
  4. There was no DLL for Windows Live, so I tried to plug-and-chug a Windows Live phone.DLL. Now that I am doing a post-mortem analysis, I am not sure why I thought of that in the first place.

Different Approaches or in other words: My Try/Catch blocks. {there was no catch.}

  1. Review the code. Skipped IOS/Android
    Checked PHP/ASP/ Windows Phone.
    can you do a
    Add-Type -Path “C:\Users\Administrator\Documents\WindowsPowerShell\Modules\Live\Microsoft.Live.Controls.dll”
    Add-Type -Path “C:\Users\Administrator\Documents\WindowsPowerShell\Modules\Live\Microsoft.Live.dll”
    Add-Type -Path “C:\Users\Administrator\Documents\WindowsPowerShell\Modules\Live\Microsoft.Live.Controls.Toolkit.dll”
    Answer > NOPE. Add-type erroring out
  2. Can you do that region based thing with DLL’s and a C-Sharp classes code and Namespace.
    Didn’t get it to work. I figure I didnt have the right DLL’s. I was trying to plug phone DLL’s on Windows 2008 R2
  3. Checked the REST API.
    Took some time trying to figure out Var’s/Tokens.
    they have a live SDK of Windows Live API. Neat
    I got the variables back when i ran the code.

big-problem
3a) you need a client-id. Looks like it is similar to an app-developer ID. I had no intention of going through the steps.
There was a big section on before you begin.

3b) Tried doing a System.nativeclient / Get-URL with these, but erroring out
GET https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=SCOPES&response_type=RESPONSE_TYPE&redirect_uri=REDIRECT_URL
https://apis.live.net/v5.0/me/contacts?pretty=false&access_token=ACCESS_TOKEN

Bad Client-ID (I was using the client-ID from live SDK.

3c) Checked Support Forums / Microsoft Connect.
Some of the answers in Forums point to cases on Microsoft Connect, which are not publicly accessible.
They have been marked as an Answer in forums but USELESS.

3d) I had the access token / folder ID numbers etc.
You can’t do any Get-URL’s without the clientID. Period.

OPTOIN-4:

I had already spent a good amount of 10 hrs on this since morning running on 5 hrs of sleep from last night. I was really drained by the time You can have the Windows Live drive mapped. I remember I had done this earlier and sufficient amount of documentation @ lifehacker level.
Maybe you can do a Get-PSDrive on the mapped drive and fulfill the original goal of writing logs to Skydrive.

But it wasn’t sexy enough. It was kinda boring and i didn’t want to rely on mapped drives to do this.
I’d rather do it with a TOKEN and get-cred, put it into a file and then call it.

Reason for Rejecting:

Mapped-drives break for weird reasons.
Mapped-drives over the Internet can break for too many reasons, I am not attempting a secure logwriter with this.
I arrived at this point and the triviality of the solution pissed me off {You should have thought of this earlier / Are you sure you can just do a mapped drive on this ?}. I convinced myseld that my script will fail for sure with this solution.

End-State:

  1. End of the day I was really frustrated with perceived limitations of the Windows Live API.
  2. The REST API looks like it gives preference to developers who will build Apps on Windows or Other Mobile Phones. It assumed a URL redirect path etc, which I am not sure I can achieve with Powershell.
  3. To get ammo for my frustration, I did some quick searches on ProgrammableWeb.
    Microsoft has 14 REST API’s for Bing Maps, Windows Live, Photos and crap. Might be a good idea for consumer products, but sucks in enterprise.
    Maybe Microsoft is going WSDL/SOAP way and started on the REST game late. Maybe they just don’t care.

Conclusion:

  1. I am documenting my approach to this, so that someone else doesn’t have to spend 10 hrs to arrive at SCREW CLIENTID.
  2. Please dont plug Phone DLL’s to 2008R2/Win7 or anything with a PC. I dont think they were meant to work in the first place.
  3. Maybe you can write your DLL, if this is that important to you.

On Second thoughts, Why would you write your own DLL, when you can play with the Dropbox REST API ?

My Moral of the story (Yours maybe different.)
$20 a month is peanuts for 10 hrs of wasted Dev Time.

PS: What not to do.

  1. Dave McClure’s post calls 500 hats a Fail Factory, but zero documentation of a single failure anywhere. Dude that’s disappointing for a fail-factory. That’s the least you could do if you call yourself a fail factory.
  2. Pointless example of a pitch here with HandshakeUmbrella.com. It was terrible to watch. I am not sure why anyone would use this as an exercise for anything other than learning when to stop talking.

Reminds me of the time when my wife was asked to attend this Indian Women’s Group in College. The lady over there split the group into 3-teams and asked them to discuss “Modern Indian Youth”.

Group-1 Had to discuss Modern.
Group-2 Had to discuss Indian.
Group-3 Had to discuss Youth.

I wasn’t there, she tells me it was torture in slow-motion to see people in a group go on and on for 15 mins to discuss the word Modern.I had a similar feeling after watching that video.

Bad Mouthing Tropo. Why ? What’s the point.

I love Tropo. Loved them for the 3 days I have known them. It does its job and gets out of the way.
They make it easy to love them.

Feedback is important

I had an awesome time at Phila Exchange Users Group meeting last evening.

SUMMARY:

  1. Don’t try V3 on production. It’s in beta for a reason. Cool demos.
  2. show-window tricks
  3. Logparser Studio is awesome. I had tried log parser lizard earlier, but it wasn’t fun. I had used Windows Grep for finding out date/time/IP log data from IIS Logs.

I also received some valuable feedback when I was demoing my script. Feedback is really important when you are developing something / anything:

  1. You really don’t know how your script runs till you try to do a demo and discover a non-standard function you have used. Made changes to use GWMI. http://poshcode.org/3369.
  2. You get ideas of what you can do with this. Function, Parameter Binding, Try/Catch blocks, Modules, Accept input from pipeline.

TODO For now:

  1. Make a Function
  2. Accept $myCell, $myString
  3. Splice string into a hashtable / array (?)
  4. Check if you can use this

LATER:

  1. Module Stuff – Cmdlet binding, Accept input from pipeline.
  2. Error Handling – I am not GETting anything. Maybe a try/catch blog will help – “You used the default phone number”, You are using my token – CONFIRM to run

OTHER:

  1. Received some encouraging emails last night. I am going to explore this a little bit further.

Make a phone call from Powershell.

 

  1. Tried searching for stuff all over the place for calling options.
  2. Saw some options on Twilio forums which required calling Twilio DLL’s. I didn’t want to add another .DLL layer.
  3. Discovered Tropo !! Free Dev Version !! <simpsons opening theme>
    How do I post to tropo. Tropo support directed me the correct API link
  4. Decided on Javascript against python/ruby and others. You just do a Call($number).That’s it.
  5. Did a lot of research on passing objects from Powershell to Javascript. I was going crazy over it. Listened to J.D and played this > http://www.youtube.com/watch?v=175j15a4w7A
  6. Took me a day to figure this out. http://poshcode.org/3369

 

Enjoy.

Bryan Cantrill at QCon

Every Windows System Admin should watch this video. Debugging Production Systems

The video is all about failures, transient failures and post-mortem debugging. It’s amazing how he covers the history, NTSB, Disaster Porn and makes it all come together in a debugger for Node.Js. It gives you a perspective on how you can approach debugging production systems.

The good news is, Windows already has good debugging tools and Symbol files where you can trace the issue down to a module / function level.

I also found this blog on replay debugging using vmWare Workstation.

Golden Rule : There are no one-off errors in production.

If it happened earlier, there’s a good chance that it can happen. It might be a good idea to get a full dump/VM Snapshots and start Windbg.

PS: You should check out Bryan Cantrill’s answer in Google Groups here.