Mark Levison

Musings on No Touch Deployment, .NET development and photography

<May 2008>
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567


Navigation

Other

Blogroll

Subscriptions

Post Categories



Development (RSS)

Development
Ignore Attribute for FxCop?

As I much as I love FxCop I find it difficult to maintain exclusions when we rename class/methods/variables. I think the underlying problem is that we can only record exclusions in the FxCop project XML file. When a name changes all previously excluded items reappear causing developers to curse the fact that they renamed the method. An elegant solution to this problem would involve an FxCop ignore attribute, for example:

[FxCopIgnore(" UsePropertiesWhereAppropriate", "Method has a non-trivial cost")]
public void SetCellHeight(int height)
{
....
}

Now when FxCop runs it would find the attribute and ignore the method. Prior art exists in the form of the pragma's that we used to in C++ to turn off specific warnings.

BTW I've posted this as an enhancement request at GotDotNet

posted Friday, March 11, 2005 5:43 PM by mlevison with 0 Comments

Notepad replacements

I've spent alot of the past few days tweaking little details in nmake files (used for post build events). I quickly grew tired of the builitin Notepad and all its limitations.  A few minutes of Googling found dozens (NoteTab, UltraEdit ($), NotePad2, NotePad++).  I like both '2' and '++' - both support syntax highlighting (for many languages), solid support search & replace (including regex) ... STOP reading go and play with them.

In the end I choose NotePad++ because it supports having a number of files open at once (via tabs).

Thanks to the PowerToys weblog

BTW Programmers Notepad might also be worth a look.

This post now hosted at: http://www.notesfromatooluser.com/2006/11/ive_spend_alot_.html

posted Friday, January 28, 2005 1:40 PM by mlevison with 0 Comments

Extensible programming

Rereading Greg Wilson's article (Extensible Programming for the 21st Century) and a few others in the past weeks, has made me think a bit more.

