dgplug member blogs

Reader

Read the latest posts from dgplug member blogs.

from abbisk

Free Software

“Free” software “is software that can be used, studied, and modified,” copied, changed with little or no restriction, and which can be copied and redistributed in modified or unmodified form. Free software is available gratis (free of charge) in most cases. “In practice, for software to be distributed as free software, the human-readable form of the program (the source code) must be made available” along “ with a notice granting the” user permission to further adapt the code and continue its redistribution for free. This notice either grants a “free software license”, or releases the source code into the public domain.

Open-Source Software

In the beginning, all software was free in the 1960s, when IBM and others sold the first large-scale computers, these machines came with software which was free. This software could be freely shared among users, The software came written in a programming language (source code available), and it could be improved and modified. Manufacturers were happy that people were writing software that made their machines useful. Then proprietary software dominated the software landscape as manufacturers removed access to the source code. IBM and others realized that most users couldn’t or didn’t want to “fix” their own software and There was money to be made in leasing or licensing software. By the mid-1970s almost all software was proprietary “Proprietary software is software that is owned by an individual or a company (usually the one that developed it). There are almost always major restrictions on its use, and its source code is almost always kept secret.” users were not allowed to redistribute it, source code is not available users cannot modify the programs. Software is an additional product that was for sale In 1980 US copyright law was modified to include software In late 1970s and early 1980s, two different groups started what became known as the open-source software movement: East coast, Richard Stallman (1985), formerly a programmer at the MIT AI Lab, launched the GNU Project and the Free Software Foundation. “to satisfy the need for and give the benefit of ‘software freedom’ to computer users ultimate goal of the GNU Project was to build a free operating system the GNU General Public License (GPL) was designed to ensure that the software produced by GNU will remain free, and to promote the production of more and more free software.

 
Read more...

from darshna

A few months ago I came to know that pycon was happening in Chennai on the month of October, and I realized that attending this year's PyCon is necessary. Deep down I knew that after returning from Pycon I'll not only make new connection and potential people but also it'll change my perspective about the open-source world(in a good way). Also this was my first time that I'll be moving out from my home town, I asked mom that this will be a great opportunity for my exposure of life and experience, as unfortunately there's not much stuff happening in my college(except mass bunking and unnecessary gossip). And my Durga puja was over, packed my bags and left for Chennai. After 27 hours of a long journey, I reached the station, where communicating with people was a bit tough, but my ecstasy was unlimited of meeting that part of India(South). I couldn't sleep that night, I woke up early morning and got ready and reached the venue with one of my folks (@priyankasaggu) from dgplug. When I reached there I was amazed at the crowd which gathered there, I took my id card, and went in the venue, people were everywhere are. Earlier I didn't notice that goodies were being distributed if you play quiz from the respective booths of sponsors. At the evening after the event got over we (dgplug) members went to beach and spent some good time together. It was day 2 and coincidently I met some new friends who were from Kerala and thet were of my same batch and of same stream. So, I attended the keynote speaker who was Ines Montani, and yeah I did not understand everything as clear as water but yes, I did get an idea. And at the end of the day, we all the folks of dgplug went for dinner and enjoyed our meals and some quality time together.

Overall, my experience if I rate out of 10, it will 10/10...yeah every penny i spent to come here, every hour of my journey I spent to come here was worth it...Before coming to PyCon 2k19, I asked myself that none of my friends came from my college.. will it be worth it? Now I know yes it was worth it!

 
Read more...

from jason’s wotw blog

wotw, leisure

And to tell the truth I
don't want to let go of
the wrists of idleness, I
don't want to sell my life
for money, I don't even
want to come in out of
the rain.

And with this delightful Mary Oliver quote, this little blog, bids you adieu awhile.
I want to go and play in the rain :)

 
Read more...

from jason’s wotw blog

wotw, gut punch

means something knocks the wind out of you literally a punch to the gut. means to be suddenly be emotionally wound up, because of something you see or hear.

like I am about to do to you …


 
Read more...

from darshna

Here we will get to know about the If-else, control flow.

As the name says (if) it simply applies the condition applied to it. If the value of the expression is true, the command works according to it. #!usr/bin/env/ python 3 number= int(input("Enter a number:")) if number<100 print("the number is less than 100")

Else statement:– This is used when the (if)statement is not fulfilled.

#!usr/bin/env python3 number= int(input("Enter a number:") if number<100 print("The number is less than 100"); else print("The number is greater than 100");

 
Read more...

from darshna

Be who you are, not who others tell you to be.

