Friday, December 19, 2008

My first WSCF web service project. Contract first, code later.

We're using WSCF (Web Services Contract First) 0.7 at work, and this guy published a review of an earlier version (0.5). He loved it except for the following, which might be different in 0.7, but I haven't checked yet:
"So far using WSCF for building the web service is quite a success. But I did not use it for building the consuming client. My main problem was that every roundtrip of the contracts requires deploying (plain copy) the generated wsdl and the accompanying schema's to the client code. Instead I created just a server project which included the contract schema's. One clean and independent project. As all info needed by a consumer of the service is in the wsdl all the consuming client application needs is a reference to the wsdl. Which is exactly what add web reference in VS does. Having updated the service all I need to do in the client project is Update Web Reference. However, the proxy generated by WCSF does offer some nice extra's. It returns the data (when the option in the wizard is set) as a collection, the VS web reference just sees an plain array. I also have to set the service endpoint (the URL with it's location) by hand. The latter is something I'll have to do anyhow, as it will be read from a config file. And I can live with the arrays as a trade off for a cleaner development process. This is a point where WSCF could be improved."

Monday, December 15, 2008

LINQ support on .NET 2.0

Oh thank god!!!

I'm working in a shop with ancient servers which run only .NET 2.0, so this is a wonderful thing to know about. Woo hoo!

Here's what he has to say:
  1. "Create a new console application
  2. Keep only System and System.Core as referenced assemblies
  3. Set Copy Local to true for System.Core, because it does not exist in .NET 2.0
  4. Use a LINQ query in the Main method. For example the one below.
  5. Build
  6. Copy all the bin output to a machine where only .NET 2.0 is installed
  7. Run"