I'm don't think that the underlying representation matters as much as having a common tool to manipulate it. In the case of Java/Eclipse (or C#/VS .NET) - storing the results (the code) in text is fine. What we need is for Eclipse (or MS) to expose the asbtract syntax tree to the various plugins. In many cases these plugins will bypass the text editor and display the program in their own way. I think this allows us to make the leap to the next generation tool without having to replace the infrastructure (ie new source code control systems etc.)

Update as Trey pointed out - by expose I didn't mean readonly - I meant expose for and allow for modification. Thanks Trey.

posted Wednesday, January 19, 2005 6:01 PM by mlevison with 0 Comments

Programs still edited as text redux
Apparently I'm not the only who has been thinking about how we edit programs.  Jon Udell has written a column "Exploring the deep structure of code" and a blog entry "The deep structure of code". He mentions an interesting paper that I'd missed: "Example Centric Programming" (PDF) by Jonathon Edwards .  I think that Jonathon's "Manifesto of the Programmer Liberation Front" nicely summarizes much of what I was thinking about.  In particlular these paragraphs really resonate with me:
Text is a dead-end

Programming is stuck in an evolutionary dead-end: the use of character strings to encode programs. Every other computer-mediated form of expression has evolved beyond text into sophisticated WYSIWYG interfaces to complex data structures. For example, no one still uses textual markup for word processing (except, notably, Computer Scientists with TeX). We need WYSIWYG programming.

It's called 'code' for a reason

Programming languages are built upon two basic tricks: the use of grammars to encode tree structures (AST's) into text, and the use of names to encode linkages across these trees. Much of what makes a language unique is its particular style of name resolution, as in the polymorphism and inheritance techniques of OO languages. Text is a dead end because all these sophisticated techniques in one way or another are just encoding structure in text strings. This is disastrous for usability.

Structure needs to be made explicit and directly manipulable, not implicit and encoded. Mentally parsing and interpreting this implicit structure is an enormous cognitive burden for the programmer. Modern IDE's such as Eclipse go to great lengths to extract the encoded structure back out of the text and help us to visualize and manipulate it somewhat more directly. Refactorings are provided by the IDE to automate the complex and widespread changes in syntax necessary to effect simple semantic changes. This is absurd. We should manipulate semantic structures directly through a WYSIWYG interface. The language is the IDE.

Much of what we know about programming language design is about clever ways to encode structure in text, and fancy ontologies to rationalize naming. Discarding the textual representation suddenly makes all this irrelevant, and opens a whole new space of design choices. Some who are invested in the status quo will see this as a threat and become counter-revolutionaries.

When I wrote Programs still edited as text? Why?, I was struck by the absurity of tools like QuickCode .NET.  This is macro tool - I type in 'prop int test', do an Alt+Q and it generates a property for me. Pure text replacement.  It works well and is certainly faster than typing properties by hand, but simple text replacement strikes me as insane.  We could do this in emacs.  When inserting a new method why do we need to type all the kewords 'protected static void' - a better IDE would just prompt me for scope (public, protected, ...), modifiers (abstract, static, ...) and return type. I could continue this list for sometime to come - I think our modern IDEs are hampering our productivity.

What needs to be done? In the short term:

  1. IDE's need to better tools to manipluate their Abstract Syntax Trees
  2. The Abstract Syntax Trees need to be documented and made accessible to external vendors

BTW "QuickCode .Net" is perfectly good tool, I'm mention it only because I'm familiar with it.

Finally, Jon I hope that the tool vendors give you good reason to give up Emacs long before you retire (let alone go to the grave).

posted Wednesday, January 19, 2005 12:59 PM by mlevison with 0 Comments

Debugging Exceptions in the WinForms designer
Matthew Adams co-author of Windows Forms in a Nutshell has just start a blog. His 2nd entry "What has the designer done now" has some excellent tips on working with the designer. My favourite is:

You can build a control that has an implementation bug that causes an exception at deisgn time. Everything will build fine, but when you reopen the designer you'll see the exception text.
...
Fixing it can be tricky. If inspection doesn't work, a handy tip is to open a second IDE, and attach to the original instance of VS.NET. You can then set some breakpoints in your control and watch what happens as you open the designer.

Sweet - I occasionally encounter this problems - usually when I've split a common base class out of several forms. No finally I can try to debug them. Thanks Matthew.

posted Friday, January 14, 2005 1:26 PM by mlevison with 0 Comments

BeginInvoke() another undocumented Security requirement

Earlier today I got myself into a little trouble, I had been calling BeginInvoke() to act as a PostMessage() to display a new object only after its parent had been created.  When running under full trust this worked very well, however as soon as someone (not I oops) tested in the default internet trust - Boom a security exception.  It turns out that BeginInvoke() calls MarshaledInvoke() which eventually calls CompressedStack.GetCompressedStack() which has a link demand for Unmanaged code. Unsurprisingly code deployed from the internet doesn't get this permission by default.

posted Friday, January 14, 2005 12:51 PM by mlevison with 0 Comments

MSDN Dev Chat on Zero or No Touch Deployment in the real world

On Feb 17, Robi and I will be reprising our early effort, based on the feedback - this version will be more hands on. Dev Chat: No Touch Deployment in the real world from the official descritpion:

In October 2004, Databeacon launched the Databeacon Smart Client family of products. These products use no-touch deployment to provide web reporting and data analysis capabilities to Windows PC users enabled with the .NET Framework. Join the two chief developers responsible for this project as they outline the technical strategies, obstacles and actions taken in bringing one of the first no-touch commercial software products to market. This session will focus on no-touch deployment and integration with Microsoft Office products.

If you want to learn more about No Touch Deployment and see if it makes sense for your WinForms application our dev chat will be a good place to start.

What is No Touch Deployment?

When Windows Forms applications is downloaded (from a web server), run directly on the users' machines without prior installation.

BTW you might also be interested in our success story the launch of our product (and the world's first commercial No Touch Deployment application) http://dotnetjunkies.com/WebLog/mlevison/archive/2004/10/18/28961.aspx

Update: the chat has happened, the recording is now up at: http://www.placeware.com/cc/lmevents/view?id=msft021705ad&pw=2WRDXC

posted Wednesday, January 12, 2005 10:03 AM by mlevison with 3 Comments

mscorlib not marked as loading from the Global Assembly Cache - why?

I've been doing some work to reduce the number of assemblies (from outside the Global Assembly Cache (GAC)) we load before posting a loading message. While doing this I discovered that mscorlib doesn't have its GlobalAssemblyCache property set to true.  Why? If you look in "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322" (this directory is the GAC) I see mscorlib.dll.  If I do a gacutil /l mscorlib is not registered.  Why isn't part of the GAC? What is different?

Update: An embarrassing mistake, I got the location of the GAC wrong.  The GAC is found in   %WINDOWS%/Assembly.  However this still begs the question in .NET 1.0/1.1 mscorlib isn't part of the GAC. Why?

With Whidbey it will be.

posted Wednesday, January 05, 2005 5:34 PM by mlevison with 0 Comments

Programs still edited as text? Why?

Isn't it odd that almost 50 years after the creation of modern compiled languages (Fortran ~1957), we're still editing text and discussing name conventions.

On one of my mailing lists in the past couple of days there has been a discussion around lightweight Hungarian notations.  Specifically the use of this.someMemberVariable vs m_someMemberVariable etc.  This made me think (a rare event), about why we need textual conventions when the IDE could just give the information we need.

It seems the underlying problem is that our IDE's don't automatically tell us what the scope of these variables are.  If member variables, statics, consts, params were all highlighted differently - we could get rid of many of these textual conventions.

In the best of all possible worlds we would have graphical editors[1], [2], [3] that allowed us to edit our parse trees directly. There would never again a formatting argument - we could all format our code the way we want. If we wanted Hungarian naming that would also be personal choice.  Most sytnax errors would be a thing of the past. How do we get there from here?

Does anyone MS research/Sun/IBM want to hire me for this project??

BTW I know that JetBrains ReSharper and Whole Tomato's Visual Assist do some of the job, but they just improve our text file editors

Update: I noticed this article was getting referrals from Jon Udell on del.icio.us.  Jon had also linked to another article from Greg Wilson “Extensible Programming for the 21st Century“ which does a better job of describing what I'm looking for.

In addition Sergey Dmitriev mentions his article “Language Oriented Programming“ which I forgot to mention.

[1] Whidbey May Miss the Next Coding Revolution
[2] Graphical Source Code Editors
[3] Source Code in Database essay

posted Wednesday, January 05, 2005 12:27 PM by mlevison with 2 Comments

Loading your Winforms Application at specific location?

I spent a frustrated half-hour today trying to set the Location property of my Application and couldn't get it to work.  In the end an email to DevelopMentor Winforms mailing list solved the problem. To have your choice for location respected you must set the StartPosition property to Manual. While it was a pain to discover StartPosition, it will do some of the hard work for you. If all you need is to centre your form on the Screen or its parent then use CenterParent or CenterScreen (members of the FormStartPosition enum).  I guess I just missed StartPosition in the morass of properties that a Form has.

Thanks to Dean Cleaver (aka Dino) for pointing me in the right direction.

posted Tuesday, January 04, 2005 9:22 PM by mlevison with 0 Comments

Tortoise SVN 1.1.2 and moving files/directories in subversion

Tortoise SVN 1.1.2 is available at http://tortoisesvn.tigris.org/download.html  (BTW when you install this version it will still say its version 1.1.1 build 2205  someone forgot to increment the build number.)

This upgrade is necessary to move files/directories within subversion. To move stuff select it and perform the drag with right mouse button (i.e. the button normally used for context menus), when you release a context menu will popup with your options. It took me a few minutes realize what that it meant the right mouse button.

posted Thursday, December 23, 2004 4:09 PM by mlevison with 0 Comments

Discovery of the day - Control.Show() is...

just an alias for Control.Visible = true;  So there is no point in doing both - as I sometimes did. (Thanks to Reflector for yet another cool discovery).

Merry Christmas and Happy New Year to all my readers

posted Wednesday, December 22, 2004 11:17 PM by mlevison with 0 Comments

Databeacon Smart Client reviewed in Application Development Trends

Recently Mike Gunderloy reviewed our 1.0 release in Application Development Trends. Thanks for the kind words especially about the charts (that's been a large chunk of my work in the past two years).

posted Thursday, December 16, 2004 11:27 AM by mlevison with 0 Comments

Ten Most Persistent UI Design Bugs

A co-worker (thanks Tony) passed this on recent days: Ten Most Persistent Design Bugs from AskTog.  They all hit home, but #3 hits the hardest.

'Mysteriously dimmed menu items' - we gray out menu items when they're not available but don't do anything to tell the user why they were greyed out.  So the user is expected to use their innate genius and grok why the item is greyed out.  As a developer this has always bothered me.  Unfortunately in the past when I've suggested solving this problem the reaction is always - but this doesn't fit with industry standards.  In addition Tog's solution (allow the user to click greyed out item for more info) requires custom code for the menus.

What we really need is for industry behemoth (is MS listening) to help solve this problem.  We need both a standard UI guideline and BCL classes that implement it.  If just one or two tiny companies try to solve this problem - users will not notice (after we all know that grey menu items can't be clicked) and not understand what we're trying to do.  If MS does it the rest of us will fall into line over a few years.

posted Friday, December 03, 2004 2:23 PM by mlevison with 0 Comments

Test Driven .NET 1.0 just released
Probably the last blogger on earth to mention this, but Test Driven .NET has just gone gold. 
TestDriven.NET makes it easy to run unit tests with a single click, anywhere in your Visual Studio solutions. It supports all versions of Microsoft Visual Studio .NET meaning you don't have to worry about compatibility issues and fully integrates with all major unit testing frameworks.

It looks like it finally time to get rid of some the crusty code we wrote our selves to launch NUnit/MbUnit. It may also be time to upgrade to the current release of MbUnit.

posted Wednesday, December 01, 2004 12:30 PM by mlevison with 0 Comments

Undocumented Permission Surprises

I'm trying to tighten our permission demands, so that we only demand the permissions that we absolutely need.  Looking at the documentation for StandardPrinterController, no mention of permissions is made in the requirements.  Being the suspicious type I fired up Reflector and made quite the set of discoveries.

All of the OnStartXXX() and OnEndXXX() methods call Check.Security():

    private void CheckSecurity(PrintDocument document)
    {
          if (document.PrinterSettings.PrintDialogDisplayed)
          {
                IntSecurity.SafePrinting.Demand();
          }
          else if (document.PrinterSettings.IsDefaultPrinter)
          {
                IntSecurity.DefaultPrinting.Demand();
          }
          else
          {
                IntSecurity.AllPrinting.Demand();
          }
    }

    I think this is testing how the document was created (PrintDialogDisplayed isn't documented either).  My guess is, if the user created this PrintDocument via the standard Print dialog then only safe printing is required.  Otherwise stronger demands are made.

    The next surpise all the methods demand Unmanaged Code Permission.  The final indignity both the OnStartXXX() methods demand AllPrinting permission.

    The moral of this story, MS hasn't done a very good job of documenting the security requirements of many of the classes in the BCL.  When you have a sneaking suspicion that an operation requires a permission that isn't documented, you might just be right.  Fire up reflector and take a closer look.

    posted Tuesday, November 30, 2004 12:37 PM by mlevison with 0 Comments

    GThreadCop

     GThreadCop

    .NET profiler that monitors your GUI application and report any violation of calling GUI code on non-GUI thread. GUI code is defined as any non-static method member of System.Windows.Forms.Control class (you can control accessibility) Non-GUI thread is the thread that didnot create the corresponding Control derived object. While VS2005 provides similiar reporting (by throwing InvalidOperationException while running under debugger) this profiler does a more complete job. For example it doesn't rely on get_Handle to be called as this can change with time

    Seems like a useful tool. I think we do a pretty good job on this front - but its always good to test.

    posted Monday, November 29, 2004 4:56 PM by mlevison with 0 Comments

    MSDN Dev Chat on Zero Touch Deployment

    Next Wednesday (Nov 24th), Robi Khan and I will be doing a DevChat "Zero Touch Deployment"

    In October 2004, Databeacon launched the Databeacon Smart Client family of products. These products use no-touch deployment to provide web reporting and data analysis capabilities to Windows PC users enabled with the .NET Framework. Join the two chief developers responsible for this project as they outline the technical strategies, obstacles and actions taken in bringing one of the first no-touch commercial software products to market. This session will focus on no-touch deployment and integration with Microsoft Office products.

    Update: The dev chat has happened if you want to see the recording visit: http://www.placeware.com/cc/lmevents/view?id=msft112404my&pw=QQXK77

    Apparently the recording will be online for another year (Until Nov. 24/05). If you have any questions/feedback post them in the comments and I will address them in future blog postings.  In addition I will tidy up my answers to the Q/A - I'm not a fast typist and most of answers could do with some editing.

    Finally Robi and I will be another dev chat on February 17th - based on the feedback so far - we will make the next one a bit more hands on.  To sign up visit: http://www.microsoft.com/canada/events/event_details.aspx?event_id=1032265808

    BTW you might also be interested in our success story the launch of our product (and the world's first commercial No Touch Deployment application) http://dotnetjunkies.com/WebLog/mlevison/archive/2004/10/18/28961.aspx

    posted Friday, November 19, 2004 5:41 PM by mlevison with 0 Comments

    Help me choose a Wiki for our internal knowledge base

    We're in the process of trying to pick a Wiki for our internal corporate knowledge base. Our company has ~40 employees; most of them will use the wiki eventually. In all likelihood only about 20 of them will ever try to edit it but not all of them have a technical background as result the less markup they need to learn the better.

    I would like your help with two things:

    1. What features would you add to my list?
    2. What other wikis are worth considering

    My list of features

    1. RSS Feeds for changes
    2. Versioning (History) - must include dates on notes so we know how old they are. Differencing should make differences clear (highlighting?)
    3. Supports free links (ie links other than the CamelCase style)
    4. Still in Active Development
    5. Should support "preformatted blocks". In a perfect world - we could paste code snippets in from various languages and have at least basic formatting (keyword highlighting etc,)
    6. WYSIWYG - lite - just support for the Wiki Markup. The goal is to make adoption as simple as possible (Even a toolbar that applied the basic formatting in plain text would ease the learning curve).
    7. Search displays some context (google style).
    8. Edit per paragraph or some other mechanism that makes editing a long page of text a little bit easier. (Underlying problem: You click edit and must scroll a long way to find the text you intended to change).
    9. User Authentication - preferably using Windows login
    10. Supports attachment of files (a necessary evil)
    11. Ease of install and administration
    12. Doesn't require heroic effort to display any characters (snipsnap.org makes it difficult to do backslashes)

    The choices

    1. PmWiki - excellent formatting capabilities - possibly even preformatted blocks of code with formatting. No wysiwyg.
    2. MediaWiki - runs Wikipedia et al - Wysiwyg: formatting toolbar - but results are Wiki ML
    3. Tiki Wiki - many features, some concerns have been raised about its stability (these concerns maybe out of date). No Wysiwyg
    4. MoinMoin - feature rich.
    5. UseMod Wiki - a well respected wiki - development is slow, may not have RSS feeds for changes.
    6. FlexWiki - recently open sourced by MS
    7. TracWiki - wysiwyg (coming next release) - simple formatting with toolbar already supported. Integrates with subversion (our sccs). It also has a bug tracking/project management system as well. Is the wiki a side effect or an integral part? It looks slick.
    8. PhpWikiit was only just recommended to my so I know nothing about it.

    What do you suggest?

    Update: I forgot to add that given the number of open source alternatives it would be difficult to justify spending money on hosted service (like SocialText).

    Tim Tabor pointed me to this comparison http://www.splitbrain.org/dokuwiki/wiki:compare

    posted Saturday, November 13, 2004 11:13 AM by mlevison with 0 Comments

    KDiff3 with TortoiseSVN a winner

    I've just started using KDiff3 as my diff and merge tool in Subversion.  I'm stunned, this tool solves a problem that has bothered me for eons in VSS (and other merge tools). It shows the differences by character. Which means if only two characters have changed on a line it shows you. You're not left guessing which characters they were.

    To use it: fire up your TortoiseSVN context menu and choose "settings". Select the Diff/Merge tab and point to KDiff as your diff and merge program.  Give the parameters: “%mine %theirs -o %merged“

    It's that simple.

    Found via Craig Andrea

    Update: add the parameters to point KDiff to the files.

    posted Thursday, November 04, 2004 4:14 PM by mlevison with 0 Comments




    Powered by Dot Net Junkies, by Telligent Systems