The above quote clearly replicates confidence and self-love. We somehow get affected by the negative comments and judgments passing by and try to change ourself so that people would accept us the way we are. Finally, when we arrange ourselves for the people to accept us there is again a judgment passing by and yet again we try to change ourselves. In the end, we forget the real us and be a toy for people's satisfaction. as we grow old we realize that we have left the true selves way back and been another person. Fat-shaming or Body shaming, being a dark-skinned girl or being extra bold even wearing a dark lipstick at daytime, or wearing clothes of your own choice attracts people's attention more than taking care of social and devastating issues happening day-to-day. Have you ever heard someone saying that look at the person who threw the packets on the side of a road or look at the person who is pissing at a public place, why aren't they ashamed? Yes, I am healthy and have a unique body shape that maybe most girls don't have or most guys make fun of it. So what? yes I am like this and I am proud of it but you will ignore it once or twice or maybe thrice. Ignorance is not a solution the mentality should be changed, and it can only change if people start teaching their children the value of respect and acceptance, acceptance of people as they are. That obviously doesn't include the acceptance of wrongdoings and violent nature of some people, but accepting the things to make this a society and a better place to live. Only then we can stand together and build a healthy community.

 
Read more...

from jason’s wotw blog

wotw, myth

the stories we tell ourselves as a culture, to explain what we could not really explain.

to help use make sense of the world, so that we’d not fuss over the unexplained and let us get on with our lives and make progress with the things we do understand.


 
Read more...

from darshna

After so many days I am continuing with Python again. Yes, I was not able to maintain the series properly, but let's get back to work and know what I read next in Python from the book of PYM. In Python most of the lines will have expressions and these expressions are made of operators and operands.

Operators

These are the symbols which tells the python interpretor to do the mathematical operation.

2+3
5
22.0/12
1.83333

To get floating results we need to use the division using any of operand as the floating number. To do modular operation use % operator.


#!/usr/bin/envv python3
days= int(input("Enter days:"))

month= days/30
days= days%30
print("Months= %d days= %d %(month, days))

Relational operators

operator ## meaning

< is less than > is greater than <= is less than or equal to >= is greater than or equal == is equal to != is not equal to

Note: // operator gives floor division result.

4.0//3
1.0

4.0/3
1.33333

Logical operator

To do a logical AND, OR we use these keywords.

 
Read more...

from darshna

I am reading the book Linux for you and me, and some of the commands I got to know and it's work!! Gnome Terminal Here in this terminal, we write the commands.

For example: [darshna@localhost~]

Here Darshna is the username, localhost is the hostname and this symbol `#~ is the directory name.

Following some commands are: * date command= tells us about current time and date in IST(Indian standard time) * cal command= displays the default present calendar. * whoami command= tells which user account you are using in this system. * id command=displays real user id. * pwd comma= helps to find the absolute path of the current directory. * cd command= this command helps you to change your current directory.

 
Read more...

from nileshpatra

I recently started reading the pym book suggested by folks at #dgplug. Since I have been programming in Python since an year and a half, I could go through the basics fairly quick. Here are the topics I covered:

  • Variable and Datatypes
  • Operators
  • Conditionals
  • Loops
  • Python Datastructures
  • Strings
  • Functions

However, file handling is something I have rarely used till now. This blog talks about the it and some of the great takeaways.

Opening a file

A file can be opened in three modes: ### Read: Opens the file in read-only mode. The file cannot be edited or added content to. The syntax for the same is :

>>> f = open('requirements.txt' , 'r')

### Write: Opens the file in write, you can make desired changes to the file. The syntax for the same is:

>>> f = open('requirements.txt' , 'r')

### Append: Opens file in append mode. You can append further content, but cannot change or modify past content. The syntax for the same is:

>>> f = open('requirements.txt' , 'a')

Reading a file

When a file is openened in read mode, the file pointer is at the beginning of the file. There are different functions for reading the file:

read()

It reads the entire file at once. The file pointer traverses the entire file on calling this function. Therefore, calling this function again will have no effect, since the file pointer is already at EOF. Syntax for the same is:

>>> f.read()
'selenium >= 3.141.0\npython-telegram-bot >= 11.1.0\ndatetime >= 4.3\nargparse >= 1.4.0\nwebdriver-manager >= 1.7\nplaysound >= 1.2.2'

readline()

This function moves the file pointer to the beginning of the next line hence outputting one line at a time. Syntax for readline() function is :

>>> f.readline()
'selenium >= 3.141.0\n'
>>> f.readline()
'python-telegram-bot >= 11.1.0\n'

readlines()

Reads all the lines in a file and returens a list.

>>> f.readlines()
['selenium >= 3.141.0\n', 'python-telegram-bot >= 11.1.0\n', 'datetime >= 4.3\n', 'argparse >= 1.4.0\n', 'webdriver-manager >= 1.7\n', 'playsound >= 1.2.2']

Now, we should always close a file we opened when not in use. Not closing it increases memory usage and degrades the quality of code. Python offers nice functionality to take care of file closing by itself:

with keyword

`with keyword can be used as follows:

>>> with open('requirements.txt' , 'r') as f:
...     f.read()
... 
'selenium >= 3.141.0\npython-telegram-bot >= 11.1.0\ndatetime >= 4.3\nargparse >= 1.4.0\nwebdriver-manager >= 1.7\nplaysound >= 1.2.2'

Writing into a file

The .write() function can be easily used to write into a file. This will place the file pointer to the beginning and over-write the file completely. Here's how that works:

>>> f = open('requirements.txt' , 'w')
>>> f.write('tgbot\n')
6

The return value '6' denotes the number of characters written into the file

Hope you enjoyed reading the blog, :)

 
Read more...

