Summer training students' planet

August 16, 2017

Vivek Anand

Using Syntastic for Python development

I use Synstastic plugin of vim for syntax checking in vim. Syntastic offers syntax checking for a LOT of languages. But, there is a problem that i had been facing with it. For a file with larger than 4k lines, it takes a lot of time to check the syntax and it used to happen every time you save the file. Syntax checking on write operation is the default behavior.

So, i did some changes in my .vimrc so that i could still use Syntastic for larger files. Do note that syntastic checking still takes a long time but, i have configured it to be called whenever i want to rather than on every write operation or opening of file.

” show list of errors and warnings on the current file
nmap <leader>e :Errors<CR>
” Whether to perform syntastic checking on opening of file
” This made it very slow on open, so don’t
let g:syntastic_check_on_open = 0
” Don’t check every time i save the file
” I will call you when i need you
let g:syntastic_check_on_wq = 0
” By default, keep syntastic in passive mode
let g:syntastic_mode_map = { ‘mode’: ‘passive’ }
” Use :Sc to perform syntastic check
:command Sc :SyntasticCheck
” Check pylint for python
let g:syntastic_python_checkers = [‘pylint’]
” For jsx – React and React native
let g:syntastic_javascript_checkers = [‘eslint’]

This change made opening of a larger python file ~25s (yes, seconds) faster. It still takes a lot of time for syntax checking though. I will have to find out why and if i could do anything about it. I don’t want to leave out this plugin because it offers so much. I could simply use Python-mode for python syntax checking but, what about the rest of the languages which i am going to use.


by Vivek Anand at August 16, 2017 07:09 AM

August 15, 2017

Kshitij Kumar

Python’s SymPy module is really cool

So I was just browsing some code, and I came across a cool module I’d never seen before: SymPy

Basically, SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS).

What is symbolic mathematics?

Symbolic computation deals with the computation of mathematical objects symbolically. This means that the mathematical objects are represented exactly, not approximately, and mathematical expressions with unevaluated variables are left in symbolic form. Symbolic computation is handling non-numerical values, this means symbols like in algebra. Variables are defined as

In simple word, “Variables are defined as Symbols in Symbolic Computation instead of defining variables as numerical values ”

This will be more clear from an example from SymPy official documentation.

Let us define a symbolic expression, representing the mathematical expression x+2xy+2y.

>>> from sympy import symbols
>>> x, y = symbols('x y')
>>> expr = x + 2*y
>>> expr
x + 2*y

Instead of evaluating to something by convention, the expression remains as just, x+2*y

>>> x*expr
x*(x + 2*y)

Here, we might have expected x(x+2y) to transform into x^2+2xy, but instead, we see that the expression was left alone. This is a common theme in SymPy.

 

The Power of Symbolic Computation

The real power of a symbolic computation system such as SymPy is the ability to do all sorts of computations symbolically.

SymPy can simplify expressions, compute derivatives, integrals, and limits, solve equations, work with matrices, and much, much more, and do it all symbolically. It includes modules for plotting, printing (like 2D pretty printed output of math formulas,), code generation, physics, statistics, combinatorics, number theory, geometry, logic, and more.

Examples from official SymPy tutorial

Solve x^2 – 2 = 0

>>> solve(x**2 - 2, x)
[-√2, √2
Compute  sin(x2)d
>>> integrate(sin(x**2), (x, -oo, oo))
√2⋅√π
─────
  2

Installation

To install SymPy run:

sudo pip install SymPy

If you already have Anaconda and want to update SymPy to the latest version, use:

conda update sympy

After installation, it is best to verify that your freshly-installed SymPy works. To do this, start up Python and import the SymPy libraries:

$ python
>>> from sympy import *

From here, execute some simple SymPy statements like the ones below:

>>> x = Symbol('x')
>>> limit(sin(x)/x, x, 0)
1
>>> integrate(1/x, x)
log(x)
 I am looking forward to using this library for mathematical computation for my IoT projects.

Currently, I am going through the tutorial and documentation to get familiar with using the software.

References:

Github: Introduction to contribution

Tutorial: http://docs.sympy.org/latest/tutorial/index.html

Documentation: http://docs.sympy.org/

Download: Releases 

 


by Kshitij at August 15, 2017 05:57 PM

Vipin kumar

A program to check you can Vote or not

#include<stdio.h>
void main()
{
double age;

printf(“Enter your age \n\n\t (ex: 18 or 17.9 or 45):”);
scanf(“%lf”,&age);

 

if(age >= 18)
printf(“\n yes you can Vote \n”);
else
printf(“\n sorry you can’t vote \n”);
}
OUTPUT :
1.

Enter your age

(ex: 18 or 29 or 45):19

yes you can Vote

 

2.

Enter your age

(ex: 18 or 29 or 45):17

sorry you can’t vote


by kumar vipin yadav at August 15, 2017 03:19 PM

Samridhi Agarwal

Working on Python Dictionaries

As dictionary can store many key-value pairs in fact it can store millions of items. So to handle or work with all those items python lets us loop through the dictionary. There exists many ways to loop through all dictionary items by using the keys or the value

1) Looping in Dictionary through all items One of the simplest way (at least for me) is using a for loop. So before working with the key-value pairs let us make a dictionary to store the information of a student.

student_1 = {'name' : 'Samridhi' , 'nationality' : 'Indian' , 'Stream' : 'Electronics and Telecommunication' , 'age' : '19'}

Use of for Loop – To get a single item of a dictionary we can simply use the key value but to print the whole dictionary we use the for loop. We select the two variables names to hold the key and value of each item in dictionary. We can choose any name or any character as variable. The for loop stores each item in those variables. The method items() is used to return the list of items.

Example – To print the information of student_1 in an organized way.

for key, value in student_1.items():
 print("\nKey: " + key)
 print("Value: " + value)

Output ->

Key: age
Value: 19

Key: Stream
Value: Electronics and Telecommunication

Key: nationality
Value: Indian

key: name
value: Samridhi

This type of looping works well with millions of data and it also helps to see for choices of many people when the value remains same for many but key (name of a person) keeps on changing.

This way does not give all the key-value pairs in the same order as entered because looping does not take of that. So the items we get are in a unpredictable order. If you want a sorted dictionary to get the name of millions of students in an order makes it more readable so a sorted() function can be used with the for loop.

2) Looping in Dictionary through keys – The method keys() of using the keys of any item is used when you don’t have to work with all the values in the dictionary. Like if you just want to know the name of students participated in a certain competition and don’t want to know in which game they are participating we can just get the keys of dictionary (names of students).
Example: In a college fest there are 3 sports category but we want only those students who participate in any sport.

College_fest = {
'sam': 'basketball',
'vikky': 'cricket',
'rachi': 'football',
'yashu': 'basketball',
}

for name in College_fest.keys():
    print(name.title())

Output ->

Sam
Vikky
Rachi
Yashu

Looping in dictionary through keys() method is default behavior for looping in dictionary so for name in College_fest: is same as for name in College_fest.keys():

We can use the key() method to work with items explicitly and this can also be used in many ways like i want to check if a certain person is coming to an event or not.
Example – Check the list of students if Rashmi is present if not call her to play any game.

if 'rashmi' not in College_fest.keys() :
    print("Rashmi come to register your name for college fest!")

Output ->

Rashmi come to register your name for college fest!

3) Looping in Dictionary through Values – In the previous method we were more concerned with keys but here our main focus is on the values. The values() method is used to get the values stored in the dictionary. Like if you only want to know the name of sports that are in the college fest.
Example –  Get the name of all the games in the College_fest.

print("These are the games in the college fest -")
for game in College_fest.values():
    print(game.title())

Output ->

These are the games in the college fest -
Basketball
Cricket
Football
Basketball

But here the game basketball repeats itself  This method results in a repetitive list of values. This can be used in some other examples where you would require all the values but here we want a list without repetitions. In this case set comes to rescue. A set only stores unique values. When a list is wrapped around a set python identifies all the unique items and displays them as a set of unique items.
Example – To display a set of games in the college fest.

print("These are the games in the college fest -")
for game in set(College_fest.values()):
    print(game.title())

Output ->

These are the games in the college fest -
Basketball
Cricket
Football

So here is the list of games in the college fest.

Next time i will be writing on nesting in dictionary.
Till then Happy Looping Dictionary!


by samridhiagarwalblog at August 15, 2017 02:43 PM

Jason Braganza

Book Review – i want 2 do project. tell me wat 2 do

Click me to buy!


TL;DR? It’s awesome. Buy it right now.

I was looking to dip my toes into some sort of structured help with the summer training and open source in general, because while I knew what I wanted, I just didn’t know how to go about it.

And then I realised that one of our mentors had actually gone and written a whole book on the how to.
So, I bought the paperback.
The binding is really good, the paper really nice (unlike other tech books I’ve read) and the words large enough to read.
I expect to get a lot of use, out of the book.

And lot of use is right.
While it’s a slim volume and a pretty quick read, the book is pretty dense when it comes to the wisdom it imparts.

The book has a simple (yet substantial to execute) premise.
You’ve just tipped your toe into programming, or you’ve learnt a new language, or you’ve probably written a few programs or maybe you’re just brand new.
You want to explore the vast thrilling world that is Open Source Software.
What now?

“i want 2 do project. tell me wat 2 do.” answers the “what now” in painstaking detail.

From communication (Mailing List Guidelines) to the importance of focus (Attention to Detail) to working with mentors (the Project chapters) to the tools (Methodology & tools) to the importance of sharpening the saw (Reading …) and finally the importance of your environment (Sustenance), the book covers the entire gamut that a student or a novice programmer with open source would go through

Shakthi writes like he speaks; pithily, concisely with the weight of his experience behind his words.

The book is chockfull of quotes (from the Lady Lovelace to Menaechmus to Taleb) that lend heft to the chapters.
The references at the end of each chapter will probably keep me busy for the next few months.

The book’ll save you enormous amounts of time and heartache, in your journey, were you to heed its advice.
It’s that good.

by Mario Jason Braganza at August 15, 2017 01:08 PM

Saptak Sengupta

Uploading Images via APIs in the Open Event Server

APIs help us to send and receive data in some particular data format that can then be used individually or integrated with a frontend UI. In our case, the entire API server is used to manage all the requests from the frontend and send back the necessary response. Usually, the application is to send simple form data which is then stored into the backend database and a valid jsonapi response is shown. However other than normal text, url, datetime data one very important data is media files, in our case event images, user images, slides, etc. In this blog, we will particularly deal with how we can upload images in the server using API.

Sending Data


Firstly, we need to decide how do we send the data in the post request of the API. So we are sending a base64 encoded string representing the image along with the image extension appended to it, for example, data:image/png;base64,iVBORw0KGgoAAAANS. This is a widely used format for showing images over the web. So when we send a POST request we send a json encoded body like:

{
"data": "data:image/png;base64,iVBORw0KGgoAAAANS"
}

Converting Base64 Data to Image


There are 2 parts of the data in the string that we receive. The first part basically tells us the format of the image(.gif in this case) and string encoding(base64 in this case), the second part gives us the encoded string. So, from the first part, we extract the file extension for the image file to be created. We use uuid.uuid4() for a random filename.
filename = '{}.{}'.format(str(uuid.uuid4()).data.split(";")[0].split("/")[1])

Now to write the base64 encoded string as an image file, we first need to get only the encoded string part from the data and then decode it. We use string decode function of python for the decoding purpose. Then we write the data to the image file and save it.
file.write(data.split(",")[1].decode("base64")

API Response


Finally using whatever logic you are using for serving your static files, you generate the static file path for the image saved. And then create another json encoded response which returns you the url for the saved image in the server.
{
"url": "https://xyz.storage.com/asd/fgh/hjk/1233456.png"
}

And there you have your image uploaded and served.

by SaptakS (noreply@blogger.com) at August 15, 2017 12:22 PM

August 14, 2017

Vipin kumar

A program to check odd and even number.

#include<stdio.h>
void main()
{
int number;

printf(“Enter a number :”);
scanf(“%d”,&number);

 

if ( number%2 == 0 )
printf(“\n Entered number is even \n”);
else
printf(“\n Entered number is odd  \n”);
}

NOTE :-> You can see we use (  ==  ) in if this is equal operator if we use it once (ex: number=50) it

assigned the value 50 to number but if we use (  ==  ) it compare the value of number with 50.
OUTPUT :
1.

Enter a number : 50
Entered number is even

2.

Enter a number : 5
Entered number is odd


by kumar vipin yadav at August 14, 2017 10:33 AM

A simple Program on if-else

#include<stdio.h>
void main()
{
int number;

printf(“Enter a number :”);
scanf(“%d”,&number);

 

if( number >= 50 )
printf(“\n Our number is greater than or equal to 50. \n”);
else
printf(“\n Our number is less than 50. \n”);
}
OUTPUT :
1.

Enter a number : 50
Our number is greater than or equal to 50.

2.

Enter a number : 5
Our number less than 50.


by kumar vipin yadav at August 14, 2017 10:21 AM

If-else statement in C.

Friends now we are Going To start If-Else.
Some time we have to make some decision in our program for those we have If statement.
If statement work in such a way

1.

if (condition)
statement;

if our condition is true then our statement will run

2.

if (condition)
statement_1;
else
statement_2;

In this case if our condition is true then our statement_1 will run and
if our condition is false then our statement_2 will run.

3.

if (condition)
{
statement_1;
statement_2;
statement_…..;
}
else
statement_n;

In this case if our condition is true then all our statements written in if
( or we can say all statement in that pair of {} ) will run .

NOTE : -> If we have more than one statement than pair of {} is necessary.

If our condition is false then our statement_n will run. which was written in
else.

3.

if (condition)
{
statement_1;
statement_2;
statement_…..;
}
else
{
statement_1;
statement_2;
statement_…..;
}
In this case if our condition is true then all our statements written in if
( or we can say all statement in that pair of {} after if ) will run .

If our condition is false then our all statements written in else will run.
which was written in else.
( or we can say all statement in that pair of {} after else ) will run .

NOTE : -> If we have more than one statement than pair of {} is necessary.

 

In our next Post  we will code some programe. Based on If-else statements

and do some example.


by kumar vipin yadav at August 14, 2017 09:52 AM

August 13, 2017

Kshithij Iyer

"People might criticize me for this but I guess the right thing to do when people around you show..."

“People might criticize me for this but I guess the right thing to do when people around you show their true but ugly faces is to move ahead and leave it all behind. To move to a different city with new faces. I guess it’s just a defense mechanism which I have developed over all these years. What can I do I can’t change the world or the people who exist in it or can I? I guess it’s time to move on and move ahead.”

- Kshithij Iyer

August 13, 2017 07:09 PM

"Now, this is really confusing my mind says that it’s time to move somewhere else but my heart..."

“Now, this is really confusing my mind says that it’s time to move somewhere else but my heart says there is a lot left to see in Pune.”

- Kshithij Iyer

August 13, 2017 06:35 PM

"So it’s 11 in the night seems like a good time to study let’s play some music and start..."

“So it’s 11 in the night seems like a good time to study let’s play some music and start studying. I guess Hardwell On Air would be a good option.”

- Kshithij Iyer 

August 13, 2017 06:20 PM

Himanshu Awasthi

Cool things I did with Python

Hello Friends !
I am here to represent some my cool stuffs which I had done in past using Python.
I start python with print “Hello World! This is Himanshu” Statement.
I learn some module of Python like Tkinter(“used for GUI application development”) and made a small game of TIC-TAC-TOE . I upload my code of TIC_TAC_TOE in github , People can enjoy this game by running the script click here : Tic-Tac-Toe .
Requirement :Python3 with Tkinter module

I made GUI calculator basically I take help from Google while writing script for calculator program.
People can check the code click here Calculator .
Requirement :Python3 with Tkinter module

Now I am developing a webpage which contain YouTube Downloader , Image Compressor  links together .

So BRB guys !

Happy Coding!


by kanpurpython at August 13, 2017 04:33 AM

August 12, 2017

Vipin kumar

Casting in C

Let us learn what is a casting in C.

Using this feature of C we can change data type of variables.

For Example :->

#include<stdio.h>
void main()
{
int a,b;
float div;
a=20,b=3;
div=a/b;
printf(“Result Before Casting : %d\n\n”,div);
div=(float)a/b;
printf(“Result After Casting : %f\n\n”,div);
}

or

#include<stdio.h>
void main()
{
int a,b,div;
a=20,b=3;
div=a/b;
printf(“Result Before Casting : %d\n\n”,div);
div=a/(float)b;
printf(“Result After Casting : %f\n\n”,div);
}

or

#include<stdio.h>
void main()
{
int a,b;
a=20,b=3;
printf(“Result Before Casting : %d\n\n”,a/b);
printf(“Result After Casting : %f\n\n”,a/(float)b);
}

you can see in both the case we use casting to make our result correct,

In first code we make change data type of (a) from int to float.

And in second code we change data type of (b).

And in third case we change data type of both (a) and (b).


by kumar vipin yadav at August 12, 2017 07:05 PM

Deepika Upadhyay

Work in Progress(Pym)

reading python for you and me , hope to summarise it more efficiently and keep using the functions …


by deepika at August 12, 2017 06:27 AM

August 11, 2017

Vipin kumar

A C program to find Simple Interest

We are going to use double Data Type in this program .

#include<stdio.h>
main()
{
double principal,rate,time,simple_interest;
printf(“Enter value of Principal : \n”);
scanf(“%lf”,&principal);

printf(“Enter value of Rate : \n”);
scanf(“%lf”,&rate);

printf(“Enter value of Time in month : \n”);
scanf(“%lf”,&time);

simple_interest = (principal*rate*time)/100;

printf(“The simple Interest is : %lf”,simple_interest);

}

or

#include<stdio.h>
void main()
{
double principal,rate,time,simple_interest;
printf(“Enter value of Principal : \n”);
scanf(“%lf”,&principal);

printf(“Enter value of Rate : \n”);
scanf(“%lf”,&rate);

printf(“Enter value of Time in month : \n”);
scanf(“%lf”,&time);

printf(“The simple Interest is : %lf”,(principal*rate*time)/100);

}

or

#include<stdio.h>
void main()
{
double principal,rate,time,simple_interest;
printf(“Enter value of Principal,Rate,and Time in month : \n”);
scanf(“%lf%lf%lf”,&principal,&rate,&time);

printf(“The simple is : %lf”,(principal*rate*time)/100);

}


by kumar vipin yadav at August 11, 2017 03:44 PM

August 10, 2017

Vivek Anand

Sending Emails using Django and Sendgrid

Recently, i setup a django app which uses  sendgrid to send emails. I will go through the steps in this short blog.

  1. Register at sendgrid
  2. Choose SMTP for sending emails
  3. Get an API key. The last step will redirect you to this. This key will also be your password. The username that they gave me was apikey so, i guess this remains same for everyone.
  4. Configure your django settings to this:
    EMAIL_HOST_USER = ‘<your username here>’
    EMAIL_HOST = ‘smtp.sendgrid.net’
    EMAIL_HOST_PASSWORD = ‘<your password here>’
    EMAIL_PORT = 587
    EMAIL_USE_TLS = True
    EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’  (this is the default value of EMAIL_BACKEND btw)
  5. Use django.core.mail.send_mail for sending emails now

by Vivek Anand at August 10, 2017 02:53 PM

Ashwani Kumar Gupta

Tracking file permission, file modes in git

Just yesterday, I came across a strange behaviour of git. When I entered command git status in one of my local repositories, it showed me that a file has been modified. But wait, I didn’t modify anything in the repository. How did this occur? I even cross checked this for confirmation. The git diff command output was something like this:

diff --git a/newfile.py b/newfile.py
old mode 100644
new mode 100755

What actually happened?

It turns out that the file permission for newfile.py has been changed. I remembered that I changed newfile.py to be executable. And yes git tracks that too. This is because git tracks files and directories as objects and not the content itself. So if the object gets changed, git knows that.

File permissions

If you use any GNU/Linux distribution, you will be familiar with different set of permissions for different users and groups. This makes GNU/Linux a much secure OS than Windows. You can look up permissions of files in your system by firing up your terminal and entering ls -l command in the required directory. You will see that there are detailed information for every file or directory you have, each in one line. The first set in the line is a string consisting of several characters like r, w, x, d, – etc. This string is displays the permissions for the particular file. It will be something like this: -rwxrw-r-- 2 owner:group

  • The first character - represents it is a regular file. If it is d then it is a directory.
  • Next there is three set of three set characters which represent permissions for the owner, group and all other users
  • Then there is a number which represents the number of hard links to the file.
  • The last set of information tells us to which user and group the file or directory belongs to.

To read more about file permissions refer here.

File modes in git

File modes are nothing but 32-bit modes which represent the file type and file permission. This is split into:

  • 4-bit object type or file type. (1000 in our case which represent a regular file)
  • 3-bit unused
  • 9-bit UNIX permission

These taken together creates valid modes in binary and octal. For example, if we have a regular file which:

  • has read and write permissions for both owner and group
  • read permission for all other users
  • is non executable

The permission for this file can be represented as -rw-rw-r-- which in binary is represented by 1000000110110100 and in octal represented by 100644.

So in our case, the old mode 100644 tells us that our file was previously a regular file with permissions represented by number 644 i.e. non-executable file. And the new mode 100755 tells us that the file is still a regular file but it’s permission has been changed to executable file. There are other modes which are explained here and here.

Note that git only records two filemodes:

  • 644 and
  • 755

Now we know what do those old and new filemodes represent. But what to do if you don’t want to track file permissions and only concerned about the content?

How to resolve this?

Every git repository has a .git directory which helps git track the contents in the repository. It contains several important information such as the branches, HEAD, index etc. The contents of .git look somewhat like this.

branches config description HEAD hooks index info objects refs

Among them there is config file which stores the configuration for that particular repository. We can edit this file to tell git whether to track file modes or not. For this, open the file and set filemode to true or false to track or untrack filemodes respectively.

[core]

filemode = false

This will save the configuration for the particular repository. If you want to disable filemodes globally for your system, you can set filemode to false in git config like this:

git config core.filemode false

Note that the default value is set to true

Why filemodes are important in git?

As far as I have understood, it is one important aspect of any version control system. File permissions add a layer of security for different users, it also states if a file is executable or not. So during development if anything breaks due to change of permissions, then we can know if we let git track it and it will be easier to debug.

I would like to thank the #dgplug community which helped me understand the issue and got to learn something new. Hope this helped you understand about filemodes in git.


by Ashwani Gupta at August 10, 2017 01:35 PM

Yurii Pylypchuk

What am I doing on DGPLUG Summer taining 2017.

              There  is second month finishing already since I start to participate in Summer training 2017 from Linux Users Group of Durgapur (India). We have sessions every over day in different topics  concerning the using Linux operating system  in developing of software (especially free software), about the communication skills, free software  movement, editing stuff, communication security issues, basics of Python language as one of the powerful tool in programming and many other.

         The range of  considered topics is wide and if you are new in programing — it demands  a lot of time to follow up and  not to loose a clue   in catching materials. But if you do constantly step by step tasks  for the class, you can feel that you are going ahead.

        How does  it happen that I from Ukraine participated in this course? OK. I have few words to tell about it.  My education and previous work experience is not related with computer science and engineering. I use computer for last 15 years mostly for the office administrative tasks,  book-keeping,  for communication (e-mail), as social-network user, internet user etc. And all the time I been using Windows OS.  HTML and HTTP sounds for me as the same thing one year ago. Shell script and command line  sounds for me as words from a very high level programmers slang and such definitions as  C++, Java, Python,  had sound  to me as something I would never understand. But accidentally in the end of  2015 I found out  CS-50 course in free source EDX (I am sure most of you have  heard about it). Impressive lectures of professor David Malan  inspired me to start learn more about computer sciences and computer technologies  in general. Gradually I started to learn more and more how stuff works, what is HTML and CSS, what is for a programming language exist, what is command line and shell script, how does servers works and so on. In March of this year I installed Ubuntu in my laptop and continued to learn the  programming issues from various online resources. In the beginning of Summer 2017 I was filling like I need something to push in my education to the new level and I was looking for paid courses that  there are plenty of  its  here in Lviv.  But again accidentally one day  in June this year I encountered this lecture of Kushal Das  (http://youtube.com/watch?v=j5YV5KzIbOc) . It was so persuasive for me that I decide to take part.

Therefore I am here now. And  by the  way I like  the expression that I hear recently : ‘Come for language —  stay for community’. 🙂  Have a nice day everyone.


by yuriipylypchuk at August 10, 2017 11:02 AM

August 08, 2017

Vipul Gupta

Low Battery Curse ft. Ubuntu [solved]

Notification – The system is running low on power  * well shit, not again *

I started using Ubuntu about 8-10 months back on my new system ( a Lenovo Ideapad 510 ). Now at that time, I was new to Linux. But then too the battery backup issue kept bugging me. Windows provided a solid backup of about 3 – 3.5 hours but in Ubuntu the system dies in about an hour. This was quite frustrating to me. So I dug deeper. The deeper I went and the more solutions I tried I came to only one conclusion. That the real problem was Ubuntu itself. My system heated to about 45-48 degree Celsius as if I was playing a 60 frames per second game on ultra settings. Cutting to the chase, here’s the summary on all that you could try till you get angry enough and Install Xubuntu or Lubuntu or something else entirely.

  1. Overheating (click)- This is the most prominent cause of battery depletion and reduction of overall battery life. Check out the link for ways to decrease and monitor the temperature of your processors and system using Lm-sensors.
  2. Personal views Powertop does nothing. No change in performance whatsoever. The command ‘top‘ gives a detailed explanation of the processes running in the computer and their CPU usage. TLP also shows minor improvement in battery life.
  3. Thermald gives a detailed review about the temperatures and also provides information in the form of graphs. Also ensure that the vents are clean and heat is distributed properly and is not being trapped.
  4. In some systems the fan speed can be altered using specific commands. Google that. Also for specific systems there are separate fixes and some driver upgrades by get the job done.
  5. Check auto-start applications and background processes that are running while using Ubuntu task manager.
  6. I found this manpage for Ubuntu to be quite helpful, brief and later on useless. But worth a shot.

Conclusion

Dump Ubuntu for better and more efficient distro’s like Xubuntu or Lubuntu which are faster and lighter and based on Ubuntu only. I been using Xubuntu for over 3 months now and the experience has been great. It is faster than Ubuntu and more customizable. Got its own battery manager and hordes of options for battery conservation and management. Battery backup now at par with windows to about 3 hours and temperatures of about 30 to 35 degree Celsius.

As we all once were new in Linux, we often found us at crossroads as to which distro to start with, which one to choose. I was nervous too. But whichever do you choose. There is no wrong choice here.

WhatsApp Image 2017-08-08 at 11.43.43 PM

The most comprehensive guide to choose …

Do mention, some methods or tricks that I missed would love to include them, so that more people can benefit from this article. Thanks for reading.


by Vipul Gupta at August 08, 2017 07:03 PM

August 07, 2017

Vivek Anand

Django with uwsgi and nginx on fedora

Today, i deployed a django project using uwsgi and nginx on a fedora 26 instance on AWS. I will talk about the same here.

I had used gunicorn in the past but never uwsgi. Getting started with gunicorn was a little bit easier for me than uwsgi primarily because i didn’t know i had to install uwsgi-plugin-python package to use uwsgi with django. This took me a while because, there were no errors. There was a “no app could be loaded” problem but, on internet most of this kind of error is for flask. Flask exposes it’s application object as app and uwsgi looks to load application which it fails to find.

The steps are:

  1. Install dependencies and the project itself:
    • sudo dnf install uwsgi uwsgi-plugin-python nginx
  1. Create a configuration file for uwsgi: uwsgi.ini
  2. Change nginx config to pass on to uwsgi for incoming requests on /ethcld/ (the mount point that i used)

 

Here is my uwsgi file:

[uwsgi]
chdir = /home/fedora/ethcld
plugin = python
# Django’s wsgi file
# module = ethereal.wsgi:application
mount = /ethcld=ethereal.wsgi:application
manage-script-name = True
master = True
# maximum number of worker processes
processes = 4
# Threads per process
threads = 2
socket = 127.0.0.1:8001
# clear environment on exit
vacuum = true

uwsgi asks for the directory of the project. In my case, it was /home/fedora/ethcld/. Mount is optional, if you want to run the application under some namespace, you will have to use mount. Also, if mount is getting used, you should not need module.

Manage Script name (manage-script-name)is important while mounting otherwise you will get a bunch of 404s. Usually, the request comes for something like: GET /username/  but, without manage-script-name option, nginx will not map /username/ to /ethcld/username.

For socket, i could have used unix socket instead of port one. But, somehow i settled for port.

On the nginx side, i did the following changes:

http {

       include /etc/nginx/mime.types;

       server {

                location ^~/static/ {
                       autoindex on;
                       alias /opt/ethcld/static/;
                }

                location ^~ /ethcld {
                        include uwsgi_params;
                        uwsgi_pass 127.0.0.1:8001;
                }

         }

}

Nginx supports uwsgi protocol by default, so options are already there, we just need to call them. For serving static files, for django, it is recommended that we do:

  • python manage.py collectstatic

This will copy (by default) all the static files in the django app to the location specified in STATIC_ROOT in settings. From there we can serve the static files. There are possible optimizations that can be done like gzip. But, i did this for testing only.

You need to include mime.types, otherwise browsers will keep rejecting files. By default, the mime type is ‘text/plain’.


by Vivek Anand at August 07, 2017 06:39 PM

August 06, 2017

Samridhi Agarwal

Musical Python

Today, sunday morning I wanted to listen to some soothing music, but the bad news was my internet connection was so poor that I could not even listen a song on YouTube without buffer. I really wished that I would have downloaded all the songs in my play-list before, from YouTube in mp3 format . So I thought of downloading the whole play-list today itself, but I did not want all the video files to get downloaded ( just wanted the mp3 version of all the videos) because that will burn my computer’s memory space. I also wanted to download the whole play-list in one go, so that i don’t have to select one song at a time.

So I thought of doing the same through python and wrote a very small code using the youtube-dl module of python. I was  happy after accomplishing a task through python that helps me. 🙂

You can go through my code here and use it for your play-list too just by changing the URL part (copying your own play-list url).


by samridhiagarwalblog at August 06, 2017 01:37 PM

Vivek Anand

Using IRC from Mobile

In this blog post, i will talk about how i use IRC from mobile.

I have been using weechat as my irc client for about a year now and i am happy with it. Generally, i used to open weechat in one tmux session and project (or projects) in other tmux sessions in my machine and stay on IRC while working. This serves well except for the fact that when you are not connected with internet, nobody on irc can leave a message for you.

I didn’t know about weechat’s relay feature until very recently when maxking was talking about this in #dgplug. In this feature, weechat listens to client connections to a specified port that allows two way communication between connected clients and weechat. The clients can be any device with internet access. The only thing left then for this setup to work was an android app. There were two options, glowing bear and weechat-android. The former didn’t support ssl so it was out of picture.

A few weeks ago, i got a free tier fedora 26 instance on AWS. I had to use this for testing other applications that i was working on. Also, AWS doesn’t allow(atleast for my instance) HTTPS connections for ports other than 443. I wanted to use ssl and that too for more than one application and thus decided using nginx as reverse proxy.

Here are the list of things that i did:

  1. Installed nginx, tmux and weechat on aws instance.
  2. Created self-signed certificate and pointed nginx to that.
  3. Configure weechat to relay on port 9001 and configure nginx for websocket connections on 443 and proxy it to 9001.
  4. Use weechat-android to connect to the relay using websocket(ssl) as connection type.

I used tmux so that i could ssh into the aws instance and join the tmux session. This is where the client-server architecture of tmux helped. I couldn’t use let’s encrypt or ACM for ssl certificate because i didn’t have domain name for that public IP. Creating self-signed certificate is surprisingly easy and this Digital Ocean blog helped.

I also use urlserver.py plugin for weechat which shortens url for you. It runs a small server on the system and provides redirects to the original link. With nginx, i am able to configure urlserver.py to run on one port and point nginx to that.

I am not fully happy with weechat-android though. Most of the time it works but, sometimes it disconnects right after connecting without saying anything. Other people have found this too here. Atleast, people can drop any message for me now.


by Vivek Anand at August 06, 2017 12:39 PM

August 05, 2017

Samridhi Agarwal

Python’s Dictionaries

Dictionaries allow us to bind almost limitless amount of real – world data more accurately. It allows you to connect pieces of related information. Like You want to store the information of all the students in a class, so you can make a dictionary representing one student and then store all his/her information as name, age, qualifications etc.

How to Create a Simple Dictionary – As dictionary is a collection of any type of data unlike other data types which have a common element for all its items. Dictionary has a key-value pair (collection). Each key has a associated value. Key makes it easy to retrieve the data.
A dictionary is made by wrapping all the items inside it by curly braces{}. Each item is separated by a comma inside the curly braces and each item represents a key-value pair. A key – value pair is represented as key : value, they are associated to each other so if you want to access value you should now the key. You can store as many items as you want in a dictionary.
Example – Take a student and enter his/her information in dictionary.

student_1 = {'name' : 'Samridhi' , 'nationality' : 'Indian' , 'Stream' : 'Electronics and Telecommunication'}

Here each item is separated by a comma and each key has a value. A key’s value can be anything a number, a list and even another dictionary. While values can repeat but keys are to be immutable and unique.There is also a built-in function dict() to create a dictionary.

Accessing a dictionary To access the value you need a key. In other data types we need some index number to access but in Dictionary we use keys. To get a value you have to mention the dictionary name and the key inside a square bracket or get() method can also be used.
Example – Accessing the name and nationality of student_1

print(student_1['name'])
print(student_1.get('nationality')

Output ->

Samridhi
Indian

The difference while using get() method is that it returns None instead of KeyError , if the key is not found.

Operations on Dictionaries –
1) Add items in Dictionary  – Dictionaries are mutable or dynamic so different changes can be made such as adding an item, changing the value or removing an item. To add a key-value pair, you have to give the name of the dictionary and a key in the square bracket is equal to a value.
Example – Adding the age as a parameter in the student_1 dictionary.

student_1['age'] = 19
print (student_1)

Output – >

{'name' : 'Samridhi' , 'nationality' : 'Indian' , 'Stream' : 'Electronics and Telecommunication' , 'age' : '19'}

If the key would have already present, value gets updated, else a new key: value pair is added to the dictionary. We can also start with an empty dictionary just defining a list with empty braces then start adding the key : value pairs (items).

2) Example of updating a key value in a dictionary –

student_1 = {'age': '19'}
print("The age is" + student_1['age'] + ".")
student_1['age'] = '20'
print("The age is now " + student_1['age'] + ".")

Output ->

The age is 19.
The age is now 20.

Providing the predefined key updates the value of the key.

3) Removing an item from the dictionary – When you think a certain item of information is not required you can simply delete the key:value pair by using the del statement. To delete a key you have to give the dictionary name and the key in the square bracket.
Example – Deleting the Nationality information of student_1

del student_1['nationality']
print(student_1)

Output ->

{'name' : 'Samridhi' , 'Stream' : 'Electronics and Telecommunication' , 'age' : '19'}

The item once deleted by using the del statement can not be retrieved, It is deleted permanently. To store the items but remove from the dictionary pop() method can be used by giving a key value. popitem() method can be used to remove the first key that is stored and clear() method to remove the whole dictionary. del statement can also be used to permanently delete a dictionary.

I will write more about dictionary about looping, storing similar items and how to work on dictionaries in my next blog! 🙂


by samridhiagarwalblog at August 05, 2017 05:20 PM

Vipul Gupta

Lights, Camera, My Love for watching movies.

I am a movie buff, a real Nazi when it comes to arguing with movies. I cherish the experience of watching a movie and giving it all my attention that it deserves. I often go alone too watch a film, the point of watching horror movie goes down the drain when your friends can’t stop cracking jokes about the plot of the story or how the ghost looks.

The crowd you go with also matters. The person next to you should be of your similar interest and most times complete strangers will do. Its ridiculous to see what people do at theaters. I was once watching a slog of a movie, and i noticed a girl putting up a snapchat filter on the actress starring in the movie. Cringe detected. I often Google up songs that i hear in films just because the part they play at, makes it feels so much better. I dream to work in a movie production house once.

One should realize that watching a movie is just not going to the theaters and spending a bunch of cash for entertainment. But to get teleported to a new world, spend 3 hours of your life seeing a different lifestyle as yours and experiencing the story and emotions that the director wants to show you. Spending time with your family or loved ones. Get a break from the busy lifestyle.

Next time you meet someone with someone like this anywhere, who talks about movies like he/she is in love with them. Give them respect, give them your support. They will make your life better. Also to the people who makes them. Bollywood and Hollywood alike. Thousands of work hours goes into making a movie for the audience and countless hopes and promises are attached to it. Taking a minute to appreciate that, will do you good.

Not just watch movies, live them, feel them and make your life better.

Next up: my top 10 mind-melting movie list.


by Vipul Gupta at August 05, 2017 07:00 AM

Samridhi Agarwal

How To work with Real Data.

As I am doing a course on data science with python first thing i learned is how to use real data. Before we can do any data science work on those files or set of data, we have to know how to access the data in all its myriad forms.

Data Scientists call the columns in a database as variables/features and rows are the cases. Here Each row represents a collection of variables that you can analyze.

1) Uploading Small amount of Data – For data first we can use the sklearn.datasets which has small toy datasets to learn. To extract the file we have to use the open method which obtains a file object. The open function accepts the filename as an access mode. At last to read the file, read method is used.
Example – filename is “colors.txt” and mode is read binary – rb .

with open ("colors.txt" , 'rb') as access_file:
    print(access_file.read())

Read Method – If we specify the size argument as part of read such as read(15), python would read only the number of characters that you specify or stop when it reaches the end of file (eof).

2) Streaming large amount of data into memory stream data (to work with little data)
Example –

with open("colors.txt", 'rb')as access_file:
    for observation in access_file:
        print('Reading data : ' + observation)

As the code performs, data reads in the for loop, the file pointer moves to the next record. Each record appears one at a time in observation.


by samridhiagarwalblog at August 05, 2017 05:40 AM

August 04, 2017

Samridhi Agarwal

Unsuccessful attempt.

Yesterday i was wondering about how to decide which project to work on, so i asked the same on dgplug and kushal asked me whether i use wordpress to write blogs and i said yes. So he gave me a project to work on that is to make a html file of your blog in your local machine and then post it on wordpress using the xmlrpc module.

Firstly I searched for this module, and learned few of its methods. So i pounced on writing a snippet of code to give it a try but ghosh i met a error that module doesn’t exist and i gave all my 3 hours trying to download the xmlrpc module but all in vain :-(. I can’t even download a module, still i am trying different things searching and asking. Hope i figure out the error soon, will be very happy after completing this project. 🙂

On the mode to try few more things! Hope soon i will be posting in a different way.

 


by samridhiagarwalblog at August 04, 2017 07:08 PM

August 03, 2017

Samridhi Agarwal

List slices tricks

So as i had already written about slices in one of my blog that they are used to deal with a part of a list let us see what are more different magics that a slice can do to a list!

1) Slice List with negative index – Using a negative number as an index in python say n returns the nth element from the right-hand side of the list.
Example – You have a list of 11 numbers and you want to print the last five numbers.

 >>> a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> a[-5:]
[6, 7, 8, 9, 10]

a[index:] is the same as a[index : len(a)] and will return a list of all the elements from the list starting at index and going till the end.

2) Slice a list with steps – This is a simple one, as we write the start and the end as index here we also mention the no. by which we want to skip. syntax – list[start:end:step]
Examples – take a list of 15 numbers.

>>> a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
>>> a[::2]
[0, 2, 4, 6, 8, 10, 12, 14]
>>> a[2:10:2]
[2, 4, 6, 8]

 

3) Slice a list with negative steps – To get a list in a backward order steps this can be used. It has same syntax as the previous one just we give step as a negative value.
Examples – take a list of 15 numbers and print the same list in a reverse order.

a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
>>> a[::-1]
[14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> a[::-2]
[14, 12, 10, 8, 6, 4, 2, 0]

To print a reverse list we have to give step as -1.


by samridhiagarwalblog at August 03, 2017 06:51 PM

Kshitij Kumar

Writing a Simple terminal based Dice Game in Python

Last week, We were given a task and that was to show a project (Game, app or script), where we had to use tools that we have learned so far.

I was busy this weekend shifting my hostel and I forgot to complete the task. So I decided to write a simple Dice Game.

Coming to the code of the game. This is a terminal based game without using any graphics. You will roll a die and If Six comes, You will win the Game :). I used random module to generate random numbers. When user will roll the die, randit function generates a random number between 1,6. You will have a better luck if you get a Six.

