Saturday, December 31, 2022

What is List datatype in Python

 A list is a collection of items that are ordered and changeable. Lists are written with square brackets, and the items are separated by commas. Lists are one of the most commonly used data types in Python and are very versatile.

Here is an example of how to create a list in Python:

fruits = ['apple', 'banana', 'orange', 'mango']

You can access the items in a list by referring to the index number of the item. The index numbers start at 0, so the first item in the list has an index of 0, the second item has an index of 1, and so on.

Here is an example of how to access an item in a list:

print(fruits[0]) # prints 'apple'

You can also use negative index numbers to access items in the list, starting from the end. The last item in the list has an index of -1, the second to last item has an index of -2, and so on.

Here is an example of how to access the last item in a list using a negative index:

print(fruits[-1]) # prints 'mango'

You can modify an item in a list by assigning a new value to it.

Here is an example of how to change the second item in a list:

fruits[1] = 'strawberry'

You can also add new items to a list by using the append() method. This will add the new item to the end of the list.

Here is an example of how to add a new item to a list:

fruits.append('kiwi')

You can remove an item from a list using the remove() method. This will remove the first occurrence of the item from the list.

Here is an example of how to remove an item from a list:

fruits.remove('banana')

There are many other methods and operations that you can perform on lists in Python. For a complete reference, you can refer to the official Python documentation.

I hope this helps! Let me know if you have any questions.

Sunday, December 18, 2022

Let’s learn about the Socket programming using python

Recently one of my project required me to recreate the master slave mechanism. This is kind of similar to the one that we have in Jenkins architecture

Below are the requirements that I need to satisfy

  • The master should support multiple agents both windows and linux
  • The slave agents should constantly be connected to the Master
  • The master should be able to keep tabs on the slaves and see what each one is doing
  • The master should be able to assign tasks to each of them
  • The slave agents should share the task status frequently with the master


Friday, November 11, 2022

OS patch updates not installing on Windows servers

One of the reason could be corrupted OS files. Open the CMD as administrator and run the SFC /SCANNOW command. This should replace any corrupted OS files which are preventing the OS patch updates. Once done now manually try installing the Windows patch updates and restart the system/server after this. Note: The patch updates to work properly, the C drive should have enough space. I would recommend to have atleast 15 gb of space for this.

Thursday, September 16, 2021

Python Virtual Environment

  One of the cool features that python has, is the ability to create a virtual environment similar to the virtual OS mechanism. The virtual environment is like a sandbox with its own site-packages and other libraries mimicking the python installed in the system. This kind of environment helps the developer/engineer to understand the deployment issues of the python library by installing and debugging the library dependencies. This step helps in identifying and fixing the dependency issues before deploying them into production environments. Also, as this entire stuff happens in an isolated virtual environment, he/she doesn't need to worry about the false results by OS level setup.