One Man's Feature, Another Man's Annoyance

Being programmer I need to do send executable files a lot. However my mail client, Google Mail, does not like this. Since it check for executable files is done even in zipped archives, easiest solution for me was to use my trusty WinRAR. Google had no idea that .exe was hidden inside it.

Not any more. Google now supports RAR archives also. While that does help with preview, it also enables Google to check my RAR files for executables. And to annoy me with “Our system detected an illegal attachment on your message.”

Now only way to send executables is to change archive extension to e.g. rarx… Annoyances…

Lenovo App Store

I have quite a few freeware applications out there. Some are for Windows, some are for Windows Mobile and last few were for Android. Occasionally I get some offer related to them. Something like this (direct copy of mail, excessive white-space removed):

I am Jessie, strategic alliance manager of Lenovo App Store (http://www.lenovomm.com/appstore/). I’m writing to seek opportunities for introducing your Mobile/PAD applications to lenovo app store, which is a premium brand and good distribution channel in China market.

If you are interested, the process is simple: 1) Pls sign up here: http://developer.lenovomm.com/developeren/index.jsp. 2) You can simply send us your APKs and authorize us to upload your apps on your behalf. 3) Your apps will be put on shelf after passing test work.

If you are not interested in cooperation now, the reasons are appreciated!

Feel free to contact us if you have any questions.

Best regards, Jessie Strategic Alliance Manager Lenovo Mobile Internet and Digital Home Business Group

This email communication is confidential. Recipient(s) named above is (are) obligated to maintain secrecy.

As I said, this wasn’t that unusual so I went ahead through registration. After e-mail confirmation I got form where I was expected to enter my bank’s name, account number and to give them copy of id card or my passport!

While I have no idea whether this page is scam or not, it does not look good. Why would any normal company ask me for those details? Even if they don’t have any fraud on mind, can I trust them never to be hacked? Can I trust that my data will never be abused?

Frankly, I am scared more if this is valid company. For any company to nonchalantly ask this sort of questions is unsettling…

P.S. Here is form that I was asked to fill:

Illustration

P.P.S. Upon asking, I got instructions to lie to the system and insert fake bank account data. However, I still need to add ID. Yes, I am probably paranoid, but I will not do that…

DipTrace PCB Layout

Illustration

As with probably half of my review, I will start with some personal history…

My first rendezvous with PCB design was with almighty Eagle. This was defacto standard program for any cheap PCB creation. I hated it’s non-standard interface, I hated it’s component editor, I hated it’s export pictures, you might say that I pretty much hated it’s guts. However, it was only decent PCB editor that I knew and it was free (non-commercial use and up to a 100x80 millimeters). Our relationship was full of pain but it lasted for quite a few years…

At one point I decided that I had enough. I decided to make my own PCB editor (named it Dove :)). It would be as powerful as Eagle but with interface that humans can use. I knew that this was monstrous task but I figured that I might as well do stuff that I need first and then make it proper package somewhere into far future. I managed to bring it into semi functional state and I even made couple of boards in it. And then I made mistake of downloading DipTrace.

Originally it was just one of programs that I wanted to check in order to improve my own. But this program is PERFECT PCB EDITOR.

I am pain in the ass when it comes to uniformity - that is why I usually create all component packages myself. This was first program where I could create components without any issues. Just go and draw. All came naturally. Since creating packages is not something I do every day, standard and logical interface is the way to go. And DipTrace has quite a good component library to start with.

PCB Editor itself looks and feels like a standard Windows application (of course within reason). After few hours I felt at home with most of functions. And best of all - almost every function is where you would expect it. I forgot all dreams about my own PCB editor - this was what I wanted my editor to be. Level of detail that you can achieve is pretty unbelievable. You can do all work on single pin basis if you need to (or if you are half crazy).

Bad points, there are few. But then again, too few to mention… :)

Single reason why not to use this packet would be that it is not free. There is a freeware version that is limited to 300 pins/pads and two layers (but no limits on board size) and for hobbyist that limit goes to 500 pins (non-commercial usage only). If you want to use it for proper work there are versions ranging from 125 to 585 € (approx. $175 to $850). I don’t say this too often for programs that are not Visual Studio, but I think that it might be worth it. And compared to Eagle it is dirt cheap.

Program is very actively developed and next version will bring (free of charge for current owners) 3D preview and bunch of other changes. It is not something I consider a killer feature but it does show that guys behind this program do care.

This program is a star. Definitely best PCB program yet - use it.

P.S. I am weird in sense that I do not use Schematic editor at all so I cannot say whether that part of package is as good as PCB editor.

P.P.S. No, I am not affiliated with DipTrace nor I received anything for this post. :)

Directory.Move Is Case Insensitive

In order to rename file one would use code that looks something like this:

File.Move("file1.txt", "file2.txt");
File.Move("file.txt", "FILE.txt");

Both lines work without any issue, just as you would expect it.

What happens when we do rename with directories (aka folders):

Directory.Move("dir1", "dir2");
Directory.Move("dir", "DIR");

First line works but second one raises IOException (Source and destination path must be different). For some reason Directory.Move does case insensitive checks. For this to work we need slightly different code:

Directory.Move("dir", "DIR.somereallyunexpectedtext");
Directory.Move("DIR.somereallyunexpectedtext", "DIR");

This code first renames directory to temporary name and then renames it to desired one. Tricky code not shown here is exception handling. Either Directory.Move can fail and thus we would need code like this:

Directory.Move("dir", "DIR.somereallyunexpectedtext");
try {
    Directory.Move("DIR.somereallyunexpectedtext", "DIR");
} catch (IOException) {
    Directory.Move("DIR.somereallyunexpectedtext", "dir");
} catch (UnauthorizedAccessException) {
    Directory.Move("DIR.somereallyunexpectedtext", "dir");
}

For any failure cause we need to do rollback (renaming it back to original name from intermediate one). And worst thing is that, if second rename fails, there is probably no chance in rollback working anyhow. Most common solution? Just forget about handling exceptions and rollback between those two renames. Probability is on your side that, if first operation passes, other will pass too.

Canceling Dialog

As I made review of one application I got reminded of one common error. Theory of cancel button is easy enough. It is enough to set button’s DialogResult to Cancel and form’s CancelButton property to that button and form will close automatically. However, what to do if we need to cancel some background operation?

More than once I saw cancel code inside of cancel button’s Click event. This is WRONG. If you are wondering why, just take a look at your application state when somebody decides to close dialog via small red button in upper right corner instead of pressing cancel button. All that carefully crafted cancel code never gets chance to execute.

Solution is trivial. All your code should go inside of either FormClosing or FormClosed event. These events get triggered whatever way you do form cancelling:

    private void Form_FormClosed(object sender, FormClosedEventArgs e) {
        if (backgroundWorker.IsBusy) { backgroundWorker.CancelAsync(); } //just an example of cancellation code
    }

Cancel button should NEVER have any code in it.

P.S. Whether to use FormClosing or FormClosed is mostly matter of philosophical discussion that I intend to leave for other post.