Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Saturday, July 4, 2015

Development Process with Git

I have been using various version control tools for years, however it has taken me a long time to make version control a core part of my work process. All of the ideas in this post come from other people... so as usual I am indebted to my colleagues for making me a more productive coder.

I now generally create a repo in my remote master, and then push the initial commit. This requires running the following on you local machine.

git init 
git add *
git commit -m "Initial Commit"
git remote add origin git@remote.com:project.git
git push -u origin master


If you want other people to work with you, then they can now clone the project.

git clone git@remote.com:project.git

Now for the interesting part: when you want to commit something into the repo but your branch has diverged from master. You can of course just run git pull and it will merge the results, unless there are drastic conflicts you need to resolve. But this creates a non-linear commit lineage, you can't look at this list of commits as one single history. To get a linear commit history you need to do the following.

git fetct 
git rebase

This will rewind your commit history to what it was before the changes in master were applied. It will apply the changes from the master branch, and then apply your sequence of changes on top. Voila, linear commit history.

There are a number of other key ideas in effectively using git.

Tag your releases

This is pretty simple, every time I push a major piece of code to production, release an App on the App Store etc, then I make sure to tag the contents of the repository. So that release can be recovered with minimal stuffing around.

git tag -a v1.2 -m 'Version 1.2 - Better than Version 1.1'

Create Branches


Branching can be a scary experience the first time you do it. However, if you want to do major refactorizations of code that is in production and needs to be supported while those changes are being made, then this is the only way to do it. In fact I don't know how people did these before tools like git.

Create a branch and check it out in a single command

git checkout -b refactor
 
  
Go back to master if you need to patch something quickly

git checkout master

When you are done go back to your branch

git checkout refactor

If you changed things in the master that you need inside your refactorization work, then merge master into it:

git merge master

Once you are done with all of your changes, run your tests etc, then your can merge that branch back into your production code.

git checkout master
git merge refactor
 
 
Once it is all merged and deployed, you don't need the branch so delete it.

git branch -d refactor
 
 


Tuesday, April 9, 2013

iOS Renewal Process

You would think that renewing your development membership would be all that you need to do on a yearly basis to keep working as an Apple developer.
It should be just: pay the fee and keep on developing. Unfortunately it is not that simple.

Your certificates and provisioning profiles need to be renewed, regenerated, and installed before you can continue. As I have not found a reasonable walk-through for this process, either from Apple or on their forums, I will quickly sketch it out here:


1) Clear out your old Provisioning profiles in Xcode

Open the XCode Organizer. Select "Provisioning Profiles," go through the list and delete all the expired certificates.


2) Remove your existing certificates in Keychain Access

Open the Utilities fold in your Mac's Applications. Open Keychain Access and then select "My Certificates." You will see your expired certificates (Dev and Dist) listed. Remove them both.


3) Create new certificates

Keeping Keychain Access open, click:
Keychain Access>Certificate Assistant>Request a Certifcate From a Certificate Authority.
Choose "Save to Disk" and save the request file.

Open the Certificates section of the iOS Provisioning Portal.

Delete the existing Development Certificate.
Click the "+" Symbol to create a new development certificate.
Select the top option "iOS App Development"
Click Continue.
Upload the certificate request file you created and finish.

Click "+" again to create a distribution certificate.
Choose the "App Store and Ad Hoc" option and continue.
Upload the certificate request file and finish.


 4) Regenerate the Provisioning Profiles

Click the "Provisioning Profiles" in the iOS Provisioning Portal.
Go through each of your development and distribution profiles and edit them.
When you edit them you will see an option to select the new certificate that you generated. Once selected the "Generate" button will become active, click to generate and download the new profiles.


 5) Install the Certificates and Provisioning Profiles
 
Install the downloaded certificates and provisioning profiles by dragging them into Keychain Access and XCode respectively.

You can now test your development apps and distribute them to the app store just like before you renewed. Just remember to select the correct profile when you are building your app.




Thursday, August 23, 2012

App Distribution Key File Backup

I have been developing apps using Appcelerator's Titanium Studio for the past year. Unlike some of the other multiple OS distribution methods Appcelerator allows you to generate native controls and widgets across multiple platforms. They have a strong user community and the stability of the apps produced is excellent (contrary to the negative reviews found online).

In my standard backup process I create regular copies of the code base for my apps. However, it has come to my attention that for the sake of security you need to back up more than just your code.

When you distribute apps to the app stores, they need to be signed used using the private keys associated with your development certificates. If these keys are lost then you will be unable to publish updates to your apps.

So if you develop for Android and iOS as I do, here are a couple of links that give you the critical information.

iOS
Read this post on backing up your private key and follow the instructions at the bottom.

Android
For android releases to Google Play, you need to make a back up of the keystore you created with keytool. This is the android guide to application signing. You will have used the keytool command to create a key for your application before distributing, as described in this how-to. You simply make a back-up of the file listed when you run the command
keytool -list -v -keystore /XXXXXXX

Wednesday, May 16, 2012

Search on Facebook, if you enjoy frustration

If you had a large successful internet company whose only asset was the attention spans of its users, you would think that you might put some effort into making sure that people could find what they were looking for. Not so with our benevolent masters at facebook.

At facebook search is an after-thought, just a text box to help people find other people, but not much else.

I have lost count of the number of times that I have seen an interesting post and thought "I will come back to that." When I do try and come back to it, it is lost thousands of posts back in my feed, and if I don't remember who posted it then I have no chance of finding it. A fully functioning search would be really handy here: but no, the search function appears to be completely uncorrelated from my feed. "Hang on!" you should be screaming, isn't that what facebook is supposed to offer, and internet that is improved by our social network?

Nope, not so with search.

Nor with events. If you search for an event with certain key words, there was a time when facebook only returned events that had passed. This appears to have changed, but nonetheless, if you don't accept an invitation to an event immediately, good luck finding it later. Yesterday I had two facebook tabs open, in one of them I had an event I was interested in going to, in the other tab I tried the facebook event search using the EXACT name of the event: and nothing appeared in the search results.

What makes this all the more puzzling is that the company that is the absolute king of search has been developing a product to rival facebook. At the same time facebook has done nothing to improve its challenge to Google: Social Search.

The only thing that seems to make sense is that perhaps facebook is relying on Bing to fill that gap for them, to make their feed of frivolity useful through search. If they don't, then I would not want to be one of the people putting out 100 billion dollars for facebook this week.