Monday, February 28, 2005

World Wind

NASA Ames Research Center OpenSource Project Home Page http://learn.arc.nasa.gov/worldwind/

Words of wisdom

"Do not allow "scope creep" (changes to your initial project objectives) to enlarge your effort. Stick your original idea; generate a "requirements" document, make a list of things you need to do, organize the list (assign the tasks, determine resources you need), and then do.

Why building software is not like building bridges

Taken from Steve Row's blog (http://blogs.msdn.com/SteveRowe/archive/2005/02/28/381910.aspx)

I was having a conversation with a friend the other night and we came across the age-old “software should be like building buildings” argument. It goes something like this: Software should be more like other forms of engineering like bridges or buildings. Those, it is argued, are more mature engineering practices. If software engineering were more like them, programs would be more stable and projects would come in more on time. This analogy is flawed.

Before I begin, I must state that I’ve never engineered buildings or bridges before. I’m sure I’ll make some statements that are incorrect. Feel free to tell me so in the comments section.

First, making software, at least systems software, is nothing like making buildings. Engineering a bridge does not involve reinventing the wheel each time. While there may be some new usage of old principles, there isn’t a lot of research involved. The problem space is well understood and the solutions are usually already known. On the other hand, software engineering, by its very nature, is new every time. If I want two bridges, I need to engineer and build two bridges. If I want two copies of Windows XP, I only engineer and build it once. I can then make infinite perfect copies. Because of this software engineering is more R&D than traditional engineering. Research is expected to have false starts, to fail and backtrack. Research cannot be put on a strict time-line. We cannot know for certain that we’ll find the cure for cancer by March 18, 2005.

Second, the fault tolerances for buildings are higher than for software. More often than not, placing one rivet or one brick a fraction off won’t cause the building to collapse. On the other hand, a buffer overflow of even a single byte could allow for a system to be exploited. Buildings are not built flawlessly. Not even small ones. I have a friend who has a large brick fireplace inside their room rather than outside the house because the builders were wrong when they built it. In large buildings, there are often lots of small things wrong. Wall panels don’t line up perfectly and are patched over, walls are not square to each other, etc. These are acceptable problems. Software is expected to be perfect. In software, small errors are magnified. It only takes one null pointer to crash a program or a small memory leak to bring a system to its knees. In building skyscrapers, small errors are painted over.

Third, software engineering is incredibly complex—even compared to building bridges and skyscrapers. The Linux kernel alone has 5.7 million lines of code. Windows 98 had 18 million lines of code. Windows XP reportedly has 40 million lines of code. By contrast, the Chrysler building has 391,881 rivets and 3.8 million bricks.

Finally, it is a myth that bridge and building engineering projects come in on time. One has to look no further than New Jersey’s Big Dig project to see that. Software development often takes longer and costs more than expected. This is not a desirable situation and we, as software engineers, should do what we can to improve our track record. The point is that we are not unique in this failing.

It is incorrect to compare software development to bridge building. Bridge building is not as perfect as software engineers like to think it is and software development is not as simple as we might want it to be. This isn’t to excuse the failings of software projects. We can and must explore new approaches like unit tests, code reviews, threat models, and scrum (to name a few). It is to say that we shouldn’t ever expect predictability from what is essentially an R&D process. Software development is always doing that which has not been done before. As such, it probably will never reliably be delivered on time, on budget, and defect free. We must improve where we can but hold the bar at a realistic level so we know when we've succeeded.

Code metrics tools

.NET Control Gallery

This site has a list of UI controls that can be used in .NET projects. Most of them deal with creating the look and feel of XP. Windows Forms : Control Gallery

Friday, February 25, 2005

CTP = Community Technology Preview

ChangeThis :: How To Be Creative

ChangeThis :: How To Be Creative

ChangeThis :: The Six Laws of the New Software

ChangeThis :: The Six Laws of the New Software

ChangeThis :: How to Manage Smart People

ChangeThis :: How to Manage Smart People: "How to Manage Smart People"

Never send an email in outlook, without the attachment

How many times have you got an email that says, Oops, you forgot to attach the attachment. Here is a macro that will remedy that. It basically checks your email for the word "attach". If it finds it, then it checks to see if you have an attachment with the email, otherwise, it will prompt you to attach the file. Here are the steps. (1 to 4, show you how to open the VBA script editor; the rest, where to drop the script) 1. Start Outlook 2. Tools | Macros | Security 3. Choose “Medium”, which will prompt you on whether or not you want to run macros (VBA). You may need to restart Outlook at this point in order for that setting to take effect. 4. Tools | Macros | Visual Basic Editor 5. In the Project window (normally on the left of the editor window), goto to the Microsoft Office Outlook Objects tree item. Under this item, you should see the the item "ThisOutlookSession" 6. Double click on the "ThisOutlookSession" item. This should open a code window on the right. 7. The code window will have two drop down bars. 8. Choose Application from the left drop-down bar. and ItemSend from the right drop down bar. 9. Between the lines Private Sub Application_ItemSend(ByVal Item as Object, Cancel as Boolean) and End Sub add the following lines of code. Dim lngres As Long If InStr(1, Item.Subject, "attach") <> 0 Then If Item.Attachments.Count = 0 Then lngres = MsgBox("'Attach' phrase in caption, but no attachments - send anyway?", _ vbYesNo + vbDefaultButton2 + vbQuestion, "Attachment warning") If lngres = vbNo Then Cancel = True End If End If If InStr(1, Item.Body, "attach") <> 0 Then If Item.Attachments.Count = 0 Then lngres = MsgBox("'Attach' phrase in body, but no attachment - send anyway?", _ vbYesNo + vbDefaultButton2 + vbQuestion, "Attachment warning") If lngres = vbNo Then Cancel = True End If End If 10. close the visual basic editor window. 11. test Outlook by sending an email with any word containing attach (attached, attachment, etc), but without attaching anything to the mail. You should get a warning about no attachments being included. (this idea was borrowed from an MSDN blog post that I had seen)

ZBB - zero bug bounce

At Microsoft there is a stage of the development called ZBB or "zero bug bounce." ZBB basically means that the software teams have taken care of all their open bugs for the current milestone and are ready to transition to the next milestone. ZBB is a cause of much celebrating on the part of the teams since it can be a hard drive to hit the ZBB dates.

Thursday, February 24, 2005

ComputerZen.com - Scott Hanselman's Weblog - Building your own Windows Media Center Edition 2005 Home Theater PC System

ComputerZen.com - Scott Hanselman's Weblog - Building your own Windows Media Center Edition 2005 Home Theater PC System: "Building your own Windows Media Center Edition 2005 Home Theater PC System This person built one from scratch for around $1500. Here's what he did: * AHANIX D6 Media Center Black Enclosure With 350W SATA Power Supply & VFD Display, Model 'X236' * Intel 'BOXD925XCVLK' 925X Chipset Motherboard For Intel LGA 775 CPU * Intel LGA 775 Pentium 4 540J 3.2 GHz, 800MHz FSB, 1MB L2 Cache w/ Hyper Threading Technology * CORSAIR VALUESELECT Kit 240-Pin 1GB(2 x 512MB) DDR2 PC2-4200, Model VS1GBKIT533D2 * SAPPHIRE ATI RADEON X600 XT Video Card, 256MB DDR, 128-Bit, DVI/VIVO, PCI Express, Model '100594L' * ATI HDTV Wonder Remote Control Edition PCI TV Tuner, Model '100-714127' * Sapphire Theatrix Theatre 550Pro PCI TV Tuner Card with Remote Control, Model '100104SR' * Maxtor 250GB 7200RPM SATA Hard Drive, Model 6B250S0 * Microsoft Windows XP Media Center 2005 * Remote Control with Receiver for Microsoft Windows XP Media Center * Lite-On 16X, Dual Layer DVD /-RW Drive, Model SOHW-1633S Black This system is totally HD ready, and the person said he taped 11 hours of 1080i SuperBowl content into about 43gigs without a hitch. He's using it as his primary PVR now.

Wednesday, February 23, 2005

Ultimate Developer and Power Users Tools List

