Tomer Gabel's annoying spot on the 'net RSS 2.0
# Monday, September 10, 2007

If you have a WCF service that returns a stream to the caller, you should be extra-careful with the source of these streams. In my case I was redirecting a file stream over a MessageContract that looks something like this:

    [MessageContract]
    public class ItemInfo
    {
...
        [MessageBodyMember]
        public Stream ItemStream;
    }

It took one of the integration tests to fail... oddly to figure out that the stream wasn't getting disposed of after the operation was completed. The solution appears to be fairly simple, add the following lines to your service wrapper (if your concrete implementation is WCF-aware you can always just stick this straight in the implementation code):

    // Make sure stream gets disposed at the end of the operation
    OperationContext.Current.OperationCompleted += delegate { item.ItemStream.Dispose(); };
Monday, September 10, 2007 2:40:15 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Wednesday, September 5, 2007

Check it out. I don't even know how to explain it.

Wednesday, September 5, 2007 3:42:40 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Gaming
# Monday, August 13, 2007

Installing Microsoft Team Foundation Server is a ridiculously arduous and difficult process. I'll spare you my own complaints and simply list the checklist for installing this beast. This assumes you're installing TFS in a domain-enabled environment and in single-server mode; this is the typical configuration for a small-to-medium-size organization:

  1. Designate a machine to host your Team Foundation Server repository. This machine must not double as a domain controller as this configuration is not supported by TFS.
  2. Set up at two regular user accounts (not administrators, and if you have any group policies you may - according to your configuration - want to keep these users out of the relevant OUs) in your Active Directory. I used the trivial TFSService and TFSReports accounts. Also you'll need a user with administrative privileges on the target server; I personally prefer to avoid the associated headaches, so I simply used a domain administrator user for installation purposes (but used the aforementioned two users to set the beast up).
  3. If necessary, install Windows 2003 Server (whatever flavor) on the machine; don't forget the necessary service packs and updates. If your pipe is fat enough, just let Windows Update do its magic.
  4. Add an Application Server role, make sure you enable ASP.NET 2.0 during the installation process
  5. Install SQL Server 2005. Make sure you read the installation guide first though, as you'll need to set it up to "Use the built-in System account," enable all services except Notification and finally select Windows authentication as the preferred authentication mechanism. You'll also need to let the SQL Server installer install a bunch of prerequisites before actual installation begins.
  6. Install SQL Server 2005 Service Pack 2.
  7. From the TFS installation media, install hot-fix 913393 for .NET Framework.
  8. Install Windows SharePoint Services 2.0 with Service Pack 2.0. Make sure you select server farm mode when installing, or you'll just have to redo the installation.
  9. Install Team Foundation Server itself.
  10. Back up the reporting services encryption key (you can find a description of the procedure here).
  11. Install hot-fix 919156, a.k.a the Quiescence GDR (no, I have no idea what GDR stands for).
  12. Install Team Foundation Server Service Pack 1.
  13. Make sure TCP port 8090 is open in your firewall software if you want web access to your Team Foundation Server (to be honest, I haven't found any use for it yet.)
  14. Install Team Explorer from the installation media (required for many add-ons, including eScrum).
  15. Install Visual Studio 2005 Team Suite Service Pack 1. This can, and will, take forever.

If at this point you're not thoroughly exhausted, you might want to set yourself up a with a project. We're currently evaluating the Microsoft eScrum template for our purposes; my colleague Oren Ellenbogen, in his capacity as Scrum Master, will probably be posting his thoughts on eScrum as a platform. In the meantime here's a quick list of solutions to problems we've encountered while configuring the beast:

  1. Make sure you install the various prerequisites; in this case, .NET Framework 2.0, IIS, TFS and Team Explorer, AJAX Extensions 1.0 and the Anti-Cross Site Scripting Library
  2. At this point you're liable to get a strange SharePoint-related error if you try and create an eScrum-based project; if that's the case (or as a preemptive measure), just run iisreset on the TFS server.
  3. If you can't seem to access the eScrum website (nominally at http://yourserver/eScrum) you may have to reconfigure the eScrumAppPool identity from the IIS manager (right click the application pool, chose Properties, go to the Identity tab and enter the right information under Configurable)
  4. You may also get 404 errors from the eScrum website even though it's very obviously configured. We've found that the solution described here works as well:
    • From the command prompt, type cd "%ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\60\BIN"
    • Run STSADM.EXE -o addpath -url http://localhost/eScrum -type exclusion
    • Run iisreset again
  5. eScrum reports only update once every 1 hour. If this bothers you, follow the instructions here to reduce the lag.

Hope this saves someone out there a lot of time and headache (and if so, a comment or e-mail is always appreciated...)

Monday, August 13, 2007 2:08:18 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Development | Software
# Sunday, August 5, 2007

A new organization and a new office require a new IT infrastructure. I'll spare you the gritty details and just mention several installation issues we've encountered and how to resolve them.

  Problem: Windows Server 2003 installed on a RAID array via NVidia RAID controller; drivers are not available on the regular installation CD-ROM.
  Solution: Use a USB floppy drive (most servers and workstations don't come with floppy drives nowadays, and with good reason). In the case of the Tyan server we use, booting off of the driver CD allowed me to create a driver floppy which I then used when installing Windows.
     
  Problem: Windows can't locate file "nvraid.cat" when using the NVidia RAID controller drivers.
  Solution: Hit the escape button to ignore the missing files (apparently that .CAT files are used for cryptographic purposes and are not provided by NVidia, see here).
     
  Problem: Nero refuses to install without installing DirectX 9.0c first on Windows Vista.
  Solution: Although Vista comes with DirectX 10, you can safely agree to this and skip the DirectX installation later. Why a CD/DVD burning package requires DirectX (even though I didn't install any of the additional crap provided by Nero) is beyond me.
     
  Problem: Not strictly an installation issue, but there isn't any immediately apparent way to echo an empty line from the Windows command processor.
  Solution: While "echo /?" won't tell you this, the MSDN documentation for the same command clearly mentions "echo." (written exactly so). Contrived.
     
  Problem: Setting up a DNS canonical name (alias) entry for a file server results in "Duplicate name exists on the network." errors when attempting to use the network resource.
  Solution: Find registry key "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters" and set the value of "DisableStrictNameChecking" to 1. (More information)
     
  Problem: Newly configured DHCP server doesn't respond to "ipconfig /renew" requests.
  Solution: Although I can't explain this, the problem was not the DHCP server; right-clicking the network connection icon and then selecting Repair did actually manage to obtain a lease. If this happens to you, don't get upset (as I did), try this technique first and see if it works for you.

I'll add a separate post on TFS and eScrum later today or tomorrow (hopefully).

Sunday, August 5, 2007 9:20:55 AM (Jerusalem Standard Time, UTC+02:00)  #    -
Software
# Sunday, July 22, 2007

I didn't want to post this before all formalities were complete, and now that they are I can finally announce my new workplace: a shiny new Israeli startup called Semingo.

Logo-semingo-com

I can't currently say much about what it is we're doing, but it's a huge challenge and it's quite a change of pace from my previous job. It's also a nice plus working alongside fellow bloggers Oren Ellenbogen and Pasha Bitz, and trying out New and Improved™ methodologies such as Scrum.

As an aside, here's a couple of videos of the last project I worked on running on the eMobile EM-ONE device (the second video appears to be a leaked beta version. Curious!) If you can read Japanese, there's more about it here. There's absolutely no way to demonstrate this without one of these devices, so while I regret the poor video quality, it's definitely better than nothing...

Update: Now that we've enjoyed a bit of spotlight in Israeli publication The Marker (Hebrew only, sorry) I'll be able to progressively discuss more about what we do at Semingo. Heads up!

Sunday, July 22, 2007 7:07:30 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
# Wednesday, July 18, 2007

Imagine that you work mostly with C#. Imagine that on occasion you sprinkle SQL, Java and JavaScript into your daily routine, and that you also use the command line a lot.

Can you see the problem?

Didn't think so. I'll clue you in: the last one in that list has one distinct difference with the first four. Look around you. Have you found what we're looking for?

That is correct. The answer is: the semicolon. A lightweight, generally meaningless way to end a statement in most common languages. Arguably useless to users, arguably beneficial to parsers, and the cause of almost half an hour of continuous head-scratching by both programmer and DBA. How so?

C:\Temp>mysql -C -usomeuser -phispassword thedatabase;
ERROR 1044 (42000): Access denied for user 'someuser'@'%' to database 'thedatabase;'

I'll let you draw your own conclusions.

Wednesday, July 18, 2007 7:16:46 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Sunday, July 15, 2007

hot-fuzz-2007-11 Let's start off with Hot Fuzz. This movie, from the creators of Shaun of the Dead, is an action-comedy about an overachieving London cop who, in order not to make his contemporaries in the police force look bad, is sent to a backwater little English village. While the worst crime in the village appears to be serving alcohol to minors, a series of "accidents" lead Sgt. Angel to dig deeper into the unlikely inhabitants of the village until he finds out what really goes on. Combining hilarious action and outrageous comedy (not to mention goofy references to classic action films), this is going to be one of my favorites for a long time yet.

505331~Shrek-3-Posters

After an amusing but unspectacular sequel, Shrek returns in what I expected would be a "the quest for more money" kind of movie. Despite (or maybe because of) my ridiculously low expectations I actually enjoyed Shrek the Third quite a bit. It's not a brilliant movie by any means, but it has a much better signal-to-noise ratio than the second one in my opinion, and my companions and I laughed our asses off throughout the production. Bottom line? If you're looking for a fun way to spend a couple of hours, it works very well.

transformers_movie_poster_optimus_primeIt's hard to explain just how low my expectations of Transformers were. To me, it's a classic "well how can it not suck?" kind of movie, along with Resident Evil and Bloodrayne (both of which sucked, in case you were wondering). And I'm not even a fan of the TV series, so I had every reason to expect a terrible movie.
Well, it actually wasn't. The first half is surprisingly funny (not "ha-ha" kind-of funny, I mean "laugh out loud" funny), and the second half is non-stop, kick-ass action. This movie is definitely going to become high-definition reference material when it comes out on Blu-Ray or whatever, and the intentionally simpleminded plot works very well indeed. Biggest surprise of the year - recommended!

Sunday, July 15, 2007 11:55:06 AM (Jerusalem Standard Time, UTC+02:00)  #    -
Movies
# Tuesday, July 10, 2007

And they're getting better at it:

captchas_suck

I mean, what the hell? That looks like a goddamned phi (φ) in italics! I couldn't even figure it out, it took a coworker to figure out that it's supposed to be "cp"...

Tuesday, July 10, 2007 4:38:19 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Personal
# Monday, July 9, 2007

I've been working with Rhino Mocks for a couple of days now and I'm duly impressed. Aside from being generally useful, the Rhino Mocks syntax is mostly natural and some very clever design hacks are used to make it work the way you'd expect it to. (In case you don't know what mocking frameworks are, the subject has been tackled ad nauseam. Just take your pick.)

There is one caveat that is not immediately visible in the Record-Playback syntax, though:

internal interface IFoo
{
    int Bar();
}
[Test]
[ExpectedException( typeof( InvalidOperationException ),
    "Type 'System.Object' doesn't match the return type " +
"'System.Int32' for method 'IFoo.Bar();'" )] public void TestRecordSyntax_ReturnTypeMismatchBehavior() {
MockRepository mocks = new MockRepository(); IFoo mock = mocks.CreateMock<IFoo>(); using ( mocks.Record() ) Expect.Call( mock.Bar() ).Return( new object() ); }

This simple test merely returns an incorrectly typed return value for the IFoo.Bar method, so with the ExpectedException in place you'd expect it to succeed, but you're in for a surprise:

[failure] RecordPlaybackTests.TestSetup.ConsistentReturnTypeMismatchBehavior
TestCase 'RecordPlaybackTests.TestSetup.ConsistentReturnTypeMismatchBehavior'
failed: Exception of type 'MbUnit.Core.Exceptions.ExceptionExpectedMessageMismatchException' was thrown. Expected exception message: "Type 'System.Object' doesn't match the return type 'System.Int32' for method 'IFoo.Bar();'", got "Previous method 'IFoo.Bar();' require a return value or an exception to throw.".

To understand this, consider the following flow:

  1. A method call expectation is set (by calling mock.Bar())
  2. Attempting to set a wrong return type results in the expected exception being thrown from Rhino Mocks. This happens before the Return constraint is set
  3. Because using calls IDisposable.Dispose in the finally block, the mocks.Record object calls mocks.ReplayAll()
  4. ReplayAll asserts because a required expectation (return value) is not yet set, masking the expected exception!

This is in fact how I first encountered this behavior, however there are several scenarios where this can happen. One example: setting up a return value that throws an exception on construction, possibly due to invalid arguments, causes the same behavior thereby masking the true cause of the error.

An alternative syntax suggested by Ayende (author of Rhino Mocks) is:

    With.Mocks( delegate
                {
                    Expect.Call( mock.Bar() ).Return( new object() );
                } ); 

Aside from the esthetical aspect (i.e. butt-ugly), this syntax introduces a minor issue: you cannot Edit-and-Continue methods with anonymous delegates. This may not be a big deal for test code but it's worth noting.

All in all I don't consider this a big issue, but it can bite and should therefore be understood and documented. This post will be reflected in the Rhino Mocks wiki shortly and will hopefully save someone a little grief in the future...

Monday, July 9, 2007 7:53:40 AM (Jerusalem Standard Time, UTC+02:00)  #    -
Development
# Sunday, July 1, 2007

Quick download link (v1.2)

I wanted to simple way to download an entire PicasaWeb album. Right-click and save simply will not do, installing the Picasa application is completely out of the question (I use FastStone, in case you were wondering) and I couldn't find any easy way of doing this, so I whipped up a quick and dirty application. It's pretty self-explanatory, really:

picasawebdownloader

Download the application (source included) here.

I also used the chance to give #Develop a serious whirl, and I can honestly say that it's damn impressive; in several hours of use the only real qualms I've had with it are the non-configurable keyboard bindings (at least I couldn't find any configuration menu for this; it wouldn't be an issue if the default bindings weren't slightly different from what I'm used to) and the lack of immediate/watch debug windows. The dialog editor is full-featured and the environment seems to be quite responsive and robust. I really am impressed.

Update (20-Aug-2007): Version 1.1 is now downloadable. I've added support for AuthKeys (as per skolima's request) so you should now be able to download private albums as well (assuming you have the appropriate key). Also added a compiled binary to the archive, doh!

Update (11-Sep-2008): Version 1.2 is available for download, and includes the following improvements:

  • The tool now works for PicasaWeb albums from any valid top-level domain (this means that albums hosted at www.picasaweb.ru will be properly handled.
  • Existing files will not be overwritten; instead I've taken a cue from common browsers and am now adding a counter suffix to the filename. If an album has two pictures with the name example.jpg, you can now expect to find two files named example.jpg and example (2).jpg in your directory. This behavior is also applied if you already have such a file in your directory prior to running the tool - any feedback as to whether or not this is desirable will be appreciated!
  • Authentication keys may now include dashes (thanks, Jakob).

Sunday, July 1, 2007 2:28:06 AM (Jerusalem Standard Time, UTC+02:00)  #    -
Development | Software
Me!
Send mail to the author(s) Be afraid.
Archive
<September 2007>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
All Content © 2024, Tomer Gabel
Based on the Business theme for dasBlog created by Christoph De Baene (delarou)