2

I just solved an issue where my application was working on one computer, but I couldn't get it to work on a different computer. I spent several hours scratching my head, and finally figured out that I had simply misnamed a file as myfile-rules instead of myfile.rules

In the past, I have found it useful when re-creating config files to use diff and md5sum to detect my own typing errors, but md5sum did not help me to notice the difference in file names this time.

The obvious lesson is just to check config filenames more carefully in future.

Are there any other tricks people use that would make it easier to catch similar errors in future?

  • The trick is learning from the situation; these types of errors are not uncommon. Consistency in naming convention helps; as do configuration management tools, but mistakes happen, learn from them and move on. – KM. Apr 13 '15 at 15:19
1

It is more important to actually prevent (whenever possible, of course) than detecting naming issues. That's what deployment stands for. If you have a template system, it is rather easy to deploy the template and then edit the files.

As for configuration files you can use git, for instance. You can use a given machine as a central repository (or template) for your configuration files, which you deploy from that machine.

Another tool, diff makes it easy to spot differences provided you can access the template and the modified tree at the same time. A file that does not exist in one tree yields many more lines than the required minimum if both files were identically named, for instance. That should trigger the attention of the reviewer.

0

I'd hardly define it a "trick", as it should be common knowledge for any computer programmer/user, but when you write a program you should always add a debug/trace/log feature (turned off by default).

I didn't understand whether you are talking about a program you wrote or a program you're using, but even in this case the answer is the same: set verbose mode and check error messages.

  • True enough! In this case, verbose mode and checking error messages did not enable me to quickly detect my trivial mistake, but of course in many cases they have done. – SauceCode Apr 13 '15 at 15:06
0

I do versions of this almost everyday -- go through source code setting a bunch of breakpoints, sit there for half an hour analyzing things, realize it was a typo that was right in front of my face to start with. Or a missing line, etc. That's just the nature of the beast; over time I've gotten better at considering the obvious sooner rather than later, but sometimes "the obvious" isn't so until you find it the hard way.

One thing to obviously beware that your problem exemplifies is anything that could include one of a number of arbitrary spacers/seperators such as ., -, _, etc. You could commit yourself/a project to a consistent practice in this regard to make life easier.

And/or you could just remember that thing about arbitrary spacers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.