June 30, 2018
We took a 4 days trip to London in early spring and next day after arrival I wrote some drafts to blog post, that I have never wrote. 3 month later, a give up and will publish this draft as it is.
June 22, 2018
Since I got new a camera, I cannot decide, in with format I shoold save photos, jpeg, raw or both. All photos eventually placed in apple photos, and this camera shoots really nice jpegs, but sometimes I still want to use raw, but, at the same time, I dont want to keep all raws, that I'm shooting nor sort them out after I have sorted jpegs. Finally I ended up with simple script, that, at lest, do the job to sorting out photos for me.
Here is link to github gist.
Description is in the comments and code is very straightforward, I just want to notice, how easy and powerfull linq is. The reason, why it took me so long to write it down is that I was sure, that I need to write python script or bash or whatever scripting language is. Truth is, I need to use what I know and comparing two lists cannot be easier, if you are using database-oriented syntax.
May 8, 2018
When I’m writing linq queries, I’m often forgetting, how powerful is it. At least a half dozen times I have wrote a query, that includes objects from one array, that are not exist in another one, like this:
var firstUnique = first.Where(l => !second.Contains(l));
But only today I was enlightened, that much simpler version exist:
var firstUnique = first.Except(second);
It may seem very similar, but make huge difference on structures, that are more difficult than List<int>
Too bad that typescript does not have linq abilities. However, I have found today a spread separator, which helps a lot working with structures. I.e. I have flattened complex dto like this:
var segments = .concat(...groupedSegments.map(bs => bs.segments))
Here groupedSegments
is array of objects, each of them contain segments
, which is array of objects, that I actually need. With one call I make this structure flat.
May 4, 2018
I use my phone every day, probably even every hour, except night. I check Twitter, reading RSS, taking photos, posting them to Instagram, using password manager and keeping track of my to-do list. One thing, that I'm trying to do as seldom as possible is to actually make calls.
I have no idea, is it some kind of phobia or it is just my personality, but I feeling strong anxiety each time, when I have to make call or when phone is calling and I don't know the number. It is just hard for me to react on someone's speech in real time with some limitations in sound quality. On conversation I should listen, understand sentence, optionally translate or recall some words, consider my answer, reread it to ensure, that is right in context and only that speak. This is hard to do in real time and even harder, when you talking with someone on phone, when sound quality is low and you don't see opponents face and mimicry. Almost always talking with someone using phone or any voice manager is a pressure for me and take a lot of energy. E-mails and messengers also got great bonus, that I can go back and re-read conversation, to understand it clearly or just to refresh some memories and touch moments.
The only exception, when I'm pleased to get a call from someone is when I want to listen her voice. And then I'm not really care, what is talk would be about.
Otherwise, no voice calls.
March 13, 2018
In last post I wrote about bluetooth tracker app, that I have tried to create. The idea was to develop battery widget for iOS today’s screen, similar to standard one, just with one difference: it should show not only currently connected devices, but also keep track of previously synchronised.
I use AirPods every day, it’s very handy to always have a headphones in your pocket without need to unravel wires. They can play 3-4 hours by themselves, and charged then by case several times. The problem is that phone shows the battery level of case only when you open it and keep at least one ear piece inside, which in regular usage happened never. There is a LED inside, but with my poor eyesight I constantly got mixed up green with red on such small dot.
Goal was to show last known battery status to all connected and previously connected devices, especially AirPods and their case.
Work with Bluetooth in iOS is relatively simple and in detail described here. The Bluetooth framework called CoreBluetooth and to get battery level of surrounding devices you need to implement these steps:
CBCentralManager
. It should be .poweredOn
kCBAdvDataIsConnectable
. I really hoped, that it is possible to get some information about battery at this point, but, actually, this is the last point, where I have got something from AirPods. Problem was, that they are stated as not connectable and next steps returned no results. And AirPods case doesn’t have any bluetooth at all, I hopped, that it served some host role between ear pieces.Unfortunately, as I said, AirPods does not provide ability to connect them directly. May be I’m just missing some obvious point, but I have spend several hours trying to connect them, when in the end I decided to search in AppStore applications, that will find bluetooth devices nearby. None of them were able to provide more information, that I have found during debugging. I still think, that it should be possible somehow - AirPods can be connected to Android, after all, but after several wasted evenings I gave up. I have some more interesting ideas in mind.
100% JS-free