Category: dev

Topics loosely related to development and development environment.


Use Docker image directly under Windows 10

Windows Subsystem for Linux allows to run Linux binaries directly under Windows. Next logical step might be to try to install Docker on the Linux, and then run images.

It might work, never tried. But, I’ve discovered (quite late – I have to admit) a way to ‘mount’ directly any Docker image as a subsystem for Windows 10.

What is needed:

 
2 Kudos
Don't
move!

Unique identified of any Type in C++

Simple and useful snippet that helps to make an unique identifier for any type in C++.

template <typename T>
std::uintptr_t getTypeId() {
	static int id;
	return reinterpret_cast<std::uintptr_t>(&id);
}

It uses a fact that function static member of a function is a part of template installation, hence it contains own, unique address.

 

 
1 Kudos
Don't
move!

Configure ConEmu and clink to show git branch

This is an extension to https://trzeci.eu/customize-conemu/ but int this case in a form of a tutorial / guideline that will help me (and maybe you) to mirror this setup.

The description shows how to configure conemu and clink, and display name of current branch:

 

 
16 Kudos
Don't
move!

WebAssembly preview support in every major browser

Today it was announced that Mozilla, Microsoft, Google Chrome and Apple Webkit have got a support for binary format for JavaScript.

What does it mean for JavaScript developers? Nothing probably, they will continue doing JavaScript programming until some tool will compile plain JavaScript (or even ASM.JS subset) to binary format.

So, who is a target for this technology?

Mostly C++/C# developers. WebAssembly is a successor of ASM.JS that cooperates with Emscripten SDK. What is super important, it removes majority of constrains like:

  • i64 emulation: In plain JavaScript has no native representation of 64 bit integers, hence such common type has to be emulated. Quick benchmark made by Mozilla shows, that emulation is 8x slower than native solution. In WebAssembly it’s only 1.13x slower.
  • Contiguous HEAP: ASM.JS requires an emulate HEAP what is basically an array that stores what normally would be stored in free memory. Decent game requires to have about 512MB of HEAP. Problem with this is that it’s hard for browser to find free, not fragmented memory that can holds it.
  • Debugging: Debugging ASM.JS code that has 10MB in size optimal version, or 100MB of JS code of debug version can kill every browser, and stepping through breakpoints takes a few seconds.

 

More info: http://webassembly.org/roadmap/

 

 
0 Kudos
Don't
move!

Use Docker for Emscripten – Usage

logo &switch_logo

Prelude

Docker based solution was a test how Emscripten SDK can be simplified for usage on Linux and especially how it could be used in CI in non-intrusive way.

Links

 
9 Kudos
Don't
move!

Customize ConEmu

I’ve started to look after good console under Windows after I’ve tried console on MacOS and Linux (Ubuntu).

2015-08-30_15-34-36

 
13 Kudos
Don't
move!

Problem with alpha in BitmapData / PNG

BitmapData doesn’t store each data what we would like to store.

If BitmapData contains transparency (from constructor argument, or loaded by Loader). It is possible to store R,G,B information in concrete pixel only if A component is not 0. That makes some problem with right texture support for Stage3D

 
1 Kudos
Don't
move!

Create alias to apps in Windows

Recently I facilitated problem that there is no easy way to create alias to most useful apps in Windows command line.  I found some hacks they require registry modifications and so one.  So because of lag of this feature I decided to simplify my workflow and I created simple Python script.

 
1 Kudos
Don't
move!

Do right things rather that do things right

I think that problem what I had on the beginning was that I tried to make something in perfect way. With perfect architecture. Sometimes it was almost over-engineered but I was proud because of that. I was so stupid. I waste so much time because of that.

Problem of this way of thinking is that I cannot be sure that some solution, or project will be the right one. Sometimes client just says “No, I don’t like it”. Sometimes it is OK, but after a while there is revolution in project and this particular feature will be trimmed off.

I think that it’s better to be able to create several prototypes in not right way. But this gives opportunity to choose the best one, and if I am sure that this is right way I can spend some time to improve it. Even I can delegate this to someone.

In other case I’ve got crap what has been written in perfect way.

 
1 Kudos
Don't
move!

Don’t use ||= operator. Memory leak if there is no coerce.

Adobe scout is great profiling tool sometimes is annoying but only in usability wise.

During profiling application life cycle I have found some peeks of GC process. Like here:

bool

 
0 Kudos
Don't
move!