Tools
Using Git with Xcode, Part I
A few years ago I wrote a series of posts about getting Subversion working with Xcode. Now that the latest versions of Xcode now support Git, I figured I would put together a tutorial about getting Git working with Xcode. Having worked with Git for only a short while, I find it is a much easier source control management system to work with compared to Subversion and others.
Getting Started with Git
If you are brand new to Git, you can get a quick overview of the product and download it by visiting the Git official website. One of the best overviews and tutorials that I have found is at the Git Reference website. The tutorial walks you through how Git was conceived and introduces you to some of the most common commands.
Creating a Local Git Repository for NEW Xcode Projects
The easiest way to put a new Xcode project under version control within Git is to select the Create local git repository for this project check box when creating your project in Xcode. You can verify that this project is under version control by looking for the .git directory under the project. You will need to use Terminal to browse to your project folder and perform a ls -a to see the directory.
![]()
Creating a Local Git Repository for Existing Xcode Projects
To add an existing project to a new local Git repository will require you to use the command line. Open Terminal and navigate to your project directory. You should first create a .gitignore file in your project directory. This file will tell Git to not track certain file patterns.
Here is a sample .gitignore file for Xcode projects:
.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
xcuserdata
If you walked-through the tutorial I mentioned above in Getting Started with Git, these commands should be familiar to you.
1. Initialize a new Git repository
2. Add project files to Git repository
3. Perform an initial commit of files to Git repository
4. Add repository to Xcode
Your code should now be under version control; however, now we need to tell Xcode about the local repository we just created. Open Xcode and from the Window menu, open the Organizer.

The Organizer lists all registered devices, projects, snapshots, documentation and version control repositories. Click on the Repositories icon.
You need to create a new repository, click on the plus (+) in the bottom left of the window and select Add Repository…

In the Add a Repository wizard, enter the following:
- 1. Name – This is typically the name of the project or collection of projects.
- 2. Location – Since we are adding a local repository, this the absolute path of your local repository or project.
- 3. Type – This should be Git in this situation.

After you click Next, your local repository should be listed on the left-hand side of the screen. Clicking on it, should list an entry for your initial (or subsequent) commits and the files modified.
You should now be able to make changes to your project within Xcode and commit your changes using the Xcode GUI. In the follow up posts to this series, I will walk you through using the Xcode GUI to commit changes and also show you how to setup a remote repository on BitBucket.
6 Books to Inspire Creativity in Programmers
I mentioned in a previous post that the secret to success as a programmer is original and creative thinking.
So what if you are not creative? Don’t worry, you’re not alone. In fact, most programmers you meet lack creativity. The reason being is that creativity requires a different type of thought compared to the objective, logical thought of programming.
Luckily, creative thinking is something that can be learned. I have chosen a list of books to inspire your creativity.
Note: This list has no particular order.
Pragmatic Thinking and Learning: Refactor Your Wetware
Andy Hunt
This is a creativity book specifically made for programmers, by a programmer (one of the authors of The Pragmatic Programmer: From Journeyman to Master).
Thinkertoys: A Handbook of Creative-Thinking Techniques
Michael Michalko
Michael Michalko takes you through several visual puzzles to force you to change your way of thinking. This can often be difficult task for those with little creativity.
Thinkpak: A Brainstorming Card Deck
Michael Michalko
Ok, so this one isn’t really a book. Building upon the skills learned in Thinkertoys, Michael Michalko created a deck of cards that you can use to inspire creative thinking and transform your ideas into solutions.
Cracking Creativity: The Secrets of Creative Genius
Michael Michalko
The last of three books (resources) by Michael Michalko. This time around, Michael focuses on how to think like the creative geniuses of history, including Leonardo da Vinci and Walt Disney.
How to Get Ideas
Jack Foster, Larry Corby
Part of being creative is having an original idea, but where does this idea come from? This book will tell you how to inspire new ideas so you can take them to the next level.
The Innovator’s Toolkit: 50+ Techniques for Predictable and Sustainable Organic Growth
David Silverstein, Philip Samuel, Neil DeCarlo
Innovation goes hand-in-hand with technology. Just look at companies like Apple or Google – who are constantly innovating computer hardware and software. This book by Silverstein, et al. is an excellent reference book for those who are innovators. To be a successful innovator, you also need to be a creative thinker.
Programming is the easy part, if you are reading this blog you are probably self-sufficient in at least one programming language. Now you know how to get to the next level: be creative!
If there are any other books that have inspired you to become a creative innovator, please share below in the comments.
Do-It-Yourself Free XML Tool Suite
If you ever had to work with XML documents and XML schemas, it can be pretty challenging if you don’t have the right tools. If you are creating/modifying XML through code (e.g. XML Web Services), it can especially be difficult searching XML nodes or trying to create a validated XML document.
Personally, I believe that XMLSpy from Altova Software is one of the best tools available if you are going to be dealing with a lot of XML documents. However, this tool does come at a price. A few years ago, they used to offer a free community edition of their software – this has since been discontinued.
I’ve recently needed to create and modify some XML and was searching for some tools that fit the criteria:
- Windows Based
- Non-Trial Editions of Software
- Free
I have come up with a list of three tools that perform a majority of the tasks in commercial products like XMLSpy and are a good alternative.
1. XML Notepad