Since writing code was not only part of the task, but to use tools taught during the session. So I used following tools for my development

  • Vim – Code Editor
  • Git
  • Github
  • Markdown
  • Python

I created Python Small Projects repo on GitHub and pushed code there.

I will write more scripts or silly games to that repo as I am practicing Python these days. I will also add python scripts, that I wrote a few days back and already using.

Please Look at Code and Repo and If find error and improvement, Create and Send a pull request.

Github Repo Link: https://github.com/iKshitiz/Python_Small_Projects


by Kshitij at August 03, 2017 06:47 PM

Samridhi Agarwal

Small python project

Yesterday in the dgplug session we were asked to show any project that we have done in the last two days, any simple project will do. But as my exams are going on and I was too stuck with learning GitHub I haven’t done anything worth showing i guess. Because the only code i had written in the last two days was of extracting files of certain extension from a predefined folder and storing that in other folder, that too i did in python2.

Our mentors gave us time to do some small project so i tried to do the same with python3. I was stuck with a very little problem that i was giving the location of the folder in a tuple. I asked the doubt in the dgplug session and one of them explained me that        a = (b) is not equal to a = “b”. So that worked for me removing the path from a tuple.

You can find my code here .


by samridhiagarwalblog at August 03, 2017 11:49 AM

Aniket uttam

Markdown for HTML

Markdown is text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

Thus, “Markdown” is two things: (1) a plain text formatting syntax; and (2) a software tool, written in Perl, that converts the plain text formatting to HTML. See the Syntax page for details pertaining to Markdown’s formatting syntax. You can try it out, right now, using the online Dingus.

The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.

Markdown is very use-full for writing fast works on HTML that was written in simple markdown words.  It has low syntax very fast excess of link.

Read this link was very good http://www.aaronsw.com/weblog/001189

 


by aniketuttam at August 03, 2017 08:48 AM

August 02, 2017

Mayank gupta

Why isn’t Linux liked by everyone?

Talking about me, I love Linux distro Fedora alot. Based on my previous blog posted long ago, I was told by Jasonbraganza to write another blog explaining why isn’t Linux everyone’s cup of tea/coffee.

It’s true that Linux is fast and good and also cool, to know more read my previous blog at https://wordpress.com/post/mayu405.wordpress.com/94

Coming to the point of this blog, I’m mentioning certain reasons as to why Linux is not liked by everyone :/

  1. Linux is not popular because everyone is different to you and I. Most people are just users. That is the market that Apple aim at. Everything just works. Don’t you worry your pretty little head about how it just does.

The next market is served by Windows. Here is a system that is geared up to run on the latest hardware and companies associated with us can make money by selling programs to consumers. We will make things run to a point, the rest is up to game developers, graphics programmers and office systems companies to supply you with what you need. A little knowledge/awareness required. Windows managed to get supremacy in the business world and people like to have what they have at work, at home.

Linux is a toolbox. It reigns supreme in the server market. It has learned to interface with the windows front-end so well, many windows users do not know they are interacting with Linux. Linux’s problem is that in the desktop market it is shooting itself in the foot on a regular basis. I read an article recently which explains it. Effectively all Kernel development in Linux is carefully monitored to keep access points the same. (Probably poor language choice). However the idea is that a new kernel does not require all the associated software to be rewritten. Desktops available on Linux are not so tidy. Therefore every upgrade generally means all the software needs to be brought up to scratch. This is why some programs stop working after an update. It means the person maintaining the packages has to ensure that they are still compatible.

Most people cannot cope with this. Plus the issue with drivers, networking etc. There are us who love this stuff and don’t mind fiddling and there are others to whom it is all Greek translated to Latin and don’t want to know.

2. Bit complicated: Linux is more complex than Windows or OS X. Sure, once you are familiar with Linux and its idiosyncrasies, it’s not hard to use. But the initial learning curve is steep.

As with several of the upcoming entries, this problem isn’t as severe as it was a few years ago. There are now a handful of distributions that work straight out of the box for most people, and setting them up is only slightly more difficult than a recent copy of Windows.

But even with those improvements, new users must, at least, sift through all the available distributions to find the easy ones, learn how to download the right install image, learn to burn the image to a disc or create a bootable USB thumb drive, get to the install portion, and decipher what each prompt is asking.

This is not an insignificant hurdle for many people. Good Linux users are good because they experiment and seek more information. If you are unable, or unwilling, to learn and work through Linux’s complexities, you may want to avoid Linux.

3.Gaming:  A couple of years ago, gaming on Linux was a joke.  There were a few open source games that, while fun, were nothing compared to the Call of Dutys, Battlefields, Skyrims, and Grand Theft Autos of the day.  Yes, there were a handful of people that they got their game working on Wine by spending 3 days configuring it and accepting defeat on certain features.  But serious gamers never bothered to go through all that work.

Today, things are definitely better.  Ubuntu, Steam, and others are working hard on making gaming not only possible, but decent on Linux.  Unfortunately though, it still has a long way to go before contending with Windows.  A serious gamer could not live on Linux.

4. Competition of softwares: There are a number of software on the open-source for the same task to be performed. Seriously people find it more complex than anything else, choosing over a number of options as the solution.

5. Programs: Okay, they don’t exactly suck, particularly since most of them are free.  But in many areas the competition is so much better.

Let me give you an example.  I am an engineering student, and I absolutely need Windows.  Linux programs for computer aided engineering are garbage compared to the competition like AutoCAD, SolidWorks, and Catia.  And there is no sign this will change any time soon.

And it’s not just engineering.  How about video editing?  You can not do serious, professional video editing on a Linux rig.  You need Windows or OS X.

Office work?  Everyone keeps saying how great LibreOffice is, but for many tasks, Microsoft Office is the only way to go.  Complex Excel operations do not transfer over to Calc.  Heavily formatted Word documents break completely.  And outside LibreOffice, Evolution and Zimbra are not suitable replacements for Microsoft Outlook in even the smallest enterprise setting.

Linux can not replace Windows or OS X for many people because the software is so lacking.  Once you start getting out of servers, supercomputers, or strictly generic web surfing desktops, the software choices are poor at best.

6. More softwares available: Here’s another one that’s a pretty clear edge for Windows. It isn’t about being able to play the newest games, even if that is one of the most often raised issues against using Linux. Simply because Windows is the dominant operating system, there is much more (and usually higher quality) software available for it than for Linux. Much of it comes from evil Microsoft itself.

A good example goes straight to one of open source’s greatest recent successes: OpenOffice. OpenOffice is great software… considering it’s free. I use it when I’m in a pinch on somebody else’s computer. It’s almost certainly adequate for a light user or a student typing up a couple of essays. As a writer, however, I can’t imagine being stuck without Microsoft Office for long. When it comes to features like SmartArt, quick table generation, editing and review functions, and inserting basically any kind of object into a document, there is no comparison. When you go beyond the word processor to the presentation software or spreadsheets, the gap grows even wider.

Now of course much of our favorite Windows software can be run using an emulator such as Wine, or on a virtual machine running Windows — but if we find ourselves doing that all the time, why use Linux in the first place?

 

Ending the blog here!

I can hear the Linux fanboy fingers pounding on the keyboard right now.  They plan on telling me about an obscure software package that I didn’t mention.  They intend on regaling me with all the flaws in Windows or OS X.  Or they will get really defensive… almost as if I mentioned politics or religion.

So let me say this before your fingers fly.  I LOVE LINUX!  I’m not trying to create an impenetrable picket line to stop people from using Linux.  If you want to feel all warm and fuzzy by hearing how great Linux is, read my last post.  Windows and OS X have plenty of faults as well, and if this were a Windows or OS X website, I would write about those.

I am aware that many of these “problems” also have positive effects that have helped shape Linux into the awesomeness it is today.  I am also aware that Linux has made phenomenal strides in recent years.  Hardware support, usability, compatibility, and much more are the best they’ve ever been, and are only getting better.

This post’s intention is to, as honestly and unbiased as I am capable, give constructive criticism on Linux’s weaknesses to inform the curious, and, hopefully, inspire more positive changes.

Now everyone can yell at me at comments. I have no issues listening to my mistakes so please go and comment me corrections or give me important information.

 


by mostrandomrichard at August 02, 2017 08:44 PM

Kshithij Iyer

Himanshu Awasthi

Python Tricks

Python is one of the language requires less code to complete basic tasks, making it an economical language to learn. Python code is often 3-5 times shorter than Java, and 5-10 times shorter than C++.

And here’s a good news for programmers :

python-close-t-shirt-close-up_grande

here’s some tricks and example :

# Swap two numbers with one line of code

>>> num1=7
>>> num2=5
>>> num2, num1 =num1, num2
>>> num1
5
>>> num2
7
>>>

# Store all values of the list in new variables

>>> list = ["Himanshu","joy", "joyhimanshu"]
>>> name1, name2, name3 = list
>>> name1
'Himanshu'
>>> name2
'joy'
>>> name3
'joyhimanshu'
>>>

# Create a single string from all the elements in list below
list = [“dg”, “plug”, “summer”, “training” , “2017”]

>>> list = ["dg", "plug", "summer", "training", "2017"]
>>> print " ".join(list)
dg plug summer training 2017
>>>

# even / odd program

>>> check=["even","odd"]
>>> num = int(input())
5
>>> print check[num%2]
odd
>>>

# list of squares

>>> squares = []
>>> for x in range(10):
... squares.append(x**2)
...
>>> squares
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
>>>

# nested list in one list

>>> list = [[1, 2], [3, 4], [5, 6]]
>>> [i for j in a for i in j]
[1, 2, 3, 4, 5, 6]
>>>

there are so many fun stuffs which easily done by python.
so see you guys next time with some more interesting stuff.
Happy Coding


by kanpurpython at August 02, 2017 06:20 PM

Samridhi Agarwal

Web development

So today i got shortlisted for one of the internship for web development and i was asked to research on two questions those were –

1. Explain five points which a developer should keep in mind while designing a responsive website which would serve customers across multiple devices with different screen resolution.

SolutionResponsive web designing is very important as per the need of the users. As the number of smartphone users increasing day by day it can’t be predicted easily about the medium of website viewers. These can be done by keeping in mind the CSS, flexible images, Google analytics, fluid grids and employing different versions.

    1. Employing at least three different versions – keeping different browser widths for desktop, mobile and tablet can help us to scale the content freely. Scaling down the contents to fit in a smaller page will make it unreadable so navigation and gestures can be used in mobile version to give user a better UI solution.
    2. Flexible images – This is one of the important key feature in every website design. We need to select for images on the basis of how they will scale properly.
    3. Google Analytics – To test our website in different browsers and applications Google’s resizer helps us to quickly preview our web design on multiple devices and browsers.
    4. Fluid grids – This helps to design layout in percentage values rather than setting in pixels. The elements in the layout re-size according to one another.
    5. CSS – This plays a major role in designing all the above mentioned fluid grids, flexible images and media queries all can be done under CSS. Media queries can be implemented so that our web design automatically changes as per the size of the screen.

2. Explain different measures to reduce the loading time of a website?

Solution – Loading time of a website is a important key feature in reducing its bounce rates and making an effective impact on its users. There are few things which can be used to reduce loading time-

  • Optimize images – An image should always be scaled properly and then uploaded because scaling down with CSS forces our users to upload the full resolution image first and then scale it.
  • Optimizing the CSS – The CSS loads before user can see our site. So minimizing CSS can remove extra spaces from our code and make files to the smallest size which enables user to see the site in less time.
  • Scripts page can load after contents – java script files can load after rest of the page so they should be kept at the end of the content, before the body tag. Defer and async methods can also be used by adding them in code.
  • Optimize Caches – Local memory should be used to cache resources to avoid unnecessary server requests. AJAX can be applied which helps to fetch the data from web server without page refreshing the updated content is loaded automatically while user browses through the page.
  • Other methods like avoiding redirects, minimizing style sheets, avoid using java script heavy plugins can also be used to reduce loading time.

This was my research on these questions. would like to know more tips for more knowledge.

And i hope i get selected for this internship by this research. (fingers crossed) 🙂


by samridhiagarwalblog at August 02, 2017 01:29 PM

Learned GitHub etiquette

In the last dgplug session everyone was discussing various things on IRC about their projects and games made by them so i gave link of one of my repos that was a game a ship war game, so a member from the dgplug session told me that he found the same game on a crash course, and that was true as i am learning things from all the three editions of crash course with python books so i implemented the same game for practice and did few changes. I also thought those changes are worth because the actual game on the book was not having any win situation or like showing the user that they win so i added that. As GitHub is quite new to me and recently learnt how to push our own code into a new repository so i started pushing all different things as new repo! But that’s where i did a mistake like i never thought that way.

Also i was aware of the concept of sending pr if i think my changes worth but at the same time i feel of making a fool of myself by giving a lame pr to a big project. 😦  But that day on IRC after the session, #bhavin192(one of the member in the session) gave me a example that if i write a code to do a stuff investing my all the time and someone else takes it and puts it on their GitHub account so that’s where the owner will feel bad. And yeah he also told me to always mention the name or give credits whosoever first thought of the project or have made it.

I think of the same in a big manner now like credits are most important that’s why the concept of fork is. I think there are many things to learn and this was a big thing.


by samridhiagarwalblog at August 02, 2017 12:31 PM

August 01, 2017

Jason Braganza

On My First Project

noun_1067223_tiny


Being laid up sick in bed is never fun.
Yet, serendipitously, it was the being laid up, that gave me time to focus and complete my first Python program.

We were to make a project, that combined what we’d learnt so far at DGPLUG.

So to me that was:

  • Markdown (or RST; I chose Markdown)
  • Git (my bugbear. I still can’t quite wrap my head around it)
  • and Python.

So I created a spanking new repo for my crazy, one off projects at Github.
Created a license, because, well because Anwesha says you ought to, and even shows you how to. (and it’s generally a good thing any way :)

That, out of the way, I used my ninja Markdown skills (honed by writing here :P) to whip up a little README

And then started the slog.

While I have been learning the basics of Python, like a child learning shapes; moulding what I have learnt into some semblance of a logical thing is darned hard.

I’d read somewhere about the Golden Mean and it’s relation to the Fibonacci sequence, so I thought I’d write a mini text adventurish romp as my first project.

It took me the whole day!
I typed and it did not run.
I fixed typos.
I fixed colons.
I fixed quotes.
I tore my hair out.
And I typed some more.
And I fixed some more.
Oh, and all the while, I was trying to push it up to Github as well. (with varying degrees of success)

But in a lot of ways, it reminded me of the time, I spent learning photography and basic editing.
I was moving sliders and figuring curves and creating needlessly large TIFFs all over Lightroom

And gm.py reminds me of the first time a photo came out right.
I don’t quite know how I did it then and I don’t quite know how I did it now.
The recipe’s ugly.
But the photo looked good.
And the program does run.

Which brings me to how I look at a photo today.
I can instinctively tell, what needs cropping, if I need to make white balance adjustments, whether the exposure needs tweaking, if I can pull detail out of the shadows.
And my newbie-ness wasn’t that long ago.

I wish myself the same level of competence when it comes to programming.
Onward!

You can find the repo and my first program here.


by Mario Jason Braganza at August 01, 2017 02:32 PM

July 31, 2017

Vipin kumar

A program to find multiply of three number

#include<stdio.h>

main()

{

int a,b,c,mun;

printf(“enter first number”);

scanf(“%d”,&a);

printf(“enter second number”);

scanf(“%d”,&b);

printf(“enter third number”);

scanf(“%d”,&c);

mun=a*b*c;

printf(“the multiply is %d”,mun);

}

or

#include<stdio.h>

main()
{
int a,b,a,mun;
printf(“enter all three  numbers number \n “);
scanf(“%d%d%d”,&a,&b,&c);

mun=a*b*c;
printf(“the multiply is %d”,mun);
}

or

#include<stdio.h>

main()

{

int a,b;

printf(“enter all three number \n “);

scanf(“%d%d%d”,&a,&b,&c);

printf(“the multiply is %d”,a*b*c);

}


by kumar vipin yadav at July 31, 2017 06:50 PM

Samridhi Agarwal

Looping

Today at dgplug session we learned about looping in python. We learned the while loop it’s syntax and how to deal with infinite loop.

A question was given and we have to do that once as it is and other time we have to use the infinite loop and to come out of the loop we used break statement after providing a if condition in the while loop.

 


by samridhiagarwalblog at July 31, 2017 04:55 PM

Kshithij Iyer

July 30, 2017

Robin Schubert

Community and Huntington’s Disease

So far, I’ve written about my experience with free and open software, coding and the like. However, in real life I am a physicist and researcher.

While I really enjoy being/becoming part of an incredible community of coders, hackers and activists, I realized that I already am part of a great community that I want to shed some light on here.

On Huntington’s Disease

I work in the George Huntington Institute (GHI) in Muenster, Germany. It is the first institute dedicated for research in Huntington’s Disease and clinical care for people suffering from Huntington’s Disease.

Now, what is Huntington’s Disease (or HD)? Scientists might say, HD is an autosomal dominant neurodegenerative disease that is caused by an overlengthy CAG repeat on the short arm of chromosome 4.

Here is what that means: The disease is inherited. A person with the gene mutation has a 50% chance to pass the disease to the children (if both parents are affected, the chance is 75%, if both chromosome arms are affected (homozygote) the chance is 100%). People with that specific gene mutation will get the disease. Depending on the CAG (the armino acids cytosine adenine and guanine) repeat length, they may start showing symptoms between an age of 30 and 50. Very long repeats even cause a juvenile disease type that shows symptoms in early ages, with a vast disease progress and early death.

While the complete pathways of the disease are not fully understood yet, it is assumed, that the gene mutation causes a production of a misfolded proteine (Huntingtin) with a toxic effect, that causes cell death especially on neurons, causing brain cell athrophy. Developing symptoms by the age of around 40 is the most common case. With constantly worsening symptoms, the disease ends in death after approximately 10 years after clinical onset.

Affected people describe the symptoms as a mixture of ALS, Parkinson’s Disease and Alzheimer’s Disease. The symptoms range from movement disorders (involuntary movements, chorea), cognitive decline and psychiatric disorders (apathy, depression).

To date, there is no cure, neither a therapy to slow down progress of the disease.

The community

Being a family disease with no cure, community is by far the most important thing for people affected from HD. Being affected does not necessarily mean being a gene carrier. Every part of of a family is affected, like every spouse or partner is, or close friends.
While there are a lot of clinical trials going on right now, time will show if the promising approaches will show an effect. Hope and community is all there is, so far.

As my life has changed significantly, even I as a researcher would call me an affected, and I feel like being part of the community. And it’s a strong one. Sophisticated networks have been built up in Europe and the USA, while other countries are following the example. Projects like We have a Face and HDdennomore (pronounced hidden no more) raise the awareness for the disease, to end the hush-up and shame that is common in affected families.

Projects like HD Buzz, a platform that “translates” scientific articles into human readible languate, help to connect researchers and families, I don’t know any field of research where the scientists are so much connected and dedicated to those people they try to help. This is the most awesome field I’ve worked in so far, and I won’t stop until there is a cure.

Another important factor that helped building this strong community is the CHDI foundation (Cure Huntington’s Disease Initiative), the largest funder of HD research. While other research fields are dominated by keeping results secret and save, showing elbows against other researchers and fighting for survival, CHDI somehow managed to establish a very prolific exchange between HD researchers worldwide.

Why do I write this article?

For myself, I am very grateful for being part in two such great communities. My science heart and my coder heart have home now and the perfect basis to grow smarter and to contribute back to the community.

However, while I feel happy of being able to express myself in a blog post, it is important that you know. If you read about Huntington’s Disease the first time now, or if you learned aspects you did not know before, this is great. It’s important that you know. Not to be known, not to be recognized can be fatal. Read more if you’re interested, spread the knowledge. Awareness may not only help affected, but will also contribute in raising funds to further improve and speed up the research. For many HD patients every day counts. I am certain that a Cure can be found, and it takes a strong community.


by schubisu at July 30, 2017 08:46 PM

Kshithij Iyer

"I have a strange feeling that something is going to happen, cause all the good that I did in all..."

“I have a strange feeling that something is going to happen, cause all the good that I did in all these years is coming back to me and giving me strength for what is about to come.”

- Kshithij Iyer

July 30, 2017 04:50 PM

"Every time a romantic song is played it just reminds me of her. As if the song sends a signal to the..."