From Scott Hanselman's Ultimate Developer and Power Users Tools List http://www.hanselman.com/blog/content/radiostories/2003/09/09/scottHanselmansUltimateDeveloperAndPowerUsersToolsList.html
  • SlickRun - What a wonderful thing. Check out SlickRun. It's fast and small. t's a resizable, floating text box. It does autocomplete for commands and for directories. You can type C:\doc and you're in documents and settings. Awesome. Faster than Dave's Search, and easier than ActiveWords. I shall delete my half-assed attempt at the ZenBar immediately and bow to Bayden Systems.
  • Jeff Key's Screen Ruler - Transparent and written in .NET. A great pixel ruler for you pixel pushers.
  • APIViewer 2003 - A database and browser of the Win32API, similar to the old win32api.txt file that was distributed with VB6. Includes 6500 function declarations and 55000 constants.
  • Application Profiler - A great GotDotNet sample, a tool for visualizing and analyzing allocations on the GC heap. Has a GREAT graphical view
  • Anakrino - The original .NET decompiler.
  • Denis Bauer's ASP.NET Version Switcher - The ASP.NET Version Switcher is a little utility that can be used to quickly switch the .NET Framework version that the ASPX pages are compiled against. This is helpful for developers who often have to test their web applications for compatibility with different version of the .NET Framework.
  • BootDisks.com - I've downloaded and saved everything from BootDisks.com, including Win95 and Win98 boot disks and a DOS 6.22 disk.
  • DllFiles - You never know when you might need an old-ass dll.
  • Adam Nathan's CLRSPY - A diagnostic that looks at .NET 1.1 Customer Debug Probes, in-freaking-valuable.
  • Stoyan Damov's KBView - A Microsoft Knowledge Base Viewer Applet
  • Dave's Quick Search Bar - The best thing to happen to the Windows interface since the Command Prompt. Totally configurable, and less invasive than the Google Search Bar.
  • PowerMenu - Great little hook that adds item to the System Menu that let you change the Transparency or Priority of the current window.
  • ProxyChanger (ja-JP) - A convenient little util if you need to change between proxies at various locations.
  • Lutz's Reflector (and all his other tools) - Now the easiest .NET object browser, decompiler (to C# as well!), and includes a great member search feature.
  • RoboCopy - When COPY and XCOPY just won't cut it, try the "Robust Copy"
  • Aaron Skonnard's Xml Utilities - Includes command line .NET utils to check for wellformedness, validity, and perform xslt transforms. These belong in your PATH!
  • Eric J Smith's CodeSmith - Oh, yes, it's much more than just a Strongly Typed Collection Generator. It's a complete code-generation engine with an ASP.NET-like syntax. Very extendable, very powerful, very free. And, only $199 for the source. And all is right with the world. I've used it to generate THOUSANDS of lines of code. There's a learning curve, but the benefits are immense. It's worth the download just for the Strongly Typed Collection code from Chris Nahr.
  • Jeff Key's Snippet Compiler - Sits quietly waiting for you to test a quick snippet of code or algorithm. No need to even start VS.NET!
  • NUnitAddIn - Makes integrating NUnit into your life easy by integrating NUnit into VS.NET! Right Click | Test. Glorious.
  • Virtual TI-89 [Emulator] - Sometimes CALC.EXE doesn't cut it, and I want a REAL scientific calculator for Windows, so I emulate the one I used in college.
  • Virtual CD ISO Image Mounter - This is the utility that is up on BetaPlace and is usually released to MSDN Subscribers. It lets you mount an ISO image as a Drive Letter...nice to keep a library of CDs around on a Firewire drive. It's not something I can distribute, but you can always use...
  • Nero 6 and ImageDrive - Nero 6 is a fantastic value and the greatest burning suite out there. It also include ImageDrive that let's you make and mount ISO images.
  • Visibone HTML/JavaScript Reference - These guys make a great physical paper reference, but they also have a great .HTML file you can download for free that has ASCII charts and Color references. It's a link I keep close by.
  • VisualXPath - A nice GotDotNet project that runs XPath Queries interactively and displays the results. Also useful for quick coarse timing of query speed.
  • Web Services Studio 2.0 - .NET Webservice Studio is a tool to invoke Web Services interactively. The user can provide a WSDL endpoint and it generates the .NET Proxy immediately.
  • SoapScope 2.0 - Your one stop shopping center for SOAP Debugging, WSDL Analysis and SOAP Traffic Tracing.
  • WhoAmI Administration Wallpaper Tool - If you log into a lot of boxes remotely and always wonder, where the hell is this? The WhoAmI wallpaper tool creates custom wallpapers with all the information you'd need, like IP Address, Box Name, Disk Space, and it's totally configurable.
  • Xenu's Link Sleuth - Xenu's Link Sleuth (TM) checks Web sites for broken links. Link verification is done on "normal" links, images, frames, plug-ins, backgrounds, local image maps, style sheets, scripts and java applets. It displays a continuously updated list of URLs which you can sort by different criteria.
  • DeveloperPlayground - Jonas Blunck and Kim Gräsman's great DLL dependency tool, also hooks any process and traces calls to externals DLL
  • Alintex .NET Scripting Host - Allows you to create scripts (like like VBS files, etc) except with .NET. Also a great prototyping tool.
  • AutoRuns - I always am suspicious that someone is running something automatically on my system. AutoRuns (from SysInternals) checks EVERYWHERE that could be running something, the registry, win.ini (remember those?), the Startup Group, etc...
  • ActiveXplorer v4 - A file manager and analyzer for COM objects...a little higher level than OleView and easier to understand.
  • BinType2.exe - Ever want to check a VB6 COM dll to see if it's been appropriately compiled with "Retain in Memory" and "Unattended Execution" set to true for correct execution under MTS?
  • Clemen's BuildDay.exe - Great commandline util that you should put in your path. Returns the last digit of the year and the number of the day. Great for batch files that create daily builds, log files, etc.
  • Microsoft MDAC Component Checker - Utility to diagnose and deal with MDAC compatibility and versioning problems.
  • Billy Hollis' ChalkTalk - Great for Presentations, let's you write directly to the screen like John Madden.
  • CommandBar for Explorer - This tool extends explorer with functionality of a command prompt. Implemented as a band object completely in C#. Demonstrates COM Interop and P/Invoke, windows hooking and API interception. Finally you can run all these .Net SDK tools and ‘Hello World!’ programs without leaving explorer shell. Definitely turns heads if you use it in a presentation.
  • Aurigma COM to .NET - Great tool that simplifies moving from COM to .NET. Analyzes COM objects and shows how to implement that interface with .NET Interop Attributes, etc. Also allows deployment of wrapped COM objects for use with .NET applications, without requiring COM registration!
  • Kenny Kerr's DisplayLogonServer - Small app that tells you what Logon Server serviced your domain login. He also has a nice tool that cleans VSS files out of your project folders.
  • DxRuler - Great transparent ruler application that overlays a grid of lines over whatever you drag the window over. Good for any kind of interface design, and a great demo of useful transparancy.
  • Marc Merrit's Event Log Monitor (EventReader) - Sits in the tray and pops up a nice XP-style baloon whenever the event log is written to. I hate tray icons but I love balloon tooltip info, so it's a good tradeoff.
  • FeedReader - The first RSS reader I used. I don't think it's being worked on anymore, but I keep it around because it's lightweight and I'm nostalgic.
  • Fesersoft's VS.NET XSLT 1.0 Schema - Enables Intellisense for XSLT 1.0 documents in Visual Studio.NET
  • FileMon and just about everything SysInternals has ever produced - Displays file system activity in REAL TIME. Just who is that writing to the disk right now?
  • Filter Files with Unknown Extensions for XP - Chris Sell's provides a .REG file that let's explorer's find files with file extensions that are not known. A real irritant with XP, fixed.
  • FindUser by Rich MacDonald - Given a Domain name and User name, tells you what systems that user is currently logged in to. (Not sure where to find this, Rich's site is now bare)
  • fLogViewer - Great freeware highlighting log viewer for large log files.
  • XmlSpy - Just buy it.
  • GhostIt - Little tray app that lets you ghost (make transparent) any window by clicking on it.
  • HightLight for Windows - Highlight is a universal sourcecode converter for Linux and Windows, which transforms code to HTML, XHTML, RTF, LaTeX or TeX - files with syntax highlighting. (X)HTML output is formatted by CSS.
  • IECookiesView 1.5 from NirSoft - Nice clean interface to snoop contents of the cookies on your box in IE.
  • ieHttpHeaders - Internet Explorer "Explorer Bar" that shows the HTTP Headers as you browse. Invaluable for quickie debugging. More great stuff from Jonas Blunck.
  • COMTrace - Hooks and lets you see COM "traffic" on processes on your system. Intercepts COM calls on any interface. Has saved my ass 3 times.
  • JR Screen Ruler - Alternative Screen Ruler. Literally, it's a ruler you can 'virtually' measure things with. Nice when you have to get down to the pixel.
  • Zoomin - The original, now with Source from Brian Friesen. If you've seen me talk, you've seen ZoomIn, and hopefully it saved your eyes.
  • MSICleaner - This is a small cleaner for those irritating files that don't seem to be deleted from WINNTInstaller (should probably work on Win98, too). You may notice that loads of nonreferenced files from all your work on the installations are left behind, and this tool helps to keep your machine clean.
  • NetPing - Jeff Key's multi-threaded pinger...it continues to include new features, like right-click and launch Remote Desktop. Great for administration of small networks. I use it all the time.
  • Magical Jelly Bean KeyFinder - Misplace your Windows and Office Product Keys? Find them with this.
  • NetworkDriveInfo - Helps you find free drive space on remote systems.
  • UrlRun plugin for Outlook - From Tim Tabor based on Chris Sells' UrlRun. Lets you right-click on messed-up and wrapped URLs in Outlook and launch the browser without manually fixing the URL. Chris Sells says "It's pure sex."
  • Speak-n-stop - Little timer util that you start when you begin a presentation and it warns you when your speaking time is running out.
  • IE Booster 2 - A collection of extensions to Internet Explorer like HTML Detective, Copy Meister, and Page Analyzer.
  • YATT by Simon Fell - Yet Another Trace Tool, requires WinPCAP, when you just need to sniff some packets.
  • PPXML - Command-Line XML Pretty Printer
  • ProxyTrace - Often better and less trouble than the Soap Toolkit's SOAPTrace.
  • PSTools from SysInternals - All the command-line tools that Windows forgot...kill, loggedon, remote exec, shutdown, getsid, etc.
  • QuickCode.NET - Lets you turn short phrases in Visual Studio.NET like "prop int test" into a complete property getter and setter with xml documentation, etc. Configurable and the snippets are shareable.
  • Roy Osherove's Regulator - Roy enters the RegEx fray with a bang, and with syntax highlighting and web services integration with regexlib.com. The very definition of slick.
  • Eric Gunnerson's Regular Expression Workbench - Nice .NET interactive Regular Expression builder.
  • Expresso is a new free tool for working with regular expressions in .NET.
  • RegexDesigner.NET from Chris Sells
  • The Regular Expression builder inside of SharpDevelop (which is worth the download just to read the SharpDevelop code!)
  • Reggie - Not a regular expression tool, not it's a BETTER RegSvr32.exe from Shawn Van Ness. It provides better error handling and messages. It doesn't suck.
  • SCCSwitch - Harry Pierson's ruthlessly competent Source Control Provider switcher for VS.NET. Great if you are using Vault, VSS and CVS like me.
  • Who's Locking? - WhosLocking.exe lets you know what application is locking that DLL you're trying to delete!
  • TrueName - Right click a file in Explorer and find out it's TRUENAME (Remember the Truename.exe?) The 8.3 name of My Documents might be C:DOCUME~1SHANSELMMYDOCU~1.
  • Sid2User - CommandLine Util to take a SID and get a Real Name to, for example, get the local name of the "Everyone" user.
  • SummerProperties - a Shell Extension that adds a Tab to File Properties that calculates the file's checksum.
  • TamperIE - Let's you intercept and tamper with Form Posts from within IE...
  • Zoltan's TaskManagerEx - Extends the existing TaskManager with a new menu and CPU Alerts, colors Services, modules in use, etc.
  • TextView 5.0 - Freeware Text Viewer that lets you run through many directories with many files, much like explorer, except everything is one click.
  • VisiCalc (vc.exe) - Because I just like having a copy of VisiCalc in my utils folder. I use it occasionally.
  • Fritz Onion's ViewStateDecoder - Simple util that gives you more insight into what's hidden inside of ASP.NET's ViewState (hidden form field)
  • DevelopMentor's Tools Page - Everything here is golden.
  • RealVNC - When RemoteDesktop is a hassle and PCAnywhere is lame...VNC stands for Virtual Network Computing. It is remote control software which allows you to view and interact with one computer (the "server") using a simple program (the "viewer") on another computer anywhere on the Internet.
  • VS.NET Command Prompt Here - INF files to create Right-Click menus for "Visual Studio.NET 2003 Command Prompt here." I use this dozens of times a day. I should probably just keep the window open, eh?
  • WHICH - It's which and it's back. Wondering WHICH copy of that .exe is being run first in the path? Run "which calc.exe"
  • WhiteBoard Photo - Has to be seen to be believed. Takes a skewed low-contrast, bad photo of a Whiteboard and automatically corrects it and offers up a clean white sheet of paper with a color corrected and keystoned photo of your whiteboard. Check out the demo.
  • URL Bandit - Monitors the clipboard and saves all URLs that go by in the click-stream. If you copy a 1 meg file to the clipboard, URL Bandit can find, for example, all 200 URLS within it. Yum.

What great .NET developers ought to know

Excerpted from http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx

What Great .NET Developers Ought To Know

Everyone who writes code

  • Describe the difference between a Thread and a Process?
  • What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
  • What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
  • What is the difference between an EXE and a DLL?
  • What is strong-typing versus weak-typing? Which is preferred? Why?
  • Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.
  • What is a PID? How is it useful when troubleshooting a system?
  • How many processes can listen on a single TCP/IP port?
  • What is the GAC? What problem does it solve?

Mid-Level .NET Developer

  • Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
  • Describe what an Interface is and how it’s different from a Class.
  • What is Reflection?
  • What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
  • Are the type system represented by XmlSchema and the CLS isomorphic?
  • Conceptually, what is the difference between early-binding and late-binding?
  • Is using Assembly.Load a static reference or dynamic reference?
  • When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
  • What is an Asssembly Qualified Name? Is it a filename? How is it different?
  • Is this valid? Assembly.Load("foo.dll");
  • How is a strongly-named assembly different from one that isn’t strongly-named?
  • Can DateTimes be null?
  • What is the JIT? What is NGEN? What are limitations and benefits of each?
  • How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
  • What is the difference between Finalize() and Dispose()?
  • How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
  • What does this useful command line do? tasklist /m "mscor*"
  • What is the difference between in-proc and out-of-proc?
  • What technology enables out-of-proc communication in .NET?
  • When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

Senior Developers/Architects

  • What’s wrong with a line like this? DateTime.Parse(myString);
  • What are PDBs? Where must they be located for debugging to work?
  • What is cyclomatic complexity and why is it important?
  • Write a standard lock() plus “double check” to create a critical section around a variable access.
  • What is FullTrust? Do GAC’ed assemblies have FullTrust?
  • What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
  • What does this do? gacutil /l | find /i "Corillian"
  • What does this do? sn -t foo.dll
  • What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
  • Contrast OOP and SOA. What are tenets of each?
  • How does the XmlSerializer work? What ACL permissions does a process using it require?
  • Why is catch(Exception) almost always a bad idea?
  • What is the difference between Debug.Write and Trace.Write? When should each be used?
  • What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
  • Does JITting occur per-assembly or per-method? How does this affect the working set?
  • Contrast the use of an abstract base class against an interface?
  • What is the difference between a.Equals(b) and a == b?
  • In the context of a comparison, what is object identity versus object equivalence?
  • How would one do a deep copy in .NET?
  • Explain current thinking around IClonable.
  • What is boxing?
  • Is string a value type or a reference type?
  • What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?
  • Why are out parameters a bad idea in .NET? Are they?
  • Can attributes be placed on specific parameters to a method? Why is this useful?

C# Component Developers

  • Juxtapose the use of override with new. What is shadowing?
  • Explain the use of virtual, sealed, override, and abstract.
  • Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
  • Explain the differences between public, protected, private and internal.
  • What benefit do you get from using a Primary Interop Assembly (PIA)?
  • By what mechanism does NUnit know what methods to test?
  • What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
  • What is the difference between typeof(foo) and myFoo.GetType()?
  • Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
  • What is this? Can this be used within a static method?
Developers using XML
  • What is the purpose of XML Namespaces?
  • When is the DOM appropriate for use? When is it not? Are there size limitations?
  • What is the WS-I Basic Profile and why is it important?
  • Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include elements from both namespace.
  • What is the one fundamental difference between Elements and Attributes?
  • What is the difference between Well-Formed XML and Valid XML?
  • How would you validate XML using .NET?
  • Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes("//mynode");
  • Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax)
  • What is the difference between XPathDocument and XmlDocument? Describe situations where one should be used over the other.
  • What is the difference between an XML "Fragment" and an XML "Document."
  • What does it meant to say “the canonical” form of XML?
  • Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve?
  • Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?
  • Does System.Xml support DTDs? How?
  • Can any XML Schema be represented as an object graph? Vice versa?

