Koder Blog

Share your technical work and thoughts Write an article
How to use Python in Devops
kishore_kumar | July 15, 2019
Python in DevOps
Nowadays everyone is looking at DevOps and Python. So if you want to know why the python is important in DevOps this article may help you.
In DevOps culture, we are required to do a lot of automation using tools and scripts. Python will provide huge open libraries and modules to help in that automation.
If we want to write a script to automate a task Python is a better option in terms of platform independence, easy to write and integrations with all tools. In Python there are so many modules available as open-source which supports several tools.
Below are some useful modules in python to write automation scripts.
Gitapi is a python module which will interact with our version control system, so if you wish to set properties or some useful functions dynamically you can write a python script using this module.
Continuous integration we need to add some scripts to perform some of the jobs. If we write those scripts in bash or PowerShell then we will face a problem when our CI environment is changed. So we can use python to so that we can move our environments.
python
devops
Basics of Python OS module
kishore_kumar | Aug. 3, 2019
OS module provides a lot of functions to interact with Operating System which can handle files, processes and environment paths and many more.
If you are planning to automate some tasks in your server which handle paths, system variables OS module is the best option because of platform independence.
OS module is platform independent, you can write the script in any machine (Linux, Windows etc.) and you can execute the same script for the same functionality in other machines also if the code is not platform independent.
If you want to list down all functions for OS modules you can directly go through the official documentation page of python i.e https://docs.python.org/2/library/os.html.
Here I will discuss some of the functions which I use most of the time.
For any module in python, the first thing is you need to import it, and you can import os modules as below.
import os
python
python-os
working with REST api internet resources with python and python requests
kishore_kumar | Feb. 18, 2019
In this article we are going to see how to use python packages/modules to request REST api mostly web services publicly available.
If you are requesting to an URL it should be the one of the type below from CRUD operations.
POST ( Create )
GET ( Read)
PUT ( Update)
DELETE ( Delete)
Lets say you have the API access to your resources through web services and you want to automate some tasks then you can use python requests package.
python
python-requests
Accessing Big-query (Google Cloud Platform) using command line:
satya2142 | Sept. 9, 2018
This article contains high level information about the cloud shell command to communicate with Cloud Datawarehouse( BigQuery)
Requirements: Project should be created in GCP and must Initialize the cloud shell/Install the cloud SDK.
Either you can use the command line installed (Cloud SDK) on machine or Cloud Shell
bq is a python-based, command-line tool for BigQuery
bq help will gives you complete details of commands that you can use with bq
bq help command : will gives you description about the given command
USAGE: bq [--global_flags] [--command_flags] [args]
GCP
Big-Query
Google cloud platform
DeDuplication-ReDuplication
harika | Sept. 17, 2018
This article helps you to deduplicate a string given a string and chunk size.
Case : Lets say you have a large text file. Each row contains an email id and some other information (say some product-id). Assume there are millions of rows in the file. How would you effieciently de duplicate the data ?
DeDuplication : The process that returns an intermediate strinig , helps in reduplication of original string.
Steps to follow :
1. Break the string into chunks of the given size (Values of chunk size can be 1KB,10KB and so on).
2. Find the unique chunks and make a note of where these chunks occur in the string.
3. The intermediate string should contain the unique strings and their positions.
python
javascript
java
string
Using Angular material MatTableDataSource in combination with FormArray
abhi | Sept. 22, 2018
Expected Behaviour: When user clicks on add data, table with empty column need to be displayed and want form control for newly added data.
For this behaviour, I used MatTableDataSource class and FormArray class and MatTable.
MatDataSource is a material class which accepts client side data array and includes native support of filtering, pagination
and sorting.  Data source provides stream, it bears the responsibility of triggering table updates.
FormArray is an alternative to FormGroup for managing any number of unnamed controls.
The mat-table provides a Material Design styled data-table that can be used to display rows of data.
I defined passengerData Array as type of PassengerDetails and used this array as data source for mat table.
formbuilder
matTable
formarray
Formgroup
dynamic forms
Exchange data between components using service
abhi | Sept. 22, 2018
Expected Behaviour: using Service to exchange data between components.
Observables open up a continuous channel of communication in which multiple values of data can be emitted over time.
BehaviourSubject holds the data that needs to shared with other components. I want to define filterType behaviour subject as boolean and set default value null to filterType. Components subscribe to filterObservable which will simply return BehaviourSubject value.
Declare  function to set value to BehaviourSubject.
service.ts
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs'
observable
component interaction
service
behavior subject
angular
Remove elements from javascript array
harika | Sept. 27, 2018
The main aim of this article is to show case the ways to remove elements from a javascript array
ar = [1,2,3,4,5,6]
Procedure1 : splice is a built in method of javascript array. This is the best method to remove elements . It just takes two parameters index defines where to starts from and the next is the number defines how many elements to be removed.
ar.splice(ind, noOfElementsToRemove)
Ex:
If a user want to remove 2nd element from the ar. Ex :ar.splice(1, 1)
If a user want to remove 2nd and 3rd elements from the ar. Ex: ar.splice(1, 2)
javascript
Django all auth setup from the scratch
kishore_kumar | March 8, 2019
When we are implementing any webapplication, we may need to setup the user management for our django application. I wonder if I can get the whole package that will manage all things about Users like Registration, Logins, Social signups etc.
Luckily we got the django application which will do the same i.e django-allauth.
This app will provide so many functionalities as we need ready made. Some of them are listed below.
User Signup of both local social accounts
Email or Username logins
E-mail address management like verification etc.
Recover forgotten password
python
django-allauth
django
What is DevOps and its common principles
kishore_kumar | June 25, 2019
What is DevOps
We have lot of definitions in Internet for DevOps , but none of those definitions can say this is the DevOps. So here also I am not going to tell this particular thing is DevOps, because it is not a thing, not a framework and not at all about tools.
First I want to say that DevOps is not a new born baby from last 3 to 4 years ?,No the word “DevOps” is the only new thing to us. So let us take a look at the past process to deliverables in terms of Software Delivery models, so that we can understand how DevOps is framed.
Suppose if an organization is providing some services to the users then it will maintain below teams to maintain and develop their services.
Development Team -> Responsible for development of their services.
Middleware Team -> responsible for deploying/ management of executables.
Admin Teams (Operations) -> Responsible for setting up the environments and maintenance.
devops
Is selenium really a worth learning phenomena in Automation Testing?
SrinuThummalapudi | Nov. 17, 2018
Let’s just go ahead and observe some real points about selenium, then we will sit down and think thoroughly about the answer for this question.
At first, is automation really required for performing so called testing validations? I don’t really think so, as every validation can be accomplished by a manual effort evidently. As we say, humans tend to commit mistakes when they are given same tasks every day. This may be true to some extent, reducing the time, man power and improving the efficiency and accuracy, and test coverage are few of the benefits of the automation as we observe in real.
With the above stated and other(which literally can be found on Google) advantages of automation, we can convince ourselves that we need automation to put in place for our project right away but just hold on, there is so much pre-requisite drama required to make that happens.
The pre-requisite starts with identifying the automation tool for the test cases to be automated in our project. There comes a few in mind sparingly, those are HP UFT, and Selenium. Which one should we get along? Various differences do exist between them comparatively such as in cost, browser compatibility, and language compatibility, support, CI, and Execution Efficiency.
Many people say UFT is preferred over Selenium because of its extensive features like record-play back execution, no need of programming knowledge as code(in VB Script) will automatically be generated with recording, Good object repositories, prominent object spying, most importantly the support that we get for the UFT problems/issues/configurations as it is a licensed automation tool.
And the real fact is the above preference seems to be a wrong choice over the period due the cost promising scripts which can perfectly be scripted in Selenium with zero charges as it is an open source tool and it can be integrated with all the possible integrations that are available in the Automation framework. It has become such a powerful tool that every organization/ company has made a mandate that all automation scripts should be scripted in Selenium if they are yet to be automated, and should be converted to selenium scripts if they were supported by UFT before.
I wouldn’t really say that the UFT has completely lost its presence but would emphasize that Selenium has taken over the most. So the selenium learning is, as worth as it is free.
HP UFT
Automation Testing
Selenium
Introduction to Python
kishore_kumar | Dec. 13, 2018
What is Python?
Python is a snake and also a name to a computer language which was implemented by Guido van Rossum.
So python is not only a snake anymore it is also a programming language that most of the developers fell in love with it once started using it.
Official documentations says
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
Why Python is that much popular, here are some points.
Python is a simple and reading python programs almost feel like English statements.
python
Electron Frameless Window
harika | Dec. 18, 2018
A frameless window is a window without having any control to the title bar , menu bar . It is more are like a simple webpage.
You can adjust the electron app height and width dynamically by Dynamic height and width.
We can make the electron app as frameless using
mainWindow = new BrowserWindow({frame: false, width: 1000, height: 500})
but once if you make the app as frameless , all the controls like dragging , minimizing, maximizing, closing of the tool will be lost.
Electron is providing api's for the events like minimize, maximize, close and full screen. you can custommize according to your choice.
Dragging functionality restores once we set the style of customized title division to
electron js
frameless window
react js
Install Python and start using it in windows or linux
kishore_kumar | Dec. 13, 2018
Install python and start using it
In this series I am going to use python 2.7 version, since most of the systems are still using Python2. Stable Python 3 is released and if you want to start with that also there is no problem. Most of the programs are compatible to Python3 except some syntaxes.
If you are using Ubuntu, Redhat or any other Linux systems python is already installed by default. Otherwise just install using apt-get install python2, python-pip for Ubuntu and yum install python2, python-pip for centos based.
In windows you need to download installer msi file and then you can install python. If you install python in windows using installer you will get an interactive IDLE also which will be very helpful while you learning python. Below is the screen of IDLE in windows.
You can execute python syntax/lines in this IDLE.
Now open your cmd or terminal and type python , then you will get into python shell which is same as shown above, but only difference is IDLE gives more functionalities while we learn python we can use those. But no problem if you are running python in UNIX systems , at the end we are all going to write python code.
Python shell shown below.
python
ELK Stack / Work with ELK Stack from command line
harika | Feb. 11, 2019
This tutorial gives a basic understanding of elk stack and how to work with elk stack from command line.
ELK Stack is the most popular log Analysis platform where E: Elastic Search, L: Logstash, K: Kibana
Elastic Search: Real time Distributed and Analytics Engine. An Apache Lucene based search engine on rest API's. Implemented in Java. Supports full text search. Completely document oriented instead of tables and schemas. This is mostly used for single page application projects. Query and analyze the structured and as well as unstructured data in any form we want. Helpful to search the logs in json format. Indexing and allowing it to search of logs.
Advantages: Scalablility, Really fast, Multiligual, Document Oriented (JSON), Auto completion and Instant search, Schema free.
Installation:
Step1: Register the elastic signing in key so that the package is verified after installtion
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Elasticsearch
Logstash
Kibana
ELK Stack

Search Blog

Popular in Koder Blog

How to use Python in Devops
Posted by kishore_kumar
July 15, 2019
DeDuplication-ReDuplication
Posted by harika
Sept. 17, 2018
Django all auth setup from the scratch
Posted by kishore_kumar
March 8, 2019
What is DevOps and its common principles
Posted by kishore_kumar
June 25, 2019
Basics of Python OS module
Posted by kishore_kumar
Aug. 3, 2019
Electron Frameless Window
Posted by harika
Dec. 18, 2018
Remove elements from javascript array
Posted by harika
Sept. 27, 2018
Introduction to Python
Posted by kishore_kumar
Dec. 13, 2018
Install Python and start using it in windows or linux
Posted by kishore_kumar
Dec. 13, 2018
Exchange data between components using service
Posted by abhi
Sept. 22, 2018
Few DevOps interview questions
Posted by krishna
Feb. 24, 2019
DevOps Common principles part 2
Posted by kishore_kumar
June 26, 2019