A Blog by Scott Isaacs

Tag: Development Page 2 of 6

Curly Brace Placement

I’ve been writing code with curly braces for a dozen years or so, starting with C++ in college, then JavaScript for many, many years, and for the last few years, C#.  In all that time, I have been a fan of putting the opening curly brace on the same line as the declaration or control statement.  For example:

private void DoSomething() {    // ...    if (somecondition) {        myval = true;    }    // ...}

At work, though, I have been working on someone else’s code, and I always try as much as possible change my coding style to match the existing code.  In this case, that means opening curly braces get their own line, like so:

private void DoSomething() {    // ...    if (somecondition)     {        myval = true;    }    // ...}

I find that I’m actually starting to prefer the "new line" option.  But I don’t want to prefer it!  I guess maybe I’m stubborn.

I agree that it is easier to visually match opening and closing braces this way, but VS2008 does that for me anyway with clever highlighting.  Also, I don’t like how much extra room is taken in my editor window.  I like whitespace, but this seems to put it in the wrong place for me.

Sigh.  What’s a poor developer to do?

What’s your preference and why?

GiveCamp MKE

I’m very excited to announce that we are planning the first ever GiveCamp in the Milwaukee area: GiveCamp MKE.  In fact, it’s one of the first GiveCamps anywhere.

"What’s a GiveCamp?", you ask.  In short, it is an opportunity for developers, designers, DBAs, project managers and anyone else involved in the software development process to give back to the community.  And we do it by doing what we know how to do best — building software.  We will soon be accepting applications from various charities for software that they need.  It could be anything from a website to a data collection app to a mailing list manager or anything else.  For more information about the whole GiveCamp concept, and to see what other communities have had (or are planning) GiveCamps, please visit the official GiveCamp site.

We’ve been putting a lot of time into this over the last couple weeks, but we’re still not quite there.  Please bear with us as we continue to finalize things, including the website itself as well as more info about the GiveCamp MKE event.  Rest assured that we will be making regular updates to the GiveCamp MKE site, so please check it often or subscribe to the RSS feed to make sure you don’t miss anything.  I’m sure I will also post major updates here as well.

I am very excited about this, and how things are shaping up.  Remember that conference call I wrote about a couple weeks ago?  That was about this.  I just wish I could put all of the things I want to say into words tonight before I fall asleep, but that might take me a couple hours.  :)  So keep checking back here and at the GiveCamp MKE site, and I’ll eventually get it all out there.

If you have any questions or comments, please don’t hesitate to let me know, or to use the contact form on the GiveCamp MKE site.

TimeSnapper

I’ve been using the free version of TimeSnapper off and on for some time now, but pretty regularly over the last few weeks since I started my new job.  I’m doing billable work again, and am notoriously bad at getting my time entered.  TimeSnapper helps by taking screenshots at some interval throughout the day and allowing me to play them back like a movie.

I’ve been thinking about getting the Pro version for a couple weeks because there are a few more features that could be helpful.  It’s an inexpensive program at about $40 (USD), but I just hadn’t pulled the trigger and bought it.  Then today on Twitter I saw that it was on sale.  It was actually on sale for $20.  Since I was on the fence at $40, I couldn’t pass it up at $20.

If you are like me and have a hard time keeping track of what you worked on, I highly recommend you check it out.  I still haven’t taken advantage of the Pro features, but even the free functionality is worth $20.

.NET Micro Framework

Just got a book in the mail from Amazon: Embedded Programming with the Microsoft .NET Micro Framework.  It was only about $6 from the "Used and New" section of alternate sellers.

An upcoming project at work is currently planned for Compact Framework, but, if my limited understanding is right, hardware needed for the Micro Framework is cheaper.  So as long as it will perform as needed, this might be the way to go.

Has anyone done any development with the .NET Micro Framework yet?  Any pointers or pitfalls?

I Was Wondering When This Would Happen

Silverlight 1.1 becomes Silverlight 2.0. (Thanks for the heads up, Dave.)

Now I just have to find a way to get to Mix ’08 next year.

Issue Tracking and Help Desk

What software do you use for issue tracking (feature requests, bugs, etc.) and help desk?  I’m looking for something here at work.  Has anyone used Axosoft OnTime?  I don’t want something hosted as a service (I want to install it here).  Also, I don’t want something that costs a fortune, but I don’t necessarily have to have a free/OSS piece of software either.  Just looking for something good and easy to use, preferably built on MS stack, but that’s not required.

Contact me with any suggestions or leave a comment here.

Microsoft To Make .NET Framework Source Code Available

Dave Bost just e-mailed and posted about this — Microsoft is making the source code to the .NET Framework available.  From Scott Guthrie’s blog:

We’ll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows).  We’ll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ).  The source code will be released under the Microsoft Reference License (MS-RL).

I think this is a big step for Microsoft and for Microsoft developers like myself.  It could be a great learning tool, letting us see how things are happening behind the scenes (without having to make use of something like Reflector).  I also like the fact that we can step into the code when debugging (see ScottGu’s post for more about this).

Sure, it’s not “open source” in that we can’t make changes to the code, but I’m not so sure I would want that anyway.  I’m looking forward to it.

Sunday Afternoon Reading

Work has been killing me lately (the last several months), but things are starting to calm down and I think I only worked about 45-50 hours last week. 

