Planet dgplug

July 02, 2015

Arpita Roy

Days on #dgplug

Hello again :)

Yes , i took a break again ( for a week this time )
Now that it is all about the summer training and three more days were very well spent on #dgplug channel

DAY 3 – 24th June 2015

As in our last session we were given links about  FHS – File Hierarchy Standards.
So , today was all about the queries we had with the links provided with Kushal da answering each one  of us :)
Came to know about many things , i had sparse or i can NO knowledge of !!

DAY 4 – 30th June 2015

Admist of these days , we were sent links to study about our next topic , that was about VI/VIM editor.
Vi or Vim – is simply a text editor that allows us to edit some  file.
Here are few links to that were given to us to know about vim —

All Vi asks for is practice as there are plenty of commands to keep tracks of.
Today , was all about the questions we had about VIM.
The widely asked question being – ” Why do we use VIM over other editors ? ”
A nice question indeed with lots of interesting answers as well :)
At last . we were served –  to read for our next class,

4th July 2015 – Late Evening

After i went through the link , had an anxiety to create the same :P
Well , it didn’t took a long but i made an html file exactly same as the above link :) with “test.rst” as my vi file and “test.html” as my presentation slide.
Had Questions about  – Literal Blocks , Ordered lists , Sections and many more. Few of which were cleared my google and  few by IRC members and the left ones , by Kushal Da :)

*Note – rst2s5 made the rst html  file that way , rst2html didn’t  ( wondering what i wrote ? Won’t be a lot of trouble to google about “s5″ )

DAY 5  – 2nd July 2015

Finally , the little doubts were swept off.
I don’t know what i am supposed to do for my next class :P Well , there is a lot to kearn :)
and yes , we were asked to give our feedback on the sessions being held ( Words won’t be enough to say how beneficial they are to anyone who wants to ” LEARN ”
Downloaded “asciinem” as told ( yet to google about it ) and mysql too !

P.S  – I wish i could stay on IRC the whole day.. and yes , i am Learning :)

by Arpita Roy at July 02, 2015 05:53 PM

June 25, 2015

Samikshan Bairagya

Travelling to FUDCon, Pune 2015

Right now I’m at Kempegowda International Airport, Bengaluru looking forward to spending an exciting weekend at FUDCon, Pune. It seems my flight is delayed by almost an hour and this is a good time to have a look at the schedule more closely. Why am I looking forward to an ‘exciting’ weekend at Pune? Well, just have a look at the schedule and you’ll understand why. The schedule is packed with a wide range of talks and workshops on really interesting topics.

For a conference having such an interesting schedule its important to prepare a schedule of your own to try and take back as much as possible. This is a screenshot of my schedule for the next 3days. Oh! And I haven’t mentioned that I’m looking forward to FUDPub too that is scheduled on Saturday evening IIRC. ;)

My FUDCon Pune schedule

I myself would be talking on kernel ABI breakages along with an introduction to how its stability is tracked through genksyms currently and how an alternative could be possible through spartakus. That would be tomorrow after at 12:30 pm. I really hope my talk can live up to the standards that will be set by other speakers.

I guess its time to check-in for my flight now. Also the free WiFi is almost timed out. So see you at FUDCon, Pune 2015.

by Samikshan Bairagya at June 25, 2015 03:14 PM

June 22, 2015

Shakthi Kannan

Introduction to Haskell - More Functions

[Published in Open Source For You (OSFY) magazine, September 2014 edition.]

In the third article in the series, we will focus on more Haskell functions, conditional constructs and their usage.

A function in Haskell has the function name followed by arguments. An infix operator function has operands on either side of it. A simple infix add operation is shown below:

*Main> 3 + 5

If you wish to convert an infix function to a prefix function, it must be enclosed within parenthesis:

*Main> (+) 3 5