from nileshpatra

Contributing to open source is one of the best ways to hone up programming skills. Along with writing quality code, using a version control tool plays a crucial role while contributing. There are a lot of source control management platforms such as github , gitlab , phabricator etc. This blog discusses about making code contributions via github.

So what Is a Pull Request?

Pull request, as the name suggests is a patch of code that is sent to original code base to be merged into the source code after review. Usually, maintainers of the project will review the PR(pull request) and merge it into original code base if everything looks okay.

How to make a PR?

1. Fork the Repository and clone

First off, there should be a fork of the upstream repository. Fork is nothing but a copy of the upstream repository onto your own github. This is where you will be pushing your changes. (Since you own it :D) Then, clone of repository so as to do the changes locally and testing them before sending a patch. This should be fairly simple using git clone <repository URL>

2. Make a new branch

Now, if we want to make a change to the source code, we should always ensure that the master/development branch to be always in sync with upstream. You would definitely not like messing the master branch , and if in case the issue's priority is not high, the PR will be pending with the changes in master branch.

Other than that, the master branch is 'supposed' to have the updated code(or the production code), the rest of the features are supposed to be done on separate branches before being pushed into production.

Thus, it it is always a good practice to make new branches for each pull request to be opened. To do this use git checkout -b <branch_name> -t upstream/master This will make the branch in sync with the upstream. If upstream is not added, you can manually add it to remote using git remote add upstream <upstream_URL>

Or alternatively, you can just create a branch and fetch from upstream using:

   git checkout -b <branch_name>
   git fetch upstream

3. Make changes in the created branch and push

make the required changes and commit them via git add and git commit commands After the changes are done, push to your code via git push origin <branch_name>

4. Make a pull request

Usually, just after pushing to github, you would button when you open your repository(on github) clicking on which a PR will be made. It should look something as follows:

PR image

If that doesn't show automatically, navigate to the branch(on github) and make a PR.

That is it! Now keeps doing the requested changes(if asked) locally and keep pushing code on the created branch till the point it is fit for merging.

 
Read more...

from Stories of raydeeam

