﻿<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text" xml:lang="en">PowerShell</title>
  <link type="application/atom+xml" href="https://d.moonfire.us/tags/powershell/atom.xml" rel="self" />
  <link type="text/html" href="https://d.moonfire.us/tags/powershell/" rel="alternate" />
  <updated>2026-05-12T17:42:15Z</updated>
  <id>https://d.moonfire.us/tags/powershell/</id>
  <author>
    <name>D. Moonfire</name>
  </author>
  <rights>Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International</rights>
  <entry>
    <title>Two years of Python</title>
    <link rel="alternate" href="https://d.moonfire.us/blog/2012/10/17/two-years-of-python/" />
    <updated>2012-10-17T05:00:00Z</updated>
    <id>https://d.moonfire.us/blog/2012/10/17/two-years-of-python/</id>
    <category term="programming" scheme="https://d.moonfire.us/categories/" label="Programming" />
    <category term="c-sharp" scheme="https://d.moonfire.us/tags/" label="C#" />
    <category term="javascript" scheme="https://d.moonfire.us/tags/" label="JavaScript" />
    <category term="powershell" scheme="https://d.moonfire.us/tags/" label="PowerShell" />
    <category term="python" scheme="https://d.moonfire.us/tags/" label="Python" />
    <category term="ruby" scheme="https://d.moonfire.us/tags/" label="Ruby" />
    <category term="typescript" scheme="https://d.moonfire.us/tags/" label="TypeScript" />
    <content type="html">&lt;p&gt;About two years ago, my dad convinced me to try &lt;a href="http://www.python.org/"&gt;Python&lt;/a&gt;. His argument was "I liked it, you probably will too." I know, it isn't exactly the greatest argument, but after the initial blowing him off, I decided that I needed to be open-minded and actually try Python.&lt;/p&gt;
&lt;p&gt;Since then, I've written a few non-trivial applications including some &lt;a href="http://mfgames.com/mfgames-media"&gt;media processing tools&lt;/a&gt;, a pretty extensive set of &lt;a href="http://mfgames.com/mfgames-writing"&gt;writing utilities&lt;/a&gt;, and a slew of other little scripts here and there. I also have an entire ebook publication system written in Python.&lt;/p&gt;
&lt;p&gt;When I went to the cabin two weeks ago, I was talking to my dad about it and I realized something: I don't like Python. I mean, Python is a great little language and I'm fairly competent at it. I would still recommend it for teaching people who to program. But, as a language, I don't think it's the language for me.&lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;My reasons are not the technical ones. Instead, they are reasons that are purely wrapped in my head. I've been programing C-based languages (C, C++, Objective C, Java, &lt;a href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29"&gt;C#&lt;/a&gt;) for 31 years, ever since my dad taught me K&amp;amp;R C for my 6th birthday (I still remember the little ANSI robot program we wrote together). My formative years and my history is wrapped in that language and the further away I move from it, the more difficulties I'm having.&lt;/p&gt;
&lt;p&gt;For Python, I can't handle the lack of braces. I don't know why, I don't handle not having that final brace for a scope. I've tried to remove that limitation of mine, but it doesn't seem to be happening. I also struggle with the lack of statement terminals (semicolon) in much the same way.&lt;/p&gt;
&lt;p&gt;There is also the philosophy behind Python. I like one class per file. I like small files and tools (&lt;a href="http://www.jetbrains.com/resharper/"&gt;ReSharper&lt;/a&gt;) that let me work with them. I like documentation comments above the code, not as a triple-quoted string. Like the concise &lt;code&gt;base&lt;/code&gt; instead of &lt;code&gt;super(Class)&lt;/code&gt; syntax. Even tabs, I like my tabs and &lt;a href="http://www.python.org/dev/peps/pep-0008/"&gt;PEP-8&lt;/a&gt; highly recommends that I abandon that preference.&lt;/p&gt;
&lt;p&gt;These are trivial, stupid little things. But, after two years, I'm going to say I haven't gotten rid of them.&lt;/p&gt;
&lt;p&gt;I'm not fond of &lt;a href="http://www.ruby-lang.org/en/"&gt;Ruby&lt;/a&gt;, &lt;a href="http://coffeescript.org/"&gt;CoffeeScript&lt;/a&gt;, and &lt;a href="http://en.wikipedia.org/wiki/Windows_PowerShell"&gt;PowerShell&lt;/a&gt; for the same reasons. It isn't specific to Python, I just spent two years trying to break out of these mental framework and I'm not doing that great of a job.&lt;/p&gt;
&lt;p&gt;So, what does it mean? Probably not much. I still have a number of Python libraries that I'm using day-to-day. Eventually, I'll probably migrate them to C#. It will make my life easier because I know the libraries. I might do something silly like try TypeScript (which looks pretty sexy) or just JavaScript, but I suspect that C# will be the language of choice for a few more years.&lt;/p&gt;
&lt;p&gt;There are some nice things. Not having to worry about Unicode and XML is a big one (I had a code bug with that this evening), using the tools I'm intimately comfortable with, and taking advantage of the knowledge I already have.&lt;/p&gt;
&lt;p&gt;I'll still learn new languages, that's important, but my daily tools will probably migrate to what I'm comfortable with. Otherwise, I'll continue to struggle with maintaining them because I can't seem to get my head wrapped around them properly. And since I only touch the code every few weeks at a time (since they are fairly stable), reducing the context switching would keep me productive.&lt;/p&gt;
&lt;p&gt;I'm glad I tried Python though, instead of dismissing it out of principle. The struggles I had to learn the language, trying to work through my problems, and even just seeing a new library made my life richer. It wasn't a waste of time by far. It was a great experience and I would recommend it for anyone who doesn't know Python.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Efficiency</title>
    <link rel="alternate" href="https://d.moonfire.us/blog/2012/02/24/efficiency/" />
    <updated>2012-02-24T06:00:00Z</updated>
    <id>https://d.moonfire.us/blog/2012/02/24/efficiency/</id>
    <category term="programming" scheme="https://d.moonfire.us/categories/" label="Programming" />
    <category term="powershell" scheme="https://d.moonfire.us/tags/" label="PowerShell" />
    <content type="html">&lt;p&gt;I will be the first to tell you, I like efficiency. I like it when things just work and everything chugs forward. The presentation I did at Iowa Code Camp was related to that since I get relatively very little time to write. So, I do a lot to make sure those 10-20 minutes are the fastest things I can write.&lt;/p&gt;
