Updates from June, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • Scott Saad 08:06 on June 25, 2008 Permalink | Reply  

    Clarification on Purpose 

    My recent posts have all been related to PowerShell. Given this, it might be helpful to clarify reasons. First off, this blog is not another PowerShell blog… it’s a developer’s blog. As a developer we have tools that help us make our jobs easier. For me, PowerShell is one of those tools. When running Windows, I always have it open.

    While working on our day to day activities we may run across things that we feel can be automated or easily solved with some custom program. Many of us have these types of tools that we’ve written (or somebody else has written) laying around and there is potential that these tools become absolutely necessary for us to feel productive.

    Have you ever had to reinstall your OS? Or better yet, have you ever had your machine crap out and you had to share one of your colleagues? Or perhaps get a loaner from the IT department while your baby undergoes surgery? How awful does it feel not having our happy environment with all our precious tools installed? Any developer usually needs some base set of tools installed for them to feel above average on productivity. PowerShell has become one of the first things I install on a squeaky clean system.

    And now to the purpose:

    What I find interesting about software development is that it is nothing but how to solve problems… in hopes that the solution to these problems are somewhat elegant. We can lean on our communities for help on this. Why do we subscribe to developer blogs? For me, it’s to learn how to become a better problem solver in hopes that I can incorporate their experiences into my own.

    Recently, PowerShell has been one of those tools that keeps helping me solve my problems. Invariably, it has given me the opportunity to evolve my skill set (freebie).

    This blog is just a reflection of what I have found useful in solving my developer related problems, in hopes that I can pass on some helpful bits to me fellows.

    -

    If you enjoyed this post, it would be cool if you subscribed for future posts via rss.

     
  • Scott Saad 22:39 on June 19, 2008 Permalink | Reply  

    PowerShell VsVars32 – 64-bit style 

    I ran across this post which is a frickin’ must for PowerShell and Visual Studio integration. Being very excited about this I ended up trying it out right away and ran across a problem. Digging deeper into the VsVars32 function, it became evident that things bonked because the registry path to Visual Studio was not all there:

    1> $theVSKey = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\VisualStudio\9.0

    2> $theVSKey.InstallDir

    This yields nothing at all as $theVSKey is empty. What the crap is going on here?

    Well it ends up being a problem related to running on a 64-bit machine. We need to remember that when in 64-bit mode, applications like Visual Studio are really 32-bit and run in the WoW64 mode. In WoW64 there is a separate section of the registry dedicated to 32-bit apps (settings for Visual Studio live here).

    What to do now? This is why PowerShell installs the x86 version of itself along side the 64-bit version. This was the first time that I realized the need for the  x86 version. At first I thought it was for those peeps that just couldn’t let go to 32-bit land. I guess not.

    Ahhhh… all better now.

    -

    If you enjoyed reading this little piece, please feel free to subscribe to future ones via rss.

     
    • Steven Murawski 19:07 on July 24, 2009 Permalink | Reply

      Just a word of caution.. the x86 version of PowerShell will have it’s own execution policy, but they share the same shell profile script.

  • Scott Saad 22:08 on June 12, 2008 Permalink | Reply  

    Generate Random Dates in PowerShell 

    You ever read something right when you actually needed it? Like, there couldn’t have been a better time in the world, and all of a sudden you see it and you say something totally cool like, “Booyah! That’s what I’m talking about baby!” Well, that’s what happened to me yesterday.

    The setup : Working on a project that required (for testing purposes) a sinful amount of files. So a single directory that contained well over 50,000 files. The test required the files’ last write time to be sparsely dated, but the sample set I was working were within 3 days each other. I figured that at some point I would try out PowerShell to solve this task but was clueless on the “random” functionality that it may or may not expose. I figured if I couldn’t figure it out within like 20 minutes in PowerShell I would have to write a quick little C# app or something to get the job done. But come on… this is the type of thing that PowerShell is made for not a compiled language!

    The moment: I was catching up on some favorite PowerShell blogs, when suddenly I ran across the post by the $cript Fanatic (Shay@Israel). It was like being struck by lightning and I immediately dropped everything to test out his thoughts on generating random dates within PowerShell.

    The attempt: Within the first few minutes I was weary because he referred to this working in CTP2. I’m still on version 1 but I was determined to see if there was a way. Unfortunately I had a huge truck of failure dumped on me because my version of Get-Random (which I still don’t know if it’s part of version 1, or pscx) could only handle Int32 bound to the min/max parameters. DateTime.Ticks property is Int64. So I decided to post a comment to Shay asking if he had any ideas. He responded within no time and I decided to kick around his findings.

    The result: We ended up with was one that could actually work on any version of PowerShell. Bonus! Anyway the following will generate a random date between the first of this year and now:

    [DateTime]$theMin = "1/1/2008"
    [DateTime]$theMax = [DateTime]::Now
    
    $theRandomGen = new-object random
    $theRandomTicks = [Convert]::ToInt64( ($theMax.ticks * 1.0 - $theMin.Ticks * 1.0 ) * $theRandomGen.NextDouble() + $theMin.Ticks * 1.0 )
    new-object DateTime($theRandomTicks)
    

    Pretty darn sweet! Super helpful? Maybe not for most everyone, but for my little world it was very helpful. Plus it provided for a little learning which is always a joy.

    -

    If you enjoyed this post and get the urge to read more in the future, please feel free to subscribe via rss.

     
  • Scott Saad 08:42 on June 11, 2008 Permalink | Reply  

    Perforce: The best damn software written… ever! 

    This will only take like 2 seconds so bare with me. Every now and then I get inspired and if I don’t capitalize and let my feelings out, the inspiration starts to dwindle within minutes. Therefore… my short little reflection on my favorite revision control system, Perforce.

    Have you ever worked with a piece of software that does it’s job so well, you completely take it for granted? Be aware of this because when it happens (which is rare at the level I’m talking about) you’ve stumbled upon a gem.

    Source code management is not necessarily rocket science but it is an essential tool for any developer. I’ve worked with many systems and hands down Perforce takes the cake. It just works and that’s what makes it so beautiful. The system is rock solid and runs on about every platform you can think of.

    Is it free? No. Is it worth the hefty pricing? Every penny of it! Too strong of a statement? You tell me but source code is for many software companies their only asset and protecting it is worth the price. Plus, I’ve yet to find a better system (and yes, I still look around). Therefore, why settle for anything less?

    Like I said, inspiration like this at the software level doesn’t come too often so I had to give a shout out when I felt it. ‘Nuff said!

    -

    If you enjoyed this little rambling, please feel free subscribe via rss. It would be just lovely if you did so.

     
    • Sheri 10:09 on June 12, 2008 Permalink | Reply

      Wow, thanks for taking the time to vocalize your effusive reflection– it’s nice to hear. Also, liked your post ‘change happens.” Sheri

    • Wouter 01:48 on September 3, 2008 Permalink | Reply

      You must be joking right? The whole internet is full of examples why Perforce just *doesn’t* work for anything else than plain ‘p4 sync’ and ‘p4 commit’ and requires you to crank out insane chains of command lines or scripts to *all* the other stuff (which is, like, daily practice for software engineers).

      I guess you’ve never used any of the other SCM systems, rihgt? You know, the ones that are free, offer exactly the same functions as perforce and more, and can actually work *for* you instead of the other way around? Which all ‘just work’ like SCM systems *should* work.

      Perforce is SCM from Hell, probably made by masochists. The fact that people are actually spending (and earning!) money with this piece of crap is astounding.

    • Scott 14:21 on September 5, 2008 Permalink | Reply

      Wouter,

      I definitely respect your experiences with Perforce… as in the end, I guess that’s all we have.

      Given that, Perforce has always been solid for me and has not failed in 7 years of using it (at two different companies). For me, it just “works” and we do some pretty intensive branching schemes.

      The post was more of an inspirational moment than anything else. From a developer’s perspective, using software that “just works” is always a blessing. I’m definitely not going to push anyone in any direction. These have been my experiences. I’m sorry to hear yours have not been so great.

      Better luck and thanks for the comment!

  • Scott Saad 23:31 on June 10, 2008 Permalink | Reply  

    Should developers upgrade to Windows Vista? 

    The short of the answer is hell yes.

    Here goes a bit longer answer… but first:

    ** Begin Disclaimer **

    My current profession involves working on a Windows platform. To be blunt… exclusive Windows platform development. However, I did most of my early learning on Unix/Linux and never really hit the Windows platform until I was out in the “real world”. That being said, I exclusively use a Mac at home, for no particular reason but that I enjoy diversifying.

    ** End Disclaimer **

    I recently upgraded my development box to Windows Vista Enterprise edition because I started to realize that I wasn’t living in the now. It’s so easy to get caught up in the criticism that Vista has faced, and continues to face. However, it started to dawn on me that I’m not the target audience for all these criticisms. These are mainly for consumers that need to make an informed decision on whether or not they want to fork over the money to upgrade to this latest version. Pish posh! I don’t care.

    As developers we need to stay current or we face falling behind. Somebody at some point in time will be attempting to run your application on Windows Vista. How will it behave and when it doesn’t behave well, who looks bad? Microsoft maybe, but this person has already bought into Windows and there is probably some other program out there that does similar things as yours and does run on Vista.

    Is this fear driven? No. It’s just being smart and going with the flow. Vista is out and it’s here to stay for a while. People are upgrading and buying new machines with it pre-installed. What the hell are we fighting? As a developer, it’s our duty to stay current and continuing to evolve with the technology changes.

    I don’t care what anyone tells you, there are some significant changes in Vista that need to be noticed from a development stand point. For me, I’ve been running it for 4 weeks now and I can honestly say that I have no reason to go back to XP. (This is me wearing both my consumer hat and developer hat.)

    XP was great and served its purpose. However, my Windows development experiences need to continue evolving and therefore Vista is the way to enable that growth.

    -

    If you like anything you’ve read so far please feel free to subscribe via RSS. It would be most appreciated.

     
  • Scott Saad 22:00 on June 4, 2008 Permalink | Reply  

    Change Happens… Change With It 

    Tools, technology, systems, patterns (etc) continue to evolve. Are we doing the same? As we move through our professional lives there seems to be something that we can always count on: change. One construct we can continue to lean on is that what we are comfortable with today, most definitely changes tomorrow. This is one industry that continues to evolve at a rate that is almost impossible to keep up with.

    For most of us, we have our jobs and in these jobs we are working on a certain product(s), being developed with certain tools, targeting certain platforms. I would imagine that a good majority of our situations don’t allow for the incorporation of all the new cutting edge technologies being developed. So if our jobs don’t allow for us to be working on projects that are in line with the latest buzz, how do we continue to sharpen the saw?

    Before answering that question a better one might first be, should I care? Yes and no. We cannot feasibly go out and try and learn every new technology that comes about. However, there exists technology that believe it or not can help complement what we do on normal days.

    The following is a couple example of how to incorporate continuous learning into the job:

    1. A good programmer always has a scripting language(s) up their sleeve. If you’re developing on a Windows platform definitely check out PowerShell, which has been touted as a top ten member of “life and work-changing technologies“. Once and a while there are tasks that seem monotonous and many times our approach is a brute force solution. Ever have to search through thousands of source files, making the same change to all? Now I realize there are many ways to skin this cat, but it’s opportunities like these that we coule be taking advantage of to incorporate new ways of solving our most common tasks. It allows us to learn new things while still being productive.
    2. Port one of your old applications to a new language/platform/etc. It’s hard to sometimes think of applications that one could write just to explore new technologies. Therefore, porting an existing one to something else might be a good route to take. Do you have any of these types of applications sitting around? Maybe something that you wrote eons ago that possibly doesn’t work anymore? Or maybe something that you still use but could use a face-lift?

    In my opinion, our minds tend to accept change more naturally by finding ways to incorporate learning into our existing patterns. Change happens… don’t fear it. Rather we should seek out ways to embrace it. By doing this, we can continue to make ourselves more valuable to the organizations we work for and potentially lessen the chances of becoming old and rusty in our skills.

    -

    If you liked this post it would pretty much rock if you subscribed to saadware via rss.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel