Before starting with the recently published Trade Me app for jobs hunters, we spent some time reading and thinking about how we can build a stable app and how to make sure that the quality of the app is maintained over time.

I’ll not be covering in this post stuff like having a CI (we use Jenkins), choosing to go with basic MVP, DI (Dependency Injection), mocking HTTP responses, etc… And the value of having presenters like simplifying writing unit tests and forming a habit of writing new test cases to cover new code. …


There are many reasons why we might want to build docker images inside of a Kubernetes cluster. Reasons are out of scope of this post but one reason might be to integrate them in you CI pipelines.

Build and push docker images inside of k8s as you please, on the other hand running containers can be very problematic. It is problematic because k8s will not know about these containers and will not be able to manage them. This just defeats the purpose of using k8s in the first place.

That said if you really need to run unmanaged containers on…


Let us say the designer in your team handed you this beautifully custom button to implement.

It looks nice, it flat, not much to it really. Should be easy to implement.

First you create a StateListDrawable , easy!

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/color_dhuhr_background_pressed" /> <corners
android:topRightRadius="@dimen/default_event_end_corner"
android:bottomRightRadius="@dimen/default_event_end_corner"
android:topLeftRadius="@dimen/default_event_start_corner"
android:bottomLeftRadius="@dimen/default_event_start_corner"/>
</shape>
</item>
<item>
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/color_dhuhr_background"…


Shortcuts

  • Shift + Enter to run a cell (code or markdown).
  • A to insert a new cell above the current cell.
  • B to insert a new cell below the current cell.
  • M to change the current cell to Markdown
  • Y to change the current cell to code.
  • D + D (twice) to delete the selected cells.

Magic commands

  • Time the execution of a single line of code or the whole cell
# Run the code multiple times and find mean runtime
%timeit CODE_LINE
%%timeit CODE_CELL
# Run once and report
%time CODE_LINE
%%time CODE_CELL
  • Use ! prefix to run a single bash command…


https://en.wikipedia.org/wiki/HTC_Dream

The following is based on my experience working on various Android apps for the past few years and seeing how the framework and the development ecosystem evolved over time.

Concurrency

  1. Avoid Async tasks, really do not use them. Kotlin coroutines (👍) or RxJava are much nicer to use.
  2. Don’t use Loaders, if you don’t know what they are don’t bother really.
  3. Don’t use bare threads or manage them on your own.

Clean Code

  1. Use a dependency injection framework, Koin is great to start with.
  2. Avoid dagger in your first project.
  3. Don’t use Guice!

UI

  1. Use Jetpack Components instead of the original Android Support Libraries…


We have 2 options if you want to play media files on Android:

ExoPlayer is easier to work with and it supports features currently not supported by MediaPlayer APIs. The main downside in using ExoPlayeraccording to its docs is that:

For audio only playback on some devices, ExoPlayer may consume significantly more battery than MediaPlayer. (1)

Before we start coding let us think about the main cases we want to handle:

  • The first obvious case is to maintain continuous playback regardless of whether the app is in the foreground or the background. …


Let us start by identifying the problem we want to solve which is inspired by this project.

Given an image containing lines of text, returns a pixelwise labeling of that image, with each pixel belonging to either background or line of handwriting.

The project structure

It consists of 5 main sections, one for notebooks, one for the shared python code, datasets, Google Cloud scripts and one for saving the model weights.

In a production project, you will probably have more directories like web and api.

I also chose to use pipenv instead of conda and virtualenv to manage my python environment. I only…


Recently I got to work on a rewriting of the Software Engineering Daily Android app. SED is a great podcast, you should checked it out if you are not a listener already.

Anyway, starting on a relatively small and new codebase meant that I could try a few things end to end and have a 100% Kotlin codebase. Here are my takes!

One of the first decisions I made was deciding on using a 2 gradle builds (debug/dev and release) setup. …


Summary

One widely accepted intuition is that CNNs combine low-level features like edges to increasingly complex shapes such as wheels, car windows until the object like a car can be readily classified, they termed that as shape hypothesis. This hypothesis is supported by a number of empirical findings. Visualisation techniques like De- convolutional Networks often highlight object parts in high-level CNN features.

CNNs can still classify texturised images perfectly well, even if the global shape structure is completely destroyed. Conversely, standard CNNs are bad at recognising object sketches where object shapes are preserved yet all texture cues are missing. Two studies…


Summary

The main goal of this paper is to maximise face class separability by introducing a new loss function that is highly discriminative to features for face recognition.

According to the writers of this paper, their method showed the best results compared to other loss functions that are good with face recognition like triplet loss, intra-loss and inter-loss. I only compared ArcFace loss with Softmax loss and the improvement was quite noticeable.

Softmax loss has some drawbacks, one of them is that it does not explicitly optimize the feature embedding to enforce higher similarity for intra-class samples and diversity for inter-class…

Mostafa Gazar

An Android Pro, built million-downloads app. Y-Combinator alumni. I write about ML and Android

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store