TimeLinux1

Wednesday, October 2, 2013

Linux Howto: Missing curses/ncurses Library Ubuntu 12.04

So I tried this simple program to test a Text-screen based program on my Ubuntu 12.04:

mrinal@ms-dell:~/C_Progs$ cat screen1.c 
#include <unistd.h>
#include <stdlib.h>
#include <curses.h>

int main()
{
initscr();
move(5,15);
printw("%s","Hello World");
refresh();
sleep(5);
endwin();
exit(EXIT_SUCCESS);
}

When I try to compile it using the Text-screen library system curses, I get the following error:

mrinal@ms-dell:~/C_Progs$ gcc screen1.c -o ans -lcurses
screen1.c:3:20: fatal error: curses.h: No such file or directory
compilation terminated.

Turns out I dont have the curses.h header file (nor the new ncurses.h)
mrinal@ms-dell:~/C_Progs$ ls -l /usr/include/*curs*
ls: cannot access *curs*: No such file or directory

This means the packages for curses (and/or ncurses) library are missing. To fix this, I did this:

mrinal@ms-dell:~/C_Progs$ sudo apt-get install libncurses5-dev libncursesw5-dev
[sudo] password for mrinal:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
 ...
After this operation, 2,971 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main libtinfo-dev amd64 5.9-4 [103 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libncurses5-dev amd64 5.9-4 [222 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libncursesw5-dev amd64 5.9-4 [255 kB]
Fetched 581 kB in 9s (64.0 kB/s)                                                                                                                  
...
Setting up libtinfo-dev (5.9-4) ...
Setting up libncurses5-dev (5.9-4) ...
Setting up libncursesw5-dev (5.9-4) ...
mrinal@ms-dell:~/C_Progs$ 

After this, the curses header file is now available in my /usr/include directory:

mrinal@ms-dell:~/C_Progs$ ls -l /usr/include/*cur*
-rw-r--r-- 1 root root  6582 Nov 18  2011 /usr/include/cursesapp.h
-rw-r--r-- 1 root root 27630 Nov 18  2011 /usr/include/cursesf.h
-rw-r--r-- 1 root root 76291 Nov 18  2011 /usr/include/curses.h
...
-rw-r--r-- 1 root root  7304 Nov 18  2011 /usr/include/cursslk.h
-rw-r--r-- 1 root root  3925 Nov 18  2011 /usr/include/ncurses_dll.h
lrwxrwxrwx 1 root root     8 Nov 18  2011 /usr/include/ncurses.h -> curses.h

/usr/include/ncursesw:
total 352
-rw-r--r-- 1 root root  6591 Nov 18  2011 cursesapp.h
-rw-r--r-- 1 root root 27648 Nov 18  2011 cursesf.h
-rw-r--r-- 1 root root 93685 Nov 18  2011 curses.h
-rw-r--r-- 1 root root 19522 Nov 18  2011 cursesm.h
... 
-rw-r--r-- 1 root root 40299 Nov 18  2011 term.h
-rw-r--r-- 1 root root 12534 Nov 18  2011 tic.h

-rw-r--r-- 1 root root  3108 Nov 18  2011 unctrl.h

And the program compiles successfully:

mrinal@ms-dell:~/C_Progs$ gcc screen1.c -o ans -lcurses

And executes successfully too.

mrinal@ms-dell:~/C_Progs$ ./ans


Sunday, September 8, 2013

How to do Group Video Meeting on Google Hangout

With Google Hangout we can do a Group Video Meeting of upto 10 users for FREE.
Heres how:

Pre-requisites for Video Meeting on Google Hangout:

1- a Google Gmail account
2- a computer/device with video camera, mike and speakers*
3- high speed Internet (at least 1Mbps is recommended)

*If using external camera, mike and speakers, make sure they are the default in Google (see below)

How to use:

1- Login to your Gmail account -- make sure you are not logged into any other video service like Skype as it can interfere with Google when it tries to access your camera, mike or speaker.

2- Click Contact -- On the left side of your Gmail screen, you have all your contacts. Click the contact name you want to video with. A new window will pop up--this is the Hangout window.

3- Settings -- On the top right of the Hangout window, click the 'Settings' icon -- it looks like a gear.
3a- When you click the Settings, you will see your default camera, mike and speakers -- make sure they are are listed and are the correct device. For eg, if your computer has an integrated camera and you are using another USB camera, then choose which camera Google should use.

4- Invite -- To add more people to the meeting, click the 'Invite People' on the left side of the hangout window.

5- Meet -- Once they accept the invite everyone would be in the same Hangout video meeting and would be able to see each other.

6- To End -- To end the meeting, click the icon on the 'Exit' button on the top right (Telephone receiver with a downward pointing arrow)

Note: When doing video meetings, the recommendation is that same person who starts the hangout meeting, adds the remaining invitees. If everyone tries to invite everyone else, Google gets confused.