XML notepad makes it easy to edit XML nodes without the need to edit the XML syntax directly. By attaching an XML Schema, your XML document is checked for validation as you input values.
Although this tool has not seen an update since 2007, it is still one of the better free XML editors with a simple, yet powerful interface.
2. XPath Visualizer

If you’ve ever had the need to query XML to find specific nodes, XPath Visualizer provides a way to test XPath queries against an XML document. With the ability to include XML namespaces, the XPath expressions can easily be imported into code environments like Visual Studio.
3. XML Sample Generator
You have an XML Schema, but now you need to create an XML document based off this schema. If you don’t have a tool that helps you visualize a schema graphically, it can be a daunting task to traverse an XML Schema and create an XML document manually. Thanks to the XML Sample Generator, you can import your XML Schema and export a well-formed, validated, XML document.
XML Sample Generator provides a good starting point if you need to start from square one.
Do you have a free tool that you use? Please share in the comments.
More Programming Books Recommended By Readers
Due the overwhelming success of one of my previous posts: 6 Books Every Programmer Should Own, I wanted to compile a list of books suggested by readers.
These books are programming-language neutral and are an effective tool to writing succinct code.
Clean Code: A Handbook of Agile Software Craftsmanship
Robert C. Martin
This book covers the best practices, case studies and first hand experiences with creating “clean” code.
Recommended by: Squirrel Hacker, Noroctal Labs and kodeninja
Refactoring: Improving the Design of Existing Code
Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts
This book covers the best practices in modifying existing code.
Recommended by: kodeninja
How To Design Programs: An Introduction to Programming and Computing
Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi
This book is geared to the beginning programmer and focuses on the design and creation of programs.
Recommended by: Dave
Structure and Interpretation of Computer Programs
Harold Abelson, Gerald Jay Sussman, Julie Sussman
Picking up where How To Design Programs left off, this book explores ways to look at code from an object-oriented point of view.
Recommended by: Dave
If you were the original commenter, please contact me and I will provide a backlink to your website or blog.
6 Books Every Programmer Should Own
I’ve seen many lists about the best programming books and I am sure there are a lot of books that are specific to a programming knowledge or technology – that I have not included in my list.
The books I have chosen are those that are meant to inspire, increase productivity and improve your programming design skills.
Note: This list has no particular order.
Code Complete 2
Steve McConnell
The main focus of this book to help you improve your programming design skills.
The Pragmatic Programmer: From Journeyman to Master
Andrew Hunt and David Thomas
This book focuses on the best practices of programming (i.e. what you should and should not do).
Pragmatic Thinking and Learning: Refactor Your Wetware
Andy Hunt
From the author of The Pragmatic Programmer, this book takes one-step back from programming and focuses on your everyday thinking and problem solving skills.
The Productive Programmer
Neal Ford and David Bock
This book will teach you different tools that you can use to make your programming life more productive.
Algorithms in a Nutshell
George T Heineman, Gary Pollice and Stanley Selkow
Unless you’ve memorized the implementation of every algorithm, this book is a handy desktop reference with pseudocode examples.
Alternate: Introduction to Algorithms
Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein
This book has become a staple in many undergraduate computer science programs. Containing much more information and details on algorithms.
Head First Design Patterns
Lisabeth Freeman, Eric Freeman, Bert Bates, and Kathy Sierra
The people at Head First have a way of explaining things in a straight-forward, non-technical approach – a good tutorial and desktop reference.
Alternate: Design Patterns: Elements of Reusable Object-Oriented Software
Erich Gamma, Richard Helm, Ralph Johnson, and John M. Vlissides
Also a common computer science textbook by the Gang of Four (GOF), this book has much more information and more detail on design patterns.
If you are interested in exploring other programming books and reading reviews, check out ProgrammingBooks.org.
What book inspires you to be a better programmer?
How to Enter Standard Input in Xcode Debugger Console
I was having an issue when I ran a program in Xcode Debugger Console that utilized scanf() the program would just hang.
The program would work correctly when run directly from the Terminal.
The only solutions that I could find online were to install a previous version of Xcode.
Solution
When entering standard input, you need to terminate your string with the forward slash ‘/’.
Example:
4556/ <—- This is what you input
Sum of 4556 = 21
5 Steps for WordPress Preparation
If you are self-hosting your WordPress blog (not using WordPress.com), it is a good idea to setup an instance on your local computer.
Setting up a local instance of WordPress and a development environment will help you tweaking theme source files, test upgraded WordPress installations and test plugins – without making changes on your live site. You won’t be using the local instance for posting, but you might want to post a few dummy posts.
Step One: Installing WordPress locally
WordPress has some tutorials on how you can setup a local version of WordPress using tools such as MAMP, XAMPP, etc. depending on your operating system.
- Windows XP with XAMPP
- Windows XP and Vista with WEMP
- WIndows XP and Vista with WLMP
- Gentoo Linux
- Debian Etch Linux
- Debian Linux
- Fedora Linux
- Ubuntu Linux with LAMP
- Mac OSX with MAMP
Step Two: Install a (source/version/revision) control system
It’s unlikely that you will like everything about a WordPress theme, so before you start editing the theme source files, establish a source control repository to keep track of your revision history.
You can use the SCM of your choosing – Smashing Magazine has a review of the 7 most popular revision control systems in use today:
Step 3: Test all your plugins locally
Before you activate any plugins on your live site, install and test any plugins locally. Some plugins may make modifications to your database and potentially corrupt your WordPress installation. Other plugins may not be compatible with your version of WordPress or behave well with your selected theme.
Step 4: Install an IDE (and a FTP client)
The Appearance Editor within the WordPress Admin site is not the most user-friendly for editing and formatting source code. It is better to use a Text Editor or an IDE that supports syntax highlighting. Some of the better IDE include a built-in FTP/SFTP so you don’t need to switch applications when deploying your files.
Editors with Built-In SFTP/FTP
Even if your IDE supports SFTP/FTP, I would still recommend installing a FTP client such as Filezilla.
Edit your files that are under version control and when you are ready to deploy, FTP them to your local WordPress directory.
Step 5: Install WordPress on your web-host
Most web-host will have some sort of one-click WordPress installation through cpanel or GoDaddy’s Hosting Control Center. These make it relatively easy to setup on your web-host without the need of transferring and configuring WordPress files.
Once, WordPress is installed on your web-host, add the FTP server information for your web-host to your FTP client and IDE.
Note: Once you have WordPress deployed on your webhost, I recommend that you backup your WordPress database regularly – this will preserve your posts. See this post from ProBlogger: How to Backup Your WordPress Blog In Three Easy Steps.
* WordPress Icon provided by BlogPerfume.com
Output PDF Binary to Browser in ASP.NET
Here is the code to output PDF Binary to the browser using ASP.NET / VB.NET.
Note: This code assumes that you already have the PDF binary data stored in a byte() array called data.
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.BinaryWrite(buffer)
Response.End()
To add an Open / Save dialog window:
If you encounter errors in Adobe Reader, make sure that your aspx page contains only the page directive:
An Overview of Microsoft PowerShell
I decided to install SQL Server 2008 Express and while I was resolving my prerequisite issues I noticed that one of the requirements was to have Windows PowerShell installed. I have to admit, I have never heard of Windows PowerShell at this point, I just passed this off as another utility that was included as a part of Visual Studio. Since it was a requirement for SQL Server, I installed it. A few days later as I was exploring my Programs folder I noticed an entry for Windows PowerShell, so I decided to take a look.
My first impressions were that it looked a lot like the command window (cmd.exe), until I did a “dir” command; the output was Unix/Linux-like. I then tried a couple of Unix commands such as “ls” and “ps” and surprisingly they worked! Other commands such as “grep” and “who” did not work. It looks like Microsoft had developed a shell comparable to those found on Unix/Linux and they also borrowed a lot.
PowerShell Resources
I was determined to test-drive PowerShell to see what it was capable of, and surprisingly found out that PowerShell had already been out since late 2006 and there was a lot of documentation and tutorials available. Frank Koch (Infrastructure Architect at Microsoft) developed some workshops and documentation for learning PowerShell that are available for download in both English and German. I walked through the first of his tutorials and discovered most of what you can accomplish in the shells of Unix (e.g. ksh, bash), can be accomplished with PowerShell and the syntax is very similar. Most of the commands (called cmdlets) will utilize pipes ‘|’ to redirect the output of a command to another or to a file. PowerShell also supports looping, and formatted output (i.e. csv, xml, html).
Another great site for PowerShell tutorials and resources is PowerShell Pro! One of the more useful features of the site is the Script Library, a forum where users can find/post shell scripts.
When starting to learn PowerShell commands, you will find that there is a lot more typing involved. Many of the commands will use a “verb-noun” context, for example, the equivalent of the “kill” command is “Stop-Process”. Fortunately, like in Unix, PowerShell supports the use of aliases and by default will map most of the known Unix Shell commands to their respective cmdlet. Here is a list of the built-in aliases:
| Alias | Cmdlet |
|---|---|
| ac | Add-Content |
| asnp | Add-PSSnapin |
| clc | Clear-Content |
| cli | Clear-Item |
| clp | Clear-ItemProperty |
| clv | Clear-Variable |
| cpi | Copy-Item |
| cpp | Copy-ItemProperty |
| cvpa | Convert-Path |
| diff | Compare-Object |
| epal | Export-Alias |
| epcsv | Export-Csv |
| fc | Format-Custom |
| fl | Format-List |
| foreach | ForEach-Object |
| ft | Format-Table |
| fw | Format-Wide |
| gal | Get-Alias |
| gc | Get-Content |
| gci | Get-ChildItem |
| gcm | Get-Command |
| gdr | Get-PSDrive |
| ghy | Get-History |
| gi | Get-Item |
| gl | Get-Location |
| gm | Get-Member |
| gp | Get-ItemProperty |
| gps | Get-Process |
| group | Group-Object |
| gsv | Get-Service |
| gsnp | Get-PSSnapin |
| gu | Get-Unique |
| gv | Get-Variable |
| gwmi | Get-WmiObject |
| iex | Invoke-Expression |
| ihy | Invoke-History |
| ii | Invoke-Item |
| ipal | Import-Alias |
| ipcsv | Import-Csv |
| mi | Move-Item |
| mp | Move-ItemProperty |
| nal | New-Alias |
| ndr | New-PSDrive |
| ni | New-Item |
| nv | New-Variable |
| oh | Out-Host |
| rdr | Remove-PSDrive |
| ri | Remove-Item |
| rni | Rename-Item |
| rnp | Rename-ItemProperty |
| rp | Remove-ItemProperty |
| rsnp | Remove-PSSnapin |
| rv | Remove-Variable |
| rvpa | Resolve-Path |
| sal | Set-Alias |
| sasv | Start-Service |
| sc | Set-Content |
| select | Select-Object |
| si | Set-Item |
| sl | Set-Location |
| sleep | Start-Sleep |
| sort | Sort-Object |
| sp | Set-ItemProperty |
| spps | Stop-Process |
| spsv | Stop-Service |
| sv | Set-Variable |
| tee | Tee-Object |
| where | Where-Object |
| write | Write-Output |
| cat | Get-Content |
| cd | Set-Location |
| clear | Clear-Host |
| cp | Copy-Item |
| h | Get-History |
| history | Get-History |
| kill | Stop-Process |
| lp | Out-Printer |
| ls | Get-ChildItem |
| mount | New-PSDrive |
| mv | Move-Item |
| popd | Pop-Location |
| ps | Get-Process |
| pushd | Push-Location |
| pwd | Get-Location |
| r | Invoke-History |
| rm | Remove-Item |
| rmdir | Remove-Item |
| echo | Write-Output |
| cls | Clear-Host |
| chdir | Set-Location |
| copy | Copy-Item |
| del | Remove-Item |
| dir | Get-ChildItem |
| erase | Remove-Item |
| move | Move-Item |
| rd | Remove-Item |
| ren | Rename-Item |
| set | Set-Variable |
| type | Get-Content |
If you use PowerShell regularly, what tasks do you find it is best suited for?


















