Mon, 30 Oct 2017

How to Buy Batteries for Flashlights

Questions about buying batteries come up periodically on the /r/flashlight subreddit. This is the guide I wish had existed when I had those questions. The primary focus of this guide is on batteries that go into flashlights, though some of what's here can certainly be applied to other battery-powered devices.

If you just want to know how to get 18650 batteries, skip down to the Lithium-Ion section. Be careful when buying lithium-ion batteries from marketplaces like Amazon; unsafe batteries abound. See the section for advice on making safe purchases.

Types of Batteries

Batteries can be separated into different types that largely have to do with their voltage. A battery's voltage is determined by the chemical reactions it uses to generate electricity (and occasionally with additional circuitry added to the battery). The usual way we refer to batteries (AA, AAA, C, etc.) specifically references their size, not voltage. Fortunately, for the most part, particular sizes only come in particular voltages. I'll note a few places you might have to take care.

Flashlight batteries generally fall into one of three categories (links go to the sections on each type of battery):

I'm omitting stuff like 9V batteries and 6V "lantern batteries", since they're not used in flashlights to the same degree that the above categories are.

1.5V Batteries (AA, C, etc.)

Flashlights that use AAA, AA, C, and D cells are very common. They're useful because those cells are also very common.

People sometimes refer to these batteries as either "primaries" or, less often, "secondaries". "Primaries" are synonymous with non-rechargeable; you use them and then throw them away. "Secondaries" are synonymous with rechargeable, though people will more often just call them "rechargeable".

The main consideration when choosing 1.5V batteries is the chemistry used inside. There are three common chemistries:

There are rechargeable alkaline and rechargeable lithium batteries, but rechargeable NiMH are the most common at the moment. Nickel-cadmium (NiCd) used to be the most common rechargeable chemistry, but it's been replaced by the NiMH, which is better than NiCd in practically every way.

In most cases, you should get NiMH rechargeable batteries for flashlights that get used frequently. For flashlights that sit and wait to be used (emergency flashlights, bug out bags, etc.), use lithium primaries.

Lithium batteries handle temperature extremes better than NiMH and alkaline batteries, so lithium is also the best choice for things like flashlights that live in cars.

The Wirecutter has recommendations for NiMH AA and AAA batteries and NiMH AA and AAA chargers.

3V Batteries (CR123A, etc.)

3V batteries are common in a number of more niche devices, like cameras. There are a lot of flashlights that use 3V CR123A batteries. Pretty much every 3V battery uses lithium, so everything about lithium in the 1.5V section applies to 3V batteries, too.

The higher voltage lets some CR123A flashlights put out more light than similarly-sized AA flashlights. Aside from that, there's not much to consider about buying CR123A batteries.

The Parametrek battery database lists several CR123A batteries ranging from $1.50 to $5 apiece. On Amazon, Amazon Basics, Streamlight, and Energizer CR123A batteries range from $1.50 to $2 apiece.

