The best kittens, technology, and video games blog in the world.

Sunday, January 27, 2019

finder-sort

Cat (OOF!) by Long Road Photography (formerly Aff) from flickr (CC-NC-ND)

I was playing a bit with Electron, building a small image viewer, as Xee is weirdly crashy nowadays. A small aspect of any image viewer is sorting images to show them in order. As far as I know there's no programming language with any special support for sorting file names, and default ASCII sort is just atrocious - going cat1.jpg,  cat10.jpg,  cat2.jpg etc.

It's not uncommon to find file manager or image viewer which uses this completely unsuitable sort order.

OSX Finder is notable for very much not doing so, and using human-friendly ordering. Exact details are unfortunately not properly documented.

I created something which works more or less the same, and published it as npm package finder-sort.

There could be some differences, especially for non-ASCII locales. In the end, it's trying to solve the same problem, not necessarily match OSX Finder exactly.

The source code is on github.

About the only interesting thing about it from code point of view is that I used ava testing package this time. Javascript has over 9000 different testing packages, and it's not uncommon for a single program to duct tape together 10+ of them. I'm surprised there's no clear winner yet. Some of the new ones like ava and cypress seem mostly decent.

Sunday, January 13, 2019

What I learned from Awair Air Quality Monitor

Unimpressed kitten by Magnus Bråth from flickr (CC-BY)

After watching DHH's video about air quality I decided to get myself AWAIR 2nd Edition air quality monitor.

Here's what I found.

Setup

Awair setup was fairly awkward. It couldn't connect with my WiFi until I changed my router to some compatibility mode, there were weird error messages about firmware update and so on. I finally got it running, but it wasn't smooth. At least there were no further issues after that.

Air circulation inside the flat is poor

I originally assumed that air in the flat would rapidly be fully mixed up, as it's a fairly small London flat, but that's not what I found. If I open all windows, fresh air gets to the sensor real quick, but as soon as I close them, the stale air is back just as fast from parts of the flat not on air flow path between open windows. I guess it's all the awkwardly placed walls and doors. Keeping windows open much longer eventually works, at least for a while.

How much CO2 per day do I need to get rid of?

One person burns about 2000 kcal a day, so let's say that's 500g carbohydrates getting burned. That's 200g carbon, or 730g CO2 per day, or 17 moles. 17 moles of CO2 takes volume of a bit over 400 liters. Plus a bit more for the cat, and for gas cooker.

Let's say the flat is 50 square meters, at height of 250 cm, so 125 cubic meters. Atmospheric CO2 is 400ppm, and let's say I want to keep it under 1000ppm, so 600ppm difference. 600ppm of 125 cubic meters is just 75 litres.

These are all heavily rounded calculations, but unless I forgot all the high school chemistry already, I need to somehow fully replace air at home 5-6 times a day to keep it in the happy range. Either by opening windows until fully replaced, or by having some small continuous air "leaks".

This number doubles with a second person, to 11 times a day.

That's a far higher number than I expected.

This number also changes depending on carb vs fat based diet, actual caloric expenditure, and so on, but in any case, it's very high.

Cooking anything generates massive PM2.5 spike

The sensor is placed in the computer room, about as far from the kitchen as it gets. And it looks like cooking anything whatsoever without windows open generates a massive PM2.5 spike for a fairly long time. This can fortunately be easily fixed by only cooking with windows open.

It's difficult to keep Awair happy

Awair never had any serious problems with chemicals, and PM2.5 spikes were only caused by cooking.

The problem were the other three readings. If windows are closed, CO2 levels creep up. If windows are open, CO2 levels go down, but temperature and somehow humidity go into unhappy zone. Pretty much no matter what I do, Awair will be unhappy. Only briefly after closing the windows when temperature goes back up but CO2 is still low Awair becomes briefly satisfied.

Perhaps I should move it farther away from airflow to make it more stable, then again it's fairly close to my computer chair, so it should be more representative of air I breathe this way.

What should I do?

I've been definitely opening windows more now, especially when cooking, but that's not too great - I like my place real warm (24-26C), and the outside is quite cold, especially in the winter.

I don't want to keep windows open too long not just because of higher heating bills, but also because of all the sound coming from outside. I'd have serious trouble falling asleep with bedroom windows open, as I'm extremely sensitive to light and sound when falling asleep. And it's distracting when I'm trying to focus on coding or gaming or just about anything.

I could open some other windows, not those in the bedroom, but honestly I don't think air would circulate much - bedroom door is always just slightly ajar for cat's sake, to keep bedroom as dark and quiet as possible. Closing them fully would generate cat scratching on door sound, which also negatively affects sleep.

Plants?

So an obvious idea is to get some houseplants. It's a bit of a hassle, and the cat would probably damage them a bit. But mostly I have no idea how much CO2 would they really remove. I suspect the numbers would be really low for any realistic amount of plants, making it not worth it. Especially at night, when the light is understandably off.

Or is there any other trick I'm missing?