“Every time a romantic song is played it just reminds me of her. As if the song sends a signal to the display in my eyes to play her face in a loop.”

- Kshithij Iyer

July 30, 2017 04:31 PM

Samridhi Agarwal

Stone Paper Scissor with python.

Remember the all time hit game of school kids stone paper scissor, Ever wanted to return to your childhood and play the game? I wanted to play the game 2 weeks ago when i saw shichan (my favorite cartoon)  playing it to win and become leader of the group. So i asked my friend to play with me but she denied saying she is busy! 😦

So i thought of playing it with my best companion laptop and i searched for how to make a game which gives you random input so, that there will be a fair-play between me and laptop and bravo i read about the Random module in python.

The point that attracted me was this module let’s us generate random numbers. Function for that is Randint – If we wanted a random integer, we can use the randint function. Randint accepts two parameters: a lowest and a highest number.

So finally i made the game using random module  and played it. You can too see the use of random module in my game here. Hope you like the game ! 🙂


by samridhiagarwalblog at July 30, 2017 11:25 AM

Tuple in python

1)Defining a tuple – A tuple is same as list just instead of square bracket we use parenthesis. Tuples are for immutable lists that means the data stored in the tuple can not be changed those are fix lists. Once you define a tuple, you can access individual elements by using each item’s index, just as you would for a list.

ExampleYou have to make a rectangle for your game whose width and height should not change throughout the game.

shapes = (200, 50)
print(shapes[0])
print(shapes[1])

Output ->

200
50

*we can ensure that its size doesn’t change by putting the dimensions into a tuple. While assigning the values to a tuple it’s called packing and when extracting values from a tuple it’s called unpacking.

If you will try to alter the value in a tuple say shapes[0]  = 250, Then python will return a type error. Basically, because we’re trying to alter a tuple,
which can’t be done to that type of object, Python tells us we can’t assign a
new value to an item in a tuple .

2) Writing over a Tuple – Although you can’t modify a tuple, you can assign a new value to a variable that holds a tuple. So if we wanted to change our dimensions, we could redefine the entire tuple:

shapes = (200, 50)
print("real shape:")
for shape in shapes:
print(shape)
shapes = (400, 100)
print("\nModified shape:")
for shape in shapess:
print(shape)

Output ->

real shape:
200
50

Modified shape:
400
100

3) Add, multiply a tuple – A tuple is not a number. But it can be added to or multiplied. By adding two tuples, they are concatenated. One is put after the other. By multiplying a tuple with a number, we add the tuple to itself a certain number of times.
Example:-

amount = (10, 20, 30)

# Add two tuples.
total = amount + amount
print(total)

# Multiply tuple.
mul = amount* 3
print(mul)

Output ->

(10, 20, 30, 10, 20, 30)
(10, 20, 30, 10, 20, 30, 10, 20, 30)

 

When compared with lists, tuples are simple data structures. Use them when you want to store a set of values that should not be changed through-out the life of a program.

 


by samridhiagarwalblog at July 30, 2017 11:05 AM

Kshithij Iyer

But now how to find out what I love?



But now how to find out what I love?

July 30, 2017 11:04 AM

July 29, 2017

Samridhi Agarwal

Parts of a List

1. Slicing a List – This is required when you have to work with big data and want to access only a small part of it, To make a slice, you specify the index of the first and last elements you want to work with. As with the range() function, Python stops one item before the second index you specify.
Example – I have a big list of users of my website but i want to give a gift voucher to the first 3 registrations then –

users = ['charles', 'martina', 'vikky', 'kattie', 'sam']
print(users[0:3])

Output ->

['charles', 'martina', 'vikky']

If you omit the first index in a slice, Python automatically starts your slice at the beginning of the list:

users = ['charles', 'martina', 'vikky', 'kattie', 'sam']
print(users[:4])

Output ->

['charles', 'martina', 'vikky', 'kattie']

*A similar syntax works if you want a slice that includes the end of a list.

2. Looping Through a Slice – If you want to perform some particular operation on a particular subset of list then you can use for loop in slice.
Example printing the name of lucky winners of voucher.

users = ['charles', 'martina', 'vikky', 'kattie', 'sam']
print("Here are the first three winners of vouchers:")
for user in users[:3]:
    print(user.title())

Output ->

Here are the first three winners of vouchers:
Charles
Martina
Vikky

*When you’re working with data, you can use slices to process your data in chunks of a specific size.

3.Copying a List – There will be times when you want the exact same list as the first one created.
Let’s take a situation and understand where you can use it – Imagine you have created a list of your favorite ice-creams and you want to make a separate list for your friend too, but viola you have same taste buds and your friend likes everything in your list so far.
This can be achieved by copying a list,you can make a slice that includes the entire original list by omitting the first index and the second index ( [:] ). This tells Python to make a slice that starts at the first item and ends with the last item, producing a copy of the entire list.

my_icecreams = ['mango', 'chocochips', 'strawberry', 'vanila']
friend_icecreams = my_icecreams[:]
print("My favorite ice-creams are:")
print(my_icecreams)
print("\nMy friend's favorite ice-creams are:")
print(friend_icecreams)

Output ->

My favorite ice-creams are:
['mango', 'chocochips', 'strawberry', 'vanila']

My friend's favorite ice-creams are:
['mango', 'chocochips', 'strawberry', 'vanila']

If you had simply set friend_icecreams equal to my_icecreams, you will not get separate lists and you will not be able to append them separately or perform simple operations on them separately because the choice of your friend may vary for the rest of the flavors.
Now let’s add different flavors to each list to prove them as different lists:

my_icecreams.append('butterscotch')
friend_icecreams.append('chocolate')
print("My favorite ice-creams are:")
print(my_icecreams)
print("\nMy friend's favorite ice-creams are:")
print(friend_icecreams)

Output ->

My favorite ice-creams are:
['mango', 'chocochips', 'strawberry', 'vanila', 'butterscotch']

My friend's favorite ice-creams are:
['mango', 'chocochips', 'strawberry', 'vanila', 'chocolate']

*So if you want to make a copy of your list and perform actions on it without changing the real list you should use slice while making a copy of a list.

Lists work well for storing sets of items that can change throughout the life of a program. The ability to modify lists is particularly important when you’re working with a list of users on a website.However, sometimes you’ll want to create a list of items that cannot change. Tuples allow you to do just that. Python refers to values that cannot change as immutable, and an immutable list is called a Tuple.

My next blog will be on Tuples till then Happy Slicing List! 🙂


by samridhiagarwalblog at July 29, 2017 07:44 PM

Kshitij Kumar

Switched to Fedora as my Main OS & It’s going Great!

After having used Windows as the Main operating system for about the past two years of Engineering, I’m finally switched to Fedora as my main OS. So far the Fedora experience has been going excellent.

What is Fedora?

Fedora is a Unix-like operating system based on the Linux kernel and GNU programs (a Linux distribution), developed by the community-supported Fedora Project and sponsored by the Red Hat company.

Basically, Fedora is a popular open source Linux-based operating system.

How I came to know about Fedora?

I saw fedora OS for the first time in my college lab during ‘Basic concepts of operating systems like UNIX, MS DOS class’. I was not familiar with Linux at that time. Later, when I joined dgplug, They introduced us to Linux and suggested to use Fedora for all work during the session.

Switching to Fedora finally

After using fedora for more than a year, I was impressed by its simplicity, flexibility and easy to use considering myself as a newbie to Linux. It offers pure GNOME with clean Desktop.

I think Fedora is best OS if you want to move to Linux from Windows. It is easy to use and Desktop Environment provides smooth and is easy for users, especially for those who are moving from windows OS. Because It’s not easy to switch directly to the terminal based environment.

I still use Windows for gaming and some other’s work. I am trying to find alternatives to those app or software in Fedora. My machine is running on dual boot currently, Fedora 26 and Windows 10.

I’ve run Fedora for last one years with a consistently reliable experience, and I look forward to what the next one brings. My most used Linux applications are the GNOME Terminal, Mozilla Firefox, Google Chrome, Mozilla Thunderbird, Gedit, and ViM.

I will write more about Fedora in my next posts. 🙂

Looking forward to exploring more “How does a computer works”

 


by Kshitij at July 29, 2017 07:30 PM

Balaji

Wikipedia Hackathon

The Indian Linux Users Group, Chennai conducted the mini Hackathon on Wikipedia on last Sunday (July 23, 2017 ). As all know Wikimedia is an open source organization, which helps all of the people to enrich their knowledge.

The venue is at a cool start up in Chennai. You can see in the photos here

fringle

drawing

Yeah the drawing is so cool (Kudos to the Designer). Coming back the Hack ideas was  collected by the Shrini anna. So as per the requirements, we need to hack or develop it.Each of them assigned to the seperate tasks. Among all I was the only one student all others are working as a Software Developers.

I  hacked the UI of Tamil wikisource. Since the writers want to scroll down and select the wiki editing tools every time, thats made them a little frustrate. So I completly shifted the wiki editing tools the left side bar. And I made them appear in that position only when the writers gone to the editing section.

balaji

I done that and reported to the shrini anna. Then he told that, I can improve it by adding the toggling feature in it. So the writer or an user can hide it or show it whenever they need. So I started working on that feature.

In that mean time the we all had a great session on bots using Google Script Engine by Neechalkaran. He explained and demonstrated the bots he created and explained about working process of the Media Wiki API. You can see the click on while explanation here

bot_explain

After that I am back to improve that feature. I was successfully able to complete it and showed it to shrini anna. He was happy with my work. You can see his blog post here.

After that I networked with the other developers who came there and learnt about what they did and understand their work. All of them are very friendly to explain the process and then we talked about the random tech related stuffs and Shrini anna clearly explained the process in Git.This

balaji_1

Now I am exploring on adding Tamil typewriting keyboard to Jquery.ime of “Universal Language Selector” extension of mediaiwiki. Soon I will finish this work too.

From this I learned so many things. And lot more to learn from this Awesome community and contribute to Media Wiki.I would really like to thank the Shrini anna for his motivational words  and the encouragement.group

 


by balajiwebblog at July 29, 2017 06:01 PM

Kshithij Iyer

"Okay! I have some hope now as tests and classes are being canceled. Am I destined to join that very..."

“Okay! I have some hope now as tests and classes are being canceled. Am I destined to join that very company? Forget it anyway, let’s sit and prepare for the interview.”

- Kshithij Iyer

July 29, 2017 02:03 PM

Samridhi Agarwal

Playing with Numerical Lists

Many reasons are there to store a set of numbers. For example in a game you will need to store the high score of the player, In data visualization it’s most of the times you have to scribble up with huge amount of digits. That’s when python rescues you by proving a number of tools to work with lists of numbers.

range() Function – It makes easy to generate a series of numbers.

Example :

for value in range(1,4):
print (value)

OUTPUT ->

1
2
3

*The range() function causes Python to start counting at the first value you give it, and it stops when it reaches the second value you provide. Because it stops at that second value, the output never contains the end value, which would have been 4 in this case.
To print the number from 1 to 4, you will use range(1,5).

Implementing range() in list- Now to make a list of numbers you can directly wrap list() around a call to the range() function, the output will be a list of numbers. You can create almost any set of numbers using range() function.

Example – You want to make a list of squares of first 10 numbers.(In
Python, two asterisks (**) represents exponents .)

squares = [value**2 for value in range(1,11)]
print(squares)

Output:

[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

Simple statistics on list – There are few python functions that are specific list of numbers.

Example – find minimum, maximum and sum of all numbers in list.

>>>digits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
>>>min(digits)
0
>>>max(digits)
9
>>>sum(digits)
45

The examples I used here are a short list of numbers but these functions are very beneficial when millions of numbers are to be stored in lists like you want to plot a graph of population of each country in the world, you will need much larger lists of numbers which can be handled by these functions easily, We can also work with a small part of list, which python calls slice.

I will write about Slice in my next blog! Till then happy listing numbers!


by samridhiagarwalblog at July 29, 2017 07:28 AM

July 28, 2017

Samridhi Agarwal

Hangman Game (python help)

It’s the game which i liked to play when i was in 8th grade but Today I played it again  because it was a lot more fun showing my friends the game made by me and seeing them playing it! Yes I made the hangman game. It seems to be easy for some of you i know, but as I was stuck since long time with a simple error so it’s the joy of finally seeing my game working! hurray!

You can play my game or get the source code from here .

Do tell me some improvements on github.


by samridhiagarwalblog at July 28, 2017 05:40 PM

Adding Conditions in your program.

Today at dgplug session, we learnt how to examine the conditions in your program. Programming often involves examining a set of conditions and deciding which action to take based on those conditions. Python’s if statement allows you to examine the current state of a program and respond appropriately to that state.

Basic Concept : At the heart of every if statement is an expression that can be evaluated as True or False and is called a conditional test. Python uses the values True and False to decide whether the code in an if statement should be executed. If a conditional test evaluates to True , Python executes the code following the if statement. If the test evaluates to False , Python ignores the code following the if statement.

Examples :

number = int(input("Enter a number: "))
if number < 100:
print("The number is less than 100")
else:
print("The number is greater than 100")

Output-

Enter a number: 170
The number is greater than 100

*Else statement is not compulsory, Python does not require an else block at the end of an if – elif chain. Some­ times an else block is useful; sometimes it is clearer to use an additional elif statement that catches the specific condition of interest.

Question given in #dgplug session

Q) Perform mathematical operation of user’s choice ( +, -, *, / ) on 2 numbers given by the user.
Solution-
number_1 = int(input("Enter first number: "))
number_2 = int(input("Enter second number: "))
print ("Operation you want to perform")
print ("(1)addition (2)Subtraction (3)Multiply (4)Division")
user_choice = input("->")
if user_choice == '1':
print (number_1 + number_2)
elif user_choice == '2':
print (number_1 - number_2)
elif user_choice == '3':
print (number_1 * number_2)
elif user_choice == '4':
print (number_1 / number_2)

Output –

Enter first number: 30
Enter second number: 20
Operation you want to perform
(1)addition (2)Subtraction (3)Multiply (4)Division
->2
10

Tip: The else block is a catchall statement It matches any condition that wasn’t matched by a specific if or elif test, and that can sometimes include invalid or even malicious data. If you have a specific final condition you are testing for, consider using a final elif block and omit the else block. As a result, you’ll gain extra confidence that your code will run only under the correct conditions.

Happy Learning! 🙂


by samridhiagarwalblog at July 28, 2017 05:27 PM

Himanshu Awasthi

Kanpur Python

Hello Kanpurites ! Kanpur Python is the group of local python users , developer and students . Idea of this meetup group comes in my mind when I was attended PYCON PUNE 2017. I asked to Kushal Das(Core Python Developer at REDHAT) that how to start local meetup group and he advised me that first improve yourself then start meetup with 2 or 3 guys who really interested to do such kind of activities.

When I came back to Kanpur lots of people wants to know about how was the pycon pune and I share my experience to them. I saw there was so many people who was interested to learn python . So I start with my college friends and we do small small tasks like implementing other language code in python and learn frameworks of python and lots of thing. Now I register this meetup group as Kanpur Python Meetup so any one from Kanpur or near by kanpur can join our group .
There is a meetup schedule in our group RSVP YES to attend meetup.
In this meetup we will learn how to setup Python , basics of Python and I will show you some cool stuffs using Python.

Learn Together Hack Together Make Together

For join Kanpur Python Meetup group click here
visit our Facebook page click here

for any query and suggestion comment below ^^


by kanpurpython at July 28, 2017 02:18 PM

Kshithij Iyer

"Today’s lesson: Some people will never learn from their mistakes. And you can’t help..."

“Today’s lesson:
Some people will never learn from their mistakes. And you can’t help them.”

- Kshithij Iyer

July 28, 2017 09:44 AM

Samridhi Agarwal

Organising a list.

There will be times when your list will be stored in a very unpredictable format, like users entering their information in your website at any time but you want your list in an alphabetical order and at the same time you also want the original list. Python provides a number of different ways to organize your lists, depending on the situation.

1) Organising your list permanently with sort() method – Python’s sort() method makes it relatively easy to sort a list. But with this method you can never revert back to the previous original list.

icecream = [‘mango’, ‘chocochips’, ‘strawberry’, ‘vanilla’]
icecream.sort()
print(icecream)

Output :

[‘chocochips’, ‘mango’, ‘strawberry’, ‘vanilla’]

*You can also sort this list in reverse alphabetical order by passing the
argument reverse=True to the sort() method

2) Organising a List Temporarily with the sorted() Function – The sorted() function lets you display your list
in a particular order but doesn’t affect the actual order of the list.

icecream = [‘mango’, ‘chocochips’, ‘strawberry’, ‘vanilla’]
print(“Here is the sorted list:”)
print(sorted(icecream))
print(“Here is the original list again:”)
print(icecream)

Output :

Here is the sorted list :[‘chocochips’, ‘mango’, ‘strawberry’, ‘vanilla’]

Here is the original list again:[‘mango’, ‘chocochips’, ‘strawberry’, ‘vanilla’]

*Sorting a list alphabetically is a bit more complicated when all the values are not in lowercase. There are several ways to interpret capital letters when you’re deciding on a sort order, and specifying the exact order can be more complex than we want to deal
with.


by samridhiagarwalblog at July 28, 2017 09:05 AM

Jason Braganza

Moved to a newer version of Ghost

Just upgraded to the new shiny.
Featured posts and social media magic and all that jazz!

Apologies if your rss has gotten duplicates from the blog.
Change is never easy.

The new editor is nice, but I don’t like the “new, improved” Casper theme

They have, for now, mercifully made the old theme compatible. (which is what I’m using)

Updating should be easy going forward.
Hopefully I won’t have to download and install and customise manually.
(Twice over, for both blogs)

If you notice anything off, please tweet at me or send me a mail to jason at this domain.

by Mario Jason Braganza at July 28, 2017 08:04 AM

July 27, 2017

Kshithij Iyer

"Try searching for a song called “kum faya kum”(it’s by A.R.Raham). And start..."

“Try searching for a song called “kum faya kum”(it’s by A.R.Raham). And start reading its lyrics, you’ll understand life.”

- Kshithij Iyer

July 27, 2017 05:42 PM

Samridhi Agarwal

Ways to remove element from a list in python!

Many a times we want to remove some items or set of items from a list like if u are making a web login page and a user wants to remove their account, so it’s much needed to delete that particular user from the list of active members. There are few ways in python to do so, but which one to use also depends on the application you want to perform. Let’s dive and see each way –

1.Removing an element using delThis can be used when you know the position of the element in your list ( Remember : start counter is from 0 and not from 1).

For example, here’s how to remove the second element in the list:

icecream = [vanilla, chocochips, mango, strawberry]

del icecream[1]

*But in this option of del statement you can no longer have access to the removed elements of the list.

2. Removing an element using pop() Method – This is used when you want to have access   to the elements removed in some other place like when a user of a website wants to remove his account but you want to store his/her data in another list of inactive_members, Then pop() method is used. This method lets you remove the last item in a list but you can still work with that item. It works on the principle of stacks as a list and popping one item off the top of the stack, and here top of the stack signifies end of a list.

Let’s pop a item from list :

icecream = [‘vanila’, ‘chocochips’, ‘strawberry’, ‘mango’]
popped_icecream = icecream.pop()
print(icecream)
print(popped_icecream)

output:

[‘vanila’, ‘chocochips’, ‘strawberry’]

mango

Pop() method can also be used to remove items from any position in a list, let’s see how!

fav_icecream = icecream.pop(1)

print(fav_icecream.title())

Output :

Chocochips

*If you’re unsure whether to use the del statement or the pop() method,
here’s a simple way to decide: when you want to delete an item from a list
and not use that item in any way, use the del statement; if you want to use an
item as you remove it, use the pop() method.

3. Removing an item by Value – Sometimes you are unaware of the position of a certain element in a big list, but you definitely know the value/name of the item, you can easily remove that item by using remove() method. The removed item by this method can be accessed further.

Let’s try a simple code using remove() method :

icecream = [‘vanila’, ‘chocochips’, ‘strawberry’, ‘mango’]
seasonal = ‘mango’
icecream.remove(seasonal)
print(icecream)
print( seasonal.title() + ” is only a seasonal flavor.”)

Output:

[‘vanila’, ‘chocochips’, ‘strawberry’]

Mango is only a seasonal flavor.

*The remove() method deletes only the first occurrence of the value you specify. If there’s a possibility the value appears more than once in the list, you’ll need to use a loop to determine if all occurrences of the value have been removed.

