Monday, March 10, 2014

Configuring extra mouse buttons in Linux

Most of mice's manufacturers don't support Linux to the extent that they would actually make a software where one could easily customize their mouse. There is no reason to despair though, the process is very, very simple.

We will need three packages - sudo apt-get install xbindkeys xautomation xev

Figuring out the button number

Now, we need to figure out which number corresponds with which mouse button. Run xev. A window will appear and by clicking a button on it the terminal will tell you to which number it is mapped:

ButtonPress event, serial 37, synthetic NO, window 0x3200001,
    root 0xb8, subw 0x0, time 18124629, (152,106), root:(1596,237),
    state 0x10, button 6, same_screen YES

ButtonRelease event, serial 37, synthetic NO, window 0x3200001,
    root 0xb8, subw 0x0, time 18124629, (152,106), root:(1596,237),
    state 0x10, button 6, same_screen YES

This means the clicked button is 6. We will need that later.

Setting up the script

Now is the time to look at xbindkeys. It is a program which translates certain buttons to other buttons. Sounds simple? That's because it is. Run xbindkeys --defaults > $HOME/.xbindkeysrc to create a config file. Then open the file and customize it. If we, for example, wanted to have button #6 translated to Alt+Left, we would add this entry:

"xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'"
b:6

Restart xbindkeys by running killall xbindkeys followed by xbindkeys.

Care about not having spaces before b:6 - it didn't work for me when they were there.
And that is all. You can create others on your own, look up xev for more info about the syntax.

Tags: Logitech Linux mouse extra buttons custom setting

Monday, January 20, 2014

Bring Me The Horizon - And The Snakes Start to Sing

Credits to http://www.youtube.com/watch?v=_Wzr114x84I. I merely rewrote the tabs. They are not complete and not 100% accurate with what Dennis plays. In some cases I chose easier fingering, when it might have been better to have the strings keep ringing.

(Note, ^ marks bending the preceding string. There are different bends, but you will have to figure that out by yourself from listening. It won't be hard though.)

Verse riff (2x)
----------------------------------------------------------------| 
----------------------------------------------------------------| 
---------------10-7--------3-0----------------------------------| 
---8-5------------------------------8-5---------12-8-----12-8---| 
----------------------------------------------------------------| 
-5--------5/8-8----------1--------5-------5/8-8-------10--------| 

Solo
----------------------------------------------------| 
----------------------------------------------------| 
-7^--------------7^---------------------------------| 
-------8/10-7-------10-8-10-7---7-8-7-5-7-5---------| 
----------------------------------------------8-5---| 
----------------------------------------------------| 


-----------------------------------------------------| 
-----------------------------------------------------| 
------------------------------------7-----7/10-------| 
------------------12---------------------------------| 
--5/10--------10-----10----5----6------6-------------| 
-----------------------------------------------------| 


-10^------------------10^-------------------------------------| 
--------11/13-10-----------13-11-13-10--10-11-10-8-10-8-------| 
--------------------------------------------------------10-10-| 
--------------------------------------------------------------| 
--------------------------------------------------------------| 
--------------------------------------------------------------| 

--------------------------------------------------------| 
-----------------15-----------------------13------------| 
-10/12-------12------12--------------------------14-----| 
---------------------------------------12----12---------| 
--------------------------------------------------------| 
--------------------------------------------------------| 

Aftersolo
(4x)

---------------------------------------------------------------| 
---------------------------------------------------------------| 
---------------------------------------------------------------| 
-------12^---------12^-----------12^---------------------------| 
-10-10--------10----------13-13--------5/6--6--6--6\9--9--9----| 
---------------------------------------------------------------| 


---------------------------------------------------------------| 
---------------------------------------------------------------| 
---------------------------------------------------------------| 
-------12^---------12^-----------12^---------------------------| 
-10-10--------10----------13-13--------5/6--6--6--6\3--3--3----| 
---------------------------------------------------------------| 




















Monday, June 3, 2013

Instalace MS Visual Studio pro programování v C++ pod Windows

Disclaimer: Tento návod je určen pro absolutní začátečníky v C++ a programování obecně. Je detailní, aby nedošlo k nedorozuměním. Není tu nic víc než jednoduchá instalace a první Hello world konzolový program.

Stažení, instalace

Visual Studio je k dispozici zdarma na adrese http://www.microsoft.com/visualstudio/cze/downloads.
Po kliknutí na Instalovat nyní se stáhne instalační soubor, který je třeba spustit a postupovat podle pokynů.

Po dokončení instalace (nebo do 30 dnů po) je nutné registrovat se odkazem Register online.

K registraci je povinný Microsoft účet. Pokud jej nemáte, vytvořte si ho. Po přihlášení vyplňte požadovaná pole, v odpovídajících polích zvolte Personal a Private use. Poté již dostanete svůj Product key, který zadáte do Visual Studia.


Vytvoření projektu, hello world

Nový projekt vytvoříte volbou FILE > New project... Zde v menu vlevo vyberte Visual C++, uprostřed pak Win32 Console Application. Vespodu si navolte, kde se má projekt vytvořit.


Otevře se průvodce vytvořením projektu, v něm klikněte na Next > a v dalším okně vyberte Empty project a můžete zrušit Security Development Lifecycle (pro naše aplikace není třeba):


Nyní tlačítkem Finish vytvoříte prázdný projekt. V něm je třeba vytvořit zdrojový soubor - v pravé části okna klikněte pravým tlačítkem myši na Source Files > Add > New item...:


Objeví se dialog, kde vyberte C++ File (.cpp). Soubor nějak rozumně pojmenujte (třeba main.cpp). Vytvoří se prázdné textové okno. Do něj už můžeme psát kód. Jednoduchý Hello world program pak může vypadat třeba takto:


Všimněte si volání system("PAUSE"); na konci programu. Tato funkce zajistí, že okno konzole nezmizí hned po dokončení programu, ale počká na uživatele. (zkuste program spustit s a bez ní).