Wednesday, March 18, 2009

Show enable/disable rich text toggle link has no effect

If you use WYSIWYG module in a drupal and notice that "Show enable/disable rich text toggle link doesnt work", here is the patch which will make it work.

Or you can edit the wysiwyg.js file and add an if condition to solve this.

if (Drupal.settings['wysiwyg']['showToggle']) {
Drupal.wysiwygAttachToggleLink(context, params);
}



instead of

Drupal.wysiwygAttachToggleLink(context, params);


Please let me know if it doesnt works for you.

Tuesday, March 17, 2009

Do you use reusable code ?

I came across one of the site (TechRepublic) which had a poll,

Do you use reusable code?

  • Yes, occasionally (52%)
  • Yes, all of the time (28%)
  • No. Even though I write reusable code, it never gets reused. (15%)
  • No. Why bother writing reusable code? (5%)

Total Votes: 317


I answered the second one, "Yes, all of the time", which I thought would be most successful one. But it gave me a strange results, which made me feel bad that am i not doing the right way of coding ? or others are not following as just they are careless... ?

anyway.. I still will be reusing the code, whatever it might happen, which makes me feel better.

Saturday, March 14, 2009

convert all windows format files to unix format

Friday, March 13, 2009

use sed to fetch a part of the file.

Suppose say you have a very huge file which might be in GB(s) and you want only a part of the file to be seen then vi is not suitable to view that file. Instead use a sed which does this job very easily.

sed -n -e 'Start_line_number,End_line_number p' Filename

This will retrieve only those lines staring from "Start_line_number" and upto including "End_line_number"

This is best useful command to retrieve only a part of file which is very huge and big.

Thursday, March 12, 2009

deleting all the mails when logging in the console mode

Do you need to delete all the mails which shows when you log in to the console. Console in the sense it might be ubuntu, mac, or any linux flavours. You might get something like this..

Last login: Fri Mar 13 10:20:10 on ttys001
You have mail.


And you want to get rid of all the mails right ?

The easy and the simplest way to get rid of all the mails is

echo 'd *' | mail -N

This will delete all the mails present for the current user.