Thursday, September 29, 2011

Disable a user account in Linux

There are some different approaches to do that. The easy way to disable a user account is to alter stored password which is stored to /etc/shadow. In that case password will be lost unless you save save the password in different file.

You can alter the password by using following command:
passwd {username} {new password}

It might better to lock a account rather than change password if you need to re-activate again. By following command a user account can be lock easily:
passwd {username} -l

If you will ever need to re-enable the account just unlock using following command:
passwd {username} -u

If you don't need to keep the account anymore then use following command to delete a user permanently.
userdel {username}

The above operation will keep his home directory, mails, etc.  Use following command to delete all his files on the system.
userdel -r {username}

Be careful to do that, your mistake may destroy all files of the server.

Note: User still will be able to connect using ssh via key-based auth on changing the user password or locking. If this is used, then the user’s authorized_keys must me moved to a different location.

Monday, September 26, 2011

How to resize Facebook UI dialog

Once, I had to re-size the facebook UI dialog while working on friends invitation widget for The widget was loaded under a popup which was wrapped up by an iframe as well. In this case it was not showing properly, the widget was not accommodate in that popup. That's why had to re-size the widget. I did that by following way..
var old_size = FB.UIServer.Methods["apprequests"].size;
FB.UIServer.Methods["apprequests"].size = {
 method: 'apprequests',
 message: 'A nice customizable first page application, visit -'
}, function() { });
FB.UIServer.Methods["apprequests"].size = old_size;
I have stored the old size first and then assign the size which i was needed. After that re-assign the old size again so that it does not broke my another UI dialog. Because in other case i have used default size.


Use following css class to resize the dialog:
.FB_UI_Dialog {
  width: 320px !important;

Saturday, September 24, 2011

Ruby interpreter has stopped working

From last couple of days, I was facing a problem with my ruby interpreter. It was crashing continuously after few page requests and getting message:

Ruby interpreter (CUI) 1.9.2p180 [i386-mingw32] has stopped working

I have tried to find out the reason and frequency to stopped but couldn't find the actual reason. After googling got a suggestion about css media link. But it does not solved the problem as well.

Finally, I have identified that it happens for missing file. The ruby interpreter was crashed after two request for me if the file missing exists, it may differ for others.