Have fun with theses deleting methods !

 

 


by samridhiagarwalblog at July 27, 2017 01:47 PM

July 26, 2017

Robin Schubert

NTM: My laptop function keys

This is a new series to my blog, which I call “note to myself”, because it’s just that. What urged me to write this first post is the configuration of my laptop after installing a new OS (or configuring a new window manager in this case). I realize that I need to configure the same items every time I do a fresh set-up, and I keep forgetting long file paths and where to look for several settings files etc.

This post will serve me as look-up when I set up my system next time, maybe it is useful for someone else, by chance.

My set-up

I’m using an Asus zenbook UX31, running Parabola GNU/Linux and i3-gaps window manager

I have the following function (fn) keys, that tend to not work out of the box when installing a new OS/wm:

  • F1: sleep
  • F2: toggle wifi
  • F3: decrease keyboard backlight
  • F4: increase keyboard backlight
  • F5: decrease screen brightness
  • F6: increase screen brightness
  • F7: turn off screen
  • F8: toggle alternate screen
  • F9: disable touch pad
  • F10: mute audio
  • F11: decrease volume
  • F12: increase volume

I usually don’t need all of those, but especially the screen brightness, keyboard leds and audio keys are important to me. This is how I can set the appropriate keybindings:

Keyboard backlight leds

The file containing the keyboards leds’ brightness is
/sys/class/leds/asus::kbd_backlight/brightness

It contains just the number that represents the brightness level, which ranges from 0 (leds off) to 3 (max brightness). I’ve written a script to increase or decrease the level stepwise.

Using bash

    #!/bin/bash

    if [ -z $1 ];
    then
        echo "usage $0 [-inc|-dec]"
        exit 1
    fi

    PATH=/sys/class/leds/asus\:\:kbd_backlight/brightness
    OLD=$(/usr/bin/cat $PATH)

    if [ $1 == "-inc" ]
    then
        if [ $OLD -lt 3 ]
        then
            echo $(($OLD + 1)) > $PATH
        fi
    elif [ $1 == "-dec" ]
    then
        if [ $OLD -gt 0 ]
        then
            echo $(($OLD - 1)) > $PATH
        fi
    fi

Using Python

    #!/usr/bin/env python
    import sys

    path = "/sys/class/leds/asus::kbd_backlight/brightness"

    try:
        with open(path, 'r') as b_old:
            brightness = int(b_old.read())
    except:
        sys.exit(1)

    if sys.argv[1] == "-inc" and brightness < 3:
        brightness += 1
    elif sys.argv[1] == "-dec" and brightness > 0:
        brightness -= 1

    try:
        with open(path, 'w') as b_new:
            b_new.write(str(brightness))
    except:
        sys.exit(1)

Either script works the same way. You must be root to write the brightness file, however. To overcome this in my i3 .config, I modified the sudoers file

    sudo visudo
    %robin ALL = NOPASSWD: <path to script>

This will allow me (Group robin) to execute the script without typing the sudo password. If you want to add this feature for all users on your machine, just add the users to users group and put that into the sudoers
instead

usermod -aG users 

I can now add the keybinding to my .config file

bindsym $mod+F3 sudo exec set_kbd_backlight -dec
bindsym $mod+F4 sudo exec set_kbd_backlight -inc

The keyboard backlight brightness was luckily the lengthiest part of all.

The screen brightness

The screen brightness can be adjusted with the xbacklight tool. The commands for my .config are

bindsym $mod+F5 exec xbacklight -dec 5
bindsym $mod+F6 exec xbacklight -inc 5

to decrease or increase the brightness by 5% each time.

Audio keys

I’m using pulseaudio per default. Although I heard about cpu consumption issues, I did not yet have reason to switch this to alsa completely. The pulseaudio settings can be controlled with the pactl tool. The audio
sinks can be listed with

pactl list short sinks

I only have one sink wich is labelled #0, so my keybindings in .config are

bindsym $mod+F10    exec pactl set-sink-mute 0 toggle
bindsym $mod+F11    exec pactl set-sink-volume 0 -5%
bindsym $mod+F12    exec pactl set-sink-volume 0 +5%

to toggle mute or decrease and increase the volume by 5% per keypress.

More to follow

These are the fn keys I definitely need every day. I will take care of the others later and update this post accordingly.

I also seem to have problems escaping my tag symbols using Markdown in wordpress. Looks like I have to surround code by “pre” tags and use &lt; and &gt; notation.


by schubisu at July 26, 2017 10:58 PM

Kshithij Iyer

"Again I stand at a point where my morals and my mind are fighting, Again I stand at a point where..."

“Again I stand at a point where my morals and my mind are fighting, Again I stand at a point where everything appears to be wrong and everything appears to be right.”

- Kshithij Iyer

July 26, 2017 05:14 PM

Samridhi Agarwal

Basics of python!!

As i made a few games and currently studying data sciences with python, I was in the thought that atleast i know how python language works and what it is. But today to my surprise i went to library to search for a book on python with data science and what i saw was their were n number of books on python and each solely on each module and at that point i realized that it can be never ever that you know a full language of python because python really can do everything and anything and knowing everything is not possible in just this one year.  So i decided to like learn 1 module in 15 – 30 days so that i can do pretty much things with python but then wait What about data science with python…

I am a lot more puzzled with everything as its my third year and it’s the time when 24 hours is so less and you want to learn everything and gets fascinated by others skills on some different thing and then try to fit in that boot, but it’s really tiring running for everything to learn because their is so much. In all this fuss I asked one of my senior about how to handle college and your interest and what should be most focused at present? She told me about her interviews and placement time and what all things where she was stuck!

She gave me a very positive idea of first focusing on basics and then jump to higher concepts and read or practice each in detail and not necessary to know everything but learn perfectly what you are interested in.

So i decided to learn the basics first or do a self 101 session of python for me! That was it when i went on dgplug summer training and what i found was so impressive! Today in dgplug python programming is started from basics and i was so happy that for next few months i will at least be again drilling with my python skills and improve them and yeah on my free time continuing with my data science with python course. Pretty much clear with what i should do at the end of the day… Big satisfaction huh!

In #dgplug, today was the basics session and i was again amazed to know that basics means a lot because all this time i was not knowing about python being an interpreted language and the theory behind it. Then i was also not knowing what this jupyter notebooks and i had heard many people talking about that and many books explaining that, but today’s session was cherry on the cake just like the previous git session, which helped me to get started with jupyter notebooks and yeah I can’t say i learned how to use it perfectly but i am sure gonna explore it and learn it !

One more great session on #dgplug today!


by samridhiagarwalblog at July 26, 2017 03:10 PM

Kshithij Iyer

"Love is really simple you know, if you have it you love falling in love and if you get screwed in it..."

“Love is really simple you know, if you have it you love falling in love and if you get screwed in it then you hate it.”

- Kshithij Iyer

July 26, 2017 08:16 AM

July 25, 2017

Kshithij Iyer

The seasonal GOT fever. The winter is here.



The seasonal GOT fever.
The winter is here.

July 25, 2017 06:28 PM

Jason Braganza

Revising Python keywords and operators


Made a list of every operator in Python 3 I have learnt in the past month (from LP3THW) and put them into an Anki deck, so that I can keep learning them at intervals.

If you want it, it’s here.


by Mario Jason Braganza at July 25, 2017 05:12 AM

Revising Python keywords and operators


Made a list of every operator in Python 3 I have learnt in the past month (from LP3THW) and put them into an Anki deck, so that I can keep learning them at intervals.

If you want it, it’s here.


by Mario Jason Braganza at July 25, 2017 05:12 AM

July 24, 2017

Kshithij Iyer

"It will all come to you when there is something that it can’t get for you, now this so called..."

“It will all come to you when there is something that it can’t get for you, now this so called it can be money, marks, success or whatever you want so bad in life.”

- kshithij Iyer

July 24, 2017 12:38 PM

July 23, 2017

Kshithij Iyer

"Don’t run to rescue a mad dog if you are not a vet."

“Don’t run to rescue a mad dog if you are not a vet.”

- Kshithij Iyer

July 23, 2017 10:48 AM

July 22, 2017

Robin Schubert

A libre OS

As described in my previous post, I migrated my system to a completely libre GNU/Linux distribution (seems I need to use the term libre in order to avoid the free/gratis confusion).

I admit that the pure migration process was pretty simple and almost unspectacular: I was running Manjaro Linux, an Arch-based distribution that comes with a nice set-up environment, but still has the freedom, simplicity and cutting edge packages, which I enjoyed very much. I decided to stay with an Arch derivative and followed these instructions to switch to Parabola Gnu/Linux. I expected some more magic, but basically I did the following:

  • removed all non-free packages
  • removed manjaro specific packages
  • installed libre alternatives where possible
  • installed your freedom

Removing the unwanted

While this sounds pretty straight forward there were some things I expected (like removal of certain software like TeamViewer, Skype etc) and some that were rather unexpected and made me swallow, like when I saw yaourt on the list of software-to-be-removed. Yaourt is a wrapper around the Arch packaging tool pacman. Whenever I could not find a package in the official repositories, that was my very first alternative, and I found what I was looking for in 99 of 100 searches.

However, it’s not crucial and I’ll be happy to invest more time in finding a solution in future, knowing that I will be more conscious about the software I install and use.
I was a bit puzzled about X not starting anymore, until I noticed that Plymouth is obviously non-free software and was hooked with my lightdm service; well I can absolutely forgo that one.

Embracing the alternative

My Thunderbird is now an Icedove, I totally can live with that ;) so far the libre alternative software does not at all change or affect the way I worked before. I was surprised to see that my kerned needed to be replaced. I nether thought about that, but apparently my linux kernel included binary blobs, I guess for hardware compatibility. The Free Software Foundation Latin America is developing libre-linux, a kernel free of any proprietary binaries, thanks for that!

More difficulties were caused by the software that was without alternative, like my proprietary wifi driver. Yes, I should have read just one more paragraph, so at least I would have been warned. Of course, no FOSS driver exists for my wifi card (since no specifications are made public), like for the vast majority of wifi cards, as far as I understood. So I ended up with buying an external usb wifi-dongle with a supported chipset (RTL8188 in my case) – I’ve come so far, I won’t be stopped by that :P

Keep the system clean

The funniest thing about the migration was indeed the your freedom package. The description given on the website tells you all you need to know about that:

This package conflicts with every nonfree package
known to date to ensure your system is free.

So this is my watchdog, conflicting with everything I didn’t know I didn’t want to have.

The system is up and running again, and I don’t feel much of a difference, yet. What I feel however, is to have gained deeper insight in how proprietary software and binary blobs are integrated in every layer of our system, unless we take the extra effort, time and knowledge to intentionally avoid it. I am no paranoiac and I don’t plan to become one in near future, but it is indeed alarming how many pieces of software are integrated per default, of which the operations that should be performed can not be verified – a very one-sided trust model.


by schubisu at July 22, 2017 11:04 PM

Kshithij Iyer

Summary of the last 21 years

A boy was born, who couldn’t mix up with other children of his age group. 

Made limited number of friends.

Got obsessed with computers and automobiles but had a bit more madness for computers when compared with automobiles. 

Took a professional course based on computers. 

Lost a loved one. (The only loved one.)

Worked hard and partied harder.

Met some great and some not so great people. (Ditched the not so great ones.)

Did some crazy shit. (Don’t ask don’t tell kind off.)

Took pressure with coke and edm music.

Currently at the best point in life but still wondering what I want from life.

I guess the last 21 years were not that bad…..

July 22, 2017 07:36 PM

"People say that most people forget their friends when they fall in love, but this brings me to the..."

“People say that most people forget their friends when they fall in love, but this brings me to the fact that is some people are worth forgetting even for a love which I know might not even last a semester.”

- Kshithij Iyer

July 22, 2017 07:08 PM

July 21, 2017

Jason Braganza

On Margin

This post is for my younger colleagues on the student planet.
Yes kids, this is a long post. Suck it up and read it over the weekend.
This is important stuff.
And please go, read this on the blog.



Introduction

In The Intelligent Investor, published in 1949, Benjamin Graham[^n] wrote:

In the old legend the wise men finally boiled down the history of mortal affairs into the single phrase, “This too will pass.”

Confronted with a like challenge to distill the secret of sound investment into three words, we venture the motto;

MARGIN OF SAFETY.

… the function of the margin of safety is, in essence, that of rendering unnecessary an accurate estimate of the future.

(emphasis mine)

What does that mean to me?

That in order to do anything with my life, in any area, I should have enough to face the worst that I think, could happen to me.

I’ll simplify it further.

Margin is having enough room to breathe;
and knowing what “enough” means in every sphere of life.

It has implications throughout life and across various societal disciplines even.
Ben Graham’s quote above comes from the field of finance.
What about engineering?

Consider a highly-engineered jet engine part. If the part were to fail, the engine would also fail, perhaps at the worst possible moment—while in flight with passengers on board … We’ve designed the part for 10,000 hours of average flying time.
That brings us to a central question: After how many hours of service do we replace this critical part? 9,999 hours? Why replace it any sooner than we have to? Why waste money?

The first problem is, we know nothing of the composition of the 10,000 hours any individual part has gone through. Were they 10,000 particularly tough hours, filled with turbulent skies? Was it all relatively smooth sailing?
And, how confident are we, that the part will really last the full 10,000 hours? What if it had a slight flaw during manufacturing? What if we made an assumption about its reliability that was not conservative enough? What if the material degraded in bad weather to a degree we didn’t foresee?

The challenge is clear, and the implication obvious: we do not wait until the part has been in service for 9,999 hours. Perhaps at 7,000 hours, we seriously consider replacing the part, and we put a hard stop at 7,500 hours.

The difference between waiting until the last minute and replacing it comfortably early gives us a margin of safety. We leave ourselves a cushion. (Ever notice how your gas tank indicator goes on long before you’re really on empty? It’s the same idea.)

Go read the whole post. It’s awesome.


So, Why Do We Need Margin?

To paraphrase Dr. Richard Swenson, who’s literally written the book on Margin (the book has a moral, Christian bent. Don’t let that bother you);

  • Progress gives us more and more, which leads to
  • stress, change, complexity, speed, intensity, and overload.
  • which is bad, because all humans have physical, mental, emotional, and financial limits that are relatively fixed
  • Thus progress is on a collision course with human limits and once we can’t take progress any more, we flame and burn out. On the unsaturated side of our limits, humans can be open and expansive. Cross them however, and the rules of life totally change.

What would you think if this page had no margins?
What would you think of me if I crammed the print top to bottom and side to side so that every blank space was filled up?
The result would be aesthetically displeasing and chaotic.

Like some of our lives!

Marginless, according to Swenson, is being thirty minutes late to the doctors office because you were twenty minutes late getting out of the bank because you were ten minutes late dropping the kids off at school because the car ran out of fuel two klicks from the petrol pump and you forgot your wallet.
Margin, on the other hand, is having breath left at the top of the staircase, money left at the end of the month, and sanity left at the end of adolescence.

No Margin, causes hyperstress and overload. (terms that to folks like us, need no definition)

Here’s Dr. Swenson again,

To be healthy, we require margin in at least four areas:

  • emotional energy,
  • physical energy,
  • time,
  • and finances.

Yet, right now for the most part we are emotional wrecks, stressed, alone, and so exhausted in spirit.
Physically, we are overfed, underactive, and sleep-deprived.
We have no time, at all.
And when it comes to finances, our bank balances look as barren as the surface of Mars.


What Can We Do about It?

Thank Pareto, grab the low hanging fruit and do the twenty percent of the work that’ll yield the most margin in your life.

Remember, we live lives, full of intention now :)

Let’s intentionally tackle each domain and see what we can do.

Emotional:

  • Bond with your family
  • Make time for friends
  • Switch off the TV! … and your other screens
  • Get a pet or go play with doggies in the park
  • Pray, meditate.

Physical:

  • Eat less, move more
  • Walk, Run!
  • Cut out sugar
  • Drink water.
  • Have the discipline (or build it up) to keep at it.
    (I didn’t have any and I’m paying the price!)
  • Most importantly, get enough sleep.

Time:

  • You’ll never “find time”. Be intentional. Make time!
  • Learn to plan your day and your week.
  • Plan your day with plenty of spaces in the middle
  • Did you cut out FB? Twitter? TV? :P
  • Learn to say No. No is a complete sentence.

Financial:

  • Stop eating out! Learn to make do.
  • The only debt you have should be your home. (and no more than 40% of income at that)
  • Have 6 months living expenses in the bank.
  • Spend way less than you make. (The bigger the buffer, the more chaos you can handle.)
  • Be comfortable with charity and giving now, when it’s hard to do. Like Dave Ramsey says, “If you will live like no one else, later you can live and give like no one else.”

And finally here’s James Clear, echoing Taleb
Leave Room for the Unexpected!

If your life is designed only to handle the expected challenges, then it will fall apart as soon as something unexpected happens to you.
Always be stronger than you need to be.
Always leave room for the unexpected.

Thank you for reading. Here’s a puppy.


This is the bonus section

Want to hear from an actual practitioner?

So what is the lesson?
Save your current income, even as you build complementary skills like frugality, adaptability, and the ability to earn money in more than one way.
Then you’ll be ready to retire much earlier, because the sum of your safety margins will be enough to make you feel comfortable taking the leap.
And most importantly, stop worrying!

That’s Mr. Money Mustache (real name, Pete Adeney), software developer who retired at age 30! (watch the video)


Resources:
(in the grand tradition of @mbuf feeding us well with knowledge)

P.S. This post is part of the Life Outside Code series.


by Mario Jason Braganza at July 21, 2017 12:07 PM

On Margin

This post is for my younger colleagues on the student planet.
Yes kids, this is a long post. Suck it up and read it over the weekend.
This is important stuff.
And please go, read this on the blog.



Introduction

In The Intelligent Investor, published in 1949, Benjamin Graham1 wrote:

In the old legend the wise men finally boiled down the history of mortal affairs into the single phrase, “This too will pass.”

Confronted with a like challenge to distill the secret of sound investment into three words, we venture the motto;

MARGIN OF SAFETY.

… the function of the margin of safety is, in essence, that of rendering unnecessary an accurate estimate of the future.

(emphasis mine)

What does that mean to me?

That in order to do anything with my life, in any area, I should have enough to face the worst that I think, could happen to me.

I’ll simplify it further.

Margin is having enough room to breathe;
and knowing what “enough” means in every sphere of life.

It has implications throughout life and across various societal disciplines even.
Ben Graham’s quote above comes from the field of finance.
What about engineering?

Consider a highly-engineered jet engine part. If the part were to fail, the engine would also fail, perhaps at the worst possible moment—while in flight with passengers on board … We’ve designed the part for 10,000 hours of average flying time. That brings us to a central question: After how many hours of service do we replace this critical part? 9,999 hours? Why replace it any sooner than we have to? Why waste money?

The first problem is, we know nothing of the composition of the 10,000 hours any individual part has gone through. Were they 10,000 particularly tough hours, filled with turbulent skies? Was it all relatively smooth sailing?
And, how confident are we, that the part will really last the full 10,000 hours? What if it had a slight flaw during manufacturing? What if we made an assumption about its reliability that was not conservative enough? What if the material degraded in bad weather to a degree we didn’t foresee?

The challenge is clear, and the implication obvious: we do not wait until the part has been in service for 9,999 hours. Perhaps at 7,000 hours, we seriously consider replacing the part, and we put a hard stop at 7,500 hours.

The difference between waiting until the last minute and replacing it comfortably early gives us a margin of safety. We leave ourselves a cushion. (Ever notice how your gas tank indicator goes on long before you’re really on empty? It’s the same idea.)

Go read the whole post. It’s awesome.


So, Why Do We Need Margin?

To paraphrase Dr. Richard Swenson, who’s literally written the book on Margin (the book has a moral, Christian bent. Don’t let that bother you);

  • Progress gives us more and more, which leads to
  • stress, change, complexity, speed, intensity, and overload.
  • which is bad, because all humans have physical, mental, emotional, and financial limits that are relatively fixed
  • Thus progress is on a collision course with human limits and once we can’t take progress any more, we flame and burn out. On the unsaturated side of our limits, humans can be open and expansive. Cross them however, and the rules of life totally change.

What would you think if this page had no margins?
What would you think of me if I crammed the print top to bottom and side to side so that every blank space was filled up?
The result would be aesthetically displeasing and chaotic.

Like some of our lives!

