Entrepreneur Geek

Nirav Mehta on life, technology and future

Archive for the ‘Apple’ Category

Finding number of lines in files recursively

without comments

I wanted to find the number of lines from a set of files – spread out in nested directories. The shell command “wc” is best for finding number of words / lines in files but it does not have an argument for recursive searching.

Here’s a quick shell command sequence that will find you the line count from all files in a directory – recursively.

find /topleveldirectory/ -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'

Replace “/topleveldirectory/” with your directory of choice. Leave it as “.” to find from current directory and below.

Found on Unix.com

Written by Nirav

December 25th, 2009 at 10:07 am

Posted in Apple, GNU/Linux

Tagged with , ,

National Geographic Photo Of The Day Wallpaper on your Mac Desktop

with 2 comments

I love National Geographic photographs. Sujeet linked to a Nat Geo photo on a tweet today, and that led me to setting up National Geographic Photo of the Day as my Mac desktop wallpaper using an Automator action.

Interested? Here are some notes:

I still remember the sweet old Webshots days! Beautiful wallpapers are always refreshing! May be time to try out their beta mac application!

Written by Nirav

May 20th, 2009 at 2:23 am

MacBook won’t boot – sometimes!

with 5 comments

My MacBook has started misbehaving after 3 years of good service! Last Monday it did not boot. Came with “the folder with question mark”. Which means it did not detect the hard disk.

Removing the battery and putting it back in fixed it for the day. I was able to work happily. Took a backup later in the evening before leaving for a small vacation.

Then yesterday morning when I booted it, it did not boot again. Removing power and booting from battery started it well. Disk Util permission verification and disk verification did not report any problem. All was OK.

I was able to boot again yesterday night. And it froze while I was working.

Sometimes it starts booting, but hangs in between with a crossed circle. Keeps spinning without moving forward.

Not sure what the problem is. I suspect it’s the hard disk – but then it should not boot at all if it’s the hard disk.

Randomness makes a problem all the more difficult!

Time to take it to the service center?

Written by Nirav

May 5th, 2009 at 10:24 am

Posted in Apple, Technology

Tagged with ,

Recursively unlock files on Mac OS X

with 4 comments

I copied some songs from a CD and ended up with a folder full of locked files. iTunes can’t save changes to song info (ID3 tags) until I unlocked them. How can you unlock files recursively on Mac OS X?

If you have a folder full of locked files on Mac OS X, you can quickly unlock all of them recursively with the following command. Open a Terminal, go to the folder containing locked files, and type:

chflags -R nouchg *

An excellent introduction to chflags on Mac OS X Hints. Here’s an excerpt:

In addition to the standard UNIX permissions (read, write, execute for owner, group, other), OS X has a few flags that can be set on files and folders to make them locked.

These flags supersede the standard UNIX permissions. If a file is locked, that overrides the write permissions so that applications treat the file as read-only. If a folder is locked, no files can be added or removed from that folder, no matter what the write permissions on the folder are. These restrictions apply to all users, independent of the permissions that are set on the files or folders. They even apply to the root user (or to admin users using sudo).

Read more about chflags at Mac OS X Server FAQ.

HTH!

Written by Nirav

April 16th, 2009 at 11:31 pm

Posted in Apple

Tagged with , , ,

Picture Puzzle – an iPhone application turned to Mac app because of delays from Apple

with 6 comments

We applied for an iPhone developers account at start of December. It’s been about 3 months now, and we have not yet got the Developers Account despite sending all documents and repeated followups.

We have 4 iPhone products ready to deploy, but our hands are tied because we don’t yet have a developer’s account. We would get emails saying that Apple is looking into this and that we should be patient. But how long?? A delay of 3 months would simply kill your idea. Why does Apple have to be so lazy in granting a developer’s account? I am scared to think how much time they will take to approve an application for AppStore.

The frustration levels went so high, we decided to just drop the plans to release these products.

Then we got an idea! Why not release them on the Mac?

So from frustration to joy, we present to you Picture Puzzle!

main-screen-picture-puzzle-memory-test

Picture Puzzle - more info and download

Picture Puzzle - more info and download

Picture Puzzle is a Mac OSX memory test game. You see a collection of pictures one after another. The objective of the game is to arrange them in right order after initial display. This tests how well you can remember the order of images. It stimulates your brain and helps you remember things better.

It’s a free download, and we encourage you to donate!

Are you an iPhone developer? Know someone? How long did it take for them? Are we the only sufferers?

Written by Nirav

February 25th, 2009 at 11:42 am