in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

May 2007 - Posts

  • War is coming

    Jeremy suggests that Martin Fowler has fired a shot across MS's bow with his RubyMicrosoft post. At the same time we hear from Jamie that Microsoft is threatening legal action against TestDriven.NET

    I think that Leia can put a lot this into perspective for us:

      The more you tighten your grip, Tarkin, the more star systems will slip through your fingers.

    I'm not saying that all Microsoft is evil, TK412 was probably a nice guy with a wife and family at home. But if tk412.5 wants to grow up big and strong he needs food and shelter which costs money, and that means working for the empire.

    Fowler says that Microsoft has struggled to find a way to co-exist with the open source world. I think the biggest reason for this is fear. Fear that if some of these loyal Microsoft shops learn that there was even one superior technology that was not invented in redmond they might start to question other Microsoft gospel. If that happens enough it could lead to free thinking. And that might mean that instead of trying to solve problems by asking "What partial solution can I buy from Microsoft" they might ask "What is the best tool I can use to accomplish my means" and in my experience the latter question rarely leads to Microsoft.

    Fear leads to anger, Anger leads to hate, Hate leads to suffering....

    This probably could have been a separate post, but while I've got you here, let's also look at this whole thing with TestDriven.NET .

    <%= begin_rant do |r| %>

    They say that Jamie violates the Visual Studio Express license because the license does not allow you to extend the product. TBH I hope Jamie fights this and wins. Why? Well let me let you in on a little secret....Visual Studio sucks. There are 2 good things about visual studio.

    1. The intellisense support
    2. The Debugger

    These are the only "features" of VS that I use. (I have used #Develop and eclipse and VS has them both beat here) The rest just hogs memory and slows me down. Want to have a fantastic VS IDE experience? Here's what you need

    1. Resharper
    2. TestDriven.NET
    3. ViEmu
    4. AnkhSVN

    So for me to do my .NET development I need to purchase VisualStudio for $299.00 and then purchase my other tools. But the only pieces of Visual Studio that I care about are intellisense and debugging which microsoft has said they don't need to charge for. Now if I could extend the express edition by using these addins I would need to give Microsoft less money. Good for me, bad for them. Now I'm not complaining about the cost, on the contrary I think it is a fair price for VisualStudio. My problem is that if that is what they want to charge then they should not be giving away the express editions. I'm sorry I just don't think you get to have your cake and eat it too in this case. I equate them putting "you can not extend this product" into the express license to me putting a bunch of TV's on my lawn and sticking a sign in the yard

    You may take any of these TV's that you want, but if you do, even though there are places you could connect a DVR, satelite or cable box you may not plug any of these devices in. In addition to that the volume control only increases the volumne it is not capable of decreasing it and you are forbidden from replacing the knob or purchasing a different remote control that would allow you to decrease the volume setting.

    <% end %>

     

    Update: Just wanted to point out that the Jedi are aware of this as well

  • Now this is cool!!

    Via Chris Sells, Mirosoft Surface.

    I remember something like this from a Bill Gates keynote (at CES?) about a year ago but never saw much more. But the cool factor here is high.

  • MySpace v Facebook

    Saw this on digg today and basically it says that whether you choose myspace of facebook is some kind of IQ test. I agree, but with slight modifications. Let's just turn the IQ test into pass / fail and if you spend a bunch of time using either site, then you fail.

  • undefined method 'gem' for main:Object

    I have to do development on several different machines (keeping them in sync is a real pain, so if you have any good advice please share) and when I went to do some rails work I kept getting this error everytime I'd try to do something:

    undefined method `gem' for main:Object

    It took me a little while to figure out, but I finally upgraded ruby gems

    gem update --system

    and things started working again.

  • Spring Cleaning

    My work PC has been a little sluggish lately so I decided I'd do a bit of spring cleaning on it today. Now I don't want to do all this manually so I start looking for a tool to do this for me. First stop http://www.hanselman.com/tools then search page for "temp" and sure enough Scott has found one.

    CrapCleaner is a nice little tool and apparently this is something I should do more often based on how much it found to delete ( about 2.6 GB).

  • Servlet programming

    Ayende mentioned disliking the JSP servlet model last week and I must say I agree with him. As I type this I'm downloading eclipse. Why, you might ask? well once upon a time about 3 years ago or so I had developed some JSP's and now it's time to go in and make some changes to them.

    I remember back when I was first writing these cursing myself because I couldn't use webforms and had to do all this manual Request.Form and if action == "save" processing (now that I have MonoRail I curse webforms for much the same reasons.

    At this point the code base is small enough and the amount of changes large enough that I intend to just move everything over to Rails. My preference would be to use MonoRail, but the site must run on linux and I don't have the extra time to learn mono and get all the MonoRail stuff working over there, so Rails it is. Besides I have never developed a full scale rails app, I've only played around with tutorials etc so it should be fun.

  • Rake task to update version information

    I maintain assembly version numbers in my msbuild project files. It is (unfortunately) spread across 3 files for the time being, a .targets file, the master .proj file and a wix (.wxs) file.

    So I thought I would hack a quick rake task that will update all these version numbers for me when it comes time to update the application. I ran into a snag though because REXML will by default output attributes like this

    <PropertyGroup Condition='$(Configuration) == &apos;&apos;'>

    which is not what I want in my msbuild files. I instead want it to look like

    <PropertyGroup Condition="$(Configuration) == '' ">

    What REXML outputs might still work correctly in MSBUILD, I never tested it, but it will be a lot harder to look at the file and maintain it by hand, so a solution is needed.

    Thanks to the flexibility of ruby a solution is not that difficult. I found this post which got me started, then I just need to make a small addition (the Text::unnormalize call)

     

       REXML::Attribute.class_eval( %q^
    def to_string
    %Q[#@expanded_name="#{Text::unnormalize(to_s()).gsub(/"/,'&quot;')}"]
    end
    ^)

    My complete task looks like this:

    task :bump_version do |t|
    include REXML
    file_names = ["build.proj","project.targets","Install/program/install.wxs"]

    build_file, targets_file, install_file = file_names.collect do |file_name|
    f = File.new(file_name,"r")
    Document.new(f)
    end

    major,minor = build_file.root.elements["//ApplicationMajorVersion"].text, build_file.root.elements["//ApplicationMinorVersion"].text

    if minor.to_i == 9
    major = (major.to_i + 1).to_s
    minor = "0"
    else
    minor = (minor.to_i + 1).to_s
    end

    puts major + "." + minor

    build_file.root.elements["//ApplicationMajorVersion"].text = major
    build_file.root.elements["//ApplicationMinorVersion"].text = minor

    product_el = install_file.root.elements["Product"]
    product_el.attributes["Version"] = major + "." + minor + "." + "0.0"
    product_el.attributes["Id"] = new_guid[1..-2]
    product_el.elements["Upgrade"].each_element do |el|
    el.attributes["Minimum"] = product_el.attributes["Version"] unless el.attributes["Minimum"].nil?
    el.attributes["Maximum"] = product_el.attributes["Version"] unless el.attributes["Maximum"].nil?
    end

    targets_file.root.elements["//AssemblyMajor"].text = major
    targets_file.root.elements["//AssemblyMinor"].text = minor

    # see: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/74224 ... slightly modified
    REXML::Attribute.class_eval( %q^
    def to_string
    %Q[#@expanded_name="#{Text::unnormalize(to_s()).gsub(/"/,'&quot;')}"]
    end
    ^)


    [build_file, targets_file, install_file].each_with_index do |file, index|
    File.open(file_names[index],'w') { |writeable| file.write(writeable,0) }
    end
    end
    Posted May 25 2007, 02:09 PM by chrisortman with no comments
    Filed under:
  • Sigh...

    I wish I was as good at finding solutions I'm happy with as I am at finding problems.

  • Getting some test data from powershell

    I want to test out a form I'm working on and I want to ensure that the requirement of "input must be less than 255 characters is met"

    So I just want a string that is at least that long that I can paste into the text area, quick and easy from powershell

     

    0..255 | %{$q += "x"}; write-clipboard $q
  • I smell conspiracy

    I haven't been able to access twitter for the past couple of days. And apparently I'm not alone. Phil mentions in his post that Atwood and Leo Laporte have already given up on it, but I have another theory. What if some large monolithic empire actually built twitter and said they used rails just so they could make it look like you can't scale rails and push you into using their own enterprisy solution?

  • Thank you Visual Studio

    I ran into a nice little issue in Visual Studio today that I still have no idea why it happened, only that I managed to make it work again.

    I had just added a new folder to my project, then a new file (it was a common script for the brail view engine if you are wondering) and went to build my project.
    Suddenly the build was failing saying that a conflicting assembly for the task assembly Castle.Tools.CodeGenerator.GenerateMonoRailSiteTreeTask has been found at (full path to VS2005 projectassemblies folder here). The only relavent google result led me to Channel9 which was not overly helpful because it had been working fine.

    The GenerateMonoRailSiteTreeTask is loaded via the $(MSBuildExtensionsPath)\Castle.Tools.CodeGenerator\Castle.Tools.CodeGenerator.targets file. I also have a reference to the assembly locally so I thought maybe that was where the confusion was, however even when I completely removed references to the .targets file I still received the error. The assembly was for some reason being copied to c:\documents and settings\chris\local settings\application data\microsoft\visualstudio\8.0\projectassemblies and it was the only one, so something must have made it special no clue what.

    Eventually after about 25 minutes of head scratching I deleted all of my *.user, _Resharper.* and *.suo files and tried reopening the project. Thankfully that seemed to fix things so now I can get back to actually getting some work done.

  • Using Powershell to see how much work it will be to replace several calls.

    I was using the brail view engine yesterday and ran into a problem. So I wanted to be able to find all the places I was calling ToString( ) on a variable and passing in a format. Powershell makes this nice and easy.

     

    gci -recurse -include *.brail | Select-String "ToString"

    So here's what happens.
    gci is an alias for get-childitem (you can also use dir or ls)
    I tell it i want to recurse and only check files with the .brail file extension.

    Next I pipe ( | ) the output to the select-string commandlet which will find all matches in each file.
    The output of select-string looks something like this

    Ebp\Statement\DownloadUsageDetails.brail:3:${item.OccurredOn.ToString("d")},${item.OccurredO
    n.ToString("T")},${item.FromPlace},${item.FromState},${item.ToPlace},${item.ToState},${item.
    MinuteTenths},${item.Amount.ToString("c")
    Ebp\Statement\viewsummary.brail:99: <dd class="Charge"><strong>${total.ToStri
    ng("c")}</strong></dd>

    But this is not that useful for what I'm trying to do, so I run this command:

    gci - recurse -include *.brail | Select-String "ToString" | Format-List

    Which yields something a bit more useful:

     

    IgnoreCase : True
    LineNumber : 3
    Line : ${item.OccurredOn.ToString("d")},${item.OccurredOn.ToString("T")},${item.FromPl
    ace},${item.FromState},${item.ToPlace},${item.ToState},${item.MinuteTenths},${i
    tem.Amount.ToString("c")
    Filename : DownloadUsageDetails.brail
    Path : C:\develop\ecrm\source\Martin.eCRM.Web\Views\Ebp\Statement\DownloadUsageDetails
    .brail
    Pattern : ToString

    IgnoreCase : True
    LineNumber : 99
    Line : <dd class="Charge"><strong>${total.ToString("c")}</strong></dd>
    Filename : viewsummary.brail
    Path : C:\develop\ecrm\source\Martin.eCRM.Web\Views\Ebp\Statement\viewsummary.brail
    Pattern : ToString

    However I have a lot of files so in reality this list is much longer, but what Format-List told me was that the output of select-string created objects with a FileName property so I change my command to be:

     

    gci -recurse -include *.brail | Select-String "ToString" | group Filename


    Which gave me this nice output:

    Count Name Group
    ----- ---- -----
    1 DownloadUsageDetails.b... {DownloadUsageDetails.brail}
    1 viewsummary.brail {viewsummary.brail}
    3 _usagedetailstable.brail {_usagedetailstable.brail, _usagedetailstable.brail, _usa...
    8 index.brail {index.brail, index.brail, index.brail, index.brail, inde...
    3 paymenthistory.brail {paymenthistory.brail, paymenthistory.brail, paymenthisto...
    1 EditPackage.brail {EditPackage.brail}
    1 ListFeatures.brail {ListFeatures.brail}
    4 OrderSummary.brail {OrderSummary.brail, OrderSummary.brail, OrderSummary.bra...

    And now I can look at which files need editing and how many occurrences there are.

    Enjoy

  • Feed url updated

    I started using FeedBurner yesterday, so please kindly update your subscription to use the new url http://feeds.feedburner.com/Chrisortman

  • Wii Goodness

    Looks like Google Reader is trying out Wii support. Nice.

  • Cropper 1.9 released

    While making that last post I realized I hadn't put cropper on my laptop, and that I've been several versions behind. New version looks pretty nice and can be found here

    Posted May 13 2007, 06:45 AM by chrisortman with no comments
    Filed under:
More Posts Next page »
Powered by Community Server (Commercial Edition), by Telligent Systems