Some places sell "RCR123A" batteries, which are basically CR123A-sized lithium-ion batteries. (Specifically, they're 16340 cells; lithium-ion naming conventions are covered below.) Some RCR123A batteries have integrated voltage-regulating circuitry to deliver a constant 3V so they behave just like a regular CR123A. Others do not; like other lithium-ion batteries, they'll be 4.2V when fully charged. If you're going to buy RCR123A batteries, either make sure your device can handle voltage up to 4.2V or check the specs on the RCR123A to see whether it has a 3V output. (Lithium-ion batteries will often be listed as having a 3.6V output or so.)

All of the usage considerations in the lithium-ion section apply to RCR123A batteries, too.

Lithium-Ion Batteries

Lithium-ion batteries brought a revolution in compact energy storage. They can hold more energy and discharge it faster than any of the common handheld battery technologies that came before them. Lithium-ion batteries are used, in some form, in devices ranging from smartphones to laptops to electric cars.

Lithium-ion batteries supply 4.2V when fully charged. As their energy is drained, their voltage drops. When they reach 2.5V or so, they're considered empty. Although a lithium-ion battery can continue to supply power beyond that point, doing so will permanently damage the battery's chemistry. That might reduce the energy the battery can hold when full or might just render the battery useless.

Lithium-ion batteries are also potentially more dangerous than the other batteries described above. If they get too hot, they can catch fire or explode. Charging and discharging lithium-ion batteries both generate heat, so doing either one too fast can cause a fire or explosion. A short circuit--connecting the positive and negative ends without enough resistance in between--will almost certainly discharge the battery too rapidly. (For people who remember the Samsung Galaxy Note 7 fires, those were caused by unsafe lithium-ion batteries.)

The above doesn't need to put you completely off lithium-ion batteries. They're incredibly useful; you just need to take a little more care with them than other common batteries. Some lithium-ion batteries are more safe than others; that'll be covered below.

You do need to be careful about where you buy your lithium-ion batteries. Many large marketplaces, like Amazon and AliExpress, have unsafe or mislabeled lithium-ion batteries for sale. Because of the dangers of unsafe usage of such batteries, you need to make sure you're getting them from a reputable seller. That will be covered in the buying lithium-ion batteries section.

Some flashlights have built-in charging circuits. If yours doesn't, you'll also need a charger, covered in the chargers section.

Lithium-Ion Names and Shapes

The Lithium-ion batteries that flashlights use--at least, flashlights with removable batteries--are generally cylindrical and are described by a five-digit identifier, like "18650". The first two digits give the diameter of the cylinder in millimeters (mm). The last three digits give the length of the cylinder in tenths of a millimeter. Thus, an 18650 cell is nominally 18mm by 65mm. There's some variation in those values, particularly in the length, but they give a rough approximation.

Some common sizes are:

A number of flashlights allow you to use either an 18650 battery or two CR123A batteries. As with 14500/AA and 10440/AAA, don't do this unless the flashlight manual says you can, since two CR123A batteries in series will give the flashlight 6V.

When speaking, most people break up the five digits of a lithium-ion battery into three groups: xx-y-zz. Thus, "18650" is pronounced "eighteen-six-fifty". ("14500" is usually pronounced "fourteen-five-hundred".)

What You Need to Know About Lithium-Ion Options

With 1.5V batteries, you have just one thing to decide about: the battery chemistry. With lithium-ion batteries, there are four options you need to consider: protection, top shape, capacity, and discharge rate.

If in doubt, you'll probably be okay with protected, button-top batteries of the highest capacity you can afford (ignoring discharge rate).

Protection

Dimensions of plain, button-top, and protected 18650s.

As noted above, lithium-ion batteries should not be discharged below 2.5V or so and should not be discharged too quickly. Many manufacturers take plain lithium-ion cells and add small protection circuits on top. These circuits stop providing power if the battery voltage drops too low or if the current draw gets too high, protecting the cell from things that could damage it. This makes the protected batteries a bit safer, since it's more difficult to accidentally push them too hard.

A protection circuit makes the battery a little longer, and sometimes a little wider. There are flashlights that have so little extra space inside that they must be used with unprotected batteries. Usually such flashlights will have their own low-voltage protection (LVP) and will stop trying to use the battery if the voltage gets too low. If you use an unprotected battery in a flashlight without LVP, you'll have to be careful not to drain the battery too far or you risk permanently damaging the battery.

Protected batteries usually cost a little bit more than their unprotected counterparts, typically in the realm of an extra $1.50 or so.

Some high-powered flashlights need to draw so much current that they can't use protected batteries because they'd trip the protection with their power usage. For those flashlights, make sure you get unprotected batteries with a high enough discharge rate (covered later).

Flashlights that need unprotected batteries should say so on their website and in their manual. If there's nothing about protection, you should be able to use protected batteries (and you ought to do so).

Top Shape

Tops and bottoms of flat top, button top, and protected 18650s.

Lithium-ion batteries, like all other batteries, have a positive end and a negative end. Putting a lithium-ion battery in backwards can damage the flashlight, the battery, or both. In some cases, it can start a fire.

On a plain cylindrical lithium-ion cell, the disk on the positive end is a little smaller than the disk on the negative end. Some manufacturers take bare cells and put buttons on top of them, like the buttons on top of 1.5V batteries. This makes the battery a little longer, but not as much as a protection circuit does. Most unprotected-batteries-only flashlights will still work with button top batteries.

Button top batteries usually cost slightly more than flat top batteries. The extra cost is generally somewhere around ten to twenty cents.

Many flashlights will work with either button top or flat top batteries. Some are shaped so that only a correctly-inserted button top battery will work. This serves as mechanical enforcement of correct battery polarity. If your flashlight takes more then one battery in series, you'll need to use button-top batteries.

Protected batteries pretty much always come with button tops.

In general, any flashlight that works with flat tops will also work with button tops, except for rare cases where the battery compartment spacing is incredibly tight. Consequently, I'd recommend getting button top batteries unless you specifically know you need flat tops.

Capacity

A battery's capacity, most commonly measured in milliamp-hours (mAh), governs how long it can continue providing power. More mAh generally equals more flashlight runtime. Even if you don't expect to run a battery all the way down, keep in mind that as a lithium-ion battery discharges its voltage drops. In many flashlights, that means that a partially-discharged battery can't support the brightest modes on the light. A higher-capacity battery will continue to provide higher voltages for longer periods of time.

As of October 2017, the highest-capacity 18650s being manufactured can store a nominal 3500mAh of energy, though lower-capacity ones go as low as 1200mAh. If all else is equal, you should get the highest-capacity battery you want to spend money on.

Discharge Rate

Depending on their particular chemistry, lithium-ion batteries can have a maximum discharge rate anywhere from 3 amps (A) to 40A. Most flashlights stay under 3A-4A, so pretty much any battery will be fine for them. Some of the higher-output flashlights need or can benefit from 10A, 15A, or even 20A batteries.

There's a tradeoff between battery capacity and discharge. The chemistries that do very well on one metric are not as good on the other. As of October 2017, the best high-capacity batteries store 3500mAh with a maximum discharge of 10A, while the highest-discharge batteries can sustain 40A but only store 2000mAh.

The most-demanding flashlights I've seen top out at about 20A, so you probably don't need to go out looking for batteries with higher discharge rates than that. (Unless you're also using the batteries in your vape or something.) Many people with high-drain flashlights like to use Sony VTC6 or Samsung 30Q batteries; both are 3000mAh/15A.

Some people refer to high-discharge batteries as "IMR" batteries, after a commonly-used chemistry for such batteries.

In general, you should see if your flashlight has a maximum current drain listed. If it doesn't, ignore discharge rate and get the highest capacity batteries you want. Otherwise, get the highest-capacity batteries with a high enough maximum discharge rate.

Other Considerations

There are all sorts of other characteristics that people care about with their batteries, but those are less relevant than the above four things, especially if all you care about is getting your flashlight to work.

There's actually a really complex relationship between batteries' capacity, voltage, and current. Batteries are a little less efficient at higher amperages, so a flashlight that's constantly used on its turbo setting will generally drain its battery even faster than the numerical difference between the light's brightness levels would indicate. Similarly, batteries providing higher amperages will have their voltage drop a bit relative to the same battery with the same charge but at a lower current draw. Different batteries will have different balances among those relationships (e.g. Samsung 30Qs exhibit slightly more voltage sag than Sony VTC6s, even though their top-line ratings are the same).

These sorts of things only tend to matter to people who want to squeeze every last lumen out of their lights, and those are just a small subset of the people who use lithium-ion flashlights on a regular basis. If you're interested in this level of detail, though, you will want to look at HKJ's battery and charger reviews. The website is a little confusing in its layout, but there's a wealth of information about all of the batteries HKJ has tested, and HKJ has tested a lot of batteries.

Where to Buy Lithium-Ion Flashlight Batteries

Don't just go to Amazon, search for "18650", and buy the first search result. There are a lot of cheaply-made and more-unsafe-than-necessary batteries in large marketplaces like Amazon. You should buy from a vendor who will only sell properly-labeled stock from trusted manufacturers.

One of the easiest ways to do that, as well as to search for batteries that match all of the options you need, is to use the Parametrek Battery Database. The person who maintains the database has links to purchase batteries from reputable sellers. For a search example, here's all of the protected 18650 batteries, with the highest-capacity ones first:

Note that to search for capacity, the mAh numbers I've talked about are on the "mAh" category. The "capacity" section sorts by watt-hours (Wh) instead. (The basic difference is that milliamp-hours are only directly comparable for batteries at the same voltage, while watt-hours give meaningful comparisons even between batteries with differing voltages. Lithium-ion batteries are generally marketed with their mAh rating--since the voltage is known--so that's what this guide uses, too.)

If you have questions about a particular battery seller, you can always come ask about it on the /r/flashlight subreddit.

Notes on Particular Lithium-Ion Battery Brands

Unprotected batteries are pretty much all made by LG, Panasonic, Samsung, Sanyo, or Sony.

Some of the more popular brands for protected batteries include AW, EVVA, and Keeppower.

Many flashlight manufacturers have their own branded batteries. Those are generally of good quality, but they're often more expensive than equally-good batteries from other reputable sellers. Some people prefer to pay the extra amount just to avoid trying to figure out whether a particular other seller is reputable or not.

Batteries from Olight are a little unusual. They're a reputable manufacturer (and seller, if you buy directly from them), but they do some extra things to their batteries. The tops of their batteries have a positive button, like any button top battery, but also a negative ring around the button. This is required for the batteries to work in their proprietary flashlight charging cradles, but it increases the chances of short-circuiting the batteries. (The protection circuit should prevent a short-circuit from starting a fire, but it's still not something you want to do to a battery.) Unless you're using an Olight flashlight with an Olight charger, you probably don't want an Olight battery.

