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
com.apple.FinderInfo:
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.apple.FinderInfo & 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 ?
=SEARCH("Party",C9)

returns <1

where C9 contains "Party in Melbourne"

Now if C9 contains "Dance in Melbourne"

then it returns

#VALUE!

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.

=NOT(ISERR(SEARCH("Party",C9)))

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.

=IF(NOT(ISERR(SEARCH("Party",C9))),C9,B9)

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.