Wednesday, May 28, 2014

TV as display for Laptop through HDMI

TVs can be used as the displays for laptops using HDMI. For this, the TV and the laptop should have the HDMI port supported. And we need a HDMI cable.

I have ASUS X550LD laptop with Ubuntu 14.04 LTS on it and Sony Bravia KDL-40HX750. The laptop and the TV is connected through a HDMI 1.4a cable. To enable the display following are steps done.

Open the system display settings.

In display settings, we can see the built-in display enabled.

Select the TV display (Sony 40" in my case).

Switch-on the TV display.

Also set the launcher placement to TV.

Now switch-off the built-in display.

And apply the settings.

Now the display would be on the TV.

We may have to do some settings for the sound from TV. Open the sound settings.

There we can find the list of audio devices.

We have to select the 'HDMI / DisplayPort 2' audio device.

In my case, I found the sound setting as follows.

The 'HDMI / DisplayPort 2' audio device is not listed. I muted the laptop speakers and restarted the laptop. Then I got the list including 'HDMI / DisplayPort 2' audio device.

Tuesday, May 27, 2014

Makefile - Checking Build Compiler Version

Building executable from sources is made easy by Makefiles. If a build has to be done by checking the version of the build compiler, then the Makefile can be altered for that.

For example, building C sources using GCC compiler. If the C sources require the C++11 standard supported compiler, then the GCC compiler to be used should be greater than or equal to GCC-4.7. If the build environment has the GCC of version lesser than 4.7, then the build will fail.

For this case, the Makefile can be altered with the following check for GCC version:

GCCMAJORVERSIONGTE4 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 4)
GCCMINORVERSIONGTE7 := $(shell expr `gcc -dumpversion | cut -f2 -d.` \>= 7)

all:
ifeq ($(GCCMAJORVERSIONGTE4)$(GCCMINORVERSIONGTE7), 11)
        @echo BUILD
else
        @echo NO BUILD
endif

Wednesday, February 26, 2014

Taglist - A VIM Plugin for browsing the source code

Browsing the source codes in VIM can be made easy using the plugin "Taglist". It supports many programming languages like C, C++, C#, Python, Java etc. (for the complete list refer An intro on Taglist).

Download and install the taglist plugin for VIM from,
http://vim-taglist.sourceforge.net/

After installing the plugin, we can set taglist variables in the '~/.vimrc' file based on our requirement. For the details on taglist variables, refer taglist usage.

Some taglist variables in my '~/.vimrc',

"Set to automatically open the taglist window on VIM startup
let Tlist_Auto_Open = 1
"Set for the vim to exit when only the taglist window is present
let Tlist_Exit_OnlyWindow = 1
"Set for reducing the number of empty lines in the taglist window
let Tlist_Compact_Format = 1