I spent yesterday with the family at the zoo.  Charlie has been to the zoo more times in her 12 months of life than I had been in the 31 years before she was born.  She likes any animal that is moving, and she absolutely loves the carousel.  Kelly’s sister has a zoo pass and the three of them (Kelly, Charlie and Aunt Katie) have gone many times over the past spring and summer.

Book CoverSo anyway, today I thought I’d take some time to either work on some side projects or try to pick up some knowledge on some newer bit of tech that I haven’t been able to use yet.  I decided to finally try (again) to play around with some WPF stuff.  I don’t have an immediate use for it, but there is some upcoming stuff at work that I might like to create with WPF.

Previously I’ve played around a little with it in VS and Blend, just to sort of get a feel for it.  Today, though, I thought I’d read and have a little more structured learning.  Fortunately, I had a copy of Charles Petzold’s WPF book in the home office (Applications = Code + Markup), so I grabbed it and started flipping through it — structured flipping, of course.  I read a few pages and then started scanning through the book to see if there were any topics that seemed to particularly interest me.  That’s when I finally got to page 611.

Page 611As you can see, Mr. Petzold must have been busy with other things at the moment he was writing this page.  Maybe he was thinking, “Hmm, 611.  That’s the number I call to connect directly to my phone company.”  Or maybe he knows someone born on June 11?  I don’t know what it was, but he forgot to include part of the page.

Or maybe it’s not his fault at all, and some rogue employee at the publisher decided to sabotage the book?

Page 612The strangest part of all of this is that there is also part of page 612 missing.  Coincidence?  Unlikely.

I’m not sure what to do.  This is very discouraging.

Maybe I should give up on reading and go outside or something.

New Tool: Folder Finder

I’m on a roll here with the little utilities…

My dad called the other day as he was leaving his office (in California).  Due to the nature of his business and the way their network is setup, he and his team work with a large number of folders on a network share.  Each of these folders contains information about a particular project or potential project, and they are all contained within a single parent folder.  For example, the parent folder might be P:\Projects, and there may be hundreds of project folders such as P:\Projects\Project 023A, P:\Projects\Project 023B.  I don’t really know the names of the folders (I just made those up), but the names mean something to him and his team.

At any given time, though, there could be a couple hundred folders in the project folder.  Some come and some go, but overall the number seems to be increasing.  So it is getting harder for them to find the necessary folder when they need to do some work or reporting for that project.

FolderFinderNow, I can imagine that there is plenty of room to engineer some system (or buy something) that will help them better manage this, but what he really needed right away was a faster way to find a folder.  So I wrote Folder Finder.

It’s a very simple app to use and I only spent a couple hours on it.  Basically, you download the app and place it anywhere you want (.NET 2.0 required).  You run it and choose a base folder, which gets saved and re-used each time you run the app (C:\Projects in my example).  Then you just start typing a portion of the folder name.  Since the names mean something to you, just type the part you know.  It doesn’t matter if it is the beginning, middle or end of the folder name.  The list filters automatically.  At anytime you can double click your folder to open it, or if it is the first in the list you can simply press Enter.

That’s it.  All there is to it.  It doesn’t do anything super high-tech or magical.  It just lets them find their folders faster.

So if you want to download and use it, feel free.  As always, use it at your own risk, but I’d appreciate it if you’d let me know if you use it — especially if you have any comments or suggestions.  Also, feel free to share it with anyone who might think it is useful.  If anyone wants the source for any reason, let me know and I’ll make it available.

Interop Issue With Winsock

Error: Method ‘~’ of object ‘~’ failed

So yesterday at work, I was working with a sample app from one of our product vendors.  The app was a VB6 Windows EXE showing how to interact with their equipment using sockets — Winsock.  Since I’m under some pretty heavy time constraints, I wanted to make use of this code rather than pick through it and see what’s happening and translate to .NET.  I was able to quickly turn the VB6 Win EXE into a VB6 COM DLL, and tested it from a VB6 test app, and it worked perfectly.  However, when I reference the DLL from my .NET test app, things were not so great.

I had a few methods in the COM DLL that I was calling from my .NET code:

  1. Sub Connect — news up the Winsock object, sets the remote host and port, then connects.
  2. Sub DoSomethingWithWinsock (not the real name, but I don’t have the code here to look up the real name, but rest assured, it was equally as descriptive) — does a bunch of unimportant stuff, and then calls Winsock.Send(…)
  3. Function TestMethod — returns the current date/time as a string for testing
  4. Sub Disconnect — closes Winsock and sets it to nothing

When I call methods 1, 3 or 4 all seems to work well.  When I call method 2 I get the error mentioned above: Method ‘~’ of object ‘~’ failed.

So, two questions to anyone that might read this:

  1. Any idea what the problem is and how to resolve it?
  2. Is there some way I can step into the VB6 code while debugging from VS2005?

I’ve already started picking through the code and rewriting with .NET equivalents, but I was hoping to avoid that.

Update: Sarma, a contractor that I’ve worked with recently, e-mailed me this link that has some good info.  I haven’t tried it yet, but it sounds promising.  If you’re looking to debug VB6 from VS, I’d definitely check it out.  Thanks, Sarma! 

By the way, Sarma was recently looking for a new contract.  If anyone is hiring, contact me and I’ll connect you.

Page 2 of 6

Powered by WordPress & Theme by Anders Norén