Marginless, according to Swenson, is being thirty minutes late to the doctors office because you were twenty minutes late getting out of the bank because you were ten minutes late dropping the kids off at school because the car ran out of fuel two klicks from the petrol pump and you forgot your wallet.
Margin, on the other hand, is having breath left at the top of the staircase, money left at the end of the month, and sanity left at the end of adolescence.

No Margin, causes hyperstress and overload. (terms that to folks like us, need no definition)

Here’s Dr. Swenson again,

To be healthy, we require margin in at least four areas:
- emotional energy,
- physical energy,
- time,
- and finances.

Yet, right now for the most part we are emotional wrecks, stressed, alone, and so exhausted in spirit.
Physically, we are overfed, underactive, and sleep-deprived.
We have no time, at all.
And when it comes to finances, our bank balances look as barren as the surface of Mars.


What Can We Do about It?

Thank Pareto, grab the low hanging fruit and do the twenty percent of the work that’ll yield the most margin in your life.

Remember, we live lives, full of intention now :)

Let’s intentionally tackle each domain and see what we can do.

Emotional:

  • Bond with your family
  • Make time for friends
  • Switch off the TV! … and your other screens
  • Get a pet or go play with doggies in the park
  • Pray, meditate.

Physical:

  • Eat less, move more
  • Walk, Run!
  • Cut out sugar
  • Drink water.
  • Have the discipline (or build it up) to keep at it.
    (I didn’t have any and I’m paying the price!)
  • Most importantly, get enough sleep.

Time:

  • You’ll never “find time”. Be intentional. Make time!
  • Learn to plan your day and your week.
  • Plan your day with plenty of spaces in the middle
  • Did you cut out FB? Twitter? TV? :P
  • Learn to say No. No is a complete sentence.

Financial:

  • Stop eating out! Learn to make do.
  • The only debt you have should be your home. (and no more than 40% of income at that)
  • Have 6 months living expenses in the bank.
  • Spend way less than you make. (The bigger the buffer, the more chaos you can handle.)
  • Be comfortable with charity and giving now, when it’s hard to do. Like Dave Ramsey says, “If you will live like no one else, later you can live and give like no one else.”

And finally here’s James Clear, echoing Taleb
Leave Room for the Unexpected!

If your life is designed only to handle the expected challenges, then it will fall apart as soon as something unexpected happens to you.
Always be stronger than you need to be.
Always leave room for the unexpected.

Thank you for reading. Here’s a puppy.


This is the bonus section

Want to hear from an actual practitioner?

So what is the lesson?
Save your current income, even as you build complementary skills like frugality, adaptability, and the ability to earn money in more than one way.
Then you’ll be ready to retire much earlier, because the sum of your safety margins will be enough to make you feel comfortable taking the leap.
And most importantly, stop worrying!

That’s Mr. Money Mustache (real name, Pete Adeney), software developer who retired at age 30! (watch the video)


Resources:
(in the grand tradition of @mbuf feeding us well with knowledge)

P.S. This post is part of the Life Outside Code series.


by Mario Jason Braganza at July 21, 2017 12:07 PM

Bhavin Gandhi

Fedora 26 release party at Rajarambapu Institute of Technology

With the release of Fedora 26 on 11th of July, we thought of having release party in our college. With that thought in mind we carried out meeting and discussion on our Linux Users Group’s IRC channel on freenode (#ritinlug).…

The post Fedora 26 release party at Rajarambapu Institute of Technology appeared first on GeekSocket.

by Bhavin at July 21, 2017 10:23 AM

July 20, 2017

Bhavin Gandhi

Markdown – The easy way to write HTML

We use HTML almost for everything, it’s simple text with extra attributes like bold, italic etc. This attributes (tags) are parsed by browser in order to display the text. Writing HTML is not easy always especially if you are writing…

The post Markdown – The easy way to write HTML appeared first on GeekSocket.

by Bhavin at July 20, 2017 06:00 PM

Kshithij Iyer

"I don’t have any hard feelings for those selfish friends who screwed me, cause one day I know..."

“I don’t have any hard feelings for those selfish friends who screwed me, cause one day I know that their karma will come back and kick their ass.”

- Kshithij Iyer

July 20, 2017 05:02 PM

"Do good even when no one sees it, even when you have to pay for it. Cause one day it will find..."

“Do good even when no one sees it, even when you have to pay for it. Cause one day it will find it’s why back to you with interest.”

- kshithij Iyer

July 20, 2017 04:58 PM

Abdul Wahababrar

Thank you so much Jason for your kind words, Still in the learning stage! Need to learn a lot…

Thank you so much Jason for your kind words, Still in the learning stage! Need to learn a lot…

by Abdul Wahab Abrar at July 20, 2017 02:25 PM

Jason Braganza

Random Meta Stuff

Moving all the lochww posts to the loc tag; (Life Outside Code)

Yes, I no longer wish to focus only on the healthy, wealthy, wise parts of life.

It was keeping me from writing regularly.

I’d rather go wide and actually write about everything that interests me and I think would help you folks, than restrict myself to just thinking; and then thinking some more, and not doing any er … actual writing.

Here’s to more …

If you want to subscribe to just the loc posts this link should help your feed reader.

by Mario Jason Braganza at July 20, 2017 01:51 PM

Random Meta Stuff

Moving all the lochww posts to the loc tag; (Life Outside Code)

Yes, I no longer wish to focus only on the healthy, wealthy, wise parts of life.

It was keeping me from writing regularly.

I’d rather go wide and actually write about everything that interests me and I think would help you folks, than restrict myself to just thinking; and then thinking some more, and not doing any er … actual writing.

Here’s to more …

If you want to subscribe to just the loc posts this link should help your feed reader.

by Mario Jason Braganza at July 20, 2017 01:51 PM

July 19, 2017

Abdul Wahababrar

Here comes Data, The new Oil of this Century [part. 01]

“Data! Data! Data!” he cried impatiently. “I can’t make bricks without clay.” — Arthur Conan Doyle

Oil is no more the most important resource today, so is Data? While we were in the late 80's and early 90's, we were working with Data but did not call it as Data Science or nearer term, we used to call Statistics to it.

Algorithms, Software tools were not prevalent in those times. Software were expensive and not Open-Source and cheap as today. During those dark age we did not have the data storage platforms and now we have millions of data sets available at very low cost.

DJ Patil and Andrew Gelman were the very first people, who coined the term Data Science. Data Science is a vast field that includes artificial Intelligence, Machine Learning (AI’s small bro), Deep Learning, Neural Networking and much more.

Data Science is the science of Data, just like Biological Science is the science of Biology and Physical Science is the science of Physical reactions. Data is gathered, pondered, manipulated, worked, analyzed then visualized. It is like uncovering the mystery behind Data. It is like story-telling that you tell what’s residing behind data. It could be structured or unstructured.

Data Science is relevant today because we have gazillions of data. During 1980’s and 1990’s people used to laugh when we speak about Artificial Intelligence and now we must laugh at people who don’t know AI because we have data NOW!

There’s never a better time to be a Data Scientist.

Let’s Discuss more about Data very soon in the next stories!

by Abdul Wahab Abrar at July 19, 2017 05:54 PM

Kshithij Iyer

"It’s a strange feeling when your teacher ask’s you to build a mars rover instead of..."

“It’s a strange feeling when your teacher ask’s you to build a mars rover instead of building the same old go-kart cause your heart wants it badly and your mind says “Beta sambhal kar nahi tho dandi lag jaygi!”(Dude be careful or else you’ll get a back!)”

- Kshithij iyer

July 19, 2017 11:52 AM

"All the plans you make, all the calculations you do, all the equations you formulate one day all of..."

“All the plans you make, all the calculations you do, all the equations you formulate one day all of it becomes useless cause the variable change jumps the charts and you are left clueless. During those days it’s just you against the odds, so get up and punch hard cause the game is the best before a win or a knock out.”

- kshithij Iyer

July 19, 2017 10:46 AM

July 18, 2017

Shivam Singhal

MozCoffee V11: Time to wakeup Community

There is a long time from Mozilla Delhi went on a hibernate so its time to wake up the community. To rejuvenate the community some members took initiative. Thus Pushpita and Bhuvnesh  planned to organize Mozcoffee V11 on July 15 at Qutub Spring House, Delhi.

I had two events on same day , one is Hackathon Random Hacks of India in Gurgaon at 9 AM where my team members wait for me and  another was MozCoffee at 11 AM, i preferred first to go to MozCoffee as it was necessary to wake up the Community.The main agenda of this MozCoffee was to discuss about the current projects of Activate Mozilla Campaign.

So I reached by 10.30 AM at the venue. Pushpita and me reached at the same time 😀 . Bhuvnesh Sir was already at the venue. More attendees began to join us from 10.45 onwards. I was so happy to some newbies join us as they were interested in Open Source Contribution. So I and Sanyam Bhaiya introduce them to open Source and tell them about how to contribute to Mozilla Projects and Mozilla Campus Club. This was first time I introduce some one to Open Source though it was not official talk 😛 .

After that Sanyam Bhaiya told about various Mozilla Projects after that Pushpita explained about the Activate Mozilla Campaign. She also highlighted other projects for non- tech peoples.

IMG_0359.jpg

Finally, it was time to bid goodbye to all the Mozactivities 🙂 .

IMG_0705.jpg

Thanks for reading. Sorry for such bad english. Be Mozillian :).

 


by championshuttler at July 18, 2017 05:42 PM

Ganesh Nomula

Tears On Fire

Well – Since my first breath, I am meeting people everyday, every month, every year for 22...

July 18, 2017 05:33 PM

Kshithij Iyer

"A good friend of mine said “You are really volatile my friend.” I smiled and replied..."

“A good friend of mine said “You are really volatile my friend.” I smiled and replied “I am not volatile my friend I am just allergic to bullshit.””

- Kshithij Iyer

July 18, 2017 01:22 PM

Shivam Singhal

Tabs v/s Spaces: Analysis on why tabs better

Tabs vs Spaces : Silicon Valley

Tabs v/s Spaces. I am sure you have encountered this dilemma in your coding career time and again. I prefer tabs. There are some people who prefer spaces instead. Today I would like to discuss why tabs are better than spaces. I am only going to use rational points here. Please spend 5 minutes on this article and then make a decision.

First, I would like to point out the major argument why people prefer Spaces over Tabs.

They say, spaces make indentation look more consistent across different setups. This is not totally correct. Tabs can be configured to consume any number of columns in the editor. So if you hate high indentation, you can set tab width as 2. But, spaces do have a real advantage and it comes when you are trying to do non-uniform indentation like of function parameters in a function declaration.

int mainFunction(int a, char b, bool c, short d, long e){
               return 0; } 
int mainFunction(int a, char b, bool c, short d, long e){
               return 0; }

The first function in this code uses spaces whereas the next one uses tabs. If you try to see the difference here, you will notice that double f is slightly misaligned in the second function. For me, this is not bothersome and I would gladly accept this over the benefits of tabs. Let’s look into these in detail.

1. Tabs are meant for Indentation

Why were ‘Tabs’ created when we already had spaces? For indentation right, what other could be the reason. Now tabs were introduced for indentation because indenting using space required lots of keystrokes (though it’s not the case with modern editors now). So you might still argue “I would use spaces because my editor automatically takes care of indentations for me”. Well have a look at the next points then.

2. Tab-based indentation is uniform, like spaces

As I already told at the start of this article, tab width can easily be changed in the editor to make indentation look consistent across different setups. As a bonus, tab width can be changed unlike spaces and this allows a developer who hates, say wide indentation to visualize a narrower indentation while coding.

This is the main point why people thought spaces are better. In my opinion, it’s just the opposite. Indentation using tabs is flexible in its own way.


I hope at this point of the article, I have cleared the air around tabs and why people feel that spaces are superior to tabs. At this point, we can say that spaces are pretty much equal to tabs if you don’t consider that indentation example earlier. Now let’s see, why tabs are better than spaces.

PS – It may feel like I am being picky here but hey, tabs = spaces has been established so every pro for Tabs matters.

3. Tabs work better with Notepad

You might be saying, who uses “Notepad”? Well, Notepad here symbolizes the most basic of the text editors. These editors don’t convert a tab press to 4 spaces. Now, there might be a need where you have to quickly edit a code file. If the code has been indented by spaces and you are trying to add a few lines in the code, you will have to use 4 times spaces for each level of indentation.

If the code had been indented through tabs, well .. things could have been much faster and less frustrating.

I know this happens in a very rare case but let’s face it, we all have faced these situations many times in our career.

4. Code size with tabs indentation is lesser

Suppose you are using a 4-space indentation, then the total size of the file added by your indent chars will be 4 times more than using tab indents. Now, in a complex program indents can easily go up to 5 levels. Suppose average indent in a program is 3 levels and average code length (without indents) in a line is 50 chars and total lines is 100, then the file size we have with space indentation is 100 * (50 + 3*4) = 6200. With tab indentation, total file size is 100 * (50 + 3) = 5300. This is a saving of 17%.

Yes, obviously the real numbers for the industry would be different than this. But how much less can it be, 15%, 12%, 10%? Even if we are getting a saving on 10% in the code size, don’t you think it’s beneficial. And this comes at absolutely no cost.

5. Spaces Indentation takes more time to fix

Again, this is a very rare situation but because tabs = spaces has been established after point 2, this adds weight to the tabs category.

Let’s take a situation where you accidentally deleted some spaces (n s.t. n % 4 != 0) in the indentation. To fix this, you will have to add some tab spaces for the indentation blocks (n / 4) + (n % 4) spaces for the extra. This won’t be the case with tabs as you will only have to add the tabs that were deleted.

6. Spaces promote super-ugly & inefficient code style

class MyClass: 
    def myDescriptiveNameMethod(param_a # description for param_a 
                                param_b, # description for param_b
                                param_c): # description for param_c 
        pass

Yes, I have seen code examples like this in the wild. I know that you want to give comments to parameters and that’s why you are putting one parameter at a line but why this high degree of indentation. A better example using tabs would be –

class MyClass:
	def myDescriptiveNameMethod(
		param_a, # description for param_a
		param_b, # description for param_b
		param_c  # description for param_c
	):
		pass

Yes, keeping param_a in a separate line could have been done using spaces as well but the point here is that because people use spaces for indentation, they are following a horrific code style like the first example.


So these are my pro-Tabs reasons. You might think some of them as BS but they are rational and you can’t disagree with that. The only pro-Space argument I see is the very first code example in this article. But for me, that doesn’t win against the stronger reasons we have for using tabs.

I hope this article will get programmers aware of why they should use tabs or spaces, whatever they feel like. I have tried to put together all points I have on tabs v/s spacesand I came to the decision that tabs are clearly better. This might not be the case with everyone. If this article triggered a change in your coding habit, do let me know in the comments. Also if you have a feedback about the article or would like to add to it, just throw in a comment.

That’s all for now. Thanks for taking time reading this blabbering 😀

 


by championshuttler at July 18, 2017 12:40 PM

July 17, 2017

Kshithij Iyer

Debian 9 (stretch) Release Party

I always wanted to do more than whatever my fellow batch mates were doing. This urge of doing more took me to Pune, the third largest IT hub in India after Bangalore and Hyderabad. And eventually, I realized that I was ahead of the curve in this case as well. So I joined an open source community to get some challenge in my life. The reason behind joining PLUG was that one of my professor with whom I was comfortable talking to used to organize these meetups. Through PLUG I met a few more students who wanted to something more. And so it all started, Debian 9 was released 17th June. We started to plan for a release party. Now I was asked to bring a cake for the party which became a piece of cake as I had fallen in love with a girl who had a sweet tooth. I was supposed to collect the cake and I was supposed to bring it to the location of the event. But I guess it was not that easy as it seemed. I went on time to pick up the cake on time and I had run back to the nearest ATM to get the cash as the card machine at the shop was not working. Then the second hurdle came which was the cab as OLA or Uber cabs were not available at the location of the shop. So I gathered my courage to take an auto-rickshaw in Pune. When I reached the place where we were hosting the event, the event was going on smoothly. The ride till the place was a bit bumpy but due to God’s grace, the cake was in one piece.The event ended and I was confused to be happy or tired so in the end, I was both. This was how I made my first contribution to open source. I know it is not as cool as contributing code to a software but it was one hell of an experience. 

image
image

July 17, 2017 06:30 PM

July 15, 2017

Mohit

#include

#include <my_struggle.h>

#include <my_struggle.h>

/** This is the header file of my journey to computer programming world.
  */

tl:dr

Hello Everyone, As you have read above already, this is the header file of my journey to the programming world. It includes the functions:

  • Why Am I Stuggling?
  • Why Do I Care!
  • My Journey/Struggle

First, we should cover all the dependencies for these functions to properly work.

Why Am I Struggling?

I took Computer Science as my majors in my Graduation out of nowhere, I don’t know why but I did. I was always an art lover with curious temperament, kinda kid. I admires the nature and the science behind it, so what I knew already that I love Physics, It’s my subject because Physics is a Latin Word, meaning “To Know”. Then, I don’t know what what came over me, I took computer Science, may be because I admired computers too. I knew totally nothing about computers and programming two years back, and that’s why I struggled to adapt to new world. But thanks to my curious temperament, I got interested in the subject very soon, started to relate programming with any other daily life stuff. And when I get to know about their architecture, my vision becomes more clear.

Why do I Care!

Now, Why do I care to struggle with this new alien stuff, I could have let it go and don’t go any deeper, but yet I did. You know why? Physics, it is. As I said, I always admires the science behind nature or anything else, when I entered this new alien planet, I started to ram my head to get into it, then slowly with time, when I adapted a little to it, my Physics temperament woken me up.

I started to wonder how, these computers (and not only computers but every electronic equiment) can do this mountains of stuff, just by utilising electricity. My Physics understanding tells me that, electricity is nothing more than flow of electrons, then how these small electrons can do these massive job. Million dollar question, Isn’t it? :)

With the advent of little more time and little knowledge of Computer Architecture, I started to understand how these electric pulses can do wonders in computers. And this is the time, I started to care even more to dvelve into this alien planet. This computer ICs and various electronic components can maipulate these electricity pulses (0s and 1s), how these 0s and 1s can be fed to computers to do what we want.

My Journey/Struggle

Now, you all might have got it right by now, I care about programming more than ever because it relates two crushes of mine (Physics and Computers). So, you might have a question by now, how smooth my journey is? Well, not so smooth and I don’t think any of had this smooth journey, because learning anything new will never have a smooth journey and will have very large hurdles in between. Many a time, you might want to quit it at all.

Once I realised what is in the computers that keeps me going to learn it i.e “Physics behind computers”, I was good to go. I made a list what I love and how will I learn those and just start picking the items off the list.

  • My Journey starts with a programming language named C, one of the universal language they teach in the graduation to build your concepts.
  • Then I encounter these online programming websites and I got more excited. But, wait I couldn’t solve any question and that makes me more sad.
  • There comes the Data Structures at rescue and voila, I could solve some problems now.
  • I am also a Math Lover, so it helped me a lot too.
  • Then Computer Architecture enlilghtened me a little about cpu, and I decided to make my own computer (which I haven’t started yet).

Now, Hurdles. The biggest hurdle for me to cope up with my friends, they all in development phase and I was still in learning phase. Besides, they neveer cared about the miniscule details of computers and I cared about computers only because of these 0s and 1s.

It took me a while to understand that, I am different and Yes, I am on a different path. So I stopped worrying about them anymore. You know I am a late bloomer. I also understood one thing, that learning this low level stuff is much more difficult to learn than those API stuff, because there’s not much guidance you can get in this field.

  • Now, I started to developed kernels (low level computation stuff) and I am glad with.
  • Soon, I gonna build my own computer from very scratch.

So, Wait for it.

Thanks for being with me!

by Abstract Learner (noreply@blogger.com) at July 15, 2017 06:14 PM

July 14, 2017

Ashwani Kumar Gupta

Feed-River: A river of feed not water

Why yet another feed reader?

On 27th June, 2017 Kushal took a session on #dgplug and we were supposed to give the link to our newly created blogs so that they can be added to the dgplug student planet. I was very excited for this as this was the first time I wrote a blog and wanted to share this with other people. Kushal asked all students to enter their feed url and name on a shared document. When I heard the words feed and url I was like what is this feed URL?

Later in the session, when answering a question about why are we adding the feed URL and not the direct link, he told us to read the Wikipedia page of RSS. Then I understood a feed is nothing but a data format which serves us with the updated content in the web and RSS is such a type of feed (web feed). There are also other types of feeds such as Atom feed. One can just add a bunch of feed URLs of different websites to a feed aggregator application and read all the updated content from all of the sites on a single webpage (Isn’t that cool?). Our dgplug student planet is such a feed aggregator.

