Moving away from WordPress

It’s time to move forward. I’ve decided to change domain name for my blog, and that change lead me to rethinking the whole site concept. I have some problems with WP, for example, I never quite liked any of the themes that they afford. Secondly, WP doesn’t allow me to host any content I want (Unity3d web builds is an example). And finally, adds on my site are a no-no.

The site is moving to Github pages, my new address is The new version is static (Jekyll + Twitter Bootstrap) and loads extremely fast. This blog will no longer be updated, and all posts and pages will be copied to the new site.

Posted in Uncategorized | Leave a comment

One line of code to make a better quick search in FAR Manager

FarA few testimonials first. FAR Manager was the kind of software which I used a lot on a daily basis. Really, it’s fast, has a rich feature set and looks cool (console-styled interface is quite competitive with those native Windows GUI’s that other managers have). When it comes to reading large files like logs, FAR manager is beyond comparison.

However, one thing that sucks and always did in FAR is the quick search – the search that is activated when you press Alt key and start typing. The concept itself is very useful and allows you to navigate files at the speed of light, but in FAR the whole idea is ruined by the way it’s implemented: FAR seeks the input string only at the beginning of each file name. Let’s imagine that we have a program that consists of an .exe file and many libraries. All file names have the same prefix. For example, they follow some awkward notation <CompanyName>.<ProgramName>.<extension>, which, you know, is quite a real case in business software. As you might expect, there’s no way to quickly navigate the exe file in this directory – you literally have to print the entire file name to select it, because most of the files differ only by extension.

OK, I’m being a little biased here. As I figured out today, you actually can use masks when searching. Considering the case above, we could print “*exe” to select the executable file. But note how many actions you have to perform: press Alt, then Shift, then ‘6’ to print the ‘*’ sign, and only then the essential string that you wish to find. Personally I think it’s a serious usability problem, because FAR is used mostly by programmers and geeks who need fast access to their files, and pressing all those keys is a boilerplate. I also never met anyone who knew that FAR supports wildcards in quick search.

Let’s see how other file manager do the job. I’ve used FreeCommander and TotalCommander – they do it in a most natural way: you print a string, and they select those files that contain the string in their name (not necessary at the beginning). They also have options to tune the behaviour of this feature, for example they can activate the search when you just start typing, no need to press any special key like Alt. Options also include filtering the files list to show only files that match your query.

Honestly, I don’t use FAR for my personal needs anymore. But at work I use it sometimes to read logs, so today I’ve hacked the program a bit to make the quick search more usable. If you have Visual Studio and experience the same problems, go to Google code and download the source code. Navigate to the file far_unicode/filelist.cpp and add one line:

int FileList::FindPartName(const string& Name,int Next,int Direct,int ExcludeSets)
#if !defined(Mantis_698)
	int DirFind = 0;
	string strMask = Name;

	if (!Name.empty() && IsSlash(Name.back()))
		DirFind = 1;

+	strMask.insert(0, L"*");
	strMask += L"*";

	if (ExcludeSets)

As you can see, FAR already turns your string into a mask by adding ‘*’ to the end. We go further and add ‘*’ to the beginning so that the input string is searched somewhere in the middle of a file name. Select the required configuration (debug/release, x86/x64) and build the program. Fortunately you don’t need to install any additional dependencies to build FAR, everything just works out of the box.

Further improvements may involve disabling the Alt key requirement. Really, why is it there? All FAR use cases I’ve seen so far involve a lot of file navigation and editing and very few or no typing in the console. If you want to run some tool very often, go start cmd.exe directly from FAR and type the necessary command there. That will allow you to start the tool fast and from the very same directory each time.

Posted in Uncategorized | Tagged , , , , , , | 1 Comment

My fav AStyle cmd args

Quick tip mostly for myself to not forget my favorite options of the magic AStyle tool, which makes someones’ ugly C++ code look more readable:

astyle --style=allman --indent=force-tab --align-pointer=name --remove-brackets --pad-oper file.cpp

Posted in Uncategorized | Tagged , , , | Leave a comment

Main entry point in Windows apps

Most of the time when you use external libraries to create window for your app (for example, graphics engines like OGRE), the app doesn’t actually need to have WinMain entry point. Moreover, if you’re going to port the app to other platforms, you’ll have to adapt the entry point to be main instead of WinMain. I think having the same main entry point on all platforms could be quite convenient.