Similarily, if you wish to convert a prefix function into an infix function, you must enclose the function name within backquotes(`). The elem function takes an element and a list, and returns true if the element is a member of the list:

*Main> 3 `elem` [1, 2, 3]
*Main> 4 `elem` [1, 2, 3]

Functions can also be partially applied in Haskell. A function that subtracts ten from a given number can be defined as:

diffTen :: Integer -> Integer
diffTen = (10 -)

Loading the file in GHCi and passing three as an argument yields:

*Main> diffTen 3

Haskell exhibits polymorphism. A type variable in a function is said to be polymorphic if it can take any type. Consider the last function that returns the last element in an array. Its type signature is:

*Main> :t last
last :: [a] -> a

The ‘a’ in the above snippet refers to a type variable and can represent any type. Thus, the last function can operate on a list of integers or characters (string):

*Main> last [1, 2, 3, 4, 5]
*Main> last "Hello, World"

You can use a where clause for local definitions inside a function, as shown in the following example, to compute the area of a circle:

areaOfCircle :: Float -> Float
areaOfCircle radius = pi * radius * radius
  where pi = 3.1415

Loading it in GHCi and computing the area for radius 1 gives:

*Main> areaOfCircle 1

You can also use the let expression with the in statement to compute the area of a circle:

areaOfCircle :: Float -> Float
areaOfCircle radius = let pi = 3.1415 in pi * radius * radius

Executing the above with input radius 1 gives:

*Main> areaOfCircle 1

Indentation is very important in Haskell as it helps in code readability - the compiler will emit errors otherwise. You must make use of white spaces instead of tab when aligning code. If the let and in constructs in a function span multiple lines, they must be aligned vertically as shown below:

compute :: Integer -> Integer -> Integer
compute x y =
    let a = x + 1
        b = y + 2
      a * b

Loading the example with GHCi, you get the following output:

*Main> compute 1 2

Similarily, the if and else constructs must be neatly aligned. The else statement is mandatory in Haskell. For example:

sign :: Integer -> String
sign x =
    if x > 0 
    then "Positive"
        if x < 0
        then "Negative"
        else "Zero"

Running the example with GHCi, you get:

*Main> sign 0
*Main> sign 1
*Main> sign (-1)

The case construct can be used for pattern matching against possible expression values. It needs to be combined with the of keyword. The different values need to be aligned and the resulting action must be specified after the ’->’ symbol for every case. For example:

sign :: Integer -> String
sign x =
    case compare x 0 of
      LT -> "Negative"
      GT -> "Positive"
      EQ -> "Zero"

The compare function compares two arguments and returns LT if the first argument is lesser than the second, GT if the first argument is greater than the second, and EQ if both are equal. Executing the above example, you get:

*Main> sign 2
*Main> sign 0
*Main> sign (-2)

The sign function can also be expressed using guards (‘|’) for readability. The action for a matching case must be specified after the ‘=’ sign. You can use a default guard with the otherwise keyword:

sign :: Integer -> String
sign x
    | x > 0 = "Positive"
    | x < 0 = "Negative"
    | otherwise = "Zero"

The guards have to be neatly aligned:

*Main> sign 0
*Main> sign 3
*Main> sign (-3)

There are three very important higher order functions in Haskell — map, filter, and fold.

The map function takes a function and a list, and applies the function to each and every element of the list. Its type signature is:

*Main> :t map
map :: (a -> b) -> [a] -> [b]

The first function argument accepts an element of type ‘a’ and returns an element of type ‘b’. An example on adding two to every element in a list can be implemented using map:

*Main> map (+ 2) [1, 2, 3, 4, 5]

The filter function accepts a predicate function for evaluation, and a list, and returns the list with those elements that satisfy the predicate. For example:

*Main> filter (> 0) [-2, -1, 0, 1, 2]

Its type signature is:

filter :: (a -> Bool) -> [a] -> [a]

The predicate function for filter takes as its first argument an element of type ‘a’ and returns True or False.

The fold function performs cumulative operation on a list. It takes as arguments a function, an accumulator (starting with an initial value) and a list. It cumulatively aggregates the computation of the function on the accumulator value as well as each member of the list. There are two types of folds — left and right fold.

*Main> foldl (+) 0 [1, 2, 3, 4, 5]
*Main> foldr (+) 0 [1, 2, 3, 4, 5]

Their type signatures are, respectively:

*Main> :t foldl
foldl :: (a -> b -> a) -> a -> [b] -> a
*Main> :t foldr
foldr :: (a -> b -> b) -> b -> [a] -> b

The way the fold is evaluated among the two types is different and is demonstrated below:

*Main> foldl (+) 0 [1, 2, 3]
*Main> foldl (+) 1 [2, 3]
*Main> foldl (+) 3 [3]

It can be represented as ‘f (f (f a b1) b2) b3’ where ‘f’ is the function, ‘a’ is the accumulator value, and ‘b1’, ‘b2’ and ‘b3’ are the elements of the list. The parenthesis is accumulated on the left for a left fold. The computation looks like:

*Main> (+) ((+) ((+) 0 1) 2) 3
*Main> (+) 0 1
*Main> (+) ((+) 0 1) 2
*Main> (+) ((+) ((+) 0 1) 2) 3

With the recursion, the expression is constructed and evaluated only when the expression is finally formed. It can thus cause stack overflow or never complete when working with infinite lists. The foldr evaluation looks like this:

*Main> foldr (+) 0 [1, 2, 3]
*Main> foldr (+) 0 [1, 2] + 3
*Main> foldr (+) 0 [1] + 2 + 3

It can be represented as ‘f b1 (f b2 (f b3 a))’ where ‘f’ is the function, ‘a’ is the accumulator value, and ‘b1’, ‘b2’ and ‘b3’ are the elements of the list. The computation looks like:

*Main> (+) 1 ((+) 2 ((+) 3 0)) 
*Main> (+) 3 0
*Main> (+) 2 ((+) 3 0)
*Main> (+) 1 ((+) 2 ((+) 3 0))

There are some statements like condition checking where ‘f b1’ can be computed even without requiring the subsequent arguments, and hence the foldr function can work with infinite lists. There is also a strict version of foldl (foldl’) that forces the computation before proceeding with the recursion.

If you want a reference to a matched pattern, you can use the as pattern syntax. The tail function accepts an input list and returns everything except the head of the list. You can write a tailString function that accepts a string as input and returns the string with the first character removed:

tailString :: String -> String
tailString "" = ""
tailString input@(x:xs) = "Tail of " ++ input ++ " is " ++ xs

The entire matched pattern is represented by input in the above code snippet.

Functions can be chained to create other functions. This is called as ‘composing’ functions. The mathematical definition is as under:

(f o g)(x) = f(g(x))

This dot (.) operator has the highest precedence and is left-associative. If you want to force an evaluation, you can use the function application operator ($) that has the second highest precedence and is right-associative. For example:

*Main>  (reverse ((++) "yrruC " (unwords ["skoorB", "lleksaH"])))
"Haskell Brooks Curry"

You can rewrite the above using the function application operator that is right-associative:

Prelude> reverse $ (++) "yrruC " $ unwords ["skoorB", "lleksaH"]
"Haskell Brooks Curry"

You can also use the dot notation to make it even more readable, but the final argument needs to be evaluated first; hence, you need to use the function application operator for it:

*Main> reverse . (++) "yrruC " . unwords $ ["skoorB", "lleksaH"]
"Haskell Brooks Curry"

June 22, 2015 09:30 PM

Arpita Roy

A New Evening !!

DAY- 2
The title shows it , i am here to discuss about the second day of my summer training.
Today , i personally felt i came to know about a lot of things ( i had no clue of ) and these questions never popped up into my tiny head :P
The process was quiet fast and it was taking me a little time to understand a few questions and their answers too ( all thanks to :) )
After the Q/A session ended , we were provided with a few links that we have to go through for the next class that is to happen on 24th june 2015 at 18:30 P.M IST
It was now when i have finished reading the links except about fhs ( it’s quiet big :P needs time )
Here are yesterday’s links : – IRC logs for FHS – The book for FHS

The links are not only great to read over and over again but are helpful and beneficial too , for one who really is interested in gathering knowledge :)
It has been a really long time since i have read them. The brain feels good after recalling them again :)

P.S – Looking forward for more and more things to grasp.

by Arpita Roy at June 22, 2015 03:31 PM

June 19, 2015


My Final Year Project aka Online FIR/GD lodging system.

Hello all, this post will be a small one. I will be discussing about my College Final Year project in here. The topic for my project was Online FIR/GD Lodging System. Since I have worked with Flask before, I chose Django 1.8 to try something new. Learning the basics of Django wasn’t much difficult. Now my college stuff is over but i have decided to add on a few more features.

about THE Application

Its a simple web-app with a Form to fill up the details necessary for lodging an FIR/GD. The main problem with this kind of application is the identity of the user.So to properly identify i decided to use approved ID Proofs by the Government for different organizations i.e Voter ID Number, Aadhaar ID Number, Ration Card Number, PAN Card Number. Obviously this a prototype so I had the freedom to use dummy data for users Aadhaar, Voter and PAN card in database tables. For Practical implementation it surely needs access to the above mentioned databases from the government. So a user can choose any two ID proof out of the 4 and fill in the details. The two ID card data must have same name and birth date for the user to be identified. Next the Report(FIR/GD) form is to be filled by the person. Also currently he needs to explicitly select the Police Station he wants to lodge the report to. According to the city and state the police stations gets shortlisted. Next the form is submitted. I did not use User Auth in this application. We already have the user identity but we need ways to contact the user, hence phone number and email needs to be filled in the Form. Next comes the verification of mobile number. I really didn’t want to spend much on this so decided to use Site2SMS API which allows you to send limited Free SMS. So sending OTP via Site2SMS API. Since the OTP are short-lived (5 minutes) i decided not to use database to avoid overhead due to frequent writes and decided to use Redis instead. The TTL feature made my work of expiring OTPs easy. Finally sending a pdf document report via email. I used xhtml2pdf to generate the pdf’s and again saving money by using Gmail for sending out emails. ;) That pretty much sums up the application. You can check out the SourceCode.

Future Plans

– Right now all I have done is for the user who wants to lodge an FIR/GD. The police portal exists but the Reports are not updated instantly. I am planning to use Django Signals to work with django-socketio to update the new Reports instantly just after they are inserted into database.

– Chalk out a way to automatically register the FIR/GD to the correct police station depending on the location of event

– This can be most handy when used as a mobile application. So either create an API and mobile application or make the design responsive to suit any device.

– And finally to write Unit tests. ( This is my new year resolution) :P

P.S.- Suggest some cool name for this app.
P.P.S.- You are most welcome to request a feature or add a feature and send a PR on Github.

This year Fudcon is from 26th. Will be attending it and maybe meeting some of you. Next post will be on FUDCON 2015. Till then Happy Coding. :)

by subho at June 19, 2015 08:04 PM

June 01, 2015

Arun Sag

Note to self: Resizing byobu to terminal size (tmux)

Often byobu reattaches to old session where the tmux windows are smaller than the terminal size


To fit the tmux window to terminal size run

Ctrl+a :attach -d


by sagarun at June 01, 2015 05:58 PM

May 25, 2015

Shakthi Kannan

Haskell Functions

[Published in Open Source For You (OSFY) magazine, August 2014 edition.]

This second article in the series on Haskell explores a few functions.

Consider the function sumInt to compute the sum of two integers. It is defined as:

sumInt :: Int -> Int -> Int
sumInt x y = x + y

The first line is the type signature where the function name, arguments and return types are separated using a double colon (::). The arguments and the return types are separated by the symbol (->). Thus, the above type signature tells us that the sum function takes two arguments of type Int and returns an Int. Note that the function names must always begin with the letters of the alphabet in lower case. The names are usually written in CamelCase style.

You can create a Sum.hs Haskell source file using your favourite text editor, and load the file on to the Glasgow Haskell Compiler interpreter (GHCi) using the following code:

$ ghci
GHCi, version 7.6.3:  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.

Prelude> :l Sum.hs
[1 of 1] Compiling Main             ( Sum.hs, interpreted )
Ok, modules loaded: Main.

*Main> :t sumInt
sumInt :: Int -> Int -> Int

*Main> sumInt 2 3

If we check the type of sumInt with arguments, we get:

*Main> :t sumInt 2 3
sumInt 2 3 :: Int

*Main> :t sumInt 2
sumInt 2 :: Int -> Int

The value of sumInt 2 3 is an Int as defined in the type signature. We can also partially apply the function sumInt with one argument and its return type will be Int -> Int. In other words, sumInt 2 takes an integer and will return an integer with 2 added to it.

Every function in Haskell takes only one argument. So, we can think of the sumInt function as one that takes an argument and returns a function that takes another argument and computes their sum. This return function can be defined as a sumTwoInt function that adds a 2 to an Int using the sumInt function, as shown below:

sumTwoInt :: Int -> Int
sumTwoInt x = sumInt 2 x

The ‘=’ sign in Haskell signifies a definition and not a variable assignment as seen in imperative programming languages. We can thus omit the ‘x’ on either side and the code becomes even more concise:

sumTwoInt :: Int -> Int
sumTwoInt = sumInt 2

By loading Sum.hs again in the GHCi prompt, we get the following:

*Main> :l Sum.hs
[1 of 1] Compiling Main             ( Sum.hs, interpreted )
Ok, modules loaded: Main.

*Main> :t sumTwoInt
sumTwoInt :: Int -> Int

*Main> sumTwoInt 3

Let us look at some examples of functions that operate on lists. Consider list ‘a’ which is defined as [1, 2, 3, 4, 5] (a list of integers) in the Sum.hs file (re-load the file in GHCi before trying the list functions).

a :: [Int]
a = [1, 2, 3, 4, 5]

The head function returns the first element of a list:

*Main> head a

*Main> :t head
head :: [a] -> a

The tail function returns everything except the first element from a list:

*Main> tail a

*Main> :t tail
tail :: [a] -> [a]

The last function returns the last element of a list:

*Main> last a

*Main> :t last
last :: [a] -> a

The init function returns everything except the last element of a list:

*Main> init a

*Main> :t init
init :: [a] -> [a]

The length function returns the length of a list:

*Main> length a

*Main> :t length
length :: [a] -> Int

The take function picks the first ‘n’ elements from a list:

*Main> take 3 a

*Main> :t take
take :: Int -> [a] -> [a]

The drop function drops ‘n’ elements from the beginning of a list, and returns the rest:

*Main> drop 3 a

*Main> :t drop
drop :: Int -> [a] -> [a]

The zip function takes two lists and creates a new list of tuples with the respective pairs from each list. For example:

*Main> let b = ["one", "two", "three", "four", "five"]

*Main> zip a b

*Main> :t zip
zip :: [a] -> [b] -> [(a, b)]

The let expression defines the value of ‘b’ in the GHCi prompt. You can also define it in a way that’s similar to the definition of the list ‘a’ in the source file.

The lines function takes input text and splits it at newlines:

*Main> let sentence = "First\nSecond\nThird\nFourth\nFifth"

*Main> lines sentence

*Main> :t lines
lines :: String -> [String]

The words function takes input text and splits it on white space:

*Main> words "hello world"

*Main> :t words
words :: String -> [String]

The map function takes a function and a list and applies the function to every element in the list:

*Main> map sumTwoInt a

*Main> :t map
map :: (a -> b) -> [a] -> [b]

The first argument to map is a function which is enclosed within parenthesis in the type signature (a -> b). This function takes an input of type ‘a’ and returns an element of type ‘b’. Thus, when operating over a list [a], it returns a list of type [b].

Recursion provides a means of looping in functional programming languages. The factorial of a number, for example, can be computed in Haskell, using the following code:

factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n-1)

The definition of factorial with different input use cases is called as pattern matching on the function. On running the above example with GHCi, you get:

*Main> factorial 0
*Main> factorial 1
*Main> factorial 2
*Main> factorial 3
*Main> factorial 4
*Main> factorial 5

Functions operating on lists can also be called recursively. To compute the sum of a list of integers, you can write the sumList function as:

sumList :: [Int] -> Int
sumList [] = 0
sumList (x:xs) = x + sumList xs

The notation *(x:xs) represents a list, where ‘x’ is the first element in the list, and ‘xs’ is the rest of the list. On running sumList with GHCi, you get the following:

*Main> sumList []
*Main> sumList [1,2,3]

Sometimes, you will need a temporary function for a computation, which you will not need to use elsewhere. You can then write an anonymous function. A function to increment an input value can be defined as:

*Main> (\x -> x + 1) 3

Such functions are called as Lambda functions, and the ‘\’ represents the notation for the symbol Lambda. Another example is given below:

*Main> map (\x -> x * x) [1, 2, 3, 4, 5]

It is a good practice to write the type signature of the function first when composing programs, and then write the body of the function. Haskell is a functional programming language, and understanding the use of functions is very important.

May 25, 2015 10:00 AM

May 19, 2015

Kushal Das

CentOS Cloud SIG update

For the last few months we are working on the Cloud Special Interest Group in the CentOS project. The goal of this SIG is to provide the basic guidelines and infrastructure required of FOSS cloud infrastructure projects so that we can build and maintain the packages inside official CentOS repositories.

We have regular meetings at 1500 UTC in every Thursday on #centos-devel IRC channel. You can find the last week’s meeting log here. RDO (Openstack), Opennebula and Eucalyptus were the first few projects to come ahead, and participate in forming the SIG. We also have a good number of overlap with the Fedora Cloud SIG.

RDO is almost ready to do a formal release of Kilo on CentOS 7. The packages are in testing phase. Opennebula team has started the process to get the required packages built on CBS.

If you want to help feel free to join in the #centos-devel channel, and give us a shout. We do need more helping hands to package, and maintain various FOSS Cloud platforms.

There are also two GSoC projects under CentOS which are related to the Cloud SIG. The first one is “Cloud in a box”, and the second one is “Lightweight Cloud Instance Contextualization Tool”. Rich Bowen, and Haikel Guemar are the respective mentors for the projects.

by Kushal Das at May 19, 2015 03:03 PM

April 26, 2015

Chandan Kumar

[Event Report] April Python Pune Meetup 26th April, 2015

After a successful Python Sprint in March, 2015, we hosted April Python Pune meetup, 2015 on 26th April, 2015 at Zlemma Analytics Pvt. Ltd., Baner Road, Pune (India). This meetup focused on python packaging workshop, writing simple automation scripts using fabric and interacting with MySQL and sqlite database using python.

About 35 people attended this meetup. Most of them were professionals.

The meetup started at 10:30 A.M. with package your python code workshop where we explained :

  • Why should i package my python code
  • Tools Required for packaging
  • Get familiar with pip, virtualenv and setuptools
  • Python Project Structure
  • Create a dummy project and package it
  • Create a source distribution
  • Register yourself on Pypi and upload package.

For that i had created a dummy project myls <> and explained the above steps.

After a small break, Suprith presented a talk on "My first automation script using Fabric". He started by introducing what is fabric, how it is different from other automation tools like Ansible, salt, puppet and chef and showed how to use fabric to write simple automation script.

The last talk was presented by Tejas on how to interact with MySQL and sqlite database using python and how to add crawled data from a website using beautifulsoap and crawler and store in the database. Here is the source code of the above demo.

By 01:30 P.M., Suraj had demonstrated his cool python application speedup, a simple python program to speedup internet speed on your LAN and Hardik demonstrated about his final year project on how to scan new virus on a windows machine by reading system calls over .exe files and analyzing those calls using data mining.

Finally, this awesome meetup came to an end at 02:00 P.M.

Below is the upcoming plan of 3 month meetup i.e from May, 2015 to July, 2015.

  • Workshop/Talk on Flask, Data Analytics, Automation using selinium and Robots and Security
  • Hackathon - Craft your idea into a real program and contribute to your favorite upstream OpenSource Python project.

Thanks to Ajit Nipunge and Zlemma for providing the venue arrangements, speakers and attendees who made the meetup successful.

by Chandan Kumar at April 26, 2015 05:23 PM

April 24, 2015

Sanjiban Bairagya

My experiences at 2015

Last year I really wanted to attend but couldn’t because my train tickets were not confirmed by the time it started. So, I had made up my mind right then, that I will definitely attend it the next year by all means. So, this year I applied and was accepted as a speaker too. But tragedy struck again, when some college issues clashed with the date of my flight, so I had to reschedule it once, and then one more time due to one more clash, after which I could finally reach Amritapuri in the evening of Day 1 of conference when it was already over. So, yes I was sad as I had missed the first day, but that also meant that I should make the best of the second day for sure.

The second day of conference started with some great south-Indian breakfast, where I met up with some of the important people like Shantanu, Sinny, Pradeepto and others. The first talk for that day was supposed to start from around 10:00 am, and I was the one to speak in it. I spoke on the ‘Interactive Tours’ feature that I had implemented in Marble last year, and it was pretty well received (I hope). My talk was followed by the rest of the other talks of the day, which were all pretty awesome, and very interesting as well. I got to meet Devaja, Rishab, Pinak, and the rest of the speakers during the talks, and I loved to interact with each one of them.




After a couple of talks after mine, I was asked by Sinny Kumari whether I would like to volunteer in a qml workshop which was being held in one of the labs. I didn’t wanna miss this opportunity, so I said “yes”, and went to the lab with her. The workshop started in a few moments, after everyone settled down. It was Shantanu who was explaining most of the stuff, using his computer screen as a projection, with me, Sinny, Pradeepto and Pinak helping the attendees in their computers in case they needed help or had some query. It was a very productive session, amazingly led by Shantanu, and I loved every moment that was spent in it.

Well, the day ended with an awesome lunch, and a few more talks for the day. We were often approached by students from their college, asking us about our experiences with KDE, and how to start contributing. I answered them with my personal experience with Marble, and it went really well, with some good feedback from both parties. People were very enthusiastic and I loved spending time and exchanging information with them. After the end of all the talks, we went out for some sightseeing, rode a boat :P , saw some awesome views from a high building rooftop, went to the beach, had lots and lots of fun.



and then finally came back, where we were invited to a lab, where each of the speakers and the students were saying their last viewpoints about the conference, what they liked about it, what could be improved. We told them about our awesome experience and that we would love to come back here again. Speakers who were still in college were asked how they keep open-source contributions alive in their respective institutions, I told them about our the GNU/Linux users’ group of my college and the events that are organized by it. Pradeepto told us some really interesting and funny stories about KDE, which were really both fun and motivational to listen to.



After all was said and done, all the speakers were given a certificate of appreciation, along with some books, and we walked back to the guesthouse. We had our very final celebration at night after returning back, with an awesome chicken and beer party in one of the rooms, till 1:30 am in the night. I think it would be fair to say that this was the best day of my life, and I am very glad to have bunked Durgapur for my flight the previous day, otherwise I would have missed out on all of these amazing moments, which have now turned into memories for life. Thanks to KDE, and especially to Dennis, without whom I wouldn’t even be in this position right now. Thanks to the organizers of and everyone else associated with it, for making my day special. I would love to come back to the next and the next and the next. Thanks a lot! :)

by sanjibanbairagya at April 24, 2015 05:29 AM

April 18, 2015

Souradeep De

Disabling an nvidia graphics card with bbswitch on Fedora

bbswitch is a kernel module which automatically detects the required ACPI calls for two kinds of Optimus laptops. It has been verified to work with “real” Optimus and “legacy” Optimus laptops.

kernel-headers and kernel-devel are needed to install bbswitch with dkms. Now, installing with dkms ensures that bbswitch is going to survive future kernel upgrades.

sudo yum install kernel-headers kernel-devel dkms

Download the latest stable version of bbswitch, extract, and install with dkms.

tar -xf bbswitch-0.5.tar.gz
cd bbswitch-0.5
sudo make -f Makefile.dkms

The nouveau driver needs to be unloaded before bbswitch can be loaded. If nouveau driver is being used somewhere, then the way around is to blacklist nouveau, and rebuild initramfs.

A simple lsmod can reveal if nouveau driver is being used:

lsmod | grep nouveau

You can also try unloading nouveau:

sudo modprobe -r nouveau

If the above fails, we are heading over to blacklisting nouveau and rebuilding initramfs.

su -c "echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf"
sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
sudo dracut --omit-drivers nouveau /boot/initramfs-$(uname -r).img $(uname -r)

If all goes well, reboot.

Nouveau driver can now be easily removed and bbswitch can be loaded once the system has restarted.

sudo modprobe -r nouveau
sudo modprobe bbswitch

Once, bbswitch is loaded, disabling and enabling the graphics card is just a walk in the park:

sudo tee /proc/acpi/bbswitch <<< OFF    # disable
sudo tee /proc/acpi/bbswitch <<< ON     # enable

Verifying the status of the card is as easy as:

cat /proc/acpi/bbswitch

Filed under: General, Tweaks Tagged: bbswitch, nvidia

by desouradeep at April 18, 2015 08:54 PM

March 30, 2015

Chandan Kumar

[Event Report] Python Pune Sprint 28th Mar, 2015

From last three months, we had conducted workshops and talks starting from python 101 to Django, Ansible, data analysis and a lot more. On the 4th Month, i.e. on 28th Mar, 2015, we hosted an sprint a.k.a Python Pune Sprint at Red Hat, Pune (India).

The main objective was to help people who have basic knowledge of python and git to come ahead and learn how to find issues which will help them to contribute to any Upstream python projects. I had selected some of the trending python projects with issues on a gist.

40 people attended the sprint in which most of them are previous meetup attendees.

About 10:30 A.M., the sprint started with a formal introduction about the sprint where i talked about:

  • How to use IRC/Mailing List
  • Tools :- IDE, Version Control System, Programming Language, Bug/issue Tracker
  • Choose a project on which you want to contribute
  • Since you are new to project, Check README or Contributing files
  • Follow the docs, setup the Development Environment
  • Check the issues and search for labels or tags with these keywords: {EasyFix, Contributor Friendly, Beginners, Easy, Low Hanging Fruits, Difficulty/beginners, junior Jobs, Gnome Love etc.}
  • Pick an issue and Read the Description
  • Try to reproduce the issue based on Description
  • Not able to understand the issue, Use Google or Ping someone on IRC or send a mail to Mailing list of Related Project
  • Got the issue, then make a fix in a new branch
  • Create a Patch or Pull Request and send it to Upstream
  • Follow up on the Patch/Pull Request until it gets merged
  • Finally, you had made an awesome contribution to an Upstream Project

Anurag explained about his project Crange and helped two contributor to get their first patch merged.

By 12:00 A.M., many of them selected issues on which they want to hack and started working on it. I and Praveen helped other to get some easy fixes for them.

By the end of the day, we had got more than 15 Pull requests for respective projects: {Fedora Infrastructure, Salt, Lohit Font, OpenStack-Horizon, Junction, Crange, werkzeug, click, sympy, tctoolkit, newcoder etc.}. Here <> is the list of all pull requests sent by the attendess.

Finally the sprint ended by 04:00 P.M. with a feedback, we are looking forward to host such type of sprints in the Upcoming meetups. Thanks to Red Hat for the venue and accommodation and all the mentors/attendees for making the first sprint successful.

Lessons Learned from this sprint:

  • Should ask attendees to come up with project of their interest.
  • Need to gather Upstream Contributors so that they can provide helping hands to attendees.
  • Need a tool which will list all the easy fixes of all the projects at one place :- OpenHatch gathers easy bugs but not for all the project
  • Needs a feature in github to query all the issues of as many projects with tags.

We hope to improve the sprint in upcoming meetups.

Some moments from the sprint:

by Chandan Kumar at March 30, 2015 07:11 PM

March 24, 2015

Kushal Das

Tunir, a simple CI with less pain

One of my job requirement is to keep testing the latest Fedora cloud images. We have a list of tests from Fedora QA team. But the biggest problem is that I don’t like doing these manually. I was looking for a way to run these automatically. We can do this by the normal CI systems, but there are two problems in that.

  • Most CI systems cannot handle cloud images, unless there is a real cloud running somewhere.
  • Maintaining the CI system & the cloud is a pain in my standard.

Tunir came out as a solution to these problems. It is a simple system, which can run predefined set of commands in a fresh cloud instance, or in a remote system. Btw, did I mention that you don’t need a cloud to run these cloud instances in your local system? This is possible thanks to the code from Mike Ruckman.

Each job in Tunir requires two files, jobname.json and jobname.txt. The json file contains the details of the Cloud image (if any), or the remote system details, ram required for the vm etc. The .txt file contains the shell commands to run in the system. For now it has two unique commands for Tunir. You can write @@ in front of any command to mark that this command will return non zero exit code. We also have a SLEEP NUMBER_OF_SECONDS option, we use it when we reboot the system, and want Tunir to wait before executing the next command.

Tunir has a stateless mode, I use that all the time :) In stateless mode, it will not save the results in any database. It will directly print the result in the terminal.

$ tunir --job fedora --stateless

Tunir uses redis to store some configuration information, like available ports. Remember to execute to fill the configuration with available ports.

You can install Tunir using pip, a review request is also up for Fedora. If you are on Fedora 21, you can just test with my package.

I am currently using unittest for the Cloud testcases, they are available at my github. You can use fedora.json and fedora.txt from the same repo to execute the tests. Example of tests running inside Tunir is below (I am using this in the Fedora Cloud tests).

curl -O
tar -xzvf tunirtests.tar.gz
python -m unittest tunirtests.cloudtests
sudo systemctl stop crond.service
@@ sudo systemctl disable crond.service
@@ sudo reboot
sudo python -m unittest tunirtests.cloudservice.TestServiceManipulation
@@ sudo reboot
sudo python -m unittest tunirtests.cloudservice.TestServiceAfter

UPDATE: Adding the output from Tunir for test mentioned above.

sudo ./tunir --job fedora --stateless
[sudo] password for kdas: 
Got port: 2229
cleaning and creating dirs...
Creating meta-data...
downloading new image...
Local downloads will be stored in /tmp/tmpZrnJsA.
Downloading file:///home/Fedora-Cloud-Base-20141203-21.x86_64.qcow2 (158443520 bytes)
Succeeded at downloading Fedora-Cloud-Base-20141203-21.x86_64.qcow2
download: /boot/vmlinuz-3.17.4-301.fc21.x86_64 -> ./vmlinuz-3.17.4-301.fc21.x86_64
download: /boot/initramfs-3.17.4-301.fc21.x86_64.img -> ./initramfs-3.17.4-301.fc21.x86_64.img
/usr/bin/qemu-kvm -m 2048 -drive file=/tmp/tmpZrnJsA/Fedora-Cloud-Base-20141203-21.x86_64.qcow2,if=virtio -drive file=/tmp/tmpZrnJsA/seed.img,if=virtio -redir tcp:2229::22 -kernel /tmp/tmpZrnJsA/vmlinuz-3.17.4-301.fc21.x86_64 -initrd /tmp/tmpZrnJsA/initramfs-3.17.4-301.fc21.x86_64.img -append root=/dev/vda1 ro ds=nocloud-net -nographic
Successfully booted your local cloud image!
PID: 11880
Starting a stateless job.
Executing command: curl -O
Executing command: tar -xzvf tunirtests.tar.gz
Executing command: python -m unittest tunirtests.cloudtests
Executing command: sudo systemctl stop crond.service
Executing command: @@ sudo systemctl disable crond.service
Executing command: @@ sudo reboot
Sleeping for 30.
Executing command: sudo python -m unittest tunirtests.cloudservice.TestServiceManipulation
Executing command: @@ sudo reboot
Sleeping for 30.
Executing command: sudo python -m unittest tunirtests.cloudservice.TestServiceAfter

Job status: True

command: curl -O
status: True

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  8019  100  8019    0     0   4222      0  0:00:01  0:00:01 --:--:--  4224

command: tar -xzvf tunirtests.tar.gz
status: True


command: python -m unittest tunirtests.cloudtests
status: True

Ran 4 tests in 0.036s

OK (skipped=1, unexpected successes=2)

command: sudo systemctl stop crond.service
status: True

command: @@ sudo systemctl disable crond.service
status: True

Removed symlink /etc/systemd/system/

command: @@ sudo reboot
status: True

command: sudo python -m unittest tunirtests.cloudservice.TestServiceManipulation
status: True

Ran 1 test in 0.282s


command: sudo python -m unittest tunirtests.cloudservice.TestServiceAfter
status: True

Ran 1 test in 0.070s


by Kushal Das at March 24, 2015 06:46 AM

March 09, 2015

Samikshan Bairagya

spartakus: Using sparse to have semantic checks for kernel ABI breakages

I have been working on this project I have named spartakus that deals with kernel ABI checks through semantic processing of the kernel source code. I have made the source code available on Github some time back and this does deserve a blog post.

spartakus is a tool that can be used to generate checksums for exported kernel symbols through semantic processing of the source code using sparse. These checksums would constitute the basis for kernel ABI checks, with changes in checksums meaning a change in the kABI.

spartakus (which is currently a WIP) is forked from sparse and has been modified to fit the requirements of semantic processing of the kernel source for kernel ABI checks. This adds a new binary ‘check_kabi‘ upon compilation, which can be used during the linux kernel build process to generate the checksums for all the exported symbols. These checksums are stored in Module.symvers file which is generated during the build process if the variable CONFIG_MODVERSIONS is set in the .config file.

What purpose does spartakus serve?
In an earlier post I had spoken a bit on exported symbols constituting the kernel ABI and how its stability can be kept track of through CRC checksums. genksyms has been the tool that had been doing this job of generating the checksums for exported symbols that constitute the kernel ABI so far, but it has several problems/limitations that make the job of developers difficult wrt maintaining the stability of the kernel ABI. Some of these limitations as determined by me are mentioned below:

1.genksyms generates different checksums for structs/unions for declarations which are semantically similar. For example, for the following 2 declarations for the struct ‘list_head':

struct list_head {
    struct list_head *next, *prev;

struct list_head {
    struct list_head *next;
    struct list_head *prev;

both declarations are essentially the same and should not result in a change in kABI wrt ‘list_head’. Sparse treats these 2 declarations as semantically the same and different checksums are not generated.

2. For variable declarations with just unsigned/signed specification with no type specified, sparse considers the type as int by default.

‘unsigned foo’ is converted to ‘unsigned int foo’ and then processed to get the corresponding checksum. On the other hand, genksyms would generate different checksums for 2 different definitions which are semantically the same.

sparse is licensed under the MIT license which is GPL compatible. The added files as mentioned above are under a GPLv2 license since I have used code from genksyms which is licensed under GPLv2.

Source Code
Development on spartakus is in progress and the corresponding source code is hosted on Github.

Lastly, I know there will be at least who will wonder why the name ‘spartakus’. Well I do not totally remember, but it had something to do with sparse and Spartacus. Does sound cool though?

by Samikshan Bairagya at March 09, 2015 01:55 PM

February 26, 2015


Understanding RapidJson

With new technologies softwares need to evolve and adapt. My new task is to make cppagent generate output in Json (JavaScript Object Notation) format. Last week i spent sometime to try out different libraries and finally settled on using Rapidjson. Rapidjson is a json manipulation library  for c++ which is fast, simple and has compatibility with different c++ compilers in different platforms. In this post we will be looking at example codes to generate, parse and manipulate json data. For people who want to use this library i would highly recommend them to play with and understand the example codes first.

First we will write a simple program to write a sample json as below (the same simplewriter.cpp as in example) :

    "hello" : "world" ,
    "t" : true ,
    "f" : false ,
    "i" : 123 ,
    "pi" : 3.1416 ,
    "a": [

To generate a Json output you need:

  • a StringBuffer object, a buffer object to write the Json output.
  • Writer object to write Json to the buffer. Here i have used PrettyWriter object to write human-readable and properly indented json output.
  • functions StartObject/EndObject to start and close a json object parenthesis “{” and  “}” respectively.
  • functions StartArray/EndArray to start and end a json array object i.e “[” and “]“.
  • functions String(), Uint(), Bool(), Null() , Double()  are called on writer object to write string, unsigned integer, boolean, null, floating point numbers respectively.
#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h"
#include <iostream>

using namespace rapidjson;
using namespace std;

template <typename Writer>
void display(Writer& writer );

int main() {
 StringBuffer s; 
 PrettyWriter<StringBuffer> writer(s);
 cout << s.GetString() << endl;   // GetString() stringify the Json

template <typename Writer>
void display(Writer& writer){
 writer.StartObject();  // write "{"
 writer.String("hello"); // write string "hello"
 writer.Bool(true);   // write boolean value true
 writer.Null();        // write null
 writer.Uint(123);     // write unsigned integer value
 writer.Double(3.1416); // write floating point numbers
 writer.StartArray();  // write "["
 for (unsigned i = 0; i < 4; i++)
 writer.EndArray();   // End Array "]"
 writer.EndObject();  // end Object "}"

Next we will manipulate the Json document and change the value for key “Hello” to “C++” ,

To manipulate:

  • first you need to parse your json data into a Document object.
  • Next you may use a Value reference to the value of the desired node/key or you can directly access them as doc_object[‘key’] .
  • Finally you need to call the Accept method passing the Writer object to write the document to the StringBuffer object.

Below function changes the keywords for “hello” , “t”, “f” to “c++” , false , true respectively.

template <typename Document>
void changeDom(Document& d){
// any of methods shown below can be used to change the document
Value& node = d["hello"];  // using a reference
node.SetString("c++"); // call SetString() on the reference
d["f"] = true; // access directly and change
d["t"].SetBool(false); // best way

Now to put it all together:

Before Manupulation
     "hello": "world",
     "t": true,
     "f": false,
     "n": null,
     "i": 123,
     "pi": 3.1416,
     "a": [
After Manupulation
     "hello": "c++",
     "t": false,
     "f": true,
     "n": null,
     "i": 123,
     "pi": 3.1416,
     "a": [

The final code to display the above output:

#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/document.h"
#include <iostream>

using namespace rapidjson;
using namespace std;

template <typename Writer> 
void display(Writer& writer);

template <typename Document>
void changeDom(Document& d);

int main() {
 StringBuffer s;
 Document d;
 PrettyWriter<StringBuffer> writer(s);
 cout << "Before Manupulation\n" << s.GetString() << endl ;
 s.Clear();   // clear the buffer to prepare for a new json document
 writer.Reset(s);  // resetting writer for a fresh json doc
 d.Accept(writer); // writing parsed document to buffer
 cout << "After Manupulation\n" << s.GetString() << endl;

template <typename Document>
void changeDom(Document& d){
Value& node = d["hello"];
d["f"] = true;

template <typename Writer>
void display(Writer& writer){
 for (unsigned i = 0; i < 4; i++)

by subho at February 26, 2015 12:30 PM