[Update Apr 2 2009: This didn't work for me because our server was using .NET 2.0 without SP1. Instead, I used the excellent LINQBridge.]

Monday, November 24, 2008

Google Advice for writing testable code

From Miško Hevery's blog:

Warning Signs

  • new keyword in a constructor or at field declaration
  • Static method calls in a constructor or at field declaration
  • Anything more than field assignment in constructors
  • Object not fully initialized after the constructor finishes (watch out forinitialize methods)
  • Control flow (conditional or looping logic) in a constructor
  • Code does complex object graph construction inside a constructor rather than using a factory or builder
  • Adding or using an initialization block

Flaw #2: Digging into Collaborators

Warning Signs

  • Objects are passed in but never used directly (only used to get access to other objects)
  • Law of Demeter violation: method call chain walks an object graph with more than one dot (.)
  • Suspicious names: contextenvironmentprincipalcontainer, or manager

Flaw #3: Brittle Global State & Singletons

Warning Signs

  • Adding or using singletons
  • Adding or using static fields or static methods
  • Adding or using static initialization blocks
  • Adding or using registries
  • Adding or using service locators

Flaw #4: Class Does Too Much

Warning Signs

  • Summing up what the class does includes the word “and”
  • Class would be challenging for new team members to read and quickly “get it”
  • Class has fields that are only used in some methods
  • Class has static methods that only operate on parameters"

LINQ Reference Documentation

From Charlie Calvert's Community Blog:

"The LINQ documentation created by Microsoft is available both inside Visual Studio, and for free via the MSDN library found on the WEB. Here are some important pages from that documentation that can help you navigate through the online reference material that Microsoft has prepared for LINQ developers:

· The Root MSDN Library Page:

· .NET Development:

· .NET Framework 3.5:

· System.Linq:

· System.Data.Linq:

· System.Xml.Linq:

· Code Generation:

· More on Joins:

· For more information on the operators, see the section of the online help called “The .NET Standard Query Operators.” It is written by Anders Hejlsberg and Mads Torgersen. The URL is

I would not suggest using these references materials as a primary means of learning LINQ. However, if you have a book or other guide to LINQ development, then this reference material can be a useful addendum to that text. If you understand in a general way how LINQ works, but need answers to detailed questions, the links provided here may sometimes help you find answers."

Saturday, November 22, 2008

Money-Saving Meal Plans at Whole Foods

Advice for constructing a menu for the week, from Whole Foods. Kind of a cool idea!

Wednesday, November 19, 2008

How To: Use Impersonation and Delegation in ASP.NET 2.0

Has an API to login as a different user. See also this link: How To: Encrypt Configuration Sections in ASP.NET 2.0 Using RSA

And this link: Encrypting configuration files using protected configuration, to avoid the dreaded "The RSA key container could not be opened" error. It tells you to encrypt using this command:
aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"

So, for example, to encrypt user identity (in one line):
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pa "NetFrameworkConfigurationKey" "ASPNET" -pef system.web/identity C:\Inetpub\wwwroot\SimpleEmailWebService

The relevant code is this:
    // From

public class NativeWindowsSecurity
// Declare signatures for Win32 LogonUser and CloseHandle APIs
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool LogonUser(
string principal,
string authority,
string password,
LogonSessionType logonType,
LogonProvider logonProvider,
out IntPtr token);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(IntPtr handle);

public enum LogonSessionType : uint
Interactive = 2,
NetworkCleartext = 8,

public enum LogonProvider : uint
Default = 0, // default for platform (use this!)
WinNT35, // sends smoke signals to authority
WinNT40, // uses NTLM
WinNT50 // negotiates Kerb or NTLM

Saturday, November 15, 2008

CSU Library Research Databases

  • EBSCOhost Research Databases: Menu of databases provided through EBSCO Publishing.
  • Business Source Complete (1886- some full text): Index, abstracts, and full text covering scholarly business journals on management, economics, finance, accounting, international business and much more.
  • Wall Street Journal (1984-): Contains full text articles from the Wall Street Journal from January 2, 1984 through today's issue. Browse issues, or search for terms in citation, abstract, or article text.
    • Use keyword search on:
      • your company
      • supply chain
      • logistics
      • quality
      • strategy
      • etc

Wednesday, October 29, 2008

VS 2008 Nested Master Page Support

Scott Guthrie has this to say about VS 2008 Nested Master Page Support:
"The good news is that VS 2008 fully supports nested master pages, and makes using them super easy. Going forward I recommend that almost all ASP.NET projects should advantage of this feature - since it can add tremendous flexibility to the UI of your projects."

Also mentions Open Source Templates.

Tips for Nested Master Pages and VS 2005 Design-Time

From Scott Guthrie. He has sample code to get around the problem of nested master pages not being editable in the visual designer. (Emphasis added.)
"One of the cool advanced features of the new Master Pages feature in ASP.NET 2.0 is the ability to nest them. For example, you could define a top-level master-page called “MainMaster.master” that defines a common logo header and footer, and defines a content-placeholder for the page called “content”. You could then define two sub-masters beneath it – one that provides a two-column layout model for the content (“TwoColumnMaster.master”), and one that provides a three-column layout model (“ThreeColumnMaster.master”). These two nested-master pages could then use the MainMaster.master file as the root master, and only adjust the layout within its content section (each would fill in the "content" placeholder and in turn add their own content-placeholders for sub-pages within it). The benefit of this approach is that if a designer ever changed the logo or top-level design of the site, they only have to update one file (MainMaster.master) and then have every page on the site automatically pick it up regardless of what master file they were based on.

"This nested model is pretty cool and powerful, and allows arbitrary levels of nesting. The only downside is that VS 2005 only supports nested master page editing in source-view, and doesn’t support it in the WYWSIWYG designer (note: obviously it does support editing them when the master-pages are not nested). "

Tuesday, October 28, 2008

Cool way to style HTML forms using CSS

Interesting article at Webmonkey. Uses things I've never heard of, including <fieldset> and <legend> tags, and using unordered lists and stylesheets to style the forms.

Saturday, October 25, 2008

CMS Ratings

This article publishes ratings of many different open source CMS systems.

Thursday, October 16, 2008

jQuery and ASP.NET AJAX UpdateRegion

When using jQuery with Microsoft ASP.NET AJAX UpdatePanel controls, you need code similar to this, in a script tag in the UpdatePanel. Otherwise events are fired multiple times, and event.preventDefault() does not work.

    // Necessary for update regions.

    function WireEvents() {
// my jQuery "ready" event stuff goes here.

Normally, of course, you would do the following:

    $(document).ready(function{} {
// my jQuery "ready" event stuff goes here.

Tuesday, October 14, 2008

Google hosting javascript libraries

The AJAX Libraries API is a content distribution network and loading architecture for the most popular open source JavaScript libraries. By using the Google AJAX API Loader's google.load() method, your application has high speed, globaly available access to a growing list of the most popular JavaScript open source libraries including:

Wednesday, September 17, 2008

Applied Software Project Management - Test Plan and Test Cases

Applied Software Project Management - Test Plan and Test Cases: "The goal of test planning is to establish the list of tasks that, if performed, will identify all of the requirements that have not been met in the software. The main work product is the test plan. There are many standards that can be used for developing test plans. The following table shows the outline of a typical test plan. (This outline was adapted from IEEE 829, the most common standard for software test plans.)"

There's also this Wikipedia link, which gives an outline of the IEEE 829-1998 test plan outline: Test Plan

Thursday, September 04, 2008

Install multiple versions of IE on your PC | TredoSoft

Install multiple versions of IE on your PC TredoSoft: "It is not difficult to follow the instructions and get any version of IE running in standalone along side other versions. Most of you probably know of evolt's archive of Internet Explorer which has them readily packaged in ZIP files. Now suppose you want to download them all. An installer that would conveniently automate the whole process would be great. Thanks to this comment for the idea. "

Friday, August 22, 2008

Testing on Mobile Devices using Emulators «

Testing on Mobile Devices using Emulators « -- Has a list of emulators with photos of the emulators.

Mobile Web Developer’s Guide Part I

Mobile Web Developer’s Guide Part I
-- excellent guide to designing mobile web apps! Includes how to think of page flow, how to think about the options available to a mobile user, the market segment breakdown to phone types (in 2007), the choice of WAP, WXHTML, etc., and recommendations and best practices.

Mobile Emulators |

Mobile Emulators | "The following emulators are very usful for testing mobile applications without incurring data charges.
The dotMobi one is pretty cool!

Gloger_TototaScrum-170706.pdf (application/pdf Object)

Toyota Way mapped to Scrum (pdf)

CodeProject: 100% Reflective Class Diagram Creation Tool. Free source code and programming help

CodeProject: 100% Reflective Class Diagram Creation Tool. Free source code and programming help

Simple graph drawing algorithms too!!!

Thursday, July 31, 2008

Microsoft Virtual Labs

TechNet Virtual Labs: "Quickly evaluate and test Microsoft's newest server products through a series of guided, hands-on labs you can complete in 90 minutes or less. You can use TechNet Virtual Labs online immediately, free. Start by selecting the lab you're interested in from the list below."

Also this link, which appears to be more inclusive:

They only work in Internet Explorer.

Tuesday, July 22, 2008

Migration: Convert A Java Web Application To ASP.NET Using JLCA

Migration: Convert A Java Web Application To ASP.NET Using JLCA: "The JLCA is a tool used to convert a Java application into a C# application. The tool has shipped with Visual Studio® since Visual Studio .NET 2003. Currently in version 3.0, the JLCA is included with Visual Studio 2005 and is also available as a free download from the JLCA home page.

Version 3.0 includes enhancements to convert Java artifacts, such as Servlets and Java Server Pages (JSPs), as well as rich-client applications that use Swing or the Abstract Windowing Toolkit (AWT). In practice, the JLCA provides a very good place to start a conversion, but it will not successfully complete the entire process. So don’t expect this to be completely hands-free—you will still need to do some manual resolution of converted items after using the tool."

Monday, July 07, 2008

How safe is instant messaging? A security and privacy survey | The Iconoclast - politics, law, and technology - CNET

How safe is instant messaging? A security and privacy survey | The Iconoclast - politics, law, and technology - CNET "The number of interested parties eager to listen in on your online conversations, including what you type through instant messaging, has never been higher.

It's trivial to monitor unencrypted wireless networks and snatch IM passwords as they flow through the ether. Broadband providers and their business partners are enthusiastically peeking into their customers' conversations. A bipartisan majority in Congress has handed the FBI and shadowy government agencies greater surveillance authority than ever before."

Humanist → Why Make Erlang a Functional Language?

I like this page. It gives great rationales, and therefore insightful descriptions, of the core Erlang features.

Humanist → Why Make Erlang a Functional Language?: "I’ve heard the argument many times. People “don’t like Erlang’s syntax so [they] don’t like Erlang.” I, for instance, didn’t understand the block terminator syntax when I was first learning Erlang, so I asked Yariv Sadan about it:"

Here's the accompanying reddit discussion:

Wednesday, June 25, 2008

robert zubek / blog :: Commentary on “A History of Erlang”

Very good summation of an Erlang program -- helps me to visualize it.

robert zubek / blog :: Commentary on “A History of Erlang”: "At a certain level, I always knew that Erlang was designed for programming telephone exchanges. But this paper really conveys the feel for what that means: huge collections of loosely coupled finite-state machines, all running in parallel, doing little bits of protocol validation here and there, but mostly staying dormant."

Sunday, June 15, 2008

Relying on getters and setters is mostly wrong, here's why and what to do instead

"Relying on getters and setters is mostly wrong, here's why and what to do instead" (Reddit)
"Mike Feathers has posted an exploration of some ideas about and misconceptions of TDD. I wish that more people were familiar this story that he mentions:
John Nolan, the CTO of a startup named Connextra [...] gave his developers a challenge: write OO code with no getters. Whenever possible, tell another object to do something rather than ask. In the process of doing this, they noticed that their code became supple and easy to change.
That's right: no getters. Well, Steve Freeman was amongst those developers and the rest is history. I think that there's actually a little bit missing from Michael's telling. I'll get to it at the end."

But then, some guy thought this whole idea sucked.

Monday, May 05, 2008

How to Choose a Data Synchronization Technology – Offline & Collaboration

To quote from Microsoft's article:

Here at Microsoft there are a number of synchronization technologies that support offline and collaboration data solutions. The key technologies include:

  • Microsoft Sync Framework Core Runtime
  • Sync Services for ADO.NET
  • Merge Replication

Why does Microsoft offer multiple sync solutions? Well, we believe it is virtually impossible to create a single solution that will fit everyone's needs. For example, IT administrators may look for more of a packaged solution that is easy to install and administer. ISVs and developers may be interested in a more embeddable and customizable solution. Ultimately, multiple synchronization solutions give you more choices at the cost of adding increased confusion. Hopefully this summary will help narrow down the choice for you.

The synchronization technologies can be broken down by flexibility and the amount of code required. In general, more code is required to get a greater level of synchronization flexibility.

Thursday, April 24, 2008

Perfecting OO's Small Classes and Short Methods

"In The ThoughtWorks Anthology, a new book from the Pragmatic Programmers, there is a fascinating essay called “Object Calisthenics” by Jeff Bay. It’s a detailed exercise for perfecting the writing of the small routines that demonstrate characterize good OO implementations. If you have developers who need to improve their ability to write OO routines, I suggest you have a look-see at this essay. I will try to summarize Bay’s approach here.

He suggests writing a 1000-line program with the constraints listed below. These constraints are intended to be excessively restrictive, so as to force developers out of the procedural groove. I guarantee if you apply this technique, their code will move markedly towards object orientation. The restrictions (which should be mercilessly enforced in this exercise) are:"

Git and SourceSafe

Procedure for merging from POS-safe. (I documented elsewhere how to do the daily merge.)
  1. Diff-tree from master to the desired merge point.
  2. Check out the files marked as "M" or "D"
  3. Merge desired merge point into master.
  4. Check in the files marked as "M" or "D"
  5. Add the files marked as "A".
Specific commands are here:
  1. git diff-tree master POS-safe --name-status -r | tee files.txt
  2. ./Python/ -o -d files.txt
  3. git merge POS-safe
  4. ./Python/ -i -d files.txt -c "VSS check-in comment."
  5. Manually add files to SourceSafe. This should be easy in Visual Studio. If not, use the VSS client.

Thursday, April 17, 2008

MSAGL: Microsoft Automatic Graph Layout (formerly known as GLEE)

"MSAGL: Microsoft Automatic Graph Layout

MSAGL is a .NET tool for graph layout and viewing. It was developed in Microsoft Research by Lev Nachmanson. MSAGL is built on the principle of the Sugiyama scheme; it produces so called layered, or hierarchical layouts. This kind of a layout naturally applies to graphs with some flow of information. The graph could represent a control flow graph of a program, a state machine, a C++ class hierarchy, etc."

This was formerly known as GLEE:

"GLEE: Graph Layout Engine
GLEE: Graph Layout Execution Engine Tool purpose GLEE is a .NET tool for graph layout and viewing. It has been developed in Microsoft Research by Lev Nachmanson"

Wednesday, April 16, 2008

Terminal Services Group Policy (how to set timeouts for remote sessions)

How to configure remote desktop (terminal services) to prevent idle users from using up the precious connections.

It's so freaking NON-obvious how to get to the Group Policy Object Editor.

Run this:
C:\WINDOWS\system32\mmc.exe C:\WINDOWS\system32\gpedit.msc

Wednesday, March 26, 2008

Sorting for Humans : Natural Sort Order

How to solve the following problem when comparing or sorting strings:

1.2 should come *before* 1.10, etc., but in a naive sort it does not.

See also the C# code he cites:

Subversion Authentication With a Windows Domain

Really quite easy, according to a colleague.

Monday, March 17, 2008

Technology Review: Blogs: Ed Boyden's blog: How to Think

Technology Review: Blogs: Ed Boyden's blog: How to Think: "When I applied for my faculty job at the MIT Media Lab, I had to write a teaching statement. One of the things I proposed was to teach a class called 'How to Think,' which would focus on how to be creative, thoughtful, and powerful in a world where problems are extremely complex, targets are continuously moving, and our brains often seem like nodes of enormous networks that constantly reconfigure. In the process of thinking about this, I composed 10 rules, which I sometimes share with students. I've listed them here, followed by some practical advice on implementation."

Wednesday, March 05, 2008

Tactics for Reducing the Subjective Experience of Down Time

"Time indicators

The formulae below all depend on use of a time indicator. The following choices of time indicators are listed from most to least desirable.

1. Estimated and remaining-time indicator. Place this either in a modal dialog or in the status bar at the bottom of the window.
2. "The system is alive" indicator. When it is impractical to offer the actual times, show an animated object that will let users know the system has not frozen. For longer waits, choose the rolling barber pole often found in status bars or other large animated object. For shorter waits (less than 10 seconds), you may use, instead, an animated "wait" mouse pointer, such as a spinning ball or animated hour glass.
3. "I hear and understand" indicator. When the expected wait is of short enough duration (less than 2 seconds) that displaying elapsed time, etc., is meaningless, display the hour glass."

Wednesday, February 20, 2008

How-To: vmware-tools hgfs module on Ubuntu Gutsy Gibbon (7.10)

Arg. Doesn't work out of the box, disallowing you to use shared directories. Luckily this guy provided a way to fix it!

Tuesday, February 19, 2008

Intercepting method calls in C#, an approach to Aspect-Oriented Software Development

Cool! Roy Osherove used this to develop XtUnit, an NUnit addin which implements database rollbacks, described here. He uses System.Transactions.TransactionScope, which is a .NET facility for creating transactable components. Tres cool, no?

Tuesday, January 15, 2008

Signs of a Bad Boss (seen by me in the wild)

A certain someone at a certain company fit this to a T.

Bosses are supposed to ask themselves these questions:

1. Have you ever publicly criticized an employee?

2. Do you take credit for your employees’ work?

3. Do your employees fear you?

4. Do you expect employees to do what you tell them without question?

5. Do you believe employees should know what to do without you telling them or providing guidelines?

6. Are you a yeller?

7. Do you demean employees as a form of punishment?

8. Do you play favorites?

9. Do you hate delegating?

10. Do you check everyone’s work?

Friday, January 11, 2008

How to find files that are different between two git trees (working with git and, *gulp*, SourceSafe)

I do this a lot in my project. I change a bunch of files, and since I'm working with SourceSafe, I need to know which files to check out of SourceSafe so that I can replace them with the changed versions.

Use this command:
git diff-tree -r --name-status branch1 branch2
where branch1 is the branch I'm going to check into SourceSafe and branch2 is the upstream branch.

$ git diff-tree -r --name-status master POS-safe
M Databases/OpenBook/Alter Scripts/THE ONLY 2.2 ALTER SCRIPT YOU NEED.sql
M OpenBookSolution/HotL/DirectBillPaymentForm.cs
M OpenBookSolution/HotL/EditReservationForm.cs
M OpenBookSolution/HotL/NonGraphicalReserveForm.cs
M OpenBookSolution/HotL/OpenBook.cs
M OpenBookSolution/HotL/ReportForms/ReportSelectorForm.cs
M OpenBookSolution/HotL/SelectDirectBillAccountForm.cs
A OpenBookSolution/HotLOnly.sln
D OpenBookSolution/HotLOnly/HotLOnly.sln
M OpenBookSolution/Yellowstone.OpenBook.BusinessEntities/MonetariesBusinessEntity.cs

The basic procedure is:
  1. hack hack hack
  2. Get my tree in good shape, usually by rebasing my branch onto the SourceSafe tracking branch.*
  3. Run the diff-tree command above to find changed files.
  4. Check out those files. If there are any warnings from SourceSafe about the files being different (and not just writable), then do the following:
    1. Get latest from SourceSafe into the SourceSafe tracking branch (typically "master") in my project.
    2. Commit.
    3. Go back to step 2 above.
  5. Merge development branch into master. Sometimes I do this step a commit or three at a time instead of an en masse merge of the branch all at once.
  6. Check changed files back into SourceSafe.
*I realize that rebasing my development branch onto "master" probably isn't the wisest thing in the world, as it loses information -- specifically, the fact that I had branched the code. It was an interesting experiment, though. Perhaps I'll go back to merging again. Although the fact that we're using SourceSafe, which doesn't have the concept of a branch, probably means that what I'm doing isn't all that un-kosher.

The flavor of git I use is msysgit.

Linus clarifies "Central Repository" issue on git in a way palatable to managers

Linus was previously rather dogmatic about having no "official" version of a project. But here he's not quite so religious and explains how you can effectively satisfy those who would like a central repository. The distinction, he says, is social, not technical:
I certainly agree that almost any project will want a "central" repository
in the sense that you want to have one canonical default source base that people think of as the "primary" source base.

But that should not be a *technical* distinction, it should be a *social* one, if you see what I mean. The reason? Quite often, certain groups would know that there is a primary archive, but for various reasons would want to ignore that knowledge: the reasons can be any of ....

ExtJS javascript library

Tres cool!
"Ext (pronounced "extent"[citation needed]) is an open-source JavaScript library, for building richly interactive web applications using techniques such as AJAX, DHTML and DOM scripting.

Originally built as an extension of YUI, Ext can now also extend jQuery and Prototype. As of version 1.1, Ext can run stand-alone without relying on any of those external libraries, though they remain an option for integration.

Ext version 2.0 can now use many different base libraries (adapters) like YUI, jQuery, Prototype or it can work Stand-alone"

Tuesday, January 08, 2008

PyPy "dot" graph viewer (Python)

Referred to from this site:
"For debugging purposes I implemented a visualization tool for DFAs using PyPy's pygame-based graph viewer. The graph viewer is able to visualize interactively any graph given in the graph-description language of Graphviz. Looking at the tokenizing DFA for Python is rather instructive, both for understanding how tokenizing works and (maybe) for understanding the Python language. To try it, download the dot file of the DFA and run from a pypy checkout:
$ python pypy/bin/
The following is a screenshot of the graphviewer: "

Monday, January 07, 2008

TCL: Creating Temporary Files

From the page:
"Tcl doesn't have a built-in command to create a temporary file and there are no built-in variables for temp directories, so you have to do a little work.


I had some luck with the following procedure on a UNIX box. Maybe, somebody can check if it works for windows.

 proc tempfile {prefix suffix} {
set chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
set nrand_chars 10
set maxtries 10
set access [list RDWR CREAT EXCL TRUNC]
set permission 0600
set channel ""
set checked_dir_writable 0
set mypid [pid]
for {set i 0} {$i < $maxtries} {incr i} {
set newname $prefix
for {set j 0} {$j < $nrand_chars} {incr j} {
append newname [string index $chars \
[expr ([clock clicks] ^ $mypid) % 62]]
append newname $suffix
if {[file exists $newname]} {
after 1
} else {
if {[catch {open $newname $access $permission} channel]} {
if {!$checked_dir_writable} {
set dirname [file dirname $newname]
if {![file writable $dirname]} {
error "Directory $dirname is not writable"
set checked_dir_writable 1
} else {
# Success
return [list $newname $channel]
if {[string compare $channel ""]} {
error "Failed to open a temporary file: $chanel"
} else {
error "Failed to find an unused temporary file name"

Igor Volobouev"