I have a wordpress blog so I just had to append /feed after the URL of my blog to get the RSS feed URL. I opened the feed URL on my browser and saw an XML file came up. I didn’t understand the mechanism of feed aggregators very well so I decided to make my own feed reader and learn as I make it.

About Feed-River

So finally after few days I was able to make Feed-River (a feed reader of my own) which takes a feed URL from the user and displays all of its posts. Here is a screenshot of it. sdadas

I used PHP and the bootstrap framework. Feed-River works in the following steps:

  • First it validates if the given URL is a correct feed URL or not. If not, you will get an error like shown below. So you can also use it as a feed validator.

asdaafaf

  • If a correct feed URL is entered, it will then fetch it and parse the XML file.
  • From the XML file then only the necessary information i.e. the posts are extracted.
  • The posts are displayed in reverse chronological order so that latest post is displayed first.

As of yet, the Feed-River is not very useful since it doesn’t allow to read the feed from multiple URLs. I plan to add the feature in future. Jason Braganza also helped me with an idea of automatically identifying the feed URL from the direct link of the website. I think this is a nice idea and will try to implement it in future. If you want to look at the code, here is the github link to the repository. Feel free to fork the repository or suggest any idea 🙂

I should thank Kushal for the explanation of working of RSS and Jason Braganza for helping me with the name (naming is such a tough job thank god Jason is here :D). I got to learn many things by making this mini app like mechanism of feed aggregators, different types of web feeds, XML structure, XSD, DTD etc. Thanks for reading 🙂

P.S – If you are also new to XML and want to explore XML here is an awesome MOOC


by Ashwani Gupta at July 14, 2017 02:05 AM

July 13, 2017

Kshithij Iyer

"2 States is it? I have been through 3 still couldn’t find her. These stories make is so easy a boy..."

“2 States is it? I have been through 3 still couldn’t find her. These stories make is so easy a boy and a girl meet in college and fall in love. How do they get time to fall in love when you have so many assignments, tests, vivas and other stuff!”

- Kshithij Iyer

July 13, 2017 04:29 PM

Not bad for a first time. #Paneer_bhurji (at Pune, Maharashtra)



Not bad for a first time.
#Paneer_bhurji (at Pune, Maharashtra)

July 13, 2017 02:46 PM

Kshitij Kumar

Who are hackers and What is Hacking ?

I was reading “Free as in Freedom” suggested by Kushal on the #dgplug channel on IRC. We also had a session on “History of Free Software Movement” on Monday”. I bookmarked the page at that time and thought to give a read in free time.

After reading the book, I was surprised and disgraced at the same time that we have no knowledge of the history of this computer science world and even we never tried to know.

So,  I will start with short Introduction of the book. This book is “biographical snapshots of GNU project founder Richard Stallman with the political, social and economic history of the free software movement. This book examines one man’s 20-year attempt to codify and communicate the ethics of 1970s era “hacking” culture in such a way that later generations might easily share and build upon the knowledge of their computing forebears. The book documents Stallman’s personal evolution from teenage misfit to the prescient adult hacker to political leader and examines how that evolution has shaped the free software movement. ”

‘Hacker’, Whenever we read or find out this term, the image that comes to our head is “a person who secretly gets access to a computer system in order to get information, cause damage”. This is what we use to see in movies or media. This is definition by most of the dictionary we follow. But that’s not the fact.

According to Richard Stallman hack means “Playful cleverness.” Hacking meant playful brilliance.

Hackers amaze people with their intelligence and innovation. They gave life to novel ideas which people thought were impossible to do; to wrought into reality.

To understand the meaning of the word “hacker,” and to understand the hacker ethic culture, one should read this book.

This book beautifully explains how the terms cracking’,security breaking’ and prank’ mixed up and create a misunderstanding.  How the word ‘Hacking’ got the new definition as the time changed. That’s why writer of the book finished his writing with these lines

Using the term “cracking” rather than “hacking,” when you mean “security breaking,” shows respect for Stallman and all the hackers and helps preserve something which all computer users have benefited from: the hacker spirit.

After reading the book I can say “I am proud to be a hacker”

References:

  1. Kushal Das’s Article on “Hacker Ethic and Free software movement”
  2. Free as in Freedom

by Kshitij at July 13, 2017 10:53 AM

July 12, 2017

Mohit

The hacker-culture.










Hacker-Culture Session


Now, I am proud to be an hacker, especially knowing after how this hacker culture developed. Well, I am a part of a revolution, Hacker Revolution and I am very excited to be its part.

We had this session on an IRC channel #dgplug, which is a part of their summer training programme, and seriously what a great session it was. I still feel pumped up as if I was there by myself. I am glad to be a part of DgPlug group and most of all,I am glad to know someone like Kushal Das. I am not gonna explain everything that was explained to us by him, because only a good story-teller can connect you to the story as Kushal Das did and unfortunately, I don’t have this skill yet.

How it all started? From this simple recent tweet by Gnome and the following reply. Do have a look and think about these comments keeping hacker-culture in mind. :)

Interested…


If you guys really want to experience what I had experienced, just read thislog for the session we had on the channel or just hear it all by Kushal Das himself, read his blog.

Let me share the Kushal Das Quote:

“The history is important, Learn about it!”

I can’t put everything here on the blog, the history is really huge and very important part of hacker-ethic. It really explains allyou just read of the log here on the blog, but I can summarise the motive, As Far I Understood, “We humans should contribute to the society as one whole indistinct part and share what we learn with others for them to continue where we left. And that’s how, we humans, can improve and develop as a being.”

And every thing you just read is not just awesome but also something that every computer enthusiast should know. Kushal Das suggested us to read these two books:
    Hackers: Heroes of Computer Revolution
    Free as in Freedom


Now, I am really upset by myself not to pick books out of my wishlist because the first book he suggested was in my wishlist for over a year.But,

“Better Late, than Never.”

So thats all for now, my experience on Hacker-ethic/culture.

Hacked… :)


by Abstract Learner (noreply@blogger.com) at July 12, 2017 04:50 PM

Robin Schubert

free != gratis

Having a class on history of the hacker culture in the dgplug IRC channel has been highly interesting. Only within seconds after starting in 1955/56 with the TX-0 at MIT, my Wikipedia tabs popped up almost by themselves, going from TX-0 to Hacker to Hack Culture to Tech Model Railroad Club and Richard Stallman. By the end of the day I ended up installing FreeBSD and Plan9 on virtual machines on my laptop and began to explore those (what a weird thing, this Plan9, but interesting and consistent in concept)

Obviously, Richard Stallman had a great influence on hacker culture, the free software movement and actually on the working environment that I use right now and every day. After watching some talks and interviews, I realized that this guy really has the 100% freedom in mind (which ironically seems to be quite constraining), avoiding any proprietary software, but also boycotting a whole bunch of other services, tools, hardware and whatsoever if they violate against his philosophy.

Although I was a bit overwhelmed by the strict policy, I liked some of that thoughts initially. Like how he declares minified JavaScript to be proprietary software, because the code is not readable and you would need some reverse engineering to make sense of it. I also like his four essential freedoms (freedom 0, 1, 2 and 3) that finally helped me to understand that free software does not necessarily mean gratis software.

So I was interested in the OS and tools that are actually approved by Richard Stallman and found a good list here. I don’t remember how often I checked that box saying “install non-free packages” on my OS installations, without thinking twice even once. I will do now, and I think I might try out Parabola GNU/Linux and stay free, by staying propriety-free as good as possible. Judging from the post on stallman.org, not even he can manage to get the 100% he aims for; sometimes a trade-off is necessary until a better solution is found or created.

In the meantime I start searching and creating.


by schubisu at July 12, 2017 10:49 AM

Deepak Chethan

First Contribution!

I finally made an open source contribution! I feel amazing. It is not in the form of code though, I translated the contributor covenant to Kannada. To those who never heard of it, it is the most popular code of conduct for open source projects with over 30,000 adoptions. I submitted a pull request a couple of days ago and it was finally merged today.

I also started to translate the tokens of DuckDuckGo into Kannada language. As of now I’ll just stick translations and non-technical contributions for this vacation. 

Apart from that, I finally started solving problems on spoj. I solved around 5 of them. My aim is to solve at least hundred of them before the college starts.

I wanted to complete an Android app college syllabus app since a couple of months. I finally started even this. I’ll make it opensource and post the code on github, as soon as I complete the first version. That’s pretty much it.


by dodococo at July 12, 2017 07:10 AM

July 11, 2017

Mohsin Mumtaz

DIVSUM SPOJ

Today while solving one of the interesting spoj DIVSUM problem, I learnt quite a bit of trick to solve the factors for any given number with efficient time complexity.

The Problem:

  • Finding the sum of factors of n.

NOTE:: Sum of the factor of 1 is 0.

Ex: let n = 16

Sum of Factors of 16 = 1+2+4+8 = 15

 

Solutions:

  1. The brute force solution is very simple where sum of all the elements that are factors of n is calculated and stored in a variable

Python3 Code

sum =0
if n == 1
print(0)
else:
for i in range(1,n):
if(n%i)==0:
sum+=i
print(sum)

The problem with this brute force algorithm is, it takes O(n) time to compute for any value of n and grows in linear. There is, however, a better solution to it which takes O(sqrt(n)) time to compute the result and it takes less than half the iteration to find the sum of all factors of n.

There is, however, a better solution to it which takes O(sqrt(n)) time to compute the result which means, it takes less than half the iteration to find the sum of all factors of n.

Python3 code

