Ohhh ... Suddenly my wifi goes off( a combination of DELL with Ubuntu natty) and got a display - wireless disabled by hardware switch. Got down to googling and finally got this.
To get back your wifi to start working, type in the following:
$: sudo rfkill list
You will get back something like this.
0: dell-wifi: Wireless LAN
Soft blocked: yes
Hard blocked: no
1: dell-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
2: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: no
4: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
As you could see (0,2) the Wireless Lan has been soft blocked. We need to unblock it to get it up and working properly.
$: sudo rfkill unblock 0
$: sudo rfkill unblock 2
Restart your networking
$: sudo /etc/init.d/networking restart
and yup! the wifi should be back now.
Tuesday, 12 July 2011
Monday, 4 July 2011
RubyconfIndia 2011
May 27,28 - Attended Rubyconf India 2011 held at Royal Orchid hotel, Bangalore.' For some one who has less than a year of hands on with ruby, it was great hearing from the giants - the very Matz himself expressed his love for the community(in his own peculiar Japaneese way), Ola bini, Chad Fowler, Brian and others. What in short ? - awesome 2 days.


Module functions as class and instance methods
Consider you have a module and a class.
module Mymod and a class Myclass.
The situation in hand is such that certain functions in the module need to end up being instance methods of the class Myclass and certain functions need to be Class methods. You could very well imagine of such situations. Consider you are using ActiveRecord and have a sub class Subscription in correspondence with a DB table. You want to insert logic, within the module, that would work in each of the following case.
1) When a subscription fails or succeeds.
2) When an unsubscription fails or succeeds
You do this.
class Subscription
include SubscriptionLogic
.....
end
You insert the logic as functions of a module, say SubscriptionLogic. Ideally you want the methods containing the logic to be instance methods of the class Subscription. You include the module SubscriptionLogic in the class and you avail all the functions in the module as Instance methods. Now you consider the case when an unsubscription fails - i.e, there is no existing subscription so that an unsub could take place. No way is it possible that you could have a function 'logic_after_unsub_fail' in the module SubscriptionLogic and use it as an instance method, simply because there is no instance available. You think and decide to use the function as your class method, but you have 'included' the module in your class and hence its not possible to use it as your class method. You cannot extend the entire module coz , ideally you want the logic to be instance methods.
So you could get this solved up by a simple piece of extra coding.
module SubscriptionLogic
def after_sub
....
end
def after_unsub
....
end
def after_sub_fail
....
end
module ClassMethods
def after_unsub_fail
....
end
def self.included(base)
base.extend(ClassMethods) # base pertains to the class within which you include the module.
end
end
end
Now within the class insert this line.
class Subscription
include SubscriptionLogic
extend SubscriptionLogic::ClassMethods
.....
end
module Mymod and a class Myclass.
The situation in hand is such that certain functions in the module need to end up being instance methods of the class Myclass and certain functions need to be Class methods. You could very well imagine of such situations. Consider you are using ActiveRecord and have a sub class Subscription in correspondence with a DB table. You want to insert logic, within the module, that would work in each of the following case.
1) When a subscription fails or succeeds.
2) When an unsubscription fails or succeeds
You do this.
module SubscriptionLogic
def after_sub
....
end
def after_unsub
....
end
def after_sub_fail
....
end
def after_unsub_fail
....
end
end
class Subscription
include SubscriptionLogic
.....
end
You insert the logic as functions of a module, say SubscriptionLogic. Ideally you want the methods containing the logic to be instance methods of the class Subscription. You include the module SubscriptionLogic in the class and you avail all the functions in the module as Instance methods. Now you consider the case when an unsubscription fails - i.e, there is no existing subscription so that an unsub could take place. No way is it possible that you could have a function 'logic_after_unsub_fail' in the module SubscriptionLogic and use it as an instance method, simply because there is no instance available. You think and decide to use the function as your class method, but you have 'included' the module in your class and hence its not possible to use it as your class method. You cannot extend the entire module coz , ideally you want the logic to be instance methods.
So you could get this solved up by a simple piece of extra coding.
module SubscriptionLogic
def after_sub
....
end
def after_unsub
....
end
def after_sub_fail
....
end
module ClassMethods
def after_unsub_fail
....
end
def self.included(base)
base.extend(ClassMethods) # base pertains to the class within which you include the module.
end
end
end
Now within the class insert this line.
class Subscription
include SubscriptionLogic
extend SubscriptionLogic::ClassMethods
.....
end
Sunday, 3 July 2011
Back after a Long Gap...
Haven't Written any thing for quite some time now. It was last november that i actually sat down to write something. Started off my professional career then and obviously was busy with work and stuff. Need to get back to writing stuff, little and bigger stuffs that i have learnt while working. In between i have fallen in love with a a new language - Ruby, the popular choice for web apps these days. From a person who never had any kind of fondness for OOP, i have started loving to talk about about objects and classes. Learnt the difference between fun coding and professional coding. These 6-8 months has really been a learning curve for me and i really do hope that my following posts would reflect that.
Subscribe to:
Posts (Atom)