Github-watch-star-fork

GitHub Fundamentals – Watch, Star, Fork

Knowing about Git hosting services, knowing how to use them, contributing in them has become a necessity for modern day developers. Before diving deep into harder stuff, let’s learn about the 3 fundamental buttons that will be one of the first things you will see in a GitHub page.

Watch:

When you watch a repository, you get notifications for any new pull requests and issues that are created, including those not mentioning you. If you are “Not Watching” you will only be notified if you are contributing or @mentioned. There are more detailed settings for “notification settings” on GitLab compared to GitHub.

Star:

Starring a repository allows you to keep track of projects that you find interesting, even if you aren’t associated with the project.

When you star a repository, you’re actually performing two distinct actions:

  • Creating a bookmark for easier access
  • Showing appreciation to the repository maintainer for their work

Fork:

When you fork a repository, you create a copy of that repository for yourself. By forking:

  • You can use someone else’s repository as a starting point for your projects
  • You can fork a repository for bug fixing (fork the repo, fix the code, submit pull request)
  • You can fork a repository for proposing changes

If bug fixing or proposing changes is why you fork a repository, then make sure to sync your fork with the upstream repository. For this, you will need to install Git and use command line.

Hope this helps.
Good Luck,
Serdar

Glances – Monitor Your Linux System Inside Your Terminal

Glances is a free software (licensed under LGPL) to monitor your GNU/Linux or BSD operating system from within your terminal. Glances uses the library libstatgrab to retrieve information from your system. it is a cross-platform system monitoring tool written in python.

See the screenshot below. It even displays the stats from your docker containers!?! Works great on my VPS running Ubuntu 14.04.5 LTS.

Image from the official site:

glances-screen

How to Install Glances:

1- Run (Only supported on some GNU/Linux distributions):

2- You can use apt-get:

3- You can also install Glances using pip:

After installation completes, type “glances” and hit enter. Glances should start bringing up various system information to the terminal screen.

You may encounter an error like: …error locale.Error: unsupported locale setting

If this is the case do the following:

Then start Glances again.

For other installation methods see here.

Also see: https://nicolargo.github.io/glances/

Hope this helps.
Good Luck,
Serdar

elastic-search-kibana

Indexing, Retrieving, Deleting Documents in Elastic Search (Using Kibana)

Indexing, Retrieving, Deleting Documents in Elastic Search (Using Kibana)

Elasticsearch (ELK Stack) – Part 1

I have been playing around with ELK (Elasticsearch, Logstash, Kibana – Elastic Stack) and I though I would paste some of my notes here.

The command below will index (insert) a car document (object/row) into “cars” type (table) inside “vehicles” index (database).

GET /vehicles/cars/1 — get the metadata and the indexed data for the document

GET /vehicles/cars/1/_source — get only the data that in indexed

HEAD /vehicles/cars/1/ — check if document exists

Documents are immutable so if we try the index the same document after changing a value it will not only update the changed field but re-index the whole document again. most granular level of operation is done on the document level.

“_update” endpoint

We can also use _update endpoint to update a certain field (term) in a document using the syntax below. But that is exacly the same as changing a single field and putting the same document again. the complete document is re-indexed, this is not a single field update.

response will be something like below:

adding another field using _update endpoint:

This will also work the same. re-index the entire document. You can see the version increase in the result output inside kibana.
DELETE /vehicles/cars/1 -> deletes the document deletes the specified document from the vehicles index
this will not immediately delete the document but will mark it as deleted. elastic search then periodicaly wipes these documents from the disk later.

DELETING Types/Indeces

it is not possible to delete a type. The command:

will display an error in kibana output panel like this:

No handler found for uri [/vehicles/cars] and method [DELETE]

deleting an index is possible:

DELETE vehicles -> will return “acknowledged:true” response and the index will be deleted.

GETTING Types/Indices

GET /vehicles -> will return the structure for the specified index. in this case “vehicles” index.
but the GET for “Types” will not work. Note: field types will be automatically determined by elestic search. You can see it in the output window inside kibana.

The command :

will return the message below:

Hope this helps.
Good Luck,
Serdar

Python - Difference Between is and double equals

Python – Difference Between “is” and “==” (double equals)

This may be a point where a lot of you may get confused. I see some people using them in if conditions without actually knowing what they do. Let me try to explain the concept with a couple of lines of code…

See the code below and try to guess what is printed as the output:

Here is the output:

Explanation:

1- “==” will check if the contents of the lists are the same, including the order.

2- “is” will check if the lists are the same list. Meaning the exact same list in the memory!

3- “list4 = list1” makes list4 point to the same list as list1 in the memory. If we edit list1 and print list4 we will get the same result as we were printing list1.

 

Difference between window.onload and $(document).ready()

Do you think $(document).ready() and window.onload are the same thing? Do you use one for the other? Do you use them interchangeably? If you do so, you are wrong. $(document).ready() and window.onload are not the same thing.

What did you think? They both get triggered when the page is loaded? They get triggered when the DOM is loaded?

The fact is they get triggered at different points in the page lifecycle.

$(document).ready() -> gets triggered when the DOM is loaded

window.onload -> gets triggered when the page is loaded with all the content like images, iframes etc.

Yes, they may sometimes get triggered almost at the same time if your page is only composed of DOM elements, but most of the time they will get triggered at different times, window.onload being triggered later.

Hope this helps.
Good Luck,
Serdar

Katacoda

This is a micro post.

I would like to mention an eLearning platform for tech/dev people who might be interested.

Katacoda is an inteactive learning platform for software developers, engineers and anybody who likes this stuff.. They have scenario-based learning activities designed for an optimum learning pattern. Currently, they have learning activities available that are related to some trending topics that might interest many of you. Some examples are:

  • Docker & Containers
  • Kubernetes
  • Docker Swarm Mode
  • CI/CD with Jenkins
  • Load balance containers using Traefik

Their Twitter account says they are London-based and their first tweet is posted on 27 Jul 2015. Seems like they are almost 2 years old but yesterday was the first time I heard about them. Sorry guys 🙂

Hope this helps.
Good Luck,
Serdar

Linking Jenkins to a Local Git Repository

I wanted to try creating a CI (continuous integration) pipeline using Jenkins at home for fun 🙂

I launched IntelliJ IDEA by jetbrains and created an empty test project. Then I added this project to Git. In case you don’t know how, below is how you can create a Git repository for you project in IntelliJ IDEA (Community 2017.1.2).

intellij-idea-create-git-repository

Once the Git repository has been successfully created you should see a .git folder as below (You may need to enable display of hidden folders).

.git folder

Now, launch Jenkins (by default it should launch on http://localhost:8080/).

Now click on New Item, select “Freestyle project” and type a name for it, click OK.

jenkins new item

 

jenkins freestyle project

Go to Source Code Management tab and select Git

jenkins source code management tab

The critical part is what you enter here as the “Repository URL”. The correct value should start with file://// for a local repository which is created on your PCs local file system.

For a test project which was created under “Users/serdarosmanonur/IdeaProjects/JavaProject” the Repository URL should be entered as “file:////Users/serdarosmanonur/IdeaProjects/JavaProject”.

Now save this configuration, go to “Jenkins” dashboard (http://localhost:8080/) and click your projects name on the right.

jenkins dashboard

Click “Build Now” on the left. You should see the build success entry on the Build History area below the Build Now button.

jenkins build project

You have successfully linked Jenkins to your local Git repository and completed your first build.

Hope this helps.
Good Luck,
Serdar

asana for task management

Asana for Task Management

Have you tried Asana? We did and we liked it…

When you are just starting a new project you may not always have all the tools at your disposal. Sometimes it takes time to acquire them tools. Tools like JIRA. Especially if you are working for a big IT company where things may go slow due to some protocols that need to be followed and countless approval processes. Or, even if you have the tools, you might want to do some off the record R&D jobs in parallel and you may not wish to follow them along with the other project tasks inside JIRA (or TFS or whatever). This is where the ASANA comes in.

With Asana, you can create projects, under them you can create tasks, and under the tasks, you can create related subtasks. You can set a due date for the tasks and keep your colleagues notified. With the Asana mobile app and notifications, tracking the tasks’ status really gets fast and efficient.

 

Hope this helps.
Good Luck,
Serdar

css-box-model

What is CSS Box Model?

In DOM (Document Object Model) each element is represented as a rectangular box. These boxes determine the properties like size, color etc. The position of these elements is also determined by these boxes which in turn forms the layout of your webpages. You must know the CSS box model as you know your name if you want to be able to set the layout of your webpages and write your own CSS stylesheets.

The CSS Box Model is the foundation of this layout. It defines 4 basic properties:

–  Content: Content area is defined using “width” and “height” properties

–  Padding: Represents the inner margin of a CSS box

–  Border: A distinct layer, between the outer edge of the padding and the inner edge of the margin

–  Margin: Extends the border area with an empty area used to separate the element from its neighbors

The diagram below explains the concept better:

css-box-model

Hope this helps.
Good Luck,
Serdar

javabeans

What is a Java Bean? Is it Just Any Java Class?

What is a Java Bean? Is it just any java class?

The answer is no!

Many people think when they say “Java Bean” they are talking about just any java class, but this is not the case. A Bean is not just any java class. Java Beans are classes that need to abide by some certain rules/conventions.

3 conventions they should satisfy can be listed as below:

1- They need to have a no-argument public constructor

2- They need to have get/set methods for their properties named according to naming conventions (getProperty, setProperty)

3- They need to be serializable

Hope this helps.
Good Luck,
Serdar