CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

September 2004 - Posts

  • WSMQ 1.1 Released

    Today, I released a setup project for WSMQ 1.1.  You can download it from the GotDotNet workspace here. WSMQ is a simple service-oriented message queuing application with a Web Service endpoint.  The most significant change with this release was a much needed administration interface.  You can now add new queues through a web interface that looks like this:

    Best of all you can inspect your queues, including the serialized message XML, or delete queue messages if needed:

    A big thanks to Josh Pollard, who's been adding some much needed base methods to the queue service.  I'm always looking for help with this, so send me a quick email if you're interested.

    -Brendan 

  • Don Box Defines .NET (and how to do remote integration)

    A short but interesting post about the difference between being a .NET developer and Windows one popped up on Don Box's NEW blog.  Here's a quote:

    .NET is a technology from Microsoft that combines XML Web Services (for remote integration) and the CLR (for local integration and execution). The CLR is an implementation of the ECMA CLI spec that is tightly integrated with Windows.
    The interesting thing to me is that the question of how to do remote integration seems to be pretty much answered here once and for all.  That is, if anyone is still wondering about whether to use Web Services vs. Remoting...
     
    -Brendan
  • Great Post on Domain Driven Design

    Steve Maine just posted one of the most excellent posts I've ever read:

    Refactoring Our Way to Glory: An exercise in implementing a domain-driven design

    There's tons of good information here, and some enticing examples of how nice it's going to be when we have Generics at our disposal.  It's also a great account of how to think through a basic problem of entity framework design and arrive at a good solution.  This is the kind of stuff that I'm always worried about getting “right” in the initial stages of design.  I'm definitely going to study this one.

    -Brendan 

  • Patching GDI+ is NOT so Easy

    Aaron's blogged about his experiences cleaning up the new GDI+ JPEG security cavern (much bigger than a hole) in  GDI+ Mess.  This worries me, not only because it seems relatively hard to clean up, but it seems to be broken in lots of different places... Uugh.

    -Brendan

  • Map a Network Drive From Code for Cross-Domain File Copy

    The other day, I had to copy a file from a Windows Service running on our Web server which is outside of our firewall, and not a trusted member of our domain, to a folder on a share inside of the firewall.  Should be easy, right?  Well, it turns out it that it's a bit more complicated than I first thought.

    In this case I had a username/password in the domain that I could use to access the share from the server.  I could successfully map the drive when logged into the console, but my service couldn't see this mapped drive.  My service couldn't impersonate this trusted domain user either (using LoginUser), since the server itself wasn't a trusted member of the domain.

    There's no IO managed framework classes for connecting to a network share as a user, and there's no way to connect to a network share, passing a domain\username and password, AFAIK.

    I found out through a lot of searching that I needed to make a call to the WNetAddConnection APIs (mpr.dll) that would allow me to map a drive as a domain user in code.  I also have to run my service under the NETWORK_SERVICE account, so that it has access to network resources.

    Luckily, I found an article on Code Project Map Network Drive (API) that does exactly this. So, my final solution (simplified), using the NetworkDrive class from the article looks like this:

         // Create a network mapped drive
         NetworkDrive drive = new NetworkDrive();

        
    drive.ShareName = @"\\SOME_SERVER\SOME_SHARE";
        
    drive.LocalDrive = "I";
        
    drive.Force = true;
         drive.MapDrive(@"DOMAIN\USERNAME", "password");

         TextWriter textWriter = File.CreateText(@"I:\file.txt");
        
    textWriter.Write("Some Text");
        
    textWriter.Close();
         drive.UnMapDrive();

    This works really well.  The only problem may come up is that if the drive is mapped by some other application, forcing this mapping may cause problems. You could have some code that loops through drive letters until it finds one suitable.

    -Brendan

  • IE JPEG Overrun Can Allow Creation of Local Admin Account.

    Stefano has a problem with people publishing hacks on the net.  He congratulates them for being “stupid.”   I think he's talking about this story from this story from Netcraft:  Here's an excerpt:.

    The critical security hole allows a remote attacker to create a JPEG image that, when viewed in Microsoft software programs, could allow the hacker to gain control of the computer. The flaw was revealed by Microsoft Sept. 14, along with a security update that addresses it. Code that partially exploits the flaw was published last week, and has been rapidly developed into code that could be used in an attack using a virus or worm.

    The latest exploit, published this morning on the Full Disclosure mailing list, claims to be able to create an administrator-level account on Windows machines.

    Not to pick on Stefano, but I don't think these hackers are at all stupid, in fact, the ones posting hacks on the net, and not using these exploits, are not only very smart, but doing us all a big service too!

    -Brendan

  • Possible SQL Injection via SQL Parameters?

    I just heard something on the latest DotNetRocks episode, featuring Joe Stagner that has made me very nervous.  At around 1h 30m into the show, the talk turns to security.  Carl asks if it's possible to inject SQL when using a SqlParamater.  It's a common belief that it's not possible, but Joe Stagner says that it is possible and he, in fact, knows how to do it!  I for one am not comfortable with security by obscurity, and don't like knowing that there's a possible security loophole that I'm not accounting for. So, how can someone do this?  Most importantly, how does one protect against it?

    -Brendan

  • Scoble's Human Too...

    Interesting to watch this issue play itself out.  It brings a real human aspect to this whole blog thing, when people you respect make public mistakes.  I've definitely been there, and had slightly embarrassing things happen on my blog, but that's life right?  That's what makes this fun for me, otherwise, I'd just read trade journals and books and msdn. 

    -Brendan

  • Multiple Vulnerablities in Firefox...

    If you're using Firefox, you may want to get the latest version that should fix this stuff.

    -Brendan

  • I'm a ReSharper Convert...

    I've posted a couple of times about different VS plugins, like CodeRush, CodeSmart, ReFactory, and ReSharper.   I think I'm ready to finally go with one tool - I placed my orders today for ReSharper, and un-installed the copies of CodeRush, and CodeSmart that I had already paid for.  It was a close decision, especially between CodeRush and ReSharper.  But in the end ReSharper won out, and I'll try to explain why:

    Now, to be fair, I don't think I took the time to fully learn CodeRush.  A listen to the latest episode of DotNetRocks, featuring Mark Miller, is a good introduction to CodeRush.   CodeRush is full-featured, well-designed and has a long history of development and use.  The application has been around for years as a Delphi product, and so a lot of thinking has gone into it. 

    But... to fully utilize it's features you have to learn how to use it.  Much of the functionality is based on this macro-type language which is driven by your current context in your code.  Out of the  box, you'll only realize a small fraction of it's benefits.  If you listen to the show, Mark Miller pretty much says this word for word.  Therein lies my problem with CodeRush:

    I'm spending too much of my time learning other methodologies and tools, like how to write good code, maintain production environments, unit testing and design, to learn a bunch of stuff just to use my new IDE plug-in!  I could learn the Dvorák keyboard too, which I'm sure would pay off in the long run, but the effort is too great!  Call me lazy, but I just want the plug in to make development easier for me out of the box, without any additional effort on my part.  This is exactly what ReSharper does, install it, start writing code, and your life will be better.  Mine was.  Here's some things that really made me a convert:

    First, ReSharper shows you code errors before you compile.  If your code is free of errors, you get this little, green box to the right of your code window:

    If it won't build you'll get a red box, along with little red lines that you can click on to go directly to the offending code:

    This is an awesome feature.  It saves me so much time during a day.  In fact, I would say that this reduces the number of times I compile in a day by 75%.  When it takes you 10 seconds or so to compile, this can really add up to a large chunk of time spent not coding, and interrupting your coding flow. 

    ReSharper's auto-code generation is cool too.  CodeRush works by copy-paste of source code, to automatically generate new code, so if you copy “private int someInt“ in a class, and paste it in the class, you get a public get/set property.  Now this sounds good, and does work well, but I could never get fully used to it.. I did use this for a couple of months, but it always seemed to violate some sort of UI “Single-Responsibility Principle“ to me.  Cut and paste should be just that, nothing more.

    In ReSharper, you choose “Generate..“ from  a menu, and it'll popup a context menu like this, if it finds stuff to generate.

    There's templates too, and all sorts of refactoring stuff built in, but that's a whole nother blog post.  But, all in all, for a developer who's too busy to stop and learn a new tool, ReSharper will give you the biggest productivity gain, in my opinion.

    -B

  • Automatic NUnit Unit Test Generation?

    The other day, I emailed Darrell about SkeletoNUnit.

    >Know anything about this?
    >
    >http://sourceforge.net/projects/skeletonunit/
    >
    >Looks interesting, I remember you were talking about NUnit addins, and
    >got me thinking of an automatic unit-test generator.  Should be fairly
    >easy to make one, so I thought for sure there's one out there.
    >
    >I know it's backwards to generate unit tests, but I can see the
    >advantages, especially with legacy code.

    Anyhow, he didn't know of anything else off-hand, and SkeletoNUnit seems, like it's name suggests, to be a dead project...  So, I'm asking if anyone knows of anything else out there that will do this?  Basically, I'm looking for something that will automate the generation of NUnit unit tests. 

    I've tried .TEST from Parasoft, (which does generate NUnit tests) but I couldn't get it to work fully.  It would choke on big assemblies, and I couldn't figure a way to generate tests for one class at a time.  I also can't justify the price tag, when VS2005 may do much of this stuff and make .TEST obsolete..

    -Brendan

  • Just Blog It!

    OBSOLETE CONTENT
    The author of this post has determined that this content is obsolete. Use at your own risk! Blog posts are a point-in-time snapshot of the blogger's thinking and should not be assumed to represent this blogger's current opinions. This post was left up for historical purposes.

    The point of this post is rather obscure, but here it is anyway.  I remember once talking with Grant Killian about blogging.  He was lamenting about not feeling like he had enough "Good Content" to blog about.   My response to him was that you never know what part of a blog post is going to end up being useful to someone, and I told him about a blog post he made through which I learned something really valuable.  I really believe this to be true.  You may feel like blogging about a particular topic is redundant, but chances are there are lots of people reading who will be enlightened by your insight. 

    Something happened this weekend which for me really illustrates this point.  Through reading blogs, I ended up protecting my family from would be burglars and fires.  How?  See, I've finally been reading Code, which I discovered through reading blogs.  This past weekend, what I learned in Code helped me install a new alarm system in my house.

    Sidebar: ADT locks you out of their alarm systems, so that you cannot use it as a local-only system without paying for their monthly service.  The system that was installed in my home (by some previous owner) was a ADT "SafeWatch Plus" system.  After loads of research, I found out that this basically was a modified "Moose Z900" system, with the master installer feature that allows you to set the alarm to local mode disabled.  So, when I disconnected my local land line phone service in my house, the alarm started going off at random times (once at 4AM), so I eventually had to disable it all together.  It was sorta like ADT telling me “Hey, You Need to Pay Us!”  This seemed like a waste, as the entire house was wired with keypads and sensors which was just sitting there looking ugly and not doing anything useful..So for $4 on eBay, I bought a brand new Moose Z950 board, and this Saturday wired it into my system and voilà! The entire system works great!  And no connection to ADT! 

    The interesting thing is that reading Code taught me all about relays, ohms, latched circuits grounding and all the stuff I needed to know to make it through the relatively complex process of re-wiring this system.   The person who originally turned me on to the book, and in fact Charles Petzold himself could have never imagined that his information may one day save a life (okay, that's a big stretch, but I really wanted to drive the point home here).

    Anyway, there's a lot of talk going on about posting appropriate stuff, and moving blogs around, and creating side blogs, and rss feeds clogging up the pipes - but I, for one, really want to encourage people to post!  The last couple of days has been pretty light in the blog world I'm tuned into.  Perhaps everyone is busy, but look: post whatever it is you're thinking about that day, and be sure to give your post a good title so that it can be filtered easily.  If you're posting about your dog, or boyfriend or cooking, label it “OT” so it can be safely ignored.  But don't withhold all that knowledge from the rest of us! 

    So, perhaps someone will Google “SafeWatch,“ find this post, read Code, install a Moose Z950, start writing code, and someday create a solution to scaling RSS.  You just never know. 

    -Brendan

  • Sorry Google, but I'm Quitting...

    I've been working for Google, giving out Gmail invites for a couple of weeks.  Well, they don't call it working, they call it “Invite a Friend” but really, I was working for them.  Now, they're going to pay me back of course - I fully intend to use as much of the 1G of space that they have given me and I will never, ever, click on an advertisement link.

    So I figure that I've signed them up around 30 people, and if those thirty people sign up 6 people each and so forth, you can quickly account for every human on the planet having a gmail account.  I did my part helping them, but  I do feel a bit duped by the whole private invite thing.  People were selling invites! Come on!

    Anyhow, the product is good so I don't mind having vouched for them, and hopefully I'm leaving them on good terms.

    -Brendan

  • Was I Blacklisted by Bloglines?

    I started trying out Bloglines about a week ago.  What I liked about it was the way I could publish my list of the blogs I'm reading. To me, this list is key.  It has taken me a year or so to filter and hone it so that I'm reading stuff I'm interested in.  The other cool thing is that you can see how many other bloglines users have subscribed to a particular  feed.  Of course, I subscribed to my own blog, just because.  I noticed that 15 other people had also, probably for lesser reasons.

    So the other day, I noticed that my blog had been removed from my list!  I didn't do this!  I assure you, I read my own blog all the time!  So I re-subscribed.  Now bloglines says that there's only 1 person subscribed to my blog.  Me!  So did everyone un-subscribe since last week?   Or, did the record and all FKs for my blog get deleted?   Was this an accident?  Am I being silenced?  I know that Microsoft is probably pretty worried about my WSMQ project taking market share from MSMQ but I doubt they'd do anything so sneaky. ;)

    Of course I'm not really that paranoid, but this does point out a potential problem when using these hosted blog readers.  You're putting your library of feeds in someone else's hands, and anything could happen.  If an obscure blog like my own was deleted from my list, I may not ever even know it was gone!  Even worse it may take me years to get those 15 people back!

    -Brendan

  • OT: Rock Music to Code By...

    I've been pretty excited about music lately.  I'm always listening, but lately, in the last year or so, there's been a lot of really good rock music around.  I think there's a zeitgeist going on, because others, even .net bloggers like Scott seem to be listening to the same stuff.  There's a lot happening in the UK right now - this seems to be the epicenter or this new revolution.  To see what I mean, check out Snow Patrol, Franz Ferdinand, and The Thrills. North America seems to be doing okay too with new bands like The Stills and Interpol. And the cool thing is that many of these bands are touring the US right now, so you can see them at a venue near you! 

    My theory (which is probably more obviousness than a theory)  is that the Internet, MP3 sharing and IPod-like things are fostering a growing revolution in music.  10 years ago, unless you lived in a big city, you would never find this stuff on your own. Today, the crap is slowing sinking to the bottom, and the good stuff is slowly floating to the surface. Hooray! In ten years, we'll have no more Brittany Spears... Wait, who am I kidding?  Anyway, perhaps we'll have less bands like Insane Clown Posse.

    Speaking of good stuff, I have to admit that I really like some of the music on the Internet talk show DotNetRocks.  I think Rory's songs are actually quite good, especially for a coder!  His stuff is in some strange and hard to define genre (that's good right?), but it's actually very listen-able, and he sings like a young Bono.

    Anyhow, enough rambling. 

    -Brendan

     

More Posts Next page »