Babysitting

I’ve been going to a road trip with my family over a weekend and, of course, I forgot to bring audio cable. That small piece of wire was all that was keeping me apart from having my phone output beautiful music for my kids on a car stereo. No biggie I though, car has a bluetooth, it will be a cakewalk to connect the phone.

It wasn’t.

You see, Ford in its eternal wisdom decided to forbid setting such things while car was moving. And the message clearly said: it was for my safety. I found that strange because I was sitting on a passenger seat, pretty sure that I wasn’t one holding the steering wheel. If car is moving, nobody should be allowed to do anything it seems.

And this “security features” seem to be just part of a bigger trend. Let’s just take National Highway Transportation Safety Agency recommendations for GPS functionality. For example, they suggest (V.5.b) that dynamic maps are not the best choice when it comes to visualization of travel data. Their recommendation is to have GPS update every few seconds. Yes, people looking every few seconds for updated map wondering whether what they see is a current information or they have already screwed the turn will definitely make for safer driving.

We should also not forget Transportation Secretary Ray LaHood saying that your mobile phone should be disabled while in a car. I understand that mobile phone is a distraction but thing is that there is no way to reliably detect who is driving. And why shouldn’t passenger use driver’s mobile phone to, God forbid, look up maps or even worse, speak to his Mom who called him at wrong moment?

I am quite annoyed by all this babysitting and forbidding various distracting things for no measurable effect. It restricts quite useful scenarios when you do have two persons in the car and it does not offer any real safety benefit when you don’t. Face it, idiots will stay idiots and no amount of “features” will make them a good driver. They will just think of something else to entertain them while hurling on a highway toward eventual doom.

Windows 8.1

Illustration

Last week Microsoft announced Windows 8.1 preview and I decided to install it on my personal machine. I mean, what could go wrong?

Installation process was really simple. First there was a quick fix for Store, followed by quick restart, Store-based install, and an 0xc0210000 error code. After some troubleshooting and a question later, problem went away when I disabled all startup applications. I would not call this a rock solid installation process in any case. But it did work (eventually).

First thing you might notice after reboot is that DPI is all wrong. Not only that Windows will not recognize high-DPI screen as they used to but, if you manually select larger text, they will also make everything blurry. Only way to get things back to normal is to select one scaling level for all displays. Once that box is checked you will be able to set DPI without blurriness.

Mind you, this might as well be issue with a graphics driver. Windows 8.1 changed driver model slightly once more and Intel HD 4000 has not received update yet. Most visible consequence of this are occasional video artifacts and a missing screen brightness adjustments. Fresh install of Intel graphics driver sorted this out.

I thought search cannot get much more wrong than what we got with Windows 8. I was semi-correct. Finally applications, settings, and files are searched together (as they were in Windows 7). However, you will get only first four hits to chose. Rest of screen will be taken with Internet search suggestions. Nice way to waste space.

Start button is a joke. Instead of full featured and loved implementation we had in Windows 7, there is a button that supports few menu options when right-clicked. Judging by the attention to details it was probably implemented by a janitor. I guess it is not all bad news because finally you can disable upper-left and upper-right hot corners. Yippee, close button is usable once more without fighting with charms menu.

There are few new Metro-style applications slowly taking over functionality from their desktop equivalents. For example, we have fully functional Metro Calculator. Oh no, wait, it misses Programmer mode. I guess that student developing it ran out of time. Most other applications that are metro-lized suffer same issue. They are just not finished so they will miss features or two when compared to their desktop brothers.

Explorer got a slight update. Not only it is called File Explorer these days but it also offers This PC as start page instead of My Computer. Some poor soul worked his heart out for this one.

Not all changes are superficial though. SkyDrive got more integrated and I find that a good thing (as does NSA :)). New DPI model shows promises in cases where you have two monitors with different DPI settings. And lets not forget boot to desktop.

It is a bit unfair to judge Windows based on just a preview, but I have a feeling that Windows 8.1 are going to be just bunch of fixes and applications that should have been there from day one with Windows 8. Regardless of my bickering, they are improvement over Window 8 and things are bound to get better once install procedure is fixed and manufacturers get their drivers in order.