Tuesday, February 22, 2005

A survey of various efforts to catalog patterns for enterprise software development.

Whats the difference between Control.Invalidate, Control.Update and Control.Refresh? (.NET)

Control.Invalidate() v/s Control.Update() v/s ControlRefresh()

Before discussing each one of the above functions, let’s look at how winforms controls paint.

Windows controls paint is response to WM_PAINT messages. This message is sent when UpdateWindow or RedrawWindow is called, or by the DispatchMessage function when the application gets a WM_PAINT through the message queue. On getting the WM_PAINT message, the control paints its background and then the foreground if necessary. Double-buffering and transparency is honored while painting and then the OnPaint event is fired to give the user a chance to perform his custom painting.

With this background, let’s look at the above mentioned three functions in more detail,

Control.Invalidate( ) / Control.Invalidate(bool) / Control.Invalidate(Rectangle) / Control.Invalidate(Rectangle, bool) / Control.Invalidate(Region) / Control.Invalidate(Region, bool)

The bool parameter denotes whether the user wants to invalidate the child controls of the control on which he is calling Invalidate. The Rectangle parameter are the bounds to invalidate and the region parameter is the region to invalidate. All the overloads essentially end up calling one of the RedrawWindow, InvaliateRect or InvalidateRgn functions. If RedrawWindow is called then this may result in a WM_PAINT message being posted to the application message queue (to invalidate the child controls).

