PostScript files are almost plain-text files, and if you set core.autocrlf and core.safecrlf, they might cause problems with the EPS binary encoded parts, as they might be detected as text-files and therefore remove any CRLF and replace it with single LF, which can mess up the whole image.
To force Git to consider a file binary which it would consider as text-file otherwise, the easiest way is to add a .gitattributes file to the directory containing the file or to any parent directory. In my case, I normally add a .gitattributes file in the root of the repository, containing
*.eps -crlf
*.jpg -crlf
*.png -crlf
In the file you set attributes to a path (or a pattern), or unset them (with the minus sign). The crlf attribute is the attribute which tells if a file is affected by the core.autocrlf options. If you unset it, Git won’t mess with the line endings in the file.
Test-driven development has proven to increase quality of software in many cases. I believe that the same principle should be applied to network management. From time to time, I am occupied in managing quite large and distributed networks, consisting of many different network segments, routers, servers, etc.
Primary tool in managing any network is using monitoring software which tells you if everything is alright or if you should worry. For various reasons I have become a huge fan of Nagios for monitoring networks I am responsible for, especially for the simple extensibility by writing your own check scripts (plugins).
While working through some issues in a network, I suddenly decided to try an approach I spontaneously called “test-driven network management”¹. The steps are easy (and are a one-to-one translation of agile software-development principles):
Write a Nagios test which checks for the requested/required feature.
This test will fail.
Implement a solution satisfying the test.
The same advantages of automated testing (better: unit testing) in software development also apply to the network management tasks:
The test documents what you want to achieve in a quite formal way.
You will (almost) immediately know when your solution breaks other requirements (if tests exist for them).
As networks tend to be even more fragile then software, you have to monitor whatever you implemented anyways
Whenever possible, I try to add a test (or tweak an existing one) for any trouble-ticket / feature request I come around. In my experience, customer satisfaction tends to increase, because you start noticing problems before they do and you also implement measures to prevent the same problems to occur over and over again.
¹ I am quite sure there is another technical term for it, as I am quite sure I am not inventing anything new here… If you know how this is called by others, please tell me in the comments.
Strings are immutable. If you want to modify a sequence of characters, use StringBuilder. At least, that’s whats officially said. But in the framework there is at least one method that does modify a string:
The string seems to be modified directly in native code by DrawTextEx from user32.dll. Additionally to the scary fact that strings are not immutable, the length of the string is not updated, regardless if the resulting string is shorter!
For instance if you have a string “aaaaaaa” which will be truncated to “aa...“, the Length property will still return 7 for the shortened string. The debugger shows that the string will in fact be “aa…\0a” after the operation. So maybe it might be right that the string is still 7 characters long but most outputting functionality like Console.Out.WriteLine() gets confused sometimes and stops any further output to the debugger or console under certain conditions.
A very quick investigation of the System.Drawing assembly using Lutz Roeder’s fabulous .NET Reflector showed that at least there should be no memory corruption in case “WW” would get ellipsed to “W...“, as DrawTextEx takes the length of the buffer and should result only in “W.“.
Summing up, I find the corruption of an immutable string by an official Microsoft API very troubling.
Krispin made me aware of a very cool new technique for resizing images: content-aware image resizing. Based on an energy-function path of an image are removed when shrinking or are duplicated and interpolated when growing the image in a non-uniform way.
This technique can also be used to remove objects from a given image. There is a nice demo video available on YouTube (it’s the same as in jfo’s coding blog, where Krispin originally found the information):
According to this Microsoft page and this Golem-Article (German), Microsoft is going to make driver signatures from Microsoft mandatory for any driver running in kernel space in Windows Vista x64. They claim security reason for this.While (faulty) drivers definitely can lead to serious (security) problems under Windows, they sometimes fulfill cruitial parts, especially in windows file system monitoring, for which there are many legitimate reasons. Having to go through the WHQL for every driver (and every minor patch) seems a little costly and time consuming to me…
Well, after all, for me it seems to be three things:
Additional money through additional drivers going through WHQL,
Anti Open-Source projects,
Building up the infrastructure for an (almost unbreakable) Digital Rights Management system.
Update 2007-01-23: I have to revise most points of this, as I now learned something new about it. Vista x64 will accept digitally signed drivers, but they do not necessarily be signed by Microsoft. Read more in my updated article.
A nice project, everyone coming from Java and migrating to C#: IKVM.NET Home Page
It is a JVM implemented in .NET, contains a .NET implementation of a lot classes from the Java class libraries (JDK), compliance of 1.4 almost complete and contains tools for interop between Java and .NET.
As it is one of the FAQs on every Java newsgroup or Java Mailinglists: “How to handle console?”
I came across a nice library that supports console operations on Windows, Linux and Mac OS: JLine.
Check it out, if you really need to work with the console on the mentioned platforms. The libarary works using native features, but I find the handling quite nice: the required DLL for Windows for instance is dynamically extracted from the JAR and loaded, so there is no need for a special installation.
JLine does not provide curses features at the moment, but it is a good approach if you need to read a password from standard in.
I am Software Engineer and partly self-employed. I develop mainly for Windows on the Microsoft .NET platform, but also C++, Java, and sometimes Python and PHP for web applications. I also consider myself a Linux enthusiast. (more)