What Programming Language Should I Learn Next?

What Programming Language Should I Learn Next?

I am a big fan of reddit and it is usually my primary source of reading what’s new.

There is a sub-category (sub-reddit) on Reddit for Programming and one question that is posed very frequently is: What programming language should I learn next?

If your purpose for learning a new language is career motivated, I recommend that you start your quest looking at what what top companies are searching for in candidates. Companies such as Microsoft, Google and and Apple will generally seek individuals who have knowledge of the core programming languages such as C, C++, Java and will mix in some of the more cutting-edge technology such such as AJAX or jQuery.

Here are some sample job requirements from Google, Microsoft, Facebook and Apple.

Google - Software Engineer

  • BS, MS, or PhD in Computer Science or related technical discipline (or equivalent).
  • A solid foundation in computer science, with strong competencies in data structures, algorithms, and software design.
  • Extensive programming experience in C/C++ and/or Java (strong OO skills preferred).
  • Several years of large systems software design and development experience, with extensive knowledge of Unix/Linux.
  • Coding skills in Python or Javascript/AJAX, database design and SQL, and/or knowledge of TCP/IP and network programming are a plus.

FacebookFront-End Engineer

  • A passion for performance debugging and benchmarking Experience building JavaScript/HTML/CSS applications and frameworks
  • Experience working with JavaScript/HTML/CSS in high-performance environments
  • Knowledge of but not reliant on Prototype JS, MooTools, Dojo, jQuery
  • Identify performance bottlenecks in JavaScript applications
  • Build performance minded front end abstractions and systems
  • Provide code optimization recommendations
  • Prototype and implement optimization techniques
  • Benchmark existing code and enhancements
  • Participate in design and code reviews
  • Code primarily in JavaScript, HTML & CSS
  • Interface with other team members to incorporate their innovations and vice versa
  • Identify and communicate best practices interpersonal and communication skills, and proven ability to work effectively with all organizational levels
  • BS or MS degree in Computer Science or Engineering preferred

MicrosoftSoftware Development Engineer (SDE)

  • Pursuing a B.S./M.S. or Ph.D. degree in Engineering, Computer Science, or related field
  • 1-2 years experience programming in C/C++/C#, Java, and/or other computer programming languages preferred
  • Ability to derive creative and innovative solutions by thinking “outside the box”
  • Expertise in feature definition, design, and feasibility
  • Demonstrated skill in estimating development time

Apple - Application Software Engineer

Key Requirements:

  • BS CS/CE or equivalent
  • Strong programming skills, preferably with C, Objective-C, and/or C++
  • Excellent communication and collaborative skills
  • Excitement and passion to work on amazing products
  • Deep understanding of performance assessment and optimization
  • Proven ability to excel in a fast-paced development team

Preferred skills:

  • Mac OS X and/or iPhone OS programming experience
  • User-interface programming experience
  • Familiarity with web technologies and XML

By reviewing the job postings of the leaders in technology, you should be able to get a good idea of what is in demand these days.

I know from past experience when I looking for a job, I often saw postings that listed every programming language known to man: Cobol, Fortran, Pascal, QBasic, C, C++, C#, VB, VB.NET, Java, PHP, Perl, Python, Ruby, etc. Any not only that, they were looking for 10+ years experience in each one. These types of postings are unrealistic, not to mention ridiculous – it is highly unlikely that anyone has all the required experience (especially 10 years of .NET).

There is nothing wrong with learning an outdated or obsolete programming language for fun – I encourage it, if you have the time to learn it. But for advancing your career, a solid understanding of a core language is key.

Beyond programming skills, you might decide to acquire skills in another area such as development estimation, code design, or something non-technical such as communication skills.

How do you decide what you are going to learn next?

6
5 Steps for WordPress Preparation

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.

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

1
How to Find Time for Learning

How to Find Time for Learning

One of the biggest challenges when trying to learn something new is finding the time to do it.

We all have obligations (work, school, family, sleep, etc.) that require our attention and finding free time in amongst all of these can sometimes be difficult.

Scheduling Out Your Day

Here’s an activity for you to perform to figure out how much free time you have available.

Note: Everyone’s schedule will differ on different days, but start by looking at the the 24 hours that you have available in a typical day.

A typical workday

Work: 8 hours
Sleep: 8 hours
Quality Time: x hours
Free Time: 8 – x hours
Total: 24 hours

Required Time: Work and Sleep

First, subtract 16 hours, this includes 8 hours for work (assuming you work a typical 8 hour day) and 8 hours for sleep – you will be left with 8 hours.