sum =1
if n == 1:
print(0)
else:
for i in range(2,int(sqrt(n))+1):
if(n%i)==0:
if i == n//i:
sum+=i
else:
sum+=i+(n//i)
print(sum)

“`
The above solution iterates to sqrt of n, To know why to check just up to sqrt, visit this link: https://goo.gl/4V8oF3. And one amazing property about the factors are that if m is a factor of n, then n/m is also a factor of n. Using this property, I could solve the problem efficiently.
The later if statements are just to avoid summing m twice in case if m and n/m is the same factor.
Happy Coding 😀

by Mohsin Mumtaz at July 11, 2017 08:09 PM

Kshitij Kumar

Free software movement & Hacker culture

I will start this post with a quote by Kushal Das in between the session yesterday.

“The history is important, Learn about it!”

We had a session on IRC channel dgplug last night and the topic was “History of hacking and free software movement”.

The session started with this simple recent tweet by Gnome and a few replies

In this session, Kushal gave an inspiring talk on this topic, He told us about

  • TX-O computer at MIT lab,
  • How ‘Hacker Ethic’ word came into existence
  • The rise of Free Software Movement.
  • PDP – I computer
  • Richard Stallman
  • Founding FSF
  • Launching GNU
  • Open Source Initiative (OSI) by Bruce Perens and Eric S. Raymond.

Whenever we use Linux, or an open source software, Everything that we see today in Open source world, It all started with Free Software movement, which is about the freedom of users.

He also suggested us some books and resources to read about “History of hacking and free software movement”

  1. Free as in Freedom
  2. Hackers: Heroes of Computer Revolution
  3. A documentary “Revolution OS”

You can check IRC logs of dgplug here.


by Kshitij at July 11, 2017 09:25 AM

Kshithij Iyer

New wallpaper. Enough of VR46, I guess..



New wallpaper.
Enough of VR46, I guess..

July 11, 2017 07:11 AM

Jason Braganza

On Free & Open Culture; Some Resources

Note: This is for the Student Planet.
Please read this on the blog.

At the dawn of computing …


Last night, over at DGPLUG, Kushal gave quite a heart rousing talk on the history of Free Software, covering quite a bit about Richard Stallman and the events leading up to him (RMS, not Kushal) launching GNU & the FSF.

If you’re interested in reading more about that sort of thing, here’s a few more books & resources.

Free as in Freedom

The seminal book is of course, Free as in Freedom, on RMS’ life and the massive base he built, upon which we all stand today.
Reading this made me realise what a debt we owe to him.
So the next time we hear about how old & weird Stallman is, maybe we could cut him some slack.

The Groklaw Archives

Did you know, that the SCO Group once brought a case against IBM, suing them for using Linux?
It was a large, long drawn out affair, 1 drawing old heavyweights such as Novell and new upcoming ones like Red Hat, into the fray.
If SCO had won, it would have been the end, of the just barely decade old Linux and our landscape would not have been as rich as it is today.

We know all this, because of the daring and intrepid, Pamela (PJ) Jones, who started up one of the earliest blogs on the internet.
It was called Groklaw, and it was …

a place where lawyers and geeks could explain things to each other and work together, so they'd understand each other's work better2

It brought awareness of the case to a wide swathe of people and Linux into the mainstream.
The bar on the left of the site, gives you access to a whole lot of cases threatening Linux, and the news and views of the people in the know

A Quarter Century of Unix

A short, really influential book on Unix History by Peter Salus.
I don’t quite know how you can lay hands on a copy, but if you do, it’s fascinating.
Nearly every article, every blog post, every book that needs something on the history of Unix, pulls a quote from this one.

The Daemon, the GNU & the Penguin

Salus’ follow up book, following Unix History on to Linux, is available to read on the Groklaw website.
You can think of it as an expanded version of Kushal’s talk last night.

Open Sources

Want to hear from the people involved in the free software movement?
From the horse’s mouths themselves?
Open Sources is a collection of essays from the folks who were there.
Marshall McKusick, author of the BSD filesystem narrates how BSD went on to be free from AT&T ownership and Free as in Freedom.
RMS tells us about GNU himself.
Bob Young, founder of Red Hat, expounds on how the company set itself on the path to becoming a business on the back of free software.
Linus, tells us of the edge, Linux had, to become successful.

Producing OSS

Karl Fogel’s book, on why we write free / open source software and how to pitch it in your organisation

This is all that comes to mind, right now.
If you know more, let me know or write about and I’ll update the page or link to yours.


Updates:

In the Beginning was the Command Line

Neal Stephenson’s essay on why Free Software would eventually win. (chock-full of history and analogy)
It’s dated and hasn’t quite panned out as he wished, but is still a fun read!

  1. Even though SCO is dead, the case is still ongoing.

  2. from the FSF article at http://www.fsf.org/news/2007freesoftware_awards

by Mario Jason Braganza at July 11, 2017 12:20 AM

On Free & Open Culture; Some Resources

Note: This is for the Student Planet.
Please read this on the blog.


At the dawn of computing …


Last night, over at DGPLUG, Kushal gave quite a heart rousing talk on the history of Free Software, covering quite a bit about Richard Stallman and the events leading up to him (RMS, not Kushal) launching GNU & the FSF.

If you’re interested in reading more about that sort of thing, here’s a few more books & resources.

Free as in Freedom

The seminal book is of course, Free as in Freedom, on RMS’ life and the massive base he built, upon which we all stand today.
Reading this made me realise what a debt we owe to him.
So the next time we hear about how old & weird Stallman is, maybe we could cut him some slack.

The Groklaw Archives

Did you know, that the SCO Group once brought a case against IBM, suing them for using Linux?
It was a large, long drawn out affair, [1] drawing old heavyweights such as Novell and new upcoming ones like Red Hat, into the fray.
If SCO had won, it would have been the end, of the just barely decade old Linux and our landscape would not have been as rich as it is today.

We know all this, because of the daring and intrepid, Pamela (PJ) Jones, who started up one of the earliest blogs on the internet.
It was called Groklaw, and it was …

a place where lawyers and geeks could explain things to each other and work together, so they'd understand each other's work better[1:1]

It brought awareness of the case to a wide swathe of people and Linux into the mainstream.
The bar on the left of the site, gives you access to a whole lot of cases threatening Linux, and the news and views of the people in the know

A Quarter Century of Unix

A short, really influential book on Unix History by Peter Salus.
I don’t quite know how you can lay hands on a copy, but if you do, it’s fascinating.
Nearly every article, every blog post, every book that needs something on the history of Unix, pulls a quote from this one.

The Daemon, the GNU & the Penguin

Salus’ follow up book, following Unix History on to Linux, is available to read on the Groklaw website.
You can think of it as an expanded version of Kushal’s talk last night.

Open Sources

Want to hear from the people involved in the free software movement?
From the horse’s mouths themselves?
Open Sources is a collection of essays from the folks who were there.
Marshall McKusick, author of the BSD filesystem narrates how BSD went on to be free from AT&T ownership and Free as in Freedom.
RMS tells us about GNU himself.
Bob Young, founder of Red Hat, expounds on how the company set itself on the path to becoming a business on the back of free software.
Linus, tells us of the edge, Linux had, to become successful.

Producing OSS

Karl Fogel’s book, on why we write free / open source software and how to pitch it in your organisation

This is all that comes to mind, right now.
If you know more, let me know or write about and I’ll update the page or link to yours.


Updates:

In the Beginning was the Command Line

Neal Stephenson’s essay on why Free Software would eventually win. (chock-full of history and analogy)
It’s dated and hasn’t quite panned out as he wished, but is still a fun read!


  1. from the FSF article at http://www.fsf.org/news/2007_free_software_awards ↩︎ ↩︎

by Mario Jason Braganza at July 11, 2017 12:20 AM

July 10, 2017

Mayank gupta

Reasons why Linux/Fedora is love.

I was introduced to Linux (Fedora 21) by my elder brother when I was in class 11, since then It’s been 4 years running and I’m in love with Fedora. Like I’ve changed 2 laptops in 4 years and both of them are running on the latest release Fedora 25.

Drawbacks of other market leading OS as compared to Linux:

1. Coming to Windows, no doubt Windows has changed our life and made things easier over years and will be making changes in the coming future. But, there are many drawbacks of using a Windows OS. Firstly, it always has the risk of malware and virus, one simply doesn’t know when his PC is full of viruses which can infect your system seriously. Though there are means to counter virus attacks by installing antivirus softwares and updating there virus definitions over time to time. But then you have to pay for those softwares and keep on renewing those softwares for years to come (P.S. I don’t like spending money on antivirus, rather save them and spend on food <3). Customers can feel the difference on pocket, buying a windows PC with an official license causes around 4k to 5k more than a Linux powered PC and there are alot of hidden charges like the renewal of the pre installed antivirus on your PC and the office suite’s renewal also. Finally it leads to a nice amount of extra charges one has to buy with his windows PC. (I don’t hate Windows though as I love playing games). And another drawback of windows being that they have distributions like Home basic, Business edition and Ultimate, each of them cost different and majority of the PC ship with either Home basic or Business edition which do not have all the features.

2. Coming over to Mac OS,  Apple tends to ship their official OS only with their devices which they promise are more efficient than Windows and so is their rivalry. But coming to the drawbacks as per my opinion Mac devices are at very high price points and end up exceeding your budget. Apple products have high security and lack of sharing options between PC’s 😦

NOTE: By writing these points I didn’t mean to hurt your feelings nor did I challenge Microsoft or Apple . So please do not try to kill me or put negative comments 😦

Coming over to why linux is better:

  • Open Source: Who doesn’t love free things and everyone love it more when they get the best things free (Just imagine won’t you love it if someone gives you a large cheeseburst pizza for free?). Yes! obviously Linux is all open source. You can take a look at the source code if you want to and its all free, no hidden charges and you can have as many pizzas as you want. Isn’t it great?
  • Secure: Accept it, many of you have faced a virus attack on your windows PC (Yes, virus don’t infect my system, I use Linux). Wondering how Linux is more secure? Its just the way Linux treats every file, the process of package management, the concept of repositories, and a couple more features makes it possible for Linux to be more secure than windows.
  • Best for programmers: Linux supports all the major Programming language, it’s not that windows doesn’t but it’s that the Linux terminal is far superior to the windows command line. Interestingly, the ability of bash scripting is also one of the most compelling reasons why programmers prefer using Linux OS.
  • Variety of Distributions: Will you not get bored eating the same flavour Ice-cream over and over again?, Yes, you will! That’s the problem with windows. It’s so singular, we just see versions of windows. But in case of Linux we get a ton of distributions like Fedora, Ubuntu etc. each of them having different UI and features.
  • Free to use: Yes, you heard it right its for free. You never have to pay 4k+ rupees to get a genuine windows and pay more to get hands-on to other features of windows. You get it for no charges at all, isn’t it great? You can always go to CCD or Subway or your favourite junk food station.
  • Community: The best thing about the Linux distros are that they have an awesome and most friendly community. You can always rely on them for answers and instant replies and free service 😛
  • Efficient system: Speed, reliability, User-friendly UI is everything one can ask from something free. Not like the windows system lagging and crashing Linux is good and uses very less resources to work and so is always fast. Another fact that proves Linux to be reliable are the web servers. You could observe that most of the Internet giants like Google and Facebook run on Linux. Even almost all of the supercomputers run on Linux. So, Why isn’t Windows preferred over Linux? It is because Linux is far more reliable than Windows OS. Period.
  • Privacy: Windows collects your data over time and saves it in their server, believe me windows collects every data and most of you don’t even know about this. But, its not that windows is not secure but you have your own privacy so think and choose. And, you always have a risk of any hacker getting all your data and you don’t even know what will happen after that.

Now coming to my personal favourite Linux distro : FEDORA

Why is Fedora my favourite?

I started with Fedora 21 as mentioned earlier, then on reading about Linux I jumped to other distros like Ubuntu and Kali linux, considering their fame. Idk why but I kept on running back to Fedora. It was just that I was so much into Fedora that it took me alot of time understanding the algo behind Ubuntu and personally didn’t like Kali at all. Fedora gave me the best experience whereas it took me a week to use Ubuntu at its best and knowing all the features it comes with (I still don’t know all of them). And so my love for Fedora increased day after day and finally I’m writing a blog about it.

For knowing about the security features refer: https://fedoraproject.org/wiki/Security_Features?rd=Security/Features

Conclusion : I love FEDORA and will be using it till when I also have no idea about. I have no personal hatred against any other OS neither am I trying to downgrade any OS. Its just that Linux is better and Fedora is the best distro.

NOTE : If you still hate me and Fedora after reading this, just remember Linus Torvalds uses Fedora. (I just trolled you and you are angry and want to kill me most probably).

Don’t worry I know that one day those who don’t like Fedora will regret not using it 😦 Let us take a 1 minute break to pray for them.

NEWS : There is a special reason i’m writing this blog today on 11th July. Today Fedora is releasing the newest ans most stable and secure version Fedora 26 *_*

Keep supporting if you like this blog.

 


by mostrandomrichard at July 10, 2017 08:55 PM

Kshithij Iyer

Aniket uttam

WCKanpur’2017

I am also a part of wordpress kanpur community and now i start contributing in wordpress .

Python

Hello Kanpurites !

As you know Wordcamp Kanpur will be on 9’th July in Rangoli at Kanpur. So be ready guys for an energetic event . This is golden opportunity for Kanpurites specially Students , Developer , Newbie who don’t know much more about WORDPRESS. Some people are still curious and want to know more about WORDCAMP . like ;

WordCamps are casual, locally-organized conferences covering everything related to WordPress. These events are organized, paid for, and attended by the local WordPress communities in accordance with guidelines published at WordCamp.org and the principles of the WordPress Foundation. WordCamps include sessions on how to use WordPress more effectively, beginning plugin and theme development, advanced techniques, security, etc.

The first WordCamp was organized in San Francisco by Matt Mullenweg in 2006, and since then local communities around the world have organized hundreds of others.

WordCamp should be attended by everyone who uses WordPress, and everyone who wants to know…

View original post 157 more words


by aniketuttam at July 10, 2017 08:57 AM

July 09, 2017

Samridhi Agarwal

#dgplug

Firstly I got to know about this program during the Pycon Pune event and as i was totally new to these things, I felt like a lone dumb in the whole community as i used to struggle with every simple thing which other people did very easily. So in the devsprints one of the guy told me to join #dgplug to learn from basics about the computer ethics and using linux properly.

I just filled a form but then also I was not having any idea about what really irc is and how to connect and all these questions appeared so lame to stand and ask them. I tried searching but still was not that clear with the concept of internet relay chat and how to really use it but then a week ago a mail came to download xchat to start attending sessions on #dgplug by using internet relay chat. Then i was pretty clear with the concept and joined the summer training session where everyday we learn new things like converting markdown to html, then biggest surprise was the session on git( That was the first time i actually understood what git is. How to contribute step by step and how to contribute in other projects then making branches  and the actual difference between git and github).

Till now i am really enjoying a i now know how to use vim and github and i am not going to make my fool in the next pycon with these pre-required knowledge of few things.

And yeah pycon 2018 is already on the calendar! Excited for it.


by samridhiagarwalblog at July 09, 2017 12:16 PM

Vipin kumar

A program to find subtraction of two number

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sub;
printf(“enter first number”);
scanf(“%d”,&a);
printf(“enter second number”);
scanf(“%d”,&b);
sub=a-b;
printf(“the subtraction is %d”,sub);
getch();
}

or

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sub;
printf(“enter both number  number \n “);
scanf(“%d%d”,&a,&b);

sum=a-b;
printf(“the subtraction  is %d”,sub);
getch();
}

or

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf(“enter both number  number \n “);
scanf(“%d%d”,&a,&b);
printf(“the subtraction is %d”,a-b);
getch();
}

 


by kumar vipin yadav at July 09, 2017 11:55 AM

Samridhi Agarwal

What is Kernel?

There was a Kernel meetup last week at Reserved bit, but the only thing that popped in my mind after hearing the word kernel is it’s the core of a computer, the only information that i was knowing till my second year but then after i got the invitation of this meetup my mind was blocked by the thoughts that can we really change something in the kernel of a computer because according to my mindset i was in the dilemma that kernel is something fixed in a computer and one can not change anything in this. So again their was question about what are we actually going to do in this meetup like are we going to just study what a kernel is ? and how is it build or what are its specification?

So, I thought of attending a session and then get a brief overview of this. So for that week i was searching stuffs about kernel but because of a tragedy, Indian traffic I was not able to reach that meetup which was so heartbreaking but their the session was live on YouTube. I went home and learn about few things but was not able to figure out much.

At least I got to learn very basic things like shell is interface between user and kernel. Then about the types , uerspace processes etc.

Looking forward to learn more about kernel, if their is not a risk of destroying my machine. 😛

 


by samridhiagarwalblog at July 09, 2017 11:49 AM

Vipin kumar

A program to find sum of two number

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum;
printf(“enter first number”);
scanf(“%d”,&a);
printf(“enter secand number”);
scanf(“%d”,&b);
sum=a+b;
printf(“the sum is %d”,sum);
getch();
}

or

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum;
printf(“enter both number  number \n “);
scanf(“%d%d”,&a,&b);

sum=a+b;
printf(“the sum is %d”,sum);
getch();
}

or

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf(“enter both number  number \n “);
scanf(“%d%d”,&a,&b);
printf(“the sum is %d”,a+b);
getch();
}

 


by kumar vipin yadav at July 09, 2017 11:47 AM

Using of operator (A demo)

Using operater==>>
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum;
printf(“enter first number”);
scanf(“%d”,&a);
printf(“enter secand number”);
scanf(“%d”,&b);
sum=a+b;
printf(“the sum is %d”,sum);
getch();
}
hear we use + operater between two variable a and b in sum.
the name of all the variable are given by us.
you can give any other names to the variable.


by kumar vipin yadav at July 09, 2017 11:42 AM

Mohit

My First Meetup, PyDelhi









My first PyDelhi Meetup



Today, I attended my very first meetup PyDelhi. So I am going to share my experience about the meetup with you all.

Since it’s going to be my very first meetup, I was really excited for this to be happen. I woke up early to reach there on time and voila, like everything, we want nothing goes wrong with, and then there it is, boom. I got late, I don’t know how but on reaching the venue I found I was much early.

Now, here comes the experience. I reached there (at Innovaccer) and I really started to appreciate the word “Meetup”, I met two guys over there, Utkarsh and Varun, both were the alumini of “IIT-Delhi” and are working on their startup “Attentive-i”. Then, the event started at around 12 noon.

Event started with Introductions, where everyone introduces themselves and then few presentations with some discussion was there.



“Web-Crawlers Using Python” by Sahil.


He explained what a Web crawler is, its use and then he showed us a basic Webcrawler made by himself in Python live, in Action. Here is the github repository of the presentation and webcrawler itself.


“Numpy and Matplotlib” By Tanya.


She was the only girl present in the talk, and give the presentation on Numpy and Matplotlib. She depicted some of their uses and showed them live in action.


(We had a small product pitching by Mr. Ashish on Just Rokket.)



“Real-Time Push Notification” By Rahul Gaur

He introduced us about himself and push notifications. Then, he showed us his code for real time push notifications.


(We had a small break for tea and snacks. Which is good cause this was the when meetup started to make sense. Meet up new peoples.)


“Mercurial: Version Control System” By Pulkit.


He introduced us all with the concept of Version Control System. He also introduced us to the Mercurial, a Version Control System, Had a great discussion on Git vs Mercurial and why one should switch to Mercurial (being easy) from Git.


And That’s all! Official end of my first meetup at around 4pm.


That was about how the event started, took place and ended. Now, back to me, Did I meet new peoples? Yes, Sure I did. Well didn’t meet all those new people, but some 2-4 people. And I also met one of my DgPlug Summer Training 2017 Classmate: Championshuttler. Now, next time, I’m gonna meet all those new people and have some new friends.


All in all, That was a great experience.


by Abstract Learner (noreply@blogger.com) at July 09, 2017 07:07 AM

July 08, 2017

Vipul Gupta

The Art of Not Giving a Fuck

Ok, the title might say it out loud but for some, I am gonna whisper something here content advisory. This is me on the subject of “Not Giving a Fuck”. So whosoever might you be, don’t get offended. If you do by any chance, I don’t give . …. One life changing article coming through (10-minute read)

 

“So, this might be long, don’t adjust whatever device you are reading this on, This is Vipul Gupta writing over one of the most special topics of his life that he learned over the course of 1st-year college. People path to greatness in Mixster begins from here.”

Edited from 13 Reasons Why

Here’s a short story about a guy named V.

V is a shy, introvert kinda guy. V is a geek and physically non-existent in a classroom. Before starting college, V decided to change, to transform himself, into somebody he always dreamed to be (*whispers* Chandler). But there was a little self-esteem and confidence issue. What will other people say or think about me, was his problem.

So he decided to make a shield for himself. One made out of sarcasm and humor. Making everyone laugh. Uncaring of what people thought about him. But with sarcasm comes great responsibility of sometimes taking the joke upon yourself. And he did with pride.And there he started to “not give a fuck” (point to be noted, my lord). V just didn’t give a fuck, over anything that happened. His friend didn’t invite him for a party. Not give a fuck. People trolled about him. Not give a fuck. People bitched about him. Oh thank you, dear but he didn’t give a fuck.

The only thing V valued was his peace of mind and the opinion of his friends. It almost became harder, for him to give a fuck about anything. Why should he,  he always thought. His fucks were precious. And to be used in the most fuck worthy of situations. And that’s …

End of story

giphy

Pandas are nature’s way of telling you to give fewer fucks in life, Be crazy, nobody cares.

Need to Bigger Picture this …

Not giving a fuck is a state of mind or a stance where only you matter and a handful others that you choose does. And nobody else.You just choose to not care about them.This could include other people or a particular situation that you think matters but actually don’t and never would

Whatever they think, say or shout doesn’t matter to you. You don’t care. If somebody is cheating on you, betraying you. Is that person really worth to give a fuck about. If your friends don’t care about what you think, then are they worthy of your attention. Hell, sometimes my friends ignore me. I am not saying become a saint and leave this world and its hardships. But I say ” man up or woman up look them or the situation in the eye and say I don’t give a fuck about you”. I just don’t care.

Your fucks matter and whom you are giving them to matters. I used the word fuck about 39 times in this article and I don’t give a fuck about it. Why should I ? #copied. This is an art that everyone should master. There are just too many things out there to give a fuck about and your ex’s new profile picture shouldn’t be one of it. People tend to see the strongest and the most admirable people to be the ones who don’t give a fuck. Like Rahul is bunking classes again . That guy just doesn’t give a fuck or Pooja is wearing something weird again. She doesn’t give a fuck.

Life becomes easier and better

Think about it for a minute here. What if no one liked your recent picture you posted. What if no one returns your calls ? What if no one messages to ask you about your awesome weekend ? What if you are single and nobody is interested in you ? What if someone makes fun of you ? What if someone you really liked, started ignoring you for no reason at all ? What if it is raining and you are worried about your clothes getting wet ? or you wanted to just dance in the rain but your friends didn’t so you didn’t ? What if there is an event you want to go but your friend won’t come along. Will you go alone? What if after a day there are 0 notification on your Facebook or Instagram account ?

You get the point right. If I want to dance I will, If nobody tags along with me, I will go alone. If nobody shows interest in what I am doing , I will either go beyond my circle or just start working alone. Being alone is not what I am recommending but when it is the only choice. Will you be brave enough to take it. Try it at least.

Afraid of being judged, I thought so …

People would always judge you, your entire life, that’s their fucking birthright. A big illusion is sometimes we feel people are judging us but they themselves don’t give a fuck about what you are doing. Just think all of them to be lazy couch potatoes and Internet trolls who have no life and instead feel awesome about yourself. Don’t be so over-conscious, for the love of god.   comparing.jpg

Let’s pro-con this thing.

Pros: Not giving a fuck increases your confidence and self esteem levels. I for that matter often feel contend with myself at some parts of the day. Example: I wore a red T-Shirt and jeans to a friend’s birthday party where everyone else was dressed formally. Fucks given what other thought. None. I liked that red T-shirt and I wore it. You often feel good about yourself as now you are not worrying what others are think about you. Pros you will figure out. Not too worried about that.

Now, cons – Living with this philosophy to not give a fuck about anything, would make you feel comfortable with anything in life. As even good criticism won’t bother you. If it did, you won’t show or express your feelings as your ego gets hurt that way. Emotions, other people’s well wishes, sentiments. Won’t get to you. You be a one man army. All alone. And as you have given no fucks in your life, now people don’t give a fuck about you. #karma #is #a #bitch. You might get too ignorant, too overconfident. Saying you don’t give a fuck but deep down you do, a little. But your ego gets hurt in accepting that. I want you guys to bigger picture yourself from time to time. This philosophy that you choose to follow ends up hurting the people close to you and driving them away.

MY nickel’s worth of advice :-

Give a fuck sometimes but don’t let it go to your heart – Nartia, my dear friend

Words hurt more than your actions. Trust me, saying that you don’t give a fuck to your good friend about something. Concerns them but won’t concern you a bit. Because caring less is good but caring for no one, that’s catastrophic. #deep #shit

1334813750213_1305074.png

So what’s it gonna be…

Lastly I want to say. Follow this, apply this in your life but don’t make it your motto. Don’t let it control you. But use it enough to make your life better. Get your fucks together and make them useful. Don’t just throw them away out like fucking sunshine on a beach.

I just see so many people that this would be helpful for. In a classroom, some people never speak up. Just in the fear of being judged or made fun off, trolled. I for one did. I was afraid to talk to other girls in my class. But not anymore. People that know me say I changed and it feels so good to hear every time,someone says that.  But then too I am not saying following this will make you the most desirable person ever but hell it’s the right step in that direction. I think that matters. What others think should never matter. Be brave for once and reach for it deep down. AND just say it. What worse could happen in your already shitty life.

Do whatever you like , post whatever you like, say whatever you like. Use Freedom of Speech as your personal toy and don’t give a fuck what the world thinks about you or what you do. Be free from the bonds that society has on you,and try to live a little.

I will leave you with this line from the article I gained my inspiration from :-

Then one day, on our deathbed, (hopefully) surrounded by the people we gave the majority of our fucks to throughout our life, and those few who still give a fuck about us, with a silent gasp we will gently let our last fuck go. Through the tears and the gently fading beeps of the heart monitor and the ever-dimming fluorescence encapsulating us in its divine hospital halo, we drift into some unknowable and unfuckable place.

Not giving a fuck since 2016-present. I see you improving already, 39 was just a random number, and you choose not to give a fuck about one less thing in this world. This is me not giving a fuck what you think about this articles but I love to see you comment and share this post. Thanks for reading.

DISCLAIMER – Important

The author in real life is not as abusive as portrayed here. He’s a simple guy who feels strongly about this issue. That’s all. Please don’t judge him and if you still do. He would like you to know that he might just care. A little. Just kidding. Judge all you want. That guy does not give a fuck.

I am just a college kid though, these scenario I based my examples upon are a bit basic as to say. Real challenges are yet to come. It’s just that people my age would relate to it better. We require this more than anybody in the world of Snapchat and Facebook and 10 other social media sites. Which just beg you constantly to give a fuck about fucking everything.

Also do ping me if there are any doubts regarding this. And again as a warning telling you guys, getting to comfortable with the fact that you don’t give a fuck about anything  sounds good but it’s not. Really you are hurting the people closest to you and that’s one thing in my book, you shouldn’t be doing. CONTROL is necessary. Your fucks are precious. Get your fucks together. And Give a fuck sometimes.

*drops mic*

Footnote:

A good friend of mine shared this one fine day and made me realize something deep inside me. The guy who wrote a book about this called The Subtle Art of Not Giving a Fuck  (The coolest thing you ever read just after my blog) I recommend this to everyone and I personally love him to death. Check him out.

28257707-_uy400_ss400_.jpg

And you thought I was joking.

 

 


by Vipul Gupta at July 08, 2017 03:30 PM

Jason Braganza

On RST


Learnt about RST markup last night.
And if you’ve forgotten what markup is, read this.

Easy to learn, easy to use.
Feels like a superset of Markdown, which I’m using to write this note.
A fitting analogy, methinks, would be a supercharged text editor vs an IDE.

First doubt I had was, where’d I use it? Markdown’s already pretty handy.
And then I realised, I should use the right tool for the right job.
While Markdown’s pretty nifty at writing, there’d be times where I’d need to go beyond what it can do.

The first thing that came to mind, was documentation for software projects, which I help out with, quite a bit now.
That’d require a more fully featured, pretty formalised way of writing Markdown, if lots of people, using lots of different systems were to use it.
So, a better idea’d be to let Markdown be Markdown, and use something else, better suited.

And that’s where RST comes in.
Formal, Featured, Extensible, Easy.

Here’s a quickstart primer.
And I found this dingus to practice with. Pretty handy.

by Mario Jason Braganza at July 08, 2017 03:17 AM

On RST


Learnt about RST markup last night.
And if you’ve forgotten what markup is, read this.

Easy to learn, easy to use.
Feels like a superset of Markdown, which I’m using to write this note.
A fitting analogy, methinks, would be a supercharged text editor vs an IDE.

First doubt I had was, where’d I use it? Markdown’s already pretty handy.
And then I realised, I should use the right tool for the right job.
While Markdown’s pretty nifty at writing, there’d be times where I’d need to go beyond what it can do.

The first thing that came to mind, was documentation for software projects, which I help out with, quite a bit now.
That’d require a more fully featured, pretty formalised way of writing Markdown, if lots of people, using lots of different systems were to use it.
So, a better idea’d be to let Markdown be Markdown, and use something else, better suited.

And that’s where RST comes in.
Formal, Featured, Extensible, Easy.

Here’s a quickstart primer.
And I found this dingus to practice with. Pretty handy.

by Mario Jason Braganza at July 08, 2017 03:17 AM

July 07, 2017

Jason Braganza

Progress Posts

Now that I’ve gotten in to a groove, I should start writing notes on the progress that I make.

Or beware, here be dragons, notes to myself.

This post kicks such stuff off.

  • Gtypist to increase typing speed.
    Horrible at it now, will slowly increase the pace.
    Nothing to it, but deliberate practice.
  • Vi. Will just practice a little more and stop.
    Don’t like it, but it is pretty handy.
    Can zip in and out of files pretty fast now.
  • Git. Now this; this right here is where my focus is.
    Will give this two weeks to get at least conversant with it;
    if not competent at it.

Onwards.

by Mario Jason Braganza at July 07, 2017 05:15 AM

Progress Posts

Now that I’ve gotten in to a groove, I should start writing notes on the progress that I make.

Or beware, here be dragons, notes to myself.

This post kicks such stuff off.

  • Gtypist to increase typing speed.
    Horrible at it now, will slowly increase the pace.
    Nothing to it, but deliberate practice.
  • Vi. Will just practice a little more and stop.
    Don’t like it, but it is pretty handy.
    Can zip in and out of files pretty fast now.
  • Git. Now this; this right here is where my focus is.
    Will give this two weeks to get at least conversant with it;
    if not competent at it.

Onwards.

by Mario Jason Braganza at July 07, 2017 05:15 AM