The important thing to note here is that these functions only “invalidate” or “dirty” the client area by adding it to the current update region of the window of the control. This invalidated region, along with all other areas in the update region, is marked for painting when the next WM_PAINT message is received. As a result you may not see your control refreshing (and showing the invalidation) immediately (or synchronously).

Control.Update()

Update function calls the UpdateWindow function which updates the client area of the control by sending WM_PAINT message to the window (of the control) if the window's update region is not empty. This function sends a WM_PAINT directly to WNDPROC() bypassing the application message queue.

Thus, if the window update region is previously “invalidated” then calling “update” would immediately "update" (and cause repaint) the invalidation.

Control.Refresh()

By now, you might have guessed what Refresh( ) would be doing. Yes, it calls Invalidate(true) to invalidate the control and its children and then calls Update( ) to force paint the control so that the invalidation is synchronous.

Monday, February 21, 2005

Sysinternals Freeware - Utilities for Windows NT and Windows 2000

Sysinternals Freeware - Utilities for Windows NT and Windows 2000 This site has some great system utilities. Some of these are indispensible if you are a developer. Tools that I love: .Net Reflector CPUMon v2.0 http://www.sysinternals.com/ntw2k/freeware/cpumon.shtml DiskMon v2.0 http://www.sysinternals.com/ntw2k/freeware/diskmon.shtml FileMon v6.12 http://www.sysinternals.com/ntw2k/source/filemon.shtml Process Explorer v9.0.1 (very good) http://www.sysinternals.com/ntw2k/freeware/procexp.shtml RegMon v6.12 (another very useful tool) http://www.sysinternals.com/ntw2k/source/regmon.shtml Autoruns v6.1 (very useful to see what applications are automatically loaded on your system) http://www.sysinternals.com/ntw2k/freeware/autoruns.shtml