I would recommend against taking time away from work and sleep. You might be able to get away with modifying your sleep schedule occasionally, but try not to make a habit out of it. Also, if your employer allows you to take 30 minutes during working hours to explore something new, then adjust the hour allocation for work.

Quality Time

The remaining hours will vary depending on your lifestyle, but are what I call Quality Time – time that you cannot be substituted for other voluntary activities. Subtract time you spend getting ready for work, eating (breakfast, lunch and dinner), commuting, spending time with family (or significant other) and any other activities in which you participate in a typical workday.

Free Time

Your Free Time should be things that if they are not done, the consequences are minimal. This might be things such as time spent watching TV, exercising, browsing the internet, reading, etc. This is the time that you can allocate for learning something new.

Determine What’s Important

If you completed the exercise and found that you don’t have any free time, what do you do? Determine what’s important to you or prioritize. Is watching your favorite TV show more important to you than spending time learning something new?

Create Time

Of course you can’t create time in the literal sense, but you can adjust your habits so it appears that you have more free time. If you must do everything on your list, try modifying the time spent on each activity – instead of exercising for 1 hour, exercise for 30 minutes. Here are a couple things that you can do to change your TV habits.

1. Stop Watching Commercials

If you have a Tivo or DVR, record all of your favorite shows and watch them when you have time. By skipping commercials, you can save over 15 minutes of commercials are shown on TV every hour. Or you can watch shows on your computer via Hulu.

2. Browse Internet/Email During Commercials

If you don’t have a DVR and like to watch shows at their scheduled time, productively use the time during commercials to do other things such as respond to email or browse the internet.

The free time that you have will fluctuate throughout your life, but it’s important that you always try to allocate some time to your continued learning.

1
Output PDF Binary to Browser in ASP.NET

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.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.BinaryWrite(buffer)
Response.End()

To add an Open / Save dialog window:

Response.AddHeader("content-disposition","attachment;filename=report.pdf")

If you encounter errors in Adobe Reader, make sure that your aspx page contains only the page directive:

<% @ Page Language="vb"%>
0
How to Read a Book Using SQ3R

How to Read a Book Using SQ3R

Before I entered college over 10 years ago, I participated in a 1-day seminar for incoming freshmen called Strategies for Success. The purpose of the seminar was to introduce you to study habits and prepare you for the college workload. What reminded me recently of this seminar was a book that I started reading: ‘Secrets of the Rockstar Programmers’. The book is a collection of interviews with top programmers. In the first chapter I came across a term that looked vaguely familiar: SQ3R. When I got to thinking about it, I recalled that it was during the Strategies for Success workshop that I originally heard about this.

What is SQ3R ?

SQ3R is an reading strategy, abbreviated: Survey, Question, Read, Recite, Review. This technique is meant to be applied to a chapter in a book. Some textbooks have indirectly adopted this strategy by including a chapter outline, a pre-test, chapter summary and a post-test.

If you were to apply SQ3R to a book on the Python programming language, this is how it could be done:

Survey

During this step you want to skim through the chapter and read any headings, diagrams, charts, pictures, etc. You do not want to read too much in depth but rather get a overview of what to expect in the chapter.

Some items that I might pull out of the book are:

  • Functions
  • Objects
  • Indenting
  • Lists, Tuples, Dictionaries
  • Exceptions

If you don’t understand something upon the first glance, start to formulate some questions.

Question

From the items that you just skimmed were there any items that made you curious or unsure? This is where you want to start formulating some questions. Write down several questions that you want to understand about content you just skimmed. Some questions you might ask are:

  • How is indenting my code important in Python?
  • What data types are objects?
  • What is a tuple?

You may also have a question that is not relevant to the chapter you skimmed such as:

  • Why is Python preferred over scripting languages such as Perl?

Though it may not be answered in the chapter, it may be covered in later chapters.

Read

Now you are ready to start reading the chapter. While you are reading start looking for answers to the questions that you posed previously, but try not to ignore the other information.

If the book you are reading contains code, try to walk through the code on paper without typing it into a computer.

Recite

After you have read the chapter, try to summarize by writing down the main points of what you read.

  • How is indenting my code important in Python? Indenting is required in Python and results in standardized formatting.
  • What data types are objects? All data types are objects.
  • What is a tuple? A tuple is an immutable list.

Write down the answers to your questions and then write down any other additional information.

  • What does immutable mean?