Ultrafire batteries should be avoided. They're known to cut corners on their batteries in order to make them cheaper. If you buy one of their batteries, you might get something that works, but you also might get a battery with a defective protection circuit, or a battery that contains a smaller, cheaper battery, and a lot of sand to fill the extra space. Given the care that needs to be taken with lithium-ion batteries, the risk isn't worth the lower prices.

Chargers

If you go with rechargable batteries, you'll need a charger. (Some lithium-ion flashlights have built-in charging, but even with those an external charger can be useful sometimes.)

The best option is to look at the list of chargers reviewed by HJK, pick one with the features you need (number of bays, NiMH, lithium-ion, etc.) and a good rating (two or more smiling faces), and buy it from one of the reputable battery vendors discussed above.

Tue, 25 Jul 2017

Trump and the BSA National Jamboree

My social news feeds are awash with news of Trump's speech at the 2017 National Jamboree (full transcript, full video). I'm disappointed on a few levels, but I'm not leaving the Scouting program.

I was a Boy Scout when I was a kid. I'm currently an adult leader with a Boy Scout troop. I think the ideals and the potential of the Scouting program are good. The short version of Scouting is that we strive to develop kids' citizenship (in the USA, but also in their community and the world), character, and fitness (both physical and emotional). We use a number of tools to accomplish those goals, but the one that most differentiates Scouting from other similar organizations, in my opinion, is what BSA (the Boy Scouts of America) calls "the outdoor program", i.e. all the stuff we do outdoors, including camping, fishing, hiking, and a whole host of other activities.

