How to learn Git in 15 minutes? List of most basic git commands

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. Every dev has a working copy of the code and full change history on their local machine

Here are some most important and useful GIT commands that will surely help you.

Git Commands:

  • This command sets the author name and email address respectively to be used with your commits.
$ git config –global user.name "[name]" 
$ git config –global user.email "[email address]"
  • This command is used to start new repository.
$ git init [repository name]
  • This command is used to obtain a repository from an existing URL.
$ git clone [url]  
  • This command records or snapshots the file permanently in the version history.
$ git commit -m "[Type in the commit message]"
  • This command lists all the files that have to be committed.
$ git status 
  • This command shows the metadata and content changes of the specified commit.
$ git show [commit]
  • These commands lists, creates and delete branch respectively.
$ git branch  
$ git branch [branch name]  
$ git branch -d [branch name]  
  • This command is used to connect your local repository to the remote server.
$ git remote add [variable name] [Remote Repo Link]  

  • This command sends the committed changes of master branch to your remote repository.
$ git push [variable name] master  
  • This command sends the branch commits to your remote repository.
$ git push [variable name] [branch]
  • This command pushes all branches to your remote repository.
$ git push –all [variable name]
  • This command deletes a branch on your remote repository.
$ git push [variable name] :[branch name]
  • This command fetches and merges changes on the remote server to your working directory
$ git pull [Repository Link]

If you want more commands with examples, please let us know in the comments below.

More Useful commands:

  • Checks if sha is in production.
$ git tag --contains [sha]
  • Number of commits by author.
$ git shortlog -s --author 'Author Name'
  • List of authors and commits to repository sorted alphabetically.
$ git shortlog -s -n
  • See differences in file before committing / compare recently edited file with its last committed state
$ git diff path/to/file.txt
  • Undo local changes to a file.
$ git checkout -- filename
  • Undo/revert last commit
git revert HEAD^
  • Remove last commit from history (WITHOUT keeping changes)
$ git reset --hard HEAD~
  • Remove last commit from history (WITH keeping changes)
$ git reset HEAD~
  • Shows number of lines added or removed from repository by an author since some time in the past.
$ git log --author="Author name" --pretty=tformat: --numstat --since=month | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'

referenceS:

https://gist.github.com/davfre/8313299#undoing-previous-actions

https://stackoverflow.com/questions/8903953/how-to-revert-last-commit-and-remove-it-from-history

https://github.com/bpassos/git-commands#committing-files

Programming Paradigm.

Hi Everyone!

Today we are going to talk about programming paradigm. And in pronounces, the ‘g‘ is silent in ‘paradigm’.

So, in layman’s language programming paradigm is just the style of programming. Their are various styles of programming.

Every developer is different, hence is the style. Here we are about to talk about the most commonly used styles or pattern of programming.

Different Paradigms:

1. Imperative/procedural programming.

Imperative programming consists of sequence of statements and values are stored in memory after the implementation of statements.

Memory utilization is low. And mostly contains Variables & Iterations. Quite simple to implement.

Yet this style of programming has some demerits.

  • Complex problems can not be implemented.
  • Parallel programming is not possible.
  • Less productive.

2. object oriented programming.

Here the data $ functions are bound in one entity called class. In this pattern of programming everything is modeled as object. It follows the modular programming approach.

Mostly known for Data abstraction, encapsulation, inheritance, polymorphism. It is also quite easy to debug and modify.

Just one demerit to name is:

Methods (fx) of class are hidden.

3. functional programming.

To be honest this is what I prefer.

Here all the computations are expressed in functions. Complex functions can be developed from a single function.

Due to a re-usable functional approach, this style becomes quite comprehensible. Large number of functions can be mentained.

  • Consumes large amount of time and memory.
  • Not recommended for commercial applications.

4. Logical Programming.

Here the computations are expressed in mathematical logic. It follows the declarative programming approach.

Development is quite fast as it uses true or false (boolean) statements.

Known demerit are:

  • Slow execution
  • True and false can not solve most of the problems.