In this step you should explore the code samples introduced in the chapter. Type and run the sample code to see if the actual output is the same as the expected output when you previously read through the code.

Review

At this point you should be able to comprehend all the main points in the chapter from memory, if not, write down more questions and repeat the read, recite, review steps until it becomes clear.

By completing all the steps of SQ3R you should have a mastery of the chapter content. I find that this strategy tends to work better with technical books or textbooks than with novels.

How does this reading strategy compare to how you typically read a chapter of a technical book?

0
An Overview of Microsoft PowerShell

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.

Power Shell

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?

0
Enhance Your Skills By Belonging to Professional Organizations

Enhance Your Skills By Belonging to Professional Organizations

If you work in information technology, how do you keep both your social and technical skills up-to-date to remain competitive? Enrolling in an academic program could be beneficial to improving your skills, but it could get expensive and often a technical curriculum will not cover the latest technologies. This is where belonging to a professional organization may be an option.

Social Skills

No matter what line of work you are in, everybody could use some improvement in their social skills. Unless you speak regularly to groups in your profession, the venues for you to practice public speaking are limited.

Toastmasters International is an organization that I have recently joined. Toastmaster’s provides a venue and focuses on helping members develop leadership, communication and public speaking skills. Most people would be apprehensive about joining an organization like this because of their fear of public speaking, but the reason Toastmasters exists is to help overcome this fear in a supporting environment.

Leadership

You acquire leadership skills by taking on roles each week to help out your fellow members. Some of the roles are:

Toastmaster - The M.C. for that day’s meeting.

Timer - Keeps track of each speaker’s time.

‘Ah’ Counter – Identify filler words that speakers use (e.g. er, um, ah, but, so, etc.)

Evaluator - Ensures speakers follow the guidelines of their prepared speeches.

Table Topics Master – Facilities a session known as Table Topics or speaking off-the-cuff.

Communication & Public Speaking

At all meetings there is an opportunity to speak by giving a prepared speech or participating in table topics. If you fulfill one of the roles above, you must present your findings to the group.

If this sounds like something you are interested in, I encourage you to contact a local club and attend a meeting as a guest to see firsthand how Toastmasters could help you. Membership fees can vary by club, but the cost is usually less than $100 for the year.

Technical Skills

With technology changing as fast as it does these days, learned skills can become obsolete very quickly. Fortunately there are plenty of online tutorials and books/magazines available so you can advance your skills through self-study. I think the difficulty lies in determining what you should study because there are so many technologies out there. I’ve read blogs where people ask “What programming language should I learn?” One possible answer to this question is: try learning different ones. If you want to commit yourself to life-long learning about new topics, consider joining a technical professional organization.

ACM

I recently joined the Association for Computing Machinery (ACM). ACM provides access to journals, magazines, online courses and books. The selling point for me was their collection of online books. For the price of a couple of technical books, I can access over 1,000 books online. ACM also provides a monthly email consisting of several articles related to your interests. These are just a few of the benefits that they provide. ACM offers two levels of yearly membership the basic membership is $99 USD and if you want the basic plus access to their Digital Library $198 USD.

IEEE

IEEE is a little less focused than ACM and covers a wider range of fields such as physical sciences, biology, law, as well as, the computing fields. IEEE provides access to numerous journals and magazines, but did not offer access to the same book catalog as ACM. The cost of a yearly IEEE membership is $169 USD.

Networking

The added benefit of belonging to either a social or technical professional organization is the opportunity to network. These organizations often host conferences several times a year, where you can meet people who share your interests and are in your field of work.

What are some other professional organizations that you belong to?

3
Using Subversion with Xcode, Part III

Using Subversion with Xcode, Part III

In Part I, I walked through the process of setting up repositories and projects in Subversion, Part II covered configuring Subversion with Xcode, this part will provide an overview of the SCM tools within Xcode and also show you how to tag and branch your code within Subversion.

Xcode SCM Attributes

If you have your project successfully configured for use with Subversion, once you check-out your files and make any changes Xcode will identify these changes with attributes. Once you start editing a file, an ‘M‘ will show up next to the file in the Groups & Files window. Also, if you add any files to your project these will be identified with a ‘?‘. These attributes will remain until your changes are committed or if you discard your changes.

SCM Attributes

Committing & Discarding Changes

If you are familiar with other version control systems, you might know committing as ‘check-in’ and discard as ‘undo check-out’. You can commit or discard changes at the file level by right-clicking each file or folder and making the selection or by selecting ‘SCM‘ from the menu and selecting commit or discard changes. The ‘SCM‘ menu also allows you to commit all the changes in your project by selecting ‘Commit Entire Project‘.

