Wednesday, August 29, 2012

New to development on MAC

Counting number of lines in files in a directory, recursively. in unix or mac


Method1: This is to find number of lines in objective C source file(has extension .m)
( find ./ -name '*.m' -print0 | xargs -0 cat ) | wc -l

if you are looking for number of lines in only C++ files, change *.m to *.cpp.

Method 2:
above command print only final number, if you want every file's lines, use as below:
find . -name '*.m' | xargs wc -l

courtesy: stackoverflow


Careful while using chrome on MAC:

When you login to chrome to get all your bookmarks and passwords, chrome creates entries in keychain for all your passwords, even if you logoff from chrome, all entries will be available in key-chain and anyone can login to sites where you stored passwords in chrome.


If you forget root user password on MAC:

Follow instructions given here: http://support.apple.com/kb/ht1528

Useful short cuts:

-- while you are editing a big command in command line,
       --use esc key and then delete key, to delete a word
       --use ctrl+e to move to end,
       -- use ctrl+a to move to beginning,
--enter key doesn't open anything in mac, use Command + o  (o is a letter, not a number)
-- delete key doesn't delete file or folder, use Command + delete
--to access network resource, open finder and use Command + k
--get info, use Command + i
--spotlight search, Command + space
--useful xcode shortcuts list was compiled by this guy(thanks), at: http://cocoasamurai.blogspot.in/2011/03/xcode-4-keyboard-shortcuts-now.html


Tools i use:

--text wrangler as text pad.
--smart svn
--

xcode items:

--