So, this is it from my side for this article. Please let us know what’s your way of programming.

  • Functional,
  • Logical, or
  • Object oriented.

See you soon in the next article.

Thank You.

How to increase EBS storage block size on a running spot instance in AWS?

So, you created a aws group with a small ebs storage size and now that the site is in production, storage disk is full and it was mounted as root storage, now you are asking “MY AWS INSTANCE STORAGE IS FULL, WHAT TO DO?”
or “How do I increase the EBS volume size of a running instance?”

So, here is the simple solution:

There are two commands which will help you

$ lsblk

and

# df -h

So, initially if you login via SSH (using PUTTY or anything else) you will see something like this:

So, what you need to do is, you need to go to aws console and edit block size in EC2 management

Go to EBS > Volumes
Right Click the volume you need to expand and choose MODIFY VOLUME
Enter the new size you want for your block

Now run the command lsblk and df -h and you will notice the old size and new size under xvda and xvda1

Size available but not used

If you dont see the updated new size, please use init 6 or restart the instance using any other command

You now need to use utility growpart so use command


sudo apt install cloud-utils

If you are out of space, please remove any old files which are of no use anymore to free up some Mega Bytes
After that, simply use


sudo growpart /dev/xvda 1

and
sudo resize2fs /dev/xvda1
resize2fs command
lsblk after resize
df command after resize

Reference: 
https://stackoverflow.com/a/43251901/2229148


tk120404

The most difficult CS subjects.

Hi Everyone!

Let’s talk about the most difficult CS subjects and why these subjects are considered difficult.

These are the subjects that really need an astonishing amount of hard work to excel and master them.

So, without any further due, let’s just dive into this.

The hardest CS subjects:

1.ARTIFICIAL INTELLIGENCE: Giving consciousness to machines, and making them able to take their own decision. This is the most difficult subject in the industry because here you have to be a multi-talented person.

  • Your mathematics needs to be strong enough.
  • You should know how to handle the database.
  • You should be able to develop your own algorithms.
  • Offcource, you need to know how to code.

And the thing that makes AI even more difficult is that it isn’t static, the system by itself gets better and better. Hence to be in the game you have to keep improving yourself.

IT is said about AI that:

“You can initiate it, but you can’t stop it.”

2.THEORY OF COMPUTATION: You might not have heard of it ever. You gave a command to the computer to do ‘X’ and it did. But have you ever imagined how the computer did it – well that’s what is Theory of computation.

The study of that process by which a computer implements a command is called Theory of computation.

Here the expert never asks ‘What?’,  instead, they only ask ‘How?’

They don’t care WHAT the result is, but HOW that result came into existence.

3.MICROPROCESSORS / LOGICAL CHIPS: Those small computers and chips that can do processing for you. This is what you have in all your electronic devices including your smartphones.

It is a big deal to program these processors.

4. ADVANCE DATABASE: You know this, the management and storing of data in a systematic way. It is easy to store data when it is in small quantity. But when it becomes huge it becomes a nightmare to store and maintain it.

It is an art to store and manage a huge amount of data.

5. COMPILER DESIGN: Converting high-level language into machine language. A very rough way to understand it is this:

This is all about creating a software that makes other software.

SO, these were the most difficult subjects of computer science. If you mastered these subjects you can get a huge payoff.

If you liked it then stay tuned for more such articles, and you can also check our previous articles.

Thank You.

Avoid these bad coding habits.

Hello Everyone!

When it comes to coding, most people think it is something mystical that only geeks can understand. Believe me, it is not like that my friend. Anyone can code with a fair amount of practice.

There is nothing mystical about it.

Coding is a skill like any other. Like language learning, there’s grammar and vocabulary to acquire. Like math, there are processes to work through specific types of problems. Like all kinds of craftsmanship and art-making, there are techniques and tools and best practices that people have developed over time, specialized to different tasks, that you’re free to use or modify or discard.

Here we are about to see a few bad coding habits that you must avoid.

Avoid these bad coding practices:

1. Saying “I’ll fix it later”.

The habit of postponing code fixes is not merely a problem of priorities. Organizing your issue tracker might generate some progress, but you also need to have a way of tracking smaller issues that come up. Adding “TODO” comments is a quick way of making sure you don’t miss anything.

2. Insisting on a one-liner solution

Being obsessive about writing efficient, elegant pieces of code is a common trait of programmers. It’s like solving a puzzle—you find a combination of functions and regular expressions that turn 20 code lines into 2 or 3. Unfortunately, it doesn’t always result in readable code, and that’s generally the far more important outcome. Make your code accessible first, then clever.

3. Difficulty seeing through recursion

The idea of recursion is easy enough to understand, but programmers often have problems imagining the result of a recursive operation in their minds, or how a complex result can be computed with a simple function. This makes it harder to design a recursive function because you have trouble picturing “where you are” when you come to writing the test for the base condition or the parameters for the recursive call.

4. your code is a mess

Symptoms
  1. Doesn’t follow a consistent naming convention.
  2. Doesn’t use indentation, or uses inconsistent indentation.
  3. Doesn’t make use of whitespace elsewhere, such as between methods (or expressions).
  4. Large chunks of code are left commented-out.
Programmers in a hurry commit all these crimes and come back to clean it up later, but a bad programmer is just sloppy. Sometimes it helps to use an IDE that can fix indentation and whitespace with a shortcut key, but there are programmers who can even bludgeon Visual Studio’s insistence on proper indentation by messing around with the code too much.

5.Reinventing the wheel all the time

Don’t write code you don’t need to. Perhaps someone else has spent a good deal of time on your problem already, and he or she might have a well-tested solution that you can reuse. Save yourself some trouble.

Conclusion.

As the old saying goes, “If it walks like a duck and quacks like a duck, it’s probably a duck.” The same is true for bad code. If it looks like bad code and smells like bad code, it’s probably bad code. The infallible developer does not exist. The almighty developers that came before may have made a mistake, and you will too. It is how coding works.
So, this is it for this article. We will surely talk about good coding habits and practices in upcoming articles.
Thank You.

JavaScript debugging dev tools.

Errors can and will happen every time you write some new computer code.

Programming code might contain syntax errors or logical errors. Many of these errors are difficult to diagnose.

Often, when programming code contains errors, nothing will happen. There are no error messages, and you will get no indications where to search for errors.

Searching for (and fixing) errors in programming code is called code debugging. And believe me, that’s not easy but the most valuable skill a developer could have.

Hence, here I am with top JavaScript debugging tools.

Chrome DevTools:

chrome dev tools

Google Chrome DevTools is a set of debugging tools that can be used to debug JavaScript code right from the Chrome browser as they are inbuilt. You can get to interact with HTML, CSS and JavaScript all from the browser simply by clicking the inspect element button.

It has the resources panel for inspecting the storage of web pages such as the HTML5 database, cookies, local storage etc.

You may have been using Chrome all these years without knowing that it has a debugging tool with so much power.

Sublime Web Inspector:

SublimewebinspectorThe sublime web inspector is a javascript debugging tools. The sublime web inspector allows you to debug, whatever you edit in your programs. It works on top of Web Inspector Protocol.

If you use Sublime Text Editor for your JavaScript editing, then Sublime Web Inspector allows you to debug from the same program you edit with. It works on top of WebInspectorProtocol, with all information displayed in console and text files.

Node.js Inspector for Debugging Requests to Node Apps

Debugging the Node.js on your application’s backend can be challenging. The following tools take advantage of the capabilities of the Node.js Inspector to assist you:

 

React Developer Tools

IN THE BROWSER: The React tab shows props and state values if they exist for the selected elements.So, these were the four debugger tools that can make debugging easier for you. You can learn to use them through the tutorials available online for free. Hope you liked the article.

Thank You.

Plunker and Angular JS.

Hi Everyone!

Let’s talk about Plunker, what is it and how is it related to Angular JS.

Plunker is an online community for creating, collaborating on and sharing your web development ideas. Plunker is the best tool to prototype, experiment, share and debug your ideas on the web platform. From idea to implementation, Plunker helps you build the web.

This is what they say in technical terms, let me clarify this.

Plunker:

Plunker or plnkr is an integrated web development environment and is completely written in AngularJS. The plunker website also provides you to write plunks(codes) and share it with other developers.

There is also the ability to search for popular JavaScript library and refer it to your current plunk. Another feature is the live preview which is quite handy when you are learning AngularJS as you can see the result of your code change in real-time.

Some of the other features are the ability to do real-time collaboration on Plunker and I recommend that if you are going to do any serious AngularJS development then try Plunker first.

A really handy feature is that you can use almost any framework right from the editor, without any complex setup.

We can code up Angular in the browser using plunker. It gives us the ability to try our Angular quickly without requiring complex setup.

It also gives us a unique URL so:

  1. We can quickly take a look at some code another person has written.
  2. We can share our code with other people, which is especially useful when we are stuck with some broken code and need help.

Why do most Angular JS people prefer Plunker?

The material reason is that Plunker allows creating an arbitrary number of files, while JSFiddle (or JSBin, for that matter) restrict you to one HTML + one CSS + one JS. Plunker also allows downloading the project as a ZIP.

Plunker allows you to describe a larger example of functional Angular.js code than JSFiddle.  It also gives better feedback and real-time previews as you type.

JSFiddle, on the other hand, allows you to quickly share a single example of some functional code, mainly a jQuery snippet of some sort.

Both are great platforms and have contributed so much to the community.

So, I hope that you liked this post and got some useful information. Stay tuned for more such contents.

Thank You.

5 WP plugins every developer must have.

Hello everyone!

If you’re a web developer working with WordPress, read on to get five great plug-ins that can help in every aspect of the development process.

WordPress plugins for developers are rated highly by developers since they help make their work easier. I have researched and found these 5 WordPress plugins that stand out as the most useful plugins for developers.

While there is no scarcity of WordPress plugins in the world, I want to showcase some of the plugins that I think you code junkies out there may get some use out of and up your game.

So, let’s begin.

5 WP plugins for developers:

  • User Switching10 Best WordPress Plugins for DevelopersUser switching can be described as a developer’s best time saver. Ever wondered how to quickly login and log out from your WordPress site in order to view how other viewers see your website? You don’t have to keep logging in and out of your site, you can now use this plugin to switch between different users, saving you a great deal of time. This plugin allows you to switch between registered users without having to login in and out. With a click on a button, you can easily and quickly switch WordPress users.
  • Query Monitor query monster plugin for wordpress developers
    Query Monitor lets you view all the ongoing database queries, as well as the rows being affected. You can also view rewrite rules, hooks fired on the current request, PHP errors and warning and even template filenames and parts. Furthermore, Query Monitor is one of the very few WordPress plugins for developers that let you keep track of AJAX calls, REST API requests and redirects. So if you are working with the WP REST API plugin, Query Monitor can prove to be very useful.

     

  • Debug BarBest WordPress Plugins for Developers

    Put simply, Debug Bar helps you debug your WordPress site in the most efficient way. You can check for PHP errors, database errors, and requests, various cache options, too. Plus, the plugin description mentions a lot of add-ons that give you “more insight into, for instance, the registered Post Types, Shortcodes, WP Cron, Language file loading, Actions and Filters and so on.”

  • Developerplugins for developer_9This is the ultimate plugin for testing your WordPress development environment. This plugin checks and ensures that your development environment is configured correctly including the plugins, constants and other settings. This plugin helps developer develop by optimizing their environment and ensuring essential tools and plugins are installed.
  • WordFenceImage titleWeb security is very critical in the tech world nowadays. Cyber breaches may cause harm to the whole organization. As a developer, you need to take care of your website. WordFence will help you shield your web pages by building a firewall and malware scanner. The malware scanner checks core files, themes, and plugins for malware, bad URLs, backdoors, SEO spam, malicious redirects, and code injections.

For more helpful WP plugins, with their detailed review please visit: List of really good and important plugins for WordPress.

I Hope that it was helpful to you. If you want us to touch any topic regarding web development than please let us know in the comments below.

Thank you for reading this far.

How to remain updated with changes in web development.

Hello all!

In the world of coding, things keep changing and as a developer, you ought to be always updated with new technologies and things coming up.

And nowadays changes happen very fast, almost every month something new comes in the world of web development.

Today I will be right to the point. This one is a short article.

In order to remain updated with changes in the field of web-development, often we search for it on the internet.

But, wouldn’t it be nice if you could get all the updates automatically every week. So, brace yourself that’s what I am gonna tell you today.

Below I am providing 2 newsletters, You just have to subscribe to these weekly newsletters and every week you will be updated with the latest changes via E-mail.

Resources:

  • Frontend Focus: A once–weekly roundup of the best front-end news, articles, and tutorials. HTML, CSS, WebGL, Canvas, browser tech, and more.

  • JavaScript Weekly: A free, once–weekly email roundup of JavaScript news and article.

Now every week just sit and wait for your newsletter to arrive with all the latest updates of HTML, CSS, JavaScript, browsers, and more.

So, this was all for this article. If you know some similar or better resources than please share it in the comments.

Thank You.

Understanding Screen resolution.

Hello and welcome everyone.

So, straight to the topic. Today we are going to decode the science behind the screen resolution and would also see, how it is calculated?

There is no rocket science in this, yet it could be a bit complex for some readers, hence pay attention.

Why is it a big deal?

screen size is important because there are lots of different screen sizes. Whether you’re deciding to build for windows or MacBook, both platforms have tons of different devices.

Resolution is also important. That’s because the resolution of different screens can affect how designers build their sites. Based on this information, there are certain things that a designer or developer needs to know.

So as you can see, both screen size and resolution size are important, but for different reasons.

As a website owner or web designer or developer, you have to take into consideration what are the most common screen resolutions for the intended target audience of the website to determine what web page width is suitable for the website.

These days we have many different screens sizes all with different resolutions – TV’s, desktop monitors, laptops, tablets, mobile phones, and even smart watches.

What is screen resolution?

To understand resolution you need to understand how a screen works. Screens are made up of thousands of tiny dots all bunched together called pixels, each one has the ability to change color and when you zoom out all the dots joined together to make up an image.

Screen resolution is the measure of the number of pixels a screen can display. This would be measured by width and height. For example, a screen that has 1,024 pixels horizontally, and 768 vertically would have a resolution of 1,024 x 768.

How is it calculated?

Resolution is the maximum number of pixels that can be displayed on a monitor, expressed as (number of horizontal pixels) x (number of vertical pixels), i.e., 1024×768.

The higher the screen resolution the more information can fit on the screen.

Screen size is usually measured in inches and is the actual size of the device’s screen measured diagonally. Anyone with a tape can measure the screen size. Screen resolution is measured by the number of pixels displayed in each dimension. In order to calculate the pixels per inch, you need to know the screen size as well as the resolution.

The formula to calculate PPI is a bit complicated. You need to take both the digits in screen resolution. Add a square of both these digits and take a square root of the result. The final number should be divided by the size of the screen.

For example – if the screen size is 5.8 inches and screen resolution is 1138 X 680, then PPI can be calculated as –1138X 1138 + 680 X 680 = 1757444.  A square root of 1757444 is 1325.69. Now, divide the number 5.8 i.e. 1325.69/5.8 = 228.5.

Final Words.

The idea behind considering screen resolution and screen size is to build an app that is visually compatible with any android and iOS device. If you are building an app with one screen in mind, it will spoil the user experience. Poor user experience will hurt the quality of your mobile app, which is something every developer should avoid.

If you have any question in mind, feel free to ask in the comments.

Thank You.