﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Just A Programmer</title>
	<atom:link href="http://www.justaprogrammer.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justaprogrammer.net</link>
	<description>We're Just Programmers...</description>
	<lastBuildDate>Fri, 04 May 2012 21:59:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>All Aboard #SQLAmtrak</title>
		<link>http://www.justaprogrammer.net/2012/04/27/all-aboard-sqlamtrak/</link>
		<comments>http://www.justaprogrammer.net/2012/04/27/all-aboard-sqlamtrak/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 00:45:14 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[#SQLAmtrak]]></category>
		<category><![CDATA[#sqlfamily]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[SQL Saturday 121]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1306</guid>
		<description><![CDATA[Update: I am proposing an earlier train. I have three announcements in this post. First of all, I&#8217;d like to announce that I will be speaking at SQL Saturday 121 in Malvern, PA, just outside of one of my favorite cities, Philadelphia. Secondly, I&#8217;d like to announce that I will be taking Amtrak there from [...]]]></description>
			<content:encoded><![CDATA[
<p><b>Update:</b> I am proposing an earlier train.</p>
<p>I have three announcements in this post. First of all, I&#8217;d like to announce that I will be speaking at <a href="http://www.sqlsaturday.com/121/eventhome.aspx">SQL Saturday 121 in Malvern, PA</a>, just outside of one of my favorite cities, Philadelphia. Secondly, I&#8217;d like to announce that I will be taking Amtrak there from <a href="http://en.wikipedia.org/wiki/Pennsylvania_Station_(Newark)">Newark Penn Station</a> in Newark, NJ. Finally, I&#8217;m inviting you all to join me in a little adventure I&#8217;d like to call <a href="https://twitter.com/#!/search/%23sqlamtrak">#SQLAmtrak</a>!</p>
<h2>Why #SQLAmtrak?</h2>
<p>Because I love traveling by rail, and I&#8217;m sure I&#8217;m not the only one! I enjoy flying, and long drives. However, Amtrak is my favorite way to travel. In fact, just this Tuesday and Thursday I took Amtrak from Newark to Philadelphia to speak at <a href="http://phillynj.net/">PhillyNJ.NET</a> and <a href="http://www.meetup.com/PhillyDB/events/55255962/">PhillyDB</a> respectively. Previously I&#8217;ve also taken Amtrak to DC for <a href="http://lanyrd.com/2010/mongodc/">MongoDC</a>, and in December I took the entire route of the <a href="http://www.amtrak.com/servlet/ContentServer?c=AM_Route_C&amp;pagename=am%2FLayout&amp;cid=1237608341980">California Zephyr</a> as part of a convoluted journey to <a href="http://www.10gen.com/events/mongosv-2011">MongoSV</a> and the first <a href="http://pt.wiki.mongodb.org/display/DOCS/MongoDB+Masters">MongoDB Masters</a> conference. (BTW, I&#8217;ve also taken Amtrak to non-nerdy things with my wife. I swear sometimes I pretend to be normal!)</p>
<p>When you love something this much you want to share it with the world! I want to share this experience with members of #SQLFamily, most of whom I only know through the internet, and many I&#8217;ve not ever met in virtually.  I know if we all spend an hour and a half on a train together, it will be a great social experience. BTW if you need a business justification, call it a networking experience.</p>
<h2>Ok, but how many people from Newark will be attending SQL Saturday 121?</h2>
<p>The answer might be zero, because I actually live in Jersey City. Seriously though, this Amtrak journey makes sense for several groups of people.</p>
<ul>
<li>If you live or work in New York City, the train stops at <a href="http://en.wikipedia.org/wiki/Pennsylvania_Station_(New_York_City)">New York Penn Station</a> before Newark</li>
<li>The train will also stop in Metro Park and Trenton, which are easily accessible from Central Jersey</li>
<li>If you work in the city of Philadelphia, you can join us for the last part of the journey from <a href="http://en.wikipedia.org/wiki/30th_Street_Station">Philadelphia 30th Street station</a> to <a href="http://en.wikipedia.org/wiki/Paoli_(SEPTA_station)">Paoli</a>.</li>
<li>Finally, if you are flying in, you can fly to <a href="http://en.wikipedia.org/wiki/Newark_Liberty_International_Airport">EWR</a>, you can take the New Jersey Transit one stop from Newark Airport to Newark Penn Station. Its quite likely that you can get a cheaper/faster/more direct flight from wherever you are coming to EWR as opposed to a Philadelphia airport.</li>
</ul>
<h2>What train are we taking?</h2>
<p>Originally I was proposing that we take <a href="Keystone Train 655">Amtrak Keystone Train</a> 655. Which gets to Paoli at 8:40pm. I am now suggesting train 651, which arrives at 6:02. The complete schedule for both trains is as follows:</p>
<table border="0" cellspacing="0">
<colgroup width="155"></colgroup>
<colgroup span="2" width="85"></colgroup>
<tbody>
<tr>
<td align="LEFT" height="18"><strong>Station</strong></td>
<td align="LEFT"><strong>Train 651 Departs</strong></td>
<td align="LEFT"><strong>Train 655 Departs</strong></td>
<td align="LEFT"><strong>Ticket Price</strong></td>
</tr>
<tr>
<td align="LEFT" height="18">NY Penn</td>
<td align="LEFT">4:03</td>
<td align="LEFT">6:35</td>
<td align="LEFT">$50</td>
</tr>
<tr>
<td align="LEFT" height="18">Newark</td>
<td align="LEFT">4:20</td>
<td align="LEFT">6:52</td>
<td align="LEFT">$49</td>
</tr>
<tr>
<td align="LEFT" height="18">EWR *</td>
<td align="LEFT">3:49</td>
<td align="LEFT">6:40</td>
<td align="LEFT">$63</td>
</tr>
<tr>
<td align="LEFT" height="18">Trenton</td>
<td align="LEFT">4:55</td>
<td align="LEFT">7:28</td>
<td align="LEFT">$32</td>
</tr>
<tr>
<td align="LEFT" height="18">Conrwells Heights</td>
<td align="LEFT">N/A</td>
<td align="LEFT">7:40</td>
<td align="LEFT"></td>
</tr>
<tr>
<td align="LEFT" height="18">North Philly</td>
<td align="LEFT">N/A</td>
<td align="LEFT">7:52</td>
<td align="LEFT"></td>
</tr>
<tr>
<td align="LEFT" height="18">30th Street Phil</td>
<td align="LEFT">5:35</td>
<td align="LEFT">8:00</td>
<td align="LEFT">$6.50</td>
</tr>
<tr>
<td align="LEFT" height="18">Ardmore</td>
<td align="LEFT">5:48</td>
<td align="LEFT">8:15</td>
<td align="LEFT"></td>
</tr>
<tr>
<td align="LEFT" height="18">Paoli</td>
<td align="LEFT">6:02</td>
<td align="LEFT">8:40</td>
<td align="LEFT"></td>
</tr>
</tbody>
</table>
<p><span style="font-size: xx-small;">* For those flying in, its $5.50 for an Air train ticket to the NJ transit station and $8.50 to take NJ Transit from EWR to Newark Penn. You can buy those tickets on arrival.</span></p>
<p>Note that you need to buy a ticket in advance if you will get on the train before 30th Street. Also, ticket prices go up the longer you wait. Finally, there is no business class available on this train. Even if there was, not everyone would want to spring for it, and the whole point of this is for the gathering to be social, so we will take coach.</p>
<h2>What if I get to Newark Penn early?</h2>
<p>People will want to fly in early, and will likely want to have a light meal and or drinks before departing. For those of us who will be departing from Newark, I am proposing we go to <a href="http://iberiarestaurants.com/">Iberia Restaurant</a> a short walk from Newark Penn in the <a href="http://en.wikipedia.org/wiki/Ironbound">Portuguese Ironbound</a> section of Newark, voted best Sangria in the Ironbound by my wife and I. Weather permitting there is outdoor seating, and the tapas are great.</p>
<h2>What do I have to do to take part?</h2>
<p>If you plan on going, email my at <strong>justin@ the domain of this blog</strong>. Everyone is responsible for buying their own train tickets. I&#8217;m going to hold off until Sunday May 6th (one week from today) before buying mine in case I get some feedback that other people would prefer a different time. Iberia doesn&#8217;t require reservations, so you don&#8217;t have to commit to going to the restaurant.</p>
<h2>What about the return trip?</h2>
<p>I&#8217;m open to the idea of a coordinated return trip. However, I don&#8217;t expect a good consensus to happen for that.</p>
<h2>How should I promote this?</h2>
<p>Blog/tweet/etc about this. Tell your friends! Use the hashtag <a href="https://twitter.com/#!/search/%23sqlamtrak">#SQLAmtrak</a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/04/27/all-aboard-sqlamtrak/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>PowerShell 3.0 [ordered] and MongoDB</title>
		<link>http://www.justaprogrammer.net/2012/04/19/powershell-3-0-ordered-and-mongodb/</link>
		<comments>http://www.justaprogrammer.net/2012/04/19/powershell-3-0-ordered-and-mongodb/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 02:02:16 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[PowerShell MongoDB]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1288</guid>
		<description><![CDATA[Recently, Shay Levy published a blog post about new features related to the Add-Member cmdlet in PowerShell 3.0. In it, one of the examples involved the use of [ordered]. The example, shown below is: The take home of this example was simple; using the @{} operator by itself created a System.Hashtable object, and the order [...]]]></description>
			<content:encoded><![CDATA[
<p>Recently, <a href="http://blogs.microsoft.co.il/blogs/scriptfanatic/">Shay Levy</a> published a <a href="http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2012/04/11/add-member-enhancements-in-powershell-3-0.aspx">blog post</a> about new features related to the <a href="http://technet.microsoft.com/en-us/library/dd347695.aspx">Add-Member</a> cmdlet in PowerShell 3.0. In it, one of the examples involved the use of [ordered]. The example, shown below is:</p>
<pre><pre class="brush: powershell; title: ; notranslate">PS&gt; $pso = New-Object -TypeName PSObject
PS&gt; $pso | Add-Member ([ordered]@{One=1; Two=2; Three=3}) -PassThru

One Two Three
--- --- -----
  1   2     3</pre></pre>
<p>The take home of this example was simple; using the @{} operator by itself created a System.Hashtable object, and the order of those keys are not guaranteed. Therefore not guaranteeing the order of the properties of the <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.psobject(v=vs.85).aspx">PSObject</a>. However we could use [ordered] to make it an &#8220;ordered hashtable&#8221; (Shay&#8217;s words). </p>
<p>So I spent some time looking for the MSDN documentation for OrderedHashtable. I never found it so I decided to fire up my Windows 8 VM and see what its type is.</p>
<pre><pre class="brush: powershell; title: ; notranslate">PS C:\Users\zippy&gt; [ordered]
Unable to find type [ordered]: make sure that the assembly containing this type is loaded.
At line:1 char:1
+ [ordered]
+ ~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (ordered:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound</pre></pre>
<p>Eventually, I figured out the problem is that [ordered] is not a type alias. I&#8217;m actually not exactly sure what it is, but <a href="http://stackoverflow.com/questions/10238698/what-is-the-proper-name-for-what-ordered-is-in-powershell-3-0">I&#8217;m pretty sure its not a type alias</a>. I did figure it it creates <a href="http://msdn.microsoft.com/en-us/library/system.collections.specialized.ordereddictionary.aspx">OrderedDictionaries</a>.</p>
<pre><pre class="brush: powershell; title: ; notranslate">    PS C:\Users\zippy&gt; ([ordered]@{}).GetType()

    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     True     OrderedDictionary                        System.Object</pre></pre>
<p>So I said to myself, &#8220;ok that&#8217;s cool, but can I cast from an OrderedDoctionary to a MongoDB.Bson.BsonDocument with the <a href="http://www.mongodb.org/display/DOCS/CSharp+Language+Center">MongoDB .NET driver</a>?&#8221; I say this because a while back I submitted some patches to improve the driver&#8217;s user experience in PowerShell. My main goal was to be able to use the HashTable notation to define a BsonDocument like so:</p>
<pre><pre class="brush: powershell; title: ; notranslate">[MongoDB.Bson.BsonDocument] $doc = @{
    &quot;_id&quot;= [MongoDB.Bson.ObjectId]::GenerateNewId();
    &quot;FirstName&quot;= &quot;Justin&quot;;
    &quot;LastName&quot;= &quot;Dearing&quot;;
    &quot;PhoneNumbers&quot;= [MongoDB.Bson.BsonDocument] @{
        'Home'= '718-555-1212';
        'Mobile'= '646-555-1212';
    };
};</pre></pre>
<p>The only problem with this notation is you cannot define the order of the keys. Luckily, I found that [Ordered] works flawlessly!</p>
<pre><pre class="brush: powershell; title: ; notranslate">[MongoDB.Bson.BsonDocument] $doc = [ordered]@{
    &quot;_id&quot;= [MongoDB.Bson.ObjectId]::GenerateNewId();
    &quot;FirstName&quot;= &quot;Justin&quot;;
    &quot;LastName&quot;= &quot;Dearing&quot;;
    &quot;PhoneNumbers&quot;= [MongoDB.Bson.BsonDocument] [ordered]@{
        'Home'= '718-555-1212';
        'Mobile'= '646-555-1212';
    };
};</pre></pre>
<p>I&#8217;ve updated the <a href="https://gist.github.com/854911">gist repo</a> for my post on <a href="http://www.justaprogrammer.net/tag/mongodb/">using MongoDB with PowerShell</a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/04/19/powershell-3-0-ordered-and-mongodb/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Advice for young aspiring IT workers</title>
		<link>http://www.justaprogrammer.net/2012/03/31/advice-for-young-aspiring-it-workers/</link>
		<comments>http://www.justaprogrammer.net/2012/03/31/advice-for-young-aspiring-it-workers/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 15:39:21 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1291</guid>
		<description><![CDATA[Today I got to address some 18 year old young men at the all-boys Catholic High School I attended at their career day about the IT field. It was a great experience for myself, and I think some of the students enjoyed it. My time was limited in addressing them, so I decided to write [...]]]></description>
			<content:encoded><![CDATA[
<p>Today I got to address some 18 year old young men at the all-boys Catholic High School I attended at their career day about the IT field. It was a great experience for myself, and I think some of the students enjoyed it. My time was limited in addressing them, so I decided to write this blog post of advice for young people. Some of this advice was in my talk, and some wasn&#8217;t. Also, while I&#8217;m a big proponent of Women In Technology (WIT), I did not get to address any young ladies since my high school&#8217;s studen body is all male. Therefore, I hope someone will make their daughter read this.</p>
<p>One thing I touched on pretty well in my talk was lifestyle choices. In IT you can work in a city or a suburban setting. You can work for yourself, or you can work for a company. You can work for small companies or large companies. Some jobs will let you go home at 5:01, and others (like video game development) will have you working 90 hour weeks.</p>
<p>This leads to several related peices of advice. The first is of course to take advantage of this by considering these factors when applying to and accepting jobs. The second, somewhat contradictory advice is try to work in several different types of work environments when you&#8217;re young and single. Finally te third is try to be your own boss when you are young.</p>
<p>The first peice of advice is pretty self explanatory, but it bears emphasis. To often people worry about salary, and foget about what brings happiness and fufillment. Its easy to get chained to a pair of golden handcuffs. Money is important, but happiness and fufillment are the ends. Money is just one of the means.</p>
<p>The second peice of advice contradicts the first because to work in a lot of different places, I&#8217;m suggesting you take jobs where your not comfortable in the environment. However, its for the learning experience. Sometimes you need to know what you like. I always used to think I was a large company person. I now know that I actually like dealing with a medium sized number of people. I know this from working in places to big for my taste where I had to work with people that I could not build interpersonal relationships with due to the infrequent nature of our interactions. I&#8217;m now happier in smaller setting because I don&#8217;t feel a longing to work at a really big company.</p>
<p>The third peice of advice is to start your own company when your young. Because I did this I know I don&#8217;t like being my own boss. Most small business owners love owning their own company. Some think everyone should own their own company. However, that view is very myopic. Some people are happier with their responsibilities boiled down to a narrow set of tasks, with a steady paycheck for a reward. I am one of those people. You might not be one too.</p>
<p>Another thing I talked about was how to learn outside of school. The two aspects of this I addressed is being self motivated to learn, and contributing to open source projects. A third aspect I&#8217;d like to talk here is finding and being involved in online communities.</p>
<p>One thing that attracted me to IT is the lack of formal barriers of entry. Some people do not like this about the field. Regardless, thats the nature of the game. Since there are no license requirements for IT, there are no continuing education requirements. In regulated fields like law and medicine, there are continuing education requirements. Just like a high school student will learn as a result of doing what his or her teacher requires of him, someone in a licensed field will do the minimum to keep abrest of advances in their field by fufilling their legally mandated licence requirements. In IT this does not happen. Some companies pay for training. Few will ever mandate it. The drive to adopt new technologies in many organizations is usually bottom up not top down. When I decided to learn Windows PowerShell, no one told me to. My boss didn&#8217;t ask me. My coworkers weren&#8217;t using it. I decided to learn a new scripting technology to work more effeciently. I introduced it to coworkers.</p>
<p>One way you can keep up your skills is by contributing to open source projects. Contributing to open source gives you an opportunity to do work that others will benifit from outside of a commercial setting. Its something good to put on your resume. Also, many successful open source projects have pretty strict submission guidelines. The feedback you get from a rejected contribution can make you a better coder.</p>
<p>In addition to being involved in open source, get involoved in online communities. Read blog articles and comment on blog articles. (Nothing makes a blogger happy then feedback!) Write your own blog. Ask and answer questions on <a href="http://stackoverflow.com">stackoverflow.com</a>, <a href="http://serverfault.com">serverfault.com</a>, and <a href="http://serverfault.com">superuser.com</a>. Create a <a href="http://twitter.com">twitter</a> account and follow tech bloggers on twitter. These things will help you grow, and to learn what new trends and technologies are out there, so you know what to learn about next.</p>
<p>In conclusion, I have one last piece of advice. Try to cross train outside of your intended specialization. If you are a programmer that doesn&#8217;t understand system administration, you will probably write code that is hard to deploy and maintain by the sysadmins that will do it. If you are a sysadmin that never programmed, you will probably have a hard time using scripting to automate tasks.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/03/31/advice-for-young-aspiring-it-workers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some 64 bit Farmanager plugin links</title>
		<link>http://www.justaprogrammer.net/2012/03/27/some-64-bit-farmanager-plugin-links/</link>
		<comments>http://www.justaprogrammer.net/2012/03/27/some-64-bit-farmanager-plugin-links/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 01:29:45 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[farmanager]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1286</guid>
		<description><![CDATA[I&#8217;ve previously written about my love of FAR, the File and ARchive manager. One of its greatest strengths is all the plugins written for it. However, some of the most popular plugins are no longer maintained (because they just work), and were not ported to 64 bit. Luckily, this is becoming less and less of [...]]]></description>
			<content:encoded><![CDATA[
<p>I&#8217;ve <a href="http://www.justaprogrammer.net/2010/06/21/my-new-favorite-tool-the-far-file-manager/">previously written</a> about my love of <a href="http://farmanager.com">FAR, the <u>F</u>ile and <u>AR</u>chive manager</a>. One of its greatest strengths is all the plugins written for it. However, some of the most popular plugins are no longer maintained (because they just work), and were not ported to 64 bit. Luckily, this is becoming less and less of an issue.</p>
<p>I have therefore compiled this short list of sites with 64-bit FarManager plugins:</p>
<ul>
<li><a href="http://code.google.com/p/evil-programmers/downloads/list">Evil Programmers</a> is a google code project with 64 bit builds of plugins. Most of the downloads only include</li>
<li><a href="http://code.google.com/p/andrew-grechkin/downloads/list">Andrew Grechkin&#8217;s plugins</a>. The only one I&#8217;ve actually used is the service manager plugin. This site also has plugins for FarManager 3.</li>
<li><a href="https://github.com/michaellukashov/Far-NetBox">NexBox</a> This is a fork of the WinSCP plugin for Far. Unlike the original version, there is a 64-bit build of this.</li>
<li><a href="http://code.google.com/p/farplug/">FarPlug Google Code Project</a> This has three plugins currently. The first is the arclight plugin that allows far to manipulate zip, 7z, rar and other archive formats. The second allows you to view the contents of movile device docked with ActiveSync, and the third lets you view information about NTFS file systems.</li>
<ul>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/03/27/some-64-bit-farmanager-plugin-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using PowerShell to call a WCF service</title>
		<link>http://www.justaprogrammer.net/2012/02/11/using-powershell-to-call-a-wcf-service/</link>
		<comments>http://www.justaprogrammer.net/2012/02/11/using-powershell-to-call-a-wcf-service/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 23:13:34 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1255</guid>
		<description><![CDATA[PowerShell lets you create web service proxies from WSDLs via the New-WebServiceProxy cmdlet. However, it only works for SOAP web services running on HTTP endpoints. If you have a WCF service using only non http protocols, such as NetTcp, you cannot use New-WebServiceProxy. Now, I&#8217;ve created and consumed my fair share of web services. So [...]]]></description>
			<content:encoded><![CDATA[
<p>PowerShell lets you create web service proxies from WSDLs via the <a href="http://technet.microsoft.com/en-us/library/dd315258.aspx">New-WebServiceProxy</a> cmdlet. However, it only works for SOAP web services running on HTTP endpoints. If you have a WCF service using only non http protocols, such as <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.nettcpbinding.aspx">NetTcp</a>, you cannot use New-WebServiceProxy.</p>
<p>Now, I&#8217;ve created and consumed my fair share of web services. So when I began to use PowerShell, I quickly figured out this unfortunate fact. I always knew that I could make use of WCF API to generate the proxies, but I never bothered to figure out how. The annoyance was pretty academic to me. At some point I event told someone on stackoverflow that <a href="http://stackoverflow.com/a/7681386/95195">it can&#8217;t be done</a>.</p>
<p>Then on Friday, I accidentally discovered that a Sharepoint MVP by the name of <a href="http://www.ilovesharepoint.com/">Christian Glessner</a> solved this problem in 2008 while visiting the excellent site <a href="http://poshcode.org">poshcode.org</a>. Christian explains <a href="http://www.ilovesharepoint.com/2008/12/call-wcf-services-with-powershell.html">his solution in detail on his blog</a>.</p>
<p>His solution was a very elegant PowerShell 1.0 solution. However, I felt it could be improved by adding some PowerShell 2.0 features such as parameter collections. I also was really intrigued and wanted to dig into his solution. He <a href="http://www.ilovesharepoint.com/2008/12/call-wcf-services-with-powershell.html?showComment=1328948458410#c8849419888666968020">was supportive</a> of my <a href="http://poshcode.org/3224">initial modifications</a> so I put the <a href="https://github.com/justaprogrammer/PowerShellWCF">git repo</a> of my changes on the <a href="https://github.com/justaprogrammer/PowerShellWCF">justaprogrammer github organization</a>.</p>
<h3>Using my version</h3>
<p>My version of the script creates three functions:<br />
<code></p>
<ul>
<li>Get-WsdlImporter</li>
<li>Get-WcfProxyType</li>
<li>Get-WcfProxy</li>
</ul>
<p></code></p>
<p>The function that is most analogous to New-WebServiceProxy is Get-WcfProxy. I kept the name from Christian&#8217;s version of the code, despite the fact that New-WcfProxy would be more appropriate. In Christian&#8217;s version of the code, <code>Get-WcfProxy</code> only returned a <a href="http://msdn.microsoft.com/en-us/library/system.type.aspx">System.Type</a> of the generated proxy, not an instance of it. I renamed that to <code>Get-WcfProxyType</code>. Finally. Get-WsdlImporter takes a <a href="http://www.w3.org/TR/wsdl">wsdl</a> or mex endpoint and returns an instance of a <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.wsdlimporter.aspx">System.ServiceModel.Description.WsdlImporter</a> that represents that metadata.</p>
<p>By default <code>Get-WsdlImporter</code> tries to generate the WsdlImporter via metadata exchange, but it can parse a wsdl with the <code>-HttpGet</code> switch. Below  are some examples illustrating its usage:</p>
<pre><pre class="brush: powershell; title: ; notranslate">$wsdlImporter = Get-WsdlImporter 'http://localhost:14232/EchoService.svc/mex' # Mex endpoint
Get-WsdlImporter 'http://localhost:14232/EchoService.svc' -HttpGet # WDSL endpoint
Get-WsdlImporter 'http://localhost:14232/EchoService.svc?wsdl' -HttpGet # WSD: endpoint </pre></pre>
<p>I don&#8217;t see much point for calling <code>Get-WcfProxyType</code> directly so I will not illustrate how to use it here. <code>Get-WcfProxy</code> is the function you want to call. Its main parameter is either a url or a WsdlImporter. You can either let <code>Get-WcfProxy</code> pick the first endpoint it finds in the WsdlImporter, or specify an endpoint and url you want to use as parameters as illustrated below:. </p>
<pre><pre class="brush: powershell; title: ; notranslate">$wsdlImporter = Get-WsdlImporter &quot;http://localhost:14232/EchoService.svc/mex&quot;
$proxy = Get-WcfProxy $wsdlImporter # using a WsdlImporter object
$proxy = Get-WcfProxy &quot;http://$($hostname):14232/EchoService.svc/mex&quot; # using a url
$proxy = Get-WcfProxy $wsdlImporter &quot;http://localhost:14232/EchoService.svc/WCF&quot; (New-Object System.ServiceModel.WSHttpBinding) # using a WsdlImporter and specifying the endpoint and binding.
$proxy = Get-WcfProxy 'net.tcp://localhost:8732/EchoService/mex' 'net.tcp://localhost:8732/EchoService/' (New-Object System.ServiceModel.NetTcpBinding) # using a metadata url and specifying the endpoint and binding.
$proxy.Echo(&quot;Justin Dearing&quot;); # calling a service function</pre></pre>
<p>As you might have guessed from my examples I used the <a href="https://github.com/justaprogrammer/EchoService">justaprogrammer EchoService</a> in my tests.</p>
<h3>The code itself</h3>
<p>I recommend you refer to the <a href="https://github.com/justaprogrammer/PowerShellWCF/">github repo</a> for the latest version of the code. However, the version I used here is posted on poshcode.org and embedded below.</p>
<p><script type="text/javascript" src="http://PoshCode.org/embed/3230"></script></p>
<h3>Future directions</h3>
<p>My fork is released under the MIT license and I&#8217;d be happy to review patches and consider bug reports and feature requests.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/02/11/using-powershell-to-call-a-wcf-service/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using PowerShell to represent Base 26 as the uppercase English Alphabet</title>
		<link>http://www.justaprogrammer.net/2012/01/09/using-powershell-to-represent-base-26-as-the-uppercase-english-alphabet/</link>
		<comments>http://www.justaprogrammer.net/2012/01/09/using-powershell-to-represent-base-26-as-the-uppercase-english-alphabet/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 03:59:18 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[Algorithims]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1214</guid>
		<description><![CDATA[Today I was asked to do something that seemed simple, until I actually had to do it. A coworker had a database with two fields he wanted renamed in a specific way. For our example, lets call them ProductNumber and ProductName. He wanted ProductNumber to be sequential (1, 2, 3 . . .) and the [...]]]></description>
			<content:encoded><![CDATA[
<p>Today I was asked to do something that seemed simple, until I actually had to do it. A coworker had a database with two fields he wanted renamed in a specific way. For our example, lets call them ProductNumber and ProductName. He wanted ProductNumber to be sequential (1, 2, 3 . . .) and the ProductName fields to be called &#8220;Product A&#8221;, &#8220;Product B&#8221; . . . &#8220;Product Z&#8221;, &#8220;Product AA&#8221; etc. So this suddenly became a non-trivial problem if you had more than 26 rows, which of course I did.</p>
<p>So I rolled up my sleeve, got a fresh cup of coffee, and got to work. Populating ProductNumber was easy enough using a <a href="http://msdn.microsoft.com/en-us/library/ms190766.aspx">Common Table Expression (CTE)</a> with a <a href="http://msdn.microsoft.com/en-us/library/ms186734.aspx">ROW_NUMBER()</a>. Then I realized I could think of the English alphabet as symbols for a base 26 number system, with AA following Z and so on. The only problem was I couldn&#8217;t express that in a set based way for a clean T-SQL implementation. No problem, I&#8217;d just generate the T-SQL to make a giant mapping table in PowerShell!</p>
<p>I am ashamed to admit I had to look up the algorithim for converting from base 10 to another number. I was also surprised to discover that the first result google returned me was <a href="http://rachel5nj.tripod.com/NOTC/cb2.html">this tripod page</a>.</p>
<p>The algorithm is as follows.</p>
<ol>
<li>Start with an empty string which becomes the return value</li>
<li>While the value is greater than the base get the remainder of the value divided by the base. Convert that to its letter and prepend that to the return value</li>
<li>Repeat step 2 with the quotient of the value over the base.</li>
<li>When the quotient is less than the base, prepend that to the string instead.</li>
</ol>
<p>It seemed simple enough, but there were some headaches.</p>
<p>The first thing I discovered was that when you divide integers in PowerShell, you get a float as a result. Also casting it back to an int rounds instead of truncating the results. I was expecting the opposite in both cases, because that is how C# behaves. I ended up using the unwieldy combination of <a href="http://msdn.microsoft.com/en-us/library/e0b5f0xb.aspx">Math.Floor()</a> and a cast in the form <code>[int][math]::Floor($currVal / 26)</code> to resolve this. The MSDN technet has <a href="http://technet.microsoft.com/en-us/library/ee176879.aspx">an article</a> that recommends the more unwieldy <code>[Math]::floor([int] $currVal / [int] 26)</code>, but I <a href="https://gist.github.com/1586729">proved</a> that my terser method gives the same results.</p>
<p>Then I had problems with how to display powers of 26. The way it was supposed to work was that 1 = A, 24 = X, 25 = Y, 26 = Z and 27 = AA. However, depending on how I did it I ended up with 26 = AZ or 27 = BA. I could not account for this edge case, nor compensate for it with special conditions.</p>
<p>Then it dawned on me, A needed to be equal to zero not one. A base 10 system deals with the digits 0-9. Base 2 deals with 0 and 1. Base 16 deals with 0-F and F is 15. Once I rewrote my script to work that way, edge cases disappeared, and things just worked.</p>
<h3>The script</h3>
<pre><pre class="brush: powershell; title: ; notranslate">
	function Convert-ToLetters ([parameter(Mandatory=$true,ValueFromPipeline=$true)][int] $value)  {
		$currVal = $value;
		$returnVal = '';
		while ($currVal -ge 26) {
			$returnVal = [char](($currVal) % 26 + 65) + $returnVal;
			$currVal =  [int][math]::Floor($currVal / 26)
		}
		$returnVal = [char](($currVal) + 64) + $returnVal;

		return $returnVal
	}
</pre></pre>
<p>If its not clear how I generated upper case letters, the <a href="http://www.asciitable.com/">ASCII codes</a> for A through Z are 65 through 90, and casting an integer to a char converts it to its ASCII code. Ergo, the expression <code>[char]65</code> evaluates to &#8220;A&#8221;.</p>
<p>So now here&#8217;s the function in action:</p>
<pre><pre class="brush: powershell; title: ; notranslate">1 .. 100 | ForEach-Object {
	$_ | Convert-ToLetters
}</pre>
</pre>
<p>Happy Scripting!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/01/09/using-powershell-to-represent-base-26-as-the-uppercase-english-alphabet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Making an RDP connection to a server you just rebooted with powershell</title>
		<link>http://www.justaprogrammer.net/2012/01/07/making-an-rdp-connection-to-a-server-you-just-rebooted-with-powershell/</link>
		<comments>http://www.justaprogrammer.net/2012/01/07/making-an-rdp-connection-to-a-server-you-just-rebooted-with-powershell/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 01:35:50 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Remote Desktop]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1194</guid>
		<description><![CDATA[It&#8217;s an all to familiar story. You  need to reboot a server, and then you need to start a remote desktop connection into it. So what do you do? You open up a command prompt, type ping -t &#60;HOSTNAME&#62; and wait until the server responds to pings. When that happens, you keep trying to connect via remote [...]]]></description>
			<content:encoded><![CDATA[
<p>It&#8217;s an all to familiar story. You  need to reboot a server, and then you need to start a remote desktop connection into it. So what do you do? You open up a command prompt, type <code>ping -t &lt;HOSTNAME&gt;</code> and wait until the server responds to pings. When that happens, you keep trying to connect via remote desktop, until it works. There&#8217;s got to be an easier way. You should write a PowerShell script to automate the process. However, its one of those things that not quite annoying enough to get you to actually take action and write the script. Luckily, thanks to the power of twitter, I reached a tipping point this week, and wrote the script. It all started out with some innocent whining:</p>
<style type="text/css">.ditto155068373691150337{background: #C0DEED url(http://a0.twimg.com/images/themes/theme1/bg.png) no-repeat;padding: 20px;} .ditto155068373691150337 a { color: #0084B4;} p.dittoTweet{background: #fff;padding: 10px 12px 10px 50px;margin: 0;min-height: 48px;color: #000;font-size: 18px !important;line-height: 22px;-moz-border-radius: 5px;-webkit-border-radius: 5px;} p.dittoTweet span.metadata {display: block;width: 100%;clear: both;margin-top: 8px;padding-top: 12px;height: 65px;} p.dittoTweet span.metadata span.author {line-height: 22px;color: #666;font-family: Arial, Helvetica, sans-serif;} .mainlink {font-family: Arial, Helvetica, sans-serif;font-size: 26px;color: #1F98C7;text-decoration: none;} .mainlink: hover {color: #1F98C7;text-decoration: underline;} .tweet {font-size: 24px;} p.dittoTweet span.metadata span.author img {float: left; margin: 0px 7px 0px 0px;} p.dittoTweet a:hover {text-decoration: underline;} p.dittoTweet span.timestamp {font-size: 12px;display: block;color: #999;} p.dittoTweet span.timestamp a {color: #999;text-decoration: none;}</style>
<div class="ditto155068373691150337">
<p class="dittoTweet"><span class="metadata"><span class="author"><a href="http://twitter.com/zippy1981"><img src="http://a3.twimg.com/profile_images/1672673440/Gravatar_normal.png"/></a><strong><a href="http://twitter.com/zippy1981" class="mainlink">@zippy1981</a></strong><br />Justin Dearing</span></span>You know what I need in an RDP client. I need an &#8220;&#8221;I just rebooted so ping it for me and autoreconnect&#8221;.<span class="timestamp"><a href="http://www.twitter.com"><img src="http://images.ientrymail.com/socialditto/twitter-bird.png" border="0" align="absmiddle" /></a> <a href="http://twitter.com/#!/zippy1981/status/155068373691150337" title="Thu Jan 05 23:29:15 +0000 2012">2 days ago</a>  via web&nbsp;&middot;&nbsp;powered by <a href="http://www.socialditto.com">@socialditto</a></span></p>
</div>
<p>Then <a href="https://twitter.com/#!/d0tk0m">d0tk0m</a> and <a href="https://twitter.com/#!/YanniRobel/status/155069020763201536">Yanni Robel</a> retweeted my whining. They say necessity is the mother of invention. In this case the commiseration off two tweeps was the father. So I spent a Saturday with PowerGUI, and came up with a script to solve the problem.</p>
<h3>Planing stage</h3>
<p>I wanted my script to automate what I already did. From the perspective a system administrator that wants to reboot a server and then remote desktop into it, the following happens.</p>
<ol>
<li>All the processes, including the remote desktop service (termsrv.dll) are shut down. When that happens the remote desktop port (default 3389) no longer has anything listening on it.</li>
<li>Eventually the network adapter is shutdown and it will stop responding to <a href="http://en.wikipedia.org/wiki/Ping">ICMP echo requests, or pings</a>.</li>
<li>The server will finish shutting down, the BIOS will <a href="http://en.wikipedia.org/wiki/Power-on_self-test">POST</a>, and Windows will begin booting</li>
<li>Eventually the network adapter will come up and start responding to pings.</li>
<li>The remote desktop service will start and bind to the remote desktop port.</li>
</ol>
<p>Therefore, I made my script to do the following.</p>
<ol>
<li>Ping the server until it answered five successive ping requests. Yes this might be naive and optimistic in many cases. However, it worked in my use case. I used the <a href="http://msdn.microsoft.com/en-us/library/7hzczzed.aspx">Send()</a> method of the .NET <a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx">System.Net.NetworkInformation.Ping</a> class to do this.</li>
<li>Once I was sure the host was up, I&#8217;d try to connect to it on port 3389, or another port if I passed a different port as a parameter. To do this I used the <a href="http://msdn.microsoft.com/en-us/library/System.Net.Sockets.TcpClient.aspx">System.Net.Sockets.TcpClient</a> class.</li>
<li>After this it was simply a matter of passing the right parameters to the remote desktop client, <a href="http://technet.microsoft.com/en-us/library/cc753907(WS.10).aspx">mstsc.exe</a>. I initially attempted to use the simple <code>&#038; mstsc &lt;Arguments&gt;</code>. However, that didn&#8217;t work to well so I ended up resorting to <a href="http://technet.microsoft.com/en-us/library/dd347550.aspx">Invoke-Expression</a>.</li>
</ol>
<h3>The script</h3>
<p>Below is the current version of the script, hosted on <a href="http://poshcode.org">poshcode.org</a>. The current version is stored in <a href="https://bitly.com/mstsc-Ac">gist repository</a>. While you are free to post changes to poshcode.org (or anywhere), in accordance  with the license, I&#8217;d prefer if you notified me of any changes so that they may be placed in the gist git repo.</p>
<p><script type="text/javascript" src="http://PoshCode.org/embed/3154"></script></p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2012/01/07/making-an-rdp-connection-to-a-server-you-just-rebooted-with-powershell/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>What #SQLFamily means to me.</title>
		<link>http://www.justaprogrammer.net/2011/12/28/what-sqlfamily-means-to-me/</link>
		<comments>http://www.justaprogrammer.net/2011/12/28/what-sqlfamily-means-to-me/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 02:25:02 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[#sqlfamily]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1183</guid>
		<description><![CDATA[Warning folks, this is a non-technical post. Recently, a post on the official SQL Server blog stated that for each of the first 400 &#8220;what #SQLFamily means to me&#8221; stories submitted to sqlfamilysubmission@live.com, $50 would be donated to The Pragmatic Works Foundation to train veterans in IT skills. I just submitted my entry, which I have reproduced [...]]]></description>
			<content:encoded><![CDATA[
<p>Warning folks, this is a non-technical post.</p>
<p>Recently, <a href="http://blogs.technet.com/b/dataplatforminsider/archive/2011/12/08/help-the-sqlfamily-give-back.aspx">a post</a> on <a href="http://blogs.technet.com/b/dataplatforminsider/">the official SQL Server blog</a> stated that for each of the first 400 &#8220;what #SQLFamily means to me&#8221; stories submitted to <a href="mailto:sqlfamilysubmission@live.com">sqlfamilysubmission@live.com</a>, $50 would be donated to <a href="http://pragmaticworks.com/foundation/">The Pragmatic Works Foundation</a> to train veterans in IT skills. I just submitted my entry, which I have reproduced below.</p>
<p>My name is Justin Dearing, and I have worked in various capacities in the IT industry since December 2002. This is my #SQLFamily story. it is a story of learning my manners and receiving forgiveness.</p>
<blockquote>
<div><a href="https://twitter.com/paulrandal">Paul Randal</a> and <a href="https://twitter.com/#!/KimberlyLTripp">Kimberly Tripp</a> recently decided to increase the community marketing of their <a href="http://sqlskills.com/">SQLSkills</a> consulting company. They offered to send anyone a SQLSkills sticker that sent them a mailing address. I decided to sign up for this. I was a bit surprised there was no automated form, and that I had to send this request in prose via email. <a href="http://sqlskills.us2.list-manage1.com/subscribe?u=729526cc5ec7737666e0a1893&amp;id=d509eaaebc">Note that there is now a web form for this.</a>.</div>
<div></div>
<div>Well I did not say please or thank you, or generally acknowledge that a fellow homo sapien would be receiving the request at the end. Well, a very unique and talented homo sapien that I respect very much (Paul Randal himself) did indeed read my response, and sent the following twitter message:</div>
<div><a href="https://twitter.com/#!/PaulRandal/status/57592320060686336"><em>Amazing number of people that sign up for our mailing list and ask for sticker without please or thank you at all. Internet = no manners <img src='http://www.justaprogrammer.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </em></a></div>
<div>I hung my head in shame for about a week while fretting over what to do because I knew right away I was the offender. Eventually I decided to simply send an email to Paul saying I realized I was the one that offended him and apologizing. He accepted the apology and sent me the sticker. Like a functional family, when forgiveness was sought it was quickly given, the incident was forgotten, and I&#8217;d like to think I&#8217;ve been a little more polite and considerate both on and off the internet as a result.</div>
</blockquote>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2011/12/28/what-sqlfamily-means-to-me/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>EZ-Pass Data Integrity and security fail</title>
		<link>http://www.justaprogrammer.net/2011/11/26/ez-pass-data-integrity-and-security-fail/</link>
		<comments>http://www.justaprogrammer.net/2011/11/26/ez-pass-data-integrity-and-security-fail/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 00:39:14 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>
		<category><![CDATA[EZ-Pass]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1163</guid>
		<description><![CDATA[On October 29th 2011, I entered an EZ-Pass lane of the Brooklyn Battery Tunnel toll plaza and, to make a long story short, learned my EZ-Pass was broken. On November 19th 2011, I went to the Newark, NJ EZ-Pass Customer Service Center to rectify the matter. I was given another external EZ-Pass tag, and told it would [...]]]></description>
			<content:encoded><![CDATA[
<p>On October 29th 2011, I entered an <a href="http://en.wikipedia.org/wiki/E-ZPass">EZ-Pass</a> lane of the <a href="http://www.mta.info/bandt/html/bbt.html">Brooklyn Battery Tunnel</a> toll plaza and, to make a long story short, learned my EZ-Pass was broken. On November 19th 2011, I went to the <a href="http://www.yelp.com/biz/nj-ez-pass-newark">Newark, NJ EZ-Pass Customer Service Center</a> to rectify the matter. I was given another external EZ-Pass tag, and told it would cost me $33 dollars. I was not asked for payment, and assumed it would come  out of my account. I went out, mounted the new EZ-Pass tag to my front licence plate (with the old screws, because the new screws were one way security screws) and went on my merry way (through several tollbooths). That&#8217;s when the real fun began.</p>
<p>My old EZ-Pass would not be detected by a toll lane at all. It had developed a crack, and I assume the circuitry malfunctioned. The new one on the other hand caused the toll booths to say  &#8221;toll unpaid call EZ-Pass.&#8221; I assumed at the time it would take a while for the tag to be associated with my account. This assumption was supported by the fact that he woman at the service center wrote the serial number of my tag on a <strong>paper form</strong>. This form incidently stated it was for accounting of the internal tags only. I assumed that the process of associating tags with accounts was not instantaneous.</p>
<p>Then November 24th came around, and I needed to travel to participate in not one, but two feasts of slaughtered turkeys for an American Holiday called Thanksgiving. My tag failed to work. Obviously something was amiss, and I took action on <a href="http://en.wikipedia.org/wiki/Personally_identifiable_information">Black Friday</a>. I logged into my account and only saw the old tag number. So I went to my car, got my new tag number off my tag, and called EZ-Pass. While I was waiting to talk to someone I made a horrible discovery.</p>
<p>So let&#8217;s backup here a little, because this is my second horrible EZ-Pass discovery. Before I got my new EZ-Pass tag, I only interacted with EZ-Pass via the EZ-Pass NJ website. To log into the site, you need either your account number or your tag number, and a pin. The pin is an all numeric password. I will come out and make the confession that at the time I made it, its was the same as my ATM pin. That is no longer my ATM pin, because this was years ago.</p>
<p>So I shared passwords across accounts, but that&#8217;s not a discovery. I always knew this. The discovery was this. When I was at the customer service center, I was asked for my pin to verify my account. I gave it to the woman, and she did not type it into her computer. She looked at her screen to make sure what I said matched what was displayed. So pins are stored unencrypted. Mind you, an EZ-Pass account contains a lot of <a href="http://en.wikipedia.org/wiki/Personally_identifiable_information">personally identifiable information (PII)</a>. In addition to credit card numbers and your address, it contains license plate numbers, and places you&#8217;ve been. With this discovery, it seems that a lot of low paid clerks, living in the same state as the tag holder can access this information with just a persons name. Remind me never to anger an EZ-Pass employee.</p>
<p>Ok so that&#8217;s terrible, but hardly worth writing a blog post about. I mean I&#8217;ve seen plenty of data security sins of that caliber, none of which have inspired a written tirade. However, something sent me over the top here.</p>
<p>So what sent me over the top you might ask? Well when I first logged in I used my old tag number, because that&#8217;s the number I know and use to log in to my account. However, while waiting on hold, I said to myself, &#8220;let me use the new tag number and my pin to log in.&#8221; I did this and I saw not my account,  but the account of a complete stranger. I explain the situation to the person on the phone and the outcome is I have to mail in both tags (at my own cost), and a new tag will be sent to me (at which point I will be charged $33). There is no record of my original visit to the EZ-Pass center. I have a feeling if they look hard enough in the other person&#8217;s account, they will find it. I&#8217;d like to know what transpired while the guy put me on hold.</p>
<p>I will likely have a lot of headaches to sort out once this is all said and done. I regret not writing down the name of the person whose account my second tag was assigned to, or the name of the clerk in Newark or phone operator I dealt with.  If there are any further developments, I&#8217;ll report them here.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2011/11/26/ez-pass-data-integrity-and-security-fail/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Editing elements with periods in the name in PowerShell</title>
		<link>http://www.justaprogrammer.net/2011/11/06/editing-elements-with-periods-in-the-name-in-powershell/</link>
		<comments>http://www.justaprogrammer.net/2011/11/06/editing-elements-with-periods-in-the-name-in-powershell/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 01:59:18 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Just A Programmer]]></category>

		<guid isPermaLink="false">http://www.justaprogrammer.net/?p=1150</guid>
		<description><![CDATA[Recently, a coworker asked me about a problem he was having with a PowerShell script that edited an app.config file. It was a simple enough fix for an experienced PowerShell programmer, but worth sharing the solution for those not as experienced. For this article, I&#8217;ll use a very small example web.config that demonstrates the problem. [...]]]></description>
			<content:encoded><![CDATA[
<p>Recently, a coworker asked me about a problem he was having with a PowerShell script that edited an app.config file. It was a simple enough fix for an experienced PowerShell programmer, but worth sharing the solution for those not as experienced.</p>
<p>For this article, I&#8217;ll use a very small example web.config that demonstrates the problem.</p>
<pre><pre class="brush: xml; title: ; notranslate">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;configuration&gt;
  &lt;appSettings&gt;
    &lt;add key=&quot;verbose&quot; value=&quot;true&quot;/&gt;
  &lt;/appSettings&gt;
  &lt;system.web&gt;
    &lt;compilation debug=&quot;true&quot; /&gt;
  &lt;/system.web&gt;
&lt;/configuration&gt;</pre></pre>
<p>The script my coworker was using worked something like this:</p>
<pre><pre class="brush: powershell; title: ; notranslate">$scriptPath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptPath

$configFile = 1(Get-Content &quot;$($dir)\web.config&quot;)
'Before: ' + $configFile.configuration.appSettings.OuterXml
$configFile.configuration.appSettings.add.value = 'false'
'After:  ' + $configFile.configuration.appSettings.OuterXml</pre></pre>
<p>Which of course prints out the following output:</p>
<pre><pre class="brush: plain; title: ; notranslate">Before: &lt;appSettings&gt;&lt;add key=&quot;verbose&quot; value=&quot;true&quot; /&gt;&lt;/appSettings&gt;
After:  &lt;appSettings&gt;&lt;add key=&quot;verbose&quot; value=&quot;false&quot; /&gt;&lt;/appSettings&gt;</pre></pre>
<p>The actual script saved the configuration file and didn&#8217;t print anything to the screen, but that&#8217;s irrelevant to the problem. The problem was he needed to edit the &lt;compilation/&gt; element inside the &lt;system.web&gt; element. He tried this first:</p>
<pre><pre class="brush: powershell; title: ; notranslate">$configFile = 1(Get-Content &quot;$($dir)\web.config&quot;)
'Before: ' + $configFile.configuration.system.web.OuterXml
$configFile.configuration.system.web.compilation.debug = 'false'
'After:  ' + $configFile.configuration.system.web.OuterXml</pre></pre>
<p>Which got him the following: </p>
<pre><pre class="brush: plain; title: ; notranslate">Before:
Property 'debug' cannot be found on this object; make sure it exists and is settable.
At C:\Users\zippy\Documents\deleteme\posh.config\editConfig.ps1:3 char:50
+ $configFile.configuration.system.web.compilation. &lt;&lt;&lt;&lt; debug = 'false'
    + CategoryInfo          : InvalidOperation: (debug:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

After:</pre></pre>
<p>The problem was the dot in <b>system.web</b>. PowerShell uses a period to separate an object from its members. However, all is not lost, because there is an alternate notation.</p>
<pre>'Before: ' + $configFile.configuration['system.web'].OuterXml
$configFile.configuration['system.web'].compilation.debug = 'false'
'After:  ' + $configFile.configuration['system.web'].OuterXml</pre>
<p>As you can see, we can reach into an xml element with indexer notation. Please note that you will get an error if you put a period before the opening square bracket, but a period is required after the closing square bracket. If you would like some more in depth knowledge of how indexers work, see <a href="http://msdn.microsoft.com/en-us/library/6x16t2tx.aspx">this MSDN page</a>. While that article is written from a C# perspective, the concepts can be applies to PowerShell as well.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.justaprogrammer.net/2011/11/06/editing-elements-with-periods-in-the-name-in-powershell/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