WinDirStat Home Page

WinDirStat Home Page WinDirStat is a disk usage statistics viewer and cleanup tool for Microsoft Windows Free and very useful.

Debugging applications that arent started up directly

Very often, we have to create applications that arent executed directly. Instead these applications are started by another app. An example : Our company develops GIS tools for SocetSet and Imagine. Our application is loaded when the user clicks on a menu option in the main executable of SocetSet or Imagine. To debug our application, we normally load it up from the main applications menu. Once our app is running, we use the Attach to process option to start the debuger. Here is another more convenient method. http://weblogs.asp.net/junfeng/archive/2004/04/28/121871.aspx its using the Image File Execution option. Every application that loads checks with some registry settings. One of these is the debugger key under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options by setting the debugger option, you can have your application automatically load the debugger - so that you can step through it. Pretty cool.

Home design Software

When we decided to buy our home (which is being constructed) I had to look quite a bit to figure out which of the myriad applications availble was worth shelling out the cash for. The one that I decided to shell out the moolah for, was Punch Software's Professional Platinum software (v8.0). I found that this software was very fast in rendering 3d views from your plans. Though my only gripe was that the user interface is not very intutive and takes some learning. Also there are no wizards that help you do the setup. For that matter the documentation is not very good too. But with some work I got my stuff working and got very good results. I think if you are the kind of person who is willing to explore the software and take on a steep learning curve - you will definetly like this software. It also allows you to design your garden and do landscaping and from some screen shots that I have seen - its pretty good - though I havent tried it out myself yet. Punch Platinum Pro The version I bought was $100. But they have another one thats about $30 cheaper and is good if all you want to do is design your home and not the garden. Other softwares that I read about: * Better Homes and Gardens Home Designer Suite http://www.homedesignersoftware.com/products/products.htm This software got the highest rankings in almost every review that I read. Heard that people who had never used design software before - found this to be very good. Check out the samples they have on the website - its very impressive * 3D Home Architect® Design Suite Deluxe 6 by Broderbund The user interface is not supposed to be very easy in this one and havent seen many people give very good reviews about this software. Checked it out only because I knew about BroderBund from way back when they used to make great PC games. I found this review to be very useful: http://www.consumersearch.com/www/software/home_design_software/fullstory.html Its very indepth and basically they recommend the Better Homes and Gardens Home Designer Suite. Also, most of these companies have demos, so it would make sense that you download them and test them out for yourself.

