Summer training students' planet

October 16, 2018

Abdul Raheem (ABD)

Guest Session by warthog9(IRC Nick) And Emacs Sessions by shakti kannan(mbuf IRC Nick).

Hello, world!

Feeling really good to be back on writing my blog again after about 1 – 1.5 month. As I said in my previous one(blog) that I got busy with my college work and missed pyconindia and the chance to meet people who are interacting at dgplug and also obviously chance to meet the mentors as well 😔 and am still busy with it but I thought I should make up some time for this and learning something which is better for my future not just literally byhearting each and every answer and writing in the exams and nothing more important than that and one thing I was really missing was Jason Braganza’s comments on how to improve my blogs 🙂 , So basically I have gone some 3-4 logs of emacs in that I got to know about many commands in it, so I will just give a clear clarification about what commands I got know and I cannot type each and every commands here it will become very lengthy blog and I don’t want to make it a lengthy one I will leave a link to the dgplug logs there you can find all the 10 blogs related to emacs from date 16-Aug-2018, I got to know about some basic commands like to open emacs from terminal type emacs -Q, In emacs if you want to copy some thing type c-y(c stands for “Control key”) and to move to end of the line type c-e and to move to beggining of the line type c-a and to move one sentence forward type M-e and for backward type M-a(M stands for “Alt key”) and to move forward one paragraph type M-} and for backward type M-{ and to save a file c-x c-w and to save a file type c-x c-f these were some of the basics commands that I remember again do check the dgplug logs to know more commands.

Buffer commands:
The next thing I got to know is buffer commands and everything is a buffer in Emacs. You could even have a chat on IRC channel or composing an email or writing code everything is a buffer. I will mention some which I remembered and again do check the logs for more information on everything. If you want to switch to another buffer type c-x b and you can come back again to the scratch buffer using c-x b and you can display the buffer using c-x c-b and you can close all other windows using c-x 1 and you can rename the buffer using M-x and you can save a buffer to a file using c-x s and you move the cursor to the next window using c-x o and many other buffer commands.

Window commands:
The next thing is window commands and again I will mention some of them do check the logs for more info, If you split a window horizontally type c-x 2 and if you want to delete current window not the buffer or file type c-x o and you can enlarge the window using c-x ^ and if you want to scroll the text in the other window type c-m-v and many other window commands.

Frame commands:
The next is frame commands, If you have a large screen you can open multiple GNU Emacs frames. You can create one using c-x 5 2 and you can move the cursor between frames using c-x 5 o and if you want to find a file in the new frame type c-x 5 f these were some basic frame commands and I have to through the rest logs and you can go through all of them as I have mentioned above with a link to all of those logs from day 1.

In between of this emacs sessions there was the guest session by warthog9(IRC Nick) I don’t know his name but it was really an interesting one (Link to that session). He gave some amazing suggestions and said one story which was also amazing :). These are some of the suggestions given by him when Kushal Das asked him to give to his students.

His first suggestion was obviously to get some virtualization software running somewhere, KVM/Qemu is free if you are comfortable with Linux.
If you have a mac or windows or Linux VMware has good options(Full disclosure: He works for Vmware).
but it is something interesting to try setting up and playing with owncloud/Nextcloud (doesn’t really matters which), squeezebox or another music jukebox kinda server do up a window file sharing setup(samba specifically).
once you have samba working, figure out how to export the same directories via nfsv4.
Setup some modern website with nginx or apache and you would even run containers to get it all working, but that could be a bit advanced, but it would be a good learning opportunity.
Once you have the above things ready, go play with collected and grafana and collect some interesting statistics and graphs from your other VM’s and seeing pretty graphs about how your machines are doing is always helpful.
Happy learning 🙂

by abdulraheemme at October 16, 2018 07:35 PM

October 09, 2018

Mohit Bansal (philomath)

Internet Relay Chat!

This blog post will cover the basics of IRC (Internet Relay Chat) and who should use it. It's been a long time since I first used IRC and it was not very pleasing experience at first. And now, I use IRC as my primary mode of communication. I won't be suprised if you haven't heard of IRC yet and even if you heard of it, never tried it. I know what are you thinking right now, "IRC, stupid, eh!".

by Abstract Learner (noreply@blogger.com) at October 09, 2018 04:48 PM

October 04, 2018

Siddhant N Trivedi (sidntrivedi)

A lot to learn.

There is an ocean of knowledge lying in our hands in the present world and learning just a teensy bit of it takes a lot of hard work and dedication. Thus, will try to work hard to learn Javascript and Rails simultaneously. I will also be doing some Data structures...

October 04, 2018 07:00 AM

September 29, 2018

Piyush Aggarwal (brute4s99)

Trying Hard

So, as of today, my tickets to Bangalore have successfully canceled.

I don’t know what to say, guess you just cannot turn the fate’s tide.

Going to read CPython documentation and go through the codebase tonight.

At IRC yesterday chandankumar, sayan and championshuttler all tried to explain me how important it is to start small.

Will try to read documentation and scrutinize. 🙂

Signing off

by brute4s99 at September 29, 2018 12:36 PM

September 14, 2018

Vaibhav Kaushik (homuncculus)

Custom Live Ubuntu

This blog is about making a live CD/DVD from the main system on your hard drive. This is useful if you want to build a clean live CD, or if you want to build a minimal rescue CD. We used it to create a beginner friendly wargame to introduce Linux to everyone. The theame was similar to that of Bandit with very elementary Linux commands and only 11 levels.

by Vaibhav Kaushik (vaibhavkaushik@disroot.org) at September 14, 2018 12:42 PM

September 12, 2018

Ratan Kulshreshtha

Workstation Setup Using Ansible

I use Fedora on my Dell Vostro 3560, and I have a habit of reinstalling fedora whenever new version of Fedora is released thus I have to install many things in my machine and configure many things again and again and sometimes I forgot something to install or sometimes I forgot to configure something so I asked myself is there a way to do this in a way which is immune to human errors or how can I automate all this ?

September 12, 2018 05:54 AM

September 10, 2018

Jaydeep Borkar(jaydeep)

Introduction to Natural Language Processing, Part 1.

Hello folks, I’ve just started my NLP journey and will be happy to share my learning process with you. Here’s an article regarding Introduction to Natural Language Processing.

The essence of Natural Language Processing lies in making computers understand our natural language. That’s not an easy task though. Computers can understand the structured form of data like spreadsheets and the tables in the database, but human languages, texts, and voices form an unstructured category of data, and it gets difficult for the computer to understand it, and there arises the need for Natural Language Processing.

There’s a lot of natural language data out there in various forms and it would get very easy if computers can understand and process that data. We can train the models in accordance with our expected output in different ways. Humans have been writing for thousands of years, there are a lot of literature pieces available, and it would be great if we make computers understand that. But the task is never going to be easy. There are various challenges floating out there like understanding the correct meaning of the sentence, correct Named-Entity Recognition(NER), correct prediction of various parts of speech, coreference resolution(the most challenging thing in my opinion).

Computers can’t truly understand the human language. If we feed enough data and train a model properly, it can distinguish and try categorizing various parts of speech(noun, verb, adjective, supporter, etc…) based on previously fed data and experiences. If it encounters a new word it tried making the nearest guess which can be embarrassingly wrong few times.

It’s very difficult for a computer to extract the exact meaning from a sentence. For an example – The boy radiated fire like vibes. The boy had a very motivating personality or he actually radiated fire? As you see over here, parsing English with a computer is going to be complicated.

There are various stages involved in training a model. Solving a complex problem in Machine Learning means building a pipeline. In simple terms, it means breaking a complex problem into a number of small problems, making models for each of them and then integrating these models. A similar thing is done in NLP. We can break down the process of understanding English for a model into a number of small pieces.

My friend recently went for diving at San Pedro island, so I’ll love to take that example. Have a look at this paragraph – “San Pedro is a town on the southern part of the island of Ambergris Caye in the Belize District of the nation of Belize, in Central America. According to 2015 mid-year estimates, the town has a population of about 16,444. It is the second-largest town in the Belize District and largest in the Belize Rural South constituency”.

(source-Wikipedia)

It would be really great if a computer could understand that San Pedro is an island in Belize district in Central America with a population of 16,444 and it is the second largest town in Belize. But to make the computer understand this, we need to teach computer very basic concepts of written language.

So let’s start by creating an NLP pipeline. It has various steps which will give us the desired output(maybe not in a few rare cases) at the end.

STEP 1: Sentence Segmentation

Breaking the piece of text in various sentences.

  1. San Pedro is a town on the southern part of the island of Ambergris Caye in the 2.Belize District of the nation of Belize, in Central America.
  2. According to 2015 mid-year estimates, the town has a population of about 16,444.
  3. It is the second-largest town in the Belize District and largest in the Belize Rural South constituency.

For coding a sentence segmentation model, we can consider splitting a sentence when it encounters any punctuation mark. But modern NLP pipelines have techniques to split even if the document isn’t formatted properly.

STEP 2: Word Tokenization

Breaking the sentence into individual words called as tokens. We can tokenize them whenever we encounter a space, we can train a model in that way. Even punctuations are considered as individual tokens as they have some meaning.
‘San Pedro’,’ is’, ’a’, ’town’ and so.

STEP 3: Predicting Parts of Speech for each token

Predicting whether the word is a noun, verb, adjective, adverb, pronoun, etc. This will help to understand what the sentence is talking about. This can be achieved by feeding the tokens( and the words around it) to a pre-trained part-of-speech classification model. This model was fed a lot of English words with various parts of speech tagged to them so that it classifies the similar words it encounters in future in various parts of speech. Again, the models don’t really understand the ‘sense’ of the words, it just classifies them on the basis of its previous experience. It’s pure statistics.

The process will look like this:
Input —>Part of speech classification model→ Output
Town                                                                      common noun
Is                                                                                   verb
The                                                                            determiner

And similarly, it will classify various tokens.

STEP 4: Lemmatization
Feeding the model with the root word.
For an example – There’s a Buffalo grazing in the field.
There are Buffaloes grazing in the field.
Here, both Buffalo and Buffaloes mean the same. But, the computer can confuse it as two different terms as it doesn’t know anything. So we have to teach the computer that both terms mean the same. We have to tell a computer that both sentences are talking about the same concept. So we need to find out the most basic form or root form or lemma of the word and feed it to the model accordingly.

In the similar fashion, we can use it for verbs too. ‘Play’ and ‘Playing’ should be considered as same.

STEP 5: Identifying stop words

There are various words in the English language that are used very frequently like ‘a’, ‘and’, ‘the’ etc. These words make a lot of noise while doing statistical analysis. We can take these words out. Some NLP pipelines will categorize these words as stop words, they will be filtered out while doing some statistical analysis. Definitely, they are needed to understand the dependency between various tokens to get the exact sense of the sentence. The list of stop words varies and depends on what kind of output are you expecting.

STEP 6.1: Dependency Parsing

This means finding out the relationship between the words in the sentence and how they are related to each other. We create a parse tree in dependency parsing, with root as the main verb in the sentence. If we talk about the first sentence in our example, then ‘is’ is the main verb and it will be the root of the parse tree. We can construct a parse tree of every sentence with one root word(main verb) associated with it. We can also identify the kind of relationship that exists between the two words. In our example, ‘San Pedro’ is the subject and ‘island’ is the attribute. Thus, the relationship between ‘San Pedro’ and ‘is’, and ‘island’ and ‘is’ can be established.

Just like we trained a Machine Learning model to identify various parts of speech, we can train a model to identify the dependency between words by feeding many words. It’s a complex task though. In 2016, Google released a new dependency parser Parsey McParseface which used a deep learning approach.

STEP 6.2: Finding Noun Phrases

We can group the words that represent the same idea. For example – It is the second-largest town in the Belize District and largest in the Belize Rural South constituency. Here, tokens ‘second’, ‘largest’ and ‘town’ can be grouped together as they together represent the same thing ‘Belize’. We can use the output of dependency parsing to combine such words. Whether to do this step or not completely depends on the end goal, but it’s always quick to do this if we don’t want much information about which words are adjective, rather focus on other important details.

STEP 7: Named Entity Recognition(NER)

  1. San Pedro is a town on the southern part of the island of Ambergris Caye in the 2. Belize District of the nation of Belize, in Central America.

Here, the NER maps the words with the real world places. The places that actually exist in the physical world. We can automatically extract the real world places present in the document using NLP.

If the above sentence is the input, NER will map it like this way:
San Pedro – Geographic Entity
Ambergris Caye – Geographic Entity
Belize – Geographic Entity
Central America – Geographic Entity

NER systems look for how a word is placed in a sentence and make use of other statistical models to identify what kind of word actually it is. For example – ‘Washington’ can be a geographical location as well as the last name of any person. A good NER system can identify this.

Kinds of objects that a typical NER system can tag:
People’s names.
Company names.
Geographical locations
Product names.
Date and time.
Amount of money.
Events.

STEP 8: Coreference Resolution:

San Pedro is a town on the southern part of the island of Ambergris Caye in the Belize District of the nation of Belize, in Central America.
According to 2015 mid-year estimates, the town has a population of about 16,444.
It is the second-largest town in the Belize District and largest in the Belize Rural South constituency.

Here, we know that ‘it’ in the sentence 6 stands for San Pedro, but for a computer, it isn’t possible to understand that both the tokens are same because it treats both the sentences as two different things while it’s processing them. Pronouns are used with a high frequency in English literature and it becomes difficult for a computer to understand that both things are same. Hence, this step is used. This step is indeed the most difficult step

In the upcoming articles, I’ll try sharing about the history of NLP, how it evolved, various past models and why they failed, NLP Libraries and coding NLP pipeline in Python. I’d love discussing various papers as well.

Please, feel free to correct me on any topic if I went wrong somewhere and do let me know about improvements.

by Jaydeep Borkar at September 10, 2018 01:24 PM

September 08, 2018

Prashant Sharma (gutsytechster)

Interactive Rebase

Git rebase has an interactive mode which helps you in rough times while working with git. You might come across situations where you have to alter what you’ve already committed. Interactive rebase provides us with tools and functions which helps us to do such things. Let’s do a quick recap of what rebasing is. By now we know that rebasing re-base our local commits on the top of commits done in the base branch.  And due to this the commit hash value changes and it act as a totally new commit with same changes as in earlier one. Hence, we shouldn’t rebase any public branch. That’s just to get a rough idea about rebasing. For more detailed insight you can refer here.

Rewriting the commit history

Interactive rebasing helps you to rewrite your commit history in case you find that you committed something wrong or some previous commit required more work to be done before committing. To tackle and get out of these problems, we have this magic wand in our hand. So, let’s know how can we use it.

Let’s create few files in our git repo(You know how to do it, right?). First create a file with name first.txt with the following content in it

This is the first file in this repository.

and then we add the changes to staging area. And finally commit it as

git commit -m "Add first.txt"

After this create another file with name second.txt with the following content in it

This is the second file in this repo.
This content needs to be deleted.
We'll do it later

And commit it as

git commit -m "Add third.txt"

Yeah, I know the file name is second.txt but I have done it intentionally. We’ll correct it later. Just keep reading. 🙂

Finally create the actual third.txt with the following content in it:

Yeah! this one is the last file.

and commit it as

git commit -m "Add actual third.txt"

At last, enough preparing. Now is the time to use our magic wand. As of now, our commit history looks like this

d6f128b Add actual third.txt
b2d48ff Add third.txt
e57559a Add first.txt

What? You also want to see your commit history like this instead of that long output of git log! Ok let me tell you then, I just used few options which git log supports

git log --pretty=format:"%h %s"

To get to know more about such options, do give a read to this.

Now we want to correct the content of our second file and then commit it with correct commit message. For that we can use git rebase as

git rebase -i HEAD~2

Ok. Let’s first understand what does this command mean?  For interactive mode we used -i option, short for –interactive. And then we give the number of commits we want to consider. As we know, HEAD always refers to the latest commit of current branch by default. So, to take 2 commits from HEAD(since the second commit from HEAD needs to be corrected), we used ~ symbol. When you’ll hit enter, a text editor would open with following content

pick b2d48ff Add third.txt
pick d6f128b Add actual third.txt

# Rebase e57559a..d6f128b onto e57559a (2 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

The last two commits would be shown in older to newer fashion. Git is smart enough to explain you the various options which can be applied to each commit. By default each commit is marked with pick command. If you leave a commit with pick command, it just applies that commit as it is.

In our case we want to edit our first commit in the list, if you see the list of options available, can you guess which option should we use? Yup, you are correct, we would need to use the edit option. We can also use it’s short form ie ‘e‘ as

e b2d48ff Add third.txt
pick d6f128b Add actual third.txt
...

Now, as you’ll save the file, you would see a message as

Stopped at b2d48ff...  Add third.txt
You can amend the commit now, with

  git commit --amend 

Once you are satisfied with your changes, run

  git rebase --continue

So what exactly happened? Let’s understand it, rebase starts to take each commit one by one in the list and performs the command defined against them. In our case, the very first commit in the list comes up with the ‘e‘ option, which says rebase to stop at this commit until user tells it to continue. And as expected it stopped at the commit. Now if you do git log as

git log --pretty=oneline

and it would give you the output as

b2d48ff1ba706f9751bd950e17355a9fb9a3fd99 (HEAD) Add third.txt
e57559a96cd0c5b9f2ef4e2dccbcf6f20b3b11d4 Add first.txt

You can see that now our HEAD is at the commit at which rebase stopped. Now we can edit this file. So open second.txt and delete the last two lines. It would be now

This is the second file in this repo.

and then add the changes. Since its commit message was also incorrect, we can correct it now using the –amend option. With this option we can amend the commit refer by HEAD. Since our HEAD is at the second commit, we can now amend it. For that write the following command

git commit --amend

And hit enter, it would open a text editor with the previous incorrect commit message. So we can correct it now and save that file. Now our commit message has been amended. You can check that using git log command. Now do git status

interactive rebase in progress; onto e57559a
Last command done (1 command done):
edit b2d48ff Add third.txt
Next command to do (1 remaining command):
pick d6f128b Add actual third.txt
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'master' on 'e57559a'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working tree clean

git tells us that interactive rebase is in progress. It means that there are other commits yet to be processed and it also tells you the next command which is going to get execute. So simply do git rebase –continue to continue the interactive rebasing and then it would show you the message like

Successfully rebased and updated refs/heads/master.

Now again look at the git log, in my case it is

9259ca9 Add actual third.txt
7092e07 Add second.txt
e57559a Add first.txt

You might have noticed that the hash value of first two commits now has been changed. You know it, right? Yes, it’s because rebasing replays each commit and gives it a new hash value.

Now you know the procedure it follows. Let’s look at other available options rebase provides.

  • Squash

Indeed, squashing is one of the most used technique used by many contributors and anyone who works with git.  In simple words, squashing squashes more than one commit into a single commit. Let’s try it. Suppose we want to squash the first two commits in one in our above example. We’ll again give the same command for interactive mode. Can you write it without scrolling above? Nice. Now the text editor would open with following content

pick 7092e07 Add second.txt
pick 9259ca9 Add actual third.txt
...

You just need to write ‘s‘ option. write it as

pick 7092e07 Add second.txt
s 9259ca9 Add actual third.txt

And then save the file. As soon as you’ll save the file, another text editor would open. It would contain the commit messages of both the commits as git doesn’t know which commit message to take. Either you can keep any one of them or you can rewrite a new commit message. After writing the commit message, just save the file and it’s done. You just squashed your commits in one. Now my commit history looks like this.

b805b0a Add second.txt and third.txt
e57559a Add first.txt
  • fixup

If you see the options in rebase text editor, you’ll find this also. fixup is also used to squash the commits together. Then what’s the difference between the two? Well, it’s simple. fixup discards the commit message of the commit on which it is applied. Just this. You just have to use ‘f‘ option instead of ‘s‘ for it.

  • reword

Well, if you want to correct the commit message of the latest commit,  you can use –amend option. But if  you need to correct the commit message of previous commits, just use ‘r‘ option for whichever commit’s  message you want to correct. As one by one it would take commit and as soon as it reaches at the commit with option ‘r’, you would land into another text editor where you can correct it and save the file. And rebase would continue by itself.

  • drop

If you want to remove a commit from your commit history, then use ‘d‘ option short for drop and it would be removed. Do notice that the changes will remain there, just the commit would be removed from your history.

  • reorder

If you want to re-order your commits, then just change their position in the rebase text editor. And it’ll be done. So easy, isn’t it?

  • edit

We just used edit option in the initial example. It is used in case you want to stop at some particular commit and perform any action on that commit specifically.

These are the some of the most helpful functions while using git. You’ll most often come across using these. However, there are some facts which I’ve experienced and can confuse you if you go with default options.

  1.  git rebase -i ignores merge commits until and unless you use the flag ‘-p‘ abbreviated for –preserve-merges.  For more details, you can refer to this answer on stackoverflow.
  2. You can’t rebase the initial commit of your repository. So, in above example if you would try replacing HEAD~2 with HEAD~3 in order to get all the three commits in rebase it would give you the error as
fatal: Needed a single revision
invalid upstream 'HEAD~3'

Since the 3rd commit is the root commit of our repository. If you want to change the root commit of your repository and want to know about it then you can refer to this answer on stackoverflow.

And yes, I again want to focus on the part that rebasing changes your commit history. So, you should never rebase a public branch. That’s all from my side.

References:

I hope this would be helpful. I am still a newbie with it. So, if you find any correction or doubt then don’t hesitate to write in the comment sections below. Meet you soon.

Till then, be curious and keep learning!

Advertisements

by gutsytechster at September 08, 2018 07:06 PM

September 07, 2018

Jaydeep Borkar(jaydeep)

Volunteering for Kerala Flood Search and Rescue Team

A few days before August 18th, 2018, I came across a news that Kerala was suffering from the worst floods in nearly a century. As soon as I heard the news, I googled up to have a look at the situation. The situation was horrifying. Already, lakhs of people were stranded, displaced, missing and lives were lost. Floods amounting to a huge destruction to the state’s property. I really felt sad about the situation. But, the thing that pricked me the most was that I was unable to do anything to stop this or to protect people and save their lives. I couldn’t do anything on my part apart from sharing posts on social media to donate the fund. 1,143 kilometres away, I spent quite a lot of time thinking on how I can help them. Neither was I in Navy nor in any Local Rescue Team. What is the use of studying these much, getting a degree, equipping yourself with a lot of knowledge, if you can’t help those in need, those who are on the verge of losing their lives? I just thought for a moment. Still, I was clueless regarding how I can help them.

On the morning of 18th of August, I got to know that Kerala Rescue Team needed developers who can keep their website running. I joined their slack group as soon as possible, but I found that the development stuff would require me to learn that particular technology first and then I could be in a position to contribute, and this would considerably take a lot of time. It was pretty dilemmatic. But, as I was exploring various other modes of contribution, I found out this Chat Support Volunteering.

The functionality was like this: relatives and friends of the people who were stranded in the various districts of Kerala without food, water, and other necessary things contacted our chat support team with the help of a portal. Our job was to extract all the necessary information from them such as the number of people stranded, their contact numbers, names, location and coordinates(longitude, latitude), their condition. Collecting the information and checking it in the database for the duplicate entries and to file the entry if it was a new case. Followed up by contacting the local rescue team, the authorities and the Navy carrying out rescue operations, by providing them with the already extracted information. We were provided with the details of various district wise helpline numbers, rescue team contact numbers, details of various relief camps and the updated data of the people in the relief camps.

The other chat support volunteers were really very helpful and kind. They helped me and guided me throughout the operation. For an instance, I don’t understand Malayalam, so they helped me in explaining what the requester was requesting with all the necessary data. I tried the hardest to respond to all the rescue requests that I could with, taking all the required information, assuring them that they would get in touch with their loved ones sooner. I was very clear regarding my role to unite a child with his/her mother, to unite a family, to unite friends, and to save their lives. I wasn’t an inch less and tried my best. Skipped my lunch because I have an extremely slow rate of transferring food particles per second to my digestive system and that would have taken a much of time, and I couldn’t afford to miss on any of the rescue requests. Definitely, I had some snacks later in the evening. The real heroes were the Navy and the local Rescue team.

It was very hurtful to hear that people were losing their lives. I called a group of stranded people in one of the district to assure them that the help was arriving, and got to know that few people had lost their lives over there. They were in a pretty bad mental and physical condition. Tried my level best to help the people by responding to the requests with a tremendous help of other chat support volunteers, they were the people with unmatchable efforts. We were available 24×7 on the helpline. We had divided the slots. I went offline at 1am and came back again by 5am, with the other volunteers assisting the team.

A lot of people who found their missing ones dropped touching messages to me,  the next day. A woman had a relative missing since 3-4 days. I took her email and assured her that I’ll get in touch with her as soon as I find that person. That day,  unfortunately, we couldn’t find that person, so I dropped her an email regarding this and assured her that we were trying our best.  The next day, one of the volunteer dropped me a message indicating the similar person on Google Finder. Yes, it was that same person. I dropped her an email regarding this update and yes, she got really very emotional and happy, and dropped a very touching email to me, thanking our team. A person whose friends went on missing from Ernakulam district contacted me on WhatsApp after he found them, leaving a very touching message again. This was something to live for.

With the help of our tireless Chat Support Volunteering Team, a lot of people were rescued, a lot of lives were saved. The members of chat support and other teams were so dedicated that they spent day and night to rescue the people. Unfortunately, I couldn’t help for more than three days as the deadlines of my assignments were marching nearer. People from various parts of India, and even from other countries were helping out the rescue team in different ways.

It had never really felt so good to me in my life yet, that we had saved the lives of people by coordinating with various teams. I met highly dedicated, motivated, hardworking and humble volunteers and made good friends too. There’s a very big and different world outside the college life, the world that is built on empathy and good people, is what I learnt. There’s much more to life than what our system restricts us to. Well, Kerala is on its track to be a powerful state again, it’s recovering, and I’m super happy about that.

I could go on and on writing about this, so to wrap it up: for me, It’s a great day to be alive!

Cheers!

 

 

by Jaydeep Borkar at September 07, 2018 03:21 PM

September 03, 2018

Piyush Aggarwal (brute4s99)

Blurred Lines

PROLOGUE

While setting up Dev environment on my CAIRO-STATION (desktop computer at my home), I realized I could not install Linux on that, since the system will be used by all family members. My best bet would have been a VM or some sort of Containerization. The I recalled my early development days, and realized both of these are inferior to Windows Subsystem For Linux (WSL)

When I first discovered WSL as an optional feature in Windows 8.1, I was busy jumping between playing Just Cause 2 (a really great Open-World game, you MUST check it out!) and studying for XII “Board Exams”. I had a slight taste of Linux back then, enough to perform the most basic functions- ls, cd, and screenfetch (my favorite).

Then, last year I saw Microsoft announce 3 more Linux flavors for WSL incoming at Build Developer Conference, all I understood was more screenfetch outputs to bask in!

Motivation

Today, after an year of experience and two incredibly knowledgeable months at DGPLUG, ideas have become more achievable.

Today, an idea struck my mind-

Developers can finally use Ubuntu through command line interface, great! If they could also use GUI apps fired from within the Ubuntu bash CLI, ah that would have been lovely.

Ever since I installed Arch Linux on my system over days of research, I came to appreciate all the nit-bits and procedures involved in installing an OS and everything that a proprietary-software user believes *should* come with it.

Since now I possessed the knowledge I needed to pull this off, I fired up my home PC and I was ready to hack!

Baby Steps

  1. Got Ubuntu 18.04 from windows store.
  2. Turned ON WSL for my system.
  3. Updated all packages and installed screenfetch.

The New Part

The X Server handles outputs to the GUI, and a variable DISPLAY needs to point to the X Server. This was done by the command DISPLAY=:0. To avoid running it manually everytime, I appended to my shell by the command echo 'DISPLAY=:0' >> ~/.zshrc.

Now, all that I needed was an X Server that serves well!

My first attempt at X-Server for Windows was XMing, but unfortunately it couldn’t be detected by packages.

XMINGnotDetectedX Server could not be found by WSL

Next up, I tried another procedure which goes as follows :-

  1. WSL opens up a TCP type port 2222 for SSHing
  2. I SSH through PuTTY and enable X11 Forwarding inside it.
  3. The X Server used was still Xming.

The result is in the following photograph.

XMingDetectedSome Progress!

There still were problems with this set up- Latency. It seems obvious that I am SSHing into my own system, which is not wise. So, now I decided to get a better terminal application and get this show on road!

So, this time, I installed ConEmu. For those who are having a hard time shifting from Linux to the Command Prompt or Powershell, this is a relief. ConEmu is extremely customizable and rock-solid!

Also, I changed my X Server to MobaXterm, which does a far better and simpler job at handling X Server and related tasks(Servers,Tunneling,Packages,File System )

Final Set Up

The MobaXTerm X Server starts at Log In, and firing up ConEmu gives me a Ubuntu CLI.

Testing

 

XMingDetectedMozilla Firefox
XMingDetectedVS Code

I also followed a blog post by Nick Janetakis on setting up Docker to work with WSL flawlessly!

The setup he used was my inspiration for the post, and I hope it would serve me well for my oncoming endeavors!

 

 

by brute4s99 at September 03, 2018 10:35 AM

August 30, 2018

Ashish Kumar Mishra (ash_mishra)

DevConf.IN

DevConf.in was organized by RedHat in Bangalore on August 4th and 5th. This was my first ever conference and I was very excited to attend it.

The day finally arrived and I was ready for it. I had planned my schedule and knew which all events I had to attend. When I reached Christ University (the place where the event was going on), I was late. I missed the opening keynote but was just in time to attend the sessions. Turns out I didn’t even attend half of the sessions from my list.

You must be wondering, ‘why?’. Well, I realized on the first day itself that conferences are a place to meet people rather than sitting and coding. The experience that you gain by meeting different people of the open source community is amazing and fun. So, I met a lot of new people, talked to them, roamed here and there with them. The best part was I that I was a student and the people whom I talked with were professionals. It helps to know where the industry is headed nowadays, what are the current trends in technology, how people became successful, where did they start, what are the various career options, etc.

Moreover, the goodies that we got from Devconf also made me happy. I always wanted badges and stickers related to computer technologies and they were present in abundance.

We had a #dgplug staircase meet where I met many people whom I just knew by their IRC nicks. Sayan and Saptak talked about the conference, they shared their experience and then Sayan clicked our photos too.

4th and 5th of August were one of the best weekends I have spent till date. I enjoyed and learnt both at the same time. I am looking forward too attend more conferences and meet more people.

 

by Ashish Kumar Mishra at August 30, 2018 08:12 PM

August 28, 2018

Prashant Sharma (gutsytechster)

Git Rebase

Heya folks!

Git is indeed an ocean of topics to dive in and one can learn these only if you use them and experience them. So, here I am with another of my learning. If you work for a project, there are probable chances that you come across using rebasing. So what exactly is rebasing? Let’s know about it.

In open source contributions, one follows certain rules and regulations while contributing. Each organization has these rules defined in specific file, most of the time, you would see something similar as CONTRIBUTING.md. So, more often you’ll be asked to work on a separate branch for each issue/feature you are working on. This branch is called as feature branch. Since you are working on different branch, you would want to keep your branch updated with master of upstream. So, do you know how would you do it?

Well of course you know it. You would simply do `git pull upstream master` and your branch will be up-to-date with master. However, this will result in superfluous merge commit that would intervene your commit history. You might not want to clutter your commit history with these merge commits each time you do git pull. So to avoid this we have a wonderful tool ie rebasing.

What does rebasing do?

Even if you mean it literally, you can tell its purpose. It re-base the commits of current branch on the top of other branch’s. Did it confuse you? No problem. Let take an example. So suppose you are working on a project which has the following commit history :

A-B-C-D (master)

And then you created a feature branch and did few commits on it, that would be like:

A-B-C-D (master)
       \
        E (feature)

However, during the period you were working on your feature branch, the work on master branch proceeded and there have been few more commits on master branch and in your feature branch. And now your commit history looks like this:

A-B-C-D-H-I-J-K-L(master)
       \
        E-F-G (feature)

But now you need those commits of master to get up-to-date in your feature branch. So, what would you do? Indeed we can do rebasing. But what if we do simple merge? Let’s see

So for merge you would enter the git command as:

git checkout feature
git merge master

And then your commit history would be like this:

A-B-C-D-H-I-J-K-L(master)
       \       /
        E-F-G-M (feature)

Since you merged the master branch into feature branch. The commit M has got created which is a merge commit. It would contain the changes in the master branch and would add it to your feature branch.

There is one thing to notice here which is that there is no effect/change on the previous commits of any of the branch.

Finally, what would have happened if we had done git rebase instead of git merge. Let’s see that also. So for rebasing you would enter the git command as:

git checkout feature
git rebase master

Now is the time where you should know how rebase works. It re-base ie change the base of your feature branch on the top of the HEAD of master branch. What’s the base of your feature branch now? Yup! it’s the commit D. After rebasing it would shift to the commit L. It would look like you had implemented your work on the top of what everybody has already done. During rebasing following steps are taken:

  • It finds out the common commit of your current branch(feature in our case) and the base branch(master in our case) which is the commit D(here).
  • It then collects all the commits between that common commit(D) and the HEAD commit(G) of current branch. And put those commits aside. In our case these commits are E, F and G.
  • It shifts the base from that common commit to the HEAD of the base branch(L in our case).
  • It re-plays each change which were set aside, on the top of new base and creates a new commit.

Now, the base of your current branch ie feature branch is the HEAD of master branch. You might have noticed those bold words in the last step. That was intentionally done to point out that all the commits of current branch from the base commit to the HEAD will have a different commit hash value. As because they have been re-committed after the base got changed. This was all done during the rebasing process.

After rebasing your commit history would look like this:

A-B-C-D-H-I-J-K-L(master)
                 \
                  E'-F'-G' (feature)

Now your base has changed from commit D to commit L.

E’, F’, G’ refers to the new commits which have been done during rebase. Each of them corresponds to the changes that have been done to commits E, F, G respectively.

While doing merging, we usually come across merge conflicts. Merge conflicts arise when there is a change in same file and in same line in two different branches. Git doesn’t know that while merging which change should it consider. So, it is our responsibility to first solve that conflict and then again try merging.

Since rebasing is actually a type of merging just the difference is that first it changes your base and then apply the changes of current branch. So, there is again chances that there could be some conflicts. Rebasing stops at the moment where it finds any conflict and asks you to resolve the conflict. Though after resolving the conflict, you don’t have to start rebasing again as it is already in progress. It just stops momentarily until you resolve the conflict. Once you are done with resolving, you can continue rebasing using the command:

git rebase --continue

And then it would apply the remaining commits. However, if at any moment you feel like you don’t want to continue with the rebase, you can abort the rebasing using

git rebase --abort

You would be at same stage as you were before starting rebasing.

When not to use rebase?

Even though there are advantages of rebasing, it can be troublesome sometimes. You should always remember not to rebase a public branch. It means that you shouldn’t try to rebase a branch that other people might have forked. As rebasing changes your commit history. That could lead to confusion and conflicts. I again say Do not ever rebase public branch.

However, rebasing private branches is totally fine and often recommended.

What’s ahead?

So, now you know rebasing. Well it’s not yet done. There are a whole lot of things you can do with it. We’ll cover it in another blog post.

References:

I have gone through many links and posts to learn rebasing. So, I would suggest you to go through the same to get more insight about it.

Goodbye for now. Hope it was helpful.

Till next time, be curious and keep learning!

by gutsytechster at August 28, 2018 05:13 PM

August 25, 2018

Mayank Singhal (storymode7)

Dvorak Experience

It’s going to be a month from the time I started learning Dvorak keyboard layout. I just wanted to find out on my own what made it different? What better way to find out than learning it?

Qwerty has been the layout I’ve used ever since I came across computers. But recently when I came to know about some of Dvorak’s benefit, I was tempted to try it out.  Or if you straight away want to jump to why Dvorak’s good, head on to this section. Small research

Converting Qwerty to Dvorak

Since I use a keyboard with a Qwerty layout, the major hurdle was to turn it into Dvorak. I didn’t know how it would be done, but I knew that it would be possible for sure. I knew that it was possible to exchange keys (I recently swapped the Caps Lock key with the escape key. It made vi experience blazing fast!). So if need be, I was ready to write a script to map my qwerty keys to Dvorak one by one. But thankfully it didn’t come to this.
Recently one of my friends shifted to Fedora. He was trying out a live USB and couldn’t get the command the command working that he used to remap keyboard keys on ubuntu. So while trying to help him out I read the man pages of the few alternatives that he wanted me to check if they work working on my dual boot install of Fedora.

One of them was setxkbmap. That exactly served my purpose.

All I had to do was write one command and voila, I had Dvorak layout. To be on the safer side lets know about our current layout so that we can switch back without issues.

By default, you would be using the us layout. To check you can type:

setxkbmap -query

In the short output, you can see the layout defined.

This is your key to home. If you lose it, you’d have fun typing out weird qwerty characters even to say qwerty 😛

Let’s get a short demo. First, we need some keys that don’t change with the keyboard layout. Like the arrow keys. And since we are trying out commands at the terminal, it would serve us perfectly.
So go ahead and create your safe home. The default layout in the command history would be one for us.
Type:

setxkbmap us

Don’t expect anything to happen, since you are reapplying the default layout. Now if we mess up, we can just press the UP arrow key and go back up and hit enter to get the cozy qwerty back.
If you feel like doing it, then type out:

setxkbmap Dvorak

Now try typing qwerty at your terminal. When I did this first time I couldn’t help but laugh at how simple and weird it was that your keyboard has gone haywire.
NOTE: Don’t let your PC sleep. As this layout is set for your account now, so it would be applied to every window that requires input. Even your login screen!
But if you were too excited and ended up doing that anyway, just search for Dvorak on any other device and try to type the key combination back, one key at a time.

Though this sufficed my necessity, I knew that a luxury was possible too.

Switching layouts on the fly!

Now let us write a small bash script to toggle layout. It will change to Dvorak if existing layout is us and vice versa.

For checking existing layout, we already used setxkbmap -query,
we’ll be using that to check the existing layout. I used wildcards to
check for the substring Dvorak in the output of setxkbmap query`

#!/usr/bin/env bash
if [[ $(setxkbmap -query) = *"dvorak"*  ]]
then
    setxkbmap us
else
    setxkbmap Dvorak
fi

This is the script I wrote.

I saved it as dvorak_toggle.sh. Now after making it executable, I can do ./dvorak_toggle.sh

I was happy with this for a minute, but quickly I realized that more luxury is possible 😛 So, next what I did was to map this script to a shortcut.
In Fedora, it’s pretty simple. Go to settings -> keyboard and just create a new shortcut.

In the command field, add the path to the script. (Since there is a shebang already, we don’t need bash path/to/script as a command)
I mapped the script to Alt + Enter. And voila in a second now I can switch from one layout to another!

Also, I found it helpful to keep an image of Dvorak layout saved offline. So that I can refer to it using GUI if I forget which key is which.

An FAQ and some suggestions

You don’t need to unlearn qwerty! I can type Dvorak and qwerty both above 40wpm easily. In fact, if you’ve prior touch-typing experience, it’d only help you!

Is it really fast?

It is definitely fast. Within 2 weeks approx, I could type with decent accuracy and about 30 wpm speed (I know that at qwerty many folks would have been faster within that interval of time, but it took me around a month to get my fingers at place correctly on qwerty 🙂 I’m a slow learner. YMMV). And some words I could type faster than qwerty even though it had been only two weeks.

Does it change the position of only the alphabet keys?

Nopes. It changes punctuation marks and some symbols as well. And more used punctuation marks like , and . are placed on the top row in place of q and w of qwerty. Some symbols like / and + are also shifted to the top row in place of [ and ]. Similarly a few other changes.

Why was qwerty designed like this?

Alphabetical typewriters had a problem in earlier times that while typing fast the rods attached to the keys would stick to each other. Qwerty dealt with this problem by spreading the keys so that clash was less often.
But this was in 1873!  And now we don’t use typewriters that would have clashing rods, rather these spaced out keys only strain our hands, Dvorak tries to deal with this.

Would my speeds at qwerty become slow?

Short answer, yes (If you stop qwerty absolutely) and no (If you do it even once in a week too).

Switching between the layouts isn’t physically difficult. Like if you practiced for 15 min on Dvorak you can get your original qwerty speed back on qwerty in no time. It’s what I realized because I used to do 1-2 lessons of Dvorak in a day and then after finishing them I’d immediately test my performance on qwerty. On some days I even dropped to a 20 wpm on qwerty after practicing Dvorak for long. But, on some days I could type qwerty as fast as I used to.

According to me, once you reach a speed of 50+wpm, speed is more of a mental construct. It is just how much you can focus. How clear your mind can get. Like I said after Dvorak, on qwerty I’d get 20wpm to 60wpm. At times the 20 wpm was followed by the 60! The reason is that initially, I’d think before typing. But when I stopped thinking how to type and just let my fingers roll over the keyboard, they would end up making the words I’d intend them to. I think that Dvorak was on my mind whereas qwerty on my muscles.

But would qwerty practicing slow my Dvorak typing speeds?

Yes, If you don’t practice it daily, as it’s new for your muscles, it’d take some time. When I started with Dvorak I had so slow speeds that I couldn’t keep it ON the whole day. Also, due to qwerty being my primary layout, most of the mistakes I did in gtypist were of typing qwerty keys in Dvorak layout (and a few days later, of typing Dvorak keys in qwerty XD). Since I could type well in qwerty, I used to switch to it usually. But when my speed was around 30 on gtypist, I started taking Dvorak out for a spin. Even at typing races with some fellows!
All you need for the starters is to get the layout habitual to your muscles.

If you’ve never touch typed and are learning Dvorak as your first keyboard you’d get it more easily. But your fingers might be a little hesitant for a few days.

Don’t type letters. Type words.

While practicing touch typing we often get in the habit of keeping a letter in our mind and then thinking where it is and finally pressing it without seeing it. Typing the letters is another thing that would make you slow despite knowing all the key positions. Instead, practice typing a word in such a manner that you don’t focus on individual letters anymore.

This is similar to stenographers’ use of steno type keyboard. They write a syllable, word or even a phrase with a single stroke!

This is the reason behind the suggestion of practicing one keyboard everywhere. I.e not only on a typing lesson but also in chats, in browsing, etc. So that you get the habit of typing words rather than letters.

Keeping the keyboard in the correct position

Try to keep keyboard such that your wrists don’t bend while trying to type. Keep your wrists flat and shoulders relaxed. I’ve noticed not only increase in typing comfort but also an increase in typing speed when the keyboard position is right.

Shoulders and hands relaxed

When trying to type fast, I used to tense up my muscles and that would eventually slow me down. If you rest your fingers rather than keeping them tensed you’ll again notice an increase in comfort and typing speed.

Don’t pound on the keys

You might have already read this somewhere. I too have! But even to this day I unintentionally end up pounding the keys. The secret is to press the keys gently (not slowly) enough just to register the touch. This helps you type fast and also keeps your keyboard in good health as compared to playing Whac-a-mole with your keyboard.

But what if I switch to Dvorak and I need to use someone else’s qwerty keyboard?

Well well, this was amongst the two reasons I was apprehensive about switching to Dvorak completely. (Other reason being that I’d lose the speed that I had at qwerty)

Then I realized that I don’t use somebody else’s keyboard that often.
Another major point against it is that, if you can type 60+ on your keyboard, there’s no surety that you would have the same speed on someone else’s keyboard.

Currently, I am a student, so the only other keyboard that I’ve to interact with too often is the lab’s old qwerty. And those keyboards are generally so old and their keys are so uncomfortable that I’ve to pound most of the times. But keeping these extreme aside, even if I type on a friend’s brand new laptop, I can’t get the same speed that my keyboard gives me. But again this is what I experienced and your mileage may vary 🙂

So what layout should I learn?

I strongly feel that Dvorak is amazing and this should be the layout you should learn if you ever want to go at really high speeds or just want a more comfortable experience for your fingers.
But on the other hand, knowing little qwerty help.

Can qwerty be bad for my wrists and fingers?

Short answer: yes!

Here’s a short experience of mine 🙂

A few days back I would have said no. Since at that time I used qwerty only on gtypist. But now I’ve used pure qwerty for some days. Today, to test how good my qwerty remained, I did a typing test. At first, I couldn’t get good speed. I thought it’d improve within 2nd or 3rd trial as it had been, but to my surprise, it took my mind around 25-30 min to get back qwerty. But as soon as I could type 30, I could go 50 easily. After all, it’s my mind that needed to come back. As soon as it did, muscles kicked into action. And once again I retained my speed on both the layouts.

BUT the thing that immediately bugged me about qwerty when I tried my hands on it after some time, was how awkward the keys have been laid. I’ve never thought so my entire life! My wrists started to pain slightly. And I realized that it may be because that in qwerty, many keys in the bottom row are frequently used and so are some at the top row. And that felt so uncomfortable that I knew I’ll be staying at Dvorak now and will do qwerty only once a week.

Are shortcuts awkward with Dvorak?

Nah. On the contrary, I’ve come to find Dvorak great in that domain too! Considering the fact that it takes you away from vim and its shortcuts, it is only better. I’ve even switched my editor to emacs and I’ve been at it for a few weeks now! I can’t bear vim with Dvorak. Though it is amazing for qwerty, emacs is more natural for Dvorak in my opinion.
And for the most common shortcut, Ctrl-c & Ctrl-v, Dvorak is amazing. Both C and V are at comfortable positions of the right hand when you press the Ctrl with your left.

But like everything, you find the thing you are habitual of more comfortable than a new thing. So it might be some time before you find the layout that suits. Though if you spend more time with a personal setup, then Dvorak deserves a try.

Touch type if you type. And go Dvorak if you touch type.

storymode7

–Touch typed in Dvorak!

by storymode7 at August 25, 2018 07:55 PM

August 21, 2018

Kumar Vipin Yadav (kvy)

STRUCTURE IN C

STRUCTURE:
You are aware that a variable stores a single value of a data type. Arrays can store many values of
similar data type. Data in the array is of the same composition in nature as far as type is concerned.
In real life we need to have different data type for example to maintain employees information we should
have information such as name,age,qualification,salary etc.
Here,to maintain the information of employees
dissimilar data types are required. Name and qualification of the employee are char data type, age is
integer,and salary is float. All these data types can not be expressed in a single array. One may think
to declare different arrays for each data type. But there will be huge increase in source codes of the
program. Hence, arrays can not be useful here. For tackling such mixed data types, a special feature is
provided by C.it is known as structure.
A structure is a collection of one or more variables of different data types, grouped together under a
single name. By using structures we can make a group of variables,arrays,pointers etc.

Features of structures:

1. To copy elements of one array to another array of same data type elements are copied one by one.
it is not possible to copy all the elements at a time. Whereas in structure it is possible to copy the
contents of all structure elements of different data types to another structure variable of its type using
assignment (=) operator. It is possible because the structure elements are stored in successive memory
locations.

2. Nesting of structures is possible i.e. one can create structure within structure. Using this feature
one can handle complex data types.

3. It is also possible to pass structure elements to a function. This is similar to passing an
ordinary variable to a function. One can pass individual structure elements or entire structure by
value or address.

4. It is also possible to create structure pointers. We can create a pointer pointing to structure elements.
For this it requires operator.

creating structure definition:

   syn:   struct Name_of_structure 
          {
             member1;
             member2;
             member3;

          };
   e.g.
       struct student                          struct employee                        struct test
          {  int roll;                              { int empno;                          {  int a,b,c;
             char name[100],fname[100];               char name[100],address[100];           float x,y,z;
             char address[100],inst[100];             char dept[100],post[100];              char p[9];
             char sub[100];                           float basic;                         };
             float fee;                             };                              
           };

Another way of creating structure variable :

      struct student                                    struct
    {                                                 {
      int roll;                                           int roll;
      char name[100];                                     char name[100];
      char sub[100];                                      char sub[100];
      float fee;                                          float fee;
    }A,B,C;                                           }A,B,C;

USING STRUCTURE VARIABLE :

#define z 50
struct employee
{
    int ID;
    char name[z];
    char dept[z];
    float sailry;
};
int main()
{
    struct employee A;
    char Escape_NULL;

    printf("Enter Employee ID : ");
    scanf("%d",&A.ID);
    scanf("%c",&Escape_NULL);

    printf("Enter Employee name : ");
    gets(A.name);

    printf("Enter sailry : ");
    scanf("%f",&A.sailry);
    scanf("%c",&Escape_NULL);

    printf("Enter Department of Employee : ");
    gets(A.dept);

    printf("Name : %s. \n",A.name);
    printf("ID : %d.\n",A.ID);
    printf("Department : %s.\n",A.dept);
    printf("Sailry : %.3f.",A.sailry);

    return 0;
}

Output:-

Enter Employee ID : 10001
Enter Employee name : Vipin
Enter sailry : 18000.69;
Enter Department of Employee : IT
Name : Vipin. 
ID : 10001.
Department : IT.
Sailry : 18000.690.

(.) Dot operator

This operator is referred as structure variable structure member operator it is used to access a,
structure member from a structure variable.
syn: structure_name new_name;
e.g.

1.                                          2.                                    3.
                                                                                  Nameless structure
                                                                                  Using typedef
  typedef struct student                    typedef struct employee               typedef struct
    {   int roll;                              { int empno;                          {  int a,b,c;
        char name[100],fname[100];               char name[100],address[100];           float x,y,z;             char address[100],inst[100];             char dept[100],post[100];              char p[9];
        char sub[100];                           float basic;                         }test;
        float fee;                             }emp;                              
    };
    typedef struct student std;

Array of structure :

We can create array of our structure , Here in our this example we will take employee detail,
and print them.

#define z 50
struct employee
{
    int ID;
    char name[z];
    char dept[z];
    float sailry;
};
typedef struct employee emp;
int main()
{
    struct employee A[5];
    char Escape_NULL;
    int i;
    for ( i = 0 ; i < 5 ; i++ )
    {
        printf("Enter Employee ID : ");
        scanf("%d",&A[i].ID);
        scanf("%c",&Escape_NULL);

        printf("Enter Employee name : ");
        scanf("%s",A[i].name);

        printf("Enter sailry : ");
        scanf("%f",&A[i].sailry);
        scanf("%c",&Escape_NULL);

        printf("Enter Department of Employee : ");
        scanf("%s",&A[i].dept);

    }

    for ( i = 0 ; i < 5 ; i++ )
    {
        printf("Name : %s.\nID : %d.\nSailry : %f.\nDepartment : %s.",A[i].name,A[i].ID,A[i].sailry,A[i].dept);
        printf("\n\n");
    }
    return 0;
}

Output:-

Enter Employee ID : 1001
Enter Employee name : Vipin
Enter sailry : 18200.69
Enter Department of Employee : IT
Enter Employee ID : 1002 
Enter Employee name : Yatender
Enter sailry : 18000
Enter Department of Employee : Sales
Enter Employee ID : 1003
Enter Employee name : Harchand
Enter sailry : 17000
Enter Department of Employee : Markcketing            
Enter Employee ID : 1004
Enter Employee name : XYZ
Enter sailry : 0000
Enter Department of Employee : abc
Enter Employee ID : 1005
Enter Employee name : ABC
Enter sailry : 0000
Enter Department of Employee : XYZ

Name : Vipin.
ID : 1001.
Sailry : 18200.689453.
Department : IT.

Name : Yatender.
ID : 1002.
Sailry : 18000.000000.
Department : Sales.

Name : Harchand.
ID : 1003.
Sailry : 17000.000000.
Department : Markcketing.

Name : XYZ.
ID : 1004.
Sailry : 0.000000.
Department : abc.

Name : ABC.
ID : 1005.
Sailry : 0.000000.
Department : XYZ.

In our this example we will take marks of student as input and display names of student who got,
above 85% marks.

#define z 50
struct Student
{
    char name[z];
    float Math;
    float Physics;
    float Chemistry;
};
typedef struct Student std;
int main()
{
    std A[5];
    int i;
    float P;
    for ( i = 0 ; i < 5 ; i++ )
    {
        printf("Enter Student Name :");
        scanf("%s",A[i].name);

        printf("Enter marks of Math for %s :",A[i].name);
        scanf("%f",&A[i].Math);

        printf("Enter marks of Physics for %s :",A[i].name);
        scanf("%f",&A[i].Physics);

        printf("Enter marks of Chemistry for %s :",A[i].name);
        scanf("%f",&A[i].Chemistry);

        printf("\n");
    }

    for ( i = 0 ; i  85.00 )
            printf("%s Has %.2f%%.\n",A[i].name,P);
    }
    return 0;
}

Output:-

Enter marks of Math for Vipin :85
Enter marks of Physics for Vipin :86
Enter marks of Chemistry for Vipin :87

Enter Student Name :Nitin
Enter marks of Math for Nitin :88
Enter marks of Physics for Nitin :45
Enter marks of Chemistry for Nitin :67

Enter Student Name :Harchand
Enter marks of Math for Harchand :43
Enter marks of Physics for Harchand :45
Enter marks of Chemistry for Harchand :67

Enter Student Name :Yatender
Enter marks of Math for Yatender :56
Enter marks of Physics for Yatender :43
Enter marks of Chemistry for Yatender :88

Enter Student Name :KVY
Enter marks of Math for KVY :90
Enter marks of Physics for KVY :98
Enter marks of Chemistry for KVY :99

Vipin Has 86.00%.
KVY Has 95.66%.

POINTER TO STRUCTURE :

We know that pointer is a variable that holds the address of another data variable mean of any data type
that is int, float and double. In the same way we can also define pointer to structure .
here starting address of the member variable can be accessed. Thus search pointers structure pointer.

  struct    Name_of_structure    *ptrname;

e.g.

#define z 50
struct Student
{
    char name[z];
    float Math;
    float Physics;
    float Chemistry;
};
typedef struct Student std;
int main()
{
    std A = {"Vipin", 78, 87, 98};
    std *p;
    
    p = &A;

    printf("%s has %.1f mark in Math %.1f marks in Physics and %.1f marks in Chemistry.",(*p).name,(*p).Physics,(*p).Chemistry);
    // Using of () is coumpulsurry you can use -> (Arrow Operatore) insted of (*)
    
    return 0;
}

Output:-

Vipin has 87.0 mark in Math 98.0 marks in Physics and 0.0 marks in Chemistry.

ARROW OPERATORE :

This operator is used to access a structure number through a structure pointer variable,
It also known as structure pointer to member operator.

#include<>
#define z 50
struct Student
{
    char name[z];
    int Math;
    int Physics;
    int Chemistry;
};
typedef struct Student std;
int main()
{
    std A = {"Vipin", 78, 87, 98};
    std *p;
    
    p = &A;

    printf("Name : %s\n",p->name);
    printf("Marks in Math : %d.\n",p->Math);
    printf("Marks in Physics : %d.\n",p->Physics);
    printf("Marks in Chemistry : %d.\n",p->Chemistry);

    return 0;
}

Output:-

Name : Vipin
Marks in Math : 78.
Marks in Physics : 87.
Marks in Chemistry : 98.

STRUCTURE AND FUNCTION :

Like members of standered data types, structure variables can be passed to the
function by value or address.
The Example is given Below.

#define z 50
struct complex
{
    int real,img;
};
typedef struct complex complex;
int main()
{
    complex A;
    
    void input( complex * );
    void output( complex );

    input(&A);
    output(A);

    return 0;
}
void input( complex *x )
{
    printf("Enter value of numerator : ");
    scanf("%d",&x->real);

    printf("Enter value of Denominator : ");
    scanf("%d",&x->img);
}

void output( complex x )
{
    printf("%d/%d",x.real,x.img);
}

Output:-

Enter value of numerator : 12
Enter value of Denominator : 45
12/45

In our next blog we will look forward union in C Language. 🙂

by kumar vipin yadav at August 21, 2018 07:29 PM

August 19, 2018

Mayank Singhal (storymode7)

Typing without looking at the keyboard?

Seeing someone typing while looking at the screen seems fascinating, no? It is like the person typing has learned the language that computers speak.

I used to be awestruck when I saw someone type like this. In wonder, I’d look at the person typing, his eyes focused on the screen, and then at his fingers, moving wildly in every direction forming words magically somehow. Later, I came to know that this magical skill is called touch typing.

Before touch typing, I used to type with 2-4 fingers that moved in a frenzy.  I had the idea where a key was but I could not type without seeing the keyboard. But I was satisfied. (That’s what I used to think since I didn’t know what touch typing is).

Around a year back I came across the term touch typing (Almost the same time I was introduced to DGPLUG), and that reminded me of my fascination with the geeks who knew the art to type without looking at the keyboard.

I started practicing touch typing using gtypist. Daily. Diligently.
Initially, it was nothing but a pain in the fingers.  And I was typing slower than I could while looking at the keyboard.

But with weeks came accuracy. With months, came speed.

Few months later, I could touch type well.  And even after a long time has passed since I started with touch typing, my love for it only increased.  And to this date, I love typing and I’m still fascinated by crazy moving fingers on the keyboard. Except for this time, they are my own fingers!

During this time I also learned basic vim, which made qwerty my home.  My fingers never moved from the keyboard while writing or editing text. Like the hjkl keys were so comfortable that I wanted every application to have vim key-bindings. During this time I also tried spacemacs which was again a beauty.

 

That’s qwerty touch typing. How about Dvorak?

Around a month back, during a session, mbuf(one of our mentors at DGPLUG) suggested that one should be able to type at least 70 wpm.  I was shocked.  I knew he used Dvorak keyboard layout, but 70 wpm to me was more of an achievement than a lower limit. (btw, he upgraded the limit. And after a session recently, he said that 80 wpm should be minimum 😛 ).

Around the same time, while we all were having a typing race, one mentor said: “Wait till you see mbuf”, then I remembered the remark about 70 wpm and almost spontaneously asked what his (mbuf’s) typing speed was.
The reply was: “Always more than 80”.
I sat gaping at that number for a while. I was decent at qwerty, but from then on Dvorak had my attention.

 

Crux of a small research

Then for a day or two, I read about Dvorak and Qwerty.

Alphabetical typewriters had a problem in earlier times that while typing fast the rods attached to the keys would stick to each other. Qwerty dealt with this problem by spreading the keys so that clash was less often.
But this was in 1873!

Also, vowels that are present in almost all English words are not in the home row (except ‘a’).
Whereas in Dvorak all vowels are in the home row and in fact under your left five fingers!

TH: One of the most used key combinations used are under two adjacent fingers of your right hand, on the home row.

Also the keys that are used less are pushed at the positions that are a little harder to reach as compared to the home row keys.  Like v is pushed below the right hand ring finger.

The point here is that for Dvorak your fingers rest at the home row for longer as compared to the spaced out layout of qwerty.  You can type more effortlessly.

 

by storymode7 at August 19, 2018 10:38 AM

Ananya Maiti

Understanding python requests

In this post I am going to discuss the python-requests library. Python-requests is a powerful http library that helps you make http(s) requests very easily by writing minimal amount of code and also allows BasicHttp Authentication out of the box. But before I write this post I want to describe the motivation behind me writing this post.

When it comes to writing software, libraries are a lifesaver. There is a library that addresses almost every problem you need to solve. That was the case for me as well. Whenever I used to face a specific problem I would look to see, if a library already existed. But I never tried to understand how they were implemented, the hard work that goes into building them, or the folks behind the libraries. Most of the libraries we use these days are open source and their source code is available somewhere. So we could, if we wished to, with a little hard work, understand the implementation.

During a related discussion with mbuf in #dglpug channel, he gave me a assignment to understand one of the libraries I have recently used and understand what data structures/algorithms it used. So I chose to look inside the source code of python-requests . Let’s begin by understanding how two nodes in a network actually communicate.

Socket Programming : The basis of all Networking Applications

Socket Programming is a way of connecting two nodes in a network and letting them communicate with each other. Usually, one node acts a server and other as a client. The server node listens to a port on an IP, while the client reaches out to make a connection. The combination of port and an IP is called a socket. The listener socket in the server listens to request from the client.

This is the basis of all Web Browsing that happens on the internet. Let us see how a basic client-server socket program looks like

As you can see a server binds to a port where it listens to any incoming request. In our case it is listening to all network interfaces 0.0.0.0 (which is represented by an empty string) at a random port 12345. For a HTTP Server the default port is 80. The server accepts any incoming request from a client and then sends a response and closes the connection.

When a client wants to connect to a server it connects to the port the server is listening on, and sends in the request. In this case we send the request to 127.0.0.1 which is the IP of the local computer known as localhost.

This is how any client-server communication would look like. But there is obviously lot more to it. There will be more than one request coming to a server so we will need Multi-Threaded server to handle it. In this case I sent simple text. But there could be different types of data like images, files etc.

Most of the communication that happens over the web uses HTTP which is a protocol to handle exchange and transfer of hypertext i.e. the output of the web pages we visit. Then there is HTTPS which is the secure version of HTTP which encrypts the communication happening over the network using protocols like TLS.

Making HTTP Requests in python

Handling HTTP/HTTPS requests in an application can be complex and so we have libraries in every programming language that make our life easier. In python there are quite a few libraries that can be used for working with HTTP. The most basic is the http.client which is a cpython library. The http.client uses socket programs that is used to make the request. Here’s how we make a HTTP request using http.client

For making Requests that involve Authentication we have to use Authorization headers in the request header. We have used the base64 library here for generating a Base64 encoded Authorization String.

Using python-requests for making HTTP requests

The http.client library is a very basic library for making http requests and its not used directly for making complex http requests. Requests is a library that wraps around http.client and gives us a really friendly interface to handle all kinds of http(s) requests, simple or complex and takes care of lots of other nitty gritty. TLS security for https requests, for e.g.

Requests heavily depends on urllib3 library which in turn uses the http.client library. This sample shows how requests is used for making http requests

You can see making requests is much simpler using requests module. Also it gracefully handles which protocol to use by parsing the url of the request

Let us now go over the implementation

Inspecting requests

The requests api contains method names similar to the type of request. So there is get, post, put, patch, delete, head methods.

Given below is a rough UML class diagram of the most important classes of the requests library

When we make a request using the request api the following things happen

1. Call to Session.request() method

Whenever we make a request using the requests api it calls a requests.request() method which in turn Calls the Session.request() method by creating a new session object. The request() method then creates a Request object and then prepares to make a request.

2. Create a PreparedRequest object

The request() method creates a PreparedRequest object using the Request object and prepares it for request

3. Prepare for the Request

The PreparedRequest object then makes a call to the prepare() method to prepare for the request. The prepare method makes a call to prepare_method(), prepare_url(), prepare_headers(), prepare_cookies(), prepare_body(), prepare_auth(), and prepare_hooks() methods. These methods does some pre-processing on the various request parameters

4. Send the Request

The Session object then calls the send() method to send the request. The send() method then gets the HTTPAdapter object which makes the request

5. Get the Response

The HTTPAdapter makes a call to its send() method which gets a connection object using get_connection() which then sends the request. It then gets the Response object using the request object and the httplib response from httplib library (httplib is the python2 version of http.client)

And now onwards, How does a request actually get sent and how do we get a httplib response ?

Enter the urllib3 module

The urllib3 module is used internally by requests to send the HTTP request. When the control comes to the HTTPAdapter.send() method the following things happen

1. Get the Connection object

The HTTPAdapter gets the connection object using the get_connection() method. It returns a urllib3.ConnectionPool object. The ConnectionPool object actually makes the request.

2. Check if the request is chunked and make the request

The request is checked to see if it’s chunked or not. If it is not chunked a call to urlopen() method of ConnectionPool object is made. The urlopen() method makes the lowest level call to make the request using the httplib(http.client in python3) library. So it takes in a lot of arguments from the PreparedRequest object.

If the request is chunked a new connection object is created, this time, the HTTPConnection object of httplib. The connection object will be used to send the request body in chunks using the HTTPConnection.send() method which uses socket program to send the request.

3. Get the httplib response

The httplib response is generated using the urlopen() method if the request is not chunked and if the request is chunked it is generated using the getresponse() method of httplib. Httplib then uses socket program to get the response.

And there you have it! The most important parts of the requests workflow. There is a lot more that you can know by reading the code further.

Libraries make the life of a developer simpler by solving a specific problem and making the code shareable and widespread. There’s also a lot of hard work involved in maintaining the library. So in case you are a regular user of a library do consider reading the source code if its available and contributing to it if possible.

Thanks to kennethreitz and the requests community for making our life easier with requests!

References

  1. https://www.geeksforgeeks.org/socket-programming-python/
  2. https://docs.python.org/2/howto/sockets.html
  3. https://en.wikipedia.org/wiki/HTTPS
  4. https://docs.python.org/3/library/http.client.html
  5. https://github.com/requests/requests
  6. https://github.com/urllib3/urllib3
  7. https://tutorialspoint.com/uml/uml_class_diagram.htm

Also many Thanks to #dgplug friends for helping me improving this post.

by ananyomaiti at August 19, 2018 07:23 AM

Siddhant N Trivedi (sidntrivedi)

Ideathon at IIIT Delhi.

Hey everyone,I along with 3 other members participated in a Hackathon or basically an Ideathon that took place at Indraprastha Institute of Information Technology (IIIT), Delhi on 17th and 18th August, 2018. It was a 24 hour hackathon in which we had to propose an idea and then get its...

August 19, 2018 07:00 AM

Kumar Vipin Yadav (kvy)

2-D Array and 2-D strings in C

2D Array and 2D strings

A 1-D array is a collection of several elements that contain only one row of elements.
The 2-D array is a collection of rows and columns where each row contains smiler number of columns.
The requirement of 2-D array is removing the need of several 1-d array and it may be helpful to create
mathematical data structure named as matrix.

Initializing 2-D Array

1.Screenshot from 2018-08-16 11-35-29
2.Screenshot from 2018-08-16 17-54-17

Taking input in a 2-D Array :-

int main()
{
    int a[3][2];
    int i,j;

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 2 ; j++ )
        {
            printf("Enter [%d][%d] element of array : ",i,j);
            scanf("%d",&a[i][j]);
        }
    }
}

Output:-

Enter [0][0] element of array : 1
Enter [0][1] element of array : 2
Enter [1][0] element of array : 3
Enter [1][1] element of array : 4
Enter [2][0] element of array : 5
Enter [2][1] element of array : 6

Taking input and printing a 2-D Array :-

int main()
{
    int a[3][2];
    int i,j;

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 2 ; j++ )
        {
            printf("Enter [%d][%d] element of array : ",i,j);
            scanf("%d",&a[i][j]);
        }
    }

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 2 ; j++ )
        {
            printf("%4d",a[i][j]);
        }
        printf("\n");
    }
}

Output :-

Enter [0][0] element of array : 1
Enter [0][1] element of array : 2
Enter [1][0] element of array : 3
Enter [1][1] element of array : 4
Enter [2][0] element of array : 5
Enter [2][1] element of array : 6
   1   2
   3   4
   5   6

Adding, Subtraction and multiplication of matrix :-

int main()
{
    int a[3][3];
    int b[3][3];
    int c[3][3];

    void input( int [][3] );

    void output( int [][3] );

    void sum( int [][3] , int [][3] , int [][3] );

    void subtraction( int [][3] , int [][3] ,int [][3] );

    void multiply( int [][3] , int [][3], int [][3] );

    printf("Taking input in first Array : \n");
    input(a);

    printf("Value in a : \n");
    output(a);

    printf("Taking input in first Array : \n");
    input(b);

    printf("\nValue in b : \n");
    output(b);

    printf("Adding a and b :\n");
    printf("\nvalue of sum of a and b:\n");
    sum(a,b,c);
    output(c);

    printf("Subtracting a and b :\n");
    printf("\nvalue of subtraction of a and b:\n");
    subtraction(a,b,c);
    output(c);

    printf("multiplying a and b :\n");
    printf("value of multiplication of a and b :\n");
    multiply(a,b,c);
    output(c);
}

void input( int a[][3] )
{
    int i ,j;

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 3 ; j++ )
        {
            printf("Enter [%d][%d] element of array : ",i,j);
            scanf("%d",&a[i][j]);
        }
    }
}

void output( int a[][3] )
{
    int i,j;
    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 3 ; j++ )
        {
            printf("%4d",a[i][j]);
        }
        printf("\n");
    }
}

void sum( int x[][3] , int y[][3], int z[][3] )
{
    int i,j;

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 3 ; j++ )
        {
            z[i][j] =  x[i][j] + y[i][j];       
        }
    }
}

void subtraction( int x[][3] , int y[][3], int z[][3] )
{
    int i,j;

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 3 ; j++ )
        {
            z[i][j] =  x[i][j] - y[i][j];       
        }
    }
}

void multiply( int x[][3] , int y[][3], int z[][3] )
{
    int i,j,k;

    for( i = 0 ; i < 3 ; i++ )
    {
        for( j = 0 ; j < 3 ; j++ )
        {
            z[i][j] = 0 ;
            for( k = 0 ; k < 3 ; k++ )
                z[i][j] = z[i][j] + ( x[i][k] * y[k][j] );
        }
    }
}

Output:-

Taking input in first Array : 
Enter [0][0] element of array : 1
Enter [0][1] element of array : 2
Enter [0][2] element of array : 3
Enter [1][0] element of array : 4
Enter [1][1] element of array : 5
Enter [1][2] element of array : 6
Enter [2][0] element of array : 7
Enter [2][1] element of array : 8
Enter [2][2] element of array : 9
Value in a : 
   1   2   3
   4   5   6
   7   8   9
Taking input in first Array : 
Enter [0][0] element of array : 1
Enter [0][1] element of array : 2
Enter [0][2] element of array : 3
Enter [1][0] element of array : 4
Enter [1][1] element of array : 5
Enter [1][2] element of array : 6
Enter [2][0] element of array : 7
Enter [2][1] element of array : 8
Enter [2][2] element of array : 9

Value in b : 
   1   2   3
   4   5   6
   7   8   9
Adding a and b :

value of sum of a and b:
   2   4   6
   8  10  12
  14  16  18
Subtracting a and b :

value of subtraction of a and b:
   0   0   0
   0   0   0
   0   0   0
multiplying a and b :
value of multiplication of a and b :
  30  36  42
  66  81  96
 102 126 150

2-D String :

As we know , A 1-D string can hold only one string at a time. To store more then one string,
we can create 2-D string.

Initializing of 2-D string :

screenshot-from-2018-08-19-00-21-19.png

Input with 2-D String :

In this program we will take input in 2-D String.

int main()
{
    char a[5][10];
    int i;

    for( i = 0 ; i < 5 ; i++ )
    {
        printf("Enter a string : ");
        scanf("%s",a[i]);
    }
    return 0;
}

output:

Enter a string : vipin
Enter a string : nitin
Enter a string : bhaskar
Enter a string : yatender
Enter a string : harchand

Output with 2-D String :

In this program we will print a 2-D string after taking input.

int main()
{
    char a[5][10];
    int i;

    for( i = 0 ; i < 5 ; i++ )
    {
        printf("Enter a string : ");
        scanf("%s",a[i]);
    }

    for( i = 0 ; i < 5 ; i++ )
    {
        puts(a[i]);
    }
    return 0;
}
Enter a string : Vipin
Enter a string : Nitin     
Enter a string : Bhaskar
Enter a string : Yatender
Enter a string : Harchand
Vipin
Nitin
Bhaskar
Yatender
Harchand

Now we will code a program who print all name start from v or V,
from a 2-D string :

int main()
{
    char a[10][10];
    int i;

    for( i = 0 ; i < 10 ; i++ )
    {
        printf("Enter a string : ");
        scanf("%s",a[i]);
    }

    for( i = 0 ; i < 10 ; i++ )
    {
        if ( a[i][0] == 'v' || a[i][0] == 'V')
            puts(a[i]);
    }
    return 0;
}

Output:-

Enter a string : vipin
Enter a string : nitin
Enter a string : bhaskar
Enter a string : harchand
Enter a string : yatender
Enter a string : vijay 
Enter a string : ajay
Enter a string : ram
Enter a string : Vinod
Enter a string : prateek
vipin
vijay
Vinod

This code will find given String from a bunch of String :

// Use string.h library
int main()
{
    char a[10][10];
    char b[10];
    int i;

    for( i = 0 ; i < 10 ; i++ )
    {
        printf("Enter a string : ");
        scanf("%s",a[i]);
    }

    printf("Enter a string you want to search : "); 
    scanf("%s",b);

    for( i = 0 ; i < 10 ; i++ )
    {
        if ( strcmp( a[i] , b ) == 0)
            printf("String is at a[%d]",i);
    }
    return 0;
}

Output:-

Enter a string : Vipin
Enter a string : nitin
Enter a string : yatender
Enter a string : bhaskar
Enter a string : ajay
Enter a string : vijay
Enter a string : harchand
Enter a string : ned           
Enter a string : caption
Enter a string : rajat
Enter a string you want to search : vijay
String is at a[5]

We can have more multi dimensional array but we use them according to our needs.
In our next blog-post we will read structures 🙂

by kumar vipin yadav at August 19, 2018 06:54 AM

August 18, 2018

Akshay Gaikwad (akshayg96)

Type hinting and Mypy

Python is dynamic typed language, but static type variable can be possible if we use type annotations. Python 3.5 and later versions have functionality of type hinting. Though It is completely optional. Type hinting is useful for testing purpose in CI. It does not change code to static variable; but...

August 18, 2018 07:00 AM

Rahul Jha (RJ722)

Do we really need to cover coverage with Vulture?

coverage - wow, so accurate - we need it…?

When this phase kicked in, I was still wrapping my head around coverage - My plan was to get coverage integrated with Vulture, which would allow users to “transfer” the results from coverage to Vulture so that the false positives were automatically detected and thereby supressed. It sounded so neat and moreso doable (using an interminnent xml file) and so naturally, I just quickly got down to nuts and bolts and started a Pull Request. But, alongst those splendid colors of awesome functionality, Jendrik comes in and talks a bunch on why we shouldn’t do it. I could extrapolate the following reasons:

  • We already created an easier, dynamic and robust way to create and manage whitelists (--make-whitelist) which shall eliminate the need of having 10 different things for dealing with false positives.
  • Coverage is a tool for dynamic analysis (which requires your code to be actually run) and is therefore slow, but gives much more accurate results. And, if we already have results from coverage, why would we then need Vulture for??
  • Vulture is supposed to be a static analysis tool.
  • Vulture would’ve no longer been independent of external modules.

But, still it struck me as a little odd at that time because I thought that the functionality was optional and if someone didn’t want it, he would simply just not use it - simple. By now, may be you’ve judged that that this was the “feature syndrome” talking (The more features we have, the more usable we are) and yes, you’re right. Luckily, Jendrik foresaw this early and redirected me towards http://neugierig.org/software/blog/2018/07/options which explains why it’s actually toxic for anything to have more “options” and how it was an expensive process in terms of time spent on writing, documenting and maintaining it.

I’m very thankful of Jendrik and proud of the fact that we’ve still managed to keep the workflow involved when using Vulture as simple as it could get. :-)

August 18, 2018 12:00 AM

August 15, 2018

Anu Kumari Gupta (ann)

split() v/s rsplit() & partition() v/s rpartition()

split(), rsplit(), partition(), rpartition() are the functions on strings that are used in Python. Sometimes there are confusion between these. If you feel the same, then I assure you, it will be no longer confusing to you.

Understanding split()

So, what does split() do? As the name suggests, split() splits the given string into parts. split() takes up two arguments – one is the delimiter string(i.e., the token which you wish to use for seperating or splitting into words). The other is the maxsplit value, that is, the maximum split that you wish to have. By default, split() takes up space as delimiter string. The resultant is the list of splited words.

Here is how you use it:

By passing no arguments,

>> s = "Hello people, How are you?"
>>> s.split()
['Hello', 'people,', 'How', 'are', 'you?']

By passing argument with just the delimiter,

>> s = "Hello people, How are you?"
>>> s.split(",")
['Hello people', ' How are you?']

By passing argument with the delimiter and the maxsplit (say 1, which means to allow only one split),

>>> s = "Hello people, How are you?"
>>> s.split('H', 1)
['', 'ello people, How are you?']

If you try passing any number against the maxsplit that is above the maximum splits possible, then it will always return the list of maximum possible seperated words.

Understanding rsplit()

You might have a question – When split() splits the string, why at all we need rsplit() and what is it? The answer is rsplit() does nothing extra than splitting a given string, except of the fact that it starts splitting from the right side. It parses the string from the right side.

Here is how you use it:

By passing no arguments,

>> s = "Hello people, How are you?"
>>> s.split()
['Hello', 'people,', 'How', 'are', 'you?']

By passing argument with just the delimiter,

>>> s = "Hello people, How are you?"
>>> s.split(",")
['Hello people', ' How are you?']

Note- the output remains the same when we don’t pass any arguments or when we just provide the delimiter.

However, if we pass the arguments with maxsplit as below, you will see the difference:

>> s = "Hello people, How are you?"
>>> s.rsplit('H', 1)
['Hello people, ', 'ow are you?']

Observe, now the split took place on the right occurrence of delimiter.

Understanding partition()

Understood split() and rsplit(). But what is partiton()? The answer is – partition() just splits the string into two parts, given the delimiter. It splits exactly into two parts (left part and right part of the specified delimiter). The output returns a tuple of the left part, the delimiter, and the right part.

Here is how you use it:

>> s = "I love Python because it is fun"
>>> s.partition("love")
('I ', 'love', ' Python because it is fun')

Note: There is no default argument. You have to pass an argument mandatorily otherwise it throws an error.

Understanding rpartition()

It should be intuitive to use, by know, the working of rpartition(). rpartition() just like rsplit() does the partition from right side. It parses the string from the right side and when a delimiter is found, it partition the string into two parts and give back the tuple to you as is the case for partition().

Here is how you use it:

>> s = "Imagining a sentence is so difficult, isn't it?"
>>> s.rpartition("is")
('Imagining a sentence is so difficult, ', 'is', "n't it?")

Notice the last occurrence of “is” in the above given string.

 

 

Hope this helps in understanding the working of these functions!

Happy Coding.

by anuGupta at August 15, 2018 07:37 PM

Kumar Vipin Yadav (kvy)

Pointers In C

Pointers in C

1. pointer is a user define data type.

2. A pointer variable stores address of another variable or NULL because pointer stores address,
of another variable so that with the help of pointer variable we can process the variable.

3. Run time memory allocation scheme can be applied only with pointers in c.

4. As we know in c language we ca no access variable of a function into another function but this can
be possible with help of pointers.

5. To create a pointer we can use * ( Re-direction operator )

syntax ::

DATATYPE     *ptr_name;

e.g.

   int           *p;
   char          *q;
   float         *r;

The Data type of pointer specify that a pointer can store address of a particular data type variable.

using pointer with different datatype :

int A = 12;        char B = 'X';       float C = 3.14;       double D = 21.22;
int *P;            char *Q;            float *R;             double *S;
P = &A;            Q = &B;             R = &C;               S = &D;

—> & operator is known as “address of” operator.

size of pointer :
pointer memory size is size of integer. because a pointer stores memory address, and memory address,
is always integer.

int A;             char B;      float C;       double D ;
2 byte             1 byte       4 byte         8 byte

int *P;            char *Q;     float *R;      double *S;
2 byte             2 byte       2 byte         2 byte

Let’s understand pointer with help of some examples :-

1.
Example
2.
Example
3.
Example

Hope you will got pointers.

Let’s solve some examples 🙂 :-

Now we will learn how to use pointer with simple asthmatics, strings, array and functions.

Pointers with simple asthmatics :-

1. A simple multiply program :-

int main()
{
    int A;
    int B;
    int C;
    int *p;
    int *q;
    int *r;

    A = 10;
    B = 20;

    p = &A;
    q = &B;
    r = &C;

    *r  = *p * *q ;

    printf("Multiply of A and B is %d.",*r);

    return 0;
}

Output:-

Multiply of A and B is 200.

2. A program to calculate Simple Interest :-

This programe will ask you the Principle, Rate and Time and give you the simple interest,
but we use Pointers here.

int main()
{
    float P ;
    float R ;
    float T ;
    float S;

    float *p;
    float *q;
    float *r;
    float *SI;

    p =  &amp;P;
    q =  &amp;R;
    r =  &amp;T;
    SI = &amp;S;

    printf("Enter Principle : ");
    scanf("%f",p);   // Because <code>p</code> has address of <code>P</code>, // So we can write <code>p</code> instead of <code>&amp;P</code>. printf("Enter Rate : "); scanf("%f",q); printf("Enter Time : "); scanf("%f",r); *SI = (*p * *q * *r)/100; // or *SI = (*p**q**r)/100; printf("Simple Interest is %.2f%%.",*SI); return 0; } 

Output:-

Enter Principle : 10000
Enter Rate : 2.4
Enter Time : 1.5
Simple Interest is 360.00%.

Pointers with functions :-

Now we will use pointer with functions.

3. A simple sum program using pointer and function :-

Here in this problem we will create a function that will store sum of
x and y in sum using function.

int main()
{
    int x = 90;
    int y = 67;
    int sum;

    void sum_of_2_number( int * , int * , int * );
    // In above statement we are telling that we give Address of variable as argument,
    // And receive them in pointers.

    sum_of_2_number( &x, &y, &sum );
    // Giving Address of variables.

    printf("Sum of x and y is %d.",sum);

    return 0;
}

void sum_of_2_number( int *a , int *b , int *c )
// Here we are reserving addresses in a, b and c.
{
    *c = *a + *b;
}

Output:-

Sum of x and y is 157.

4. A function that can swap value of 2 integer variables :-

Here in this problem in which we will have to swap values of 2 integers but,
with help of functions.
This can only be done with help of pointers only.

int main()
{
    int x = 90;
    int y = 67;

    void swap( int * , int * );

    printf("Values of x and y before calling function : \nx = %d y = %d \n",x,y);

    swap( &x, &y );

    printf("Values of x and y after calling function : \nx = %d y = %d \n",x,y);

    return 0;
}

void swap( int *a , int *b )
{
    int temp;

    temp = *a;
    *a = *b;
    *b = temp;
}
Values of x and y before calling function :
x = 90 y = 67
Values of x and y after calling function :
x = 67 y = 90

5. A function to calculate Area of a circle :-

Here we program A function who calculate area of a circle using pointers.

int main()
{
    float r;
    float area;

    void Area_of_circle( float * , float * );

    printf("Enter Radius of Circle : ");
    scanf("%f",&r);

    Area_of_circle( &r, &area );

    printf("Area of circle is %.3f.",area);

    return 0;
}

void Area_of_circle( float *a , float *b )
{
    *b = 3.14* *a * *a;
}
Enter Radius of Circle : 9
Area of circle is 254.340.

6. A function to count number of digit in integer :-

Our this function will take a integer and count how many digits it has.

int main()
{
    int n, count = 0;

    void Count_digit( int * , int * );

    printf("Enter a integer : ");
    scanf("%d",&n);

    Count_digit( &n , &count );

    printf("Number of digit in a integer are %d.",count);

    return 0;
}

void Count_digit( int *a , int *b )
{
    for( ; *a != 0 ; *a = *a/10 )
        *b = *b + 1;
}

Output:-

Enter a integer : 999999
Number of digit in a Integer are 6.

POINTERS WITH ARRAY :-

When we create an array, Then the array name declared as pointer variables,
that contain address of first element. This pointer variable is constant in nature means we can,
not change it’s value.

Screenshot from 2018-08-14 00-54-42

Arithmetic with pointer :-

1. Addition an integer with pointer –>

We can add only an integer to a pointer which return an address.

Screenshot from 2018-08-14 01-39-24

2. Subtraction an integer with pointer –>

We can subtract only an integer to a pointer which return an address.
Screenshot from 2018-08-14 01-41-14

MULTIPLICATION, DIVISION AND REMAINDER OPERATION ARE NOT ALLOWED WITH POINTERS.

3. Subtraction of 2 pointers –>

We can not add 2 pointer with each other but we can subtract 2 pointers which return,no of element between addresses.

Screenshot from 2018-08-14 01-59-58

4. We can compare 2 pointers using relational operators –>

Screenshot from 2018-08-14 02-45-06

Let’s use pointers to print arrays :-

1. Here we print a array using pointer :

int main()
{
    int a[5] = {23,54,56,67,78};

    int *p , i;

    p = a; // or p = &a[0];

    for ( i = 0 ; i < 5 ; i++ )
        printf("%d\n",*(p+i));

    return 0;
}

//or

int main()
{
    int a[5] = {23,54,56,67,78};

    int i;

    for ( i = 0 ; i < 5 ; i++ )
        printf("%d\n",*(a+i));

    return 0;
}
// or

int main()
{
    int a[5] = {23,54,56,67,78};

    int *p;

    for ( p = a ; p < a+5 ; p++ )
        printf("%d\n",*p);

    return 0;
}

Output:-

23
54
56
67
78

2. Here we print a array in reverse using pointer :

int main()
{
    int a[5] = {23,54,56,67,78};

    int *p;

    for ( p = a+4 ; p >= a ; p-- )
        printf("%d\n",*p);

    return 0;
}
//or
int main()
{
    int a[5] = {23,54,56,67,78};

    int *p , i;

    for ( i = 4, p = a ; i >= 0 ; i-- )
        printf("%d\n",*(p+i));

    return 0;
}
// or

int main()
{
    int a[5] = {23,54,56,67,78};

    int i;

    for ( i = 4 ; i >= 0 ; i-- )
        printf("%d\n",*(a+i));

    return 0;
}

Output:-

78
67
56
54
23

Pointers with String :

1. printing an string with help of pointers

int main()
{
    char a[] = "My name is vipin.";
    char *p;

    for ( p = a ; *p != 0 ; p++ )
        printf("%c",*p);

    return 0;
}

Output:-

My name is vipin.

 

by kumar vipin yadav at August 15, 2018 05:55 PM

August 13, 2018

Siddhant N Trivedi (sidntrivedi)

First Year of Programming

Having completed JEE and school, when one steps in college, he gets a new challenge-PROGRAMMING. If he had a CS background back in college, then it appears somewhat easy but if he had taken Physical Science in his 10+2, it gets a bit tough for him to get acknowledged with...

August 13, 2018 07:00 AM

Hello World!

Hello World to my new blog!! Its built on Jekyll and I am in love with its minimalism. Thinking out loud to write out my experiences and learnings here. Thanks and Cheers!

August 13, 2018 07:00 AM

August 12, 2018

Ratan Kulshreshtha

Bootstrap Your .gitignore

Many of us use git to version control our projects and we all can agree on one thing although that despite the benefits git provides, Git is hard: screwing up is easy, and figuring out how to fix your mistakes is really hard. And while working with git it is also important to tell git what files git should not remember thus not version control that, so .gitignore comes into the picture.

August 12, 2018 06:50 AM

August 10, 2018

Siddharth Sahoo

How to Learn to Code ?

In this blog we gonna talk about what should be the course of action to learn coding right from scratch . First of all If you feel you lack programming skill , don’t feel too bad.Try not to think that you are too late to learn how to code .So to begin with our very first step to learn programming is to choose a language you want to code in. First thing you have to do is find you interest area . This means you have to know which development you enjoy the most. It can be Web Development, application development, data science etc. Then you have make a domain language. This means you have to choose some languages you enjoy the most. You can know your favorable language by trying some. There are many languages you can go for like python,JAVA ,C ,C++ etc.It is advisable to start coding from either python or java as theses languages are easy to work on compared to C and C++.

[Youtube] Learn How to code to become an expert programmer.

If you don’t mind spending a few bucks, join some renowned coding classes or Coding Boot-camps which teaches concepts right from the scratch.Stay away from institutes who aim for making money rather than imparting knowledge. If you want to learn by yourself at home, Follow for the following fundamental steps: First of all learn all to code and understand basic programming logic.Start writing basic programs like whether a number is prime or not , palindrome , Armstrong etc.. After having a fair idea of such basic programs , start with the very first data structure i.e Array.. Try solving problems related to the concept of arrays. And when you are confident enough to solve all problems related to one dimensional arrays. Start with multi dimensional arrays. It would be easy to proceed with multi dimensional arrays if you have practiced arrays well. Now comes the most important part of coding , i.e. recursion. Recursion makes your code small and easier to understand. Try converting iterative codes to recursive code. This will help you have idea on how recursion works. View tutorials online to understand it better. After recursion, comes the part of understanding complexity of the program you write. Complexity helps you understand how efficient your code is going to be. And hence, makes you a good programmer. Next, learn how to allocate your memory dynamically . This is very important for you to learn as it helps you code efficiently. After all these basics , comes the most important part of coding – DATA STRUCTURE . Begin with linked list and move on to other data structures like stacks , queues , trees , binary trees , heaps and etc. And now, final piece of advice: There are several things you can do to improve your coding skills. Code as much as you can. Make it your hobby. Your day should not pass without coding.Make projects. Think of something and create it from scratch. Believe me, this helps a lot.Participate in Open source projects. It will also help you in reading others’ code.

If you are having a hard time with problems, do competitive programming. It will be awful in the start and you’ll get frustrated but if you stick to it long enough and work hard enough, you’ll become a great programmer .

Don’t learn to learn. Learn to build.

A important thing we need to understand is Knowing a language and knowing how to code are two completely different things. Knowing the syntax of various languages is not going to work.One needs to work on the code logic and algorithms and it is always advisable to code in a single particular language.Try not to learn every language out there.

Stick to one and master it.

Thank you for reading ! Happy Programming!

by CodedWorm at August 10, 2018 05:12 PM

Kumar Vipin Yadav (kvy)

FUNCTION WITH STRINGS IN C

Functions with Strings :-

We have a studied about inbuilt function of strings now we will create our own functions or,
we will learn function with strings.

1. Copy function:-

copy( A, B )
Our this function will copy A into B it work as strcpy() but It is coded by you :).

e.g.

#include<stdio.h>
int main()
{
    char A[] = "Vipin is my name";
    char B[20] = "Empty :)";

    void copy( char [] , char [] );
    printf("Values before changes : \n\n");
    puts(A);
    puts(B);

    copy(A,B);

    printf("\nValues after changes : \n\n");
    puts(A);
    puts(B);

    return 0;
}
void copy( char x[] , char y[])
{
    int i;

    for( i = 0 ; x[i] != 0 ; i++ )
    // Here 0 condition represent NULL
    {
        y[i] = x[i];
    }
    y[i] = 0;
}

Output:-

Values before changes : 

Vipin is my name
Empty :)

Values after changes : 

Vipin is my name
Vipin is my name

2. Length function:-

length( A )
Our this function will accept a String and find it’s length and return it.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "Vipin is my name";
    int length_of_String;

    int length( char [] );
    
    length_of_String = length( A );

    printf("Length of A is : %d.\n",length_of_String);

    return 0;
}
int length( char x[] )
{
    int i;

    for( i = 0 ; x[i] != 0 ; i++ );
    // This ';' will show that we are not writting anything in for loop     
    return --i;
}

Output:-

Length of A is : 15.

3. Counting vowels function:-

count_vowels( A )
Our this function will count vowels in a string.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "Vipin is my name";
    int number_or_vowels;

    int count_vowel( char [] );
    
    number_or_vowels = count_vowel( A );

    printf("Numbers of vowels in A is : %d.\n",number_or_vowels);

    return 0;
}
int count_vowel( char x[] )
{
    int i;
    int count;

    for( i = 0, count = 0 ; x[i] != 0 ; i++ )
    // Here 0 condition repentant NULL
    {
        if ( x[i] == 'a' || x[i] == 'e' || x[i] == 'i' || x[i] == 'o' || x[i] == 'u' )
            count++;
    }
    
    return count;
}

Output:-

Numbers of vowels in A is : 5.

4. Concatenating Strings function:-

concatenate_strings( A , B )
Our this function will concatenate A and B mean It append B with A,
It is same as strcat() but here we code this function.

e.g.

#include<stdio.h>
int main()
{
    char A[50] = "my name is ";
    char B[]   = " Kumar Vipin Yadav";
 
    void concatenate_strings( char [] , char[] );
    
    printf("Value of A before calling our function : \n\n");
    puts( A );

    concatenate_strings( A , B );

    printf("Value of A after calling our function : \n\n");
    puts( A );

    return 0;
}
void concatenate_strings( char x[] ,char y[] )
{
    int i;
    int len;

    for( i = 0 ; x[i] != 0 ; i++ );

    len = --i;

    for ( i = 0 ; y[i] != 0 ; i++ )
        x[len+i] = y[i];

    x[len+i] = 0;
    // here we add NULL in last of array A
}

Output:-

Value of A before calling our function : 

my name is 
Value of A after calling our function : 

my name is Kumar Vipin Yadav

5. Conciliating Words function:-

counting_words( A , B )
Our this function will take a string and count that how many words It has.

e.g.

#include<stdio.h>
int main()
{
    char A[50] = "my name is Vipin";
    int words;
 
    int counting_words( char[] );
    
    words = counting_words( A );

    printf("Number of word in our String is %d.\n",words );

    return 0;
}
int counting_words( char y[] )
{
    int i;
    int count;

    for ( i = 0, count = 0 ; y[i] != 0 ; i++ )
    {
        if ( y[i] == ' ' )
            count++;
    }
    return ++count;
}

Output:-

Number of word in our String is 4.

6. Counting alphabets, spaces, digits and symbols function:-

print_alphabets_spaces_digits_symbols( A )
Our this function will take a string and count that how many alphabets It has,
how many digits it has, how many symbols it has and how many spaces it has
and then print all information.
WE CAN EVEN RETURN ABOVE INFORMATION USING A ARRAY, IT’S YOUR HOME TASK HAVE A FUN  🙂

e.g.

#include<stdio.h>
int main()
{
    char A[50] = "my name is Vipin";
 
    void print_alphabets_spaces_digits_symbols( char [] );
    
    print_alphabets_spaces_digits_symbols( A );

    return 0;
}
void print_alphabets_spaces_digits_symbols( char y[] )
{
    int i;
    int space,alphabets,digit,symbols;

    space = 0 , alphabets = 0 , digit = 0 , symbols = 0 ;

    for ( i = 0 ; y[i] != 0 ; i++ )
    {
        if ( y[i] == ' ' )
            space++;
        else if ( y[i] >= 'a' && y[i] <= 'z' || y[i] >= 'A' && y[i] <= 'Z' )             alphabets++;         else if ( y[i] >= '0' && y[i] <= '9' )
            digit++;
        
        else
            symbols++;
        
    }
    printf("Alphabets = %d, Digit = %d, Space = %d and Symbols = %d.",alphabets,digit,space,symbols);
}

Output:-

Alphabets = 13, Digit = 0, Space = 3 and Symbols = 0.

7. Converting to lower case function:-

lower( A )
Our this function will take a string and convert it into lower case.

e.g.

#include<stdio.h>
int main()
{
    char A[50] = "My Name Is VIPIN";
 
    void lower( char [] );
    
    lower( A );

    puts( A );

    return 0;
}
void lower( char y[] )
{
    int i;

    for ( i = 0 ; y[i] != 0 ; i++ )
    {
        if ( y[i] >= 'a' && y[i] <= 'z' || y[i] == ' ')
            continue;
        else
            y[i] = y[i] + 32 ;
            // because ASCII value of upper case alphabets are 32 less then uppercase.
    }
}

Output:-

my name is vipin

8. Converting to upper case function:-

upper( A )
Our this function will take a string and convert it into upper case.

e.g.

#include<stdio.h>
int main()
{
    char A[50] = "My Name Is VIPIN";
 
    void upper( char [] );
    
    upper( A );

    puts( A );

    return 0;
}
void upper( char y[] )
{
    int i;

    for ( i = 0 ; y[i] != 0 ; i++ )
    {
        if ( y[i] >= 'A' && y[i] <= 'Z' || y[i] == ' ')
            continue;
        else
            y[i] = y[i] - 32 ;
            // because ASCII value of lower case alphabets are 32 greater then uppercase.
    }
}

Output:-

MY NAME IS VIPIN

9. Comparing function:-

compare( A, B )
Our this function will take 2 string and compare each other.
and return +ve value if A is greater, -ve value if B is greater and 0 if both are equal.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "My Name Is VIPIN";
    char B[] = "My Name Is VIPIN";
    int res;
    int compare( char [] , char [] );
    
    res = compare( A , B );

    if ( res == 0 )
        printf("Both strings are equal.");
    else if ( res > 0 )
        printf("Strings A is greater.");
    else
        printf("Strings B is greater.");

    return 0;
}
int compare( char x[] , char y[])
{
    int i;

    for ( i = 0 ; x[i] != 0 || y[i] != 0 ; i++ )
    {
        if ( x[i] != y[i] )
            return x[i]-y[i];
    }
    return 0;
}

Output:-

Both strings are equal.

10. reversing function in another string:-

revers_in_another( A, B )
Our this function will take 2 string and revers A in B.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "My Name Is VIPIN";
    char B[50];

    void revers_in_another( char [] , char [] );
    
    revers_in_another( A , B );

    puts(A);

    puts(B);

    return 0;
}
void revers_in_another( char x[] , char y[])
{
    int i,j;

    for ( i = 0 ; x[i] != 0 ; i++ );
     
    i -= 1; // because we are not taking NULL which was in last

    for ( j = 0 ; j <= i ; j++ )
        y[j] = x[i-j];

    y[j] = 0;

}

Output:-

My Name Is VIPIN
NIPIV sI emaN yM

11. reversing string:-

revers_in_itself( A )
Our this function will take a string and revers it within it.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "My Name Is VIPIN";
    char B[50];

    void revers_in_itself( char [] );
    
    printf("A before calling function. \n\n");
    puts(A);

    revers_in_itself( A );

    printf("A after calling function. \n\n");
    puts(A);
 
    return 0;
}
void revers_in_itself( char x[])
{
    int i,j,temp;

    for ( i = 0 ; x[i] != 0 ; i++ );

    i -= 1;

    for( j = 0 ; j <= i ; j++, i-- )
    {
        temp = x[j];
        x[j] = x[i];
        x[i] = temp;
    }

}

Output:-

A before calling function. 

My Name Is VIPIN
A after calling function. 

NIPIV sI emaN yM    

12. palindromes function :-

palindrome( A )
Our this function will take a string and return 1 if they are palandrom and,
return 0 if they are not palindrome.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "VIPIN";
    int res;

    int palindrome( char [] );

    res = palindrome( A );

    if ( res == 1 )
        printf("Yes String is palindrome.\n");
    else
        printf("No String is not palindrome.\n");
 
    return 0;
}
int palindrome( char x[])
{
    int i,j;

    for ( i = 0 ; x[i] != 0 ; i++ );

    i -= 1;

    for( j = 0 ; j <= i ; j++, i-- )
    {
        if ( x[i] != x[j] )
            return 0;
    }

    return 1;

}

Output:-

No String is not palindrome.

12. abbreviation function :-

abbreviation( A )
Our this function will take a string and print it’s abbrivation.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "Mohan Das Karam Chand Gandhi";

    void abbreviation( char [] );

    abbreviation( A );
 
    return 0;
}
void abbreviation( char x[] )
{
    int i,j;

    i = 0 , j = 0 ;
    do
    {
        if ( x[i] == ' ' )
        {
            printf("%c. ", x[j]);

            j = i+1;
        }
        
        i++;

    }while( x[i] != 0 );
    for ( ; x[j] != 0 ; j++ )
        printf("%c",x[j]);
}

Output :-

M. D. K. C. Gandhi

13. remove vowels function :-

remove_vowels( A )
Our this function will take a string and remove all vowels from it.

e.g.

#include<stdio.h>
int main()
{
    char A[] = "My Name Is Vipin";

    void remove_vowels( char [] );

    printf("A before calling function\n");
    puts(A);

    remove_vowels( A );
 
    printf("\nA after calling function\n");
    puts(A);

    return 0;
}
void remove_vowels( char x[] )
{
    int i,j;

    for ( i = 0 ; x[i] != 0 ; i++ )
    {
        if( x[i] == 'a' || x[i] == 'e' || x[i] == 'i' || x[i] == 'o' || x[i] == 'u' )
        {
            for ( j = i ; x[j] != 0 ; j++ )
                x[j] = x[j+1];
            
            i--;
        }
    }
}

Output:-

A before calling function
My Name Is Vipin

A after calling function
My Nm Is Vpn

In our next blog we will read about pointers 🙂 .

by kumar vipin yadav at August 10, 2018 12:58 PM

August 08, 2018

Vaibhav Kaushik (homuncculus)

First Golang Meetup

Saturday 21-July-2018, was the first meetup of Gurgaon Golang meetup and also my first Golang meetup. Organised at Grofers Headquater, Gurgaon for all the gophers in Delhi-NCR. Group Photo Everybody was already half way through the Q/A session when I reached (I was late). Kasisnu was giving a demo of an exercise from the Go book (TCP server that periodically writes the time). You can read the source code of the Exercise from here.

by Vaibhav Kaushik (vaibhavkaushik@disroot.org) at August 08, 2018 12:18 PM

August 07, 2018

Anu Kumari Gupta (ann)

Dictionary using CLI

If you write posts like me, I am sure, quite often you must have referred a dictionary. Even if you didn’t require it while writing posts or you don’t happen to blog, dictionary is something unavoidable and it should be readily available to you because at any point of time unknowingly, it may be required to you.

You may have different ways of using dictionaries in your life. By different ways of using  dictionaries I mean, you might have used it online, or sometimes while typing you may have a tendency to check your dictionary apps on phone, etc. That can be ineffective at times, because it may take your time in finding exactly what you need and breaks your concentration. But here am I, with some amazing handy commands, taken from this amazing book: The Linux Cookbook by Michael stutz, that you can use to refer Dictionary and it won’t take much of your time and efforts to feel comfortable with it. Let me show you how you can use dictionary through Command Line Interface.

If you are using GNU/Linux, you have a list of words already in your system. You can find it by using: whereis dict. You will get the location of the source.  It should be either /usr/dict or /usr/share/dict.  The traditional Unix-style dictionary is the words sorted in ascending order, a long list albeit! The newer type dictionary contains the headwords as well as their definitions. To use the latter, you need to install WordNet – “a lexical database containing Nouns, verbs, adjectives and adverbs, grouped into sets of cognitive synonyms (synsets), each expressing a distinct concept”. Note: There are other databases other than wordnet as well.

Let us look into what we can do with the System Dictionary:

  • Sometimes it so happens that you don’t remember the full word and if you remember the first part of it, you may wish to lookup a word that begin with the type of string. To lookup a word beginning with ‘civ'(say), you have the command : look civ. It will return the list of words that starts from that given string.
  • To list all the words containing the string (say, int), regardless of case type: grep -i int /usr/share/dict/word
  • To list all the words that end with a string (say, ed) use: grep ed$ /usr/share/dict/word

Using Wordnet, you can find the meaning of the words as well. To install in your system, it is as simple as sudo apt install wordnet (I am using Ubuntu).

Let us have a look into what we can do with Wordnet:

  • To see all the available options for that particular word, you can use: wordnet your_word. your_word is the word which you want to search for.
  • To search the definition of a particular word (say, sad) along with some sentences as examples, use : wn sad -over or wordnet sad -over

Personally,  I like Wordnet because it’s just a terminal away from me. I don’t have to go anywhere to hunt for the exact meaning of a particular word. It allows me different options/forms of what I want from that word. For example, it shows me all the derived senses of the word ‘sad’, if I use wn sad -deria. The output is:

Screenshot from 2018-08-08 01-59-29

Isn’t it cool? And amazingly, it has different options for different words. -deria was option available for this word because a at the end denotes the adjective (the type of the word ‘sad’) and deri denotes the derived forms. If you try with some different word like fun, you will see different options for wn funas :

Screenshot from 2018-08-08 01-53-56.png

Note how the options for this word changed. We have hypernyms, hyponyms, synonyms, attributes, derived forms, domain, familiarity, coordinate terms, common words available for this word ‘fun’. Here, n at the end of the commands denotes the Noun form (the word fun being noun).

Spell is another one such amazing tool to spell check the file interactively. You can download it using sudo apt install spell. Say, you have a file named ‘file.txt’. To spell check the entire file, you just need to use: ispell file.txt. Amazingly, it corrects each wrong spelt word individually by providing a lot other substitutes and similar sounding words, along with the option to add it to your personal dictionary, replace it then and there, uncapitalize it, lookup for it, etc

Screenshot from 2018-08-08 02-54-05

Screenshot from 2018-08-08 02-54-26

Do you feel any difference between what you use as your dictionary and the one above i.e., using command line interface? I hope Yes.

I like playing around with Linux tools and commands because they have so much to offer according to my needs. The best part is that I can modify the commands according to my desire. Obviously, I don’t need to learn the commands. More than that, I like to share these petty tricks and information with you all, as I happen to come across them. Hope this article was helpful to you!

by anuGupta at August 07, 2018 09:45 PM

Bhavesh Gupta (BhaveshSGupta)

#readingeveryday 2

For #readingeveryday and link Today I dedicated 15 mins to read documentation or pym python book.

August 07, 2018 06:06 PM

Priyanka Sharma

The “line” which keeps me motivated !

IMG_20180804_231511

Whenever you will feel less energized, demotivated just ask one question to you-

“What is stopping you ?”

The answer that comes to your mind is- “Nothing is stopping me !” Always remember one thing that someone in the world has already faced and overcame from the problem you may facing. So get up and ask few questions to yourself and say to you that-

  • Do I have the Potential ?

Yes definitely I have and why not ! I am capable of development into actuality.

  • Do I have the Courage ?

Yes, I have the strength to venture, persevere and withstand danger, fear or difficulty !

  • Do I have any reason of not making things happen and not giving my as best as I can ?

Definitely, I don’t have any excuse of not doing the best !

 

 

 

by priyanka8121 at August 07, 2018 03:36 PM

August 06, 2018

Bhavesh Gupta (BhaveshSGupta)

#Readingeveryday Day-1

I have been having difficulties in making reading a habbit so my friend Jason, introduce to something which is called #readingeveryday challenge to start reading here is the link. So this post and goes to that today is the day 1, rightnow as I am starting I am reading 15 min a day. Being a slow Reader I was able to read 6 pages of the book which I am currently “Think and Grow Rich” by Napoleon Hill.

August 06, 2018 10:33 AM

Pradhvan Bisht (pradhvan)

Grokking Algorithms

There are some books that you suggest to every person who asks you ” How should I start with … ?” Well being a recent graduate of yet another engineering college I have been asked a few times, “How to start with programming? Can you recommend some books ?” to those people I generally recommend this book with Python for you and me followed by “Jokes on you mate, I am as clueless as you are about programming 😛

To justify why I recommend this book to everyone who is starting with programming; here is my short review and if you want a one-liner I have added the TL;dr version too.

Grokking_algo

TL;dr When a comic book meets a programming book the result is grokking algorithms.

I have broken down the review into very basic pros and cons list that should give you the idea of the entire book. So starting with the pros:

1. Visualization is the key, one of the book’s strength lies in the neat sketches you get on every page with the unique way of storytelling. So while you’re busy figuring out the story and looking at the sketches, the author quietly passes those computer science fundamentals that would be taught in a boring lecture, which seems so fascinating and easy while reading the book.  For example, in the hash tables chapter, there is this one character  Maggie who work in the grocery store and knows all the product prices. So instead of searching the price catalog, the cashier can instantly check the price by asking her and we can say as in fancy computer science term, she can give the price in O(1) times for any item no matter what!

Maggie

One more example I could think of it the way it relates folding paper with binary search where the search space is divided into half just as we fold a paper in half every time we fold a paper.

B-search

The book is filled with such similar stories focusing on small but important concepts.

2. Short and crisp exercises, after every chapter there is a recap of major points and a small exercise of hardly 10 questions which are a blend of code and theory concepts and are enough to practice what you learned in the previous chapter. Plus the code is available on the GitHub repo and the answers to the theoretical concepts are printed at the end of the book. So it saves time and energy of searching for solutions online.

3. Great supplement books, although it is a good stand-alone book for a beginner programmer who is just starting out with python and is interested in algorithms but I believe this book will be best suited if you read it with some standard book because it majorly focuses on the concept and somewhat fails to go in much depth if you’re taking up a course of Algorithms in your college or you want to know more about a particular topic like hash tables, greedy algorithms etc.

As much as I love this book there are some cons to it too 😦

1. Expensive, the major drawback I found is that this book is a bit expensive, for a freshman it’s fine because he is yet to learn a lot and this book offers a good head start but for an intermediate user it’s still a big deal.

2. Too basic for intermediate programmers, I picked up this book in my last year of engineering when I had a basic understanding of the concepts explained in the book so I wasn’t that amazed what the book has to offer as it lacks the depth in the topics covered but I was amazed at how easily they were explained.

The above six points cover all the major section of the book and should give a brief idea about the book of what I thought it’s strength are and what it lacks.

Book Rating: 3.5/5

So if you are starting out as a freshman in college, starting an algorithms course or are just curious about algorithms with a decent saving left around that you usually spend on partying 😛 give this book a shot, you won’t be disappointed.

 

by Pradhvan Bisht at August 06, 2018 08:07 AM

August 05, 2018

Aman Verma (nightwarriorxxx)

Week6 -Day1 and Day 2

“It takes as much energy to wish as it does to plan.”

-Eleanor Roosevelt

Week 6 Day1 and Day2 were awesome. I went to two meetups each day.

The first one was Foss Mega Meetup in Adobe Systems.The talks given by people were like awesome. The schedule was as follows:-
1. How to Learn Effectively
2. Akka Reactor
3.Panel Discussion
4.Hiring and Pitching sessions
As it was my first meetup I felt amazing and was introduced to great people working on different things. These amazing people with great skill set not only clear my doubts but also gave me advice how to solve every problem and cleared my confusions also.

The second was Linux Chix India meetup at IIIT-D. Another great event organised by again great people with great skill set.The schedule was like:-
1.Bash for Beginners
2.Chaos Engineering Session
3.How to contribute of Open Source
The “Chaos Engineering” session was just phenomenal. It’s like you break the system and then others make the system. Seriously, I learned a great alot.

Happy hacking

by nightwarriorxxx at August 05, 2018 05:51 PM

Ratan Kulshreshtha

DevConf.in 2018

I attended Devconf.IN which is the first annual Developers’ Conference to be organised by Red Hat at Christ University in Bengaluru, India held on 4-5 August 2018. Around ~1323 attendees attended Devconf.IN 2018 along with 110 speakers. There were around 14 parallel tracks (Agile, Blockchain, Cloud and Container, Community, Design, Developer Tools, DevOps, IOT, Machine Learning, Middleware, Platform, QE, Security, Storage) and BOFs, workshops so pretty much completely packed schedule.

August 05, 2018 05:13 PM

Priyanka Sharma

Algorithms: Heart of Computing

Before there were computers, there were algorithms. What are algorithms? Why is the study of algorithms worthwhile? What is the role of algorithms relative to other technologies used in computers?

These are some questions that came to the mind. So let’s begin !

What are algorithms ?

Informally, an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. An algorithm is thus a sequence of computational steps that transform the input into the output. We can also view an algorithm as a tool for solving a well-specified computational problem.

What kinds of problems are solved by algorithms?

Some of the practical applications of the Algorithms are:

  • The Human Genome Project has made great progress toward the goals of identifying all the 100,000 genes in human DNA, determining the sequences of the 3 billion chemical base pairs that make up human DNA, storing this information in databases, and developing tools for data analysis. Each of these steps requires sophisticated algorithms.

download (1)

  • The Internet enables people all around the world to quickly access and retrieve large amounts of information. With the aid of clever algorithms, sites on the Internet are able to manage and manipulate this large volume of data. Examples of problems that make essential use of algorithms include finding good routes on which the data will travel and using a search engine to quickly find pages on which particular information resides.

download (2)

  • Electronic commerce enables goods and services to be negotiated and exchanged electronically, and it depends on the privacy of personal information such as credit card numbers, passwords, and bank statements. The core technologies used in electronic commerce include public-key cryptography and digital signatures, which are based on numerical algorithms and number theory.

download (3)

Algorithms as a technology

Suppose computers were infinitely fast and computer memory was free. Would you have any reason to study algorithms? The answer is yes, if for no other reason than that you would still like to demonstrate that your solution method terminates and does so with the correct answer. If computers were infinitely fast, any correct method for solving a problem would do. You would probably want your implementation to be within the bounds of good software engineering practice (for example, your implementation should be well designed and documented), but you would most often use whichever method was the easiest to implement. Of course, computers may be fast, but they are not infinitely fast. And memory may be inexpensive, but it is not free. Computing time is therefore a bounded resource, and so is space in memory. You should use these resources wisely, and algorithms that are efficient in terms of time or space will help you do so.

So, this is all the small introduction to Algorithms. 

by priyanka8121 at August 05, 2018 04:34 PM

Abdul Raheem (ABD)

Session on PYM book and guest sessions

Hello, world!

Sorry for this late blog again, it’s because of my external exam and one update is that there will be no blog’s coming for about 10-20 days due to my external exams sorry for this excuse, anyways hope you are enjoying my blogs and you will enjoy this one too…

So on 27-August-2018, we had a session on PYM book by Kushal Das on looping chapter, there we had a game called the game of sticks and he asked everyone to  modify that game code so that every time a  user should win not the computer, so everybody started modifying it (me as well 🙂 ). Some changed the number of sticks to 20 from 21 but in that case, it was like a computer can also win and sometimes the number of  sticks went in negative then a clever answer came into the discussion, it was to change the word lose to win it was given by vishalirc(IRC nick) and the discussion goes on… in this session I got to know how to think differently and how to analyse the code and to think how it works, really got to know some good things by this session, all thanks to Kushal and dgplug :).And as always the homework goes on.

Guest session by Jennifer Helsby (redshiftzero IRC nick)

So who is she? and what does she do? she is currently the lead dev of the secure drop which is a whistleblowing platform at the freedom of the press foundation.

  • she is also the CTO for lucy parsons labs which is a 501c3 non-profit that does investigate journalism and police accountability work
  • previously she worked for data science for social good which she came into after a Ph.D. in astrophysics

and the session goes on with questions and answers. I don’t want to get deep into it as I don’t have much time but I will leave the link for that session do check that link as it was a very good session, You can go through the session over here.

Guest session by Vaishali Thakkar (Vaishali IRC nick)

So again who is she? and does she do? she is currently working as a freelance Linux kernel engineer and co-organiser of RGSoC which is a paid scholarship program for woman and binary people.

  • she is also a volunteer of the Linux kernel co-coordinator for outreach.
  • previously she worked as a kernel engineer at Oracle and Linux kernel intern under outreach program.

and the session goes on with questions and answers. Again I don’t want to get in deep as it will become a very lengthy blog and I don’t have much time as well. Do go through the logs as it was also a good one, not only this two are good every guest session was good and will be good, You can go through the logs over here.

Session on PYM book by our very own Kushal Das

So due to my college work and these bloody exams, I couldn’t attend this session but got to know some good things from PYM book which was given to us by Kushal Das. I have gone through the logs and I saw the question by Kushal which was this

Q:- Say, you have 500 names or 5000 names. and I want you to tell me if the “asdfas” exists in those or not. How will you store the names in your code?

and my answer to this was a list but got to know one more answer which was using a dictionary anyways here are the answers to the above question

1. Using list We can check if a value is there in a list using in. “asdfas” in names Where names is a list of all the names.

2. using dictionary say d = {“name”: True} and we have added all the names as keys. then we can use in again. “asdfas” in d.

You can go through the logs of the Pym session of  3-August-2018 over here.

Happy learning 🙂

by abdulraheemme at August 05, 2018 01:16 PM

August 03, 2018

Bhavesh Gupta (BhaveshSGupta)

Reading Habit

I am trying to develop the habit of reading. Recently while going through #dgplug summer training, there have been discussion about having a habit to read. You write 1/10th part of what you read. Reading and writing both is considered to be one of the most important part of engineer. So trying to follow above I started reading books still non-technical but as a first step I did start. I do a lot of technical reading, but I never write about it so one of the task is to start writting about technical readings be it github projects I am going to try to write about it.

August 03, 2018 10:28 PM

Aman Verma (nightwarriorxxx)

#Week5 Day6

“Don’t blame others as an excuse for you not working hard enough.”

I am little bit confused these days because of my college schedule and that is the main reason I won’t be able to write blog daily and punctually. I know it’s difficult to manage time but at the end of the day I have to plan something to manage my time. Just got an advice from a senior that if will be able to manage time if you have short term goals otherwise you will only waste your time.

Coming to technical part as I have been learning python these days. Now I have moved on to Django.I have started with a project in which an admin can write and posts its blogs. Its always good to start with a project to learn anything. I have a desired aim to contribute to Open Source Community. Hopefully I will!!

Happy Hacking

by nightwarriorxxx at August 03, 2018 04:54 PM

August 02, 2018

Anu Kumari Gupta (ann)

Internet Relay Chat

Hola folks!

If you are hearing about IRC for the first time and you wish to know about it, don’t worry, you are at the right place. This post should get you started and guide you along. I have covered the basic things that you should know and some useful tips and tricks. Enjoy reading.

What is IRC?

As Wikipedia defines, IRC (Internet Relay Chat ) is an application-layer protocol used for communication in the form of chatting through text. To start talking through IRC, you need to have IRC clients. These basically are applications that needs to be installed or you can do this through browser. Examples of some IRC clients are: XChat, WeeChat, HexChat, etc. that you can use in your PC. You can find the comparison here. Mobile applications include AndroIRC, IRCCloud, HoloIRC etc. Browser based clients are KiwiIRC, Mibbit, etc. Try them all and choose what you like! These IRC clients connect to a server you have set as default in your program settings. Communication is done in channels(discussion forums), and requires certain rules and etiquette which you need to follow.

If you have a question like – Why IRC? – IRC because it is considered as the main communication channel for open source projects. It is the most light-weight platform that can run on even low bandwidth Internet. There are several channels available on several servers, which you can join according to your interests (My favorite the one close to my heart is #dgplug – Linux Users’ group of Durgapur with the motto Learn and teach others:) ). All you need to have is the proper name of the channel, if you wish to join any. Internally, for every message you send in the channel through your client application, it is sent across the internet to the IRC servers, which echoes it to every other user connected to the channel.

Interested? Let’s get accustomed with the basics.

How to get started?

To get started, you ought to follow the following steps :

1. Like I mentioned, to join a particular channel, you have to start by joining a server. Simplest way of doing it is running this command in your IRC client : /server chat.freenode.net You can also do it manually based on the type of IRC client you are using.

2. To start using IRC, you have to have a nickname i.e., the name that will be used to address you. You will be called with this name if you join a channel. In other words, you will be known to the other users with this name that you will provide at the time of registration. Choose a nickname and  type this in the chat head of freenode : /nick YourNick. Note – YourNick is the name given by you, which you wish to have. YourNick should contain lower case alphabets, underscore(_), digits(0-9), or hyphen (-) and a maximum of 16 characters.
If you face an issue like “The nick is already in use”. It means you have to choose a different nick because it is already been taken.

3. Next step is to register your nick because you would like to have this as permanent and restrain other people from using your nick which you choose. To register, type the following in the freenode chat head :/msg nickserv register password email.Password is the password you wish to set for your nick to protect your nick and claim your identity. Email is the email that you need to give for confirming the password that has been set up.

4. When you receive the confirmation mail, do the specified instructions mentioned in your mail, in the chat area of freenode.

5. After you have verified your nick, you are all set to go ahead. If you ever get disconnected, you can identify yourself (similar to sign-in option that you use in other platforms) using: /msg nickserv identify YourNick Password.

6. Now that you have a proper identity, your task is to join a channel i.e., your main purpose on being in IRC. There are several channels that you can join and discuss. To join a channel, just write /join #channel_name. In place of channel_name, you have to write the proper name of the channel existing on the server.

Do’s and Dont’s

Unlike any other platform, there are certain norms that you must keep in mind while using IRC:

  • Type in full proper English sentences.
  • Be polite and gentle.
  • Be patient specially when nobody answers you or you disagree with someone on a particular context.
  • Remember IRC channels are very useful in gaining knowledge and you happen to see knowledgeable, renowned people, specialists in a particular domain hanging around in channels. So, you should be specific and meaningful in the questions you ask.
  • Do not act foolish.
  • Do not use any slang. Don’t swear. Don’t be obnoxious.
  • Do not use ALL CAPS TO TYPE – it is like you are shouting at someone.
  • Do not flood the channel i.e, sending too many texts all at once

The above are some of the basic requirements that you need to keep in mind before speaking up in any channel. Any intolerance or wayward behaviors, could get you kicked out or banned permanently from a channel. Yes you heard that right!

Utilities of IRC

IRC is very useful, if you use it the right way. Make the most of IRC by learning from other people’s issues, exploring stuff, finding problems to your solutions by reaching out to people in that domain, finding projects and mentors, etc. I leave it to you to find more 🙂

Talking about some other basic functionality, If you are on IRC (Internet Relay Chat), you get certain services known as IRC services. You use this to modify and/or add  functionality to your account. These are basically a special type of bots that has several statuses and flags for you to set. The most common services that you will find are:

  • NickServ – a nickname service bot. You might have observed that while registering you messaged NickServ with your email and password. It has other functions too.

Type /msg NickServ help and you are sure to get the following commands:

SET                               – Sets various control flags
UNGROUP                   – Removes a nickname from your account
Other commands     – ACC, ACCESS, CERT, DROP, HELP, LISTLOGINS, LISTOWNMAIL, LOGOUT, REGAIN, SETPASS, STATUS, TAXONOMY, VACATION, VERIFY

If you do not know what these commands are for, you can try to seek individual help by typing in: /msg NickServ help <command>. There may be some sub-commands within a command, like in case of SET command, if you type /msg NickServ help SET, you get to see the following set of sub-commands:

ACCOUNTNAME – Changes your account name
EMAIL                   – Changes your email address
EMAILMEMOS    – Forwards incoming memos to your email address
ENFORCE              – Enables or disables automatic protection of a nickname
HIDEMAIL            – Hides your email
NEVERDROP        – Prevents you from being added to access lists.
NOMEMO              – Disables the ability to receive memos
NOOP                     – Prevents services from settings mode upon you automatically
PASSWORD          – Changes the password associated with your account
PRIVATE               – Hides information about you from other users
PROPERTY           – Manipulates metadata entries associated with an account
PUBKEY                – Changes your ECDSANIST256p-CHALLENGE public key.
QUIETCHG           – Allows you to opt-out of channel change messages.

Now to see more of what each sub-commands offers you, you can type /msg NickServ help <command> <sub-command>. Example – /msg NickServ help SET HIDEMAIL.

Do try and configure all the necessary flags that is essential for you. One such useful is ENFORCE that ensures your nick is protected and it automatically changes the nick of the someone who attempts to use yours. Another such useful flag is PRIVATE that hides your information.

  • ChanServ – a channel service bot. It provides the status of the channel i.e, it maintains the basic information about the channel, like when a user joins or leaves a channel. It is set by the channel operators/admins. Normal users have no access to ChanServ. ChanServ provides several helpful services like kicking the user, banning the user, change the channel topic, etc.

You can obtain the info of a particular channel by : /msg chanserv info #channel. The information will contain the following: founder of the channel, timestamp and the date of registration of the channel, the status of the channel and the flags.

  • MemoServ –  a memo service bot, is used to record and deliver messages to users who are currently offline.
  • OperServ is used by IRC operators to perform administrative functions. Also known as AdminServ, RootServ, or OpServ (srvx).

Some others are also seen following this naming convention in some services packages including:

  • BotServ, a bot which allows channel operators to assign bots to their channels. These bots are mostly a ChanServ representative in the channel.
  • HelpServ, the help service bot, is used to provide help on a variety of IRC topics.
  • HostServ, a host service bot, is used to allow general users to register a vhost so that their real IP address on IRC is hidden.
  • RootServ, used on specific networks, is utilized by Services Root Administrators to perform Root Administrative functions for the IRC Network and Services Program.
  • SpamServ, used to protect channels against spam.[1]
  • StatServ, a statistic services bot, is used to perform various statistical analysis on the IRC Network.

[Reference URL : https://en.wikipedia.org/wiki/IRC_services under heading : Components]

Useful commands

Now that you have figured out the basic commands and their usage, there are several other commands and options available in IRC like the following:

/LIST – It lists all the available channels on the server. The list is really long.

/WHOIS <nick> – It shows information about the specified nick.

/NAMES #channel – It lists all the users on that channel.

/AWAY <message> – To denote the users that you are not using IRC at the current moment, with a message. However, /AWAY can follow no message also.

/QUIT <message> – To quit the IRC and the current channel with a message.

/ME <message> – To denote any action of yours. Example- /me is happy to join dgplug will appear as ann is happy to join dgplug (ann is my nickname. If you use this, your nick will appear instead of ann)

/QUERY <nick>– To open a seperate window for privately messaging the specified nick.

You can find more on this here.

Modes in IRC

I have covered most of the basics that you need to know about IRC. Another important concept that is used in IRC is that of channel modes used by channel operators and user modes that is used by users/participants. These modes have different use cases and functionalities. You can check the several possible modes here.

To set user mode, you need to type in the chat head of freenode: /mode nickname +/-mode. So, for example, you wish to set +R mode, which ignores private messages from users who are not identified with services, you have to type in /mode nickname +R. Similarly, to remove this feature, you can do /mode nickname -R.

Channel operators can set modes accordingly with the help of available channel modes. These modes acts like core settings of a channel. One such example is +r, which prevents users who are not identified to services from joining the channel.

If you as a user wish to see the modes set by a particular channel, you can check by: /mode #channel.

Facts and Figures

Hope you got a glimpse of IRC and enjoyed knowing about it. Unfortunately, according to the statistics, the usage of IRC declined by 60% after the social networking platforms like Facebook, Twitter, etc came into being.

Personally, I like IRC very much and I find it more useful than any other social platform. I  am sure you will feel the same once you try it. Go forth and conquer IRC!

 

Special thanks to Jason Braganza for editing and correcting my grammar.

by anuGupta at August 02, 2018 10:39 PM

August 01, 2018

Shiva Saxena (shiva)

How to create bootable USB using CLI

Hey! I was curious about if we can create a bootable USB drive from Command Line Interface alone. I always have my utmost trust in CLI but this task sought to be tricky. Therefore, I set myself relaxed and dived to search a solution on duckduckgo.

Surprisingly, I found the solution much sooner than my expectation. Following is a simple, efficient and fast way to create a bootable USB drive only from your command line.

Note: I am using my Ubuntu 16.04 LTS in this tutorial. You may continue with other GNU/Linux distros as well. Months back I wrote the post on How to make a Bootable pen drive using Rufus? feel free to have a look on it (in case you want to create bootable USB from windows.)

Requirements

  1. Any GNU/Linux distros.
  2. A formatted USB drive.
  3. ISO image of Operating System.

Step by step

1. Have a look at existing devices

1. Use the command lsblk to see the list of existing block devices in your system

$ lsblk
NAME  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda     8:0    0 298.1G  0 disk 
├─sda1  8:1    0  11.4G  0 part 
├─sda2  8:2    0   350M  0 part 
├─sda3  8:3    0 114.2G  0 part 
├─sda4  8:4    0     1K  0 part 
└─sda5  8:5    0 172.1G  0 part /
loop0   7:0    0  86.9M  1 loop /snap/core/4917
loop1   7:1    0  86.9M  1 loop /snap/core/4830

2. Identify your device

  1. Plug-in your USB device.
  2. Use lsblk again to identify your device. In my case it is sdb->sdb1
$ lsblk
NAME  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda     8:0    0 298.1G  0 disk 
├─sda1  8:1    0  11.4G  0 part 
├─sda2  8:2    0   350M  0 part 
├─sda3  8:3    0 114.2G  0 part 
├─sda4  8:4    0     1K  0 part 
└─sda5  8:5    0 172.1G  0 part /
sdb 8:16 1 7.5G 0 disk
└─sdb1  8:17   1   7.5G  0 part /media/shiva/myusbdrive 
loop0   7:0    0  86.9M  1 loop /snap/core/4917
loop1   7:1    0  86.9M  1 loop /snap/core/4830

3. Unmount your USB

To make your USB bootable, first, you need to unmount it.

$ umount /dev/sdb1

If the command above doesn’t work try it with sudo.

Note: Make sure you are selecting the correct device.

Make sure that the device is unmounted using lsblk command again, and notice that the MOUNTPOINT for your device has been removed.

$ lsblk
NAME  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda     8:0    0 298.1G  0 disk 
├─sda1  8:1    0  11.4G  0 part 
├─sda2  8:2    0   350M  0 part 
├─sda3  8:3    0 114.2G  0 part 
├─sda4  8:4    0     1K  0 part 
└─sda5  8:5    0 172.1G  0 part /
sdb 8:16 1 7.5G 0 disk
└─sdb1  8:17   1   7.5G  0 part 
loop0   7:0    0  86.9M  1 loop /snap/core/4917
loop1   7:1    0  86.9M  1 loop /snap/core/4830

4. Make it bootable

To make a bootable USB. In GNU/Linux we have a simple tool: dd command:

$ sudo dd bs=1M if=/path/to/os_image.iso of=/dev/<device> conv=fdatasync

Here:
<device> should be replaced with your device name. In my case it is sdb.

NOTE: <device> will be replaced with your device root name in my case it is “sdb” not “sdb1”. If you go with “sdb1” then your device might not be able to boot. So in my case, the command would be like:

$ sudo dd bs=1M if=~/Downloads/Fedora/Fedora-Workstation-Live-x86_64-28-1.1.iso of=/dev/sdb conv=fdatasync
[sudo] password for shiva: 
1705+0 records in
1705+0 records out
1787822080 bytes (1.8 GB, 1.7 GiB) copied, 309.198 s, 5.8 MB/s

It may take a while to complete. You may understand different attributes in this command from its help menu $ help dd.

5. Have fun!

Believe it or not but your USB is now bootable. I tried this method to make my bootable USB to install Fedora28. And my device is good to go. I tried to run Fedora in try mode first, and soon going to install it.

Thanks to Hayk Gevorgyan for his post: https://linoxide.com/linux-how-to/create-bootable-ubuntu-usb-flash-drive-terminal/

Thanks for reading!

Advertisements

by Shiva Saxena at August 01, 2018 04:12 PM

July 31, 2018

Manank Patni

Day 26

Have started a solving a programming exercise question from this Github repository. I have taken a task of 5 questions per day and will be pushibg these to my Github Account. This programming exercise has 3 levels of difficulty from Beginner to Advanced. So I will have a good grasp over Python Language.

by manankpatni at July 31, 2018 06:00 PM

Prashant Sharma (gutsytechster)

Get to know reStructuredText (reST)

While documenting our project, we often use Markdown syntax and save the file with .md extension. But have you ever noticed any repository which has something different? Yeah! in README file. Do you always see .md extension? Well, I first encountered with reStructuredText when I saw a repository containing .rst extension for README instead of .md. I was bit confused about what could it be, so I started searching about it and my curiosity lead me to the concept of reST. So, does it mean that Markdown and reST are same? Well, this would be like asking which flavor of lays is better. Is it Mango Salsa or Classic one(I like Classic one!)? Of course that depends on user and their use-case.  So is here.

However, the main focus of Markdown is on the static web pages without much formatting and that’s where it shines. Similarly, the main focus of reST is to write documentation in a what-you-see-is-what-you-get format. But there is no such restriction, one can use any of them in any way. reST requires two python packages to get interpret. You can install them using pip as

pip install python3-docutils
pip install python3-sphinx

These two packages provide rst2html utility, which can be used to convert an rst to a html file. So suppose you create a file and name it as practice.rst which would contain the reStructuredText, but it won’t be able to display the HTML on the browser. For that you would need to do something like this:

rst2html practice.rst practice.html

Now, you have the equivalent html file. It can now be used to display the content on the browser. You can convert the rst file into various formats using different utilities.

Note:- After each change in rst file, you’ll need to generate the HTML file with same process as told above.

reST Syntax

reST has simple and easy syntax, so as for understanding. Then let’s get familiar with its functionalities:

Paragraphs

Paragraphs are the group of text separated by one or more blank lines. All lines of same paragraph must be aligned at same indentation level.

Inline Markup

Often we require to highlight some specific part of text. For that we use inline markups.

*I am italic*
**I am bold**
``I have a code sample inside me``

They are as simple as they look. However, they have a few restrictions like they can’t be nested within one another. Also, they must be surrounded by space. For eg

These must be *surrounded* by space.

Note the spaces before and after asterisk.

Lists

We use lists in our documentations very often. So to use list, just prefix the list item with an asterisk(*). Do indent all the list item at same level. This will produce an unordered list. In order to produce an ordered list, prefix the list item with the number followed by a period. Well, there is something new here ie you can use # to autonumber the list.

* LIST ITEMS

  * Nested list item
  * Another nested list item

1. ORDERED LIST

  #. Autonumber list
  #. This item will already autonumbered.

You can use nested list as shown in above example, just make sure to give blank lines before and after the parent list element.

Definition List

These are the relative indented text. One can use them to define terms and their description which can span multiple paragraphs. Just make sure to give same indentation to all the lines under the description block.

term( upto a line of text)
    Definition of the term, which must be indented and

    Can even span multiple paragraphs

Blockquotes

They can be created by just indenting them more than the surrounding paragraphs.

This is a normal text in a paragraph
   This is a part of blockquote
This is not part of blockquote as it is not indented at same level.

Line Blocks

These blocks are used to give line breaks as we need.

  | These lines will be
  | broken exactly as
  | it seems

Literal Blocks

The blocks are used to escape any special meaning of particular symbols. These can be created by ending a paragraph by the special symbol “::“. The whole block must be indented and separated by blank lines from surrounding text.

This is a normal text paragraph ::

    This is a part of literal block.
    All lines at this indentation level won't be processed in any way.

    It can span multiple paragraphs

This is again part of normal text paragraph.

The marker has some special functionality. If the marker is preceded by a whitespace, the marker would get removed and if it is preceded by  a non-whitespace, the marker would get replaced by a colon(:)

Doctest Blocks

These are the interactive python session pasted into text. These are used to show the example pieces and do not require literal blocks syntax to be processed. These must end with a blank line.

>>> 2 + 3
5

Tables

To create a tabular structure in documentation, reST provides two ways to create tables. Simple tables are easy to create however with some restrictions ie they must contain more than one row and first column cells can’t contain multiple lines. They look something like this:

====== ======= =========
A       B       A and B
====== ======= =========
True    True    True
False   True    False
True    False   False
False   False   False
====== ======= =========

However to create more complex table, we need to draw the grid structure by ourself. It might seem difficult at first but it’s not that difficult. This would look something like this:

+--------------------------+----------+----------+---------+
|Header row, column 1      | Header 2 | Header 3 | Header 4|
|(Header rows are optional |          |          |         |
+==========================+==========+==========+=========+
| body row 1, column 1     | column 2 | column 3 | column 4|
+--------------------------+----------+----------+---------+
| body row 2               |    ..     |    ..   |    ..   |
+--------------------------+----------+----------+---------+

That’s it. Believe me, I have also made this by myself. The headers are separated by other fields through “=” sign. We will see about precedence of different symbols in a few moments. Keep reading.

Links

We sometimes need to refer to links in our documentation. Using links are easy in reST.

We can use inline links like this:

`Link Text <https://www.example.com>`_

Note the underscore at the end. The links are wrapped in the backticks followed by an underscore. One can also use target link as:

This paragraph contains a `target link`_.
.. _target link: https://www.example.com

Don’t forget to give the space between dots and the underscore.

Headings/Sections

Headers are created by underlining and overlining(optional) the header text by any of the punctuation character. There are few characters which can be used to mark headings. However, the following convention is generally followed as it is used in python style guide:

# with overline, for parts
* with overline, for chapters
=, for sections
-, for subsections
^, for subsubsections
", for paragraphs

But there is no such restriction. You can use any header for your purpose, just make sure you remain consistent throughout the document. For eg

=================
This is a heading
=================

---------------------
This is a sub-heading
---------------------

Images

We can insert images in our documentation through the following syntax:

.. image:: path/to/image

Again, don’t forget to give space after the periods. It’s pretty easy, isn’t it?

Footnotes

Including footnotes are also pretty simple in reST. Just do the following:

This is footnote 1 [#]_ and this is footnote 2 [#]_.

.. [#] First footnote
.. [#] Second footnote

I have used auto-numbered footnote. You can use [1]_ and [#f1]_ also. That totally depends on user. Footnotes contains labels which are either numeric or start with #.

Comments

Comments are the important part in any language whether it is small or big. They help to understand what does the particular section do and what options can be added and where. In reST, one can give comments as:

.. This is a comment.

You can also write multi-line comments as

..
   This is a multi line comment

   It can span along paragraphs.
   just make sure that there should be same;
   indentation level throughout the comment section. 
This is not a comment.

References:

  1. http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
  2. http://docutils.sourceforge.net/docs/user/rst/quickstart.html
  3. https://dgplug.org/irclogs/2012/rst-primer/

Conclusion

These are just few basics of reST. There is more to it. I myself don’t know much yet. Though as soon as I would learn, I’ll definitely gonna come up with another blog post for this. Till then…

Be curious and keep learning.

by gutsytechster at July 31, 2018 05:44 PM

July 30, 2018

Anu Kumari Gupta (ann)

J. P Barlow ~ EFF

February 7, 2018 was the dark day of our lives, when John Perry Barlow passed away at the age of 70 due to heart attack in San Francisco. John Perry Barlow, a co-founder of Electronic Frontier Foundation and the Freedom of the Press Foundation, political activist, lyricist for  Grateful Dead,  championed the ideals of free and open Internet. He had a vision to change our view of how we can use Internet. He came around in cyberspace in 1985 and in 1996, his  Declaration of the Independence of Cyberspace goes like this:

Governments of the Industrial World, you weary giants of flesh and steel, I come from Cyberspace, the new home of Mind. On behalf of the future, I ask you of the past to leave us alone. You are not welcome among us. You have no sovereignty where we gather.

This was in defense to the Internet, aimed at the government. In this declaration, he fought for protecting the Internet against the cruel impositions and laws from the government of United States. If you go through the entire 16 short paragraphs of his declaration, you would come to know his efforts and strong desire to appeal to the government to make all the difference. This was not only the appeal and his strife against the government, but a message to all those people about their rights and the way they use the Internet. It was his dream that anyone should express his or her beliefs  anywhere, without coercion.

In his keynote of PyCon – 2014, he talked about the cyberspace that needed reform since the space  was held upon a faint idea of culture. After he joined in the cyberspace,  he imagined a “new substrate for the community to form it”.  He told that Internet needs to be spread everywhere and “it was about the connection and not separation” and the content that needs liberation. He had an aspiration of creating a system, in which people can voice their thoughts freely, that doesn’t necessarily needs to be heard by everyone.

He believed in giving voice to the people and explained it by giving examples, like, if he had world’s largest diamond in his pocket, he could be curious or not of people not knowing it, but it is still valuable. Likewise, if a song is running in his head, it will be useless or valueless only after he let it be known. It was due to the fact, that the concert did by his band was taped by many people and he did not stop people from doing this, although, initially they thought that people are stealing and they should stop them to do so. He did this because he believed that it was going to be the “effecting system for spreading word about what they did”. He told about the culture existing in the different languages- there are TDX people, UNIX culture, Python. He talked about how government can use their power “to surveil people in a way that they have never done before”. He told how he almost always have a conversation with Ed Snowden, on how the government can’t stop even if they make something so that they do not happen to talk to each other. He dreamt that “right to know” should be considered as a natural human right and must be applicable to everyone who is being surveiled about the know-hows of what the government is doing  and the reason they are doing so.

Being that old, he still had the enthusiasm in himself and he desired to do a lot more. Truly, it is inspiring and at the same time encouraging to know about his avidity in his aspiration. He had a huge hope on us because we are the future and it is we who can shape up the politics and the technical architecture.

I was enthralled by the keynote.

Barlow is still alive and it’s living in his ideals that he set up. It’s on us now how to continue the legacy because his efforts are priceless. Watch the John Perry Barlow synopsium by the Internet Archives.

by anuGupta at July 30, 2018 09:33 PM

Kumar Vipin Yadav (kvy)

Inbuilt Functions In C

Inbuilt function for String Processing :-

NOTE : All Inbuilt Function of String need string.h library.

1. strcpy(Target_String , Source_String ) :-

This function will take 2 string as argument one is Target_String and another is Source_String,
this function will copy Source_String into Target_String.
e.g.

#include<stdio.h>
#include<string.h>
int main()
{
	char A[15] = "Vipin Yadav";
	char B[15] = "- - - - -";

	printf("Value of A and B before calling function. \n\n");
	puts(A);
	puts(B);

	strcpy(B,A);
  // It will copy A in B as you can see in Output.

	printf("\nValue of A and B after calling function. \n\n");
	puts(A);
	puts(B);

  return 0;
}

Output:-

Value of A and B before calling function. 

Vipin Yadav
- - - - -

Value of A and B after calling function. 

Vipin Yadav
Vipin Yadav

2. strncpy(Target_String , Source_String ) :-

This function will take 2 string as argument one is Target_String and another is Source_String,
just like strcpy() this function will copy n letters from Source_String into Target_String,
and it do not affect reaming part of string.
e.g.

#include<stdio.h>
#include<string.h>
int main()
{
	char A[15] = "Vipin Yadav";
	char B[15] = "- - - - -";

	printf("Value of A and B before calling function. \n\n");
	puts(A);
	puts(B);

	strncpy(B,A,5);
  // It will copy A in B but upto n characters and don't disturb other values of B.

	printf("\nValue of A and B after calling function. \n\n");
	puts(A);
	puts(B);

  return 0;
}

Output:-

Value of A and B before calling function. 

Vipin Yadav
- - - - -

Value of A and B after calling function. 

Vipin Yadav
Vipin - -

3. strcat(Target_String , Source_String ) :-

This function is used to concatenate Source_String just after Target_String or we can say to append Source_String with Target_String.

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
	char A[20] = " Vipin Yadav";
	char B[20] = "-->";

	printf("Value of A and B before calling function. \n\n");
	puts(A);
	puts(B);

	strcat(B,A);
	// It will append B with A

	printf("\nValue of A and B after calling function. \n\n");
	puts(A);
	puts(B);

  return 0;
}

Output:-

Value of A and B before calling function. 

 Vipin Yadav
-->

Value of A and B after calling function. 

 Vipin Yadav
--> Vipin Yadav

4. strncat(Target_String , Source_String ) :-

This function is used to concatenate Source_String just after Target_String or we can say to append Source_String, with Target_String but here we can limit that how much letters you want to append.

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
	char A[20] = " Vipin Yadav";
	char B[20] = "-->";

	printf("Value of A and B before calling function. \n\n");
	puts(A);
	puts(B);

	strncat(B,A,5);
	// It will append B with A upto 5 le tters

	printf("\nValue of A and B after calling function. \n\n");
	puts(A);
	puts(B);

  return 0;
}

Output:-

Value of A and B before calling function. 

 Vipin Yadav
-->

Value of A and B after calling function. 

 Vipin Yadav
--> Vipi    ( Don't mess with ' ' before V :;)

5. strcmp( First_String , Second_String ) :-

This function will take 2 Stings as argument and return a>0 value if First_String is,
greater( not on the basic of length 🙂 ) and return <0 if Second_String is greater and
return 0 If both are Equal.

NOTE : strcmp() IS CASE SENSITIVE
e.g.

#include<stdio.h>
#include<string.h>
int main()
{
	char A[20] = "aaaa";
	char B[20] = "AAAA";
	int x;

	x = strcmp(A,B);

	if ( x == 0 )
		printf("Both Stings are Equal.");
	else if ( x == 1 )
		printf("First Stings is greater.");
	else // mean strcmp() return -1
		printf("Second Stings is greater.");

  return 0;
}

Output:-

Second Stings is greater.

5. stricmp( First_String , Second_String ) or strcmpi( First_String , Second_String ) :-

This function will take 2 Stings as argument and return a>0 value if First_String is,
greater( not on the basic of length 🙂 ) and return <0 if Second_String is greater and
return 0 If both are Equal.

NOTE : stricmp() or strcmpi() IS NOT CASE SENSITIVE
AND THIS FUNCTION IS NOT FROM STANDERD LIBRARY OF C
            LANGUAGE   SO IT WILL NOT WORK IN SOME
COMPILERS LIKE IN LINUX/UNIX .

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[20] = "aaaa";
    char B[20] = "AAAA";

    int x;

    x = strcmpi();

    if ( x == 0 )
        printf("Both Stings are Equal.");
    else if ( x == 1 )
        printf("First Stings is greater.");
    else // mean strcmp() return -1
        printf("Second Stings is greater.");
    
    return 0;
}

Output:-

Both Stings are Equal.

6. strlen( String ) :-

This function will take a String as argument and return it’s length.

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[20] = "aaaa";

    int x;

    x = strlen(A);
    
    printf("Length of A is %d.",x);

    return 0;
}

Output:-

Length of A is 4.

7. strlwr( String ) :-

This function of C language will convert all alphabets of String in lowercase.

NOTE: THIS FUNCTION IS NOT FROM STANDARD LIBRARY OF C LANGUAGE SO IT WILL NOT WORK IN SOME COMPILERS LIKE IN LINUX/UNIX .

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[20] = "AAAA";

    strlwr(A);
    
    puts(A);

    return 0;
}

Output:-

aaaa

8. strupr( String ) :-

This function of C language will convet all alphabets of String in uppercase.

NOTE: THIS FUNCTION IS NOT FROM STANDARD LIBRARY OF C LANGUAGE SO IT WILL NOT WORK IN SOME
COMPILERS LIKE IN LINUX/UNIX .

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[20] = "aaaa";

    strupr(A);
    
    puts(A);

    return 0;
}

Output:-

AAAA

9. strset( String , character ) :-

This function will change hole string with a character you give,
means It take 2 argument a string and a character and replace hole string with that character.

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[20] = "Vipin";
    char C = 'V';

    strset(A,C);
    
    puts(A);

    return 0;
}

Output:-

VVVVV

10. strnset( String , character , n ) :-

This function will change hole string with a character you give but upto a limit,
means It take 3 argument a string and a character and a integer and replace hole string with that character,
till n .

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[20] = "Vipin";
    char C = 'V';

    strnset(A,C,3);
    
    puts(A);

    return 0;
}

Output:-

VVVin

11. strspm( String1 , String2 ) :-

This function will take 2 string as argument and return the number of characters
in the initial segment of String1 which consist only of characters from String2.

e.g.

#include<stdio.h>
#include<string.h>
int main()
{
    char A[] = "Vipin is my name";
    char C[] = "Vipin";
    int x;

    x = strspn(A,C);
    
    printf("String C matches In String A till %d.",x);

    return 0;
}

Output:-

String C matches In String A till 5.

One function is there name strstr()
we will learn it when we learn about pointers.

by kumar vipin yadav at July 30, 2018 06:29 PM

Pradhvan Bisht (pradhvan)

How to setup wifi drivers for RTL8723be network adapter for Manjaro/Arch linux

For a long time I have been facing wifi connectivity issue with my system, I used to get weak and unstable wifi signals with me sitting literally next to my router. When I looked at the issue online I came to realize every laptop that had the network adapter RTL8723BE was facing this issue or even worse they had no wifi signal.

Things I tried to solve this problem:

1) Hopped Linux distros

2) Downgraded my kernel version

Things I learned quick, it was a driver issue and not anywhere related to a particular distribution, so trying out different Linux distributions might not solve the problem. The hit and trial method were to manually downgrade the Linux kernel and check which one has the working wifi connection and stick to it. This approach was a budge and came with certain consequences.

The best approach is to manually download the drivers, locally build them in your machine and install them. You can get the latest drivers from this link.

$git clone https://github.com/lwfinger/rtlwifi_new

$cd rtlwifi_new

TIP: Before going forward make sure you have the Linux headers, I am using kernel version 4.14 which is the default for Manjaro 17. You can easily get them by

 $sudo pacman -S linux414-headers

Now you have the all the requirements, let’s build the driver 😛

$make clean && make

$sudo make install

$sudo mkinitcpio -P

This might take some time so be patient and if done successfully, reboot your system. After rebooting you need to edit the configuration file.

$vim /etc/modprobe.d/rtl8723be.conf

If this file is present good, else create a file at /etc/modprobe with the file name of rtl8723be.conf and add the following in the file

options rtl8723be fwlps=0 ant_sel=x

x is the antenna number either 1 or 2 for now let’s keep it 2, it worked best for me when it was 2.You can check by

$sudo rmmod rtl8723be

$sudo modprobe rtl87233 ant_sel=1

$sudo rmmod rtl8723be

$sudo modprobe rtl87233 ant_sel=2

Whichever works and gives you the best result add that to X. Hope this helps 🙂

 

by Pradhvan Bisht at July 30, 2018 03:57 PM

July 29, 2018

Manank Patni

Day 25

Read some chapters from the PYM Book. The book is great has some really good python tricks that aren’t easy to find except in those big books. I feel very lucky to find this book and the dgplug training.

by manankpatni at July 29, 2018 06:14 PM

Abdul Raheem (ABD)

Guest session by James Lopeman(meflin IRC nick)

So we had a guest session on 25-July-2018 by James Lopeman (Meflin IRC nick). So who is he? -He’s the CTO of his wireless ISP in Denver, Colorado USA, he has built on building ISP’S on 3 continents, and he’s a GSOC (google summer of code) admin for the python foundation and he has done Systers, Minnowbord, SyncDifferent, and The Linux Kernel Organization.

Some good suggestions that were given by him were

  • Always find something you love to learn and do.
  • Find good people to work.
  • You should always be ok with failing and many more, you can go through the logs over here.

If you are a beginner this was the few steps suggested by him that almost every beginner should follow to become a good system administrator:-

  • Always try something new
  • Don’t hesitate to experiment with something you like the most or wants to know about that particular thing 🙂
  • And the next one was to break your own computer and fix I guess he was saying about dismantling and fixing it 🙂
  • And try to install that on your own don’t take the help of an agent.

Kushal requested James Lopeman to give examples of things/services people can do/setup to learn some more amount of system? As most of the participants here are newbies.

  • One should set up networking not with the help of an agent but by his/her hands.
  • Web servers are easy fun you can do on your machine, learn to build a package for the distro you use (Which is very useful)
  • one should use most stem works as it helps to know how to write shell scripts they are used all over

Happy learning :).

by abdulraheemme at July 29, 2018 03:31 PM

Sehenaz Parvin

New milestone in humanity.

What is humanity according to India?
The answer is just a word ” hatred”. They just know how to hate people , kill people for no reasons.

What Indian people can do for their country?

  1. Molesting people
  2. Protesting against film industry
  3. Women destruction in every way possible
  4. Killing people for silly reason like cows, difference in religion,etc.
  5. And at last , a new thing that is added in the list recently – rape of animals irrespective of what they are.

Yes , now rape of animals. Sounds impossible Na? But no our Indian men can do anything . They have the ability to do everything. Remember the quote ” saare Jahan se accha, Hindustan hamara”? India is working full fledged on that to make our country developed both in internal and external networks. We are on the way to get an Oscar for the “best Country of the year” .

Today morning I got a news from Twitter and the heading was just unbelievable:

A pregnant goat dies after being gang raped by 8 men in Haryana.

I mean how ? Why? Till now we were frustrated with the rape victims of woman in the whole country and now this! What is left now to be seen? Who’s next ? A hen? A pig? A snake? Till now I knew that humans are interested in human molestation only but no ! Now along with females of the country we have to seek justice for our female animals too! Read this :

http://India just wow &amp; how ? A goat! Who's next? A hen, a pig? India Oscar is eagerly waiting for you.@narendramodi do you have anything to say here?
#humanityisdying
@RealtyMyths

#http://www.dnaindia.com/india/report-haryana-pregnant-goat-dies-after-being-gang-raped-by-8-men-2642880

And this was not enough. Read one more here. Today a dog which was only 7 months old was also raped by a man!

https://www.indiatoday.in/amp/mail-today/story/man-rapes-dog-to-death-section-377-unnatural-offences-ipc-1035577-2017-09-01?__twitter_impression=true

Now I have a question . Please tell me what feeling arouses by seeing a goat and a dog? No, I really wanted to know now what is that , that even biology failed to explain in men? Just because she belongs to feminine group and she has got vagina we would rape them ? This is humanity?

People of India who are giving great lectures on developing India must pay heed to these cases first. Something must be done to these sick and frustrated people. A country will be developed only after the people are developed.

Recently , India has been declared as the “most dangerous Country for women”. Soon it’s going to be declared as the ” most dangerous Country for feminine genders”

A new milestone is being set up by Indian men everyday. Humanity is in grave danger. If it is not controlled then we cannot imagine what will the next step in humanity.

Women are learning different sorts of self defence activities. What are the animals going to learn? They cannot speak even ! Are the men taking this advantage? Or we want to tell that animals admired them to do so !

“Man , when we are going to stop this ? ” It’s a grave question with no answer. Save humanity. Think now . It’s high time now.

I hope you will also have the same mentality after reading this. Tell me what you think about these habits of India of better Indian people.

P.S- I have dedicated these to those few men who are after the destruction of humanity . Not all men are the same. I want those men to speak up for these shameful activities too to restore humanity and peace in India again.

by potters6 at July 29, 2018 12:48 PM

July 28, 2018

Prajit Mukherjee(thegeekbong)

Python – The programming language of Coders, Not the Snake

Everyone has heard about Python, be it the snake or the programming language of coders. But, here I will only dedicate this post to the programming language. 😉 Python today, is one of the best programming languages because of it’s readability, ease of writing and also for notably using significant whitespace in the code which is also the design philosophy of the language.

Wikipedia says:

Python is interpreted high-level programming language for general purpose programming.

Easy peasy, right? Thought so.
The basic idea behind python is that it is a scripting language and we write scripts in a certain manner and then tell the python interpreter to interpret it and give us the output. That’s all.

Let’s dig into some history of this language, shall we?

History

Python was developed by Guido van Rossum

220px-Guido_van_Rossum_OSCON_2006Guido Van Rossum Credits: https://en.wikipedia.org/wiki/

Python was conceived in the late 1980s and early versions are released before the popular language Java in 1991. With its first release, python was not able to capture the market as Java did after it’s release in 1996. This must have been because of many reasons.

Soon enough came a revamped Python 2.0 on October 16, 2000, with features like cycle-detecting garbage collector, support of Unicode and many other features like list comprehension borrowed from Haskel. Python v1 went up to 1.6 before 2 was released.

 

220px-PythonProgLogoPython logo in the 1990s – 2005 Credits: https://en.wikipedia.org/wiki/

Python 2.0 was pretty good and extended till version Python 2.7 with features like backward compatibility, which means scripts written in Python 1 and other versions can be interpreted.

After Python 2, Python 3 was released on December 3, 2008. Python 3 is the Python as we know it today. With Python 3, the Python Software Foundation removed its backward compatibility feature and started fresh with new features and rectified several fundamental design flaws of the language. The main principle of Python 3 was to reduce feature duplication by removing older ways of doing things. Python 3 nonetheless was still a multi-paradigm language where the coder can choose among OOP, Structured programming, functional programming and many other.

Some major changes in Python were:

  • Changing print so that it is a built-in function, not a statement.
  • Renaming the raw_input(Python 2) function to just input. Thus, taking every input as a string datatype.
  • Changing the integer division functionality. In Python 2, if you do 3 / 2 the answer would have been 1But, with Python 3 onwards, if you type 3 / 2 it will give 1.5, and to only display the integer part you have to type 3 // 2, which will give 1.

These were some great features which were incorporated in the new Python 3.
Enough with the history lesson. Let’s jump to using python.

Using Python

Python is an easy to learn language. If you are a beginner and want hands-on experience with any programming language, then I highly recommend you begin with python.

For Windows user, you have to download the installer, depending on whether your PC it is 64-bit or 32-bit Run the executable file and don’t forget to select the option at the beginning screen to add python interpreter to your PATH. It is a very important step or you won’t be able to use python. Give it a while and after the installation is complete, open command prompt(Win+R -> Type cmd -> Enter). Type this command and hit enter.

python --version

This will show you the version of the python you have installed. if you see anything other than the version, like Python not found, for instance, then something has gone wrong.Either the install did not quite work or you forgot to add python to your path. Then you have to explicitly add the directory in your PATH variables.

For Linux and MacOS users, two different versions of python come inbuilt. For many users,

python --version

Gives the output as 2.7.x, as python invokes Python 2.7.x in your system, and

python3 --version

Gives the output as 3.6.x as python3 invokes 3.x.x.

You might want to change this, but I warn you not to do this since it can break your system permanently and you may have to install the OS again.

I work with LInux since it’s powerful, really handy and now in recent years, really easy to use.

Let’s begin.

We will be working with Python 3 and at the end of the blog, I’ll also give you links for those who want to study deeper about Python.

First, let’s start python:

python3

This will go in your terminals for Linux and macOS users, and for Windows users, you can do it in Command Prompt, but you will have to write just python.

The above command will show you somewhat like this:
python3-command

This tells us that the python command line interpreter has started and you can start writing code snippets.

Next, type in the commands as I have done below and you’ll see the output after you hit return after every command

 >>> 12+56
68
>>> 26-20
6
>>> -56+45
-11
>>> 25-50
-25
>>> 25/2
12.5
>>> #25//2 
... 
>>> 25//2 #Gives only integer part
12
>>> 5*2
10
>>> 5**2 #5 raise to the power 2
25
>>> var_1 = 100
>>> var_2 = 200
>>> var_1 + var_2
300
>>> print(var_1)
100
>>> print(var_1 + var_2)
300
>>> value = input('Enter the number to be squared: ')
Enter the number to be squared: 12
>>> value = value**2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
>>> #Right way to input an integer
>>> value = int(input('Enter the number to be squared: ')) 
Enter the number to be squared: 12
>>> value = value**2
>>> print(value)
144

The error above, in bold is because in Python 3 we don’t need to declare any datatype hence, by default it takes input and stores the value as a string.  Just like raw_input in Python 2. Hence, I have to explicitly tell Python that I am the boss here, :P. Kidding. I have to specify that I want an integer by using the int( ) method

python-code

So that was the command line. You type a command. You hit return. You see results.

But, how do we execute multiple lines of code in one go?
There is an application called MU editor in which you can write python scripts and run also. Go to the downloads section and download the installer. It is available for both Windows and MacOS. Do refer to the instructions beside the download links if you need to.

For Linux users, you can download MU editor by using the below command on the terminal as explained by Kushal Das in his book for python for everyone.

python3 -m pip install -U mu-editor --user

It is around 150 MBs and may take some time to download and install. When it is downloaded then to run it you can by the command

python3 -m mu

When you want to execute the code you can simply click RUN on the editor.

Saving scripts is also simple in its Graphical User Interface(GUI), just click SAVE and give the script a name without any space, ex. my_script.py.
.py 
is the file extension to let the interpreter know it is a python script. Every python script has .py extension. So the next time you see a .py file, whoop de doo, you know it’s a Python script.

So as now you know to write basic python and also where to write the scripts. You can go on and read about python more.

Where to use Python?

python-clip

Python is the most versatile language. Using Python (and it’s broad ecosystem) alone, we can work on web development, data science, make new programs and software, games, search engines, etc. Some very famous python libraries and frameworks which you can use as a developer are listed below:

Flask:

flask-python

Flask is small, easy to use framework written in Python used for web development. It was released on January 1, 2010, and is developed by Armin Ronacher
It is regarded as a microframework because it does not try to do much, leaving you in control. Flask as in Django cannot interact with a database or any type of form validation.

Django:

django-logo.jpeg

Django is a free and opensource framework which follows the model-view template(MVT) architectural pattern. Django provides easy and fast ways to interact with a database. Python is used throughout the application even for simple forms and data models. Their own website states “It is the framework for perfectionists with deadlines.”
You can learn about the latest stable version, Django 2.0 in its own documentation as it is the best resource on the internet.

NumPy, SciPy, matplotlib:

scipy-numpy-python-training.jpg

These very famous libraries are used for Data analytics and in the field of Data Science. If you want to be a Data Scientist or Data Analyst, these three libraries are essential to your work.

NumPy adds the support for solving multi-dimensional arrays and matrices. NumPy also provides a huge number of operations to work on these arrays. NumPy was first released in 1995 as Numeric and then in 2006, it changed to NumPy. Please refer to the documentation for further information and how to use it.

SciPy is a free and open-source Python library used for scientific computing and technical computing. To try and know more about SciPy read their documentation.

Matplotlib is a Python 2D plotting library which produces quality graphs and figures in a variety of formats. Matplotlib can be used in Python scripts, the Python and IPython shells, the Jupyter notebook, web application servers, and four graphical user interface toolkits. The latest stable release of matplotlib 2.2.2 can be read about in its dedicated documentation.

Source of the above info: https://www.scipy.org/index.html

Pandas:

pandasPicture Courtesy: https://www.analyticsvidhya.com/blog/2018/03/pandas-on-ray-python-library-make-processing-faster/

Pandas is a software library written for the Python programming language for data manipulation and analysis. In particular, it offers data structures and data analysis tools for Python. It is open source and anybody can contribute to it.

It has the below salient features(compiled by Wikipedia):

  • DataFrame object for data manipulation with integrated indexing.
  • Tools for reading and writing data between in-memory data structures and different file formats.
  • Data alignment and integrated handling of missing data.
  • Reshaping and pivoting of data sets.
  • Label-based slicing, fancy indexing, and subsetting of large data sets.
  • Data structure column insertion and deletion.

The library is highly optimized for performance.

This is just a teaser, there are tons of libraries and frameworks available for Python. If you go on research on the language and dig deeper you’ll get to know its true abilities, and in the end, you’ll fall in love with this programming language. Python scales with you as your programming skills grow.

Some examples of Python in daily life: the biggest example is Google, the search engine, search engines are written in python, Political parties gathering votes or analyzing their own supporters is the work of Data Analytics and Machine Learning, again python is used here and at many more places. Hence, its crucial that as a coder we learn and study more about python.

Here are some resources to learn about Python:

There are many resources to learn about Python such as edX, Udemy and many more. choose what you like and do tell me in the comments section what you chose.

Conclusion:

For me, Python is one of the best programming languages that I have worked with. It has a huge number of uses and at present, it is hovering high above every language. Today for a programmer, knowing Python is a necessity. Hence, I strongly urge you to research and get familiar with Python.

Do share and follow for more and please leave your feedback in the comments, it really means a lot to me.

by thegeekbong at July 28, 2018 09:56 PM

Bhavesh Gupta (BhaveshSGupta)

The Man Who Stole My Laptop's Ferrari

So, the story goes back to 2014-2015 maybe I don’t remember exactly when my laptop stopped working on later finding it was discovered the issue was with my onboard graphics card. A brief history I had a Sony Vaio laptop with AND Radeon graphics card on it. So, it was found that it was my graphics card which is creating issue. So, I took it to many people to check what can be done this that.

July 28, 2018 07:54 PM

Abdul Raheem (ABD)

Synopsis for the previous classes

As always again I got busy with my college work and I have my exams in the very first week of August anyways here is my blog enjoy :).

So we had a guest session on 20-July-2018 which was taken by manishearth(IRC nick) on rust, He works on servo and rust at Mozilla and he got involved with open source for a while now. Wikipedia was the thing which got him involved with open source, I don’t know much about rust so am not going deep with it, you can have a look to that session here. And you can have the more information about rust here.

 

Session by Kushal on PYM book:

So after about 3 days, we had a session by Kushal da on PYM book, he gave us some homework from PYM book before we had a guest session by manishearth. The session started and everyone greeted and Kushal asked us if we had completed our homework or not and then he took some questions/doubts about the given homework.

f"{d} was a {d:%A}, we started the mailing list back then."

So as I said Kushal took some questions and I was having a doubt in the above line, my doubt was what does the %A do? So answer to my question was here which was provided by Kushal da.

And everybody else started asking their doubts/question they got in the given homework. The thing which I too got to know from other question was about boolean values(True/False).In python, every digit including negative values are true except zero and one more thing to remember in python that always try to say True and False, the first letter is always capital in True and False (boolean values only).

The values which are False in python are False, 0 {}, []. Then we had some discussion on operators which are basically the common mathematical operator like +, -, *, / and then we headed over to the logical operators ‘and’ and ‘or’.

So first we will get started with the operator ‘and’. So if both a and b are true, then the answer is true, it will display the b value if both values are true. If either of them is false, then the final value is false.

Then coming to the operator ‘or’ if either of the sides is true then it will return true. so basically if the left-hand side value is true then it does not check the right-hand side value. And as always we got some home-work.

 

 

by abdulraheemme at July 28, 2018 03:21 PM

July 27, 2018

Muhammad Zeeshan Qazi (mzeeqazi)

Disturbed me

It’s counselling time at my University. Many students are joining this university. Many people have confusion and doubts, is this the right place for them? what is the placement stats? etc are the commonly asked questions and they ask their seniors about these doubts.

Just a week back, I received few texts where some fresher asked me about how to get into Google Summer of Code(GSoC). What skill it requires and many related questions. Since, am not a GSoCer, I felt am not the right person to answer such questions. So I pinged my friends and discussed to arrange some session for fresher in their induction program itself. As Joint Seat Allocation Authority ( JOSSA ) counselling is yet not finished, many people were reluctant to organize such a session. But somehow I convinced them and we decided to introduce all student managed groups of Computer Science. After this, I talked with the university administration to allot some slot to us And they allotted us half hour slot on Friday afternoon.

We discussed what will be topics for the session and I choose to speak on FOSS with my slide titled as FOSS@SMVDU, where SMVDU is my university. I choose to speak with this title as I have sought permission to organize at least three events in past. All applications to access lab, for financial support and other requirements have this name as the organizer. Though this group has no membership like thing and people from other groups work hard to organize its event.

As it has no member, many of co-organizer were against presenting FOSS@SMVDU as a separate group. They want to present this as an activity of a major student group. They call that major group as the mother of all other groups. I don’t know why I find myself more connected to FOSS@SMVDU than that major group. And I was reluctant to change the title of my slides.

This action of mine made many co-organizers furious. And they alleged that I am dividing the group. I believe I don’t have such intentions. I guess, am reluctant to change the title because I want to represent the idea of freedom rather than the ideas of that major group.

But things get bad to worse when one of my friend started doing things which I never expected and this act hurt me the most. I got disturbed. I don’t know whether I will be comfortable to work with him in any near future?

But still we managed to organize this event, we represented 6 groups and I never changed my slide’s title.

I am thankful to all organisers without their support organising such event will not be possible.

by Zeeshan at July 27, 2018 07:38 PM

Vivek Shukla

Truth and False Value in Python

Python support Boolean data type . Boolean data type is usually intent to denote the Truth and False values . It basically represent the two valued  logic of Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic .

In Python ,

0 , ‘ ‘ , [ ] , { } , ( ) , False and None are logical False Values  

True , any number except 0 , any non empty string , list , dictionary and tuple are logical Truth Values .

To check if a given literal or variable has Truth Value or False , We can use bool() function . 

boolean

If bool(value) return True then the value is logical Truth Value , if it return False then the value is logical False Value .

by vivekshuklai at July 27, 2018 04:29 PM

Manank Patni

Day 24

Missed today’s session of dgplug. Will read the logs.

by manankpatni at July 27, 2018 04:27 PM

Kumar Vipin Yadav (kvy)

Strings In C language

String:-

String is group of alphabets,digits and symobls. In C language, a string represented by char array.

e.g.  char S[20];

In this example S is a string of 20 characters but it can hold a string of only 19 characters,
because the last character of a string is always NULL.

NULL :-
It is a character used to repersent end of String.
It has three repersentactions:
1. NULL (need stdio.h)
2. '\0'
3. 0

String example

Output with String:-

1. Using printf() function:

printf will display the entire String using %s

e.g.

char a[20] = "Vipin Yadav";

printf("The String is %s",a);
// The String is Vipin Yadav

printf("The String is %.4s",a);
// The String is Vipi ( Here .4 will allow us to print only 4 letter of string only)

printf("The String is %10.4s",a);
// The String is ------Vipi
// Here 10.4 mean print 10 letter but use 4 letter from string here it take 4 letter and 
// use 6 ' ' but i use '-' instead of ' ' to show you

2. Using puts() function:

Input with String:-

1. Using scanf() function:

scanf() with %s :-
It can read one word of a string or a one word string.

e.g.
 char a[20];
 printf("Enter a string who contain lases then 20 words : ");
 scanf("%s",a);
 // NOTE : WE DO NOT USE '&' DURING A STRING INPUT.
 puts(a);

scanf() with %[^\n] :-
It can read a multi word string .

 char a[20];
 printf("Enter a string who contain lases then 20 words : ");
 scanf("%s",a);
 // NOTE : WE DO NOT USE '&' DURING A STRING INPUT.
 puts(a);

2. Using gets() function :-

gets() function can read multiple word once It work under stdio.h heder file

e.g.

 char a[20];
 printf("Enter a string who contain lases then 20 words : ");
 gets(a);
 puts(a);

In next post we will read about Inbuilt function and user-define of strings.

by kumar vipin yadav at July 27, 2018 01:46 PM

July 26, 2018

Jagannathan Tiruvallur Eachambadi

Moving to systemd-networkd

systemd-networkd is a network manager that comes built in with Systemd. It has features, similar to NetworkManager and ConnMan which are more commonly used in distributions like Ubuntu and Fedora.

My old system

I had moved away from NetworkManager one year back due to constant issues with connecting to enterprise Wi-Fi with logs and errors that were difficult to debug or fix. It was also difficult to see where the failures occurred prompted me to move towards a more modular system.

The hacked system did not have a manager on top and it was cobbled together with:

  1. wpa_supplicant for wireless.
  2. dhcpcd for DHCP (wired and wireless).
  3. dnscrypt-proxy for DNS over HTTPS and as a local cache.

Last week I started having problems when dhcpcd was not setting the proper network gateway and I couldn’t figure out what exactly was the issue since there were no updates to any of the affected programs. I realized that decoupling DHCP caused issues that can only be solved with a program that can react to network link changes properly. To be honest, this system did not have any issues for a long time and I could’ve just continued to use it after figuring out the problem but I thought it was time to try networkd.

systemd-networkd

It works similarly to how Systemd handles services. networkd uses INI style “.network” configuration files. Look at the man page for systemd.network for more information.

My motivation was to seamlessly handle wired and wireless interfaces without dropping connection due to state changes. For this purpose I had two files, /etc/systemd/network/20-wired.network

[Match]
Name=eno1

[Network]
DHCP=yes

[DHCP]
RouteMetric=10

and /etc/systemd/network/25-wireless.network with

[Match]
Name=wlp2s0b1

[Network]
DHCP=yes

[DHCP]
RouteMetric=20

You should start systemd-networkd.service and it should work with your existing wpa_supplicant@wlp2s0b1.service which should be setup separately. Network interface names eno1 and wlp2s0b1 are predictable and persistent across reboots, and are setup by Systemd.

My DHCP issue was solved by networkd knowing about both networks and handling them properly. The other nice property is I can set route metrics in the configuration which puts the kernel in charge of using the appropriate route when there are multiple gateways. Example of ip route with both interfaces connected:

$ ip ro
default via 192.168.1.1 dev eno1 proto dhcp src 192.168.1.125 metric 10
default via 10.46.255.254 dev wlp2s0b1 proto dhcp src 10.46.140.105 metric 20
10.46.128.0/17 dev wlp2s0b1 proto kernel scope link src 10.46.140.105
10.46.255.254 dev wlp2s0b1 proto dhcp scope link src 10.46.140.105 metric 20
192.168.1.0/24 dev eno1 proto kernel scope link src 192.168.1.125
192.168.1.1 dev eno1 proto dhcp scope link src 192.168.1.125 metric 10

Handling DNS

Systemd also comes with resolved which has a bunch of nice features and also integrates with options in the network files. However tempting this might be I still wanted to stick with my working dnscrypt-proxy setup. This is easily done by asking resolved to use 127.0.0.1 as its DNS server in /etc/systemd/resolved.conf. Now resolv.conf should have use 127.0.0.53 which is the resolved stub and it delegates the actual work to dnscrypt-proxy.

While you may feel, this is similar to NetworkManager I would point out that wpa_supplicant is handled separately and hence affords more ways to test your wireless connection before getting caught in an endless loop. Although if NetworkManager works for you, there isn’t a compelling reason to leave it. In the end, this was pretty easy to set up and the system looks more robust now.

July 26, 2018 11:04 PM

Mohit Bansal (philomath)

Setting up Tor to connect to IRC network!

Freenode to EliteBNC bouncer to Tor! First time I connected to IRC using webchat.freenode.net web portal with no encryption and IP hiding. With time, I moved to EliteBNC bouncer to read all the messages even when I am offline. Now, the time has demanded me to evolve a bit further. This is an instructable blog post on how to set up "Tor" proxy to connect to my #dgplug folks. The Onion Routing

by Abstract Learner (noreply@blogger.com) at July 26, 2018 07:54 PM

Aman Verma (nightwarriorxxx)

#Coding Streak!!! Days after

“Optimism is a happiness magnet. If you stay positive, good things and good people will be drawn to you.”
– Mary Lou Retton

As I have already posted in my previous blog.Currently I am learning python. I just finished python basics and now I moving towards Django.I founded many resources for Django and the following are the best from them:-

1.Django Official Documentation
2.Learn django by project
3.Django Girls Tutorials

All of them are good and easy understandable. Moreover it’s good if you ask your doubt on Django official IRC channel i.e #django.
Do learn to be active all the time on IRC.

Happy Hacking

by nightwarriorxxx at July 26, 2018 07:42 PM

Kumar Vipin Yadav (kvy)

Sorting In C

Hope you have haired about sorting , Arrange elements of an array either in ascending or descending,
order is called sorting.
we have a lot’s of sorting algorithm but here we will discuss about
1. Selection Sort
2. Bubble Sort

Selection Sort:-

Selection sort works by finding the smallest unsorted item in the list and swapping it with the item in
the current position.

The algorithm work works as follows:

1. set first position as current position.
2. Find the minimum value in the list.
3. Swap it with the value in current position.
4. Set next position as current position.
5. Respect Steps 2-4 until you reach end of list.

ascending order selection sory

Here we will make a program for arranging elements in ascending order.

selection-sort-in-ascending.c

#include<stdio.h>
int main()
{
  int A[5] = {5,2,1,4,3};
  int i;

  void Short( int [] );

  Short(A);

  for( i = 0 ; i < 5 ; i++ )
      printf("%d  ",A[i]);

  return 0;
}

void Short( int a[] )
{
  int i,j,pos,min,temp;

  for( j = 0 ; j < 4 ; j++)
  {
		pos = j;
		
    for( i = j ; i < 5 ; i++ )        {          if ( a[pos] > a[i] )
          pos = i;
      }
      temp = a[j];
      a[j] = a[pos];
      a[pos] = temp;
  }
}

Output :-

1  2  3  4  5

and here is a program for arranging elements of array in descending order using Selection Sort.

selection-sort-in-discending.c

#include<stdio.h>
int main()
{
  int A[5] = {5,2,1,4,3};
  int i;

  void Short( int [] );

  Short(A);

  for( i = 0 ; i < 5 ; i++ )
      printf("%d  ",A[i]);

  return 0;
}

void Short( int a[] )
{
  int i,j,pos,min,temp;

  for( j = 0 ; j < 4 ; j++)
  {
		pos = j;

    for( i = j ; i < 5 ; i++ )
      {
        if ( a[pos] < a[i] )
          pos = i;
      }
	temp = a[j];
      a[j] = a[pos];
      a[pos] = temp;
  }
}

Output:-

5  4  3  2  1

Bubble Sort:-

Bubble sort works by comparing two continuous items in the array.
It’s algorithm is very simple just compare adjacent element and Swap them.

ascending bubble sort

Let’s code a program for arranging elements of array in ascending order.

#include<stdio.h>
int main()
{
  int A[5] = {5,2,1,4,3};
  int i;

  void Short( int [] );

  Short(A);

  for( i = 0 ; i < 5 ; i++ )
      printf("%d  ",A[i]);

  return 0;
}

void Short( int a[] )
{
  int i,j,temp;
  for ( j = 0 ; j < 5 ; j++ )
   {
	for ( i = 0 ; i < 4 ; i ++ )
  	{ 
 		if ( a[i] > a[i+1] )
			{
				temp = a[i];
				a[i] = a[i+1];
				a[i+1] = temp;
			}
	}
   }
}

Output:-

1  2  3  4  5

Let’s code a program for arranging elements of array in descending order.

#include<stdio.h>
int main()
{
  int A[5] = {5,2,1,4,3};
  int i;

  void Short( int [] );

  Short(A);

  for( i = 0 ; i < 5 ; i++ )
      printf("%d  ",A[i]);

  return 0;
}

void Short( int a[] )
{
  int i,j,temp;
	for ( j = 0 ; j < 5 ; j++ )
	{
		for ( i = 0 ; i < 4 ; i ++ )
		{
		 if ( a[i] < a[i+1] )
			{
				temp = a[i];
				a[i] = a[i+1];					a[i+1] = temp;
			}
	        }
       }
}

Output:-

5  4  3  2  1

We will start reading about string in our next blog.

by kumar vipin yadav at July 26, 2018 06:39 PM

Ananya Maiti

Understanding DNS

In this post I will explain How DNS Works in my own words.

DNS stands for Domain Name System. It is way for naming the Address of computers or resources in a Network. All of the computers in a network is associated with an IP Address, like IP address of google.com is something like 172.217.163.110. Now its tough for a person to remember such big numbers. So we have a simple and more human friendly way of naming these computers which is done by DNS.

So now how does the DNS work ? When we type in a website name in a browser the IP address of the server mapped to the name needs to be found out to display the web page. So there is a process by which this IP address is searched. Let’s understand what are the steps that are carried out for  finding the address.

First, Ask the Browser

Whenever we type in a website name in a browser the browser searches its cache to check if the IP address mapped to the website is present.

Then, Ask the OS

If the Browser doesn’t have the address it then asks the OS to check if it has the address.

Ask the Resolver

If the OS doesn’t have the address it points to the IP address of the Resolver server that will Resolve the IP address of the website. It is the role of the Resolver to find the IP address of the website and bring it back to the OS. These are usually the Servers provided by the ISPs serving the Internet. If you do a cat /etc/resolv.conf in a Linux Machine you will get an output similar to

# Generated by NetworkManager
nameserver 202.88.174.6
nameserver 202.88.174.8

These are the IP addresses of the Resolvers that are responsible for finding the IP address of  website when a request comes to it. So it first checks its cache to see if it has the IP address of the website requested. If it doesn’t find the IP address it then goes to the Root to find the same.

Ask the Root

The Root server knows the addresses of the Top Level Domain (TLD) Server for the website. There are total 13 Root Servers spread all over the world. Well that doesn’t mean there are only 13 servers. Basically it means there are 13 unique names for the server. Each one is distributed over multiple servers to handle the load. The Resolver gets the address of the TLD Server from the Root and goes there to find the IP address of the website. Each time the Resolver gets the address it saves it to its memory.

Ask the TLD Server

The Top Level Domain is the .com part in google.com . Similar to that there can be various Top Level Domains such as .org, .gov, net, .edu etc. Also there are country specific  domains like .in, .us. .jp etc. The Root server knows the addresses of these TLD servers. The TLD then gives the address of Authoritative the Nameservers for the website domain.

Ask the Authoritative Nameservers (DNS Servers)

The Authoritative Nameservers are the one that contains the actual address of the website. Their names are similar to ns1.google.com, ns2.google.com etc. These are often simply called the DNS Servers as they contain the records of the address corresponding to a specific website name. Whenever you purchase a Domain the Domain Registrar send the name of these DNS Servers to the the TLDs. That way a TLD can say which DNS Server contains the address of a website. The DNS Server gives the Resolver the IP address of the website.

You can find the names of the DNS Servers of a website and the website IP address using the dig command. Here is a sample output of dig command.

[ananyo@localhost ~]$ dig google.com

; <<>> DiG 9.11.4-RedHat-9.11.4-1.fc28 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33490
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 9

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 8114e77595b2cc097e7725a95b59fdf1b2d1c4d480039c49 (good)
;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
google.com. 40 IN A 172.217.163.78

;; AUTHORITY SECTION:
google.com. 31267 IN NS ns3.google.com.
google.com. 31267 IN NS ns2.google.com.
google.com. 31267 IN NS ns4.google.com.
google.com. 31267 IN NS ns1.google.com.

;; ADDITIONAL SECTION:
ns1.google.com. 206437 IN A 216.239.32.10
ns2.google.com. 210049 IN A 216.239.34.10
ns3.google.com. 210049 IN A 216.239.36.10
ns4.google.com. 210049 IN A 216.239.38.10
ns1.google.com. 210874 IN AAAA 2001:4860:4802:32::a
ns2.google.com. 341654 IN AAAA 2001:4860:4802:34::a
ns3.google.com. 57401 IN AAAA 2001:4860:4802:36::a
ns4.google.com. 304702 IN AAAA 2001:4860:4802:38::a

;; Query time: 35 msec
;; SERVER: 202.88.174.6#53(202.88.174.6)
;; WHEN: Thu Jul 26 22:29:29 IST 2018
;; MSG SIZE rcvd: 331

Finally, return it to the OS, then Browser

The Resolver finally gives back the IP address of the website to the OS which then caches it for future requests. The OS then gives it back to the Browser which sends the request to the IP address and serves the Page. So if you enter the IP address of the google.com in the browser that we got from dig command (172.217.163.78) it will point to the same page.

The Best part of this is the entire things just takes few seconds to complete!

 

by ananyomaiti at July 26, 2018 05:19 PM

Manank Patni

Day 23

Took python class at #dgplug training.

by manankpatni at July 26, 2018 04:32 PM

July 25, 2018

Kumar Vipin Yadav (kvy)

Linear And Binary Search In C

Let’s discuss about function with arrays:-

When we pass an array to the function the target variable is the reference of passed array.
So that any operation on the reference variable will be performed It will directly affect
the original value of the variable.
Let’s discuss with help of some example.

1. Let’s take two array and print there sum using a function.

sum-of-2-array-in-3rd-using-function.c

    #include<stdio.h>
    int main()
    {
        int a[] = {1,2,3,4,5};
        int b[] = {1,2,3,4,5};
        int c[5],i;

    // Declaring function sum and telling it that we give 2 arrays as arguments
        void sum ( int [] , int [] , int []);

    // Calling sum function
        sum(a,b);

      for( i = 0 ; i < 5 ; i++ )
          printf("%d  ",c[i] );
      return 0;
    }
    // Here we have defining our function
    void sum( int x[] , int y[] , int z[] )
    {
        int i;

        for( i = 0 ; i < 5 ; i++ )
            z[i] = x[i]+y[i];
    }

Output:-

2  4  6  8  10

In above program x , y and z are reference of a and b
and c
respectively. so as we change value of z in sum function same changes will take place
in c also.

2. Let’s copy an array into other using function.

array-copy-function.c

    #include<stdio.h>
    int main()
    {
        int a[] = {1,2,3,4,5};
        int b[5],i;

    // Declaring function copy and telling it that we give 2 arrays as arguments
        void copy ( int [] , int []);

    // Calling copy function
        copy(a,b);
      for( i = 0 ; i < 5 ; i++ )
          printf("%d  ",b[i] );

        return 0;
    }
    // Here we have defining our function
    void copy( int x[] , int y[] )
    {
        int i;

        for( i = 0 ; i < 5 ; i++ )
            y[i] = x[i];
    }

Output:-

1  2  3  4  5

In above program we will take values from x and store them in y and,
as a result value will stored in b .

Linear search:-

Linear-search.c

The following code implements linear search (Searching algorithm) which is used to find whether,
a given number is present in an array and if it is present then at what location it occurs.
If you give duplicate value then it will return first occurrence of element.

    #include<stdio.h>
    int main()
    {
        int a[5], i, c , b = -1;

        int search (int [],int);

            printf("Enter your array :\n");
            for (i = 0; i < 5; i++)
            {
                printf("Enter a number :");
	            scanf("%d",&a[i]);
            }
	    printf("Enter a number u want to search :");
	    scanf("%d",&c);

	    b = search (a,c);

    	if( b == -1 )
		    printf("Element is not present in array.\n");
        else
    		printf("Element is present in array at %d.\n",b);
        return 0;
    }
    int search (int a[] , int b )
    {
        int i;

        for (i = 0; i < 5; i++)
    	{
		    if( b == a[i] )
        		return i;
    	}
    }

Output:-

Enter your array :
Enter a number :23
Enter a number :45
Enter a number :56
Enter a number :34
Enter a number :23
Enter a number u want to search :34
Element is present in array at 3.

In our this Linear search program we have taken an array as input and find a number in that.
we check each element and if any element match our entered value then we return it’s index value,
and print it, else we return nothing It means there is not such kind of value exist.

Binary Search:-

Binary-search.c

This code implements binary search in C language.
It can only be used for sorted arrays, but it’s fast as compared to linear search.
If you wish to use binary search on an array which isn’t sorted, then you must sort it using some sorting technique say merge sort and then use the binary search algorithm to find the desired. Element in the list. If the element to be searched is found then its position is printed.

	#include<stdio.h>
	int main()
	{
	  int a[5],i,b,c = -1;
	
	  int search (int [],int,int);
    printf("Enter your array : \n");
   	for (i = 0; i < 5; i++)
     	{
       	printf("Enter a number :");
	     	scanf("%d",&a[i]);
     	}
		printf("Enter a number you want to search :");
		scanf("%d",&b);
    i=i-1;
		c = search (a,b,i);

		if( c != -1 )
			printf("Element is present in array. \n");
        	else
			printf("Element is not present in array. \n");
  	}
	int search(int a[],int b,int h)
	{
    	int i,m,l;
			l=0;
			while ( l <= h )
 			{
 				m = (l+h)/2;
 				if( m == b )
 				  return 1;
 				else if( b > m )
				  l = m+1;
				else if( b < m )
				  h = m-1;
			}
		return 0;
	}

Output:-

Enter your array : 
Enter a number :1
Enter a number :2
Enter a number :3
Enter a number :4
Enter a number :5
Enter a number you want to search :5
Element is present in array.

In binary search we divide our array from middle and search is the element in mid of array if yes,
then we return 0 and loop will stop and if element is not on mid position of array then we check,
is our element less or greater then the mid then we find value between mid and the last position,
of array or in between first and mid position of array respectively.
and if mid position cross the last position and we can’t find our element then we

return 0,
and stop loop.

 NOTE : Data must be sorted If we use binary search for searching an item in a array.

We will read about sorting algorithms in next blog post.

by kumar vipin yadav at July 25, 2018 06:41 PM

July 24, 2018

Kumar Vipin Yadav (kvy)

Some Problems In Array

Here in my this blog we will learn how to take input in an array and display that on screen and we perform some others operation on Arrays.

Have a fun : )

1. In our this program we will learn how to take inputs in array we will declare a array of length 5 and enter some value into it

reading-array.c

#include<stdio.h>
int main()
{
int a[5],i;
for (i = 0; i < 5; i++)
{
printf("Enter a number :\n");
scanf("%d",&a[i]);
}
printf("All values are stored in the Array");
return 0;
}
Output :-
Enter a number :
5
Enter a number :
4
Enter a number :
3
Enter a number :
2
Enter a number :
1
All values are stored in the Array

2. In our this program we will read an array and display that on screen , This program will take 5 integer and display them on screen.

reading-writing-array.c

#include<stdio.h>
int main()
{
int a[5],i;
for (i = 0; i < 5; i++)
{
printf("Enter a number : \n");
scanf("%d",&a[i]);
}
printf("Entered numbers are : \n");
for (i = 0; i < 5; i++)
{
printf("%d \n",a[i]);
}
return 0;
}
Output :-
Enter a number
1
Enter a number
2
Enter a number
3
Enter a number
4
Enter a number
5
Entered numbers are :
1
2
3
4
5

3. Our this program will take 2 Array and store that in a third Array and display third array on screen.

sum-of-2-array-in-3.c

#include<stdio.h>
int main()
{
float a[5],b[5],c[5];
int i;
printf("Enter first Array :\n");
for (i = 0; i < 5; i++)
{
printf("Enter a float number :");
scanf("%f",&a[i]);
}

printf("\n Enter second Array :\n");
for (i = 0; i < 5; i++)
{
printf("Enter a float number :");
scanf("%f",&b[i]);
}
//Adding of both Array
for (i = 0; i < 5; i++)
{
c[i] = a[i]+b[i];
}
printf("Sum of both array is :\n");
for (i = 0; i < 5; i++)
{
printf("%.2f\t",c[i]);
} 
}
Output :-
Enter first Array :
Enter a float number :1.2
Enter a float number :2.3
Enter a float number :4.5
Enter a float number :6.7
Enter a float number :8.9

Enter second Array :
Enter a float number :2.1
Enter a float number :3.2
Enter a float number :4.3
Enter a float number :5.4
Enter a float number :7.6
Sum of both array is :
3.30 5.50 8.80 12.10 16.50

4. Our this Program will take 10 integers and count Positive,Negative and Zeros from that Array.

counting-pos-neg-zero-in-array.c

#include<stdio.h>
int main()
{
int a[10],z,p,n,i;
z=p=n=0;
for (i = 0; i < 10; i++)  {   printf("Enter a number : ");  scanf("%d",&a[i]);    if(a[i]>0)
   p++;
  if(a[i]<0)
   n--;
  if(a[i]==0)
   z++;
}
printf("Positive numbers are %d, Negative number are %d and zeros are %d.",p,n,z);
return 0;
}
Output :-
Enter a number : 12
Enter a number : 23
Enter a number : -56
Enter a number : 0
Enter a number : 65
Enter a number : 0
Enter a number : -97
Enter a number : 34
Enter a number : -67
Enter a number : 0
Positive numbers are 4, Negative number are -3 and zeros are 3.

5. It is a kind of calculator which will perform a operation you provide and display result on the screen.

array-calculater.c

#include<stdio.h>
int main()
{
int a[5],b[5],i;
char x;

 printf("select a operation form +,-,* and / :- ");
 scanf("%c",&x);

printf("Enter first array :\n");
 for (i = 0; i < 5; i++)
 {
   printf("Enter a number : ");
   scanf("%d",&a[i]);
 }
 printf("\n Enter second array :\n");
 for (i = 0; i < 5; i++)
 {
   printf("Enter a number : ");
   scanf("%d",&b[i]);
 }

switch(x)
 {
  case '+':
 {
  for (i = 0; i < 5; i++)
    printf("%d \n",a[i]+b[i]);
  break;
 }
 case '-':
 {
   for (i = 0; i < 5; i++)
    printf("%d \n",a[i]-b[i]);
    break;
 }
 case '*':
 {
   for (i = 0; i < 5; i++)
    printf("%d \n",a[i]*b[i]);
    break;
 }
 case '/' :
 {
   for (i = 0; i < 5; i++)
    printf("%.2f \n",(float)a[i]/b[i]);
    break;
 }
 default:
  printf("invalid selection \n");
}
return 0;
}
Output :-
select a operation form +,-,* and / :- /
Enter first array :
Enter a number : 12
Enter a number : 23
Enter a number : 34
Enter a number : 45
Enter a number : 56

Enter secand array :
Enter a number : 1
Enter a number : 2
Enter a number : 3
Enter a number : 4
Enter a number : 5
12.00
11.50
11.33
11.25
11.20

6. Our this program will accept a integer from you and display count number Larger, Smaller and Equal to that number.

finding-larg-small-=-num-in-array.c

#include<stdio.h>
int main()
{
int a[10],i,b,l,s,e;
s=e=l=0;

printf("Enter a number with which you want to compare Array elements : ");
scanf("%d",&b);

for ( i = 0 ; i < 10 ; i++ )
{
printf("Enter a number :");
scanf("%d",&a[i]);

if(a[i]==b)
e++;

if(a[i]<b) s++; if(a[i]>b)
l++;
}
printf("Large number are %d, Small number are %d and Equal are %d.",l,s,e);
return 0;
}
Output :-
Enter a number with which you want to compare Array elements : 23
Enter a number :45
Enter a number :67
Enter a number :23
Enter a number :76
Enter a number :56
Enter a number :56
Enter a number :768
Enter a number :435
Enter a number :-887
Enter a number :-67
Large number are 7, Small number are 2 and Equal are 1.

7. Our this program will take 2 Array and compare there each index and store larger value in third Array.

e.g

if (A[0] > B[0] )

C[0] = A[0];

same process will held with each index.

finding-large-number-and-storing.c

#include<stdio.h>
int main()
{
int a[5],i,b[5],c[5];
printf("Enter first Array :\n");
for (i = 0; i < 5; i++)
{
printf("Enter a number :");
scanf("%d",&a[i]);
}
printf("\nEnter second Array :\n");
for (i = 0; i < 5; i++)
{
printf("Enter a number :");
scanf("%d",&b[i]);
}
for (i = 0; i <5 ; i++)  {    if(a[i]>b[i])
    c[i]=a[i];
  else
    c[i]=b[i];
}
for (i = 0; i <5 ; i++)
{
  printf("%d \t",c[i]);
}
return 0;
}
Output :-
Enter first Array :
Enter a number :12
Enter a number :34
Enter a number :56
Enter a number :7
Enter a number :1

Enter second Array :
Enter a number :1
Enter a number :2
Enter a number :3
Enter a number :4
Enter a number :5
12 34 56 7 5

8. Our This program will Marge first two array into third array.

merging-array.c

#include<stdio.h>
void main()
{
int a[5],i,b[5],c[10];

printf("Enter first Array\n");
for (i = 0; i < 5; i++)
{
printf("Enter a number :");
scanf("%d",&a[i]);
}
printf("\nEnter second Array\n");
for (i = 0; i < 5; i++)
{
printf("Enter a number :");
scanf("%d",&b[i]);
}

for (i = 0; i < 5; i++)
{
c[i]=a[i];
c[i+5]=b[i];
}
printf("Array after merging is : \n");
for (i = 0; i <10 ; i++)
{
printf("%d ",c[i]);
}
}
Output :-
Enter first Array
Enter a number :12
Enter a number :34
Enter a number :54
Enter a number :67
Enter a number :897
Enter second Array
Enter a number :34
Enter a number :34
Enter a number :45
Enter a number :23
Enter a number :567
Array after merging is :
12 34 54 67 897 34 34 45 23 567

9. This program will Print reverse of an Array.

printing-array-in-reverse.c

#include<stdio.h>
void main()
{
int a[5],i;
char x;
printf("Enter your array : \n");
for (i = 0; i < 5; i++)  {  printf("Enter a number :");  scanf("%d",&a[i]);  } for ( i = 4 ; i >= 0 ; i-- )
 printf("%d ",a[i]);

}
Output :-
Enter your array :
Enter a number :12
Enter a number :34
Enter a number :54
Enter a number :76
Enter a number :89
89 76 54 34 12

10. This program will store reverse of an Array and store it another array and display that.

reverse-an-array-in-another.c

#include<stdio.h>
void main()
{
int a[5],b[5],i,j;
char x;
for (i = 0; i < 5; i++)  {  printf("Enter a number :");  scanf("%d",&a[i]);  }  for (i=4,j=0;i>=0;j++,i--)
    b[j]=a[i];

for (i = 0; i < 5; i++)
printf("%d ",b[i]);
}
Output :-
Enter a number :12
Enter a number :34
Enter a number :45
Enter a number :675
Enter a number :34
34 675 45 34 12

Later we will discuss Array with functions.

by kumar vipin yadav at July 24, 2018 06:22 PM

Prashant Sharma (gutsytechster)

How to resolve grub error: file ‘/grub/i386-pc/normal.mod’ not found

Heya! Hope you all are doing well. Me too. So, today I am gonna share something amazing and insightful. I have attended a meetup held by LinuxChix last Sunday. So after the talks, there held a chaos engineering session. Even though I hadn’t attended any session like this before, I was eager to experience these things myself. Because whenever I do something on my system, I am always very careful in case it doesn’t run into any system failures. So, this was a golden opportunity for me. In the session, my friend Neeraj and I were given a system with the error shown as:

error: file '/grub/i386-pc/normal.mod' not found.
grub rescue>

We have to resolve this error and get into the system safely. We were at the grub-rescue prompt. Basically grub-rescue prompt is somewhat more restricted as compared to grub prompt. This is because not all commands run in this shell. Only some selected commands work at the grub-rescue prompt. Very first command which we tried was “ls” command which worked and it showed the all the devices or partitions which were present in the system. So, the  output was somewhat like:

grub rescue> ls
(hd0) (hd0,msdos1) (hd0,msdos2) (hd0,msdos4) (hd0,msdos5) (hd0,msdos6)

These are the partitions which were present in the system. After that we run the “ls” command on each partition, which gives us some unexpected output. It tells if  the file-system is known or not. Grub only recognizes the “ext2” file-system. So, we were left with only three partitions to work with which were (hd0,msdos2) (hd0,msdos4) (hd0,msdos6). Now you might be wondering what does this partition name means. So, if I would explain in short, it would be like

  • (hd0,msdos1) = /dev/sda1
  • (hd0,msdos2) = /dev/sda2

and so on. Now, in words (hd0,msdos1) will be the 1st partition in hard-drive 0 and (hd0,msdos2) means 2nd partition in hard-drive 0. Since the system had only single hard-drive and it’s been divided into partitions, so all partition contains (hd0). Partitions except the known file systems showed the error of “Unknown file system“.

Now, we were left with the 3 partitions to look into for the required file which is “normal.mod“. Before going any further, we should understand the need for this file. Basically, normal.mod is a module which grub loads at the boot time which provides the use of normal command. Using normal command we can display the GRUB menu. Since, the grub couldn’t locate the file in its usual location, it means either the file has been displaced or it could have been deleted somehow.

Case 1: ‘normal.mod’ is displaced from its default location

So, let’s consider the first case for now ie the file has been displaced and could be in some other partitions. Grub looks for this module in the /boot/grub/i386-pc/ by default(Here i386-pc is specific, it depends on your system architecture). For that we have to check the contents of each of the three partitions in order to ensure if the file is present there or not. We can do this using ls command.

grub rescue> ls (hd0,msdos1)/boot/grub/i386-pc/

We need to do this for every partition. If we get the required module in any of the partition. Let’s say we get it in the 1st partition. So,  now we need to set the prefix variable to the partition which contains the required file. prefix variable is set to the location of grub directory at the time of grub installation. So, it is possible that grub couldn’t locate the normal.mod because the prefix variable is pointing to the wrong partition. So we can set the prefix variable using set command. Also, we need to set the root to the same partition as that of prefix . For eg

grub rescue> set root=(hd0,msdos1)
grub rescue> set prefix=(hd0,msdos1)/boot/grub

Now, since we have set the correct path to root and prefix, we can use the normal module now. So for that we have to import the module. To import it, we would use insmod command.

grub rescue> insmod normal
grub rescue> normal

Now, the grub menu would be shown and you can enter into the system safely.

Special case:

In this there can be situations like the normal.mod is not present in the exact location we are looking into. Like in our case, we are trying to locate it into “(hd0,msdos1)/grub/boot/i386-pc/”. But what if it is present in the location “(hd0,msdos1)/root/”, then pointing prefix to this location won’t be useful and also we can’t transfer it to its correct location. So, to resolve cases like this what we can do is use insmod command to import the normal module as:

grub rescue> insmod (hd0,msdos1)/root/normal.mod
grub rescue> normal

Using this you would be able to use the normal module and get into the GRUB menu. But since it isn’t placed in its correct location, this means that there were some problem while installing grub. So, if you reboot the system, you would again be thrown into the grub rescue prompt and have to follow the same procedure. It would be better if you install the grub again using the following command after entering into the system terminal:

$ sudo grub-install /dev/sda

And then you are good to go.

Case 2: ‘normal.mod’ is not present

Well, the whole procedure was for the case when the required module is misplaced. But what if it isn’t present at all in any partition and somehow got deleted. To your curiousness, this was the case with us in chaos engineering session. We tried to find the module in each known partition but couldn’t locate it anywhere. So, now we have to do the work which normal module would’ve done if it would be present. Therefore we have to find the kernel files and boot the system manually.

To boot the system we would require the kernel file which would be something like “vimlinuz-linux” and the file “initramfs-linux.img“(Sometimes, you can find it as “initrd-linux.img”). The vimlinuz-linux is actually the kernel image which mounts the root partition on the hard-disk. The initramfs-linux.img loads the futhur required modules needed for booting of the system. So, very first thing we did was to locate these files in any of the known partitions. So, we looked for these files under the /boot directory using the same ls command as:

grub rescue> ls (hd0,msdos2)/boot/
# some output
grub rescue> ls (hd0,msdos4)/boot/
# some output

We finally found the above mentioned files in the (hd0, msdos4) partition. This was the great success after searching through the internet and several wrong attempts for a long time. Now, we have to set the root to the partition which contains the kernel image using the set command so that it always points to the right location.

grub rescue> set root=(hd0,msdos4)

Next thing to be done is to run the kernel image. So for that we need to import the linux module using the insmod command and also the initramfs-linux.img file using the initrd command:

grub rescue> insmod linux
grub rescue> linux /boot/vimlinuz-linux root=/dev/sda4
grub rescue> initrd /boot/initramfs-linux.img

And finally the boot command, which would boot the system(using the above files) and allow us to get into the system

grub rescue> boot

Yay! finally  we were able to enter into the system. We were feeling like a cracker who has solved some crucial problem(just kidding!). But yet the problem existed ie the normal module isn’t present. In case if we would reboot the system, same error would’ve been shown and we have to repeat the same procedure. So to resolve it we need to do the same thing which we did for the 1st case. Do you remember it? Yeah, we need to re-install the grub to repair the damaged or deleted files using the system terminal.

$ sudo grub-install /dev/sda

As soon as the installation successfully completed, we reboot the system to check if it actually worked(we both crossed our fingers at that moment). And Hurrah! we have successfully solved the problem.

We both were appreciated by the people there. It was really an amazing experience. Cocoa was our mentor during the session and helped us in understanding things and showed us the path to solve the problem. I really look forward to attend more of these sessions. I think you should also. So, watch the LinuxChix space for more of these session.

References:

  1. https://wiki.archlinux.org/index.php/GRUB#Normal_loading
  2. https://askubuntu.com/questions/266429/

For now, bidding you goodbye. Meet you in the next blog. Till then…

Be curious and keep learning!

by gutsytechster at July 24, 2018 06:13 PM

July 23, 2018

Manank Patni

Day 22

Still stuck on the same PR. There has been a lot of confusion about what should be done and different reviewers giving different suggestions regarding the pr. So I have been listening to all of them and applying the changes as requested. I just hope that it gets merged till tomorow as I am kinda bored with this one and want to work on somehing new. So let’s see what happens tomorrow.

by manankpatni at July 23, 2018 06:19 PM

Kumar Vipin Yadav (kvy)

ARRAY IN C

An Array is user define data type. It is collection of several elements of similar data
type, where we can store multiple values at a time.

Syntax:

Data Type ArrayName [ No_of_element ];

e.g.
int Arr[5]

Properties of Array:-

1. All elements exist on continues memory locations.

Here i am assuming that it starts from location 100 in memory.
int A[5];

100                                  102                                   104                               106                           108

2.Each element is identified by a number, which called as index no.
The index no begins from 0 to N-1.

int A[5];

Here N = 5

0                                 1                                  2                             3                                4

100                                  102                                   104                               106                           108

3.All elements of an array are of same type.

int A[5];
float A[5];
long A[5];

4.Length of array must defined by a constant integer.

int A[5]; = OK
float A[5]; = OK
int A[]; = error
int A[5.7]; = error
int l = 5;
int A[l]; = error
int A[l*2]; = error

5.The size of array is sum of size of its elements.

int a[5]; SIZE = 10
float a[200]; SIZE = 800
long a[44]; SIZE = 132

6.All elements of array are automatically initialized by garbaze.

7.Initialization of array:

int a[5] = {10,20,30,40,50};

0                                 1                                  2                             3                                4

10 20 30 40 50

Partial Initialization-

int a[5] = {10,20,30};

0                                 1                                  2                             3                                4

10 20 30 0 0

int a[100] = {0};

0………………………………………………………………………………………………………………………………………….99

0 0 0 0 0

int a[] = {10,20,30,40,50};

10 20 30 40 50

8.The size of an array also defined by a symbolic constant/macro.

#define sz 25

double A[sz];
int B[sz];
char C[sz];

9.The[]operator,in c language ,is known as sub-script operator.

Disadvantages of array:-

1.C environment doesn’t have checking machism for array sizes.
2.Differenet type of data can not be stored into an array.
3.We must know in advance that how many elements are to be stored in array.
4.Array is static structure. It menas at array is of fixed size.
The memory which is allocated to array can not be increased or reduced.
5.Since arrayis of fixed size, if we allocate more memory than requirement then,
the memory space will be wasted. And if we allocate less memory than requirement,
then its will create problem.

by kumar vipin yadav at July 23, 2018 05:13 PM

Piyush Aggarwal (brute4s99)

Arch – Zero to One

Simplicity is the ultimate sophistication.
 -Leonardo da Vinci

After eons of self-doubt and mixed opinion, I finally decided to get Arch Linux up and running in my laptop!

How it all began?

My mentors at IRC insisted upon switching over to latest Linux distros. The reason was implicit: to work with packages having latest features. My IRC friends at #dgplug suggested me a few flavors to choose from- latest Ubuntu build, latest Fedora build, or a rolling release distribution.

What’s a Rolling Release?

A rolling release is a type of linux distribution model in which instead of releasing major updates to the entire operating system after a scheduled period of time, a rolling release operating system can be changed at the application level, whenever a change is pushed by upstream.

There are a couple of rolling release models – semi-rolling and full rolling – and the difference is in how and what packages are pushed out to users as they become available.

A semi-rolling distribution, such as Chakra Linux and PCLinuxOS, classifies some packages to be upgraded through a fixed release system (usually the base operating system) in order to maintain stability.

A full rolling release, such as Gentoo, Arch, OpenSUSE Tumbleweed, and Microsoft Windows 10, pushes out updates to the base operating system and other applications very frequently – sometimes as often as every few hours!

Why switch?

The main benefit to a rolling release model is the ability for the end user to use the newest features the developer has enabled. For example, one of the newer features of the Linux kernel, introduced with the 4.0 update, was the ability to update the kernel without restarting your computer. In a rolling release distribution, as soon as this update was tested and marked as working by the development team, it could then be pushed out to the user of the distribution, enabling all future updates to the kernel to occur without computer restarts.

What’s new?

For ubuntu users, it’s the same thing as if you come to Linux from Windows; there is a learning curve.

An excerpt from the Arch Wiki states thus:-

Arch Linux is a general-purpose distribution. Upon installation, only a command-line environment is provided: rather than tearing out unneeded and unwanted packages, the user is offered the ability to build a custom system by choosing among thousands of high-quality packages provided in the official repositories for the x86-64 architecture.

Oh, and one more thing- none of the proprietary softwares/packages/drivers come with the base installation. Read more about them here.

If you still think you can steer clear off the proprietary softwares , think again, and one more time.

Theory’s over.

Baby Steps

A few pointers before we start the installation:-

  1. The installation requires a working internet connection. So, I had a wired ethernet connection ready at my disposal.  A WiFi module that’s NOT with a Broadcomm Chipset would be just as fine. Since I have the Broadcomm Chipset, I switched to wired connection for the time being.
  2. Once I’ll get the installation done, all I’ll have is a bare-bones installation with a log-in shell. You must absolutely be comfortable with the terminal, as almost no graphical utility comes out of the box.

I grabbed a USB and prepped it with this Arch Linux img. First thing after booting from the USB – I connected to the internet.

In case you have Broadcomm chipset in your WiFi, follow this. You need the driver firmware for the Broadcomm chipset to get it working on your laptop, since it’s proprietary.

Connecting to the Internet

Connecting to internet via Ethernet

Just Plug n Play, you’re good to go!

Connecting to internet via WiFi

1.Create a profile for your wifi in there

# wifi-menu

2.Connect to the profile you set by

# netctl start <profile_name>

3.If you want to enable it to connect automatically at startup

# netctl enable <profile_name>

Connecting to internet via Android USB tethering

1.List all your DHCP interfaces that are now available

$ ls /sys/class/net

2.Connect to the new inteface provided by Arch for your USB tethered device!

# dhcpcd <enp....something_profile_name>

Check if you’re online :    $ ping -c3 google.com


There are many good tutorials out there, follow any one of these.

Now that Arch was installed, I booted up the system and got connected to the internet again.

image

Now that I was online, I set up a GUI !

Installing a GUI

So the first thing I decided to get for the Arch was GUI! It’s a quite simple procedure, you need a display manager, and a Desktop Environment to interact to the X server.

X Server

X is an application that manages one or more graphics displays and one or more input devices (keyboard, mouse, etc.) connected to the computer.

It works as a server and can run on the local computer or on another computer on the network. Services can communicate with the X server to display graphical interfaces and receive input from the user.

My choice:  # pacman -S sddm plasma

 IMPO ! Install a terminal before rebooting to GUI !

# pacman -S konsole

Configuring terminal

Sources + References:-

  1. http://jilles.me/badassify-your-terminal-and-shell/

Configuring weechat

Sources + References:-

  1. https://alexjj.com/blog/2016/9/setting-up-weechat/
  2. https://wiki.archlinux.org/index.php/WeeChat

Surfing through some sites also got me through a good command that would be of much help to most!

/mouse enable  # In case you’d like to use the mouse in weechat

/redraw          # A saviour for guys SSH-ing to any ZNC

You can’t find the packages through pacman?

Enter AUR : the Arch User Repository

Suppose I have to get a package that cannot be found by pacman. I will try to find it at AUR home page.

for eg : ngrok. Now, after reading description, I know this is the package I was looking for. So, now I will see how I can acquire the package.

Here I can see two ways to acquire the package- by git clone (preferred), or by downloading the tarball.

It gives me one file : PKGBUILD . These PKGBUILDs can be built into installable packages using makepkg , then installed using pacman .

Fakeroot

Imagine that you are a developer/package maintainer, etc. working on a remote server. You want to update the contents of a package and rebuild it, download and customize a kernel from kernel.org and build it, etc. While trying to do those things, you’ll find out that some steps require you to have root rights (UID and GID 0) for different reasons (security, overlooked permissions, etc). But it is not possible to get root rights, since you are working on a remote machine (and many other users have the same problem as you). This is what exactly fakeroot does: it pretends an effective UID and GID of 0 to the environment which requires them.

P.S:-

UID: User ID
GUI: Group ID

The git clone method is preferred since you can then update the package by simply git pull.

Why so much fuss ?

You can always try out AUR helpers. I set up yay in my configuration, since it also shows DIFFs when installing new/upgrading packages through AURs.

Why would you want to read DIFFs?

Essentially, it’s a shell script,(so it can possibly have mailicious / dangerous content, so look before you leap) but since it’s ran as fakeroot, there is some level of security albeit. Still, we shouldn’t try and push our luck.

So after all this, I successfully set up Arch Linux, WiFi, Desktop Environment, Terminal and Weechat in my laptop! Next was installing basic software packages and fine tuning the GUI to my personal tastes.

Google Chrome DEV – For Web Browsing

tor-browser – For extended internet access

Konsole – Terminal

Deepin Music Player – Music Player

Gwenview – Image editing solution

Steam – for Games

Kontact – for updates on calendar events

VLC – Video player

The end result

ssssbeautiful, isn’t it?

Setting up a personal Arch Linux machine taught me many things about the core Linux system, how exactly the system is set up during installation and how different utilities orchestrate to form my complete workstation ready to build beautiful code and software!

by brute4s99 at July 23, 2018 12:55 PM

Kumar Vipin Yadav (kvy)

PRINTING SIN, COS, LOG AND E^X SERIES IN C

Let’s learn some series printing with help of loop and functions,
it is like summering what we have study till now
Let’s start with a simple series.

Printing x+(x/2)+(x/3)+(x/4)+(x/5)…(x/n) series :-

Printing-simple-serese.c

#include<stdio.h>
int main()
{ 
int n,x;
double result;

double series ( int ,int );

printf("Enter value of x : ");
scanf("%d",&x);

printf("Enter value of n : ");
scanf("%d",&n);

result = series(x,n);
printf("Result is : %.3lf",result);
return 0;
}
double series ( int x, int n )
{
int i;
double res = 0.0;
for ( i = 1 ; i <= n ; i++ )
res = res + x/(double)i;
return res;
}

Now we will make a program to print value of sin(x) series

after asking values of x and n.

Printing sin(x) series:-
x-(x^3/3!)+(x^5/5!)-(x^7/7!)+(x^9/9!)+(x^11/11!)…

Printing-sin(x)-serese.c

#include<stdio.h>
int main()
{ 
int n,x;
double result;

double series ( int ,int );

printf("Enter value of x : ");
scanf("%d",&x);

printf("Enter value of n : ");
scanf("%d",&n);

result = series(x,n);
printf("Result is : %.3lf",result);
return 0;
}
double series ( int x, int n )
{
int i,pow,fact,number;

int factorial( int );
int power( int , int );
double res = 0.0;
for ( i = 1 ; i <= n ; i++ )
{
number = 2*i - 1 ; // To bring even number every time

pow = power(x,number);

fact = factorial(number);

if ( i%2 != 0 )
res = res + pow/(double)fact;
else
res = res - pow/(double)fact;
}
return res;
}

int power ( int x , int n)
{
int i,pow = 1;

for ( i = 1 ; i <= n ; i++ )
pow = pow*x;

return pow;
}

int factorial( int x)
{
int i,fact = 1;

for ( i = 1 ; i <= x ; i++ )
fact = fact*i;

return fact;
}

Now we will make a program to print value of cos(x) series

after asking values of x and n.

Printing cos(x) series:-
1-(x^2/2!)+(x^4/4!)-(x^6/6!)+(x^6/6!)+(x^6/6!)-(x^8/8!)…

Printing-cos(x)-serese.c

#include<stdio.h>
int main()
{ 
int n,x;
double result;

double series ( int ,int );

printf("Enter value of x : ");
scanf("%d",&x);

printf("Enter value of n : ");
scanf("%d",&n);

result = series(x,n);
printf("Result is : %.3lf",result);
return 0;
}
double series ( int x, int n )
{
int i,pow,fact,number;

int factorial( int );
int power( int , int );
double res = 0.0;
for ( i = 0 ; i <= n ; i++ )
{
number = 2*i ; // To bring odd number every time

pow = power(x,number);

fact = factorial(number);

if ( i%2 != 0 )
res = res + pow/(double)fact;
else
res = res - pow/(double)fact;
}
return res;
}

int power ( int x , int n)
{
int i,pow = 1;

for ( i = 1 ; i <= n ; i++ )
pow = pow*x;

return pow;
}

int factorial( int x)
{
int i,fact = 1;

for ( i = 1 ; i <= x ; i++ )
fact = fact*i;

return fact;
}

Now we will make a program to print value of log(1+x) series

after asking values of x and n.

Printing log(1+x) series.
x-(x^2/2!)+(x^3/3!)-(x^4/4!)+(x^5/5!)+(x^6/6!)-(x^7/7!)…

Printing log(1+x) serese.c

#include<stdio.h>
int main()
{ 
int n,x;
double result;

double series ( int ,int );
printf("Enter value of x : ");
scanf("%d",&x);

printf("Enter value of n : ");
scanf("%d",&n);

result = series(x,n);
printf("Result is : %.3lf",result);
return 0;
}
double series ( int x, int n )
{
int i,pow;

int power( int ,int );

double res = 0.0;
for ( i = 1 ; i <= n ; i++ )
{
pow = power(x,i);

if ( i%2 != 0 )
res = res + pow/(double)i;
else
res = res - pow/(double)i;
}
return res;
}

int power ( int x , int n)
{
int i,pow = 1;

for ( i = 1 ; i <= n ; i++ )
pow = pow*x;

return pow;
}

Now we will make a program to print value of e^x series

after asking values of x and n.

Printing e^x series.
1+x+(x^2/2!)+(x^3/3!)+(x^4/4!)+(x^5/5!)+(x^6/6!)…

Printing e^x series.c

#include<stdio.h>
int main()
{ 
int n,x;
double result;

double

 ( int ,int );
printf("Enter value of x : ");
scanf("%d",&x);

printf("Enter value of n : ");
scanf("%d",&n);

result = series(x,n);
printf("Result is : %.3lf",result);
return 0;
}
double series ( int x, int n )
{
int i,pow,fact;

int power( int ,int );

int factorial( int );

double res = 0.0;
for ( i = 0 ; i <= n ; i++ )
{
pow = power(x,i);
fact = factorial(i);
res = res + pow/(double)fact;
}
return res;
}

int power ( int x , int n)
{
int i,pow = 1;

for ( i = 1 ; i <= n ; i++ )
pow = pow*x;

return pow;
}

int factorial( int x)
{
int i,fact = 1;

for ( i = 1 ; i <= x ; i++ )
fact = fact*i;

return fact;
}

by kumar vipin yadav at July 23, 2018 09:37 AM

July 22, 2018

Manank Patni

Day 21

Read about Docker, Ansible and Continuous Integration

by manankpatni at July 22, 2018 04:32 PM

Aman Verma (nightwarriorxxx)

Day 5,6,7,8 ,9#Coding Streak

The way you tell your story to yourself matters.”
-Amy Cuddy

The last 4 days were not that so good. I was just surfing over the internet and to find out good tutorials for Data Structures and Algorithms,Web Development but I didn’t get anything good.

My college has been started these days and I am introduced to new Computer Science courses namely:-
1.Data Structures and Algorithms
2.Computer Organization and Architecture
3.Database and Web Development
4.Introduction to Digital Electronics
Moreover despite these things my college has also introduced students to Mat Lab and Stimulation.

All of these courses are very very interesting and cool. A programmer should have at least knowledge of these courses as they are the most vital ones.

Moreover guys just have a look at CodingForEntrepreneurs, an awesome website.

by nightwarriorxxx at July 22, 2018 07:00 AM

July 21, 2018

Neeraj Kumar Arya (InquiridorTechie)

“Hamara” Linux Party.

Hello Friends,

Last week was not good for me. I got injured while playing football with my friends (By the way congratulations to France to become a FIFA world champion 2018). After this, I got caught by the cold and fever. But as we know there is dawn after every dusk, same happened with me. This Sunday I was feeling well. My friend sent a message on slack channel “Hey! who all are going to the meetup tomorrow?” I suddenly remembered that it is the Hamara Sugam release party meetup for which I had registered myself a few days ago. I was fascinated by the topic “Hamara Linux”. I was eager to know about that. So, I decided to go and have some fun there. Finally along with my two friends Prashant Sharma and Naman Sharma I rushed to join the meetup.

Hamara

Event’s takeoff.

I reached on time because I am punctual and both of my friends came late ( i am just kidding 🙂 ).

We reached on time but the event started one hour late. The event’s organizers were busy and trying to make a connection with the Vikas Tara (founder of Hamara Linux) by webcam who had to give the introductory talk on Hamara Linux project (remotely). After a lot of hard work when the connection was not established then we move to the conference room and interact with Vikas Tara via jitsi. He told us how he got an idea of Hamara Project. He shared an incident where a Hamara vision encounters his mind.

“He went to an Apple shop and bought a MacBook. Before paying the money he told to the worker that “I am gonna buy this product please removes all the software in it.” (the reason behind is simple that now the technology is our so what we want we can do with it). But the worker said, “Sir, these are free”. Vik replied, “so what? I don’t need that”. A worker said If you remove the software your product warranty will be lost and added: “you seem to be one of those Linux guys”. Vik smiled and thought “I am paying for the hardware not for the software”. A question arises in his mind “is the technology really owns?”. This is the origin of the Hamara vision (Hamara is a Hindi term which means “something belongs to us” in English).

According to him, Hamara is more than an operating system. Hamara is a vision of an open source system of exchange: of skills, knowledge, and ideas. Technology as an empowering platform for democracy, collaboration, and social responsibility. Discover more.

After a short interaction with Vik, we bid adieu him. Now Shivani Bharadwaj helds the stage. She shared new features and changes made in the Hamara Sugam operating system with us which make the system most lightweight.

Features:-

1. First, they thought to use Debian installer for Hamara Sugam but they realized that its options are complicated for the newbies. So, the team decided to port it into ubiquity (a default installer for Ubuntu) but in the end, they abandoned this idea due to some technical issue in porting. Finally, they integrate Hamra Sugam with calamares installer.

Calamares is an easy to use installer providing the options suitable for newbies as well as for people who want to do finely grained configurations while installing the operating system on their machine.

2. There is another change in Hamara Sugam. Initially, they are using Paper Theme for GTK environment but later they found some issue in that so they migrated to the Materia Theme that gave a more fluid slick Material Design experience.

3. They have used generic names for the applications like:-

                    (Default Name)              (Generic Names)

                    MATE terminal ————> Terminal

                    MATE color chooser——->Color chooser etc.

4. They have used the Linux kernel version 4.12.

At the end of her presentation, she shared a link to check the detailed changelog and also suggest to join with the team to contribute to the project. Link

After this Raju Dev (one of the contributor to Hamara Sugam) came to gave his talk. He talked about how he tried another installer for the Hamara Sugam and got stuck in technical issues and finally integrate with the calamares installer. He also talked about the many technical terms which gone upper to my mind :P. He shared the source code and explain it also answered all the question asked by the folks. I learned many new things.

RajuDev

You can find the source code link here.

Lunch Time

After this healthy discussion, we had a lunch and networking break. Techblue Software Private Limited provide us with lunch then we met others people and get to know about them. I spend little time to solve Rubix cube and try different patterns.

After Break

Everyone seems to be energetic. Now, Manas Kashyap the one who build the Docker Container for Hamara project. He told us how he first started to work with the Debian packaging and under the guidance of Raju Dev, he builds Docker container for Hamara. He also told that he used 2 tools Dbootstrap and Chroot during this project. He gave an opportunity in contributing to the project as the size of the Docker files are quite large whoever interested to reduce its size can send the pull request on GitHub. After this Sagar took the stage and explains that applications are based on GTK. Desktop Environment of Hamara Sugam is based on MATE. He also shared the upcoming version of Hamara (Svastik) based on GNOME. In the end, Shivani and Raju also revealed future plans for the Hamara project.

Cake Cutting Ceremony!

cake

This is the most awaited moment. Raju Dev cut the cake and it was distributed among all the folks. The cake was tasty as you can see below :). This was a short 10 min tea-break. Snacks were also provided.

Quiz Time

IMG_20180721_084839

Before ending up the session there was a quiz-round. The rules were simple and straight the one who knows the answer will raise his/her hand Shivani’s work like a “third umpire” to choose the person who first raises the hand. Give a correct answer and Win the T-shirt. I really like this phrase “Hamara Linux, Hamara Quiz, Hamara Rule and Win Hamara T-shirt”. Though I raised my hand two times, first I gave the wrong answer but I didn’t lose my second chance by giving the correct answer and won the T-shirt. My friend Prashant raised his hand most of the time but unfortunately, he missed it.

Group

We took a group photo at the end, spot me out if you can. We were given goodies when we left. It was my 2nd meetup I really enjoyed this.

If you want to try Hamara Sugam download it from here. Share your meetup experience with me in the comment section. Also, share your experience with this new linux-distro.

I hope you liked this blog!

See you soon!

Have a good day!

InquiridorTechie.

by inquiridortechie at July 21, 2018 08:41 PM

Manank Patni

Day 20

Couldn’t do much of the programming today other than the usual classes of OOPS, DSA, Software Engineering and other subjects that are being taught at the college, because I was out at some place. But there I learned how to set up a biometrics sensor and the other things related to it.

by manankpatni at July 21, 2018 05:42 PM

Amitrajit Bose

Dual Boot Ubuntu With Windows 10

Tired of the black screen on Command Prompt, enough of using the mouse to guide the pointer through the screen, you now want to code directly on the Terminal or more appropriately get a bit of that geeky feeling as a computer scientist or a budding hacker, who magically writes commands on the Terminal window and transforms the world.

Well, coming back to reality – using a Linux distribution can be one of the most liberating feeling at some times of your career. You get a lot more to do without anyone bothering you and that too for free. I sometimes cannot believe that Linux is free honestly. Linux is an open source operating system, in other words it is free for you to modify or add stuff, download the source code and make changes to it, in a positive manner that would help the community. According to the facts, Linux was one of the first open-source technologies. Linux offers a wide range of available options directly to the user to modify or make changes, and has added security in comparison to other OS. With Linux being open-source, several distributions are available to the users. Debian, Fedora, Ubuntu and Mint are just a few of the distributions available to end users, and these distributions are completely free to download. Ubuntu being the most popular among them currently. I can put up an entire article with this topic of comparing Linux with other OS, but let’s stick to our goal.

Let us install Ubuntu 16.04 (Xenial Xerus) alongside Windows 10, that you already have.

Step 1 : Download the ISO of Ubuntu OS

You need to download the ISO file that is compatible with your system from here. Keep it in some folder on your computer.

Step 2: Create a bootable USB stick

This is the easiest way, assuming you have a pendrive, you have to load the ISO of Ubuntu to it, not by Copy- Pasting, but by using Rufus or Universal USB Installer. I personally prefer the second one.

Universal USB Installer Screenshot

So, you select the Linux distribution that is, Ubuntu and then provide the path to the ISO file. Then you select your USB and tick on the Format to Erase option. Click on Create, it will take a while, go and have a glass of water.

Optional Step: Create a backup

You may lose your information if you are installing Ubuntu on your C drive. Also chances are less, you may brick you device by not following the instructions. So a safer step is to take a backup of your data.

Step 3: Turning off Fast Startup

Go to settings on Windows 10, go to Control Panel > Hardware and Sound > Power Options > System Settings.
There at the middle of the screen you can see a check box for Turn off fast startup , disable that.

Fast Startup

You may not be able to disable it directly, on the top there will be an option to Change Settings, you need administrator permissions for that. You will be able to do it.

Step 4: Create the space

Find a drive that on your system that has enough space remaining, partition the drive so that Ubuntu can be installed on that. I made 60 Gigs of space for mine, you can do less or more. Don’t go less than 30 Gb, if you’re a gamer or need to use heavy applications, then go for 80-100 Gb.
The disk management tool on your Windows Settings will do the partitioning for you. Just right click on the drive > Shrink volume > Set the space you need in Mb units .

Leave the space as it is. Most probably you won’t be able to see the newly create free space from your Windows Explorer. Let it be like that.

Step 5: Disable Secure Boot

Go to Setting (Win+I) > Advanced Startup Options > Restart > Troubleshoot > Advanced Options > UEFI Firmware Setting > Booting & Security Options > Disable Secure Boot

Refer this article for the detailed procedure with picture. Thank me later.

Remember to Save and Exit, otherwise the changes will not work.

Step 6: Install Ubuntu

Plug in your bootable USB and restart your device from Windows 10. Keep pressing Shift+Restart or ESC (as per your computer’s requirement) to go to the advanced start up options.
Press ENTER on the boot from an USB device option.
Click on install, and the Ubuntu installer will be launching.
It will then do some internet connection and power checks, the instructions are quite clear.
In the installation type select Something Else

Step 7: Root, Swap, Home Partition

Select on the free space in the list of locations and then click on the + sign. It will open a dialog box for setting the partition.

So, for the root (Use as: Ext4 Journaling system, Mount point: /) use around 10-20 Gb of memory. Leave
For the swap space (Use as: swap), it is recommended to use twice the space of your RAM memory. (2 x RAM memory)
The rest memory can be used as the home (Use as: Ext4 Journaling system, Mount point: /home), this is for your songs, media and video.

For example, I used 15 Gb for root, 16 Gb for swap and 31 Gb for home out of my 62 Gb partition.

Click Installvnow in the right corner.

Step 8: Ubuntu Installation Manager

After this, the Ubuntu Setup guide will guide you easily through setting up and running Ubuntu. Please try to have a good Internet connection, because several packages and files may get updated or installed during the installation process.

That’s it. You’re running Ubuntu.

Acknowledgement: I would like to take this opportunity and thank It’s FOSS for helping me through the entire process of installing Ubuntu on dual boot mode. Their instructions were greatly helpful in getting me started with Ubuntu.

by amitrajitbose at July 21, 2018 01:02 PM

July 20, 2018

Prajit Mukherjee(thegeekbong)

JavaScript – Not at all Java!

When I first started learning about JavaScript popularly known as JS, as a fact being a newbie I thought it is something to do with Java, that is a programming language but they have their differences. As answered here in Stack Overflow, Java and JavaScript are as similar as Car is similar to Carpet. Yeah, this answer does tickle one’s funny bone. Well, I think this tells you how different both of these programming languages are. Putting the differences will be deviating from the topic(You can always search the internet) but I’ll surely put some features of JS below.

Features:

  • JS is dynamically coded programming language
  • JS is popularly used as a scripting language for web browsers(will surely explain this point)
  • JS is a prototype-based programming language
  • JS uses function-based scoping

Above were some features of JS which makes it such a versatile language. You will find JS today everywhere. It’s quite impossible and difficult to make a webpage without JS. This webpage alone will use many JS scripts to show you an interactive webpage. Hence, JS today is one of the crucial technologies used to make a web application.

In the last paragraph, you must have seen the phrase in bold which tells JS scripts. Any JS file is called a ‘script’ as it is a scripting language and also dynamically coded. A JS script has the power to actually interact with the database also, but not as efficiently as Django, PHP, Java or any other such frameworks and languages. Hence, this proves the versatility of this precious tools.

You must have come across the word dynamically coded language many times now and that must have made you wonder what exactly does that mean. Dynamically – coded languages are the languages which don’t need a variable type to run them, in short, we don’t have to define the type of the variable, the variable type is defined at run-time. Also, a point to be noted that dynamically – coded languages don’t need a compiler and also some of them doesn’t have one. There is no compiler for JavaScript.

Now, tackle the point, if JS does not have a compiler, how does it gets compiled and how do you see its effects on the browser? Well, nowadays each and every modern browser, Internet Explorer too, has a JS engine which runs the JS Scripts associated with the webpage. The engine comes in-built with all the browser today.

As JS is a programming language, it must give some output right? But, where does this output is shown? To your astonishment, it gets displayed on your browser only if at all the programmers logs it. All you have to is tap, Ctrl + Shift + I, if you are using Google Chrome, or you can just right-click and click ‘Inspect Element’/’Inspect’. You’ll find that in on the same webpage, a different partition has opened which somewhat looks like this:

screenshot-4.png

The orientation must be vertical/horizontal, depending on the default option. By default, the Element tab will open, you click on the Console tab, that’s what we are devoted on for now. It would be empty if you have opened on the new tab, but if you have opened on this webpage then surely there would be some text on it. Those can be errors or outputs, depending on the scripts.

We all have at some point of time has seen a dialogue box pop up on while filling a form which says generally “You have some unsaved changes. Are you sure you want to leave this page?”, this is done by the following command

alert("Hello!!!") ;

You’ll find something like below:

screenshot-5-e1532096265144.png

This how an alert is raised.

JS can do many interactive things like it can make a menu dropdown when the mouse hovers on it or it when clicked. Also ever seen the images on FlipkartAmazon IN and many other e-commerce pages? You may have seen the images in a constant slideshow after some interval. Well, this my friend is doing of JS. JS provides pre-defined functions to attain this type of transition. Also, the bullets underneath the picture going black or grey is also doing of JS. The 5-10 line code of the slideshow may be very overwhelming for a beginner, hence, it is better we leave it for now.

JS Frameworks and Libraries

js_frameworks_list

JS has become the most integral part of any good website. Hence, today there are a huge number of frameworks and libraries of JavaScript found online. One who doesn’t know what is a framework is, well to put it in simple words you can say it as an abstraction in which software provides generic functionalities which are selectively changed to perform specific tasks.  And libraries are pre-written non-volatile resources used by computer programs to facilitate specific tasks. Some of the most popular framework and libraries of JavaScript are written below:

  •  AngularJS
    angular_logo
    It is a JS framework maintained by Google. This is an open-source framework and thus, the FLOSS community maintains it. Nowadays, AngularJS is not used and is termed as obsolete though. But still, people use it in many of their projects. AngularJS has their new version as Angular 2 and Angular 2+. There are many versions of Angular and the latest stable version is Angular 6. Angular is very concise, that means, code taking around 10-15 line in JS will take around 5 -7 lines in Angular. You can try Angular by reading their tutorials. (the best way) Or you can directly search for the best tutorial you want to do.
  • ReactJS:
    reactjs-logo
    It is basically a library and is maintained by Facebook and the open-source community. ReactJS is used to build user interfaces and interactive web applications. You can try and read about React more in their documentation.
  • jQuery:
    jquery_logo
    jQuery is by far the fastest way to learn a JS library. It has very easy-to-use pre-defined methods. Hence, to try jQuery you got to know the basics of AJAX. The documentation is quite daunting, so, my preference will be this great life-saver by W3Schools. But if you want to go for the documentation, please be my guest.
  • VueJS:
    vuejs-logo
    Vue 
    is known as the framework which can be incrementally adoptable, by this it means that any application which uses other frameworks of JS is simplified by Vue. Vue is again an open-source framework and can be used by anyone. It was built to organise and make web development easy. Nowadays, Vue is very widely used and why not? It makes development easy and fast. Again, want to try Vue, go to the documentation at once!

There are many, many and many frameworks and libraries like these of JS. But, to be concise and small I just added these four very popular frameworks and libraries. It is totally on your own conscience what you want to try and work upon.

Conclusion

JavaScript is one of the best programming language at present. Core JS has many aspects which can take a lot of time to try and study upon. But, as they say if your studying about something, study it with utmost sincerity. So, it’s on you to go digging deeper.
To work upon all these frameworks and libraries, first you have to know JavaScript in its deepest depths. Hence, start trying JavaScript. My own preference to learn JS will be from W3Schools and the book Eloquent JavaScript by Marijn Haverbeke. They have the best resources and also you can anytime refer to it. Also Codecademy course of JavaScript with many other web development course I have found are very good. The completetion of the course rest purely on your will.

Please feel free to refer other online resources for JavaScript.

Till then this “thegeekbong” signing off.
Thank you for reading this blog and also please share if you like it.
May you have a blessed day ahead.

by thegeekbong at July 20, 2018 08:48 PM

Manank Patni

Day 19

Worked on the coala issue and submitted the PR. Also took clss of DSA and OOPS in college.

by manankpatni at July 20, 2018 05:36 PM

Devesh Verma (devesh_verma)

Student Teacher interaction Platform using CMS(Joomla and Moodle)

MY FIRST COLLEGE PROJECT


Let me start this by explaining what this project was all about.

This project was intended to provide better student-teacher interaction, conducting a quiz for students, lectures/ notes sharing platform. All these features were to be provided on the department website, which was to be built. While explaining all these requirements to me and my friend our HOD briefed us regarding Joomla and Moodle.

Let me now explain what is Joomla and Moodle.

1. What is Joomla???

Ans: Joomla! is a free and open-source content management system (CMS) for publishing web content. It is built on a model–view–controller web application framework that can be used independently of the CMS that allows you to build powerful online applications.
For more detailed info regarding Joomla, you can have a look at their
website.

What’s a content management system (CMS)?

The definition of a CMS is an application (web-based), that provides capabilities for multiple users with different permission levels to manage (all or a section of) content, data or information of a website project, or intranet application.
Managing content refers to creating, editing, archiving, publishing, collaborating on, reporting, distributing website content, data and information.

2. What is Moodle???

Ans: Definition from the website – Moodle is an opensource learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments.
So basically this was the platform which had almost all and more than what we were briefed about from our HOD. In Moodle, you can easily configure how to add each of the functionality like sharing of notes and lectures, quiz platform, books sharing, student-teacher interaction functionality too. Also, moodle is capable of many more things like attendance management etc.

So now comes the implementation part, with the help of Joomla we can create a frontend. As we needed to develop a department website we made use of Joomla. In a few days, the website was done. Then we started off with Moodle part, setting up moodle is quite easy but because this was the first time I was making use of WAMP server, configuring WAMP and running took quite a while. This platform is so beautifully made that a novice can easily understand the complete functionality in not more than 5-10mins. We were really happy getting hand-on such a simple platform and in a day we made some demo quiz and uploaded some notes to test the functionality. To our utter surprise, everything worked in one go.

Both of these platforms(Joomla and Moodle) have there own user databases and authentication functionality, and for students to use of moodle they have to sign in from either of the locations (either from joomla side or moodle side). Have a look at the screenshots:

joomla-frontendJoomla Login
moodle-loginMoodle-Login

In the above screenshots, you can easily see the login pages of Moodle and Joomla. But we did not want a user to sign-in Joomla front and when he/she heads to Moodle they again need to sign in to use the Moodle functionality. So basically we had to provide a single sign-on feature. For this, we had presumed that it will be easy to implement this feature as both the platforms are very user-friendly. So we started searching for a way to implement this single sign-on feature. It took us around 3days to 4days and finally we had come across sometimes name as “Joomdle connector”. So the process is like we need to make a user named joomdle-connector in joomla and moodle. The use of joomdle-connector is that it syncs the database between both joomla and moodle and helps a user to sign-in only once. So this was done and everything worked seamlessly.
After this, we did all the setup on college department computers and taught teachers how to make use of the platform to the fullest.
I am attaching the video which I made for my internship application to a startup company please go through it to understand this project more.

by devesh_verma at July 20, 2018 02:59 AM

July 19, 2018

Abdul Raheem (ABD)

One Month Later At Dgplug :)!

Hello World!

The topic itself says that it’s now one month at dgplug and we have learned communication skills, how to be patient and many more. for some days our mentors took sessions just on communication skills and others basic things and then we had an intro on the shell script. So what is it?  -a shell script is a computer program designed to be run by the Unix shell, a command-line interpreter. Then we were introduced to a book which was known as Linux command for you and me LYM. Then we had sessions for This Particular Book And By This Book, I Came To Know More About Command Line.

Then we had some more sessions on it so that everybody doubts get clear from LYM book. Then we had a guest session on programming by ntoll(I didn’t remember his name it’s his IRC nickname) and we had session on privacy and security and were suggested to use tor browser and then we had a git session by Sayan and now everyone is requesting for more git sessions I hope we will have them.

Moving on to the next we had a session on vim editor and am pretty much liking it and I have used it to solve some basic math problems and now am enjoying this training/summer training. And here comes the most interesting and most awaited part of the training which is the introduction to python:), I don’t know how many weeks or months we will have the sessions but will try to grasp as much as information as I can, so what we had in python session? – First we created an account with Microsoft Azure and with that, we got access to jupyter notebook and there we did some simple calculations and Kushal took some doubts and the time was up and we ended up with that and got homework, yes you read that correctly homework, we were introduced to a new book called PYM Book and we ended up there.

The next day we had a session on time-management and operation blue moon from shakti Kannan (Mbuf), Links will be provided at last. Every time when I try to do new thing like blogging, time-management, etc…, I used to get discouraged and left that thing/time going as usual like how I was before joining to dgplug, but then again got motivated from one of our mentor and things went well from then and now I never get discouraged and the way our mentors explains with such good examples like ice-cream and all, all our mentors are polite and kind-hearted and never have been rude to us and never let us felt like frustrated or in anger :). And now I must say am not the one who I was before joining to dgplug :), now am feeling much better and thank you all at dgplug for conducting such good sessions, I will mention some of the mentor’s names which I remember from dgplug at last. am very much excited to learn many good and useful things from this training :).

So as I have said here are the links:-

Time-Management

Blue Moon

Our heroes in dgplug are:-

Kushal Das

Jasonbraganza

Sayan And More …

So by this, I will end my blog and hope to you see you again in my next blog till then happy learning :).

Note:-I may miss something if anyone from our training come across this blog and finds something which I have missed in my blog, please do ping me about it I will update that thing into my blog :).

Happy learning :).

by abdulraheemme at July 19, 2018 07:10 PM

Manank Patni

Day 18

Took up another issue to work on on coala project. Have done 90% of the work it needed, now just waiting for the maintainer to reply to some questions to finalise it. Will probably submit a PR till tomorrow.

Also didn’t felt like doing anything at night so watched some videos from a a channel. I like these kinds of infographics videos.

by manankpatni at July 19, 2018 06:15 PM

July 18, 2018

Mayank Singhal (storymode7)

Using Markdown

Hey there! A long time ago I shared my markdown experience in PyCon India 2017. What I missed was a gentle introduction to markdown. Let’s get on with it.

Markdown is amazingly simple and I write my blogs using markdown. Credits go to many folks but the one I remember always is Aaron Swartz. Yup, The Internet’s Own BoyHere is a list of people involved in markdown. Before starting with this post, I went to the website again to see if I find something new, and it was like a book that you read once and when you read it again you are amazed at what all it had!

Headings

Headings are created using a # symbol. The number of # symbols define the heading level. Like,

### Heading

This is the notation I used for the heading of this section.

Emphasis

To emphasize text you can wrap the content with * or a _. Like this text is emphasized. Strong tag generally makes text bold. It can be used by wrapping the word with ** or __. For example: This is strong text.

Code

This is the loveliest part about markdown. It not only makes the raw content easy to write but also beautiful! To write code you just need to indent it with a tab or 4 spaces (or more). Using this markdown also escapes the < and & like symbols which would otherwise ruin the writing experience.

This is some text written after indenting with a tab.
And hence treated as a code block.

For code used in the paragraph itself like this is also simple. It just uses backticks (`) to select the area that contains the code. To type backticks as a code like I did above you need to use double backticks (“) around the single backtick.

Hyperlinking text

Another easy task if you’re using markdown! Just write the text to be hyperlinked in square brackets, immediately followed by the link in parenthesis. This link is written like:

[This link](https://www.duckduckgo.com “Optional Title goes here”)

This “Optional Title goes here” part is the text which appears when you hover your mouse over the hyperlinked text. Another part that I came across when I read about the markdown again was reference-style links. I absolutely forgot about them and they just made my life easier!
You can reference a link using the syntax [link text][reference] which can also include a space by the way. And then later on anywhere in the text, you can use

[reference]: https://yourlink “optional title goes here”

If you feel too lazy to give the [reference] part, you can just give blank square brackets like [], in which case it would create a reference with the name of reference text. For example:

[ddg] []

[ddg]: https://www.duckduckgo.com

Now whenever I want to create a hyperlink, I just create reference-style links and then add a blank reference at the end of the paragraph. When I complete the blog, I can just fill these instead of jumping repeatedly in between to fetch the links.

Another really useful feature is automatic links. If you just type your link and want it to be clickable. That means, a link directing to a link. To clear out the confusion, let us see another example:

<https://www.duckduckgo.com>

This would appear as https://www.duckduckgo.com. More magical is the email address part. If you specify an email address using this method, the email address is encoded so that spambots can’t harvest it from the source of the page! Here is an example email address: example@nosuchemail.com

Lists

To create an unordered list use * or + or even - to denote items. An example would look like:

* Item 1
* Item 2
* Another item!

And after processing it’ll turn to:

  • Item 1
  • Item 2
  • Another item!

An ordered list is also easy to write.

1. Item 1
2. Item 2

Important thing is that the numbering doesn’t matter. Shocked? The number followed by . pattern just shows that this is an ordered list. You can even type random numbers or can have all the numbers exactly the same. Though it is suggested to use 1. as starting number due to a possible change to support starting of lists from a random number.

This means that:

1. Item 1
1. Another item

is perfectly fine for an ordered list. And it’d appear like:

  1. Item 1
  2. Another item

Note: If you want to write a number followed by a dot and don’t mean it to be a list, you can escape the dot by using a \. For example 123. is written as 123\.

Horizontal Rule

As simple as writing *** will create a horizontal rule(a simple line denoted by <hr/> tag). Any of * or - and even _ can be used. Spaces are also allowed between them. (The number of such characters has to be three or more)

--------

Will create:


Images

To use images, the syntax is exactly similar to hyperlinking text with just one exclamation mark preceding it.

![Alt text](https://some/path/to/the/image.jpg)

If you’ve not come across Alt text yet, it’s the text that is displayed in case image can’t be displayed.

I’ve also used markdown for writing this post and it has been a really pleasant experience.

 

Just write anything, even short content would do to see how amazing is markdown 🙂 (You may find https://daringfireball.net/projects/markdown/dingus helpful)

storymode7

by storymode7 at July 18, 2018 09:00 PM

Manank Patni

Day 17

Today’s Summary :-

  • Worked on the GSSOC issue on B.E.N.J.I. project and was successful. Then PR got merged after some of my utterly silly mistakes.
  • Also the PR on the coala/corobo project also finally got merged. Took a lot of time in comparison to what a small changes should have taken.
  • Also attended the #dgplug training. Today’s session by mbuf was on time management(which is my weakest department) will be following some of the methods he gave.

References:-

  1. https://github.com/coala/corobo/pull/582
  2. https://github.com/the-ethan-hunt/B.E.N.J.I./pull/132

by manankpatni at July 18, 2018 06:29 PM

Sehenaz Parvin

Day 31 ( Taking first footsteps in python programming).

Finally completed a month in summer training. Completed all the basic Linux commands . Now finally its time to set a new collage with basic ideas. Time to learn python programming!

Python is an interpreted high level programming language. It was created by Guido van Rossum and was first released in 1991. It provides construct that enable clear programming both in small and large scale.

So , now we know an introduction about python. Let’s start with the installation .

Installing Python:

We will Install Python 3 , the latest version of the language.

For Fedora users:
[user@host]$ sudo yum install python3

For Debian/ Ubuntu users:

[user@host]$ sudo apt-get install python3

After installing Python we will just type python3 and our terminal will show this:

>>>

Then we can type commands here to get a desired output.

Let us take one example: Type the following in the terminal.

>>> print(“hello world!”)

We will get the following output:

hello world.

Now we will get hold of Microsoft Azure notebook for writing commands and practising. We can also use the terminal also for this purpose.

Opening and creating an account in Microsoft Azure Notebook:

Firstly open this site with the following link:

https://notebooks.azure.com/

We will get the following screen:

There in the right corner of the screen we are going to get an option ” sign in”. We will click on that and we will get the following dialogue box :

If you already have an account you will log in through that. Otherwise click on “create one”.

Then give your email address and create a strong password. Our account will be created.

We will get the following screen. Mine one has already a created one. So no worries about that.

Now look at the following steps very clearly:

  1. Click on +New Library option. We will get the following dialogue box:

  1. Give your library a name. for eg: dgplug. and add your library id like your first name.Then click on create option. Our library will be created.

  1. Click on the library you have created. Then click on the +new option. We will get a dialogue box like this:

Add an item name for eg: summer training. Then select the item type as Python 3.6 notebook. Then click on New option.

  1. Then click on the created item. We will get the following screen:

It will be blank actually with one box available. I have given this picture with examples also.

Now you can try the examples to get the result as given in the screen.

Isn’t it interesting ? First get habituated with basic commands then slowly proceed into it.

So , I hope I could help you to create an account on Microsoft Azure Notebook . If not please tell your feedback to me so that I can improve more on it. Happy programming!

by potters6 at July 18, 2018 04:26 PM

July 17, 2018

Manank Patni

Day 16

Took up a new issue to work on under GirlScriptSOC and am currently working on it. Also from today the python classes have started in the #dgplug summer training. The training will be held on an online Jupyter Notebooks by Azure. Also tge PYM book was shared to learn Python. Looking forward to having a great learning experience.

References:-

  1. https://github.com/the-ethan-hunt/B.E.N.J.I./issues/129

by manankpatni at July 17, 2018 06:25 PM

Janifa M(bismi)

DGPLUG – Day 23

Started learning Python :).  Yesterday two of my friends, Anusha K.(anusha_1997) and Nimisha C. P.(nimisha_1997) joined dgplug and today, we attended the class together. Really enjoyed learning together.

by janifanowfal at July 17, 2018 05:52 PM

Ashish Kumar Mishra (ash_mishra)

Static pages with Gatsby

Gatsby is a JavaScript framework used for generating static HTML from React components. The thing is, while React is used to build a client-side application it generates JSX and not HTML, and so it’s a little difficult for the web crawlers to crawl through a react page.

This is a problem if you are building static websites such as a landing page for your project/product or a blog page, etc.

Gatsby generates static HTML from your React app and when you deploy it, it’s easier for the web crawler to go through the contents of your page and bring up your page in google or a duck duck go search results.

With all this in mind, let’s get started.

Installation

To start with, you will have to install the gatsby-cli. So fire up a terminal and type:

npm install --g gatsby-cli

Create a project using Gatsby

In the terminal type the following command:

gatsby new  https://github.com/gatsbyjs/gatsby-starter-hello-world

Fill the brackets with the name of your project.

Run

To run the application just type

gatsby develop

in your terminal, open your browser and go to localhost:8000 and tadaa… There’s your first Hello World application using Gatsby.

Next steps

If you are familiar with React, you can edit the tag in index.js and see the changes in your browser and play around with it a little.

GraphQL

There are many options for loading data into React components. One of the most popular and powerful of these is a technology called GraphQL. GraphQL is a query language that was invented at Facebook to help product engineers pull needed data into components. GraphQL is a query language. You use a special syntax, to describe the data you want in your component and then that data is returned to you. Gatsby uses GraphQL to enable components to declare the data they need.

You have to create a config file named gatsby-config.js in the root directory and type:

module.exports = {
  siteMetadata: {
    title: `Your title here`,
  }
};

Restart the server and go to http://localhost:8000/___graphql which is an interface to check your graphql queries.
You can type this query here to see your site title.

{
    site {
      siteMetadata {
        title
      }
    }
  }

In your index.js, to get the website title, you can do,

import React from "react";

export default ({ data }) =>
{data.site.siteMetadata.title}
export const query = graphql `query LayoutQuery { site { siteMetadata { title } } }`

You can see more here https://www.gatsbyjs.org/tutorial/part-four/

HTML page from JSON data

Now to get data from a JSON file, you can install a plugin named gatsby-transformer-json. You can find the installation instructions at https://www.gatsbyjs.org/packages/gatsby-transformer-json/

The gatsby-config.js file should look something like this:

module.exports = {
    plugins: [
      `gatsby-transformer-json`,
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          path: `./src/data/`,
        },
      },
    ],
  };  

Here, we specify the path as being ./src/data/, so the json file must reside in the data directory inside src.

The important thing to note here is that the JSON file can be of two types: it could either be an array of objects, in which each object has the same key, or it could be a single object having a key and a value.

The value must always be a string for gatsby-transform-json to read it.
If your JSON file name is letters.json and has keys named “value” You can query the data at localhost:8000/___graphql like so:

{
  allLettersJson {
    edges {
      node {
        value
      }
    }
  }
}

This query now runs in your React component to get the JSON data, and you can use it according to your needs.

I had a JSON file, having values as strings in markdown format and I created a whole static page using just this.

If you need help, the Gatsby guide’s over here: https://www.gatsbyjs.org/tutorial/

Try it. Gatsby is fun.

by Ashish Kumar Mishra at July 17, 2018 05:38 PM

Prashant Sharma (gutsytechster)

Hamara Sugam release Party

Hey everyone! I was waiting for this weekend so as to attend the release party of Hamara Sugam 2.0 (Namaste), a linux distribution. I get to know about this from the meetup page of ILUG-D and LinuxChix India. I was following their events for last few months and came across this. The name of the distribution itself is so fascinating and different that I was eager to know more about it. I was excited to know about it from the actual founder and main contributors of the project.

The Beginning

I reached the event on time. There were few people at the time but soon, the room was full. According to the schedule,  our first session was to be taken by Vikas Tara, the founder of Hamara Linux, remotely from UK. We all were excited to listen to him. Initially, there were some technical problems but soon they(organisers) managed to solve it. He was thrilled to see so many people. He started with his small experience on how did he come up with this project idea. So, the story is like this

Once, he went to a shop to buy a laptop(specifically Macbook). But, when the shopkeeper showed him the machine(laptop), Vikas said that he only want the machine and not software. The shopkeeper was amazed and  said “You must be one of those linux guys”(lol).

Well, the shopkeeper understood very well. He is a linux guy, just like us. Vikas felt that even if he buys the machine, he would be restricted to use it in a pre-defined manner. So he thought of building something which belongs to us and came up with the “Hamara Linux” project. The name shows his intentions very clearly. To the people who might not know, “Hamara” is a hindi word which means that something belongs to us. So, he gathered all open-source enthusiasts and begins with the project which has now brought up its 2.0 release. Amazing, isn’t it?

Soon, as he completed with the small conversation, we all bid him goodbye and continued with the follow up sessions. The next session was a presentation by Shivani Bhardwaj on the features of Hamara Sugam desktop. Some of the features she shared:

  • The Hamara Sugam release uses the Calamares installer. They have tried with other installers also like Ubiquity(default installer of Ubuntu), Debian Installer, but at last they come up with this distribution-independent installer.
  • It uses Material theme for Hamara Sugam desktop and Paper theme for the icons.
  • They have used Generic names for the applications
  • They used the updated linux kernel 4.16 in their new release.

In the end she shared wikis links for references. You can find it here.

The next talk led by Raju Dev, who has worked on the integration of Calamares installer specifically. He shared the repositories which contains the source code. You can find them here. He explained how he experimented with other installers, however he got the success with the Calamares installer only. I was new to these things so it fascinated me a lot.

As soon as it ends, we had a lunch and networking break. We enjoyed the lunch break and meet with other people out there. People there were discussing about the web series “Sacred Games”(duh! everyone knew about it except me).

After the lunch break, Manas Kashyap took the stage, who has contributed to the Hamara Docker Containers. He explained that earlier he has contributed to Debian packaging and then he started with building Docker containers for Hamara. He also shared that it still needs the improvement as its size is large. He asked the interested contributors to take up the task and contribute to the project. As soon as he finished his talk, Sagar came up with another small discussion on to bring more GTK based applications and plans for upcoming GNOME based Hamara Svastik release. If you are new to the terms like GTK and GNOME(just like me!), there is a small explanation over here. In the end, Shivani and Raju talked about the upcoming plans of Hamara Linux project.

Yay! Cake Cutting Ceremony

Well, the most awaited part of any release party would be cake cutting, though everyone thinks to eat only (lol). After the cake cutting, it was distributed among all enthusiasts over there.

cake-hamara

WhatsApp Image 2018-07-17 at 1.21.58 PM

When we’re all done with filling our tummy, there held a small quiz-round. So, the rules were simple. A question would be asked and whoever raises the hand first would get a chance to answer the question. If the person gives the right answer, s/he would win a Hamara T-shirts(great prize, huh!). Though, I got a chance to answer one of the small question, I wasn’t right exactly. So, I missed it. But it was fun seeing people taking an active participation.

On the final note, everyone took a group photo and then we all left. We were given a small gift. Finally, I got something(just kidding).

hamara-group-photot

Can you find me in the picture? Well, maybe yes or no,  but I am there. Let me know if you get it where I am in the comments below. It was an amazing experience. I feel so happy to share it with you all. What do you think about this new distribution? Let me know this also in the comments.

For now bidding you goodbye!

Be curious and keep learning.

by gutsytechster at July 17, 2018 11:27 AM

Abdul Raheem (ABD)

John Perry Barlow

Hello World!

Sorry For This Late Blog Because I Got Busy With My College However Here Is My Blog :), So Who Is John Perry Barlow?

John Perry Barlow Is The Co-Founder Of EFF, You Can Go Through His Site Here.

In One Of Our Session, Kushal Said Us To Go Through This And Then To Go Through The Keynote Of Pycon 2014 Here Is The Link I Have Completed The Half Part Of This However I Will Probably Finish It Soon And Then Complete The Keynote Aswell. I Got To Know About It By One Of Our Mate On Dgplug IRC Chat.

by abdulraheemme at July 17, 2018 11:26 AM

Fun Begins Today!

Hello World!

Yesterday We Had A Session And Kushal Said Us To Go Through The Vim(It Is An Editor) Logs (Will Provide The Link Below For That Sessions ),  And Said That We Will Start Python Programming From Today, Feeling Good about it ;). Kushal Gave Us A Resource To Go Through Which Is Introduction To Python. I Completed Some Basics Of Python In Dataquest.io.

Python Is An Experiment In How Much Freedom Programmers Need. Too Much Freedom And Nobody Can Read Another’s Code; Too Little And Expressiveness Is Endangered.

– Guido Van Rossum –

images1

Resources For Vim :

1st Class

2nd Class

4th July 2018 Session

5th July 2018 Session

 

by abdulraheemme at July 17, 2018 10:32 AM

Piyush Aggarwal (brute4s99)

My testimony about Blockchain

from Genesis block to blockchain and everything in between!

Blockchain is a vast, global distributed ledger or database running on millions of devices and open to anyone, where not just information but anything of value — money, but also titles, deeds, identities, even votes — can be moved, stored and managed securely and privately. Trust is established through mass collaboration and clever code rather than by powerful intermediaries like governments and banks.

Wikinomics

So I’ve been reading all about blockchains (even those 12 point font research papers!). This is a rough gist of what I learnt:-

A distributed ledger

Wikipedia explains thus –

“A distributed ledger is a consensus of replicated, shared, and synchronised digital data geographically spread across multiple sites, countries, or institutions. There is no central administrator or centralised data storage.”

This seems too much condensed. Let me break it down for you.

  1. There is no central authority.
  2. Every transaction here occurs in front of an array of guards that maintain order and make sure the transactions are completed in full by both parties.
  3. These guards are just some computers that have volunteered to become a ‘node’. Only these nodes can validate the transactions of every user on a blockchain.

Before we go any further, I need to tell you what a transaction means in this context.

A transaction occurs when there is an exchange of data between any two parties. It need not be money only. It can be any data, you can even make a deal involving official papers of properties through some blockchain implementing platform!

And if this sounds scary, don’t worry; no-one, not even those nodes (the ones which supervise the transactions) know what exactly you exchanged! Kudos to privacy! And that’s not even half of it! I’ll explain more later.

Consider the conventional case of a bank (a conventional central authority).

NOTE : We are using ‘bank’ as an example just because it comprises a good amount of ‘transactions’. Always remember that these ‘transactions’ can be of data or goods too!

So here, in a bank, all the transactions occurring between accounts would be verified by a single, central authority, and all your possessions currently with the bank would be at the mercy of the whims of the bank, the single point of security in the transaction. If, by any chance, the bank burns down (physical damage to central authority) or gets robbed (or hacked), or seizes your account (unethically or otherwise) , there would be consequences, the likes of which you most probably won’t be comfortable with.

Enter blockchain with the power of consensus based distributed ledger! If we consider the case of bitcoin blockchain, there are about 7000 nodes in the network that all work for the security of all those precious bitcoins that keep soaring and falling by the minute. For bitcoin to fail, all these 7000 points of security would have to be attacked at the same time, or at-least half of them. Not only that, with the sky-high pricing of these virtual currencies, more and more people are opting in to become nodes, which adds to security of the users(traders) making transactions over bitcoin blockchain. So that’s security for you and the ‘things’ you love! If you wish to know more about blockchain that deals with data, check out ethereum. Ethereum is an open-source, public, blockchain-based distributed computing platform and operating system featuring smart contract functionality.

Block

A block is the ‘current’ part of a blockchain, which records some or all of the recent transactions. Once completed, a block goes into the blockchain as a permanent database. Each time a block gets completed, a new one is generated. There are countless such blocks in the blockchain, connected to each other (like links in a chain) in proper linear, chronological order. Every block contains a hash of the previous block. The blockchain has complete information about different user addresses and their balances right from the genesis block to the most recently completed block. Every node on the blockchain has a copy of the ledger with themselves, that gets synced after creation of a new block.

The ‘what’ block ?

Every blockchain has to start somewhere, so there’s what’s called a genesis block at the beginning. This is the first block, and there, at the beginning, the creators of Ethereum (or any other cryptocurrency) were at liberty to say “To start, the following accounts all have X units of my cryptocurrency.” Any transfer of data on the blockchain will have originated from one of these initial accounts (or from mining).

The blockchain was designed so these transactions are immutable, meaning they cannot be deleted. The blocks are added through cryptography (more, later), ensuring that they remain meddle-proof: The data can be distributed, but not copied (a node never knows exactly what’s in these transactions). You can always see a block yourself by using a Blockchain Explorer.

Privacy – how?

The blockchain isn’t just a bunch of computers watching that A sent something to B in return for some data; it’s so much more than that! On-chain transactions refer to those cryptocurrency transactions which occur on the blockchain – that is, on the records of the blockchain – and remain dependent on the state of the blockchain for their validity. All such on-chain transactions occur and are considered to be valid only when the blockchain is modified to reflect these transactions on the public ledger records.

What the crypto?!

So how does cryptography exactly fit in with this blockchain? It’s simple- the nodes lock the data with a  256 bit number (Hash Sum) that represents the data within a block. A different blockchain may use a different hash function, but the basic idea of its integration in the blockchain remains the same (more or less).

Hashing Functions

File:Hash function.svg - Wikibooks, open books for an open worldA basic idea of any hash function. <source>

If you look closely, you’ll notice even a slight change (even just 1 bit) in the data would create a different hash sum altogether. There is simply no pattern at all!

So here comes the answer to a question that might’ve struck you-

Why would anyone waste her/his own electricity and compute power to validate my transactions? Social service? Repentance out of guilt?

It’s MONEY!

There are nodes, there are traders, then there are MINERS.

Miners are a subset of nodes as all miners must be running a full node (ie they must have complete ledger with themselves) in order to mine (at least to mine properly). The nodes are what determine consensus as all nodes must agree to the same rules otherwise the nodes will fork off of the network.

They’ll what ?

They’ll fork off of the network.

A byproduct of distributed consensus, forks happen anytime two miners find a block at nearly the same time. The ambiguity is resolved when subsequent blocks are added to one, making it the longest chain, while the other block gets “orphaned” (or abandoned) by the network.

But forks also can be willingly introduced to the network. This occurs when developers seek to change the rules the software uses to decide whether a transaction is valid or not. Forks can be classified into two- hard and soft forks; both have different implications for the network and ecosystem.

Hard forks are a permanent divergence in the the block chain, commonly occurs when non-upgraded nodes can’t validate blocks created by upgraded nodes that follow newer consensus rules.

Soft forks are a temporary divergence in the block chain caused by non-upgraded nodes not following new consensus rules

Miners can add blocks to the blockchain so long as every other node on the network agrees that their block fits the consensus rules and accepts it.

The Block Header

So what do these miners do exactly? They hash the block header. It is 80 bytes of data that will ultimately be hashed.

The header contains this info:

Name Byte Size Description
Version 4 Block version number
Previous Hash 32 This is the previous block header
Merkle Root 32 The hash based on all of the transactions in the block
Time 4 Current time stamp as seconds (unix format)
Bits 4 Target value in compact form
Nonce 4 User adjusted value starting from 0

 

Screenshot_20180717_080410A snap of the latest block at Bitcoin blockchain at the time of writing.

How would the consensus deem a mined block as accepted?

See the Bits part ? It is the Integer (Base 10) representation of the target that is to be achieved by the miners. The target is the 256 bit hash sum of the block header. It is the MAXIMUM value acceptable by the consensus for the hash.

MAXIMUM value?

I thought you’d never ask! See the nonce part in the block header? Yup, miners need to start all the way from 0 (some may try to skip values, completely up to miner) to the number that when used in the block header, yields a hash sum below the target. See the nonce in the latest block image? The miner who successfully relayed this value to the nodes received the price money ie 12.5 BTC! That’s a lot of work and indeed a lot of bucks!

People buy special hardware (recent scarcity of GPUs? Curse those miners) and even computers specially built for this purpose! Ever heard of ASICs?

As it stands, mining on your won, on your single PC is almost dead. The process of finding blocks is now so crowded and the difficulty of finding a block so high that it would take over an year to generate any coins on an average high-end gaming system. While you could simply set a machine aside and have it run the algorithms endlessly, the energy cost and equipment degradation and breakdown will eventually cost more than the actual bitcoins are worth.

Pooled mining, however, is far more lucrative. Using a service  you can split the work among a ground of people. Using this equation:

(12.5 BTC + block fees – 2% fee) * (shares found by user’s workers) / (total shares in current round)

Putting it simply, it is basically how the system works. You work for shares in a block and when complete you get a percentage of the block reward based on the number of workers alongside you. More the people in pool, higher the chances of rewards.

Types of Blockchains in use

Any blockchain can be classified into any one of these categories-

Public Blockchain

The most basic of all blockchain concepts. This is the blockchain everyone uses out there.

The most basic features of this bockchain are –

  1. Anyone can run a BTC/LTC full node and start mining.
  2. Anyone can make transactions on the BTC/LTC chain.
  3. Anyone can review/audit the blockchain in a Blockchain explorer.

Example: BitcoinLitecoin etc.

Private Blockchain

Private blockchain as its name suggests is a private property of an individual or an organization. Unlike public blockchain, here there is actually someone in charge who looks after important things such as read/write or whom to selectively give access to read or vice versa. Here the consensus is achieved on the whims of the central authority who can give mining rights to anyone or not at all!

Example: Bankchain

Consortium Blockchain

This type of blockchain tries to remove the sole autonomy which gets vested in just one entity by using private blockchains.

So here you have multiple authorities instead of just one. Basically, you have a group of companies or representative individuals coming together and making decisions for the benefit of the whole network. Such groups are also called consortiums or a federation; ergo the name consortium or federated blockchain.

For example, let’s suppose you have a consortium of world’s top 20 financial institutes out of which you could decide that if a transaction or block is voted/verified by more than 15 institutions, only then does it get added to the blockchain.

Example: r3EWF

In fact, the idea that cryptographic keys and shared ledgers can incentivize users to secure and formalize digital relationships has imaginations running wild. Everyone from governments to IT firms to banks is seeking to build this transaction layer.

Authentication and authorization, vital to digital transactions, are established as a result of the configuration of blockchain technology. The idea can be applied to any need for a trustworthy system of record.

by brute4s99 at July 17, 2018 05:47 AM

Mohit Bansal (philomath)

One year anniversary with Pydelhi!

8th july 2017 is the day when I attended my very first meetup of pydelhi or any in general. Thanks to #dgplug folks and @curiouslearner. And now a year later, we had another pydelhi meetup on the exact date which marks my one year annniversary with delhi open source community. This post is going to be lengthy, so grab your popcorn! So, let's start with the details and experience of this

by Abstract Learner (noreply@blogger.com) at July 17, 2018 05:15 AM

Bhavesh Gupta (BhaveshSGupta)

Javascript uses utf16 and Html utf8, then how things work together?

This was part of one the discussion of dgplug discussion, that javascript uses utf-16 and html we usually use utf-8 as character encoding then how things work out. This was quite intresting on how things work around because of this. So I was reading around to find answers for the above question and I landed upon this. And this text from the answer in the link helps understand how things work.

July 17, 2018 12:15 AM

July 16, 2018

Bhavesh Gupta (BhaveshSGupta)

Update 17 Jul 18

This update post was actually created on 10th july, But as ususal due to some x reason it is not yet complete. There are several things which are running into my life right now out of them on is to update this blog on regular bases to get align with things. Pending Posts This blog came to life again due to dgplug summer training where we were taught to write blog post about things you are doing or learning(PS: I am yet to read logs to that class :p).

July 16, 2018 11:33 PM

dgplug Start 2

So Last year in some Facebook group or somewhere I read about summer training offered by dgplug on IRC chat. I had heard about IRC chat before and had tried to use it once or twice but never tried to use it or understand it. Technically summer trainings are usually for college students but during my college time I was too busy being in and around Microsoft Student Partner that I didn’t knew about many things around.

July 16, 2018 10:30 PM

Mohit Bansal (philomath)

Aman Verma (nightwarriorxxx)

Day 4 #Coding Streak

“An essential part of creativity is not being afraid to fail.”
– Edwin H. Land

Open Source!!, Coolest thing I have ever heard. My urge to contribute in Open Source is become more and more day by day. So, I found a project called random-words in Python and started looking for good first bugs. I solved it but when it came to pull request I faced problem with Travis CI. At that time I don’t know what do I do with it then I asked the project mentor about it. He tried to help me and make me understand but I was completely blank. I researched about it on internet but I didn’t get anything. So i failed to send my first PR to an Open Source Project but anyways I will try it again with more confidence.

Coming to Python I just completed beginner tutorials course from datacamp.
It not only help me with variable,strings,list,function but I also learned about numpy library. Side by side I am going through Python For You and Me,a book full of resources. I recommend everyone who want to start with Python just have a look at it, you will automatically get to know it’s conceptual power. Looking more forward to contribute to Open Source Projects and to become I good coder as it’s my second year now I will be going to attend lots of meetups specially PyDelhi-devsprints and Pycon 2018. Some more things I need to tell you but I will wait for my next blog. Till then stay tuned!!!

Happy Hacking

by nightwarriorxxx at July 16, 2018 07:02 PM

Janifa M(bismi)

DGPLUG – Day 22

Kushal told that we will start learning Python tomorrow, happy about it 🙂 . I was reading this (Introduction to Python) which is shared in today’s session and wondering how simple Python is, when I saw this 4 line code to print initial sub-sequence of Fibonacci series.

a, b = 0, 1
while b < 10:
    print(b)
    a, b = b, a+b

by janifanowfal at July 16, 2018 04:58 PM

Shiva Saxena (shiva)

John Perry Barlow – A rhyme in Cyberspace

Howdy readers! While going through dgplug summer training, I am getting to know about people who have not only enhanced and simplified the availability of information over the internet, but also about people who have brought the goodness in cyberspace, revealed the secrets behind the internet and what not. As a result of their work, we are now experiencing our internet as it is.

“The Internet is the most liberating tool for humanity ever invented, and also the best for surveillance. It’s not one or the other. It’s both.”

— J. P. Barlow

John Perry Barlow is not only a name but I see him as an exemplary individual who devoted his life to dreams. Dreams which were not shaped by selfish deeds like that most of common people’s, but his dreams, lies for the benefit of humanity around the world. Dream of a better cyberspace. Dream of freedom to get information.

“Hope does not always require probability.”

— J. P. Barlow

I first got to know about John Perry Barlow from this PyCon Talk. That, I really enjoyed! From the talk, I also got to know about organizations such as EFF (Electronic Frontier Foundation) and Freedom of the Press Foundation.

As I watched the talk, I got to know about John Perry Barlow as an Internet philosopher, as a great speaker who has a sense of humor in his tone and as humble as the stature of his thoughts. I got to know about his dreams for cyberspace and people around the world who are part of this.

“I … believe that angels, or something like them, sometimes live among us, hidden within our fellow human beings.”

— J. P. Barlow

After watching the video I couldn’t stop myself to search for him over the internet. Soon, I  found out that he is not only an Internet activist but also a great writer.

Without any doubt, the passion he had for liberty very well reflects in his writing, that was how my first exposure to John’s writing happened from his A Declaration of the Independence of Cyberspace.

I would say, that piece of writing is daring … and amazing! I mean, see below is a quote from the same.

“We will create a civilization of the Mind in Cyberspace. May it be more humane and fair than the world your governments have made before”

— J. P. Barlow

I can’t explain in words how true, confident and motivational the words in this declaration sounded to me.

When I was searching about him over the internet before I could come across anything further. I come to know that unfortunately, he has left us in this February and next, I watched his symposium.

In this, people who knew John very closely came forward and gave some words about him and also answered some questions from the audience. At times the moment in the symposium was joyous, and at times it was nostalgic.

“If you’re not lost, you’re not much of an explorer.”

— J. P. Barlow

For me John Perry Barlow is inspirational. And I believe not only for me, but also for people across the globe. Currently, I’m going through more of his writings available here. And at times I wonder about how much some people are struggling passionately, selflessly, and with dreams in their eyes to make a safe and better cyberspace.

Thanks for reading!

by Shiva Saxena at July 16, 2018 03:48 PM

July 15, 2018

Ved Sinha (Ved_Sinha)

My Blog

 

Ved’s Blog
About My Python Experience

Hello everyone, my name is Ved Sinha, I’m a 10 year old homeschooler in Pune, India and this is a blog post about Python and how I got interested in the topic. I started 1 1/2 years ago when I went to a JavaScript course but it didn’t work out. Then I tried a Python class but the teacher didn’t work out and then in the U.S. I went to a summer camp about Python and loved it.

When I returned to Pune, we (and by we I mean my mom) had a hard time finding someone to teach me (not everyone thinks that kids can learn Python) but we stayed encouraged. I went to a Python Pune Meetup in a place called Red Hat, they were so welcoming and nice to me. They introduced me to a programmer named Aditya who was looking for a job so we asked him if he could come over to teach Python.

Aditya and I clicked and not only did he become my mentor but we were BFFs in no time. He would come over every day I learned the amazingness of Python for 2 and sometimes 3 hours! He really understood me and vice versa; we spent a long, long, long, time working with the code and then…. WE MADE OUR FIRST GAME! It was called “Bounce; The Best Game Ever.” A few months later we made “Mr. Stick Man Races for the Exit.” We enjoyed making games with Python and even presented the games at the Meetup. That experience encouraged us to make a game called “Da Car Racing Game”.

I started using Python for Minecraft and attending more Python meetup and workshops. This is what I have done in Python programing so far and I hope more and more kids like me love and learn programing.

Oh and one more thing here are the books that Aditya and I followed

 

Thank you for reading my blog.

by vedsinha08 at July 15, 2018 01:55 PM

Manank Patni

Day 15

Today’s highlight was the meetup of Python that I attended. It is named PyJaipur Meetup. I had a great time there and met some amazing people. We learnt the basic data structures of Python Language.

The thing that I realised in this meetup was that I have been learning an writing Python for some time now. But still I learned a lot of things that were completely new to me and I know this is going to happen a lot with a language like Python.

So, I hope to attend more of such meetups to grow my knowledge of python as well as make some new friends.

by manankpatni at July 15, 2018 06:25 AM

July 14, 2018

Prajit Mukherjee(thegeekbong)

Version Control – A baby step for project management

 

What is version control?

Version control is an idea to manage the changes to documents, computer programs, large websites, and other collections of information.
It can be done by any means and there are many softwares available to do version control.

In lay man’s language version control can be broken into two words; version and control. ‘Version’ can be said as the different instances of a file after a number of changes are done on it and Control means controlling these changes. Thus, controlling or studying the number of changes on a file is said to be version control.

In a life of a Software Engineer or a Coder working on a project in a group, implementing version control is the most important step. Version control can be used when working on an individual project also. Suppose someone is starting his/her project after leaving for a long time and he/she doesn’t remember where he/she left, version control can be a useful tool here.


 

Now coming to the software to use to do version control. As I wrote there are many free softwares to do version control naming some are Git, Mercurial, Apache Subversion, Concurrent version system and many more. But the two most popular is Git and Mercurial. I’ll use Git to make you understand the main agenda of the blog.

Now coming if we go up to the picture used in this blog, in it, first, it is written Git, which is the software, and an icon is made, that is what we call GitHub. Now, what is GitHub? Github is nothing but a web application which let us host our projects with inbuilt version control in it. In GitHub, there are millions of programmers, GitHub gives our project a chance to let the other people alter our source code and tell us how to do it better than what is written. Let’s leave GitHub for the moment and start to learn basic localhost end version control.


 

The importance of version control

Version control is important for documents that undergo a lot of revision and redrafting and is particularly important for electronic documents because they can easily be changed by a number of different users. These changes may not be immediately apparent.
Quite overwhelming, right? Let’s discuss what it says, the above statement tells us the importance of version control(Duh, we all can see that), it tells us that a document saved on a server which is shared by many people can be a part of many editing and changes in the data done by everyone. Now, if the document contains 80 pages it will be a tedious job to actually see where someone has edited and what. Hence, by version control, one can easily see the added line and also the removed line, if any. All the editing can be seen in by version control softwares. Thus, making life easy.
This is implemented in projects by big companies because they have many employees working on the same project.

git-logo

Now, without further adieu let’s come to Git, which is a very popular version control software after which a huge web application is named.

First, let’s install Git.
For Windows users, Git has to be downloaded as an executable file and will won’t be able to work at the command prompt. So, if you are a Windows user, follow this link Git for Windows. The file will automatically start to download and you have to install it.

For Mac users, Git is pre-installed in your command line, to check the version of your Git write down the following command in your CLI(Command Line Interface) –

/usr/bin/git --version

This is because the git is pre-installed as Apple-Git at /usr/bin/git. And if you want to download it explicitly, then follow this link Git for Mac. But I don’t feel it is necessary.

For Linux users also it is pre-installed.

Let’s Get Started

Any Git command will start by calling Git. Yes, you heard it right, as you are called by your name Git also prefers to be called by its own name in CLI. To check a version of the Git installed we use

git --version

This will give the version installed in your system. The latest version can be seen on the official website of Git.

Now as you have worked upon the first command for Git. Let’s learn a bit more. Before going on we have to learn some of the keywords which will be needed in further reading.

  • Repository: It is the central location where data is stored and managed. In simple words, it is the root folder of your project. It is popularly known as Repo.
  • Branch: A branch determines the workflow of the project when a number of people are working on the same project. In this case, a user will create a branch of the default branch called master and gives it a name. This will copy all the files of the repo to the branch say ‘newbranch‘. Now the user who has created this branch can work independently on that branch and after he/she is finished doing the required work, he/she commits the changes to the ‘master‘.
  • Commit: A commit is used to save the changes in the main project. After making a branch as explained above, and attaining the goal the user sends a message to the owner in the form of a commit. The commit consists of a message, which explains the changes done. In Github, each commit has a hash id. This differentiates the different commits in the project because in real time there can be as many as 50 commits in a single project.

gitbranch

The above picture shows you how a new branch is formed off the master branch.

Now the commands used in Git:

git status *This tells that if the project has git incoporated in it*
git init *This changes the folder into a git repository*
touch file *To make and empty file*
git add -A *This adds all the file in the staging area*
git commit -m "...message goes here..." 
                    *This creates a commit with an option as message*
git log *This is to show all the commits*

These are some basics commands to use Git. In the above commands, there came a phrase which introduced a new word, staging area, this is the area where Git works upon. If an update is not added to the staging area then Git will ignore that update. Hence, adding that update is very necessary.

Now let us create a branch and work upon it:

$ git branch branch_name *This will create a branch branch_name*
$ git branch *This commands displays the branch the user is in*
$ git checkout branch_name *To change the branch to branch_name*

*Now to merge a branch to master, checkout to master by the above 
command and then write the below command*
$ git merge branch_name

*After merging to delete branch we use -*

$ git branch -d branch_name 

Now as Git tells the different instances of the file it must tell the difference also. So the difference of two instances of the same file can be given by

$ git diff file_name 
$ git log _commit hash_

Each commit has a unique id. Here it is used to log the changes the commit will do to the main project.


githubGithub

Github, as explained above, is nothing but a web application which lets people store their code in the cloud and also lets fellow coders around the world to contribute to the project. Well, it shows the source code of your app or project and other coders can improve it or help you with some issues that come up. This is the basic idea of Github in simple words.

To get to know more about Github and how to use it there’s always a tutorial by Github to learn more about it. Github is a very versatile and moreover stacked up with new and efficient services for Project Handling, though it uses Git in its backend.

Github has the same idea of Git that is creating a repository and letting others edit it by making a new branch or creating a commit. But as said it has many other services also that is Pull Requests and Forking.

Pull Request:

It is a type of submissions by the contributors after contributing or rectifying the issues rose by other fellow coders after using the application or making the application better. A pull request is sent to the owner of the repository and if he/she feels like it is worthy to implement in the project it is accepted.

Fork:

Forking a repo is mainly copying the whole repository of someone under your profile. This is mainly done to change or contribute to the project and later you can send a pull request to the owner. This feature is a very useful feature because one can contribute to the project at one’s own leisure and also the main project does not get changed hence, easy to compare.

Github is a platform where not only you can upload your work but also can contribute to other projects and showcase it to the world, as it is a global platform. Github also generates a heat map kind of a thing which tells the visitor how much you are contributing to your community.

Github also lets the owner create a README.md file which tells other contributors about the application. Popular softwares like Linux Distros, Mozilla Firefox browser, Chrome Browser, Atom Text editor and many more are uploaded on Github and you can contribute also.

Contributing to Github is easy but to maintain the decorum of the organisation and the community is as important as rectifying the issues. Hence, one must read the contributors text before contributing to the project. A well organised and a polite behaviour must be maintained when conversing with others.

You’ll keep finding many other references to Github and Git, and you can also search and gather more information about them also by just googling them.

Till then this is the thegeekbong bidding goodbye. Hope you have a marvellous day ahead and heartiest thanks for taking the time to read it.

See you on the next page. 😉

by thegeekbong at July 14, 2018 07:47 PM

Manank Patni

Day 14

Couldn’t do much today the internet was baned for nearly the whole day in the city. Other than that made some changes to the pr as proposed. Waiting for its approval

by manankpatni at July 14, 2018 06:10 PM

Pooja Kumari Singh (poojaencoded)

Gangtok: one day trip

Gangtok, a blissful Heaven in the Northeast😊.Exactly one week ago i went for the Gangtok.

Actually it was not a planned trip i went for the interview . Amazing place not too much expensive.I stayed there in one of my seniors home,and took pictures from her terrace because i can’t stop myself after looking this beautiful scenario 😃.A beautiful place I ever seen till the date .I wish i could stay there for more 4-5 days,but i went there with my uncle and next day he has his work as he didn’t take leave ,so we came back next day my hometown.But definitely I ‘ll go again there in future with my friends😊.

by iampooja at July 14, 2018 04:12 PM

Prashant Sharma (gutsytechster)

Why should you write a blog?

Does the topic seem boring to you? Indeed the answer to this question looks simple and easy. But do we know all the possible perspectives to this question? This can only be possible only when we ask many people out there about this. Rather than asking every person individually, there is a much better way to do this. You know this, don’t you? Yes, blogging. Well, instead you go to everyone and ask the same question, you can write a blog over it and ask the people through it. Of course, one of the main advantage of internet is to connect people across different parts of the world, belongs to different diversities. So, why not use it? So, this comes out to be one of the answer to our question.

So, few days back we were told to write blogs in our DGPLUG summer training. Though I have already started writing blogs, I wasn’t regular. Maybe because I lack motivation to write. I sometimes used to write just for the sake of doing things. But, when you realize that how much importance it has, and how can it change the way you look at the things; the way you learn things; the way to memorize them, you get motivation to do it. So, I came up with few things that might motivate you, to write a blog.

  • Your identity

It becomes your identity on the web. Your blog reflects your nature; your knowledge; your personality. Even if the person would’ve never met you but s/he can guess what kind of person you would be. You would find every other person who is famous for his work, having a personal or professional blog.

  • A log to refer

It helps you to keep record to what you are doing. So suppose, you go on a vacation and after returning you want to resume your work. So you can refer to your blog and catch up with your work from where you left. So, it helps you to maintains a log of whatever  you are doing. This needs you to write regularly. Through this you also measure your growth and how much you are improving.

  • A better understanding

You get a deep understanding of what you are writing about. So, suppose if you have to teach someone, of course you would go prepared with the topic so that you can handle any doubt. Same goes for writing. You learn and understand topics in a way so that you can write about it in your words without any uncertainty.

  • Feedback matters

You improve yourself. Well, you might want to know how? Since, you are posting your blog over the web so that everyone can see it. When people find your post helpful they appreciate through the comments and in the same way if they find any mistake or errors, they tell you that too, through comments. This way you get feedback and with each feedback you improve and do better every next time.

  • You get a command over language

Many people don’t have English as their native language and it is the language which is accepted for professional communication. So, we need to get command over the language. I often do silly mistakes while writing. I do typos, grammar mistakes and sometimes I don’t get words to write. But when you write you search for the words; before posting you proof-read your post. This way we improve our writing skills and vocabulary and in all we get more comfortable with the language.

  • Dive into reading

Very first step to write something, is to read something. We often read something to get a better understanding of what we are going to write about. So, this way we get a reading habit which is very crucial and has an equal importance as that of writing. Just like, Jasonbraganza(one of our mentors in DGPLUG summer training) always refers to the beautiful quote said by Junot Diaz:

Read more than you write, live more than you read.

  • A platform to reach out

When you start writing a blog, you create a platform for people to reach out to you. You present your thoughts, your views, your learnings which might be helpful to a lot of others out there. So,  in a way you help society and believe me, they would be as eager to help you when you need them.

In Open source community, we help out each other in any way we can. We share what we know and spread our learnings. Through blogging you make it much easier to help.

Is it easy to write a blog?

Oh no! what have you asked me? That’s the most difficult question. I am not much experienced enough to answer this question. However, on the basis of experience I have gotten till now, I can tell a bit. Well, it wasn’t easy for me when I started to write. But it is much easier now. You wanna know how?

Well the answer to this is consistency. Being consistent in any work, indeed improves the quality and efficiency of it. So does for writing. It might seem difficult at first; might take much longer time to write your first blog post. But just don’t leave it. Start with small. Of course, it would take time to improve, but if you are persistent then it’s not hard to achieve. You have to do these three things only. Do you know what are those three things? I think you do, yes those are Read, read and read. And whatever you read, try to synopsize it in your blog post.

Now you might ask, from where should I start? There are many platforms which provide you with almost everything(with everything I mean the whole website structure). You can go to wordpress, blogspot, medium, et al. You just need to write the content and click that Publish button and that’s all. You are good to go.

Conclusion

In the end, I would say that just start writing. I hope that somewhere I was helpful to motivate you and to convince you to start writing. Meet you next time.

References:-

  1. https://summertraining.readthedocs.io/en/latest/blogging.html

Be curious and keep learning!

by gutsytechster at July 14, 2018 02:26 PM

Jagannathan Tiruvallur Eachambadi

Privacy podcast, IRL

Mozilla, the organization behind Firefox actually does more than just build software. In its advocacy efforts, they roped in Veronica Belmont to make IRL: Online Life Is Real Life, a podcast that explores various aspects of privacy in everyday life explained in a way that can be understood by everyone. It is into the third season and the current episode takes a look at the dilemma of sharing data with companies for free services and privacy.

Nothing to hide

I was privacy conscious before but documentaries like “Nothing to Hide” has opened my eyes towards the historical significance of privacy as well. People who are generally in the opinion that since I am a normal person, I don’t have to fear surveillance should watch the documentary to gain more insight as to why everyone has something to hide or at least would not be comfortable with it being public.

Grand Bargain

Coming back to the topic of the IRL’s recent episode, we have become quite accustomed to accepting long terms of service agreements for online services. This extends to application permissions that can be overreaching. We move past those in the hopes of getting something out of those applications and in some cases we do. The episode takes a dive into whether this is worth it and how it can have an impact on someone’s life.

Paying for privacy

Old methods and practices are always resurfaced as we find newfangled business models are insufficient to handle privacy concerns. The question is if we pay for services, will that buy us more privacy.

  • Platforms like patreon offer a way for creators to reach their fans directly and sustainably.
  • Paying for a mail host gives us the confidence that they will maintain our mail and are not in it for extraneous purposes.

It should be quite evident that paying for these services removes incentives for companies to spy on users and concentrate on the product instead. To be honest, I am not sure that everyone would be able to pay for every service we use for free today. A lot of us use multiple news sources but paying for each of them can be difficult.

No one left behind

There is a real concern that the section of the internet users which is not able to pay their way out of this will be disproportionately affected. Till now these issues have not been looked at seriously because of online advertisement. But due to increase in the use ad blockers we have had banners asking to disable the plugin and allow tracking to view the content.

A straightforward solution will be to allow people to share subscriptions and make them cheaper; family plans comes to mind. We should also realise nothing comes for free and accept some loss of functionality by limiting our use to essential services. More importantly by paying for those essential services we get more privacy!

Middle ground between self hosting and advertisement driven services

Motivated individuals can maintain their own services on a personal server for a small group of people. For example, personal mail servers was the norm in the 90s but it has died out considerably due to amount of administrative burden and inherent complexity of these services.

To this extent, I have seen a couple of groups popping up offering free services powered through donations and free software that can help people move from ad-driven services. Disroot and Asymtote are examples that I found online. I believe forming groups among like-minded people and creating such small services is the way forward. Importantly the author behind Asymtote is keeping the infrastructure open so people can create clones and stand up their own versions. Sharing of infrastructure can help with reducing costs and burden with regards administration and bus factor.

This post has been braindump of sorts but hopefully the links here and the podcast can help people to think about these issues before signing up for more services and think about self hosting as a cheaper alternative. If you have money, please pay someone rather than using an ad-driven service for your own privacy and safety.

July 14, 2018 12:30 PM

Aman Verma (nightwarriorxxx)

Day 3 #Coding Streak!!!

Health is Wealth

Day 3 started with a doctoral session . I went to doctor again for the final time in order to make sure my health conditions are fine. I got a green signal from him, he confirmed that my body has started reviving. But the problems doesn’t end here. My medicines made me sleep all day long. So in order to avoid my boredom I started watching movies.I started with Citizenfour,one of the best movies I have ever seen. After that I went for Imitation Game, again an amazing movie.

I started with a Python course online after coming back from playing, so that I won’t miss any basics. Believe me programming is one of the coolest things every person should try not only for knowledge but also for understanding that without programming a person’s life is nothing.
I also got to know about few cool article, which I will revel I the next blog. Till then Keep Coding !!!!.

Happy Hacking

by nightwarriorxxx at July 14, 2018 07:01 AM

July 13, 2018

Amitrajit Bose

Python String Manipulation

This article will briefly demonstrate you to some of the most commonly used string manipulation functions using Python. Let us take a quick look at their implementations in Python 3. I have used Python IDLE for easy demonstration purpose.

>>> myWord = "Hello World!"

Convert To Lower Case

>>> myWord.lower()
'hello world!'

Convert To Upper Case

>>> myWord.upper()
'HELLO WORLD!'

Capitalizing A String

>>> myWord.capitalize()
'Hello world!'

Slicing A String

If you want to slice a string from index ‘i’ to index ‘j’. Assuming i and j contain some numerical value.

>>> myWord[i:j+1]

If you want to slice the string from the beginning, you don’t need to put i=0, you can just leave it blank. The code below will slice the string from beginning up to index ‘j-1’

>>> myWord[:j]

Same goes for the ending. Suppose you don’t know the length of the string but want to slice it till the end. This will be useful.

>>> myWord[i:]

Splitting The Words

>>> myWord.split()
['Hello', 'World!']

Splitting The Characters

>>> list(myWord)
['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!']

Joining The Characters

>>> arr=list(myWord)
>>> arr
['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!']
>>> "".join(arr)
'Hello World!'

Replacing Words

>>> myWord.replace("World","Wordpress")
'Hello WordPress!'

Finding Sub-string

A sub string can be simply found using the .find() function which returns the index of the first occurrence of the character or sub string in the main string.


>>> myWord.find('orl')
7

Notice that, only the first occurrence is returned.


>>> myWord.find('o')
4

Finding some sub string in a given range from the main string,


>>> myWord.find('o',5,8)
7

What if the sub string or character is not present in the string at all.


>>> myWord.find("hero")
-1

Finding the last occurrence of a sub string or character, we use the .rfind() function.


>>> myWord.rfind('l')
9
>>> myWord.find('l')
2

Trimming Whitespaces

>>> myWord+" "
'Hello World! '
>>> myWord.strip()
'Hello World!'

Repeating Strings

>>> myWord * 5
'Hello World!Hello World!Hello World!Hello World!Hello World!'

Toggle Case

>> myWord.swapcase()
'hELLO wORLD!'

That’s all for now. For more functions, you can check the Python official documentation here. I may keep on adding more content to this article in future. Please feel free to put your comments, suggestions and recommendations below.

by amitrajitbose at July 13, 2018 04:14 PM

Pooja Kumari Singh (poojaencoded)

On Markdown

Learnt about Markdown on 11th July.

John Gruber created markdown,the best way to compose content for the internet.

Those who are an internet writer will definitely love markdown because it is easy,fast and efficient for them.

However, Markdown is commonly supported on popular blogging platforms like WordPress,it is not supported naturally on websites with WordPress software installed.

There are many Markdown Editors available for Linux ,Mac and Windows.

And you can try this online Dingus to learn more.

by iampooja at July 13, 2018 01:17 PM

Mayank Singhal (storymode7)

Writing reST

Ever wondered how documentation, blogs, online books (not the PDFs) are written? Well, if it’s a really big one, RST (or reST) is the best shot.

 

The name reStructuredText was chosen to indicate that it is a “revised, reworked, and interpreted StructuredText”. reStructuredText is also abbreviated as RST, ReST and reST. (Wikipedia)

The official Python documentation uses RST. You can see the primer of the RST they use here

I followed the reStructuredText Primer by kushal and created a test.rst for me.

To convert RST to an HTML page, you’d need to install two packages namely: python3-docutils and python3-sphinx

and then you can use the command:

rst2html test.rst test.html

This will generate HTML page based on the RST you wrote in test.rst. Without test.html the output is just sent to the stdout.

If you don’t have rst2html command after installing the said two packages, you can try pressing the tab key to see if it is installed by some other name.

Let’s follow along with some snippets:

Headings

First the title of the doc.

======
Title
======

Here remember to keep the upper and lower lines equal, and you can skip the upper one.

Then you can write the texts and para like normal text for example:

This will come as a simple sentence.

And this as another para, due to space between them.

If you don’t leave any line between two sentences, then they are joined into one.

Commenting

To comment, we use .. like:

.. This is a comment

Space between .. and the comment is required. Most of the issues that I ran into were resolved by trying to put a space or a new line while trying out RST.

A comment can be multiline in which case it’s length is determined from the indentation.

..
  This is a multiline
  comment.

Section title can be given in a similar manner to the doc title.

Section Title
==============

According to sphinx documentation, the following convention is preferred as it is used in the python style guide.

# with overline, for parts
* with overline, for chapters
=, for sections
-, for subsections
^, for subsubsections
", for paragraphs

I didn’t know this so in my test.rst I tried playing to get it all correct 😛

Lists

Lists are the simplest part. Unordered list has a syntax:

* First Item
* Second
* And this is Third

“This text is not in the list due to the absence of ‘*’”

Ordered List can be generated manually or automatically like:

1. Some text
2. Other text
   more text with "other text"


1. This 
#. Is
#. An
#. Autonumbered list

a. This
#. Is 
#. Also
#. Autoindexed

Definition list

This is a set of text indented relative to each other. Point to note here is that, there should be a blank line just before and after the definition list.

Some term
    It's definition

Some other term:
    It's definition

Option list

The options list is used to write command line tools’ option and description. This is one of my favorites too!

-a      Option a
-b      This is b option
        with longer description
--some  This is another option

Remember to leave lines before and after starting a new body element. This was the thing I messed up most.

Literal blocks

If you are writing about RST in RST, then what? You need literal blocks for such cases. They are not interpreted and are printed as it is.

::

    This is a literal block
    for a in ['a', 'b', 'c', 'd']:
        print(a)
    print("some content")
    # A python comment

Doctest Block

These are interactive python sessions pasted in the text. When I first tried RST, I thought these were supposed to be evaluated in Python :P. But these are for explanation purposes, to show examples, and to provide a method to test the documentation’s content using doctest modules

>>> print("This is a python command")
This is a python command

The command and the output are both written by the writer.

Creating Tables

Creating a table is another easy task though it requires some typing effort.

===   ===   ===
 a     b     c
===   ===   ===
1     2     3
3     2     1
===   ===   ===

Another form of a table is:

+--------+--------+
|Another | form   |
+--------+--------+
|of      |creating|
+--------+--------+
|a       |table   |
+--------+--------+

Though this is more readable, it is slightly strenuous on your fingers. But I still like this one :P.

Note: This table might appear malformed on wordpress. You can try copying it to an editor locally.

Creating links

This is a normal hyperlink

`link text <https://www.duckduckgo.com>`_

This is an example of a targeted hyperlink:

`text which isn't linked currently`_ This is text apart from it

.. _text which isn't linked currently: https://www.duckduckgo.com

Notes

You can also give notes in the text.

.. note:: This is a note

But this isn't

Emphasis

You can put * around your text to put the emphasis. Generally, it italicises the content it surrounds.

To make the content bold you can use **

This text is *italicised* and this **bold**

Footnotes

To give more links for further reading and clarifications, you can give footnotes. They can also be autonumbered.

This is footnote one [#]_ and this two [#]_.

Some text between the footnote text and links.

.. [#] Hey I'm footnote one
.. [#] You can refer to the official docs for more!

Some text after footnote

Note that the text before and after footnote links isn’t compulsory. I just added it so that I know that it’s possible too.

This must be it.

Till the next time, don’t rest but go reST!

 

storymode7

by storymode7 at July 13, 2018 10:56 AM

Manank Patni

Day 13

Worked on the issue that I volunteered for in Coala. Have nearly completed it and will be submiting a PR soon.

by manankpatni at July 13, 2018 06:13 AM

July 12, 2018

Aman Verma (nightwarriorxxx)

Day 2 #Coding Streak!!!

“Start where you are. Use what you have. Do what you can.”
-Arthur Ashe

When friends lie

Straight forwardly coming to my day to day life, I would like to share something about my friends.I have got friend who say’s them self an Open Source enthusiast,which completely agree with them as they contribute to Open Source projects more than me.I always talk to them ,never hide anything from them , on what things I am working on but when I ask them “Hi buddy ,on what you are working on these days ?” and then every time I get a reply nothing much I am just wasting time these days,which I came to know they were lying to me as I checked out their GitHub profiles and accounts.

So now I am confused whether they are my friends or they are someone who is hiding everything and calling them an Open Source enthusiast and a Hacker(a hacker that hacks into projects #self made hacker) which I guess it’s against Open Source ethics i.e share and talk about what you are learning .

It would be great if you guys help me out with this .What should I do ignore them and never talk to them again or something else?

Coming to Programming

Day 2 is far more better than Day 1.As not only my health is better now,but I am now more focused,excited,curious and serious for learning more and more about various programming language .

As I talked about Python in my previous blog that I will be learning Python ,which I started and I am on it .Surfing over the internet I found some good resources which I would love to share .

1.python programming Tutorials

2.Python for You and Me

3.Python.org

The above are one of the best resources for learning python.Moreover you can go on YouTube, Udemy and Udacity for video tutorials.

Happy Hacking

by nightwarriorxxx at July 12, 2018 03:35 PM

Sehenaz Parvin

Are humor and punch lines the only way of writing?

When it comes to writing why can’t we just think it in our own perspective? Why do we always think that if we can’t add humour and thoughtful words ,our work is not going to be well accepted? Is there seriously no other way? Well if you ask me there is . Sometimes basic and common words can make your writing an extraordinary one. And if we talk of humor then its not always necessary in writing. Long sentences always doesn’t specify a good meaning. Short sentences can do that too.

There are many ways of writing a particular interest.But we have to make sure that it has some logic or it will become totally meaningless to understand😉.

Now, the question will arise that how can we believe that only logical and short sentenced works can also be another way of writing ? Well , here is your answer – Francis Bacon .So before we go into details, let’s get an idea about Francis Bacon and his writing skills .

Francis Bacon:( 22nd January, 1561- 9th April,1626).

Bacon has been called ” The father of Empiricism.” So let’s first know what is Empiricism. Empiricism is the theory that all knowledge is based on experience derives from the senses. Empiricism in the philosophy of science emphasises evidence , especially as discovered in experiments. That is , his writing skills are based on logic and scientific resoning not on any humour or pity feeling.

Bacon’s writings are written in short sentences and it would look very simple to understand but it’s not at all like that. Every sentence describes a paragraph and every word of that is connected is to the sentence. If we don’t read carefully we won’t get the actual meaning of it. That is the perfection of his writings.

So Bacon’s writing characteristics can be summed up as follows:

  1. He writes everything based on logic and scientific resoning.
  2. No usage of excessive and thoughtful words.
  3. Tone of the writing is like an advicer one. He speaks as if he is not requesting us in a soothing tone but recurssing us to follow that by opening a floor of options in different fields that suits that particular interest.
  4. Full of Latin evidences and quotations.
  5. Every sentence has their own importance including each and every word.
  6. After every sentence he describes the following sentences that why he thinks so regarding that interest.
  7. He always presents both sides of an interest. That is, the advantages as well as the disadvantages of that particular interest.

So now we have got an idea about Francis Bacon and his writing skills and characteristics. So now let’s get an example from one of his famous essay ” Of studies” . https://www.bartleby.com/3/1/50.html Do read the text once before going to the examples.

Examples with reference to the text:

So coming to examples from “Of studies”

Let’s start with first three sentences :

Studies serve for delight ,for ornament and for ability . Their chief use of delight, is in privateness and retiring ; for ornament is in discourse;and for ability, is in judgement and disposition of business. For expert men can execute, and perhaps judge of particulars ,one by one; but the general counsels , and the plots and marshalling of affairs , come best from those that are learned.

Here, in these lines he explains that studies serve for delight, for ornament and for ability. Study provides us delight when we enjoy it personally. It serves as ornament during conversation with people. In practical field , it enhances our ability to perform and execute.

From Bacon’s perspective men with worldly experience can carry out plans and understand certain circumstances but men who study are better able to understand important political matters and know how to deal with problem accordingly ( marshalling of affairs).

So you can see through three lines only he explained a paragraph with short and understandable sentences without “humour”. Isn’t it beautiful?

Coming to next example:

Crafty men contemn studies , simple men admire them , and wise men use them ; for they teach not their own use; but that is a wisdom without them , and above them, won by observation. Read not to contradict and confute; nor to believe and take for granted; nor to find talk and discourse; but to weigh and consider.

Here Bacon describes the different attitude and objectives of studies. According to him simple and ignorant people admire study. Crafty or cunning men study to cover up their inefficiency in any field. But wise men use them to properly. Because their wisdom is incomplete without studying.

Further he says that study should not be taken as granted for fulfilling needs or cover up inefficiency nor it supports any blind faith in anything. Everything should be judged properly then considered. Study should not serve as topics for useless discussion in every day life but to use it efficiently to solve and tackle problems in life.

Here you can see he has used so basic words to describe the attitude and objectives of studies and the result of it is such an excellence. Hence basic words are sources of excellence too.

Another one and the most important one.

Reading maketh a full man ; conference a ready man ; and writing an exact man

Here, he describes his perception about perfection in studies. He suggests that one needs to read, write and confer in order to achieve perfection. Reading makes a man learned , conference makes him ready to use the learning . But the ultimate perfection can be achieved through writing. So if a man is very good at writing skills he must have a very vast knowledge about everything while a man good at confering with people will have a good presence of wit and the reader who read very little will not have a vast knowledge which is again a drawback.

There are much more important lines in the text but I think this is enough to make us understand that cheesy pick up lines and adding humour is not only the way to write anything. There can be other styles too.

Hope I could answer the questions through Bacon’s writing . Remember whatever you think and write , it must have some logic behind it otherwise it won’t attract readers and moreover your blog may also seem blurry. And moreover everything cannot be mastered at the very first attempt. It needs a lot of practice. So, “THINK BIG, START SMALL”.

by potters6 at July 12, 2018 12:56 PM

Manank Patni

Writing Documentation for Code

So, Yesterday (11 July 2018) we had a session on the topic RST(reStructuredText) on the #dgplug channel. A small tutorial for the basics of writing in RST was shared with us from where we all learned what RST is, it’s syntax and how the documentation for projects is written.

So, I decided to learn more about writing documentation and after searching the about the same on web I came to know about the various reasons as to why documentation is written.

It is written so that the people who are new to our software/code can easily understand how they can use it and they don’t get lost or confused. The documentation should be able to explain the project to the users/ contributors.

So what is RST?

The reStructuredText (RST) syntax provides an what-you-see-is-what-you-get plaintext markup syntax and parser system. So basically we type our code in plain text using a pre-defined syntax and then it is converted to HTML format for publishing. A basic tutorial of the same can be found here.

The RST was created by Python community and hence is a part of Docutils.

Alternative for RST :-

Markdown is another option which we can use in place of RST. Markdown is easier to use. It is written in Perl language. You can learn more about it on this link.

The main difference between Markdown and reStructuredText is that the former is intended for one purpose to be used as a format for writing for the web whereas the latter is used for writing technical documentation.

So, you can choose whatever you like and are comfortable with to write documentation. It all depends on what features you would want.

by manankpatni at July 12, 2018 08:37 AM

Kumar Vipin Yadav (kvy)

Some Simple Program on Functions

Let’s discuss some very simple example on Functions
By solving these problem you can able to solve simple problem based on functions
later we will discuss about functions with Array, Strings and with Pointers.

Factorial function :-

Finding Factorial of a number using function.

#include<stdio.h>
int main()
{
   int factorial( int );
   int n , facto; 
     // we can't access these variables in function but we can 
     //create variable there with same name
   printf("Enter a number : ");
   scanf("%d",&n);

   facto = factorial(n);

   printf("Factorial is %d. \n",facto);
   return 0;
 }

int factorial( int a )
 {
    int i,fact;
    for ( i = 1 , fact = 1 ; i <= a ; i ++ )
    fact = fact * i ;
    return fact;
 }

Output :-

  Enter a number : 5
  Factorial is 120.

Now we can find factorial of any number just by calling factorial function.

A Uppercase converter function:-

This function will accept a lower case latter and converter it into Uppercase latter.

#include<stdio.h>
int main()
{
   char alpha_converter( char );
   char n; 
 
   printf("Enter a alphabet : ");
   scanf("%c",&n);

   n = alpha_converter(n);

   printf("Latter is converted it's %c now . \n",n);
   return 0;
}

char alpha_converter( char x )
{
   // ASCII value of lower case latter
   if ( x >= 97 && x <= 122)
   // Converting latter if it is lower case
   return x-32;
   else
   // returning latter if it's already upper case
   // we can return only 1 variable from a function
   return x;
 }

Output :-

  Enter a alphabet : d
  Latter is converted it's D now .

Prime function:-

This function will return 1 give number is Prime else return 0.

#include<stdio.h>
int main()
{
   int Prime( int );
   int n ;
   printf("Enter a number you want to check : ");
   scanf("%d",&n);

     //here i call my function and if it return 1 means 
    //true and if will execute

   if (Prime(n))
     printf("Yes entered number is Prime");
   else
     printf("No entered number is Not Prime");
 
   return 0;
}

int Prime( int a )
 {
    int i ;
      // here i write (int)a/2 because a number can't 
     //divided number greater then it's half
 for ( i = 2 ; i <= (int)a/2 ; i++ )
  {
    if ( a%i == 0)
       // if condition is true it mean It's Not Prime so return 0
     return 0;
 }
    // and if loop will over and can't return 0 
    //means it's a prime number hence return 1
 return 1;
}

Output:-

  Enter a number you want to check : 98
  No entered number is Not Prime

by kumar vipin yadav at July 12, 2018 08:09 AM

July 11, 2018

Aman Verma (nightwarriorxxx)

Day 1 #Coding Streak

“Everyone you will ever meet knows something you don’t.”
–Bill Nye

Day 1 was not so good,because of my health which is not so good these days, so I tired to many unusual things likely surfing over the net,scrolling down the news feed of Facebook and other stuffs so that I can deviate my mind from my health issues and focus on learning ReStructuredText which was referred by one of my #dgplug mentors i.e Kushal Das.

For all those folks who don’t know what is ReStructuredText ,let me tell you it is same as what you see is what you get plain-text markup syntax.Basically, it is used for writing program documentation mostly for Python docs .Next thing I am going to start learning is Python as it is one of the most useful language in development and because its easy to learn .

“Happy Hacking”

by nightwarriorxxx at July 11, 2018 09:53 PM

Anu Kumari Gupta (ann)

Bash fun :P

If you are new to GNU/Linux, the pro like commands would have made you feel no less than a hacker initially (Note: Hacker doesn’t mean the one who breaks into your system, steals your data, passwords and do mischievous activities. The one who does this is called Cracker. Hacker is one who do all the innovation with their intelligence and it is something not restricted to computers and tech, it may be beyond that). All the commands you type in the terminal makes you a different person all-together than the one who uses operating system like Windows, which stresses on GUI than CLI. At times, may be, you must have felt “this” particular stuff would have been easier or better in some respects being in Windows than in Linux. Want to add something? was it uncomfortable or seemed difficult at first? or, contrary to this, may be you had the impression that you are doing an ingenious task running all those “unfriendly” commands and getting some unfathomable outputs, making you feel like a true programmer and making you happy deep inside. Nevertheless, it’s all different opinions. Whether or not, you like GNU/OS (or what people say as Linux), I have a fun thing to share with you! Excited?

For people who already been using GNU/Linux (Linux to be in particular), I don’t have to tell them anything because they already know what bash is and would have come here to see what bash fun I will be talking about (lol :P).

OK, now let’s begin the real fun!

Screenshot from 2018-07-11 22-26-59.png

Can you see my terminal? Is it same as your’s? Of-course no. It has my beautiful name written on it. Want to have your name written like this or something dynamic that changes each time? Hang on! I got to tell you how.

For having your name appear like this each time you open up a terminal, you have several options. First option is without installing anything new. Before I move on with the first step, I would like to tell you something, rather warn you something and, that is, the output of this program written in Python:

 for i in range (1000):
       print("Don't play with Bash !!")

It is essential that you note, you shouldn’t play with it and make each change very carefully and with a backup copy so that you do not end up doing some trouble to your login shell. Any mis-activity may lead to anomalous behavior.

Let’s begin with the actual stuff:

First step: Use an online Text to ASCII art generator. Write anything you wish using any of the characters from your keyboard. For example like one below:

Screenshot from 2018-07-11 23-14-36  Here, you can try out with the different types of font, character width, character height available to you. After you have done with it, you need to copy the generated output and paste it to the end of your .bashrc file. (You have to append and not overwrite). I will highly recommend you to open .bashrc file using the editor in which you are comfortable in. To avoid trouble that can happen in any case, you can use gedit or pluma for ease in copy and pasting. Use gedit ~/.bashrc or, pluma ~/.bashrc . Put echo statement at each line and put it under inverted commas so that it is treated as a string to be printed. To avoid confusion, let me clear you with this picture:

Screenshot from 2018-07-11 23-23-30

Notice there is already a piece of code written. You just need to append the lines at the end. Save your .bashrc file and close it. Open up a new terminal and you will see the changes as below:

screenshot-from-2018-07-12-00-01-141.png

Isn’t it cool? Now whenever you will open the terminal, you will see the lines in this format which you chose.

Alternatively, you can also use figlet. To use figlet, you have to install figlet (depending on your distribution) by: sudo apt install figlet or, sudo dnf install figlet. After it is installed, you have to open the bashrc file, i.e., gedit ~/.bashrc  or, pluma ~/.bashrc . At the end of the bashrc file, write figlet "Your text". Your text includes whatever text you wish to print. When you open a new terminal, you will find your text written at the top, quite similar to the art I showed above. You can explore more of figlet by reading its manual. For reading the manual, type man figlet.

This was all about text. Do you wish to see some characters printed in your terminal each time and would it sound more cool if I say you that each time you open the terminal, you will see some fun facts or quotes written? And guess what with each time you open the terminal, you see some different texts written. Do you want that? Well, if the above was interesting to you, you will find the below as interesting too.

For that, you need to install cowsay. To know more of cowsay, you are free to read on wiki and manual. Install cowsay by either sudo dnf install cowsay or, sudo apt install cowsay,  depending on your distribution. Open the bashrc file, i.e., gedit ~/.bashrc  or, pluma ~/.bashrc. At the end of bashrc file, type cowsay -f eyes "Some text"

I have appended cowsay -f eyes "I am watching what you do". And here is the output:

screenshot-from-2018-07-12-00-27-14.png

Now you have several options to try out. To list the names of all possible characters, type cowsay  -l. To see all the characters designed with symbols, write this small script on the terminal:

for i in $(cowsay -l); do cowsay -f $i "$i"; done

You may choose whichever you like and then append it to the bashrc file. Do tell me your favorite one in the comments. Mine is calvin and tux.

Screenshot from 2018-07-12 00-45-05

Quite Interesting and fun? right? Oh wait, you must be wondering about the fun facts and quotes which I told you that changes each time you open a new terminal. Here is what you need to do:

fortune | cowsay -f  tux

In place of tux, you can put your favorite character and you are done. You will see some fun facts or quotes written. See what I got when I opened four different terminals:

Screenshot from 2018-07-12 00-59-32.png

Full of humour and pun. Imagine you being in office unwilling to do work and happened to open up a terminal and you get to see this, might make you smile.

 Try this out and explore the bash fun!

by anuGupta at July 11, 2018 07:48 PM

Manank Patni

Shiva Saxena (shiva)

Intro to reStructuredText

Hello readers! Yesterday, in dgplug summer training, we had a session in which we were introduced to reStructuredText. I had been aware of and used Markdown before but it was my first time that I put my hands on reStruncturedText and seen how it works. Let’s go through a quick intro to this simple yet efficient tool.

What is reStructuredText?

It is simply a plaintext easy-to-read markup language, also abbreviated as reST.

It is part of the Docutils project and was developed by David Goodger and initially released on April 2, 2002 (source Wikipedia).

reST files have the extension .rst.

Why reStructuredText?

Ever want to get rid of those HTML tags while creating a simple webpage? Ever want to see an alternative of your Readme file format other than Markdown? Ever want to try out an efficient tool using which you may document programs especially of Python? Or say you want to create any standalone document like the changelog for your FOSS project. Then reStructuredText is the tool that fits in your purpose.

I read from Wikipedia that reStructuredText has been a core component of Python’s Sphinx document generation system since 2008.

And if you’ll look at the official documentation of reStructuredText you’ll find this module –> statemachine.py, It is completely documented using reST. Isn’t it awesome?

A quick hands-on with step by step examples

In the session, we were introduced with reST with this Primer, a big thanks to our mentor Kushal.

The first step is to install these tools

  • python3-docutils
  • python3-sphinx

Now create any file (say doc.rst) and let’s try out the following examples.

Document Title

Open the file and create a title with:

=======
A Title
=======

Save and exit

Display your reST file as HTML

On your shell give command   –>   $ rst2html doc.rst doc.html
This will convert your reST to HTML.

and open doc.html to see your reST in a form of a webpage.

Every time you’ll make changes to your doc.rst you’ll have to first convert that to HTML to see the webpage with updated changes.

Section Title

This is a section title
=======================

Sub-section

This is a sub section
---------------------

Note: You may use any of these character for section title and sub-section   = – ` : . ‘ ” ~ ^ _ * + #   but, the character you’ll use for the first “section title” it will get fixed to it. Means, if you use that character again, then it can only be used for a section title. Similarly the character you’ll use for the first “sub-section” it will get fixed to it as well. Don’t interchange the usage of these characters. If you have chosen a character for section-title let it be constant for all the section-titles otherwise you are likely to get an error while converting this .rst to .html.

Basic Inline markup

This is how to *emphasize* a word.
This is how to **strong emphsize** a word.
And this is a standalone hyperlink  https://google.com

Paragraphs and Indentation

This is paragraph number 1.

     This is paragraph number 2. With indentation.

Note: Multiple separate lines are counted as a single separate line.

Lists

Unordered/bullet list

- object 1
- object 2

Ordered/enumerated list

1. object 1
2. object 2

Definition list

Term 1: optional_classifier
       This is definition 1.

Option list

-a          purpose of attribute 'a'
-out        purpose of attrubute 'out'

Field list

:Student: Name of student
:Enroll: Student's enrollment number

Blocks

Literal block

::
       This is a literal block.
             Where no foramtting takes place.
       Useful for code samples.
       It will continue until indentation is close

This is outside literal block.

Line block

| this is a
| line block
| useful for
| writing addresses

Quote block

These are simply:

       indented paragraphs

Doctest block

Doctest blocks are interactive Python sessions.
They begin with: >>>like >>> print "This is a doctest block." This is a doctest block.

Comments

.. This is a comment.
    Will continue till
    indentation is completely over or

   if an empty line is introduced. This is outside of the comment

This is outside of the comment

Links

Titled link

This is `title <link>`_

Targetted link

`The Geeky Way`_ is a technical blog.

.. _The Geeky Way: http://TheGeekyWay.com

Footnotes

Refer this blog [#]_ and also this one [#]_.

.. [#] Blog on Markdown
.. [#] Blog on AsciiDoc

Have a look at reST cheatsheet http://docutils.sourceforge.net/docs/user/rst/cheatsheet.txt

reStructuredText vs Markdown

I have a prior experience with Markdown. I have always been using Markdown as a format for Readme, changelogs and some time on github issues. But if both Markdown and reST can be used for documentation and creating simple web pages, then who really wins the battle?

This is a hot topic like that of “which text editor is the best?” 🙂

People all over the web discuss, debate and give their opinions about it. Have a look, here is a discussion available on the same. https://news.ycombinator.com/item?id=11922485. And here on Reddit. https://www.reddit.com/r/Python/comments/3zp9g5/markdown_vs_rest/

But I think the gist of this battle lies as follows:

  • reST is better for technical documentation such as documenting program libraries, changelogs, API documentation, etc.
  • Markdown, on the other hand, is useful for creating simple web-pages, and all non-technical documentation.
  • Markdown seems more popular than reST.

But I would like to use both of them as per their use cases.

Conclusion

References:
http://docutils.sourceforge.net/rst.html
https://dgplug.org/irclogs/2012/rst-primer
http://docutils.sourceforge.net/docs/user/rst/quickref.html
https://en.wikipedia.org/wiki/ReStructuredText

I believe reST is a powerful tool that is easy to learn and that you may use for technical documentation purposes. I want to learn and apply more of it. Now let me know what you think about reST in the comments section below 🙂

Thank you!

by Shiva Saxena at July 11, 2018 11:16 AM

Sehenaz Parvin

Day 25 ( summer training)

Finally, its going to be a month in summer training of Linux.😊 A new environment . A new learning process. A new beginning .

Well , it was not at all possible or it would never be a new beginning if I wouldn’t have come out from the four walls of the captive environment. As said by Mark Caine

“The first step towards success is taken when you refuse to be a captive of the environment in which you first find yourself. “

Learning Linux was very confusing at first because of using windows for such a long period. But slowly after joining the summer training and with the proper guidance of the mentors I am able to synchronise that too.

Now as it is going to be one month in summer training I have almost learnt the Linux commands thoroughly and I can now move about freely on Linux. The commands are much more easier , user friendly . Doing these things myself have increased my self confidence and self reliability. And moreover Linux system is like a magnetic field – the more you learn the more you get attracted to it.

So thank you to all the mentors of summer training for your patience and support 😊.

by potters6 at July 11, 2018 03:06 AM

July 10, 2018

Aman Verma (nightwarriorxxx)

Coding Streak!!!!!

This world is full of technology. Everything is so fast that if you stop and look back you will never get a chance to succeed. Everyone wanted to go with the trend and so I.

Watching this on growing growth of technology day by day, something struck my  mind last night and I decided to write blog every day, which I named as “Coding Streak“. This will not only keep me on track but will also help me to focus on my goals.

Coming to “Coding Streak” as I am an Open Source enthusiast and fond of learning about Operating Systems and Web Technology ,I will be posting about them daily .

 

Happy Hacking

Do visit my Facebook Page Technoflux

by nightwarriorxxx at July 10, 2018 06:52 PM

Manank Patni

Day 11

Learned about RST or reStructured Text to write documentation in today’s session of dgplug summer training.

References: –

  1. https://dgplug.org/irclogs/2012/rst-primer/

by manankpatni at July 10, 2018 06:29 PM