Friday, July 15, 2011

Setting up sensors in linux

Just install lm-sensors with this command:

sudo apt-get install lm-sensors


after installation use this command to get the status of the cpu:

sensors

Friday, July 8, 2011

Changing brightness from ubuntu terminal

Try this command:

setpci -s 00:02.0 F4.B=10

value of F4.B can be changed (my limit is 99)

Thursday, June 30, 2011

Easiest way to determine "Follow Set"

Consider the following grammar:

E = TE'
E' = +TE' | e
T = FT'
T' = *FT' | e
F = (E) | id

Here,
First( E ) = { ( , id }
First( E' ) = { + , e }
First( T ) = { ( , id }
First( T' ) = { * , e }
First( F ) = { ( , id }

So, to get the value of Follow (E) we have to pick any one of Es from the right side of the equation. E is in the right side only here F = (E)|id , here right side of E is ')' which is a terminal. So Follow set of E would be ')'. And E is first one to get so $ sign would be in the follow set.
So Follow(E) = { ) , $ }

Now we have to get the value of Follow (E'). At first we have to take any one of the equations from the list where E' is in the right side. Lets take E = TE'
Here right side of E' is empty. So the Follow set of E' would be the Follow set of E (left side of the equation)
So, Follow(E') = { ), $ }

Now it's time to get the value of Follow(T). We can take E = TE', where T is in the right ride of the equation. Here the right consecutive value of T is E' which is a non terminal. So, we have to add it's first set's element to its follow set, adn if the first set has the value 'e' (empty set), follow set of the non terminal residing in the left side of the equation has to be added, Here the first set of E' is {+,e}, so the follow set of T would be {+, Follow set of E} that means {+,),$}

To get the Follow set of T' We can take the equation T=FT' and T' has not any right consecutive value, so the follow set of T' would be the follow set of the left sided non terminal T. That is {+,),$}

Follow set of F can be determined from the relation T = FT'
Here right consecutive value of F is T' which is a nonterminal. So the follow set would be {first set of T', if First(T') contains e add follow set of T}
Therefore, Follow(F) = {*,+,),$}