Wednesday, November 11, 2009

Remove Extended attributes present in file permission in Mac OS

Hi Guys,

For the past two days I was struggling to get rid of the '@' character which is appended in the permission for a file whenever used using the TextMate Editor in the Mac OS. I opened TextMate Editor and created a file called "test.txt" which is created successfully but unfortunately the permissions saved are

-rw-r--r--@ 1 kishorekumar admin 5 Nov 11 13:56 test.txt

Now I felt strange regarding this why this @ came and what is that exactly. Later after two days of digging I found the answer and now I am relaxed. Oops sorry to continue my story.. continuing back..

What I understood regarding the '@' is that it is file extended attributes for the Mac files. You can see them with the -@ flag to ls, or with the new xattr command:

ls -al test.txt
-rw-r--r--@ 1 kishorekumar admin 5 Nov 11 13:56 test.txt

ls -al@ test.txt
-rwxr-xr-x@ 1 kishorekumar admin 11614 Nov 11 12:27 test.txt
com.macromates.caret 35

xattr -l test.txt
0000 00 00 00 00 54 78 4D 74 00 00 00 00 00 00 00 00 ....TxMt........
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

com.macromates.caret: {
column = 7;
line = 295;

So now, how to get rid of the '@' and the & com.macromates.caret so here is the simple and fastest solution which works faster.

To Disable the Extra Attributes which gets attached to the file is just run this below command in the Terminal.

defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1

To Enable the Extra Attributes which gets attached to the file is just run this below command in the Terminal.

defaults write com.macromates.textmate OakDocumentDisableFSMetaData 0

Note: Make sure that you restart the TextMate Application else it might not work perfectly.

Hope this might help you easily. If not please let me know I will try to help you :-)

Tuesday, September 15, 2009

Missing Attachment in Outlook but present in Web Gmail

While coding send mail functionality, found that the attachment functionality is not working properly. The attachment is displayed in the Web browser Gmail / Mozilla Thunderbird but when tested with Microsoft Outlook, Apple Mail for a strange it didn't showed any attachment. After a long debug we found that instead of

Content-Type : multipart/related;

it should be

Content-Type : multipart/mixed;

I am not sure what exactly the difference but it worked out to be a wonder for us. So Please make sure that whenever Attachment is attached thru coding we should use only

Content-Type : multipart/mixed;

Hope this might help you whenever you face this kind of problem.

Monday, September 14, 2009

Useful ISERR function - Microsoft Excel

I feel most of the non-IT people & few of the IT people use the Microsoft Excel. Have you any time tried to use the formula to find a value in some cell, have used ? SEARCH or FIND function. Ok if you have used you might have found that it returns 1 if it has found an #VALUE! if it returns false.

i hope you have used something like this right ?

returns <1

where C9 contains "Party in Melbourne"

Now if C9 contains "Dance in Melbourne"

then it returns


Here is a quick and fast solution to fix this and return TRUE or FALSE instead of 1 or #VALUE! which is not useful for further purpose.


Hope this might have solved your purpose, by the way I was using the below line to check whether the Finding string is present then return the cell content else return some other cell content.


hey, I am here to help you...

Thursday, September 10, 2009

Best 1 line command to rename extenstions for multiple files.

One of the best command to rename all the files having same extensions. This is one line command. Say you have 100 files with same extension jpg and you want to convert all the jpg files to gif files so here is the below command to do it.

ls -d *.jpg | sed -e 's/.*/mv & &/' -e 's/jpg$/gif/' | sh

you just need to replace jpg instead of the extension you have and replace gif value with what extension you want to replace.

Hope this might be definitely helpful for you.

Monday, September 7, 2009

svn: Can't copy 'models/.svn/tmp/text-base/comments.php.svn-base' to 'models/.svn/tmp/comments.php.tmp.tmp': No such file or directory

While doing checkout of a project from the repository I got some errors which has been solved very easily.

[mnto]$ svn delete comments.php
D comments.php
[mnto]$ svn commit -m "No Need for comments.php will commit back sometime later" .

I did this and solved the issue and it worked out easily.

