Ne v kontakte Antisocial programmer's blog

Facets of simplicity

Facets of simplicity

    software development     thoughts     golang     dev

Simplicity is com­pli­cat­ed. In the Golang community, this statement is most often attributed to Rob Pike but it turns out a lot of people said something like that. A couple of weeks ago I en­coun­tered this yet again in a debate with a colleague (someone with lots of experience and whose opinion I respect a lot). Both of us considered ourselves advocates for simplicity, yet we were leaning towards radically different technical approaches. Both, of course, were sure that our own solution is much simpler than the other, and even had a good set of technical arguments to support that.

Without going into too many details, we needed a bunch of small business logic snippets executed ever so often against a certain dataset. The whole thing was supposed to be pretty small and simple (no high-load, out of the critical path, latency in­sen­si­tive, etc.), so the main concern was to minimize main­te­nance and debugging effort. In this particular case, the language was Go, but frankly, this can be applied to any language. The two options at the table were:

  1. Define a concrete struct type to hold snippet metadata and snippets themselves would be stand-alone, stateless functions. Execution manager will be another struct that would hold a list of snippets and manage their execution. The execution manager would also hold a bundle of all extra de­pen­den­cies (e.g. static data, RPC clients, etc.) a snippet function might need and that bundle would be passed over to all snippets as a function argument.

    Pros: Everything is explicit and visible at-a-glance: all external de­pen­den­cies (which should be very few) are in one place, every snippet is a stateless function; minimal amount of in­di­rec­tion. Concrete im­ple­men­ta­tion leaves minimal amount of “creative freedom” for those who will be writing the snippets, dis­cour­ag­ing them from using the system for things it wasn’t supposed to be used for.

Read more →

FSEconomy noob: most profitable assignments?

FSEconomy noob: most profitable assignments?

    fseconomy     data science

Not so long ago I’ve discovered FSEconomy, an economy meta-gate for flightsim fans. Despite of somewhat simplistic core mechanics and unfancy look, it has a very active community and a lot of depth to it. I’ve spent last couple of weeks reading the manual, watching community forums and doing some as­sign­ments in the game itself. And the more I was learning the more questions I was having: where to fly? Which aircraft? Rent, buy or lease? What about FBOs? How to find the best as­sign­ments? The manual and community forums have some advices, but I want more definite answers.

I mean, staying net positive is not so difficult, but being efficient is a whole another story. And I want to be as efficient as I can. Luckily, FSE offers a treasure trove of data to support decision-making in a form of data feeds. So I armed myself with Python and spend a few evenings getting some answers.

Since I’m still quite a noob in this game, my high-level plan is this:

  1. Find the most efficient way to build up initial capital without owning any assets.
  2. Find out which assets (FBOs or aircraft, which ones) would provide the most sig­nif­i­cant cost reduction.
  3. Invest and explore less involved methods of gaining revenue: rent/lease business, FBOs and all other fun.

Read more →

Comment branching in C++

Comment branching in C++

    c++     programming     tricks

Recently I’ve stumbled upon a code snippet in my C++ code, which I’d call “comment branching”. For example, you are ex­per­i­ment­ing with two im­ple­men­ta­tions of the same func­tion­al­i­ty rep­re­sent­ed by a relatively small pieces of code and you need to switch between them back and forth until you decide which one will end up in final version.

Consider following snippet:

   

   

<>

If you simply remove first slash from the second line, it turns into this:

Read more →

Hosted by GitHub

Hosted by GitHub

    blog     github     eomy     goodby

Finally, I’ve completed transition of this blog to GitHub pages, planned over two years ago. I did the first step — migration to a static site engine (specif­i­cal­ly, Acrylamid) — back in March 2014. And since than I’ve been saying to myself “one day I must move it to a GitHub as it’s a best free hosting for a static site”.

I couldn’t tell for how long I’d continue slacking like this, but now I had to do this. This site was hosted at free hosting service provided by EOMY.net since it’s very beginning and recently I’ve received a no­ti­fi­ca­tion, that EOMY shuts down it’s shared hosting, completely focusing on VDS. It’s a bit sad news, as EOMY managed to provide fan­tas­ti­cal­ly stable and reliable hosting for all this years, so great thank you for them and good luck with VDS business!

By the way, I have plans on im­ple­ment­ing an automated process of site generation and deployment using TravisCI the way it’s done for GCB-JS. If i do this, I’d be able to blog right from GitHub interface, which would be pretty cool :-)

Rogue Ninja support in CLion

Rogue Ninja support in CLion

    c++     clion     cmake     ninja     projects     dev

In a past few years I’ve been using C++ as my main pro­gram­ming language and during this time I’ve been in constant search for better IDE for it which would run on Linux. I was very happy when Jetbrains released CLion IDE and im­me­di­ate­ly gave it a try. Though there is a lot to improve yet, I’d say that it has best au­to­com­ple­tion and modern C++ support among C++ IDEs on Linux. The only problem I had with it was a build toolchain which it uses.

Currently CLion supports only CMake projects (with is totally fine for me) with GNU Make generator (which is sad). When using CMake, I always preferred Ninja build system, especially for large projects like one I work on as my main job. For some reason Make does not a very good job at in­cre­men­tal builds. For example, even if there is nothing to rebuild, it spends 5 seconds to only verify this fact, which is pretty annoying. On other hand, Ninja does this in like 200 ms.

Un­for­tu­nate­ly, CLion developers currently have no plans on supporting Ninja (I realize that they have many things to do way more important than Ninja support), so I decided to solve this problem by myself.

CMake-Ninja wrapper for CLion

Read more →