Multi-Monitor taskbar - UltraMon

UltraMon UltraMon is not free-ware(like Multi-mOn), but I think its definetly a much better multi-monitor taskbar. (whoever said that the best things in life are free, was definetly wrong) * it looks similar to the WindowsXP taskbar. (MultiMon's taskbar looked more like the old windows 2000 taskbar). * The extra buttons that it adds are much more cleaner and work better. (there is a button that switches the window between your monitors and another that stretches your window across your monitors) * it has a much better interface, that allow you to customize your wallpapers and screen savers and lots more. * allows you to have different wallpapers on your monitors, as well as stretch one across all your windows. * allows you to have different screensavers for each of your monitors.

Wednesday, February 16, 2005

Uninstaller does not remove all installed assemblies from the GAC

Problem: Assemblies installed by your installer into the GAC, cannot be removed upon uninstallation. (Unable to uninstall assembly or application completely) You installed assemblies into the GAC, and you weren't able to remove them using all three of the following methods 1. Using the .Net configuration manager 2. Trying to manually delete them form c:\WinNT\assembly3. using the gacutil /u or /uf option on the assembly Trying any of the above methods, will lead to a message that says that the assembly is still being referenced by another application. If you run gacutil /lr assembly, you will see that the application that is still referencing the assembly is the MSIInstaller. I found that the problem was in a value in the registry. Goto HKEY_CLASSES_ROOT\Installer\Assemblies\Global the key (default) should not have a value. (so its value should read as (value not set)) if the value is either empty or any other value, then you will not be able to remove your assembly from the GAC. Solution: Goto HKEY_CLASSES_ROOT\Installer\Assemblies\Globalclick on the key (default), hit delete. This should reset the value of (default) so that its value comes up as (value not set). After this you should be able to uninstall your assembly from the GAC. If you are creating an installer, then make the installer, delete this key from the registry. Then when the user uninstalls the application, it will remove all your assemblies from the GAC too. I have no idea why this works. Cant even give you a reason as to why .NET framework needs to look at that key to decide if it can remove an assembly from the GAC. But apps like MSN IM 6.0 insert a value into the default key, and this can mess the uninstall procedure of your app. The HKEY_CLASSES_ROOT\Installer\Assemblies\Global\ area is used to store information about shared assemblies deployed on the machine. But as far as I can see the (default) key should not be used. A good thing to know

MSDN .NET Framework Developer Center: Designing .NET Class Libraries

Design guidelines for developing classes and components that extend the .NET Framework. MSDN .NET Framework Developer Center: Designing .NET Class Libraries

David Chappell & Associates

David Chappell & Associates David Chappel does a great job of presenting technology content in a way that is understandable. He writes a lot of papers for Microsoft. This site has a lot of his white papers that you can read through Articles and White Papers

A repository of design patterns. - PatternShare

PatternShare A repository of design patterns. The PatternShare community site brings together software patterns from different authors in one place to show relationships between existing patterns and encourages developers to contribute new ones.

Tuesday, February 15, 2005

Fiddler - NetMon on steroids

http://www.fiddlertool.com/fiddler/ Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler is designed to be much simpler than using NetMon or Achilles, and includes a simple but powerful JScript.NET event-based scripting subsystem.

Great .NET UI components

Sandbar Features: * Office 2003 and Office XP style renderers supplied * Pluggable renderer support for full customisation of appearance * Toolbars can be rearranged and redocked to any side of your form * Toolbars can be pulled off the sides and "floated" in any position * Saving and restoring your users' preferred UI layout is easy with two functions * Images are supported by binding to ImageLists or direct Icon support (16x16 through 128x128) * A completely new menubar can be un/redocked like toolbars, and even host controls * Top-level menu items can be shown as context menus on any control * All library objects can be inherited to extend their functionality And at design time... * Automatic menu system conversion can copy appearance, names and even events of existing menus * Buttons can be bound to menu items to cut down on repeated code * In-situ designer support for adding/selecting/configuring toolbar items * Menu designer offers the same ease-of-use as the framework equivalent, with more capabilities * All toolbar and menu items support full drag-and-drop * Configuration of a toolbar's location in a group is made easy DotNetWidgets Docking Suite Document Manager Outlook Bar Wizard"

Monday, February 14, 2005

.NET Development

Links to lots of cool stuff on .NET devlopment on MSDN. Most of them from the MSDN mag .NET Development

Thursday, February 10, 2005

Multi-monitor task bar

This a truly cool app if you have multiple monitors. It allows you to create a seperate taskbar on your 2nd monitor (and even supports a 3rd monitor). http://www.mediachance.com/free/multimon.htm

Wednesday, February 09, 2005

ArcObjects AlterSpatialReference does not work

ESRI ArcObjects If you have attempted to use AlterSpatialReference and it does not seem to work then most probably the file is in use. If you attempted calling it from ArcCatalog, then check to see if the image is not loaded in ArcMap or ArcScene or is being used by some other application. In code, if you attempt to set the spatial reference then you need to set the GeoDatasetSchemeEdit to null (or nothing in VB). Here is an example using VC++ IDocumentPtr ipDoc; ipApp->get_Document(&ipDoc); IMxDocumentPtr ipMxDoc(ipDoc); IMapPtr ipMap; ipMxDoc->get_FocusMap(&ipMap); ISpatialReferencePtr ipSpatialReference; ipMap->get_SpatialReference( &ipSpatialReference ); IWorkspaceFactoryPtr ipWorkspaceFactory; ipWorkspaceFactory.CreateInstance(CLSID_RasterWorkspaceFactory); IRasterWorkspacePtr ipRWorkspace; IWorkspacePtr ipWorkspace; hRes = ipWorkspaceFactory->OpenFromFile(CComBSTR(strResPath), 0, &ipWorkspace); ipRWorkspace = ipWorkspace; IRasterDatasetPtr ipRasterDataset; IRasterPtr ipRaster; hRes = ipRWorkspace->OpenRasterDataset (CComBSTR(strResFileName), &ipRasterDataset); VARIANT_BOOL varCanAlter; if ( (ipSpatialReference != NULL) && (ipRasterDataset != NULL) ) { ((IGeoDatasetSchemaEditPtr)ipRasterDataset)->get_CanAlterSpatialReference(&varCanAlter); if (varCanAlter == VARIANT_TRUE ) { ((IGeoDatasetSchemaEditPtr)ipRasterDataset)->AlterSpatialReference(ipSpatialReference ); } } ipRasterDataset = NULL; //this is important - otherwise Spatial Ref wont be set //reopen raster dataset hRes = ipRWorkspace->OpenRasterDataset (CComBSTR(strResFileName), &ipRasterDataset); //...continue processing the raster

Assigning properties to delegates in C#

Assigning properties to delegates in C# - this cannot be done. So if you wanted to select a property to use at runtime, then you can use a method similar to that shown below. public class Class1 { string s1 = null; string s2 = null; private PropertyInfo _prop; public Class1(int iPropToUse) { if (iPropToUse == 1) _prop = typeof(Class1).GetProperty("PropOne"); else _prop = typeof(Class1).GetProperty("PropTwo"); } public string PropOne { get {return s1; } set {s1 = value;} } public string PropTwo { get {return s2;} set {s2 = value;} } public void SetStringValue(string s) { if (_prop != null) _prop.SetValue(this,s,null); } public string GetStringValue() { if (_prop != null) return (string) _prop.GetValue(this,null); else return "no property set"; } static void Main(string[] args) { Class1 o1 = new Class1(1); o1.SetStringValue("Hello"); Console.WriteLine(o1.GetStringValue()); Class1 o2 = new Class1(2); o2.SetStringValue("World"); Console.WriteLine(o2.GetStringValue()); int i = Console.Read(); } }

using Reflection for runtime calling of methods

See Dynamically Loading and Using Types in MSDN documentation