Committing Changes

Other SCM Tools

The Xcode SCM Menu provides a couple of ways to easily compare the contents of any file that you have checked-out with any revisions committed in Subversion, using FileMerge and the Unix diff tool.

Compare

By selecting ‘Compare With’ from the ‘SCM‘ menu, Xcode will open the FileMerge application that will show each file side-by-side and indicate the differences between each file. In File Merge, you can choose to add or remove any lines in your checked-out file.

Diff

If you have had exposure to the diff tool in Unix/Linux, it is available as an option to use within Xcode. By selecting ‘Diff With‘ from the ‘SCM‘ menu, Xcode will execute the diff command with your currently checked-out file and the revision file that you specify as arguments. The results of this command will be displayed in the current code window.

Subversion Tagging

In Part I, I mentioned that Subversion also has the following folders: tags and branches. The tag folder is used for storing releases or stable builds of your code and allows you recall the correct version of the project files if you need to fix any bugs. Here is a script that will allow you to tag your project, it assumes that whatever the is currently committed in the trunk folder is what you want to tag:

#!/bin/ksh
# A script to tag a SVN release

reporoot=/Library/Subversion/Repository/
projdir=Projects

# Prompt for repository name
print -n "Enter repository name:"
read repo

# Prompt for project name
print -n "Enter project name:"
read project

# Prompt for release number
print -n "Enter release number:"
read release

# Tag release
svn copy file://$reporoot/$repo/$projdir/$project/trunk file://$reporoot/$repo/$projdir/$project/tags/release-$release -m "Tagging the $release release of the ‘$project‘ project."

echo
echo Tagging the $release release of the $project project Complete!
echo

Subversion Branching

The branches folder is used for storing code that you want to develop new functionality with or experiment on without making revisions to the code in the trunk. Here is a script that will allow you to branch your code, also it assumes that whatever the is currently committed in the trunk folder is what you want to branch.

#!/bin/ksh
# A script to branch a SVN trunk

reporoot=/Library/Subversion/Repository/
projdir=Projects

# Prompt for repository name
print -n "Enter repository name:"
read repo

# Prompt for project name
print -n "Enter project name:"
read project

# Prompt for branch name
print -n "Enter branch name:"
read branch

# Create branch
svn copy file://$reporoot/$repo/$projdir/$project/trunk file://$reporoot/$repo/$projdir/$project/branches/$branch -m "Creating a branch of the ‘$project‘ project."

echo
echo Creating a branch of the $project project Complete!
echo

I hope you enjoyed reading this 3 part tutorial on setting up Subversion within Xcode. Please share your thoughts on how you use Subversion or any other SCM system with your development environment.

4
Using Subversion with Xcode, Part II

Using Subversion with Xcode, Part II

In my previous post, Using Subversion with Xcode, Part I, I covered how to create a repository and provided a set of scripts to use to automate these tasks. In this post I will demonstrate how to use the SCM client within Xcode to access your Subversion server.

SSH

Before you can use Xcode’s SCM client to connect to your Subversion server, you need to enable the SSH server on your Mac. SSH server is installed by default on OS X 10.5, to enable it open System Preferences.

From the Internet & Network section, select the Sharing icon, within the Sharing preferences check the box labeled Remote Login.

SSH

That’s it, at this point your SSH server is running.

Configuring SCM Repositories

After you launch Xcode, you can configure your SCM repositories by selecting SCM > Configure SCM Repositories… from the menu bar, this will open the Xcode SCM Preferences window.

Click the the plus sign ‘+’ to create your repository, it will prompt you for a name and ask you to select which SCM System you are using (Subversion in our case).

Repo Name

Now you need to build the URL to connect to the repository on your computer. Here you enter the Scheme, Host, Path, User and Password and have Xcode build the URL for you.

Scheme: svn+ssh

Host: either <computer name>.local or localhost

Path: the absolute path to your repository

Port: N/A

User: your login username

Password: your login password

Repo Configuration

If you entered everything correctly, you should see a green light indicator with the word Authenticated beneath the password box, click OK. If you are encountering errors, double-check that all information is entered correctly above. You can also try connecting to yourself through SSH via the Terminal: ssh username@localhost.

Configuring Projects

Before you import your projects in to Subversion, you may want to configure your project so that your build files are not located in the same directory as your project. It is normally not necessary to place these files under version control, as they can easy be regenerated by rebuilding your project.

Project Settings

