Saturday, November 27, 2010

Some probability

among N persons, willing to go to a place X, in one of the 5 working days.

Step1: probability that day chosen for outing is friday = 1/5 * preference_index.

Step2: probability of day chosen as any other day = 1/5 * (1 - preference_index).

preference index =  persons choosing to go on friday / 2  +
                               persons ignoring friday as it will be
                               occupied by atleast one more ppl /2

2 = minimum number of persons required to make the place X
occupied when you are there.. (you + one more = 2)

if k persons out of N choose a day and n = k/N.. (which turns out that k -> N if none of the N person ditch their plan to go to place X)

preference_index = n/2 + (1-n)/2 = 1/2

substituting the preference index in Step1 and Step2,
It doesnt make things any better if you go on any day of the week..


Critiques and comments welcomed.

Thursday, November 25, 2010

Pidgin notification pop-up blocker in ubuntu

In Ubuntu with pidgin 2.7.1

It's very disturbing to have a notification popping up everytime a user logs in.
If you want to stop that, go to Tools > Plug-ins and uncheck the 'Libnotify Popups' plugin that is responsible for the notifications. Enable the plugin when you want to re-enable notifications again. 

Wednesday, November 24, 2010

sound not working in ubuntu.

- check alsamixer if the voice is muted.

if not,
- check if the sound is muted in root account!

if not,
- start the audio /usr/bin/pulseaudio

if not,
Dont know any alternatives as of now :)

Tuesday, November 23, 2010

Printer Bug in ubuntu

One more common bug:

To start the printer services,

user@ubuntu:~$ sudo service cups start
 * Starting Common Unix Printing System: cupsd                           [ OK ]

Monday, November 22, 2010

Monitor Resolution in ubuntu

I experienced a bug with Ubuntu, when i use extended monitors.
The monitor resolution was not getting recognized beyong 1024x720

I wanted the monitor resolution of 1440x900

Workaround:

user@host# xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync


user@host# xrandr --addmode VGA-1 1440x900_60.00

Next the newly added resolution can be selected from sytem->preferences->monitors

Sharing screen session

screen is a popular text based window manager, which allows
multiplexing several interactive shells in a single terminal. It
is possible to share one's screen session with other users on the
same host, for the purpose of collaborative debugging or the like.

These are the settings for enabling the multiuser mode in screen.

Lets say Alice wants to share the screen session 5810.screename
with Bob.

1. Allow multiuser access in the screen session:

    Ctrl-a :multiuser on

2. Give permissions to the user to access the screen session

    Ctrl-a :acladd user_id

user_id is the login ID of the person, with whom the screen session
is to be shared.

In our example,

    Ctrl-a :acladd bob

3.The other users can now connect to the shared screen session.

    $ screen -x username/session.

In our example, Bob can connect to the session by

    $ screen -x alice/5810.screename

Note that this is applicable on one machine.

screen for starters

screen is a popular text based window manager, which allows
multiplexing several interactive shells in a single terminal.

To start a screen session is pretty simple:
(byobu as an alternative to screen can be used in ubuntu)

user@ubuntu:~$ screen

This starts a screen session with a particular process id(pid).
To resume/kill the screen session, this pid is used.

For people who would like to deal with names rather than pid numbers, a name can be associated with the screen session with:

+ user@ubuntu:~$ screen -S my_screen_name


Ctrl-a is the screen-control. All the screen related features is prefixed with ctrl-a.

+ Name the tab:
ctrl-a : title tab_name

+ creating a new tab:
ctrl-a c


+ shift between tabs:ctrl-a <tab_number>
ctrl-a <space>
ctrl-a p             (previous)
ctrl-a n             (next)

 


+ kill the tab
ctrl-a :kill


+ detach screen:
ctrl-a d

[detached from 4372.my_screen_name]

 + look at the existing screens


user@ubuntu:~$ screen -ls
There is a screen on:
    4372.my_screen_name    (11/23/2010 11:30:08 AM)    (Detached)
1 Socket in /var/run/screen/S-vprasad.

 + reattach a screen

user@ubuntu:~$ screen -dr pid/screen_name

Splitscreen in Vim

To have a multiwindow editting mode in vim,

:sp filename

to switch between the windows
ctrl + w + j/k
or ctrl + w + ctrl +w

Screen shot: