SCRUM ex 1

Scrum methodology helps keeping products on track with the stakeholders interests.
Scrum encourage teams and team members to be honest in their progress and obstacles.
Scrum development may help the entire organization deliver better products.

Duplicate Git repo from Bitbucket to Github

Mirroring a repository

To make an exact duplicate, you need to perform both a bare-clone and a mirror-push.

Open up the command line, and type these commands:

git clone --bare https://user:bitbucket.com/exampleuser/source-repository.git
# Makes a bare clone of the repository

cd source-repository.git
git push --mirror https://github.com/exampleuser/target-repository.git
# Mirror-pushes to the new repository

cd ..
rm -rf source-repository.git
# Remove our temporary local repository

Reading incoming multipart content

When using this snippet the thread goes into some infinite loop.


// Handle multipart
if (Request.Content.IsMimeMultipartContent())
{
   IEnumerable parts
     = Request
       .Content
       .ReadAsMultipartAsync()
       .Result
       .Contents;
   foreach (var part in parts)
   {
      // Do stuff with the part
   }
}

You can use the following to prevent this:

        public HttpResponseMessage Post()
        {
            // Handle multipart
            if (Request.Content.IsMimeMultipartContent())
            {
                IEnumerable parts = null;

                Task.Factory
                    .StartNew(() => parts = Request.Content.ReadAsMultipartAsync().Result.Contents,
                        CancellationToken.None,
                        TaskCreationOptions.LongRunning, // guarantees separate thread
                        TaskScheduler.Default)
                    .Wait();

                foreach (var part in parts)
                {
                    // Do stuff with the part
                }
            }
            return Request.CreateResponse(HttpStatusCode.OK, "Yeah, some text here...");
        }