Nov 15, 2013

Core data peer-to-peer synchronization

Drew McCormack is the developer of ensembles:

Ensembles extends Apple’s Core Data framework to add peer-to-peer synchronization for Mac OS and iOS. Multiple SQLite persistent stores can be coupled together via a file synchronization platform like iCloud or Dropbox. The framework can be readily extended to support any service capable of moving files between devices, including custom servers.

Using Python to disassemble a block in LLDB

Luckily, LLDB has a very powerful script bridging interface where the entire LLDB API is available as Python functions. In this article I’ll go through the creation of a Python script that we will be able to invoke from the LLDB debugger.

Damien DeVille provides all you need to dig into Python and interacting with LLDB.

Nov 14, 2013

Create a basic web-server on Mac OS X

Mac OS X (including Mavericks) has an integrated web-server. This is really handy if you need to do run through some basic development/testing from your Mac, without the trouble of finding/configuring a remote server.

Follow these steps:

1) Run the following from a terminal:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

2) Place html content into the folder /Library/WebServer/Documents/

3) Open web-browser and point to: http://localhost/filename

Create bootable Mavericks install on USB drive

ars technica explains how to create a bootable install of Mavericks on a USB stick.

This is a nice to have if your harddrive ever goes south.

Nov 13, 2013

cURL open source tool and library

cURL:

Curl is a command line tool for transferring data specified with URL syntax. libcurl is the library curl is using to do its job.

cURL is an awesome tool for talking to web-services via the command line. You can use libcurl if you need to embed cURL functions into an application, for example a test tool to exercise your Mac or iOS apps.

Nov 12, 2013

Code review and auditing tools

Phabricator is an open source collection of tools for:

reviewing and auditing code;
browsing repositories;
tracking bugs;
hiding stuff from coworkers; and
also some other things.
so features; such applications;

In addition to the GUI interface, there are command line tools available.

Nov 11, 2013

Using bitwise operators in C and Objective-C

One of the wonderful(?) things about Objective-C is that it’s based on C. Part of the power of C is bit-bashing, where you can manipulate individual bits inside of a piece of memory…That being said, there are times where bitwise operations appear in the Cocoa APIs, so it’s good to be comfortable with a couple of basic operations.

With that intro, Mark Dalrymple of Big Nerd Ranch covers the basics of working with bits and the related operators.

Nov 7, 2013

Simplified grand central dispatch (GCD) coding

Rasmus Andersson is the developer of LazyDispatch:

I’m a lazy person and so it hurts me when I have to write so much to do such common things as to schedule various blocks of code in various dispatch queues. This little thing lets me write less code with the added bonus of making the result more readable.

LazyDispatch includes code to simplify usage of dispatch queues, blocks and timers.

Nov 5, 2013

Python, iOS 7 screenshots and the status bar

Dr. Drang writes a Python script to capture iOS app screenshots, overlaying the status bar for consistency.

If you are just getting started with Python, this is a good example that demonstrates some basic image manipulation with Python.

Nov 4, 2013

Enable copy and paste in Finder Quick Look

By default, Quick Look does not allow copy/paste when previewing a document. Here’s a quick fix.

From a terminal enter the following:

$ defaults write com.apple.finder QLEnableTextSelection -bool TRUE; 
$ killall Finder

Why are there two NSObjects in Cocoa?

Mike Ash does a bang up job answering this question:

There are two NSObjects in Cocoa, a class and a protocol. Why both? What purpose do they serve?

Mike briefly covers namespaces, root classes, proxies and protocols.

Nov 1, 2013

Manage Mavericks tags from the command line

As a guy who spends much of his time in a terminal, this looks interesting…

James Berry:

tag is a command line tool to manipulate tags on Mac OS X 10.9 Mavericks files, and to query for files with those tags. tag can use the file system’s built-in metadata search functionality to rapidly find all files that have been tagged with a given set of tags.

Oct 31, 2013

Web toolkit to automatically display online status

Offline.js:

…a library to automatically alert your users when they’ve lost internet connectivity. It captures AJAX requests which were made while the connection was down, and remakes them when it’s back up, so your app reacts perfectly.

How to fix Xcode 5 quick help bug

Recently I was coding in Xcode 5 … and I noticed a bug when trying to view the quick help for a symbol. This is usually done by option clicking on a symbol in the Xcode editor pane. The quick help popup window would show up and then rapidly shrink down to nothing. Most mysterious.

Oliver Jones shares the command line fix provided by Apple to fix this innocuous bug.

Oct 30, 2013

Becoming a programmer, a personal summary

Robert Read on how to become a programmer:

To be a good programmer is difficult and noble. But it is really child’s play compared to everything else that a good programmer must do to make a software system that succeeds…In this essay I attempt to summarize as concisely as possible those things that I wish someone had explained to me when I was twenty-one.

Interesting and thought provoking, even if you are an experienced coder.

Crash course on AWK

Bill Phillips of Big Nerd Ranch presents a short intro to AWK:

If I’m hacking together something on the command line, chances are good that I’m using AWK for some part of it.

There are plenty of great resources on how to use AWK. Rather than write another one, this short post will show you the basics of what AWK is, and what it’s good for.

This is a good post to get the 30,000 foot view of AWK and its use on Mac OS X.

Oct 29, 2013

C regular expression engine for data streams

Yichun Zhang is the author of sregex, a non-backtracking regular expression engine designed to work on large data streams.

The syntax follows Perl 5 regex. There is an included test suite, also written in Perl.

UIColor macros for Objective-C

Below are two macros I paste into most every project. Besides saving a few keystrokes, they work well when using the color picker application. Let’s look at the macros first:

#define RGB(r, g, b) 
    [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define RGBA(r, g, b, a) 
    [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]

Here’s the code without/with the macro:
Continue reading...