Saturday, August 22, 2009

BASH Script to copy a particular file to different directories having the same pattern folder structure

One of the module which was done has to be copied to many directories say roughly around 50 inner directories. I did that by replicating it, but when i tested it i found that I have to change a file in all the 50 directories. I knew there is definitely a way out which can do this job easily and did some googling and used the bash script to write a small program which will do a small wonder for me.

The below bash script will loop thru all the directories (eg., abc, def, mmm ) and copies a file from turn/site/newfile.txt to all site directories which has been looped thru now.

for directory in abc def mmm
  echo $directory
  cp trunk/site/newfile.txt $directory/site/somefile.txt

Note: While reading some sites, I found interesting bash shell script: copy only files modifed after specified date

Hope this might help you to save time.

Friday, August 21, 2009

ER Diagram Tool for Mac

Have you ever did an ER Diagram for the Tables ? hmm, I hope yes, you might have did in your schoolings. Did you thought at that time how much it will be useful later ? Ok, Ok, coming straight to the point, I was figuring out any tool which might do the ER Diagram easily without straining too much. Atlast I found one for Mac.

SQLEditor for Mac

I have downloaded the 30 Day trial and tested it and works fine. I was in search for this which accepts the MySQL exported SQL file and it draws the ER Diagram for it.

Thursday, August 20, 2009

Easy Steps to remove "Read More" , Published by author - Drupal 6

One of the ticket raised in Drupal community was, how to remove the "Read More" link & "Published by Author" with date for a story / page while listing the stories in the website. I just digged the code for exactly 1 min and found an easy solution. Drupal 6 is as good as you think good. But really speaking its really damn good. I went to the garland folder present in the themes folder. I just removed the below two blocks and saved the node.tpl.php file.

<?php if ($submitted): ?>
<span class="submitted"><?php print $submitted; ?></span>
<?php endif; ?>

<?php if ($links): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>

I definitely hope that this might have solve his issue who has raised it in Drupal Themes community. If you feel any issues, please let me know I will try to help as much as possible.

Wednesday, August 19, 2009

Clear Cache in Mac OS X might increase fast bootup

Last week I went to a service center to ask why my Mac book is slow only while booting. One of the suggestion was that RAM present in the Mac to be increased which might cost little expensive. This was definite but spending money would mean that we need to think really is that needed ? Anyway I also asked him is there any other way without spending money really much. He suggested two ways which help to improve the Mac performance better.

a) To clear the caches

To clear the cache you need to move all the files from /Library/Caches to Trash
Also Move all the files from /Users//Library/Caches to Trash

b) Need to have 60 GB of free space

I have a HDD of 200 GB and 2GB RAM in which 1GB RAM is fully utilized by the Mac Leopard itself. Whenever I have less than 40GB of space, my Mac drive slowly and sometimes i feel its hanged but never.

Hope this might solve you too.

Friday, August 14, 2009

use sed to find and replace a particular text

One of my colleague asked me how to find and replace a particular text in a remote shell where X Windows / any IDE is not available. I just googled for sometime and then I tried my self with only one hint to use the sed command. You will not believe I tried it for 5 times and I got the thing working at the 6 attempt, wow i felt so happy. Anyway back to the command, please use the below command to find and replace in any file.

sed -i "s/example/sample/g" *

The above command will find "example" text in all the files present in the current directory and replaces them with "sample" text. The text example / sample not only accepts exact words but regular expression is also possible.

Please feel free to ask me if you need any help regarding this.

Tuesday, August 11, 2009

Copy Window Freezed in MacOS Finder

Before Reading please make sure that I have alternative solution only, I don't have proper solution.

I was trying to copy files from remote location to my laptop, after 25% of completion the network connectivity was lost. I was surprised to see that copy window got freezed and even the cancel button (x) was also not working. I kept the window open for 2 days and meanwhile I was working on the other things. Atlast my laptop started working slowly so I thought if I get rid of this frozen window it would make my life easier. Unfortunately there was no PID for this to kill it, so atlast I made a Force Quit of the Finder which automatically restarted the Finder and it was good. But I don't know is there any other good idea to get rid of this.