On the other hand, only console apps normally have main entry point on Windows. They also auto-create console window, which isn’t what we want in a GUI application. The following steps will help us to solve the problem (assuming that we use Visual Studio):

  • Open project properties
  • Change “Linker -> System -> SubSystem” option to WINDOWS
  • Change “Linker -> Advanced -> Entry Point” option to mainCRTStartup

The System option set to WINDOWS makes application run with no console window. The Entry Point option allows us to specify what entry point the compiler should expect to find in our code (main in this case).

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Something you probably didn’t know about C/C++, part 4

Part 3

Empty declarations in C:

int typedef const;

Won’t compile with -Wall though.

Some people write such code probably hoping that C/C++ has native support for tuples. No, it doesn’t.

int func()
    int a = 1;
    int b = 2;
    int c = 3;
    return (a, b, c);

// ...

int d = func(); // d == c == 3, if () operator is not overloaded
Posted in Uncategorized | Tagged , | Leave a comment

Custom engine in The Witness game

Recently I had a twitter conversation with Jonathan Blow, the creator of Braid and leader of the team behind the upcoming game The Witness. I was wondering why developers decided to use custom engine in their project, considering many good engines already available out there.

Jonathan spoke of the following reasons:

  • You have full control of your code
  • You have no restrictions
  • You can achieve any level of quality you wish (clearly because of 1. and 2.)
  • You owe no money to anyone whose commercial engine you might have been using

These are good points, however they shouldn’t be considered as a 100% guide for you to go and roll your own engine. Do that only if you really need to, if other engines don’t provide you with the necessary tools. Sadly, there were no technical details discussed about what was actually impossible to achieve with existing engines when developing The Witness. Hopefully we’ll hear about it from developers in the future.

Below is the conversation:
Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Test Chambers for Ludum Dare 27

Ludum Dare #27 was held in August 23rd-26th, 2013. That was the first LD for me, so I was very excited and actually nervous, because I was not sure that I was able to do the task in two days. Things got worse when the theme was announced: 10 seconds. I had no idea what game to make.

But I did it. I actually managed to make a complete game in two days, including graphics and music. Music was the most difficult part because I’ve almost never been doing it before (except two episodic cases that I don’t count). The bad news for me was that three weeks later (after the voting period ended) my game didn’t make it to the top 100. Luckily I didn’t expected that to happen, so I wasn’t very upset.

As usual, I used Unity + GIMP + Inkscape, and FL Studio for music.

My entry.

Posted in Uncategorized | Tagged , , , , , | Leave a comment


Finished my work on Wireframe – a DX11 Unity shader for wireframe rendering. More info here.

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Unity3D tip: tasks concept

You are coding a game with Unity3D. What do you normally do when you need to perform some non-instant, continuous action, which will last for a certain amount of time (during a number of frames)? For example, you need to move an object 10 units forward. I bet you write a special component that will be responsible for this particular action. Then you add this component to that object and fill the necessary parameters:

var action = obj.AddComponent<SomeAction>();
action.duration = 2;
action.speed = 3;
// and so on...

Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Something you probably didn’t know about C/C++, part 3

Part 2.

Most interesting parts of this article about designated initialization in C. No more words, let code speak for itself:

struct point
  int x, y;
// ...
struct point p = { 1, 2 } // ok, p now has coordinates (1, 2)
struct point p = { .y = 1, .x = 2 } // ok, p now has coordinates (2, 1)
// Re-assign? No problems, but tricky
struct point p = { .x = 1, .y = 2 };
// ...
p = { .x = 10, .y = 20 }; // compilation error
p = (struct point){ .x = 10, .y = 20 }; // works
p = (struct point){ 10, 20 }; // this works too
int distance(struct point a, struct point b);
// ...
distance({ 1, 2 }, { 3, 4 }); // no-no, compilation error
distance((struct point){ 1, 2 }, (struct point) { 3, 4 }); // fine, this compiles
// Initializing pointer members
struct node
  char *value;
  struct node *next;
// ...
struct node n = 
  .value = "Hello, world!",
  .next = (&(struct node) { .value = "Next node" }) // wow!
Posted in Uncategorized | Tagged , , , , , | Leave a comment