I finally got tired of the “Connecting…” message and associated delay when starting Internet Explorer 8, and did some searching. This worked for me; your mileage may vary. No warranties.
In IE 8:
Tools/Manage Add-Ons
Toolbars and Extensions
Select Java™ Plug-In 2 SSV Helper
Disable (OK if disables other helper)
Close
Tools/Internet Options
General
Under the “Tabs” section, click Settings
When a new tab is opened, open: A blank page
OK
These were two of the links that helped me find this info:
https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=366238
I wrote my first real AutoHotkey script yesterday. I’ve been using the program for a week or so to provide keyboard macros, but I wanted a way to list all of my hotstrings (abbreviation-expanders).
I set up my hotstrings to start with two dots (..) and to not require an ending character (like space or tab). So if I type “..e” it will be replaced with my email address. That’s set up as:
:c*:..e::myemail@my.domain
Here’s my first cut at a macro to list the hotstrings in the current script. I haven’t found a way to get at the metadata for this yet, so I’m loading the current script file as text and parsing it with regular expressions. Note that this does not depend upon my two-dot convention. It does have to be in the same file as the hotstrings, though. I don’t list the expansion text, as that can get pretty long (snippets of SQL, etc.).
; == HOTKEYS ==
#H::
; Windows + H: Display all Hotstrings
FileRead, ScriptContents, %A_ScriptFullPath%
if not ErrorLevel
{
AllHotstrings := ""
Loop, parse, ScriptContents, `n, `r
{
if (RegExMatch(A_LoopField, "^:.*?:(.+?)::", SubPat))
{
AllHotstrings := AllHotstrings . SubPat1 . "`n"
}
}
MsgBox 0, Hotstrings, %AllHotstrings%
}
return Available at: Notes index
I’m in the process of refactoring and revising an existing Web Service. Clients exist out in the field, and I want to insure that I don’t break the contract.
There’s an easy way to do this: diff the WSDL. If the WSDL for the old service matches that of the new (and the behavior remains unchanged), existing clients should still work.
To make comparisons simple, don’t change the order of the web methods. Also don’t reorder properties on any serialized classes.
Thanks to Mark at work for this tip!
The fourth Iowa Code Camp is now over. I’m tired but happy - it was a very good conference. Kudos to the organizers, speakers, and sponsors! An extra thank you to DMACC for hosting!
More to come…
Several people at work are now using LINQPad. I’ve purchased the autocompletion (IntelliSense) feature, and find it well worth the money.
Derik Whittaker’s DimeCasts tutorials were helpful. I did find a few things they didn’t cover, though.
First, if your referenced assemblies need a custom configuration, you can create a LINQPad.config and copy it to the same folder as LINQPad.exe.
Second, select File/Save As to save a query to the My Queries folder. By default this is C:\Documents and Settings\username\My Documents\LINQPad Queries (under Windows XP), but you can change that. The file is saved with a .linq extension, and is simply a text file with an XML-like header. The neat part is that references added with Advanced Query Properties are saved with it! This makes it very easy to create a library of snippets that reference your assemblies and contain any necessary setup code. You could even change the folder location and share it or place it under source control. LINQPad opens saved queries with a single click; these can be reconfigured and re-saved.
The IntelliSense works with referenced assemblies, too.
I set up our persistence framework in LINQPad today and loaded some business objects; it worked beautifully.
Highly recommended.
And available for Windows XP, too!
See Windows Management Framework is here! on the Windows PowerShell Blog.
Having trouble connecting to Outlook, TFS, or anything that uses Windows Authentication? Always getting prompted for your password?
Windows may be caching an old password.
Go to Start –> Run and type: control keymgr.dll
It will open a window that has your saved passwords. Remove anything in there that you don’t want.
Thanks to Justin and Joe at work for this tip!
(Tried under Windows XP Pro; use at your own risk.)
JetBrains posted a ReSharper 5.0 Overview on their blog. While the Inspections are going to be great, I’m particularly looking forward to 100% compatibility with NUnit.
Drool.
Woohoo! :)
I can edit other people’s posts now. It’s like gaining another level in D&D!
Stack Overflow is far too addictive…
- TrueWill
The current standards of the company I work for state that Developer Express controls will be used instead of Microsoft FCL controls on all deployed WinForms applications. This has caused some grief in the past. One tool vendor for GUI testing supported only FCL controls without expensive customization. New hires aren’t familiar with the controls. Since we develop in-house software, DevX version upgrades require GAC deployments of the redistributable assemblies. Our shared assemblies that depend on DevX must be kept in sync. The third-party controls do not appear to be tested as rigorously as the Microsoft controls. And common properties are sometimes difficult to find, buried under options properties.
The controls (the grids in particular) do have some nice features. But there are drawbacks.
Today I was trying to data-bind a collection of objects to a DevX grid. The objects had properties of an enumerated type. I wanted to display the value of the DescriptionAttribute for the enum columns. After asking around and searching, I posted the question on Stack Overflow and got a great response from Marc Gravell. It works beautifully with Microsoft’s DataGridView.
Unfortunately it does not work with the DevExpress.XtraGrid.GridControl. And Developer Express “are not going to implement this feature”. Why? Because it’s not as performant. The company offers an alternate solution, which involves setting two properties for every affected grid column. The original Microsoft solution could be applied with an attribute on the enum type or on the bound-class property.
I’m not advocating using only FCL controls. Just be aware of the trade-offs inherent in using third-party ones.
Are you smart enough to do without TDD
In my case, the answer is “no.”
A review of Roy Osherove’s The Art of Unit Testing with Examples in .NET
Executive summary: buy and read this book.
The good:
Chapters 7, 8, and 9 are excellent. These cover how to write good tests, how to get your organization to adopt unit testing, and how to work with legacy code. The table on p. 232 ("Team progress and output measured with and without tests") and the test-feasibility table on p. 241 are priceless.
Appendix A covers designing for testability. I’ve only skimmed the appendices, but this hits the important topics: Inversion of Control, issues with Singletons, etc.
Appendix B has great coverage of tools and frameworks related to testing, including Moq (one of my favorites).
The disappointing:
Chapter 3 generally recommends property injection over constructor injection. I don’t agree with this, but that’s open for debate. What I find glaring is the book’s failure to mention the need to check if dependencies are assigned. This is more challenging with optional dependencies injected via properties. His techniques seem prone to NullReferenceExceptions. I can understand omitting checks from example code, but I did not find a discussion of this topic in the text.
Chapter 5 contains an extended discussion of the old, verbose record-and-replay syntax in Rhino Mocks. Much less coverage is given to the new Arrange, Act, Assert (AAA) syntax.
Similarly, some examples use anonymous delegates. While this might make the material more accessible, I prefer the cleaner syntax of lambda expressions.
I came away from the early chapters with the impression that they were excessively pragmatic. (Now I’m having difficulty coming up with examples to substantiate this.) Later chapters stressed best practices, though.
Final notes:
Read the author’s blog entry on Steal My Book. Hopefully this will make you angry (not at him!) and will encourage you to purchase his book.
The next Iowa Code Camp will be held on November 7, 2009 (a Saturday) in West Des Moines. They are now accepting registrations. This is FREE to attend, but register early!
The Call For Speakers will be open until September 23rd.
This is a great service to the community; thanks to the sponsors and all involved for putting it on!
I’m back from Software Craftsmanship North America. It was an excellent convention with some exceptional speakers, and was a tremendous bargain. Kudos to the organizers!
Ken Auer’s opening keynote was the only significant sour note in the entire day-long event. “Uncle” Bob Martin more than made up for it in his closing keynote - he stoked the fires and challenged us.
It was my great pleasure to meet Ward Cunningham. He reminded me of Steve Wozniak (whom I’ve never met) - he’s a Hacker in the best sense, still innovating after all these years. He’s clearly in the Ri stage; he can (and does) make his own rules.
To everyone I met, thank you for sharing your insights!
Update - August 29, 2009
I finished typing up my notes! :) They are available online at: Notes index
I’m off to Software Craftsmanship North America in Chicago tomorrow (the conference is Wednesday). Say hi to the bald guy in the black T-shirt!
Earlier I was tempted to post something about the barrier to entry in certain communities (open source projects, a certain auction site, and now Stack Overflow), but I think I just broke through the latter one. And now I’m starting to get addicted.
Stack Overflow is a site where programmers can ask and answer questions. It’s like a modern version of Usenet. It has sister sites for other types of questions (see the FAQ).
The initial barrier to entry is that it requires an OpenID account. This is free, if somewhat cryptic. After that, the issue is reputation.
You need reputation points to do anything besides asking and answering questions. In particular, voting up or down on answers requires a certain reputation level (again, see the FAQ). In practice this means that you’ll want to answer a few questions (and answer them correctly and completely) to accumulate some points.
Somewhat more annoying are the hidden requirements. I had typed up a careful answer to one post, and it was refused - I had more than one hyperlink in it. New members are restricted to a single link per answer. (Fortunately it allows you to edit your response and resubmit it.) I tried to answer several questions in succession, and had to wait three minutes between posts (again, because I was new). Presumably these are anti-spam tactics, but it would be nice if they were clearly spelled out.
Once you start answering some questions and gaining reputation, though, the addiction can strike. Wow - if I get 100, I can Vote Down! Were there any easy ones just posted? Any in my areas of expertise?
The tagging system is nice. It lets you quickly find questions in a given category. You can see the newest questions, unanswered questions, etc. Note that even answered questions may be worth looking at; you can always expand upon (or correct) the existing responses.
Somewhat annoying, a bit insular, but definitely worth a look.
P.S. I’m on as TrueWill.
Several interesting items:
I’m working on a small project at home, and I decided to add a custom configuration section to the App.config. If it weren’t for Derik Whittaker’s article (thanks Derik!), it’s unlikely that I would have figured it out.
So after importing one reference (System.configuration), descending from three different classes, overriding two methods, applying two attributes (one of them multiple times), making multiple casts, and repeatedly hardcoding the same strings, I can now parse six lines of XML.
It would be simpler to write a custom class and use LINQ to XML to load it. This is absurd.
An important update to an older post:
Remote GAC issue
Thanks to this article at Elegant Code, I found the EQATEC Profiler for .NET.
It’s free (BSD licensed) and it works (it’s not just for CF); we’ve used it to help tune real-world WinForms applications at work. It provides only basic features, but they’re professionally implemented. (Note that it’s not a memory profiler.)
For teams on a budget, this is definitely worth a look. Just remember that premature optimization is evil.
Today I was working on refactoring several classes. I had some tests in place, but these were edging towards integration tests. The design of our persistence layer is a bit too coupled to a database. Because of this, the tests took more than a few seconds to run. After a few successful refactorings, I started to get some Level 3 confidence and made multiple changes before running the tests.
Naturally, four of the tests failed. I was reluctant to roll back all my changes, and it took me quite some time to get all the tests to pass. I was lucky, too, as every additional change I made increased the risk of further failures.
Jeremy Miller’s MSDN article on Incremental Delivery Through Continuous Design makes a number of implicit assumptions. I wouldn’t have noticed these before, but my former manager’s healthy skepticism is starting to rub off on me. (Thanks Bob!) ;-)
Here are the ones I caught:
The last one is particularly blatant. Please note that I’m a huge fan of Agile, particularly XP. But an O/RM is infrastructure. As always, an organization needs to evaluate build vs. buy (vs. use open source). Depending on your platform and choice of language, that decision isn’t always clear-cut.
“Successful agile projects require far more discipline than any other methodology I’ve ever used.” - Brad Wilson
Thanks to Phil at work for suggesting this tip!
In addition to launching programs, Launchy can also launch web sites via the Weby plugin. It comes pre-configured with numerous searches, but here’s how to add MSDN’s new Bing search.
Start Launchy and go to Options. Select the Plugins tab and the Weby plugin. Click the plus (+) sign and enter the following:
Name: MSDN
URL: http://social.msdn.microsoft.com/
Query: Search/en-US/?query=%s&ac=8
Click OK.
Now bring up Launchy and type “msdn” (it’s case-insensitive), then hit the Tab key. It should show “MSDN > “. Type in a word or phrase to search for and hit Enter. It should bring up MSDN Search in your default browser.
Double-clicking - how quaint! ;-)
I’m planning to go to the one-day Software Craftsmanship North America event in Chicago August 26. This could be one of those “I was there” events, and they have several interesting speakers. I’m hoping there’s more to it than just patting ourselves on the back, though.
It’s taken me a long time, but I finally finished Scott Bain’s book Emergent Design: The Evolutionary Nature of Professional Software Development.
As the title suggests, the book is evolutionary, not revolutionary. I’m still looking for someone to bridge the gap between the Agilists and the Architects, to point out where long-term design has a place. Developers experienced in both OO and Agile design may find much of the material familiar. It’s a valuable book, though, building on principles popularized by “Uncle” Bob Martin and others. Mr. Bain covers a lot of ground, and many readers will be exposed to new ideas (always a good thing).
Most of the examples are in Java, although a few are in C#. They are generally simple and to the point. A passing familiarity with UML will aid comprehension, but is not a requirement. The text is well-written; Mr. Bain has an informal style that keeps the material from being dry. He also provides amusing real-world analogies.
I found the patterns overview (Appendix B) extremely valuable. It’s 84 pages long; I read a pattern a day in the morning until I finished it.
One downside is the number of typos in the book. The UML diagrams seemed particularly susceptible.
If you’re not deeply familiar with all of the following, read this book:
Bob Martin’s Clean Code would make a nice prerequisite.
See also: Practices vs. Simplicity
I’ve been (slowly) reading Scott Bain’s book Emergent Design. I’m roughly halfway through it, and I agree with most of his views and recommendations.
I cannot agree with the practice of encapsulating the constructor, though.
Bain recommends making constructors private and adding static factory methods to classes when they will be used by client classes. This avoids the new keyword outside of the class, with the goal of reducing coupling and making the system more open-closed.
I completely agree with the goals of this practice, and generally agree with Bain’s underlying principle (separating use from construction). I disagree with making this a standard practice.
To be fair, Bain states that this is an “at least do this” practice, and that separate factories and other techniques may be used instead where appropriate. I still believe it is not appropriate for general use.
Being a fan of XP, I favor doing the simplest thing that could possibly work. Bain suggests that factory methods support adding subclasses at a later time. I would not add the factory until that time comes. This practice provides benefit only if the class with the encapsulated constructor becomes polymorphic. If we favor composition over inheritance, that’s not as common as it once was.
He talks about issues extrinsic to the client for determining which subclass to instantiate. He actually implies (p. 160) that coupling the factory method to a GUI might be acceptable! Don’t do it. The moment you do, your class with the encapsulated constructor becomes effectively untestable.
What’s more, I believe that extrinsic issues like configuration settings will tempt developers to use Singletons (read: global state) as “determiners.” Again, this makes for classes that are difficult to test.
So what would I recommend instead? Dependency Injection works well for me. This can be done simply through manual constructor injection. If the system is sufficiently complex, I introduce an IoC (Inversion of Control) container. This decouples my classes, makes them easy to test, and provides great flexibility.
An IoC container is not needed on every project. Neither are factory methods.
Update - May 3, 2009
I sent Mr. Bain a link to the post, and he was kind enough to respond in the comments. Please read his well-stated position. Again, we both have the same goals.
Update - June 21, 2009
See also: Mini-review: Emergent Design
First, I found Keith Hill’s Free PowerShell EBook that I’d previously mentioned quite valuable. Recommended.
Here’s another reference you’ll want: Bruce Payette’s Windows PowerShell Refcard.
And a few more links:
Creating Cmdlets
This is a relatively advanced topic, and is not required to use PowerShell. However, it’s something I’m interested in. I’d like to try creating DSLs (Domain-Specific Languages) in PowerShell.
Allegedly, the Windows PowerShell SDK is required. The installation instructions are unnecessarily complex. Why can’t Microsoft give us a “download just the PowerShell SDK and nothing else” link? Why do I have to install the Windows Server 2008 SDK?
Once you’ve installed the relevant portions (read the download instructions carefully), you’ll then need to locate the relevant DLL to reference. If you read way down on this article on the Windows PowerShell Blog, you’ll learn that “Reference assemnblies are installed as part of SDK installation under ‘Program Files\Reference Assemblies\Microsoft’". On my system, this is:
C:\Program Files\Reference Assemblies\Microsoft\
WindowsPowerShell\v1.0
and the assembly that your project must reference is:
System.Management.Automation.dll
Oddly, the folder timestamp showed that it was created on my PC long before I installed the SDK. I checked another PC that just had PowerShell and Visual Studio installed and found this assembly at the above location. In other words, I do not believe that you need to install the SDK.
To create a cmdlet in C# or VB.NET:
To install the new cmdlet in PowerShell:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil MyCmdlet.dllGet-PSSnapin -RegisteredAdd-PSSnapin [Name]When testing, you can use the /u switch with installutil to uninstall a snap-in.
Just a thought, but wouldn’t it have been simpler to have a PlugIn folder where you could drop DLLs that PowerShell would recognize and load on startup? The current process smacks of COM to me.
You can also write your own provider. Get-PSProvider lists the current providers, which allow PowerShell to treat various hierarchies like file systems on drives.
ReSharper version 4.5 added significant functionality to the Solution-wide Analysis feature. I have found this to be a valuable tool. However, it’s wise to be extremely cautious about removing public members that ReSharper says are never used.
I would not expect ReSharper to know about projects that are not part of the current solution. If you’re creating a shared library, you’re likely to see a lot of “unused” public members.
What was less obvious to me is that data binding is not detected by ReSharper in this context. For example, say I have a public string property named FullName on a class. ReSharper displays a hint that “Property ‘FullName’ is never used". ReSharper’s Find Usages likewise finds no references. The property may still be data-bound to a control, though, since data binding generally references the property name as a string. Removing the property would cause a runtime failure.
ReSharper’s Find Usages Advanced can be used to find the binding, if Textual occurences is checked.
“Class ‘Foo’ is never instantiated” hints may also be incorrect. IoC containers (such as Unity) or other Reflection-based techniques can fool ReSharper.
Please note that I’m not suggesting turning off Solution-wide Analysis (and if you’re not using ReSharper, you’re working harder, not smarter!). Just be aware of its limitations.
Update - August 17, 2009
The UsedImplicitlyAttribute can be used where necessary to mitigate this problem.
Moq version 3.1 is out; I updated our tests from version 2.x this afternoon. The only breaking changes I encountered were that the Expect() and ExpectGet() methods were deprecated in favor of Setup() and SetupGet(), respectively. (Not technically breaking, but I had warnings-as-errors turned on.) A few quick search-and-replaces fixed this, and all the unit tests passed.
If you’re not familiar with Moq, it’s a library for creating mock objects (or stubs, or fakes - mocks in the broad sense) to assist with unit testing. Personally, I find it significantly easier and more intuitive than Rhino Mocks. Your mileage may vary, but Moq generally works the way I expect it to.
Blogs
I started reading some of the PowerShell blogs today. There are many, but I’ve subscribed to two feeds so far:
Here’s a particularly interesting (to me) post from the former, where they discuss Microsoft’s guidelines for writing new cmdlets:
Increasing visibility of cmdlet design guidelines
There’s also a post about a Free PowerShell EBook. (It was tricky to download that through the proxy server at work, but the links worked fine at home.)
I really like grep. Windows Search Containing Text seldom seems to give me the results I want. Grep works, it’s fast, and it lets me use regular expressions.
I’m used to an old version of Borland’s Turbo GREP that shipped with Delphi. It’s old, it doesn’t work well when files have long lines, and it doesn’t support Unicode (particularly UTF-16). Microsoft’s SQL Server Management Studio has a nasty habit of saving SQL text files as UTF-16, so I don’t always find the saved query I’m looking for.
I found out that Windows XP (and up) has a utility called FINDSTR that acts much like grep (type “help findstr” in a command prompt for more info). Unfortunately, it doesn’t support Unicode either. See http://stackoverflow.com/questions/408079/findstr-or-grep-that-autodetects-chararacter-encoding-utf-16.
PowerShell comes to the rescue. It appears to support Unicode/UTF-16, at least if the byte order mark is present. See http://kevin-berridge.blogspot.com/2008/06/powershell-grep.html. I think the first comment on that post is half right; the issue is that “ls” in PowerShell is an alias for Get-ChildItem and is returning a collection of FileInfo and DirectoryInfo objects. In UNIX, the output of ls is just text, so that’s all grep can operate on. PowerShell pipes objects, so it is more powerful (albeit sometimes trickier).
Here’s the feedback I submitted to Audible.com:
I just started on Audible, and have only downloaded one book. I found the experience very annoying, and am debating if I want to remain a member.
First, I had to enable JavaScript to even sign up for your site.
Second, I had to download, install and configure custom software to download books. Have you ever noticed that EVERYONE hates iTunes? That’s exactly what AudibleManager reminds me of.
Third, AudibleManager had problems with Sandboxie (http://www.sandboxie.com/). I finally had to run Firefox outside the sandbox (another security issue, along with the JavaScript) in order to get this to work.
Fourth, AudibleManager contacts your site. I had to configure my firewall to permit this.
Fifth, I use an iPod. I don’t trust iTunes, and disable all automatic syncing. I manage my library manually. I wanted to do the same with Audible. This was quite difficult. I finally figured out the procedure. Basically I had to download the file into my AudibleManager library, copy it, paste the file into Windows Explorer, open iTunes, add the file to the iTunes library (because it won’t let you add a .aa file to your iPod otherwise, unlike .mp3 files), and then drag it over to my iPod.
Contrast this with Amazon’s MP3 downloads. OK, I did install their MP3 download manager. But its interface is simple, it downloads files to a directory of my choice, and it works in a sandbox. After I purchase and download the MP3 files, I bring up iTunes and drag the files onto my iPod. Done.
Maybe there’s an easier way to do this, but it’s not at all clear from your site. I was given an array of confusing options - formats, install devices, etc. AudibleManager is not intuitive - you can’t right-click a file and say Save File As. I develop software for a living, and I want to be in control of my computer and my files.
- Bill Sorensen
(If they respond, I’ll try to post it here.)
“Learning” blog serials seem popular lately. I am a rank amateur with Windows PowerShell, but you’re welcome to stumble along with me.
References
Windows PowerShell in Action (eBook) - Bruce Payette
See also: http://www.manning.com/payette2/
Essential PowerShell (book) - Holger Schwichtenberg
Setup
PowerShell Community Extensions
I tried the demo of PowerShell Plus - I liked the IntelliSense and debugging, but the trial period was too short to convince me to shell (heh) out $145. A coworker (Justin) suggested the free PowerGUI; I’ve installed this but haven’t done much more.
If you want to run scripts (.ps1 files), the first thing you’ll need to do is set the security policy with Set-ExecutionPolicy. RemoteSigned is the easiest (if not the most secure) option for learning.
> Set-ExecutionPolicy RemoteSigned
Help
Use “help” or “man” (aliases for Get-PagedHelp) to get help on a command.
> help Get-Process
Spacebar goes to the next page; q quits. (UNIX users will find this more ;) familiar.)
Help with no parameter lists available aliases, cmdlets (basically commands), providers, and so on.
Get-Command shows you the available cmdlets.
Tab-completion is a handy feature; try typing “Get-” and then hitting [TAB] repeatedly. It works for parameters, too; try typing “Get-Process -” followed by several [TAB]s.
Objects
Not only does PowerShell give you the true piping power of UNIX shells, it does more. Rather than piping text, it pipes objects.
$_ represents the current object in the pipeline (in ForEach-Object, Where-Object, etc.).
Get-Member (alias gm) is your friend. You can pipe an object (or objects) into it to get information on the object.
> Get-Process | gm
This tells you that Get-Process returns a collection of System.Diagnostics.Process objects and lists the members.
Note that Select-Object (alias select) will screw with Get-Member, as it creates new PSCustomObject instances.
Aliases
While you may not want to use aliases extensively in scripts (ever tried to read Perl?), they are your friend at the command line.
Get-Alias (alias gal) is your gal-friend. (Couldn’t resist.)
Show all aliases:
> gal
Show the definition for the ps alias:
> gal ps
Show all the aliases of a cmdlet:
> gal | ? { $_.Definition -eq "Get-Process" }
(? is the alias for Where-Object.)
I/O
Common DOS and UNIX commands (cd, pwd, dir, ls, cat, etc.) are often aliased or otherwise made available to the shell.
Get-PSDrive (alias gdr) shows you the available drives. You can treat different providers in the same manner, which makes it possible to do things like getting a listing of all environment variables:
> dir env:
Note that you add a colon (:) on the end, as you would with a drive letter (C:).
One way to get the contents of a file is with variable notation and a provider:
> ${c:foo.txt} | ? {$_ -match "java.*version"} | sort
Alternately, you could use Get-Content (aliases gc, cat, type).
If you want to look at the contents of your GAC (Global Assembly Cache), one way is to open Windows Explorer on “C:\WINDOWS\assembly". You can also Start/Run and type that path.
I found out recently that this does not work across a network. Start/Run “\\some-workstation\c$\WINDOWS\assembly” appears to work, but will actually show you your own local GAC.
Update - August 18, 2009
Philippe Parent, coworker and friend, wrote:
…today I needed to check the gac on [a remote workstation], turns out if you issue a ‘dir’ to the command line it
works, ie:dir \\machinename\c$\windows\assembly\devexpress* /s
Thanks Phil!
The third Iowa Code Camp is going to be May 2nd, 2009 in Cedar Rapids, Iowa.
Thanks to Chris Sutton for the reminder!
I have a friend’s wedding that day; otherwise I would plan to attend. It’s well worth your time.
I recently finished reading the book Schneier on Security by Bruce Schneier.
Pros:
Cons:
Recommended.
If my statistics are correct, my readership has grown. I thought I’d highlight some older posts that newer readers may find interesting.
Comments welcome!
I just received an email with the subject line “Facade, Proxy, and Factory". I assumed it was legitimate and opened it:
many kilos ? be healthful.
real working product is come
just try
(Russian link)
Now that’s targeted spam.
I was at DevConnections in Orlando last week. It was definitely educational.
The major item of interest was WCF (Windows Communication Foundation). I attended two sessions on it presented by Miguel Castro (who is an excellent presenter) and a post-conference seminar taught by Juval Löwy. Castro stressed that the Visual Studio wizards are the worst way to do WCF, and Löwy emphasized the many benefits that WCF offers over Web Services and traditional OO development. I came away believing that SOA (service-oriented architecture) may actually be feasible.
Microsoft is coming out with a new distributed cache called Velocity. This is primarily for web sites; what I found interesting was that Windows PowerShell is the designated tool for administering Velocity.
Microsoft’s Scott Guthrie made a point of mentioning integration with open source projects (specifically NHibernate and NUnit) in his keynote. Good to hear.
There was a cool demo of installing Silverlight 3 applications locally and running them outside the browser in a sandbox. Interesting, but on the edge of my radar.
WinForms didn’t get much love. Sigh.
Anyway, hi to the all nice people I met! It’s good to be back, though.
I’ll be at DevConnections in Orlando next week. If you see me, say hi! (Look for the bald guy with glasses dressed all in black.)
I’ve been working a lot lately - learning a lot, but without much time or energy to post. I’m becoming addicted to Steve Gibson’s Security Now! podcast, too. So far it’s clued me in on Sandboxie, NoScript, and properly disabling Autorun (not as easy as you’d think).
As for reading, I got through the second edition of Framework Design Guidelines and started on Scott Bain’s Emergent Design. So far, Bain is an interesting read.
More after the convention!
I’m not a heavy UI guy, but today I was working on a WinForms app and tried to get a custom component to show up in the Toolbox. I right-clicked on the Toolbox, selected Choose Items… from the context menu, and… boom. Visual Studio crashed. I reproduced it, too.
After some searching, I found the solution on Wesley Walraeve’s blog:
Visual Studio 2008 SP1 crashes, Toolbox –> Choose Items…
The culprit was PowerCommands for Visual Studio 2008. Uninstalling that (via Add or Remove Programs) fixed it.
Note that PowerCommands shows up on the Visual Studio splash screen and in About Microsoft Visual Studio, but not in Tools/Add-in Manager.
There’s an alleged fix according to one of the comments on the PowerCommands page, but I’m not willing to risk that at this point. It’s handy, not crucial.
I’m by no means an expert on ADO.NET. Most of the time I go through an O/RM (Gentle.NET) to handle persistent storage. (It’s a nice product, but it’s no longer being maintained.) A recent project needed to read an Access database, and we had built some SQL Server-specific layers on top of Gentle, so I dropped to ADO.NET and used OleDb to hit the Jet drivers.
Everything was working in my tests. When I tried it on a different machine, though, it failed with “Data type mismatch in criteria expression.” The Jet DLLs were the same. The base MDAC version was the same. The relevant schema in the database was the same.
I still don’t know what caused it, but I know how to fix it. I was using DbType to set the type of the SQL parameters. This was not mapping correctly to the OleDbType. For instance, DbType.String was mapping to OleDbType.VarWChar when the actual type was WChar (similarly with date types).
To fix it, I used View/Server Explorer in Visual Studio, connected to the database, then checked the column properties. I copied and pasted the OleDbType values into the code and set OleDbType directly for the parameters. Then I removed the connection in Server Explorer.
Note that this was all hand-coded C# - I was porting working code over from Delphi, and was not using any visual tools.
I’ve started using Sandboxie on my system as another line of defense. Steve Gibson’s Security Now! podcast turned me on to it. I haven’t used it long enough to swear by it, but I think it’s a good idea.
Update - February 26, 2009
I’m liking this program. I’ve got both Firefox and Thunderbird running in the sandbox now, with the contents automatically deleting when no program is running. Email, bookmarks, etc. are persistent (there are handy options for these), and Sandboxie prompts to persist files saved to the desktop. I’ve hidden several directories from the sandboxed programs completely. The browser and email client automatically run sandboxed regardless of how I launch them (even with Launchy).
It takes a small amount of getting used to. I saved an attachment to a non-persistent directory and almost forgot about it prior to cleaning the sandbox (since it doesn’t prompt for unspecified directories). By default the VPN client my work uses didn’t work with IE in the sandbox (but it’s probably doable with some configuration). Apparently iTunes can override Sandboxie somehow - clicking on a Podcast link brought up some interesting dialogs. But other than these, I haven’t run into any significant issue with Sandboxie. It works.
(Continuing Pragmatism over Principles)
“The freedom from arbitrary rules, for which Cameron had fought, the freedom that imposed a great new responsibility on the creative builder, became mere elimination of all effort, even the effort of mastering historical styles. It became a rigid set of new rules—the discipline of conscious incompetence, creative poverty made into a system, mediocrity boastfully confessed.”
- Ayn Rand, The Fountainhead
Saying that it’s OK not to care about quality and that there is no need to study the collected wisdom of experienced developers is an affront to my professional ethics. It is equating mediocre programmers with those who care about craftsmanship. It denigrates our profession and ourselves.
This is the same idea that Rand rails against - that the common man, following his simple platitudes, can achieve the same results as the person who has strived, studied, tested, challenged, and continuously improved for years can achieve. There is no concept of excellence. Choosing between two possibilities is simply a matter of opinion - there is no objective validation that says, “this method is better.”
To be fair, this does bring up questions of measurements, metrics, and results. A good developer must deliver working software that meets the customer’s needs. Doing so without principles, though, is unethical, unprofessional, and foolish.
This may be SharePoint 101 for gurus, but this is for non-experts like me.
If you are trying to reorganize Shared Documents on a SharePoint site, there’s an easier way than doing it through the web interface.
Option one:
Start/Run \\sharepoint.domain.com\site
(basically change the HTTP www to two backslashes).
Option two:
Go to My Network Places and map the drive.
Either way, you can use Windows Explorer to move documents around.
Your mileage may vary; I strongly suggest you check with your SharePoint administrator before trying this tip.
Update - April 13, 2009
Our administrator imposed a document size limit on SharePoint. Uploading a larger document through a browser errors out with a descriptive message. Copying a file through Windows Explorer appeared to silently corrupt it. When in doubt, verify (and keep a copy!).
Hanselman List of Podcasts for .NET Programmers
There are even more podcasts mentioned in the comments. I found this an incredibly useful resource.
Atwood and Spolsky are digging their hole deeper:
http://www.codinghorror.com/blog/archives/001225.html
Be sure to read Uncle Bob’s posts on the matter:
http://blog.objectmentor.com/articles/2009/01/31/quality-doesnt-matter-that-much-jeff-and-joel
http://blog.objectmentor.com/articles/2009/02/06/on-open-letter-to-joel-spolsky-and-jeff-atwood
I’m heavily on Bob Martin’s side in this. I’ve read Clean Code, and Martin’s clearly earned his chops.
While I agree that one can use Agile techniques to achieve good OO design, it’s extremely helpful to know what good design looks like.
I’ve worked with unprincipled pragmatists. The git-r-done philosophy leads to unmaintainable code. I’m a huge fan of Agile/XP, but XP takes discipline. If you don’t care about software craftsmanship, you’re in the wrong profession.
I’m tired of bloggers throwing out controversial topics to increase readership. I read some bozo the other day who had a post on 10 reasons why .NET sucks. (The ICloneable interface is the only one that’s meaningful, and he misspelled that.)
Hey! Morons! Why don’t you take a lesson from Uncle Bob and try to impart actual information to your readers?
And since I’m just ranting and haven’t really taught you anything, I’ll shut up now.
P.S. Would you buy a house designed by an architect who didn’t follow any principles, but had a vague methodology that guided him most of the time? Beck wouldn’t put up with that; don’t call it Agile.
Update - February 13, 2009
Uncle Bob posted the definitive statement on the meaning of “principle".
Update - February 14, 2009
Here’s Palermo weighing in on this.
Update - February 17, 2009
JetBRAINS finally fixed a long-standing limitation in ReSharper - the test runner ignored NUnit’s SetUpFixture attribute. (It’s supposed to be fixed in the current build, at least.)
I used these today to create a state machine diagram, and they worked reasonably well:
MEF - Managed Extensibility Framework with Glenn Block on Hanselminutes.
This is an excellent talk. Block’s a great speaker, and he hits all the important points.
The interview really cleared up a lot of misunderstandings I had about MEF, and it made me feel much better about the direction Microsoft is taking it. I especially liked the possibility of better interaction with Unity in the future.
Highly recommended.
For anyone who has ever used MySQL, SQL Server really seems to be missing the ability to export data as a series of INSERT statements.
A number of people have tried to remedy this. Here’s one I tried today:
This worked for what I needed. It seems to be limited to certain data types, and you do have to tweak Management Studio as noted in the comments: “select Tools, Options, select the Results tab then change the ‘Maximum characters per column:’ value to something bigger than 256″.
As for how I’m using it, I had a SQL Server Express file-based database set up as a test deck for some of our O/RM business objects. Some of the test methods change the data, and I wanted them to be independent. I set up the table data as I wanted it, ran the Insert Generator, then saved the INSERT statements to a stored procedure preceded with TRUNCATE TABLE. I then changed the SetUp test fixture to call the stored procedure.
I don’t like having to use a physical database to run the tests. With the way our O/RM persistence framework works, though, it’s difficult to avoid that.
I certainly wouldn’t recommend this stored procedure for production code. It worked fine for my test code, though.
There are a number of similar implementations. If anyone has a recommendation on the quintessential one, please post a comment!
I put together a flowchart based on the exception throwing guidelines in Framework Design Guidelines 2nd Ed. It’s available in PDF format at:
ExceptionsDotNet.zip (1.75 MB)
Note: These are just guidelines. InvalidOperationException is not the only choice at one point in the flowchart; to quote the book, “The list is by no means exhaustive.” For developers who return error codes, return null on failure, throw System.Exception, etc., following these guidelines will keep them out of trouble. (Hopefully that’s not my readership, but I’m sure you know a coworker…)
Update - January 27, 2009
Readers might find this blog article interesting as well:
At work, we use CodeSmith to generate persistent business objects from existing database schema. Our templates create partial classes; this allows us to add functionality while preserving the ability to regenerate the original classes at any time. The CodeSmith templates pull metadata from the tables to create XML documentation comments.
So what happens if we add class documentation comments to the other half of the partial class?
Here’s the weird part: IntelliSense appears to pull the comment from whichever file was modified most recently. You don’t even have to rebuild to test it - it’s immediate.
It might be nice if it merged the comments, but perhaps that’s too much to ask.
I bought the PDF version of Windows PowerShell in Action this weekend, and ran into the same irritation I usually do with PDF e-books: Adobe Reader doesn’t let the reader set bookmarks.
I found a free utility that seems to do the job, though; the PDF Bookmark plug-in. I just started using it, but it’s working so far. Your mileage may vary.
Thanks to John Ford for this handy tool!
Here’s a tip for anyone who may be configuring a tool (such as ReSharper) to reformat code.
First create a reference source code file based on your standards. Include every element you can.
Now check this document into source control.
Once you have it saved, run the reformat on it.
Finally, compare the reformatted document with the version in source control. If they’re identical (including whitespace), you’re done - distribute the configuration to your team.
Today I tried to use the Find dialog in Visual Studio 2008 with a regular expression. It was one I had tested in the excellent RegexBuddy, so this was a surprise.
I found that Visual Studio’s Find regular expressions differ from the .NET ones: http://msdn.microsoft.com/en-us/library/2k3te2cs.aspx
Standards? We don’t need no stinkin’ standards!
The following quote comes from the members of the band Hungry Lucy, in a blog post reflecting on lessons learned in the past year.
Among them, we learned that “good enough” is anything but.
We learned that change is essential for growth.
We learned that transparency can be stressful, especially for introverts.
We learned to experiment without placing expectations on the results.
We learned that simplicity is often the most powerful and appropriate method.
We learned that “getting it wrong” is valuable and useful thing to do.
We learned to learn.
All of these lessons apply equally well to software development.
Here’s to a better new year,
Bill
P.S. Check out War-N’s Creative Commons views on the Hungry Lucy site.
Development Central is the blog of Bill Sorensen, a professional software developer. Much of this will relate to C#, .NET, and OOP in general.
Disclaimer
These postings are provided "AS IS" with no warranties and confer no rights.