Viewing SCM Repositories

Whenever you are ready to import into Subversion, you can add it through the Xcode SCM client by selecting SCM > Repositories from the menu bar, this will open the SCM client. If you ran my scripts from the previous post, you should see the following in each column:

Column 1: All of your configured Repositories.

Column 2: The Projects folder you specified when setting up your repository

Column 3: The Project you created

Column 4: The Subversion folders that were automatically created with the script

The horizontal window at the bottom will display the Subversion commands that are being run when you select an item from each column. This can be helpful troubleshooting tool if you are having access or permission problems.

Repositories

Importing Projects

To add your project to Subversion, click the Trunk folder and then click the Import icon. This will display the directory import dialog, here you will want to select the folder of your local project and enter a meaningful comment.

Project Import

Configuring Projects for SCM

Now that you’ve added your project to Subversion, you will want to configure it so you can start versioning any changes to your code. You may want to create a separate directory on your computer to store projects that are under version control. I recommend choosing a location that is separate from the directory where you initially imported from. Once you establish a location, select the Project folder under the Trunk folder and click the Checkout icon, here is where you will select the folder you created. After you click Checkout, you should receive a Checkout Complete dialog window where you are given the option to open the project. Congratulations! At this point your code should be under version control.

Part III will show you how to commit any changes that you make and will explore some of the SCM tools.

3
Using Subversion with Xcode, Part I

Using Subversion with Xcode, Part I

When you start learning new languages and work through different projects and problems, I find it helpful to have my code under version control (or SCM). Keeping on topic with my previous post about learning iPhone Application Development, it may be a good idea to version your code especially when working with the Stanford University projects. Currently Xcode supports three different SCM tools: CVS, Perforce and Subversion. You may choose to setup either tool, I have chosen Subversion because of its ability to integrate with a variety of development IDEs: Xcode, Visual Studio, Eclipse, NetBeans, etc.

The most detailed resource I have found on setting up Subversion within Xcode 3.1 is from the Apple Developer Connection. In this post I will keep it simple, as well as, provide shell scripts so you can avoid typing tedious commands to add new projects, branch, tag, etc.

This configuration will use svnserve, which is a lightweight Subversion server useful for individual developers, it is also installed by default on OS X. If you are looking to setup Subversion in a large development environment with multiple users, the Apple Developer Connection document will provide details for setting up Subversion with Apache.

This tutorial will cover the initial setup of configuring your Subversion repository and creating your first project via the command line.

Creating a Repository

A repository is the data store that will contain all of your projects. Because Xcode will only allow you to have one project folder at the root of the repository, I create a Projects folder that will contain all my individual projects. The following script will create your repository and a projects root folder:

#!/bin/ksh
# A script to create a new SVN repository

# Set this to the location where you want to store your repositories
reporoot=/Library/Subversion/Repository/

# This is the name of the projects root folder
projdir=Projects

# Create new repository
print -n "Enter new repository name:"
read repo

echo
echo Creating repository $repo
svnadmin create $reporoot/$repo

echo
echo Creating projects directory
svn mkdir -m "Directory for Projects" file://$reporoot/$repo/$projdir

echo
echo Repository Creation Complete!
echo Start adding new projects
echo

Creating a Project

The structure of a project in Subversion is setup with three sub-directories: branches, tags, and trunk. Each of these are used for the following:

Trunk

This is the location where you will import all your project files. The files contained in this folder will be the those that are checked-out and committed (checked-in).

Tags

This is the location where you will archive your releases of your project.

Branches

If you need to experiment with changes to your project and do not want to make changes to the files in the Trunk, the Branches folder is where you can store these project files.

This script will automate a lot of the work of creating the folders above. You can run this script each time that you need to add a new project to your repository.

#!/bin/ksh
# A script to create a new SVN project directory

# Replace this with the path of your Repository and Projects folder
reporoot=/Library/Subversion/Repository/YourRepositoryName

# Create new project
print -n "Enter new project name:"
read project

# Clean up local tmp directory
rm -rf /tmp/project

echo
echo Creating temporary directories
mkdir -p /tmp/project/$project/trunk /tmp/project/$project/branches /tmp/project/$project/tags

echo
echo Importing $project into Subversion
svn import /tmp/project/ file://$reporoot -m "Initial import"

echo
echo Cleaning up…
rm -rf /tmp/project

echo
echo "Directories Created!"
echo "Import your project through SCM in Xcode"
echo

Part II, will cover configuring Xcode to connect to add your project files to your Subversion repository.

4