Changing __MyCompanyName__ In Xcode Templates

How many times have you created your project and then manually changed the default __MyCompanyName__ to your company name? By default Xcode will use your identity card set in your Address Book but sometimes it simply won’t. There is a simple way to specify your company name per project basis. Here is how you would do it:

Select your project in Xcode (refer to the screenshot below).

Continue reading “Changing __MyCompanyName__ In Xcode Templates”

Changing __MyCompanyName__ In Xcode Templates

Typedef Blocks

It is a good practice to typdef blocks before using them in Objective-C. Doing so will not only make our code more readable, but will allow us to tweak the process by which we get the result in one place and make sure the update effects every single outcome where the block was called. Here is how we would typedef a block:

Continue reading “Typedef Blocks”

Typedef Blocks

On viewWillAppear: and NSNotificationCenter

viewWillAppear: method can be one of the trickiest methods to understand. According to Apple’s documentation:

This method is called before the receiver’s view is about to be added to a view hierarchy and before any animations are configured for showing the view.

The problem arises when your app consist of a single view controller and you implement this method in hopes to be notified (or check your setup) when the user relaunches your app. Unfortunately viewWillAppearAnimated: only fires in between view controllers. So if you have a root view controller and a detail view controller, it will be called when the user switches from one to another, not when he/she reopens (assuming background state) your application.

Continue reading “On viewWillAppear: and NSNotificationCenter”

On viewWillAppear: and NSNotificationCenter

Backing Up A Backup With FolderWatch

I like to keep multiple backups of my files. Backups of backups if you will. I have a few terabytes of data sitting my external drives. In particular, the “main” drive contains files I work with everyday. The data on that drive is ten times more important to me than my MacBook Air. The truth of the matter is, simple backup solution like Time Machine (Mac only) is not available for external drives so I had to look for alternatives.

Continue reading “Backing Up A Backup With FolderWatch”

Backing Up A Backup With FolderWatch

Deleting NSManagedObjects From The Database

Core Data is awesome. It is the best way to persist application state hands down. While creating/inserting objects into the database is straight forward, deleting NSManagedObjects from the database is even simpler. You simply envoke the following method on the context:

Here is how you would write a simple method you can call anytime you need to remove objects from the database:

The above method will remove all objects from the database of any given NSManagedObjectContext. Pretty straight forward, huh?

Deleting NSManagedObjects From The Database

List Of Mac Apps I Can’t Live Without

To answer a question I was asked by one of my friends, here is a list of Mac apps (with links to the App Store) I use on regular basis. Feel free to suggest your favorite apps in the comments below.

1Password – 1Password is your password and identity companion. It leaps past simple password storage because 1Password works directly with your browser, saves your user names and passwords, and effortlessly creates strong, unique passwords for each site. 1Password can then automatically and securely log you in, enter credit card information, and fill registration forms, all while encrypting your information with the one password you need to remember.

Continue reading “List Of Mac Apps I Can’t Live Without”

List Of Mac Apps I Can’t Live Without

Ubuntu Server MAC Address

Knowing how to setup Ubuntu server is extremely handy. Not only can you set up a “personal dropbox” file sharing service, you can also host your website, setup and configure ZNC bouncer (IRC bouncer) and much more.

If you own a router that is capable of managing DHCP and you would like to use it to assign static local IP address to your computer using MAC address, there is a simple way to get your Ubuntu’s MAC address via command line.

Continue reading “Ubuntu Server MAC Address”

Ubuntu Server MAC Address