3x3x3 Rubik’s cube world (GIF alert) Jul 7, 2019 Introduction I find Rubik’s cube an awesome puzzle. It has simple design, but quite difficult to solve (if you don’t know how to do that). At the same time it is possible to learn how to solve cube — there are a lot of algorithms for solving (for example Fridrich method describes quite a lot of them). These optimized algorithms made popular speedcubing — solving cube on time — with world record of less than 4 seconds. ...
Android Version Code Tricks Jul 4, 2019 Introduction Version code is a special integer value which works as an internal version number. It is not visible to end users. Android system uses this number to protect against application downgrades — it is not possible to install new application with version code lower than in currently installed application. Developers can use version code for example for doing specific tasks on updating to specific version. Version code is placed inside AndroidManifest, but usually it is inside *defaultConfig *in build. ...
Throttling in RxJava 2 Jun 24, 2019 Introduction I don’t know for what reason but I see from time to time same misunderstanding on different throttle operators in RxJava. Usually nobody says about throttle, instead by default everyone says that debounce can be used. Especially using debounce to avoid multiple clicks on buttons is commonly suggested, which I believe is a bad UX (some examples here and here). Let’s finally look at available options in RxJava and find out when it is better to use what. ...
Java-C-Assembly Matryoshka Jun 4, 2019 Source Disclaimers: I’ll use Windows and more particularly Visual C++ with its Inline Assembler. If you use MacOs or Linux you will have significant differences comparing to what is described in the article. Everything below is shown mostly for demonstration purposes Introduction Java is mature self-sufficient language, though as we all know it is possible to “connect” java to C (via Java-Native-Interface or JNI) to speed up some critical pieces of code. ...
RxJava Observable to Single May 27, 2019 Transforming Single to Observable is simple, as Single satisfies Observable’s contract. Just call single.toObservable() and you’re good. But transforming Observable to Single is not that simple: if it happens that Observable emits exactly one value and completes (or terminates with error without emitting values) then it is pretty straightforward, otherwise one need to set up some additional rules. In RxJava there are a number of operators for transforming Observable to Single: ...
How to structure learning for maximum return Apr 10, 2019 A learning framework I developed after many meandering attempts at self-development. ...
Dart language bad design choices Apr 8, 2019 Introduction Before raising a point about some design choices we need to define some criteria. Intent/Declaration > Usage/Implementation Code one write should clearly state the intent. Implementation is not that important than an intent. Implicit is bad Implicit things do not share the intention, therefore from the first point it means that any implicit thing hides true intent. If anything hides intention — it can be considered bad. ...
Kotlin-android-synthetics performance analysis (with ButterKnife) Feb 18, 2019 Introduction After comment that synthetic is no longer recommended practice and some arguments I decided to go deeper into issue with performance of kotlin-android-synthetics by analyzing generated Java and byte code and comparing to other approaches (such as vanilla-*findViewById *and ButterKnife). Vanilla-findViewById This is sample Activity we’ll work with throughout the article. Approach with *findViewById *will be our baseline. Sample consists of: *Activity *class One *TextView *property inside *Activity *with *lateinit *modifier ...
Scary movies Oct 15, 2018 I don’t like horror movies. But this short story is not about that particularly. Horror movies are different: murders, ghosts, fantasy etc. I don’t like horror movies of any kind. But I still can watch them. 1408, final destination, the saw etc. The only thing that scares me in horror movies are people. Not blood, not ghosts. Here I’d like to share few movies, which traumatized my psyche in the childhood (and not only). ...
Kotlin-Java interop: function references and SAM conversions Sep 13, 2018 Though all the things below are pretty obvious if being careful while dealing with Kotlin-Java interop, I decided still to write short note about one particular issue with function references (from Kotlin side) and SAM conversions (from Java side). Function reference Function reference is a good way to pass function as a parameter without explicitly using lambdas. For example, if we have function: fun method(callback: (Input) -> Output) { . ...