Archive for category Programming

How debuggers work

Interesting post on how debuggers work.

Other interesting articles:

  1. Abusing mach on Mac OS X: Discusses how to replace some ptrace functionality using Mach functions
  2. mach_star and mach_inject (still being developed?): Opensource code to dynamically load your code into a running process. Port for Intel machines. Also see this link.

Game Physics

Ok not quite game physics but a very good article on modeling collisions in a game. The author talks about modeling both “hard” collision – like a billiards ball hitting another – and soft collisions (sumo wrestlers).

Article at MacResearch: The Physics of Sumos (A Flirtation with iPhone Game Development)

How to pick an open source license

A list of articles comparing licenses

  1. From ZDNet blogs: Part 1 and Part 2
  2. Milking The GNU: Picking an open source license w/o becoming brain dead
  3. Choosing an Open Source License
  4. An impassioned plea to pick a license.
  5. And finally the WTFPL.

Write your own compiler

Here is the link.

iPhone SDK Cookbook

Excellent set of code examples but seems to contain no text or explanations. Associated videos are HERE.

Objective-C Notes

Fast enumeration:

     NSString *element
     NSArray *myArray;
     for (element in myArray) {
     }

     for (NSString *foo in myArray) {
     /*do stuff*/
     }

SVN Cheat Sheet

Reference: The SVN user manual

These instructions will create a repository on your local disk with capability to support multiple projects. I use the file structure layout recommended in the SVN user guide.

Using one common repository for all projects:

Pros:

  • One place to hold all your projects. One set of hook programs/scripts.

Cons:

  • Each project may have different event triggers (e.g. who gets emailed when a check in is made). Hook scripts need to manage these issues.
  • Revision numbers are global to the repository. So though no changes have been made to a project it will still get a new rev number if some other project gets checked in.

The recommended directory structure (in svnbook):

MyMainSvnDirectory/
    Proj1/
        trunk/
        tags/
        branches/
    Proj2/
        trunk/
        tags/
        branches/

Creating a Repository:
    svnadmin create MyProjects/

This will create the following under MyProjects/

MyProjects/
    README.txt
    conf
    dav
    db          – Holds the versioned filesystem
    format
    hooks

Initial import:

    svn import Proj1 file:///Full_Path/MyProjects/Proj1/ -m “Initial import”

This will copy files in Proj1 into the directory Proj1 in the repository. After the import is done the original directory is NOT converted into a working copy. You need to check out the code in a separate directory.

Checking out code:

    svn checkout file:///Full_Path/MyProjects/Proj1 WorkingDir

This will check out the latest committed copy of Proj1 into WorkingDir

Adding a new file:
   
    svn add filename

Do this from a checked out working directory

Deleting a file:
   
    svn delete filename

Examining changes:

    svn status
    svn diff

Resolving conflicts:
   
    svn update
    svn resolve

Commit changes:

    svn commit

Browsing the repository:
   
    svn list file:///Full_Path/MyProjects
    svn list file:///Full_Path/MyProjects/trunk

Creating a branch:

    svn copy file:///Full_Path/MyProjects/Proj1/trunk file:///Full_Path/MyProjects/Proj1/braches/branch1 -m “Creating a new branch”

Creating a tag works the same way except you copy to the tags directory.

Misc Programming Links

C Programming FAQs:

Assembly Programming Links:

Misc Other links:


Building 32-bit mode on a 64-bit Linux machine:

Set LDFLAGS to  ‘ –verbose –format elf32-i386 ‘. If that does not work try export GNUTARGET=’elf32-i386′.

Interesting Podcasts

Vector Mathematics for Computer Graphics