Author Archives: admin

Programming iOS 6 By Matt Neuburg

There aren’t too many books I own for iOS development.  I’ve been programming Objective-C and Cocoa for long long time even when it wasn’t cool to do so.  But with iOS, things have changed and it’s getting harder and harder to keep up with the changes.

Before I get into Programming iOS 6 review, let me first state that I have previous version, Programming iOS 5 in dead tree version.  So it’s one of very rare iOS book that I own*.

Programming iOS 6 covers just about all aspect of iOS programming.  It won’t bore you with “Hello World” type of contents, just straight to the point on various topics.  It’s like having a buddy who you can tap on the shoulder for quick answers.  I like it as an experienced developer, but this book serves beginners well as it covers fundamentals rather well.

If you’re completely new to Objective-C, I highly recommend that you go out and learn that first before diving into this book.  But if you’re an experience developer diving into iOS, then this one is for you.

* This edition of the book was provided by the publisher for review purpose.

Something New, Yet The Same

What’s the difference between `self` and `this`?

Why do we have both?

Can’t we just have one?

The fact is, people are different. I’m different. Even when we are in fact, same.

I’m a Catholic, a husband, a father, a son, a brother and so many different things to others. However, one thing remains the same, I write code. This is where all those things come together.

Something new, but not really.

Enabling Public Access To Development Machine

Show Note

open ssh tunnel from your local machine

For running Rails app in development, you can do this since rails s runs on port 3000.

localhost$ ssh -R 8088:localhost:3000 remote_server -N &

This creates a tunnel that binds remote TCP port 8088 to local TCP port 3000.

-R flag is for remote binding which tell the remote server to send TCP traffic on port 8088 to my machine. This is basically reverse of -L which binds the local machine’s port to remote.

8088: specifies the port on remote server. Therefore, following command on remote server will give a result assuming that I’m running a Rails app on port 3000.

remote_server$ curl localhost:8088

localhost is the host, obviously my local machine where the traffic will bind to.

:3000 is the local port you want to bind the traffic to.

-N tells ssh to not execute a remote command. Should always use this if we’re just tunneling.

& makes it run in background.

install socat if not installed on remote server

This is the definition from socat.

Socat is a command line based utility that establishes two bidirectional byte streams and transfers data
between them

For Ubuntu, remote_server$ sudo apt-get install socat will do.

run socat to relay public traffic

On remote server, expose a public port and then route the traffic to local port that’s bound to my local machine.

remote_server$ socat TCP-LISTEN:8090,fork,reuseaddr TCP-CONNECT:127.0.0.1:8088 &

TCP-LISTEN:8090,fork,reuseaddr tells socat to listen TCP on port 8090, creating a server at that port. The options are self-explanatory.

TCP-CONNECT:127.0.0.1:8088 tells socat to connect TCP to localhost at port 8088 which is bound to my machine.