&lt;p&gt;Some of it comes down to planning ahead, but others is just doing more with less.&lt;/p&gt;
&lt;p&gt;&lt;!--more--&gt;At work, I just finished something that my obsession appears to be benefiting others. When I started, we had a process for getting a new code base. It was somewhat long and had a lot of manual steps including restoring databases, copying files, making changes. It took about an hour to get everything set up.&lt;/p&gt;
&lt;p&gt;So, developers would get out of sync simply because it was a lot of work.&lt;/p&gt;
&lt;p&gt;I get frustrated if I have to do something three times in a row. At first, I just created a script to run a few things in batch file, but then I found the power of PowerShell. Now, I'm a Linux user at heart and a Perl programmer at the core. I'm also Damn Good&amp;trade; at .NET languages. So, PowerShell was a god-send (except that I dislike the ascethics of the language and it &lt;em&gt;doesn't require semicolons&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;I started with just a little thing. Install the database, run some scripts. Then added in copying files. Making changes. Slowly, I built up a system that eventually got to the point that I would type one line, hit return and come back twenty minutes later and everything was done (we got much faster machines during this time).&lt;/p&gt;
&lt;p&gt;I talked about it for a few months and then... someone asked for it. I polished it up and in a bit of free time, got it running. Took me an hour to set up their computer. I went back and fixed the bugs I found. Another developer asked. Only took twenty minutes. I fixed a few things. Added another of my pet projects that was blessed last year as official.&lt;/p&gt;
&lt;p&gt;Another developer asked. Ten minutes.&lt;/p&gt;
&lt;p&gt;Another. Still ten, but mostly because I explained how to customize everything. I had a meeting with the rest of the developers.&lt;/p&gt;
&lt;p&gt;And then, I got compliments. I was making people's lives easier. The painful process was a lot less painful and they were happy.&lt;/p&gt;
&lt;p&gt;I still have improvements to do on the program. Little things to make it work just right for everyone. But, when I wrote this, I paid attention to how everyone worked. I tried to write something that was flexible enough to cater to everyone else's quirks and not just my own. And... I made their lives easier.&lt;/p&gt;
&lt;p&gt;A long time ago, I was a cocky bastard of a programmer. I thought I was the universe's gift to bits. I learned otherwise and I'm glad I did. There really is nothing to compare to the high of helping others. I love when they say "this is so easy" instead of watching them dread it.&lt;/p&gt;
&lt;p&gt;So, for those curious, the script did the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Downloaded the databases&lt;/li&gt;
&lt;li&gt;Decompressed them using the PSCX&lt;/li&gt;
&lt;li&gt;Restored databases&lt;/li&gt;
&lt;li&gt;Set up database sizes, shrank files, connected users&lt;/li&gt;
&lt;li&gt;Copied common files and linked them using junction points&lt;/li&gt;
&lt;li&gt;Copied the release files&lt;/li&gt;
&lt;li&gt;Installed configuration files&lt;/li&gt;
&lt;li&gt;Edited the configuration files to match the setup&lt;/li&gt;
&lt;li&gt;Got the source, either from a label or the latest (had a lot of help with this one)&lt;/li&gt;
&lt;li&gt;Ran the script-based client to do everything else&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
</feed>
