Recently I got new computer and I prefer to install everything by myself. On of the programs I use is FAR. Basically it is file manager. It is quite powerful application and it is mostly used by people who work professionally on computer. It resembles old good Norton Commander and it is console application.

Anyway, after I installed it, I found that colors are weird. Initially I thought it is something in video driver settings but after some time I found that all other colors look correct.

Here how it looks on new PC:

And here how it looks on old PC:

Firstly, I would like to setup context. Few years ago, in company where I work decided to upgrade 256GB SSD to better ones. I did research and found that 512GB Samsung 850 EVO. This is great SSD and it works quite well for like 4 years. But eventually it filled up and I had to move some stuff to HDD and finally I decided enough is enough and ask our IT department to buy 1TB disk. I specifically asked for 860 EVO 1TB disk. After one week I got my disk and was happy user since.

Later I was asked to investigate problem with checking out data from one of our source control servers. At the same time, I got

Monitors

For very long time computer screen had ratio of width to height equal to 4:3. Common resolutions were 640x480, 800x600, 1024x768. Every person who works with computer knows the more you can fit vertically the better. You can fit more text when you type or when you read. If you edit pictures, they also tend to be close to 4:3 ratio. But 24” monitor with 4:3 ratio requires much more pixels than say 24” with 16:9 ratio. About 15 years ago LCD panels were expensive. Nobody wants to buy panel with defective pixels and the less pixels the more chance to have no defective pixels. And manufacturers started to sell widescreen monitors. As result when consumers see 24” monitor

Many of you seen code like this:

public async Task Func()
{
    await SomeFuncAsync().ConfigureAwait(true);
    SomeOtherFunc();
}

Let’s assume that this code is executing in main application thread. Is it possible that SomeOtherFunc will be executed not in main application thread? Answer is yes. Let me explain why.

Here is really really simplified version of what compiler will do with our function:

public Task Func()
{
    Task task = SomeFuncAsync();
    SynchronizationContext context = SynchronizationContext.Current;
    task.ContinueWith(finishedTask => context.Post(state => { SomeOtherFunc(); }, null));
    task.Start();
    return task;
}

It actually looks completely different but from point of SynchronizationContext it looks close enough.

In short, when task will finish, it will execute provided callback in

Today I would like to talk about window message queue. Many developers for Microsoft windows familiar with this subject. There are many books about this subject and honestly, I was under impression that each window has own message queue. I even asked many developers around me and most developers were telling the same story. Some believe that there is one message queue for process and some even believe that there is one queue for whole session.

Today I will try to get to bottom of this. If we read here https://docs.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues you will see this: “The system maintains a single system message queue and one thread-specific message queue for each GUI thread”. Just to be clear GUI thread is

Recently I did watch one video about scams in Facebook (sorry I didn’t remember whom I did watch and actually I forgot about that story for quite some time). Basically, one guy found many scams on Facebook that sell some products like notebook but very cheap, like 10% of original price. One example was Microsoft Surface for $50. Another one was Samsung watch for $30. And these scams are using original product texts, images, videos etc. Obviously if you will buy one, you will get some cheap fake. But for unexperienced person these products look legit.

Anyway, that guys reported these scams to Facebook and provided statistics in his youtube channel. And results do not look good for Facebook. 75%

As I wrote before I use Skype extensively. And usually I talk few with few people at the same time. In old Skype it was possible to open separate conversation window for each person. Not only it saves time to switch between different conversation, but it also allows to check who is writing and depending on priority answer now or later. Without this feature it is suitable for occasional use like few messages per day with one or two people. If you are chatting with 5-10 people, 50-100 messages per day it was not that usable. This was biggest feature I missed in new Skype.

And finally, Microsoft added this feature back. In fact, they added it some time ago.

.APK file does not contain all necessary files and files I was looking for were stored here:
/data/data/<game packageid>/files/<version of app>

But that time I didn’t know that and as result I came to conclusion that this thing is done from code. And I decided to decompile game logic. This particular game uses LUA language for most things. This is quite simple language, but it is compiled to byte code and needs to be decompiled back to source code. I immediately found this https://github.com/viruscamp/luadec and I did attempt to decompile simple file but it instantly failed. After some research and looking at simplest file I found that it has only one instruction: Return and it

So, my next step was to read real file, skip first 7 bytes and call decrypt function. To do this I wrote following code:

bool DecryptFile(const char* inputFileName, const char* outputFileName)
{
    FILE* fileHandle = fopen(inputFileName, "rb");
    if (fileHandle == nullptr)
    {
        LOGW("DH: Failed to open input file '%s'", inputFileName);
        return false;
    }
…

And to my surprise code failed on fopen. I checked errno and found that it is EACCES. It means that application does not have enough rights to read this file. I spent few hours trying to figure out where should I place my file, so my application will be able to read it. And one of the most confusing and annoying part about Android is lack of consistency. On one phone has is here, another phone will have it there and on Samsung it is always in third place. Anyway, after few hours I figured it out. I placed them at this location:
/storage/emulated/0/Android/data/com.Android2/files