Basic Git Commands

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

Git is a source code versioning system that lets you locally track changes and push or pull changes from remote resources. GitLab, GitHub, and Bitbucket are just some of the services that provides remote access to Git repositories. In addition to hosting your code, the services provide additional features designed to help manage the software development lifecycle. These additional features include managing the sharing of code between different people, bug tracking, wiki space and other tools for ‘social coding’.

Continue reading

Saving your Git credentials

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

If Git prompts you for a username and password every time you try to interact with GitHub or a GitLab server,  you’re probably using the HTTPS clone URL for your repository.

Using an HTTPS remote URL has some advantages: it’s easier to set up than SSH, and usually works through strict firewalls and proxies (like here in DkIT). However, it also prompts you to enter your credentials every time you pull or push a repository!

Continue reading

Write your own WordPress plugin to rename Posts

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

Quite often when building  a WordPress website you might want to use the Post object to represent something else, for example, a business, a piece of art, a machine etc. So when the editors login, you want them to “Add New Machine”, “Edit Machine” and so on, yes?

Continue reading

Perl Postfix Control Constructs

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

Control statements in Perl can also be written with the conditional following the statements (called “postfix”). This syntax functions (nearly) identically to the usual one you would expect.

Continue reading

Print Fibonacci Series in C++

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

A “Fibonacci series” is a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc. To print a Fibonacci series in C++, you have to ask the user to enter the total number of terms that he/she want to print fibonacci series upto the required number.

Continue reading

Comparison and Boolean Ops in Python

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

Python comparisons are unusual in that chaining comparisons is allowed, and works reasonably. Chained comparisons translate to a series of anded terms, repeating the middle. For instance, a < b == c <= d is interpreted as a < b and b == c and c <= d. The only other note is that the middle expression (4 in the below example) is evaluated only once. For a constant, this doesn’t matter, but it will make a difference for expressions which have a side-effect. Note that this does not always have the desired effect. For instance, 3 != 2 != 3 is true, which might not be what you wanted.

Continue reading