Experiencing: git-flow


0. Read http://nvie.com/posts/a-successful-git-branching-model/

1. Download git-flow from https://github.com/nvie/gitflow 

2. Head to https://github.com/nvie/gitflow/wiki/Installation - I chose manual and it worked cool :)

With git flow - there are two main streams of code

1. master - contains the release(d) code 

2. develop - contains current development code - unreleased

Dev 1

1. Create a git repo

2. Init the git flow - git flow init  

    answer the questions - the defaults should be enough

3. Start working on a feature

git flow feature start my-new-feature

4. Now there could be more than one dev working on the same feature and we need to share 

    git flow feature publish my-new-feature

5. Now you carry on your development in the feature, and push the changes

    git push origin feature/my-new-feature    

6. Before you issue git feature finish my-new-feature make sure you have pushed the changes to remote branch for the remote user

Now the remote dev:

1. Clone the remote repo

2. Init the git flow - git flow init

    answer the questions - the defaults should be enough

3. Now this dev is going to continue the work on the my-new-feature

    git flow feature track my-new-feature

4. Continue your work …

5. Push the changes to remote branch

    git push origin feature/my-new-feature

6. Pull the changes from remote feature

    git flow feature pull origin my-new-feature

7. git flow feature finish my-new-feature

Since your codebase has remote users - make sure the remote develop brach is kept up to date. 

git push origin develop

 

more learning in process …. will update here soon

 

Facebook deprecating offline-access Permission

What is offline access?

from https://developers.facebook.com/docs/reference/api/permissions/

Permissions - Facebook Developers- offline-access
Uploaded with Skitch!

Most of the Facebook applications - like klout (and many others)-  utilize this token to access the userdata even if the user is not logged in to facebook. It allows the apps to have some background jobs that could use the userdata. 

As a user you can see this permission being asked by the app, when you first authorize that app.

Like here:

Request for Permission
Uploaded with Skitch!

Now Facebook is going to deprecate the offline access token, as per their blog https://developers.facebook.com/docs/offline-access-deprecation/

They have started rolling it out.

offline access deprecated
Uploaded with Skitch!
The older tokens will work as usual, the new users will not be shown the offline access permission and the new tokens has to be renewed in a timely fashion

I think that's good and bad, Good in the sense, the app has to investigate new means to get the user to get engaged with the app, so the access token gets renewed. Bad in the sense, the one off token is gone :( 

Waiting more on this topic :)

Thanks Tom for the heads up :)

Streaming video via PHP - Zend

To stream video files via php in html5 you have to honour the HTTP_RANGE header 

Here is code to download the video: It caters both conditions of having HTTP_RANGE and not

Code written with Zend-Framework, and I am only penning the action code.

More information and code here: http://mobiforge.com/developing/story/content-delivery-mobile-devices

 

Deploying Zend App on Openshift

Update: A quickstart app is added : https://github.com/vinu/zend-quickstart-openshift

What is openshift? Here is the answer http://openshift.com  ;)

Hit it and create an account.

Download the client tools and create a domain and an application - you can create any type of app in Java, Ruby, PHP, Perl and Python -

But here (as zend framework is only for PHP :p ) I am creating a PHP application.

Note: Alot of resources are available in https://docs.redhat.com/docs/en-US/OpenShift_Express/1.0/html/User_Guide/index.html and http://www.redhat.com/openshift/faq on how to create domain, app , ssh keys, git ... - read it well :)

Now that you have created an PHP application in rhcloud, checkout the code to your local machine.

Here is dir structure of the php openshift application.

basic-openshift-php-dir-struct
Uploaded with Skitch!

the dir 'php' is the public facing folder (refer the README for the details of the dirs)
Now let's make our zend app work with openshift.
This is basic dir structure of a Zend application.

basic-zend-app-dir-struct
Uploaded with Skitch!
Now copy all dirs except the public to openshiftapp/libs dir
so the libs dir looks like this:

openshift-libs-dir
Uploaded with Skitch!
the library dir contains the Zend framework
Now copy the contents - including the .htaccess - in the zend-app/public to openshiftapp/php folder
edit the openshiftapp/php/index.php - APPLICATON_PATH to have the updated path

open-shift-applicaiton-path
Uploaded with Skitch!
that's it ...
Commit and push the code.
Now take the cloudurl - woohoo you have your Zend app running on openshift.
Happy coding ... :)

Update: A quickstart app is added : https://github.com/vinu/zend-quickstart-openshift

Hosting .in for free and Tweak it

Go here : http://www.indiagetonline.in/

You will get free .in domain for one year.

Once you have registered successfully there, you will get an email having the password to administer the site.
Once you are in you can create your websites in a jiffy using any of their templates.

But if you feel that too hard and if you feel you can design your own, FTP will help. (Me didn't like their templates ;) )

Choose any ftp client - I use cyberduck

Use yourdomain.in as servername
and username and password in the welcome mail.

Once you are in, enable view hidden files in the client
You should see something similar

 

thamasha.in 2013 FTP

 

go to www edit .htaccess - this is important as by default the .htaccess has a rewriterule that redirects to their hosting site.

clean .htacess and make sure it has only this line
DirectoryIndex index.php index.html index.htm default.htm default.html

save it

Now edit the default.html as you wish and save it ...

take yourdomain.in in browser

woohoo -  you have built the site.

Set up simple git server

Now a days git is emerging as popular code versioning system. Thanks to Github. Though git hub offers unlimited public repos (https://github.com/features/projects), it will cost you $$ if you want to host a private repos.

But if you know some simple commands you could host your own private git repo.
Let's see how we can do it.
>> Install git on the remote machine - git-core
>> Create a user 'git' in the remote machine
>> Enable password less login for that user from the local machine - (Copy your localhome/.ssh/id_rsa.pub to git@remotemachine:/.ssh/authorized_keys)

    If you want to allow more than one machine to connect - add all of their public keys to the authorized_keys one in a line.  

>> check ssh git@remotemachine 
if all is fine (means no password is asked and you are successfully logged into the remote machine), Now it is time to create a remote repo
[git@remotemachine ~]$ mkdir helloworld.git 
[git@remotemachine ~]$ cd helloworld.git/
[git@remotemachine helloworld.git]$ git --bare init
Initialized empty Git repository in /home/git/helloworld.git/
woohoo your remote empty repo is ready.
Now in your local machine:
[dev@localmachine workspace ~]$ git clone git@remotemachine:helloworld.git
Cloning into helloworld...
warning: You appear to have cloned an empty repository.
[dev@localmachine workspace ~]$ cd helloworld/
[dev@localmachine helloworld ~]$ ls -a
.     ..     .git
Now let's create some contents and push it
[dev@localmachine helloworld ~]$ vi README
add some contents and save it.
[dev@localmachine helloworld ~]$ git add README
[dev@localmachine helloworld ~]$ git commit -m 'initial commit'
[dev@localmachine helloworld ~]$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 224 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@remotemachine:helloworld.git
 * [new branch]      master -> master
woohoo - you remote repo is updated
Continue the play …. :)