Warning: count(): Parameter must be an array or an object that implements Countable in /usr/home/trzeci/domains/trzeci.eu/public_html/blog/wp-content/plugins/wordpress-meta-keywords/wordpress-meta-keywords.php on line 50

Category: blog

Configure graphic and sound on WSL

This is more like a notebook entry, rather than full tutorial.

References:

In this post I will describe how to install WSL on Windows 10, configure X11 to run any Linux application in GUI mode, and fix missing sound problem.

 
296 Kudos
Don't
move!

2016 wasn’t the year of Linux for me.

From the beginning of 2016 I decided to move permanently to Linux as a primary system. I thought through decently this decision. So that I did a list of programs, tools that I use day by day on Windows.

 

Challenge 1: Find a stable and well supported Linux Distribution.

A list of choice was rather not so impressive: Debian, Arch and everything that bases on those. After few installations on a virtual machine, I decided to go in Ubuntu.

Installation itself was in like flynn, every device on Asus K95VM worked nicely.

Challenge 2: Customization.

First month I spent for making a system tailor made, mostly from visual and UX aspect. It’s amazing how far a system can be changed, also it was surprise how different is on Linux to install a video player that just works.

In case of development tools I fall in love to Terminator console emulator. ZSH+oh-my-zsh+terminator provide far better workflow than ConEmu+clink.

Challenge 2: Missing WebGL.

Firefox didn’t enable support for WebGL for my setup, although it’s pretty powerful. One change in Firefox’s settings and I’ve got support for it. This made me to think about update a graphic driver for my primary nVidia card. This was my first mistake. I did update and upgrade, then I navigated to a control panel of Additional Drivers and I selected then highest number. After this system didn’t start properly, and I spend half a day trying to restore it. Eventually I managed to downgrade to 340.96. Right now my laptop works with 367.57 binary driver, and even if I can select 370.28 I’m simply to afraid to do it.

Challenge 3: Support by other companies.

In this case Logitech. Even if mouse works nicely, there is no way to customize all mouse buttons. Somehow I manage to live without my custom settings. Unfortunately, it’s not my level to write my own drivers for it.

Challenge 4: Open/Libre Office.

As a free alternative to Microsoft Outlook, Libre office does amazing job. Literally in normal home-usage cases I haven’t find anything missing. Once I needed to use more advanced pivot table techniques in LibreCalc, I admit that we reached a limit. Don’t understand me wrong. Libre Office for home usage and probably in many cases for a professional usage is fine.

Challenge 5: Energy management.

K95 is not an example of mobile laptop I did few travels with him and I had to rely on embedded energy management. What I didn’t find much useful. I know that due a level of customization one can configure Linux to be very efficient, but from a noobie point of view there is no simple option that could simplify it. As a result of my incompetence and lack of tool, I didn’t manage to have more than 50% of the time that I could have on Windows.

Challenge 6: Multi screen configuration.

No surprises here, unless one of screen is set in portrait mode. In my case my GPU didn’t allow me to put a monitor to portrait mode. I’m not even talking about having a nice GUI that could allow to do it, in my case simple xrand didn’t work.

I found few cases that windows manager didn’t handle multi-screen configuration. It’s not uncommon that once a window is moved to another screen then the windows moves back to an original screen.

Layout manager for Unity/Ubuntu is not such useful like in Windows 10. It allows only to move a windows to right/left half and it’s always hardcoded 50%. It’s far better in case of i3wm or awesome, but this requires more time to learn.

Positive aspects.

Miscellaneous tools useful for development like: valgrind, sanitizers ltrace, strace are amazing.

System update works how it should work, so that I didn’t have to restart my system only because system update.

Early access to the newest compilers, so that it’s easy to learn new techniques (C++ especially).

System looks far better than any Windows, every step can be scripted, and due a convention of storing settings in ~ folder, it’s easy to reinstall system, and have an environment works rapidly.

 

Current setup

I didn’t uninstall Linux from laptop, it’s there still as a development machine, nevertheless where It’s needed better performance in a travel I use an other – windows based laptop. Also I found that Window 10 + WSL (Windows Subsystem for Linux) fulfills a missing part of lack of tools, so that it’s so far my configuration of choice.

 

 

 
4 Kudos
Don't
move!

Compile with WebAssembly on Windows

The base instruction is placed over http://webassembly.org/getting-started/developers-guide/ Unfortunately at this moment (17th of December 2016) It does not cover an instruction for Windows.

One option could be to use Windows Subsystem for Linux :) If this is not an option then remaining options are:

  1. Compile the latest Emscripten locally
  2. Use pre-compiled version
 
21 Kudos
Don't
move!

Doppler Effect removed from Chrome

In Chrome 55+ the function setVelocity has been removed. If your C++ game depends on OpenAL and somewhere you call:

alSource3f(mAlSourceId, AL_VELOCITY,

alSource3f(mAlSourceId, AL_SOURCE_RELATIVE, ...

Then you should either remove those calls, but if your game depends on AL_SOURCE_RELATIVE and you cannot remove it, then it’s required to add a simple snipped to your HTML page:

// A stub for missing setVelocity in Chrome 56+
try {
	if (typeof PannerNode.prototype.setVelocity == "undefined") {
		PannerNode.prototype.setVelocity = function() {}
	}
} catch (e) {}

try {
	if (typeof AudioListener.prototype.setVelocity == "undefined") {
		AudioListener.prototype.setVelocity = function() {}
	}
} catch (e) {}

It’s required due an underlying implementation that sets velocity while you call set source relative.

 

 
4 Kudos
Don't
move!

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!

Windows 10 support of Hi-DPI and Low-DPI displays

Although Windows 10 has significantly improved support for high density displays I do have some strange issue, that I cannot confirm it’s a bug in my setup, or this is something not fixed yet.

 

 
1 Kudos
Don't
move!