<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Neil Carpenter's Blog : General</title><link>http://blogs.technet.com/neilcar/archive/tags/General/default.aspx</link><description>Tags: General</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Rating Music (iTunes Edition)</title><link>http://blogs.technet.com/neilcar/archive/2007/08/15/rating-music-itunes-edition.aspx</link><pubDate>Wed, 15 Aug 2007 21:02:23 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1759500</guid><dc:creator>neilcar</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/neilcar/comments/1759500.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=1759500</wfw:commentRss><description>&lt;p&gt;I have a large collection of music, all of which is (finally) in iTunes.&amp;nbsp; I'd like to rate all of it but it's somewhat cumbersome to flip back and forth from whatever app I'm in to iTunes in order to click on the little star icons while I'm listening to music.&lt;/p&gt; &lt;p&gt;I was thinking about this the other day when I noticed that my keyboard has five "My Favorites" buttons at the top of it that I've never, ever used:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.microsoft.com/hardware/mouseandkeyboard/productdetails.aspx?pid=095" atomicselection="true"&gt;&lt;img src="http://www.microsoft.com/hardware/mouseandkeyboard/images/signature/MK_po_ned7k_detail_1.jpg"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I started thinking -- there are five star ratings in iTunes and there are five buttons, which seemed like a convenient coincidence.&lt;/p&gt; &lt;p&gt;ITunes can be scripted in Windows via&amp;nbsp;a COM object (see &lt;a href="http://www.microsoft.com/technet/scriptcenter/funzone/tunes.mspx"&gt;here&lt;/a&gt; for an excellent tutorial on it).&amp;nbsp; I figured I needed to do two things in script&amp;nbsp;-- find the currently playing song and change the rating on it.&lt;/p&gt; &lt;p&gt;To start with, I needed to instantiate the iTunes COM object:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;' Connect to iTunes app&lt;br&gt;Set iTunes = CreateObject("iTunes.Application")&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;After that, I get the currently playing song from the iTunes object:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;' Get the currently playing song&lt;br&gt;Set PlayingSong = iTunes.CurrentTrack&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Finally, set the rating on PlayingSong:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;' Set the rating of our song&lt;br&gt;PlayingSong.Rating = Rating&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;(Rating is being passed into the script as a command-line parameter) &lt;p&gt;I found that there were a few more things I needed to do to get this into useable shape.&amp;nbsp; First of all, if iTunes wasn't running, instantiating the COM object caused iTunes to start -- which was probably not the behavior I wanted.&amp;nbsp; So, I query WMI to make sure that iTunes is running before proceeding. &lt;p&gt;Second, when setting the rating, iTunes takes a value of 0-100 that represents&amp;nbsp;unrated (value==0) and the range of one star (value==20) through five starts (value==100).&amp;nbsp; So, I had to check the command line parameter to make sure it was between 1 and 5, then multiply the value by 20.&amp;nbsp;  &lt;p&gt;The entire script is at the end of this entry although, as with anything here, this is presented as sample code only.&amp;nbsp; Use it at your own risk -- I haven't tested it extensively and there are definitely cases that it misses. &lt;p&gt;Once I had the script done, all I had to do was to go to the settings for these buttons and to set the button to launch the script like this: &lt;blockquote&gt; &lt;p&gt;Button 1: "c:\scripts\iTunes Rating.vbs" 1&lt;br&gt;Button 2: "c:\scripts\iTunes Rating.vbs" 2&lt;br&gt;Button 3: "c:\scripts\iTunes Rating.vbs" 3&lt;br&gt;Button 4: "c:\scripts\iTunes Rating.vbs" 4&lt;br&gt;Button 5: "c:\scripts\iTunes Rating.vbs" 5&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Now, I can use the buttons to rate my music while I'm working on other things.&amp;nbsp;  &lt;p&gt;Entire sample script: &lt;blockquote&gt; &lt;p&gt;' iTunes Rating.vbs&lt;br&gt;' Sample Script for setting rating&lt;br&gt;' on currently playing song &lt;p&gt;' First, need to check if iTunes is running.&lt;br&gt;' Otherwise, it starts automatically when &lt;br&gt;' we create the COM object.  &lt;p&gt;Set objWMIService = GetObject("winmgmts:" _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp; "{impersonationLevel=impersonate}!\\" _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp; "." &amp;amp; "\root\cimv2")&lt;br&gt;Set colProcesses = objWMIService.ExecQuery( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Select * from Win32_Process " _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp; "Where Name = 'iTunes.exe'")  &lt;p&gt;If (colProcesses.Count &amp;gt; 0) Then  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' iTunes is running so let's do this  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim iTunes, PlayingSong, Rating  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Default to clearing the rating if no parameters&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' were passed  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rating = 0  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Do simple bounds checking on the parameter and&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' convert from star rating (0-5) to percentile (0-100)  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (Wscript.Arguments.Unnamed.Count = 1) _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; And (Wscript.Arguments.Unnamed.Item(0) _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;= 0) And (Wscript.Arguments.Unnamed.Item(0) _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;= 5) Then  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rating = Wscript.Arguments.Unnamed.Item(0) * 20  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Connect to iTunes app&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set iTunes = CreateObject("iTunes.Application")  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get the currently playing song&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set PlayingSong = iTunes.CurrentTrack  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Set the rating of our song&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlayingSong.Rating = Rating  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Done; release object&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set iTunes = nothing  &lt;p&gt;End If &lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1759500" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/General/default.aspx">General</category></item><item><title>Microlending</title><link>http://blogs.technet.com/neilcar/archive/2007/07/05/microlending.aspx</link><pubDate>Thu, 05 Jul 2007 21:50:30 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1447048</guid><dc:creator>neilcar</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/neilcar/comments/1447048.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=1447048</wfw:commentRss><description>&lt;p&gt;I commute about 90 minutes a day, total, on an average day.&amp;nbsp; I spend most of the commute listening to some combination of local talk radio (WBT 1100), NPR, Fox, and the BBC World Service.&amp;nbsp; I think of it as a sort of yin-yang radio diet.&lt;/p&gt; &lt;p&gt;Yesterday afternoon, Marketplace on NPR had &lt;a href="http://marketplace.publicradio.org/shows/2007/07/04/PM200707044.html" target="_blank"&gt;a fascinating segment&lt;/a&gt; on what they referred to, in the bumper, as 'peer-to-peer lending'.&amp;nbsp; I've seen several articles on microlending banks which provide small (generally less than $1k) loans to individuals with small businesses in the 3rd world so the concept wasn't new to me.&amp;nbsp; What was new was a website called &lt;a href="http://kiva.org" target="_blank"&gt;Kiva&lt;/a&gt; that allows you to become a microlender yourself.&lt;/p&gt; &lt;p&gt;On the website, you can find various loan applications from people all over the world (handled by regional microlending organizations) and, if you choose, fund part of the loans to those applicants.&amp;nbsp; You can also track the progress of loans that were made, including their repayment status and updates on their business.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I'm surrounded by technology all day long, but using a website to connect small businesses in impoverished areas with individual lenders really struck me.&amp;nbsp; &lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1447048" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/General/default.aspx">General</category></item><item><title>Reboot</title><link>http://blogs.technet.com/neilcar/archive/2007/06/27/reboot.aspx</link><pubDate>Wed, 27 Jun 2007 21:05:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1377733</guid><dc:creator>neilcar</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/neilcar/comments/1377733.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=1377733</wfw:commentRss><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I started blogging on MSDN back in 2004 with the best of intentions.&amp;nbsp; I was working with the Engineering Services team as 'the network guy' and I was involved in a lot of interesting cases working with our customers on deep networking issues, so I felt I had something to offer to the world at large.&lt;/P&gt;
&lt;P&gt;Shortly thereafter, I moved to the PSS Security Support Team here at Microsoft.&amp;nbsp; Without a doubt, this has been one of the most interesting jobs I've had at Microsoft but it also involved jumping in deep to&amp;nbsp;a set of new concepts and methodologies.&amp;nbsp; Needless to say, it's taken me awhile to absorb it all.&lt;/P&gt;
&lt;P&gt;Needless to say, the things I write about are going to be a bit different.&amp;nbsp; I'm currently an escalation engineer on my team, working across several different technologies including the Forefront products (particularly the server-oriented products formerly known as Antigen) and security incident response.&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1377733" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/General/default.aspx">General</category></item><item><title>Conversations</title><link>http://blogs.technet.com/neilcar/archive/2004/06/02/146919.aspx</link><pubDate>Wed, 02 Jun 2004 21:22:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:146919</guid><dc:creator>neilcar</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/neilcar/comments/146919.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=146919</wfw:commentRss><description>&lt;P&gt;&lt;A href="http://www.gapingvoid.com/"&gt;My favorite cartoonist &lt;/A&gt;wrote something that started me thinking...&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://www.gapingvoid.com/Moveable_Type/archives/000788.html"&gt;&amp;#8220;All products are conversations.&amp;#8221;&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;I suppose that, in terms of product support, this is self-evident.&amp;nbsp; Every product we ship results in a conversation with support.&lt;/P&gt;
&lt;P dir=ltr&gt;The exciting thing is that, for me, these conversations have changed drastically over the years.&amp;nbsp; When I started, most of the conversations I had were of the &amp;#8220;Why can't I get &lt;EM&gt;X&lt;/EM&gt; to work?&amp;#8221; category.&amp;nbsp; These conversations are self-contained, and can be frustrating.&amp;nbsp; In the context of this metaphor, these were very impersonal conversations.&lt;/P&gt;
&lt;P dir=ltr&gt;These days, the conversations I have are different.&amp;nbsp; They are usually focused on how our technologies can be used to support &amp;amp; extend the business of the folks I'm talking to.&amp;nbsp; The technologies are building blocks for my customers, and they use them to build anything they can imagine &amp;amp; spec.&amp;nbsp; Instead of impersonal conversations about self-contained issues, these conversations are partnerships (which, I see, I'm &lt;A href="http://weblogs.asp.net/jledgard/archive/2004/06/01/145820.aspx"&gt;not the only person thinking about&lt;/A&gt;...).&amp;nbsp; &lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=146919" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/General/default.aspx">General</category></item></channel></rss>