Please help me out if you have any answers for this as I couldn't find any solution even after googling it out.

Friday, August 7, 2009

Mysql Number Formating '0000X'

I was just trying to figure out how to print an stored value of integer having 0 pre appended with it.

The best and good way to prepend zero integer value for a integer of fixed size is to alter the table having "UNSIGNED ZEROFILL" as an attribute for the field which needs zero prepended with it.

`ID` int(11) NOT NULL auto_increment,
`some_id` int(6) unsigned zerofill NOT NULL,

You can do when data is present and you want to do this.

ALTER TABLE `table_1` CHANGE `some_id` `some_id` INT( 6 ) UNSIGNED ZEROFILL NOT NULL

feel free to express your thoughts too.

Tuesday, July 28, 2009

Basic SCiTE configuration for Drupal

Suppose you are working on Drupal and new to SCiTE editor and you want to customize then try this little below trick to help your eyes feel cool. The below info will help you to colorize little. This is just a start and would let you guys know how easy to do the stuff. I know most of the guys working in Ubuntu + SCiTE + Drupal for their projects.

In the SCiTE editor click Options Menu then click "Open User Options File"

copy paste the below settings

# Matching braces
# Not maching braces
# Double quoted String
# Single quoted string
# Keyword
# Number
# Variable
# Comment
# One line comment
# PHP variable in double quoted string
# PHP operator

# File patterns

find.files=*.php *.inc *.module * * *.info *.install

#SCiTE Cursor Config

Just Save an you will feel the difference when you open the Drupal's / PHP code file. Please let me know if you need more.

Sunday, July 19, 2009

Sharing files and folders from Mac OS X to Ubuntu

Sometimes you want a folder from Mac OS X to be shared and need to be accessed by Ubuntu then you need to follow the below link, which is really nice and beautiful. I was in search for not using "scp" / "ssh" command as I have to log in as a user and need to give pwd too.

Please follow Mac OS X File Sharing

Wednesday, July 8, 2009

remove host key from .ssh/known_hosts

$ ssh user@

Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /xxxx/xxxx/.ssh/known_hosts to get rid of this message.
Offending key in /xxxx/xxxx/.ssh/known_hosts:4
RSA host key for has changed and you have requested strict checking.
Host key verification failed.
lost connection

When you get this kind of error in your system, it means that either server's RSA host key has been changed or your local machine host key is changed. Don't try to delete the .ssh folder instead, use the below command to fix this issue only for a particular host.

$ ssh-keygen -R

This will help in changing only one host's key to be removed. And now when you do it again it will ask for you to add the host key in your local machine.

Sunday, July 5, 2009

Uninstall SCPlugin for MacOS

I installed the SCPlugin and Subversion Packages & thought would play wonders, but unfortunately it couldn't be useful much for me. I left it unattended but suddenly I got some strange error like this..

This client is too old to work with working copy '/Users//Public'; please get a newer Subversion client
The tool /usr/local/bin/
may be used to convert this working copy to match this SCPlugin (see 'About'), but you will loose any features of the newer Subversion you may be using

I tried googling but unfortunately I couldn't find any solution and after some couple of weeks I found some how to do uninstall it.

Please remove /Library/Contextual Menu Items/SCFinderPlugin.plugin
Remove /Library/Receipts/SCPlugin.pkg -> version might be also appended sometimes
Remove /Library/Receipts/Subversion.pkg

Feel free to ping for any help.

Monday, June 22, 2009

diff ignoring .svn directories

Easy way for comparing two directories and ignoring svn directories. Use the below command to compare two directories recursively and ignoring .svn directories.

diff -r --exclude=".svn" sub/dir/one sub/dir/two

let me know if you run into issues.

Wednesday, April 15, 2009

Removing all the .svn directories command

Its very easy to delete all the .svn directories recursively by issuing the below command.

rm -rf `find . -type d -name .svn`

This will delete all the folders with name .svn inside the current working directory and recursively inside all other sub-directories too.

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.