BSA is not perfect; there are policies they have that I think should be changed, and bad adult leadership in a troop can give the troop's kids a bad experience. But I believe that the core goals and methods of the organization are good, which is part of the reason I am a scout leader. I want to make sure that the kids in my troop have the opportunities to get as much out of the program as possible and have good experiences while doing it.

As part of BSA's focus on citizenship, the President of the United States is considered to be the honorary president of the BSA (though there's a separate actual president who actually runs the national board). Consequently, the US President is always invited to speak at the BSA National Jamboree, an every-four-year camping event that hosts troops from all across the US (and plenty from other nation's Scouting programs, too). Nineteen National Jamborees have been held (including the one currently underway), under twelve different sitting US Presidents (including Trump). Eight of those presidents have spoken in person at a National Jamboree during their term. (Neither Nixon nor Carter spoke at a National Jamboree while they were President. Reagan was scheduled to speak, but was unable to make it for health reasons, so Nancy Reagan spoke in his place. Obama recorded a video that was played at the Jamboree.) The BSA's Bryan on Scouting blog has a history of presidential visits to National Jamborees through Obama.

So whether you like Trump or not, it was reasonable (in my opinion) for him to be invited to speak at this year's National Jamboree, on the basis of Jamboree tradition and in the spirit of developing citizenship in young Scouts.

That said, Trump took a disappointingly political tack with his speech, seeming to treat it as a campaign rally. Officially, the Boy Scouts of America is a non-partisan organization. Everyone should be able to benefit from the skills, knowledge, and experiences available through Scouting, regardless of political viewpoints, so no one should feel excluded because of their viewpoints. Past presidents have focused on non-partisan topics, emphasizing things like community service and being a good citizen, in their Jamboree speeches. Trump had a fair amount in that vein, but he kept dropping in things like his usual digs at the media or complaining that he hasn't been shown enough "loyalty". There was actually a lot of good stuff in his speech, but it seemed like he couldn't avoid making every few paragraphs about himself, in a partisan, exclusionary manner. (Plenty of past presidents used their speaking opportunity to highlight things they saw as personal accomplishments, but they all presented those things as examples of citizenship or service in line with the ideals of Scouting.) He also managed to use language that most Scout leaders would at least frown on, were it uttered by one of their troop members at an event, and referenced apparently risque activities in a fairly approving manner.

I was also disappointed at the members of the audience who went along with Trump's partisan digressions, booing Clinton and Obama while cheering things like the GOP-supported, Democrat-opposed effort to repeal the Affordable Care Act. I'm not actually surprised that Trump treated his speech like a campaign event. It still saddens me, but it's entirely in keeping with his demonstrated character up to now. I had hoped, however, that Scout leaders would understand that sort of partisanship is inappropriate at a Scouting event. It is, of course, hard to tell just how many people were participating, but it was enough that the TV cameras could pick them up.

But despite all that, the instances of angry, divisive speech from President Trump to the Jamboree crowd do not represent Scouting as a whole. I'm sure there were some people in the audience who would be happy chanting "Lock Her Up" at a genuine Trump rally, just as I'm sure that there were among those 40,000 people some who have marched in anti-Trump protests. I think, however, that most scout leaders care primarily about encouraging their kids to be better people without having to pick a political team and without having to shut out anyone on the opposite side.

If you have qualms about Scouting, go visit some troops in your area and see how they work. The scouting program is big and it provides a lot of resources for individual troops, but what defines each one is really the adults and kids in that specific troop. Each troop has its own character. Some are bad environments for youth development, which makes me sad. Some are good environments that maybe just aren't the right fit for your particular child. But most troops are friendly and welcoming, and in most places there should be at least one where your child will feel comfortable and engaged and where there are people who will help your child develop into a healthy citizen of upstanding character.

Thu, 04 Dec 2014

The Best Android Apps of 2014

(According to /r/Android.)

Google recently came out with a "Best Apps of 2014" list. It was not well received, with many people feeling that the majority of apps present were there because Google was making money from them, not because they actually deserved to be on such a list. Consequently, the Android subreddit attempted to compile its own list. This post is my attempt to collect the most highly-voted submissions on that /r/Android post.

What follows are the 35 top apps, based on Reddit's "best" sorting algorithm. If I have time, I'll add more to the list later.

SuperSU

Gives you root on your system.

JuiceSSH

SSH client with optional cloud syncing and other features.

SeriesGuide

TV episode (and movie) watching management. Tracks things you've seen, tells you about upcoming things. Syncs with trakt or tvtag.

Pocket Casts

Podcasting app. "Buy it for the hilarious changelogs, stay for the awesome Podcast App."

QuickPic

Album app. Browse, display, and select images on your device.

Nova Launcher

Alternate home screen. Very customizable.

AirDroid

Manage your device from your desktop or laptop web browser over the network. You can transfer files, send and receive SMS messages, see notifications, and generally fully control your Android device.

Pushbullet

Easily send information between your device and desktop computer. Serves as both a cross-device notification system (e.g. see your Android notifications on your desktop) and a data sharing system (e.g. send a URL from your laptop to your phone).

CamScanner

Take photos of documents with your phone and turn them into PDFs.

Tasker

General-purpose automation for your Android device.

Moon+ Reader

Ebook reader.

Strava

Fitness app for tracking your running and bicycling.

Today Calendar

Material-designed calendar app.

Textra

Material-designed SMS app.

ES File Explorer

File management app.

Duet

Game. The gameplay's a little difficult to describe. You control two objects that rotate in sync around the same point and you have to move them to avoid obstacles.

Sleep as Android

Sleep tracker and sleep-cycle-aware alarm clock.

Nine

Synchronizes device data with a Microsoft Exchange Server.

Timely

Very customizable, multi-featured, and good looking clock app. Has a clock, alarm clock, timer, and stopwatch.

Reddit Sync

Reddit client with a card UI.

TextSecure

Encrypted messaging app.

Cerberus

Security program. Lets you track, manage, and even wipe your device remotely in case it's lost or stolen.

Waze

Traffic-aware GPS routing and navigation.

FolderSync

Sync local folders to various cloud storage providers.

IFTTT

Short for "If This Then That". Android client for the IFTTT web service. IFTTT hooks into a lot of other sites (and your Android device) and lets you set up triggers so if something happens in one place, it causes something else to happen in another. (e.g. if it's going to rain, it can have your phone pop up a notification to take an umbrella when you leave the house.)

TeamViewer

Kind of the reverse of AirDroid. Lets you manage your desktop computer from your phone.

Llama

Android device automation, similar to Tasker. (Or Tasker is similar to Llama. Plugins for either will work with both.)

Here

Offline maps. Not available in the Play Store, so you have to sideload it.

Plex

Client for the Plex Media Server.

AcDisplay

Shows notifications while the phone is locked. Detects when you pull your phone out of your pocket and turns on the screen to show your notifications. Similar in concept to the Moto X's Active Display.

RedReader

Reddit client.

Morning Routine

Alarm clock that lets you define a sequence of steps necessary to turn off the alarm. The idea is that you encode your entire morning routine into it, which makes sure you're awake by the end and makes sure you do everything you're supposed to.

Citymapper

Journey planning app, including transit, auto, foot, bike, and taxi. Only for specifically-supported cities.

Sunrise Calendar

Calendar app.

Xposed Framework

Framework for installing Xposed modules. Each module patches some aspect of the running system in order to change it. There are modules for all sorts of things, from working around Android bugs to adding cosmetic tweaks to making stock Android behave like a custom ROM. Root required. Must be sideloaded, since it's not in the Play store.

Solid Explorer

File manager.

Fri, 13 Dec 2013

Portable Filesystems for Portable Disk Drives

I periodically need to set up a USB hard drive so that its files can be shared between different operating systems. I recently tried to update my practices. This is a record of my findings.

The short version of my conclusions is: If you need good portability between Windows, OSX, and Linux (and you're only writing data from Windows or Linux), use NTFS. If you don't need filesystem metadata like ownership or permissions and your files and disks aren't too large, FAT32 might work for you.

FAT32

FAT32 is often the filesystem of choice for flash drives and smaller media. Windows, OSX, and Linux all have native support for it. It can span filesystems up to 2TB in its default configuration and up to 16TB or so if you tweak its block size. It cannot support files larger than 4GB, nor does it include support for file ownership and permissions. Its support for filenames longer than eight characters plus a three character extension is something of a hack. It's not case-sensitive (though it does preserve case).

Basically, FAT32's biggest strength is its cross-platform support. In most other areas it falls down when compared to more modern filesystems.

NTFS

NTFS is a bit nicer than FAT32 in many ways. It supports filesystems up to 16EB in size, and you can fill all of that space with a single file, if you want. (In other words, there's effectively no limit on file size other than the size of the containing filesystem.) Filenames can be up to 255 characters long, just like other modern filesystems. NTFS supports POSIX-compatible file ownership and permissions, hard and soft links, case-sensitivity, and sparse files, all of which which make it a lot more interoperable with Unix than FAT32.

Its main drawback is that it's proprietary and what support exists has been reverse-engineered. Windows supports NTFS, since it came from Microsoft originally, back to Windows 2000 and Windows NT 3.5. Max OSX has had native read-only support since 10.3 (Panther). Linux can read and write NTFS volumes via NTFS-3G, which runs in userspace (via FUSE). NTFS-3G doesn't give tremendous performance when accessing SATA or SAS disks, but modern hardware is more than capable of keeping up with USB-attached disks. (At least for USB 2.0; I haven't done comparisons with USB 3.0 hosts and disks.)

exFAT

exFAT is an attempt to extend the aging FAT family (FAT12/FAT16/FAT32) to support larger files. Its size limits are somewhat crazy: maximum recommended filesystem size is 512TB (though it can theoretically go up to 64ZB); maximum file size is 127PB. Like FAT32, it does not support file ownership or permissions, hard or soft links, or sparse files, and it's case-preserving but not case-sensitive. Many of the unsupported features aren't completely necessary in a lot of USB drive use-cases, so their absence isn't an immediate strike against it.

The main problem with exFAT is that it's not just proprietary (like NTFS) but patented. It's supported natively from Windows Vista on (and Windows XP can be patched for support) and in OSX 1.6.5 (Snow Leopard) and later, but Linux support is currently very shaky and difficult to distribute because of the patents. Even if Linux support were not a factor, the fact that only relatively new OSes have support for exFAT would disqualify it from consideration in many situations.

UDF

UDF is something of a dark horse in this space. It was originally designed as a general-purpose, portable filesystem. It's only really seen adoption, though, as the filesystem used on DVDs and Blu-Ray disks. Because it's used for DVDs, though, it's natively supported by all three of the major desktop OSes: Windows (back to Windows 95), MacOS (back to OS 9), and Linux (back to kernel 2.2).

Like FAT32, UDF can only have 232 blocks in its filesystem, so it only goes up to 2TB filesystems with 512-byte blocks (which is what hard drives would use; the UDF spec requires that the UDF block size match the disk block size). Like NTFS, though, its only limit on file size is the size of the containing filesystem. Also like NTFS, it supports POSIX ownership, permissions, and metadata; ACLs; and hard and soft links, as well as being case-sensitive. It doesn't support sparse files.

It would seem that UDF would be the best choice for a portable filesystem: it's natively supported in practically every OS and it supports most of the features you'd want in a modern filesystem. Unfortunately, OS bugs hamper its usefulness.

Although Linux will read UDF filesystems with blocksizes other than 512 bytes (even though that's outside the official specification), Windows is pickier and will only recognize conforming layouts with 512-byte blocks. That immediately limits Windows to 2TB disks or smaller when using UDF. Also, Windows expects UDF to span the entire disk, with no partitions, so you can't even work around the size limitation by making multiple sub-2TB partitions.

Linux, on the other hand, has had problems with UDF with 512-byte blocks. It handles filesystems with 2KB blocks just fine, but you need to be running relatively new kernels for the 512-byte blocks (required for Windows compatibility) to work. (Two problems I've run into are disks being reported full when they're not and Linux not seeing UDF volume labels.)

The Linux problems have been fixed, but only just this year. Losing compatibility with all older Linux systems knocks out one of the biggest advantages that UDF has over NTFS. In my case, I have RHEL 5 and 6 systems that aren't going to get these fixes for a really long time. (Maybe by RHEL 5's 2017 EOL, assuming RHEL 7 includes all of the fixes.)

ext[234]/HFS+

There are also the native disk formats for Linux (the ext2/3/4 series) and MacOS (HFS/HFS+). While there's at least some support for accessing them from other systems, that support is generally less robust than the NTFS-3G project's work, so if you're going to require third-party support for cross-platform access you might as well use NTFS.

Other filesystems

There are a lot of other filesystems out there. Linux has native support for quite a lot of them. OSX and Windows don't. In cases where installing third-party drivers on OSX or Windows is an accepted requirement, some other filesystem might be a good choice. In my opinion, though, NTFS, FAT32, maybe UDF, and possibly exFAT cover the filesystem portability use-cases pretty well by themselves; it would have to be a very specific set of circumstances for a different filesystem to be a better choice than one of those four.

Tue, 10 Dec 2013

Dottie Gold-Humphreys, October 1999 - 9 December 2013

Less than five months after getting married and moving into an apartment together, my wife, Becca, and I got a pair of cats. They'd been with a friend of ours for about ten years, longer even than she'd known her husband. She and her husband loved them dearly despite their cat allergies, but their two-year-old was turning out to be allergic and was terrorizing the cats (as only a two-year-old can do) to boot, so they were reluctantly looking for a new home for the cats. Thus it was that on January 31st, 2009, Becca and I took Nico and Dottie to our apartment to live with us.

Once the cats got used to the apartment, they settled into distinct roles. Nico was used to getting his way with everything and tended to crowd Dottie out when there was something he wanted. We were always worried about her getting enough food because even though we gave them separate bowls she usually wouldn't eat until he'd finished. Nico would often eat so quickly that he'd immediately regurgitate some of his food, which Dottie would promptly eat. It was a little gross, but we felt oddly comforted by it, because we knew Dottie was actually eating something. (We had Nico on a diet because he was 20 pounds when he should have been about 15. Dottie always seemed a little scrawny at her 7 pounds.)

Nico was always the cat that would greet newcomers to the house and aggressively demand attention, but Dottie was Becca's special baby. Dottie always seemed prim and dainty, especially when compared to the more boisterous Nico.

Becca delights in nicknames for people, cats, cars, and probably other entities too. Nico and Dottie were no exception and went through a plethora of names, including Small Cat, Muffin, Princess, and Sneezy for Dottie. "Princess Baby" was probably the most long-lived nickname for her (as was "Fatty" for Nico).

In February 2011, Nico developed kidney cancer and that April we made the difficult decision that it was time to let him go. Dottie mourned Nico for a time--at least it seemed that way. She was even more withdrawn than usual and I think she missed his presence in some sense or other. Eventually, though, she blossomed in a way that she had never done around him. She became more confident around the house; she hid under things a lot less; and she was a lot more comfortable around other people. For all that we loved Nico, I think Dottie was a lot happier by herself.

Both Dottie and Nico had had renal problems for pretty much their entire lives. When we got them, we continued their diet of kidney-friendly food (high in calories, low in protein) and we had bloodwork run on them periodically to make sure they were doing okay. The bloodwork measured levels of substances that the kidneys should be removing from the blood. For both cats, those levels were always higher than what a cat should normally have, but they never worsened into areas that would be problematic.

Until a couple of months ago. I forget now what particular symptom prompted the vet visit, but while we were there they ran her bloodwork and her creatinine levels had spiked, indicating a decrease in kidney function. At the vet's recommendation, we started administering subcutaneous fluids to help flush out her system and compensate for the lost kidney capacity. We had done this with Nico, and he had been easy to handle. He seemed to enjoy the attention, even though we were sticking him with needles on a regular basis. (One vet tech told us that he was the only cat she'd seen who didn't react at all when she took his temperature rectally.) Dottie was a lot less happy about the fluids. Although she eventually became more accustomed to them, she never liked the process and it took both of us to hold her while we were administering them.

The fluids plus a few pills to also supplement her kidney function held her for a month or so and seemed sustainable; we'd be doing them for the rest of her life, but it seemed likely that they'd be able to sustain her for some time to come while preserving her quality of life.

In November we moved into a new house. I was worried that Dottie would be disoriented by the change and would be unhappy with the new house, especially since there were stairs and she was starting to look a little arthritic in her back legs. She took to the house surprisingly well, however. She seemed happy to go up and down the stairs and explore everything in the place. Unfortunately, we discovered fleas several days after moving in. Most of the house has hardwood floors, but we fogged the entire place (spending several hours with Dottie in the old apartment) and put flea powder down on the carpets. We kept Dottie in our bedroom while the flea powder was down.

After about a week at the new house (and about three weeks ago), Dottie stopped eating. She'd gone through phases of not eating in the past and we had an appetite stimulant on hand for times when it went on for more than a couple of days. Correspondingly, after a couple of days, we gave one to her. It didn't appear to have any effect. We thought she might not have gotten it (sometimes she managed to make us think she took her pills but would spit them out later), so we waited three days (the minimum dose window) and gave her another. When that one also had no effect, we started syringe-feeding her and we took her to the vet as soon as we could. The vet found that she was very anemic--another side effect of the kidney dysfunction--and prescribed an injection that would fill in for the red-blood-cell-creation function of the kidneys.

After about a week on the injection, Dottie started recovering. She started becoming more energetic and she started eating again. We were administering a lot of treatments at that point, but it seemed likely that once she recovered more we could stop some of them and go back to just the handful of maintenance treatments.

In the last couple of days, though, her appetite dropped off again. We attributed this to one of the supplemental (and bad-tasting) drugs we were giving her, so we decided to just stop that one. It was for nausea relief and she was already on a couple other things with the same effects. Sunday night she seemed to be wheezing a bit but was otherwise about the same as she had been, so we just figured we'd mention the wheezing when we took in for her scheduled vet visit on Wednesday.

On Monday morning Becca and I woke up, showered, got dressed, gave Dottie her pills, syringe-fed her a bit, wished her goodbye, and went to work. When we came home that evening, she was dead.

Our vet is of the opinion that, given everything that we know, she probably went peacefully. That gives a little consolation, as does the fact that we'd been deliberately spending time with her--carrying her out to the couch to sit with us as we ate, talked, and watched TV--but we never really said goodbye, because we really didn't expect this so soon. We thought the treatments we were giving her would hold her for at least a few weeks, by which point we'd be able to tell whether she'd be able to recover from the most immediately-threatening symptoms like the anemia. We figured we'd be in store for a difficult decision about what would be best for her at that point, but we really expected her to live until then.

So this is the best I can do for now: Goodbye, Dottie. You were our princess baby and you were a special and unique cat. We will miss you and you will remain special to us for the rest of our lives.

Tue, 22 Oct 2013

Pride and Prejudice and Zombies

As most people are by now aware, Pride and Prejudice and Zombies is a modern adaptation of Jane Austen's classic that adds a plague of zombies to the book's setting and plot.

I have to say that while I was looking forward to the book, its execution left me wanting. The zombie storyline feels like a veneer laid over the original storyline in a way that doesn't really add much to that original story. I feel like the zombies are just a gimmick that don't hold up for an entire book. Pretty much the only thing that kept me reading was my love for the original story, which remains mostly unchanged beneath the zombie veneer.

Seth Grahame-Smith has recharacterized several of the people, mostly making them more violent and bloodthirsty--Elizabeth is a Chinese-trained "master of the deadly arts", and Lady Catherine is a noted zombie slayer with an entourage of ninjas--but everyone takes pretty much the same actions and ends up in the same places. At least one character becomes a zombie and is killed, but not until after her presence in the original plot is finished. I think this sameness is what led me not to really engage with Grahame-Smith's additions: the original was a deliciously sarcastic commentary on 19th century people of wealth layered in with a genuinely compelling story of the development of characters' personal relationships1. The zombie additions don't change the story enough to make a statement of their own, but they do serve to obscure some of the themes and characterizations of the original, so their presence is a net negative.

All in all, I probably would have been better off just reading Pride and Prejudice again.

1 One of the great things about Pride and Prejudice is that it's pretty feminist-friendly. Sure, it's a tale of two people who take a long time and a lot of minsunderstandings to finally come together and realize their True Love(tm), but two of the things I've always appreciated about it are: 1) Elizabeth is given agency to choose her own path in life and 2) the reason it's okay that they end up together is that when she tells Darcy what her issues are with him, he listens. How often does that happen in popular love stories?

Fri, 09 Nov 2012

Org-Mode and Project Overviews

I recently started a new job and my new manager wanted me to give him a periodically-updated task list showing what I was working on, its progress, and any deadlines I had. I like Emacs' Org Mode, so I set out to set up something in Org Mode that worked for both of us. This is my story.

In general, I want to have a main directory for my files and, within that directory, use a separate file for each distinct project I work on. My manager wanted to easily see project progress via milestones, so each level-1 heading represents a milestone, while the deeper headings are more fluid and are more for my benefit than his. It was pretty easy to set up HTML publishing from the Org file directory to a web server, so my manager could browse through the details of my org files.

My manager also, however, wanted to see an overview page with sections for current, future, and recently-past projects, with detail lines for the milestones on current projects. That proved to be the trickiest thing to implement: since I dislike repeating myself, I wanted as much of the "current project status" part of the overview to be automatically generated from the individual project files, including any milestone deadlines but ignoring all of the more minor details.

Org Mode is big, so I spent a while reading through the manual about custom agenda views and such until I stumbled on the C-c / d key sequence, which folds all the file's subheadings and displays any deadlines on the level-1 headings. In combination with C-c C-e v Spc, which exports only the visible portions of the current buffer to a new org-mode buffer, I was able to create an org-mode formatted project overview. Thus, my general overview page (named index.org so it becomes index.html during publishing) looks something like this:

* Active Projects

** [[file:project-1.org][Project 1 Description]]
   DEADLINE: <2012-11-16 Fri>
#+INCLUDE: "project-1.org_overview" :minlevel 2

** [[file:project-2.org][Project 2 Description]]
   DEADLINE: <2012-11-30 Fri>
#+INCLUDE: "project-2.org_overview" :minlevel 2

* Future Projects

** [[file:project-a.org][Project A Description]]
** [[file:project-b.org][Project B Description]]

* Recently Completed Projects

** [2012-11-01] [[file:project-x.org][Project X Description]]

I added a few CSS tweaks at the top of the index.org file to better fit its purpose. Mostly, they just put related things closer together and deemphasize some of the extra information on the page:

#+OPTIONS:   H:2 num:nil toc:nil tasks:t
#+STYLE: <style>
#+STYLE: .outline-3 h3 {
#+STYLE:   margin-bottom: 0;
#+STYLE: }
#+STYLE: .outline-text-3 p {
#+STYLE:   margin: 0;
#+STYLE: }
#+STYLE: .outline-4 {
#+STYLE:   line-height: 0.5em;
#+STYLE: }
#+STYLE: .outline-text-4 {
#+STYLE:   font-size: 0.75em;
#+STYLE: }
#+STYLE: .outline-4 h4 {
#+STYLE:   margin-bottom: 0;
#+STYLE: }
#+STYLE: </style>

I also wrote the following two elisp functions. The first one generates the overview file for a given buffer, while the second looks through a buffer for included overview files and regenerates all of them.

(defun org-export-overview (file)
  (save-window-excursion
    (find-file file)
    (org-check-deadlines org-deadline-warning-days)
    (org-export-visible ?\  0) ; calls switch-to-buffer-other-window
    (write-file (concat file "_overview"))
    (kill-buffer)))

(defun org-export-overviews-for (buffer-or-name)
  (let ((plan-dir (file-name-directory (buffer-file-name (get-buffer buffer-or-name)))))
    (with-current-buffer buffer-or-name
      (save-excursion
        (goto-char 1)
        (while (re-search-forward "^#\\+INCLUDE: +\"\\(.*\\)_overview\"" nil t)
          (org-export-overview (concat plan-dir (match-string 1))))))))

Finally, I wrote a simple function that goes through all the stuff I need to publish my org files and I call that hourly, so my manager can see my current project status at pretty much any time with no manual steps on my part:

(defun pmg-org-publish ()
  (org-save-all-org-buffers)
  (org-export-overviews-for "index.org")
  (org-publish-all))

(run-at-time "00:45" 3600 'pmg-org-publish)

All I need to do is periodically update index.org as I add or complete projects, and the rest of my work is done, as it normally is, in the project files. Thanks, Org Mode!


Phil! Gold