As far as I am concerned, possibility to disable upper-corner charms and “everywhere” search are reason enough to upgrade. Especially since it will be free.

Agilent U1232A

Illustration

Newest in line of my multimeters is a 6000-count Agilent U1232A.

This device falls into a category of electrician’s multimeters which is most noticeable on current range which only starts at 1 mA. Other specs for this multimeter are also nothing special; you cannot even use K-type probe directly with it. Considering cost in excess of $100, why would anyone buy it?

Because trust is important. While every multimeter states at least CAT III 600V rating, just few of them really do. In reality they will fry if you do something stupid (e.g. measuring current on ohm range). And it is not question whether you will do something stupid, it is just question of time. This multimeter can handle stupid.

DC voltage measurement is 0.5% + 2 counts from 0.1 mV to 600 V which is more than decent. AC voltage is slightly worse with 1% + 3 counts but no real surprise there. Nice addition is low input impedance mode as a separate switch selection. Not only that it will deal with “phantom” voltages but it will automatically detect whether voltage is AC or DC.

Simple hand-wave above its screen can produce quite a big voltage spikes (up to few hundred mV) in this multimeter. It is not necessarily an real-life issue with measurements since I don’t ever hold my multimeter in hands but it is something to be aware of. It seems that someone at Agilent decided to go a bit cheap on shielding.

Resistance is 0.9% + 3 on all ranges except 60 MΩ. Resolution better than 100 mΩ would be good but it is definitely not something I need every day. Still, it would be nice if it went at least one decade lower. Continuity tester is speedy and it will even flash screen at you. I love this for late night sessions because sound can be turned off.

Diode measurement is basic and, of course, cannot light up white LED. I find that slightly disappointing but I know of even more expensive multimeters without this functionality.

Capacitance range goes from 1 nF to 10 mF. If you need to measure smaller capacitance, you will need to have additional LCR meter. This multimeter is good for troubleshooting bad power supply caps but not that good if you want to check oscillator cap values.

There is one mode that sort-of measures temperature but only with additional accessory. If you don’t have such accessory you can use it as fixed 600 mV range but I don’t see the point. If you are not going to include direct K-type measurement, there is no need to include temperature setting especially when multimeter offers nice scaling function.

Current range starts at 1 mA and goes to 10 A of continuous current. If you just need quick measurement you can go up to 20 A for 30 seconds. While this is something that most multimeters can handle, not all of them are ready for new measurement within a minute after overload. Multimeter also has µA range that is not suitable for any real measurement because it has more holes than a Swiss cheese. It is only suitable for measuring some (e.g. flame) sensors and not for general-purpose measurement. Unless you use something like µCurrent you can forfeit low-current work.

Menu system is logical and it is usable even without manual. You can set surprisingly big number of options ranging from beep frequency and backlight all the way to smoothing. There is a possibility of basic data logging on multimeter itself but it is very restricted. Fortunately there is an optional IR to USB cable (that does not work with Windows 8, but more on that later).

Looking directly at display numbers look clear and big. However, it gets really washed out when watched from above. It is only slightly better looking from side and generally I find it rather disappointing. How come that Uni-T can provide superior LCD screens even with its cheapest multimeters and Agilent cannot get it right with one that is at $130. Selection switch is really spongy and unlike any other I have tried. It was necessary to make it a bit softer in order to allow for one-hand operation but Agilent went a bit too far in my opinion.

Build-wise this is really nice meter. Sockets are full metal and they give nice feel when you plug cable into them - not too soft, not too firm. Rubber foot fits nicely around multimeter offering protection and good feel. Some reported on it getting easily dirty but I cannot testify to that. Either I keep it too clean or (as wife can testify) I have blind spot when it comes to dirt. AAA batteries hide under single threaded (semi-captive) screw alongside a single 11 A HRC fuse.

Two more self-tapping screws hold a case together. PCB inside is nice and clean without many surprises. Protection comes in form of two power resistors, few PTCs, and a glass encased varistors. There are a few isolation slots at a strategic places so high voltage should not be an issue. Sockets are connected via hex head and no amount of vibration will set those free. This multimeter has potential to last a long time even with all expected abuse.

