Skip to main content


Diet diary

I really like play with food. I eat a lot of stuff and try different diets. After the last one, which was supposed to make me feel great, my LDL levels went to values I didn't think were possible at all. My doctor after seeing my tests and hearing my diet story said I don't need another diet, I need medicine treatment. But if diet made my condition, diet will take me out of it. I met with dietician and got request to log everything I eat, divided in 2-3 hour slots. As a person who prefers computers to pen and paper, I tried to find app that would fill my needs. There are plenty of apps to track food, but they all seem too complicated. You need to select every ingredient of every meal, I don't need to know how many calories my food has, I need to store somewhere that between 9 and 12 I have eaten slice of bread with pesto. That's it. Completing this task in most of the apps is just not worth the effort. So I decided to make my own app. I can log whatever I want there. B…

Extract module from swift app

Can the architecture of a mobile application be transformed into a more modular one? In the backend it always pays off but does it pay off in a mobile application? Is it worth to cut functionality into independent modules if we use them in one application anyway? Does it make sense to hide them behind another layer of abstraction? Is it finally possible to do it in a convenient way that helps us instead of standing in the way? The traditional approach is to use CocoaPods. Each framework has its own repository from which we pull the sources and create a project with the pods. Everything is cool except one detail, I would like to be able to edit the sources of my modules in the place where I use them and compile them without any additional actions, i.e. from the point of view of using the code the fact that the components are in another repository is invisible. I wanted to use the Swift Package Manager and its packages. SPM is also very much like cocoapods when it comes to using compone…

Swift, architecture, asynchronousness

Asynchronous calls are one of the elements that have a strong influence on the structure of the whole application. However, they are often treated as a necessary evil or even avoided, if possible. At the same time, iOS itself and the swift language syntax provide tools to make asynchronous calls easier to use.

Swift, like JavaScript asynchronous calls are based on callbacks. This means that when calling an asynchronous function, one of the arguments is another function (or code block) to be called when the asynchronous work is finished. Although the action is different from a synchronous call, the code is nevertheless similar. For example:

func syncFunction() -> String { //some work here return "result" } //call sync let x = syncFunction() print(x) func asyncFunction(callback: @escaping (String) -> Void) { { //some work callback("result") } } //async call asyncFunction() { res in …

Repairing Foscam camera

Since one incident, I've bought cameras to observe the area around my house. One of them (the first one I bought) is produced by Foscam, model FI9900P V1. Unfortunately, my camera broke on the last day of warranty. I packed it quickly and sent it to get the warranty repair. The repair lasted over a month, but the camera didn't work anyway, was as broken as before sending it.  I decided to face the repair myself. With no experience in repairing similar things, it is really hard to find the point where to start.

In my case, I've been plugging the camera and watching the wireshark network traffic to see if the camera is trying to retrieve an address from dhcp (there was not a single packet), if it will configure itself on APIPA addresses in the absence of dhcp, or if I can finally connect to it on the default ip. Nothing.

The next step was to update the firmware. I contacted foscam company, described my problem and asked for help. I got a file with the firmware and instructi…

Wear out or Rust out ?

“We must all either wear out or Rust out, every one of us. My choice is to wear out.” — Theodore Roosevelt.
I've wanted to do this for a long time. I have watched online courses, read books, but somehow I couldn't get down to anything concrete. I had no idea, and writing another hello world is not as fun as it used to be. Fortunately, there was a problem to solve. I have a large collection of photos. It comes up to 1TB and still contains a lot of duplicates. I remove them "on the fly", which means in practice that if you remind me, I look for them and remove them until I get bored, which is quite fast. I even have an automated script in python that catalogues them and also (at least in theory) removes duplicates. But I dreamed of something else. I would like to have a program that will read all the files, count their cryptographic hashes, save them in the database, and every time a new file is added there, it will immediately check if it was not already there. My net…

C# F# - different tones of .NET

I like good programming languages and C# is definetely one of them. It is my main tool at work. But it is not the only language in the world. When I've got a chance to make one of our next services in F# i was more than just happy about it. Some parts (.csprojects) were already done and needed to be replaced by their F# implementation. I thought F# is just another language with "strange" syntax which does the same stuff the same way. Boy, was I wrong. I had trouble to write interface method, then to implement it. Then to properly use other method. This is so much different. For example, in C# you declare everything about method in first line:
string method( string param1, int param2) while in F# it will look more like this:
let method param1 param2 : string See there is no parameter type? You don't have to add that. You can of course:
let method param1:string param2:string : string But the thing is you don't have to. F# is static language just like…

Xamarin Forms Binary Size

Apps on iOS are nice, Xcode is fine development environment and working in it is fun.
I have and app on iOS which I would like to port also to Android.
I thought about rewriting it in Xamarin.Forms. It turned out Xamarin apps (now as a part of Visual Studio) are also nice to write. I choose Xamarin.Forms to minimize code needed per platform.
App is available on github: and has almost all functionality my original app had.
There is, however, one issue. BIG issue. It's the binary size.
While my original iOS app takes less than 2MB on device, Xamarin version is around 100MB. That is not acceptable for so simple app. I don't mind apps being big for a reason.
I would also accept that if it wouldn't make the app slow. But it makes it slow.
Have a look:

Cool ha? Native is so fast! So, what are the sizes exactly?

Native app is 1.1 MB

  Xamarin.Forms app is 101.2 MB

The question is: can I shrink the app to some reasonable size? …