Skip to main content

Posts

Showing posts from 2015

Huawei TalkBand B2 review

Ok, so I've bought a new gadget. It was long overdue because I, being a MediaPad X1 user, sometimes feel uncomfortable pulling that monster of a phone just to check the time on answer a call. Of course, Bluetooth headsets are cheap and abundant but I don't really like the idea of keeping one in my ear all the time. And having it not in the ear usually makes it pretty much unusable. Various wearable gdgets that can show time and some notifications aren't new either, and there are a lot of cheap options, but, again, there are even cheaper watches and I don't care much about fitness tracking (I don't mind it though) and notifications (reading long texts is seldom convenient on a small screen anyway). So when I heard about the new TalkBand that combines watch and wireless headset I was all interested, read reviews, became even more interested, and waited a few weeks only because of the price and availability. The price, for most people around the world it might seem a

Mobile accessories review

As some of you know, I'm a happy owner of Huawei Mediapad X1. So far it's the best 7" phablet (not counting the new Mediapad X2, obviously, which has better hardware with the same size and slightly changed buttons) but this post is not about device itself, instead I wanted to write a few words about cables, cases, screen protectors available on the market. By "market" I usually mean Aliexpress but some stuff might be available in your local stores as well. I'm not endorsing any sellers or brands, especially not original accessories, and prices are for reference only (and usually are for one piece and include shipping i.e. if you're thinking to buy a dozen of something, you might be able to find a better deal). In almost all the cases there might be cheaper options but with worse quality, seasonal deals and everything tend to change every month as new manufacturers and sellers come to market. Unlike competitors' devices in the same form factor (I'

Settling the bracket discussion once and for all

There are quite a few ways you can format a multi-line function call/list/dictionary in a programming language. With Python (at least with PEP8) it's just two ways: hanging indentation and vertical indentation. The latter is quite straight-forward and I mention it in the notes below. The former one is what this post is about. Well, about a minor but important question of where to place the closing bracket when using it. Yes, style is much more than formatting the commas and brackets so let's settle this and move on to the more important questions. When using hanging indentation, the only true way is this one(*): some_tuple = ( # Nothing here, only opening bracket. item1, item2, item3, item4, # Several items on one line is acceptable though not recommended. item5, # Last comma is important. And never, never place the closing bracket here. ) # Again, nothing here but the bracket and it's on the same level as the opening line. Empty line after the o

Using Docker: Is it worth it?

Many companies these days are starting using Docker in their workflow, both big shots and tiny startups, even open-source projects which might sometimes be somewhat conservative when it comes to tools. I'm not trying to provide any kind of instruction here but instead to ask questions you should be asking yourself before following or not following their lead. I'm concentrating on context of web services using Django and Python, but it should be applicable to more or less anything. I must admit that Docker is cool. Linux containers is a fascinating thing itself and Docker is a great tool for simplifying their use for whatever purpose. Reusable and simple to build and share images, an easy way to launch those images and do stuff with them is a must if you use them. But should you containerize everything? It might, on the other hand, over-complicate your process without any significant benefits. So the first question is: do you even need containers or would you better off withou

A small catch in Python documentation (strftime).

Every developer knows  datetime.strftime()  method, but some don't know that its argument's format is not documented in full in the official documentation. For example, you won't find any mention of %s directive there which means UNIX epoch time, timestamp. It works (at least with every major version of Python on Linux, FreeBSD, and MacOS), I've tested it a few times myself, it's just not documented. I recently saw a piece of code where developers, being unaware of such a directive, used custom format string with both datetime.now() and time.time(), a function generator, and on top of it messed with model migrations (it all was about FileField.upload_to if you know what I'm talking about) when they could just use %s. From other undocumented features you might be interested in these: %C  is a century (%Y//100), could be helpful for complimenting %y or something, I guess. %u  is a weekday number with Monday as 1 and Sunday as 7 (as opposed to %w represen