Carrying case is an optional accessory and comes at price of $20. For that price I have an issue with velcro strap. Even Uni-T gives elastic strap in its free case and it is infinitely more practical.

USB to IR cable has much bigger issue. In their wisdom Agilent decided to use obsolete chip (PL-2303HXA) and thus there is no Windows 8 driver support. Not now, not ever. I did manage to make it run on Windows 8 by making a completely new board.

Agilent’s Data Logger GUI was probably build by prisoners around 200 BC judging by its quality. I haven’t seen program that requires administrator rights on computer in a while. Yes, corporate users without administrative privileges on a computer can forget about it.

All things considered, I am still happy with this multimeter. Agilent did a really lousy job on accessories side but main device is good enough that you can forget few shortcomings.

P.S.: If you are interested how it looks inside, I have a close-up PCB images for you.

P.P.S.: There is quite long review video for this multimeter on YouTube.

P.P.P.S.: If you need IR to USB cable under Windows 8, check alternative communication board (you will still need Agilent’s cable).

Avoiding ArgumentException

Lets have an imaginary function:

void Dream(string theme, int rating) {
    if (theme == null) { throw new ArgumentNullException(theme, "Theme must not be null."); }
    if (rating < 0) { throw new ArgumentOutOfRangeException(theme, "Theme must not be null."); }
    if (!OtherCheck(theme, rating)) { throw new ArgumentException(theme, "Some other reason."); }
    ...
}

On first look it looks fine. As always, devil is in the details. Let’s see how constructors for these functions look like:

public ArgumentNullException      (string paramName, string message)
public ArgumentOutOfRangeException(string paramName, string message)
public ArgumentException          (string message, string paramName)

Notice small difference in last line? Yes, order of arguments is different. Once this code is written you will probably never notice it unless you have code analysis turned on (CA2208). Unit tests will still catch correct exception and 95% developers will probably just skip over it because it “looks right”.

Would this be a critical bug? Well, not really. All properly written exception handling code will still work. Worst thing that might happen is for user to see wrong exception text. Chances are that this will be one of bugs that sits for ages although it is trivial to fix.

It is pointless to discuss whether ArgumentException has a bug in parameter ordering. Even if it is a bug (and I personally think it is), it will never get fixed. Fixing it would mean that you automatically break code for someone else and I cannot imagine any sensible person approving of this. Best that you can do is to just forget this class exists. ArgumentOutOfRangeException fits most of use cases for it anyhow.

PS: Everybody would probably be happier if ArgumentException was an abstract class.

PPS: Don’t let me get started ranting about ArgumentNullException and why it was wrong to have three argument exceptions in framework.

Brother MFC-J435W Startup

Illustration

I was trying to scan quite a big stack of documents in Brother’s MFC-J435W multifunctional device and I was hitting some driver error after couple of pages. What made whole affair annoying wasn’t the error. It was the fact that scanner would continue pulling pages. That made it impossible to easily continue scanning of nonfailed batch.

Proper behavior is to stop pulling new pages in case of an error. No programmer (and let’s face it, firmware and driver programmers are ones deciding about this) would think to continue printing after paper jam. Why would they think that pulling paper after scan has failed is any different? If something fails, stop the feeder!

Since printer was on for a long time I figured that quick reboot would make it work properly. First I was asked some stupid question about losing all fax data even though I haven’t used fax functionality on it. If you are going to stop user action with question, first check whether question is even necessary!

And, guess what, feeder starts working upon startup and picks each and every one of your papers through. For what purpose is this? And don’t tell me it is to verify feeder. Of what possible use is information that feeder is not working during startup?

Whether feeder is functional or not matters only when user attempts to use it. At that time you can do quick self-test if you really must. However, you might as well actually use feeder and scan pages. If you retrieve data and move pages through, it works. Yep, you can do self-test and actual work at the same time.

I find current behavior very annoying because somebody had to write code in order to make product worse. If they were lazy and made no effort to write verification procedure and include it in startup, everything would be fine.

Writing code is not hard. Knowing when to stop is.

PS: While I use Brother’s device as an example, most other devices make the same unnecessary check.