After resuming my study I've learned about File handling (I can recall file handling in C).

  • File handling Python gives us an easy way to manipulate files. We can divide files in two parts, one is test file which contain simple text, and another one is binary file which contain binary data which is only readable by computer.

    • File opening The key function for working with files in Python is the open() function. The open() function takes two parameters; filename, and mode. There are four different methods (modes) for opening a file:

      "r" - Read - Default value. Opens a file for reading, error if the file does  not exist
      "w" - Write - Opens a file for writing, creates the file if it does not exist
      "a" - Append - Opens a file for appending, creates the file if it does not exist
      "x" - Create - Creates the specified file, returns an error if the file exists
      
    • Creating a file To create a new empty file:

      >>> f = open("file.txt", "x")
      
    • To Create a new file if it does not exist:

      >>> f = open("file.txt", "w")
      
    • Opening a file To open a file we use open() function. It requires two arguments, first the file path or file name, second which mode it should open. If we don't mention any mode then it will open the file as read only.

      >>> f = open ("file.txt")
      >>> f
      <_io.TextIOWrapper name='file.txt' mode='r' encoding='UTF-8'>
      
    • Closing a file After opening a file one should always close the opened file. We use method close() for this.

      >>> f = open ("file.txt")
      >>> f
      <_io.TextIOWrapper name='file.txt' mode='r' encoding='UTF-8'>
      >>> f.close()
      
    • Reading a file To read the whole file at once use the read() method.

      >>> f = open("sample.txt")
      >>> f.read()
      'I am Rayan\nI live in Bangalore\nI am from West Bengal\n'
      

      If we call read() again it will return empty string as it already read the whole file. readline() can help you to read one line each time from the file.

      >>> f = open("sample.txt")
      >>> f.readline()
      'I am Rayan\n'
      >>> f.readline()
      'I live in Bangalore\n'
      

      To read all the lines in a list we use readlines() method.

      >>> f = open("sample.txt")
      >>> f.readlines()
      ['I am Rayan\n', 'I live in Bangalore\n', 'I am from West Bengal\n']
      

      We can loop through the lines in a file object.

      >>> f = open("sample.txt")
      >>> for x in f:
      ...     print(x, end=' ')
      ...
      I am Rayan
      I live in Bangalore
      I am from West Bengal
      

      Example:

      >>> f = open("sample.txt", "w")
      >>> f.write("I am Rayan\nI live in Bangalore\nI am from West Bengal")
      >>> f.close()
      >>> f = open("sample.txt", "r")
      >>> print(f.read())
      I am Rayan
      I live in Bangalore
      I am from West Bengal
      
    • Using the with statement (which I found so cool) In real life scenarios we should try to use with statement. It will take care of closing the file for us.


 
Read more...

from Stories of raydeeam

Today I read about few things those are listed below:

  • Data Structures in Python Data structures is a way to store and organize data. Obviously, some data structures are good in one set of problems, but terrible in other ones. The right choice of data structure can make your code faster, more efficient with memory and even more readable for other human beings. Python has few in-built data structures.

    • Lists List is a sequence of elements. It can store anything: numbers, strings, other lists, functions and etc. The fact that it can store anything is great but it has a disadvantage. This kind of list will require more memory. Let’s take a look at a basic example of list:

      # create list
      >>> list= ['Noname', 'Rayan', 'xyz', 100, 42, 55]
      >>> list
      ['Noname', 'Rayan', 'xyz', 100, 42, 55]
      # check if element is in list
      >>> 42 in list
      True
      
    • Tuples Another way to store a sequence of elements is to use tuples. Tuple is basically the same thing as list but with one difference. You can’t add or remove elements from tuples after initialization. It’s immutable data structure.

      >>> a = ('Noname', 'Rayan', 'xyz', 100, 42, 55)
      a
      >>> ('Noname', 'Rayan', 'xyz', 100, 42, 55)
      
    • Dictionary nother important data structure is dictionary. The difference between dictionary and list is that you access elements in dictionary by key, not by index.

      >>> dict = {'Rayan': 'Das','Kushal': 'Das','Sayan': 'Chowdhury'}
      >>> dict
      {'Rayan': 'Das', 'Kushal': 'Das', 'Sayan': 'Chowdhury'}
      
    • Sets Set stores only unique elements.

      >>> letters = {'a', 'b', 'c'}
      >>> 'c' in letters
      True
      >>> letters.add('d')
      >>> letters
      {'c', 'b', 'd', 'a'}
      
  • Strings In Python we declare strings in between “” or ‘’ or ‘’’ ‘’’ or “”” “”“ There are different methods available for strings.

    • Strip a String Got to know how to strip a string.
  • Functions A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.

    • Defining a function This way we can define a function.

      >>> def func(params):
      ...     statement1
      ...     statement2
      
    • Calling a function

      >>> def func():
      ...     print("hello from func")
      ... 
      >>> func()
      hello from func
      
    • Local and Global variables

    • Keyward only arguments We can also mark the arguments of function as keyword only. That way while calling the function, the user will be forced to use correct keyword for each parameter.

    • Docstrings We use docstrings in Python to explain how to use the code, it will be useful in interactive mode and to create auto-documentation.

    • Got to know about Higher-order function. It does at least one of the following step inside: -Takes one or more functions as argument. -Returns another function as output.

    • Map function map is a very useful higher order function in Python. It takes one function and an iterator as input and then applies the function on each value of the iterator and returns a list of results.


 
Read more...

from Stories of raydeeam

I've started Python again from Pym book by Kushal

Read about following topic and solved few basic problems.

  • Data types
  • f-string ( Which I found so cool)
  • Type conversion
  • Conditional statements
  • Loops
    • When I started Python back in college I found it so confusing but then I got to know how it works.

I've paused here. Cleared all my basics again till now. Basics are the key ingredients in long run I believe.


About me

 
Read more...