Jekyll2023-07-18T19:09:16+00:00https://www.wassupy.com/feed.xmlMichael Haren’s Wassupy BlogOccasional thoughts on technology, money, life and kids by Michael HarenMichael HarenAnother Bittersweet Goodbye2016-08-26T12:50:00+00:002016-08-26T12:50:00+00:00https://www.wassupy.com/2016/08/another-bittersweet-goodbye<p>About two years ago we first <a href="/2015/01/they-dont-make-greeting-card-for-that.html">said goodbye</a> to our first foster placement, a delightful baby boy, J. Thanks to the mercy of time passing, our thoughts have turned from grief to hopefulness. We have no actual knowledge of how he is doing but that’s how it works.</p>
<p>Since then we’ve had many more kiddos come through our home. We do our best each time to give them love in whatever form they need – attention, kindness, patience, nutrition, dental, medical, etc. – and we are genuinely happy to see them reunited with their families.</p>
<p>About a year and a half of the last two years has passed with a pair of toddlers, a boy and girl, A and I. No matter how you measure it this is a long time: birthdays, seasons, holidays. Half their lives. It’s not supposed to, but that’s often how it works.</p>
<p>Today we say goodbye.</p>
<p>This goodbye bears no resemblance to the first one I shared. It’s more like all the ones since: mostly sweet, mostly happy, a little sad, and planned. We had no idea what was happening with J two years ago when he was suddenly taken from our home to live with a relative. In the void of knowing what to expect we got too close. In the years since we’ve prepared ourselves for the reality that most of the time these kiddos go home and it doesn’t have to make sense. This personal growth has come through hard-earned experience, and through the council of many wonderful friends who exhibit a love for foster children we admire.</p>
<p>We say goodbye to A and I for what we hope is the last time. I hope their family provides them the home that every child deserves. I hope we <em>don’t</em> see them again because to see them again will mean that trauma has cruelly visited them again.</p>
<p>And while we’ve learned to weather the acute pain of the goodbye, this placement is hard for us in a new way: the pain has been chronic. This has been a long placement. It warms my heart to see how far they’ve come in our care, but the investment in their lives has been taxing for us and our bio kids. It’s been so difficult! And so rewarding! Life is messy; that’s how it works.</p>
<p>Goodbye, A and I.</p>
<p>We’re taking some time off.</p>
<p>(And SO many thanks to the many amazing families that have helped us these past two years with love, support, respite and food. We couldn’t do any of this without you. Thank you.)</p>Michael HarenAbout two years ago we first said goodbye to our first foster placement, a delightful baby boy, J. Thanks to the mercy of time passing, our thoughts have turned from grief to hopefulness. We have no actual knowledge of how he is doing but that’s how it works.The term ‘Invoke-AzureResourceAction’ is not recognized as the name of a cmdlet2016-03-09T02:54:00+00:002016-03-09T02:54:00+00:00https://www.wassupy.com/2016/03/the-term-invoke-azureresourceaction-is<p>In case you are getting this ungoogle-able error when using <code class="language-plaintext highlighter-rouge">Invoke-AzureResourceAction</code>:</p>
<blockquote>
<p><code class="language-plaintext highlighter-rouge">Invoke-AzureResourceAction : The term 'Invoke-AzureResourceAction' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</code></p>
</blockquote>
<p>You’re might be using some out of date docs. Try <code class="language-plaintext highlighter-rouge">Invoke-AzureRmResourceAction</code> instead (add the “Rm”).</p>
<p>Oh, and if you then get this (because you’re automating things):</p>
<blockquote>
<p><code class="language-plaintext highlighter-rouge">Invoke-AzureRmResourceAction : Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.</code></p>
</blockquote>
<p>Try adding <code class="language-plaintext highlighter-rouge">-Force</code> to run the command without prompting for interactive confirmation.</p>Michael HarenIn case you are getting this ungoogle-able error when using Invoke-AzureResourceAction:Fixing “500 : undefined” error in Swashbuckle/Swagger2015-03-24T13:16:00+00:002015-03-24T13:16:00+00:00https://www.wassupy.com/2015/03/fixing-500-undefined-error-in<p>Suppose you include XML docs to make your Swagger/<a href="https://github.com/domaindrivendev/Swashbuckle">Swashbuckle</a> docs even better via the option:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">c</span><span class="p">.</span><span class="nf">IncludeXmlComments</span><span class="p">(</span><span class="n">Path</span><span class="p">.</span><span class="nf">Combine</span><span class="p">(</span><span class="n">HttpRuntime</span><span class="p">.</span><span class="n">BinDirectory</span><span class="p">,</span> <span class="s">"Das Docs.xml"</span><span class="p">));</span>
</code></pre></div></div>
<p>And things work great locally. But then you publish to a webserver, an Azure Website, etc. and you get an error like this:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>500 : undefined http://your-site:80/swagger/docs/v1
</code></pre></div></div>
<p>You probably already enabled the generation of the XML documentation file, <strong>but did you do it for the Release configuration</strong>? Since you’re here, probably not. Fix that and you’ll be all set.</p>
<p><img src="/assets/2015/project-dialog.png" width="1004" height="803" alt="project config dialog with "configuration: release" highlighted, and a highlighed checked box that reads "xml documentation file"" /></p>Michael HarenSuppose you include XML docs to make your Swagger/Swashbuckle docs even better via the option:They don’t make a greeting card for that2015-01-16T03:25:00+00:002015-01-16T03:25:00+00:00https://www.wassupy.com/2015/01/they-dont-make-greeting-card-for-that<p>Wife and I became licensed foster parents late last year. In early November we took our first placement into care, a three day old baby boy. He is awesome.</p>
<p>He has lived with us as our foster son for the last nine weeks. He is so, so awesome. I talk about him a lot.</p>
<p>Thing 1, Thing 2, and Thing 3 adore him. He is their foster brother.</p>
<p>At 1:45 pm today we learned that he’ll be going home to live with a relative <em>tomorrow</em>. Wife cried. I raced home.</p>
<p>We are conflicted. We knew this would likely happen; we were told that 85% of kids go “home.” And we’re glad for him, his relative, and his birth mother! This is the best thing for him! But we’re sad, too.</p>
<p>We’re heartbroken. We’re experiencing profound loss that most people can’t understand.</p>
<blockquote>
<p><em>“He’s not your son,”</em> people must think.</p>
</blockquote>
<blockquote>
<p>We are all he’s ever known.</p>
</blockquote>
<p>We started packing up his things. I held him. I cried.</p>
<p>We are grieving.</p>
<hr />
<p>On Sunday Wife and I were on a panel at a foster care and adoption support group. We shared how wonderful it is being foster parents. We nodded unknowingly along with others who shared about the loss they’ve experienced as kids went home.</p>
<p>We know now. We were warned. We are not ready.</p>
<hr />
<p>Wife took him to book club so the book club could say goodbye. They’ve read three books with him in tow. They know him well. They’re crying, I’m sure.</p>
<p>Meanwhile I took our other kids to the store to get a card for Wife, for his relative, or for him. I don’t know. I wept in the aisle and left empty handed. There’s no card for this. He’ll be gone, but not gone.</p>
<hr />
<p>Tomorrow we cannot do. But we will. We will bathe and dress him. We will feed him. We will play and read to him. We will take him to the doctor for a previously scheduled appointment. Then we will pack up his things, his keepsakes, the cards all the Things have made for him, the special pacifier he likes, and give him to his social worker. She will take him to his relative.</p>
<p>We will never see him again. This child that we have held, comforted, and raised as our own will be gone.</p>
<p>And we will cry some more.</p>
<blockquote>
<p><em>“You shouldn’t get attached,”</em> people must think.</p>
</blockquote>
<blockquote>
<p>Maybe not. Attachment is best for him, even if it hurts us.</p>
</blockquote>
<p>And I hope. I hope we will work through our grief and forget how hard this is right now. I hope I forget how painful it is to type these words as I wipe my face after every sentence. Because then we can do it all over again for the next beautiful child that needs our home, if only for a little while.</p>Michael HarenWife and I became licensed foster parents late last year. In early November we took our first placement into care, a three day old baby boy. He is awesome.Make way for a unique key constraint by renaming/updating duplicate rows in SQL Server2014-07-08T18:47:00+00:002014-07-08T18:47:00+00:00https://www.wassupy.com/2014/07/make-way-for-unique-key-constraint-by<p>If you want to add a unique key constraint or index to a table that might have duplicate records you’re in for some fun. You can either delete the duplicates, or fix the data to make them unique.</p>
<p>Suppose you have a table “Widgets”, which <em>should</em> be unique on <code class="language-plaintext highlighter-rouge">SupplierId</code> and Name, but isn’t. This tsql script will update the duplicates by appending a “(1)”, “(2)”, etc. to the Name, thus satisfying the proposed UKC:</p>
<div class="language-sql highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">DECLARE</span> <span class="o">@</span><span class="n">Widgets</span> <span class="k">TABLE</span><span class="p">(</span>
<span class="n">Id</span> <span class="nb">INT</span> <span class="k">NOT</span> <span class="k">NULL</span> <span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">,</span>
<span class="n">SupplierId</span> <span class="nb">INT</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
<span class="n">Name</span> <span class="n">NVARCHAR</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">)</span>
<span class="k">INSERT</span> <span class="k">INTO</span> <span class="o">@</span><span class="n">Widgets</span> <span class="p">(</span><span class="n">Id</span><span class="p">,</span> <span class="n">SupplierId</span><span class="p">,</span> <span class="n">Name</span><span class="p">)</span>
<span class="k">VALUES</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="s1">'WidgetA'</span><span class="p">),</span>
<span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="s1">'WidgetA'</span><span class="p">),</span>
<span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">'WidgetB'</span><span class="p">),</span>
<span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">'WidgetB'</span><span class="p">),</span>
<span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">'WidgetC'</span><span class="p">),</span>
<span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">'WidgetC'</span><span class="p">),</span>
<span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">'WidgetC'</span><span class="p">)</span>
<span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="o">@</span><span class="n">Widgets</span>
<span class="p">;</span><span class="k">WITH</span> <span class="n">cte</span> <span class="k">AS</span>
<span class="p">(</span>
<span class="k">SELECT</span>
<span class="n">ROW_NUMBER</span><span class="p">()</span> <span class="n">OVER</span><span class="p">(</span><span class="k">PARTITION</span> <span class="k">BY</span> <span class="n">SupplierId</span><span class="p">,</span> <span class="n">Name</span> <span class="k">ORDER</span> <span class="k">BY</span> <span class="n">Id</span><span class="p">)</span> <span class="k">AS</span> <span class="n">rno</span><span class="p">,</span>
<span class="n">Name</span>
<span class="k">FROM</span> <span class="o">@</span><span class="n">Widgets</span>
<span class="p">)</span>
<span class="k">UPDATE</span> <span class="n">cte</span> <span class="k">SET</span> <span class="n">Name</span> <span class="o">=</span> <span class="n">Name</span> <span class="o">+</span> <span class="s1">' ('</span> <span class="o">+</span> <span class="k">CONVERT</span><span class="p">(</span><span class="nb">varchar</span><span class="p">(</span><span class="mi">10</span><span class="p">),</span> <span class="n">rno</span><span class="p">)</span> <span class="o">+</span> <span class="s1">')'</span>
<span class="k">WHERE</span> <span class="n">rno</span> <span class="o">></span> <span class="mi">1</span>
<span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="o">@</span><span class="n">Widgets</span>
</code></pre></div></div>
<p>You ought to be able to run all that and get these results in SQL Server:</p>
<p><img src="/assets/2014/query-results.png" width="213" height="332" /></p>
<p>Adapt to your needs :).</p>Michael HarenIf you want to add a unique key constraint or index to a table that might have duplicate records you’re in for some fun. You can either delete the duplicates, or fix the data to make them unique.Understanding (That There Exists) An Opposing View2013-11-02T20:25:00+00:002013-11-02T20:25:00+00:00https://www.wassupy.com/2013/11/understanding-that-there-exists<p>If you are passionate about anything, chances are you’ve found yourself wondering “how in the world could that person believe <em>x</em> about an issue?!”, where <em>x</em> is avoiding semicolons in javascript, using tabs instead of spaces, being pro-gun, anti-cupcake, etc.</p>
<p>I used to find some of those moments very stressful. I’d be sitting there with lots of “evidence” and “research” to support my position, fuming about some <em>idiot who can’t use apostrophes correctly and is frickin’ ridiculous with his/her hyperbole and logical fallacies…</em>and get nowhere.</p>
<p>I finally figured out a little exercise that helps me in those tense situations: <strong>I just consider that the other person probably sees me as just as insane as I see him/her</strong>. That other person is more or less like me (rational, thoughtful, educated, kind, etc.) but disagrees with me the same way I disagree with him/her. And that’s fine.</p>
<p>“But <em>I’m</em> right!” you say.</p>
<p>Maybe you are. So what? Go tweet about it with loud, emphatic language! What good is that going to do? It makes you look like an ass when you’re right, and an ass when you’re wrong. Save your energy and hope that your noncombativeness will be reciprocated. To quote Dale Carnegie (more from him in a minute), “You can’t win an argument. You can’t because if you lose it, you lose it; and if you win it, you lose it.”</p>
<p>A baby step on the way to figuring all this out was more or less the development of a coping mechanism. I made a decision to not engage in fruitless debate. I noticed that many arguments I was having on Twitter and Facebook <em>were fruitless</em>…so I just stopped enabling myself to get all worked up over things 140 characters at a time.</p>
<p>Later, I had a realization when a friend help a position I found to be indefensible. As friends often do, we had an easy, dispassionate conversation. Neither of us won over the other person and that wasn’t the goal—we were just friends talking. That is when the real trick I described above sunk in: me and that other dude are <em>similar</em>.</p>
<p>Then this happened again when I was listening to a podcast I’d been listening to for a long time. My views usually line up well with the host’s (I listen for entertainment, not education). But then he passionately, and repeatedly started taking a position I am strongly opposed to. I literally said “Whoa, what?!” to myself the first time I heard it. Then I went though the whole exercise: this crazy smart, well informed guy has an insane position on this issue. Whoa! But that’s ok!</p>
<p>Now, suppose you actually want to change some hearts and minds on an issue. That’s really, really hard, and I’m not going to tackle that here. I can recommend these two books I recently finished, though: <em><a href="http://www.amazon.com/Switch-Change-Things-When-Hard/dp/0385528752">Switch</a></em> and <a href="http://www.amazon.com/How-Win-Friends-Influence-People/dp/0671723650"><em>How To Win Friends and Influence People</em></a> (aka HTWFAIP).</p>
<p>Both titles walk you through the basics of understanding problems, working with people, and affecting change. They use lots of anecdotes, guidelines, and tips.</p>
<p>If you’re not familiar with either, you might be surprised to hear that I found <em>Switch</em> to be more mechanical and duplicitous than HTWFAIP. It seems to focus more on the steps necessary to analyze situations and maneuver* *others into your line of thinking (or outright manipulate them). It also helpfully provides a framework for approaching and solving problems, and a vocabulary for talking about them. This has been very useful at work—we read it as a group and now refer to it and use its terms all the time.</p>
<p><em>HTWFAIP</em> on the other hand sounds like it’d be all about subterfuge but is actually entirely genuine. It has a slightly different goal of getting people to like you and it encourages this almost exclusively by teaching you to be a nicer person. Seriously! It offers many tips and admits that they will be effective only if you are sincere.</p>
<p>Relating this back to the post, here’s another Dale Carnegie quote from HTWFAIP about arguments:</p>
<blockquote>
<p>“I have come to the conclusion that there is only one way under high heaven to get the best of an argument— and that is to avoid it. Avoid it as you would avoid rattlesnakes and earthquakes.”</p>
</blockquote>
<p>Both are good, easy reads, and great for groups. I suggest reading <em>FTWFAIP</em> first, then <em>Switch.</em></p>Michael HarenIf you are passionate about anything, chances are you’ve found yourself wondering “how in the world could that person believe x about an issue?!”, where x is avoiding semicolons in javascript, using tabs instead of spaces, being pro-gun, anti-cupcake, etc.Notify New Relic of Deployments with Chef2013-09-09T14:03:00+00:002013-09-09T14:03:00+00:00https://www.wassupy.com/2013/09/notify-new-relic-of-deployments-with<p>You can tell New Relic about your deployments and they’ll add vertical lines to the graphs at the corresponding times. This is <em>super</em> helpful as the (often dramatic) impact of a deployment becomes easy to grok.</p>
<p>The documentation on the Events > Deployments page is very helpful, but I still had to tinker with my message to New Relic’s API to get it to work. Here’s what I ended up with:</p>
<p>At the end of my recipe, post to the API with the <a href="http://docs.opscode.com/resource_http_request.html">http_request</a> resource:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">http_request</span> <span class="s">"notify_new_relic"</span> <span class="k">do</span>
<span class="n">action</span> <span class="p">:</span><span class="n">post</span>
<span class="n">url</span> <span class="s">"https://rpm.newrelic.com/deployments.xml"</span>
<span class="n">headers</span> <span class="s">"x-api-key"</span> <span class="p">=></span> <span class="s">"#{node["</span><span class="n">newrelic</span><span class="s">"]["</span><span class="n">apikey</span><span class="s">"]}"</span>
<span class="n">message</span> <span class="s">"application_id"</span> <span class="p">=></span> <span class="s">"#{node["</span><span class="n">newrelic</span><span class="s">"]["</span><span class="n">appid</span><span class="s">"]}"</span>
<span class="n">end</span>
</code></pre></div></div>
<p>I’m loading the key and application id from attributes. And it works</p>
<p>This was crazy simple to do, though it might be better implemented as a report handler. If you go that route please share.</p>
<hr />
<h3 id="1-comment">1 comment</h3>
<p><strong>Unknown said on 2014-11-20</strong></p>
<p>Thanks for this, but the “message” parameter no longer accepts a hash, and the New Relic API has changed to use the URL <code class="language-plaintext highlighter-rouge">https://api.newrelic.com/deployments.xml</code> and the format of the parameters has changed. So you need something like:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>message "deployment[application_id]=#{app_id}&deployment[revision]=#{sha}"
</code></pre></div></div>
<p>(I parse the Git SHA out of release_path, I’m sure there’s a better way but Chef’s sparse documentation bit me again)</p>
<p>Anyway thanks for getting me most of the way there :)</p>
<p class="comments-closed">Comments closed</p>Michael HarenYou can tell New Relic about your deployments and they’ll add vertical lines to the graphs at the corresponding times. This is super helpful as the (often dramatic) impact of a deployment becomes easy to grok.How to use services in a NopCommerce Plugin that it doesn’t use by default2013-06-18T14:25:00+00:002013-06-18T14:25:00+00:00https://www.wassupy.com/2013/06/how-to-use-services-in-nopcommerce<p>Suppose you want to override some behavior in a NopCommerce service via a plugin. You would start by subclassing the service that has the behavior you want to override. But what if your new code requires access to something that the existing service doesn’t know about?</p>
<p>The answer turns out to be pretty simple: <strong>just add it to your constructor, and the dependency resolver will figure it out for you.</strong> (You don’t need to worry about it.)</p>
<p>Here’s an example. I want to override the PictureService. So I started with this:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">public</span> <span class="k">class</span> <span class="nc">MyPictureService</span> <span class="p">:</span> <span class="n">PictureService</span>
<span class="p">{</span>
<span class="c1">// constructor</span>
<span class="k">public</span> <span class="nf">MyPictureService</span><span class="p">(</span>
<span class="n">IRepository</span><span class="p"><</span><span class="n">Picture</span><span class="p">></span> <span class="n">pictureRepository</span><span class="p">,</span>
<span class="n">IRepository</span><span class="p"><</span><span class="n">ProductPicture</span><span class="p">></span> <span class="n">productPictureRepository</span><span class="p">,</span>
<span class="n">ISettingService</span> <span class="n">settingService</span><span class="p">,</span>
<span class="n">IWebHelper</span> <span class="n">webHelper</span><span class="p">,</span>
<span class="n">ILogger</span> <span class="n">logger</span><span class="p">,</span>
<span class="n">IEventPublisher</span> <span class="n">eventPublisher</span><span class="p">,</span>
<span class="n">MediaSettings</span> <span class="n">mediaSettings</span><span class="p">,</span>
<span class="p">:</span> <span class="k">base</span><span class="p">(</span><span class="n">pictureRepository</span><span class="p">,</span> <span class="n">productPictureRepository</span><span class="p">,</span> <span class="n">settingService</span><span class="p">,</span>
<span class="n">webHelper</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span> <span class="n">eventPublisher</span><span class="p">,</span> <span class="n">mediaSettings</span><span class="p">)</span>
<span class="p">{</span>
<span class="p">}</span>
<span class="c1">// my overrides</span>
<span class="p">}</span>
</code></pre></div></div>
<p>So you can see that we get a lot of stuff by default. If we want to use any of those services, we need to create class variables for them (the base class marks them private), like so:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">public</span> <span class="k">class</span> <span class="nc">MyPictureService</span> <span class="p">:</span> <span class="n">PictureService</span>
<span class="p">{</span>
<span class="k">protected</span> <span class="k">readonly</span> <span class="n">ILoggerService</span> <span class="n">Logger</span><span class="p">;</span>
<span class="c1">// constructor</span>
<span class="k">public</span> <span class="nf">MyPictureService</span><span class="p">(</span>
<span class="n">IRepository</span><span class="p"><</span><span class="n">Picture</span><span class="p">></span> <span class="n">pictureRepository</span><span class="p">,</span>
<span class="n">IRepository</span><span class="p"><</span><span class="n">ProductPicture</span><span class="p">></span> <span class="n">productPictureRepository</span><span class="p">,</span>
<span class="n">ISettingService</span> <span class="n">settingService</span><span class="p">,</span>
<span class="n">IWebHelper</span> <span class="n">webHelper</span><span class="p">,</span>
<span class="n">ILogger</span> <span class="n">logger</span><span class="p">,</span>
<span class="n">IEventPublisher</span> <span class="n">eventPublisher</span><span class="p">,</span>
<span class="n">MediaSettings</span> <span class="n">mediaSettings</span><span class="p">,</span>
<span class="p">:</span> <span class="k">base</span><span class="p">(</span><span class="n">pictureRepository</span><span class="p">,</span> <span class="n">productPictureRepository</span><span class="p">,</span> <span class="n">settingService</span><span class="p">,</span>
<span class="n">webHelper</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span> <span class="n">eventPublisher</span><span class="p">,</span> <span class="n">mediaSettings</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">Logger</span> <span class="p">=</span> <span class="n">logger</span><span class="p">;</span>
<span class="p">}</span>
<span class="c1">// my overrides</span>
<span class="p">}</span>
</code></pre></div></div>
<p>And if I want to add a service or repo that’s not there already? Just add it:</p>
<div class="language-cs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">public</span> <span class="k">class</span> <span class="nc">MyPictureService</span> <span class="p">:</span> <span class="n">PictureService</span>
<span class="p">{</span>
<span class="k">protected</span> <span class="k">readonly</span> <span class="n">ILoggerService</span> <span class="n">Logger</span><span class="p">;</span>
<span class="k">protected</span> <span class="k">readonly</span> <span class="n">ISpecificationAttributeService</span> <span class="n">SpecificationAttributeService</span><span class="p">;</span>
<span class="c1">// constructor</span>
<span class="k">public</span> <span class="nf">MyPictureService</span><span class="p">(</span>
<span class="n">IRepository</span><span class="p"><</span><span class="n">Picture</span><span class="p">></span> <span class="n">pictureRepository</span><span class="p">,</span>
<span class="n">IRepository</span><span class="p"><</span><span class="n">ProductPicture</span><span class="p">></span> <span class="n">productPictureRepository</span><span class="p">,</span>
<span class="n">ISettingService</span> <span class="n">settingService</span><span class="p">,</span>
<span class="n">IWebHelper</span> <span class="n">webHelper</span><span class="p">,</span>
<span class="n">ILogger</span> <span class="n">logger</span><span class="p">,</span>
<span class="n">IEventPublisher</span> <span class="n">eventPublisher</span><span class="p">,</span>
<span class="n">MediaSettings</span> <span class="n">mediaSettings</span><span class="p">,</span>
<span class="c1">// just add it to the constructor!</span>
<span class="n">ISpecificationAttributeService</span> <span class="n">specificationAttributeService</span><span class="p">)</span>
<span class="p">:</span> <span class="k">base</span><span class="p">(</span><span class="n">pictureRepository</span><span class="p">,</span> <span class="n">productPictureRepository</span><span class="p">,</span> <span class="n">settingService</span><span class="p">,</span>
<span class="n">webHelper</span><span class="p">,</span> <span class="n">logger</span><span class="p">,</span> <span class="n">eventPublisher</span><span class="p">,</span> <span class="n">mediaSettings</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">Logger</span> <span class="p">=</span> <span class="n">logger</span><span class="p">;</span>
<span class="c1">// and use it</span>
<span class="n">SpecificationAttributeService</span> <span class="p">=</span> <span class="n">specificationAttributeService</span><span class="p">;</span>
<span class="p">}</span>
<span class="c1">// my overrides</span>
<span class="p">}</span>
</code></pre></div></div>
<p>Have fun!</p>Michael HarenSuppose you want to override some behavior in a NopCommerce service via a plugin. You would start by subclassing the service that has the behavior you want to override. But what if your new code requires access to something that the existing service doesn’t know about?Chef: Cannot find a resource for powershell on windows version 6.1.7600 (solved)2013-06-14T13:45:00+00:002013-06-14T13:45:00+00:00https://www.wassupy.com/2013/06/chef-cannot-find-resource-for<p>While working on some deployment stuff I ran into this error:</p>
<blockquote>
<p><code class="language-plaintext highlighter-rouge">Cannot find a resource for powershell on windows version 6.1.7600</code></p>
</blockquote>
<p>The <a href="http://community.opscode.com/chat/chef/2012-11-06#id-228600">solution</a> turned out to be pretty obvious, and easy: <strong>include the powershell cookbook</strong>. For some reason I assumed it came in as part of the windows cookbook, but no. So just include it in your metadata.rb file like so:</p>
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">name</span> <span class="s1">'...'</span>
<span class="n">maintainer</span> <span class="s1">'...'</span>
<span class="n">maintainer_email</span> <span class="s1">'...'</span>
<span class="n">description</span> <span class="s1">'...'</span>
<span class="n">long_description</span> <span class="no">IO</span><span class="p">.</span><span class="nf">read</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">dirname</span><span class="p">(</span><span class="kp">__FILE__</span><span class="p">),</span> <span class="s1">'README.md'</span><span class="p">))</span>
<span class="n">version</span> <span class="s1">'0.1.0'</span>
<span class="n">depends</span> <span class="s1">'windows'</span>
<span class="n">depends</span> <span class="s1">'powershell'</span>
</code></pre></div></div>
<p>Of course, if you’re using Chef Solo, you’ll want to download your dependent cookbooks, too.</p>Michael HarenWhile working on some deployment stuff I ran into this error:My Top 9 Favorite Podcasts (Updated March 2013)2013-03-11T21:46:00+00:002013-03-11T21:46:00+00:00https://www.wassupy.com/2013/03/my-top-9-favorite-podcasts-updated<p>Although I sample a ridiculously large number of podcasts, these are the select few that I subscribe to and listen to regularly. I’ve presented them in order of “fewest unplayed episodes remaining” (which suggests how much I like each one). Again, simply being on this list means I’m a regular listener—don’t avoid the ones at the bottom—they are excellent.</p>
<ul>
<li><a href="http://www.freakonomics.com/tag/freakonomics-podcast/">Freakonomics Radio</a></li>
<li><a href="http://www.npr.org/templates/story/story.php?storyId=127413729">NPR: Planet Money Podcast</a></li>
<li><a href="http://www.thisamericanlife.org/">This American Life</a></li>
<li><a href="http://www.radiolab.org/series/podcasts/">WNYC’s Radiolab</a></li>
<li><a href="http://omegataupodcast.net/">Omega Tau</a> (available in English and German)</li>
<li><a href="http://www.stuffyoushouldknow.com/podcasts/">Stuff You Should Know</a></li>
<li><a href="http://themoth.org/radio">The Moth Podcast</a></li>
<li><a href="http://www.hanselminutes.com/">Hanselminutes</a></li>
<li><a href="http://www.theskepticsguide.org/">The Skeptics Guide to the Universe</a></li>
</ul>
<p>I was going to write a lengthy description/review for each but, let’s be honest, you weren’t going to read it. Just go listen to some of these!</p>Michael HarenAlthough I sample a ridiculously large number of podcasts, these are the select few that I subscribe to and listen to regularly. I’ve presented them in order of “fewest unplayed episodes remaining” (which suggests how much I like each one). Again, simply being on this list means I’m a regular listener—don’t avoid the ones at the bottom—they are excellent.