Planet dgplug

July 21, 2016

Trishna Guha

A Moment to Cherish

It was June when I was interviewed by opensource.com for my Opensource (FOSS) journey and Summer training in Dgplug.

https://opensource.com/life/16/6/how-community-taught-me-code

Heartfelt Thanks to my family, mentors and friends I have come across so far!

Definitely a moment that I would love to cherish for lifelong:).

Contributions:  https://github.com/trishnaguha  https://pagure.io/user/trishnag


by Trishna Guha at July 21, 2016 01:27 PM

Farhaan Bukhsh

Search for Code in Pagure

I was trying to get into code search in Pagure, thing that I land up on got really interesting and amazing.  If you want to have a code searching mechanism in your website you need to look into something called Indexing.

The way search happens in some E-commerce sites like Amazon or be it the search happening on Google, with Google its web scrapping and then indexing on the results. The point being the response time , while you are searching for something you get results in few microseconds.

Now imagine going through such a huge database and going through them in few micro second how much ever power you have but what you need is a clever way to manage it. I was looking at a CS50 video in which Mark Zuckerberg was telling about how he managed his DB, the first architectural design he took was have different MySql instance for different school so that they reduce time taken to search and form relation.

That was a really clever move.

While I was searching for ways to have code search feature on Pagure, I landed up on a pyhton based library called Whoosh. It blew me off with the way it was doing its searches and maintaining the database. I actually looked for a lot for tutorials on how one can understand indexing.

I landed up on Building Search Engines using Python and the way he explained things like N-grams , edge N-grams and how different files store different index words with the frequency and path to documents. I am yet to analyze git grep v/s whoosh.

While I was going through whoosh I saw that it has performance issues and then I started contemplating on the fact that if search is not fast enough then there is no point in having it. I actually looked into HyperKitty I figured out they were using Whoosh before and I assumed even they suffered form performance issues or may be because Django introduce Haystack . As the name suggest you can also use this to find the needle in haystack.

Yeah! you are right, I started looking for Haystack in Flask and I found Flask-whoosh. Again the draw back I had was it use to search through databases and not files, where as my application was to search through files on the system

There came the xapian there are a lot of core concepts involved while using or writing utilities in xapian. I went through the documentation for Xapian. They have covered a lot of concepts and have given examples of it, the bottleneck still persist when it comes to file searching and performance. I found a nice application Building Document Search which might give me some hope but still a lot of work is required there.

The whole concept being you need to do two things on a really high level:

  1. Indexing
  2. Search

Indexing

Indexing is required to go through the each file or record and build something called Index which has the search words filtering  stop words and the new database is build having the frequency and location of the word , this is the most time consuming process.

Search

This comprises of forming a query and searching through the formulated database and return the document in which word or phrase is found.

If you need to see a demo.

Till then Happy Coding an Bingo!


by fardroid23 at July 21, 2016 10:00 AM

July 20, 2016

Suraj Deshmukh

Run aircrack-ng without external “wifi card” [UPDATED]

Note: This is updated version of my previous blog, which goes by the similar title.

home-kali-slider-1
I wanted to use pentesting tools provided in Kali-Linux. I use a Fedora machine as my primary desktop, I can install some of those tools locally, but then I wanted to keep these things separate. So I use Kali Linux in a VM. It was all good, until the point when I was not able to run wireless pentesting tools from VM.

kvmnet_580

This is because VM does not get direct access to the host’s wifi card. The way it works VMs get connected to a bridge setup by your hypervisor via ethernet interface. So VM never deals with how the host is connected to outside world, be it wired or wireless connection.

The VM can get a wireless interface using USB connected wifi device. But then you need to have one to utilize it. To get around this problem, and use your host machine’s interface, we can use containers. Containers give you isolation similar to VM(not exactly) and since container is again a process mapped onto your operating system it has access to everything on your machine(if run in privileged mode) and container can also see the host’s network stack if run with specific flag(--net="host").

So lets get started

Install docker for your system:

Engine

Create Dockerfile which looks like this:

$ cat Dockerfile

FROM kalilinux/kali-linux-docker

RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get install -y aircrack-ng pciutils

Here we are using official kali-linux docker image, then installing tools required.

Create a docker image using above Dockerfile

$ docker build -t mykali .

Now that you have all the bits required to get started, spin up the container:

$ docker run -it --net="host" --privileged --name aircrack mykali bash
root@user:/#

Once inside the container, identify your wireless interface:

# ip a
[SNIP]
3: wlp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 40:f0:2f:57:3d:37 brd ff:ff:ff:ff:ff:ff
inet 10.9.68.109/23 brd 10.9.69.255 scope global dynamic wlp9s0
valid_lft 1373sec preferred_lft 1373sec
inet6 fe80::bf7e:dc5d:337:131c/64 scope link
valid_lft forever preferred_lft forever
[SNIP]


On my machine it is wlp9s0.
Enable monitor mode on that wireless interface.

# airmon-ng start wlp9s0
Your kernel supports rfkill but you don't have rfkill installed.
To ensure devices are unblocked you must install rfkill.
PHY Interface Driver Chipset

phy0 wlp9s0 ?????? Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)

(mac80211 monitor mode vif enabled for [phy0]wlp9s0 on [phy0]wlp9s0mon)
(mac80211 station mode vif disabled for [phy0]wlp9s0)

Observe the new interface created wlp9s0mon

# ip a
[SNIP]
9: wlp9s0mon: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UNKNOWN group default qlen 1000
link/ieee802.11/radiotap 40:f0:2f:57:3d:37 brd ff:ff:ff:ff:ff:ff

Start capturing raw 802.11 frames on the newly created interface running on monitor mode:

# airodump-ng wlp9s0mon

Let this process continue to run here.

Start another terminal window, we need another bash instance in container

$ docker exec -it aircrack bash
root@dhcp35-70:/#

Now that you have everything setup, start doing stuff here, in this terminal window. If you wanted more softwares in the container, edit Dockerfile above and create image accordingly.

To stop the monitoring mode:

# airmon-ng stop wlp9s0mon
Your kernel supports rfkill but you don't have rfkill installed.
To ensure devices are unblocked you must install rfkill.

PHY Interface Driver Chipset

phy0 wlp9s0mon ?????? Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)

(mac80211 station mode vif enabled on [phy0]wlp9s0)

(mac80211 monitor mode vif disabled for [phy0]wlp9s0mon)

And, finally, since wireless interface was put to monitoring mode we should stop monitoring before we exit continer. Doing this is important because the Guest OS will not get access to wireless card unless monitoring process by Docker container is not stopped. Now the interface wlp9s0 has appeared back, because airmon-ng was stopped.

# ip a
[SNIP]
8: wlp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 40:f0:2f:57:3d:37 brd ff:ff:ff:ff:ff:ff
inet 10.9.68.109/23 brd 10.9.69.255 scope global dynamic wlp9s0
valid_lft 3581sec preferred_lft 3581sec
inet6 fe80::bf7e:dc5d:337:131c/64 scope link
valid_lft forever preferred_lft forever

Please comment if any doubts.

Ref:


by surajssd009005 at July 20, 2016 06:02 PM

July 19, 2016

Suraj Deshmukh

Hybrid setup for multi-node Kubernetes

I wanted latest kubernetes to try out new features. But then there are no latest packages of kubernetes available for fedora as of now. So alternative was to try out the released binaries. But I wanted a kubernetes that runs on docker and is multi-node setup. I also read the docs which tells how to setup multi-node kubernetes on docker. But then it was not working for me for some reason.

13629408

Also may be due to complexity of running bootstrap instance of docker daemon, then setting up flannel and etcd which run in its own containers, which somehow messed up with my default gateway interface, causing me to restart the VMs, very often.

etcd-horizontal-color

The docs ask you to run etcd 2.2.1 and flannel 0.5.5 in container, so when I checked with the fedora repos those were available as packages. So I decided to install etcd and flannel as rpm package and run only kubernetes in containers. So this reduced complexity.

flannel-horizontal-color

I have written some shell scripts that do following (link to scripts github repo):

  1. Bring up three VMs using vagrant one acts as master and other are nodes (you can add more nodes to Vagrantfile).
  2. Install required packages viz. docker, flannel, etcd(only on master).
  3. Setup etcd and flannel.
  4. Make changes to systemd file of docker to use flannel as default network.
  5. Change SELINUX contexts of folders that are mounted on container running kubernetes.
  6. Finally pull kubernetes as container image. (More info k8s docs for master, k8s docs for node)

 

Ref:


by surajssd009005 at July 19, 2016 04:30 PM

July 18, 2016

Farhaan Bukhsh

Setting Postgres For Pagure

I normally use Sqlite for development because of the ease you get to see your file , browse through it and edit it. Having said that sqlite is good for development and not for production one of the foremost reason being it doesn’t support multi-thread querying.

The other disadvantage was sqlite doesn’t give a damn if you have dangling Foreign Key references, I land up on this problem recently. The way we categorize fork project in Pagure is on the basis of parent_id so if a project has parent_id its a fork and if it doesn’t then its not a fork.

This works out quite well unless recently we figured out a flaw , what if the main project is deleted, the expected behavior is the fork should be accessible but because of the parent_id  dependency the fork was getting inaccessible this was because as you delete the main repo , the FK references with the fork gets modified and becomes Null.

This creates anomaly because now the project is no more a fork , its a main repo and its treated like it which leads to a lot of repo path chaos. The relation of Postgres came here because I was able to have a dangling FK reference here in sqlite but when I try to achieve the same thing in Postgres it throws an integrity error.

Pagure uses Sqlalchemy as the ORM so I just need to set up postgres on my system and provide the URL in pagure/default_config.py  and ORM magic makes all the queries just work.

Setting up Postgres is really easy because of the amazing documentation provided in fedora-wiki . The only thing you need to care or a little tricky about is you need to be a superuser  before you change to user postgres .  So first sudo su and then su - postgres. Then the follow the steps in the wiki and create a user and create a database name pagure.


by fardroid23 at July 18, 2016 06:33 AM

July 16, 2016

Kushal Das

Fedora Atomic 24 is now available

Just in case you missed the news, Adam Miller already announced the availability of Fedora Atomic release based on Fedora 24. You can get it from the usual place. Dusty already uploaded the same into Atlas for Vagrant. You can try it out by the following.

    $ vagrant init fedora/24-atomic-host; vagrant up

As Adam mentioned in his mail, we are sorry for the delay, but we will keep improving the process. Thank you everyone for helping us with this release.

by Kushal Das at July 16, 2016 11:02 AM

July 14, 2016

Kushal Das

Fedora mirror at home with improved hardware

It was always a dream to have a fully functional Fedora mirror in the local network which I can use. I tried many times before, mostly with copying rpms from office, carrying them around in hard drive, etc. But never managed to setup a working mirror which will just work (even though setting it up was not that difficult). My house currently has 3 different network (from 3 different providers) and at any point of time 1 of them stays down 😔

Hardware

If you remember my post on home storage, I was using Banana Pi(s). They are still very nice, and Fedora runs on them properly, but they were not very powerful, things like rsync was crawling on them. This PyCon, I received Minnowboard Turbot from John Hawley(Thanks a lot once again). It took time to get them setup (as I don’t have a monitor with HDMI, I had to steal the TV from the front room), they are finally up in my own production environment. Installation of Fedora was super easy, just used the latest Fedora 24 from a live USB stick, and I was ready to go.

In the picture above you can see two of those running, you can also see a Banana Pi in the back.

Syncing up the mirror

Now for my work, I mostly need x86_64, and nothing else (I update my ARM boards, but not regularly). So following the tips in #fedora-noc channel from smooge, and puiterwijk, and some tips from this wiki page, I started rsyncing the 24GA. This was around 55GB, and took me some days to get it in. Mean while Chandan helped me by syncing the updates repo. Right now I have a cron job which syncs the update repo every night.

Remember to add the following your Apache virtualhost configuration

  AddType application/octet-stream .iso
  AddType application/octet-stream .rpm

by Kushal Das at July 14, 2016 05:33 AM

July 12, 2016

Anwesha Das

Coming out of hibernation : PyLadies Pune chapter

It was 10th July, a rainy, lazy Sunday morning. It was a kind of day when you would want to spend some extra hour in the bed. I woke up with up a shrill sound of alarm and immediately it stroked me "oh today is 10th, the PyLadies meet up". It was an event for which we were planning for a long time. Had several meetings with Rupali Talwatkar.

That day was on of those very few days when Kushal was excused from all his daily household jobs (and I was happy about it!) because I wanted my speaker to get ready on time. I got ready and packed my event speaker with me and reached the Red Hat, Pune office. We went into " Harishchandraghar" (but not the hill fort) and made all the set-ups ready and running. Slowly the people started coming in. There were people from different fields - students, banker, programmer, lawyer and of course Red Hatters. What a vibrant community to be part of. We had 18 people as attendees. We started half an hour late ( remember lazy rainy Sunday morning).

photo courtesy : Chandan Kumar

I started the session with a Welcome note and an Introduction to what PyLadies is all about. As well as I had formally announced the rebooting of the Pune Chapter of PyLadies.

Then the next speaker Kushal took over. He was supposed to give a talk on Python Industry and Community. Instead of giving a formal lecture he let us peep into the Python world through his lenses. He gave us a photo ride of his album Pycon 2015 with all the stories behind it. So, we had Guido to Lynn Root to Nick everyone present through those pictures in our meet up :).

Everyone is not lucky enough to go to Pycon. So we planned the next video watching session. We chose this year's ending keynote by K Lars Lohn to be projected. It was a keynote of a lifetime. He has used his multi facet personality of a programmer, musician, teacher and a biker ( and without over doing any of it) as a tool to present a vision of life. The talk had everything from mathematics to music. More than a talk it appeared as a beautifully written poetry to me. The talk actually has given a new definition on how a talk should be given.

After having a quick lunch we had started our Self Introduction session. But unfortunately I had missed the initial part of it because by then 'lady Py' had made her grand entry to the 'PyLadies' event.

Then started our Python Workshop. After learning some basics Python program we tried our hands on python. Kushal gave us problem of implementing some part of the command free. The session made me realise that I should try to make my typing skill right first before I proceed on programming. But somehow I managed to finish the task quite fast (may be Py's crying for food made my productivity grow).

The post hands on session was primarily planning and discussion for the next PyLadies meet up and about our future goals. People came up with some nice ideas like hackathon, more video watching, some real life bug solving etc.

Overall the event went well. Before I end my post I should show my gratitude to few people :

Chandan Kumar for his help, guidance and advice for how to unite a community together.

Rupali for taking care of all the management issues.

And last but not the least Siddesh.Without whom atleast 3 of the attendees would have not been able to participate. A big thanks to him for taking care of Py and Ira.

We have started the PyLadies Pune chapter a fresh. Together lets learn, have fun and make this Pune chapter of PyLadies a success. See you ladies at the next meet up.

by Anwesha Das at July 12, 2016 08:23 PM

July 08, 2016

Trishna Guha

First Guest Session of DGPLUG Summer Training 2016

Screenshot from 2016-07-06 14-06-08

I never imagined that Kushal Das (Mentor of DGPLUG) would ask me to take the first guest session at DGPLUG summer training 2016. I was one of the participants of DGPLUG summer training 2015.

Few days ago I was asked to take the first guest session at DGPLUG summer training 2016 about my journey in FOSS, Python and DGPLUG. I became super excited after hearing that and also it was the first guest session of DGPLUG summer training 2016. It was really unexpected:). The next day I took the session at 18:30 IST on #dgplug channel on IRC.

I started with little introduction about me and let the participants ask Questions after that. The whole session went really interactive. They asked smart questions despite being newbies:).

The mostly asked Questions were How I started my first upstream contribution, How did I select the project I worked on for the first time, What do I do when I am stuck at an issue, How do I manage time to contribute along with my studies, How FOSS helps in career, Steps to contribute in a better way and all.

I really enjoyed answering all kind of Questions those were asked.

You can join the summer training still now. Join #dgplug channel on IRC and the Mailing list. Fill up the form and ping Kushal Das. Feel free to ask if you have any query on IRC or Mailing list. You get this golden opportunity only once a year, so don’t miss it.

The IRC logs are uploaded here. You will find all the conversations here https://dgplug.org/irclogs/2016/Logs-2016-07-01-15-00-trishna.txt.

It feels amazing to be a part of such a great community:).


by Trishna Guha at July 08, 2016 08:13 AM

July 07, 2016

Praveen Kumar

Vagrant DNS with Landrush and Virtualbox and dnsmasq

Landrush is pretty neat vagrant plugin if you need a DNS server which is visible to host and guest. For Mac OS it work out of the box but to make it work in Linux we have to make some configuration changes to dnsmasq.

I assume that you are using latest vagrant and Virtualbox for this experiment. If you are using libvirt than please refer to Josef blogpost.

Landrush DNS server runs on port 10053 (localhost) instead of 53 so we have to make entry to redirect requested domain name to our Landrush. Follow below steps and lets configure it.

Install dnsmasq if not present
$ sudo dnf install dnsmasq

Add following to /etc/dnsmasq.conf
listen-address=127.0.0.1

Will create below file which redirect our .vm traffic to Landrush
$ cat /etc/dnsmasq.d/vagrant-landrush
server=/.vm/127.0.0.1#10053

Will start/restart dnsmasq service and check status (should be active)
$ sudo systemctl start dnsmasq.service
$ sudo systemctl status dnsmasq.service
● dnsmasq.service - DNS caching server.
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2015-12-24 11:57:47 IST; 2s ago
Main PID: 19969 (dnsmasq)
CGroup: /system.slice/dnsmasq.service
└─19969 /usr/sbin/dnsmasq -k
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com systemd[1]: Started DNS caching server..
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com systemd[1]: Starting DNS caching server....
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: started, version 2.75 cachesize 150
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth DNSSEC ...ct inotify
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: using nameserver 127.0.0.1#10053 for domain vm
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: reading /etc/resolv.conf
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: using nameserver 127.0.0.1#10053 for domain vm
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: using nameserver 10.75.5.25#53
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: using nameserver 10.68.5.26#53
Dec 24 11:57:47 dhcp193-61.pnq.redhat.com dnsmasq[19969]: read /etc/hosts - 2 addresses
Hint: Some lines were ellipsized, use -l to show in full.


Make sure you put '127.0.0.1' as nameserver to /etc/resolve.conf at first place.
$ cat /etc/resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 4.4.4.4

Make following change to your vagrant file
$cat Vagrantfile
PUBLIC_ADDRESS=10.1.2.2
PUBLIC_HOST= "your_host.vm"
config.vm.network "private_network", ip: "#{PUBLIC_ADDRESS}"
config.vm.hostname = "#{PUBLIC_HOST}"
config.landrush.enabled = true
config.landrush.host_ip_address = "#{PUBLIC_ADDRESS}"
config.landrush.tld = ".vm"
confg.landrush.guest_redirect_dns = false

$ vagrant landrush ls
your_host.vm 10.1.2.2
2.2.1.10.in-addr.arpa your_host.vm

$ sudo netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN 2946/dropbox
tcp 0 0 10.65.193.61:44319 0.0.0.0:* LISTEN 14810/weechat-curse
tcp 0 0 127.0.0.1:17600 0.0.0.0:* LISTEN 2946/dropbox
tcp 0 0 127.0.0.1:45186 0.0.0.0:* LISTEN 433/GoogleTalkPlugi
tcp 0 0 127.0.0.1:39715 0.0.0.0:* LISTEN 433/GoogleTalkPlugi
tcp 0 0 127.0.0.1:17603 0.0.0.0:* LISTEN 2946/dropbox
tcp 0 0 0.0.0.0:10053 0.0.0.0:* LISTEN 14966/ruby-mri
tcp 0 0 127.0.0.1:2222 0.0.0.0:* LISTEN 15200/VBoxHeadless
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 16871/dnsmasq
tcp 0 0 192.168.121.1:53 0.0.0.0:* LISTEN 16817/dnsmasq
tcp 0 0 192.168.124.1:53 0.0.0.0:* LISTEN 16810/dnsmasq
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2647/cupsd
tcp6 0 0 ::1:631 :::* LISTEN 2647/cupsd

$ ping your_host.vm
PING your_host.vm (10.1.2.2) 56(84) bytes of data.
64 bytes from 10.1.2.2: icmp_seq=1 ttl=64 time=0.332 ms
64 bytes from 10.1.2.2: icmp_seq=2 ttl=64 time=0.238 ms


by Praveen Kumar (noreply@blogger.com) at July 07, 2016 12:10 PM

July 04, 2016

Shakthi Kannan

Karaikudi and Chettinad trip photos

Few photos taken on a trip to Karaikudi and Chettinad, Tamil Nadu, India. More photos in my /gallery.

Courtyard
Corridor
Hall

July 04, 2016 12:45 PM

Anwesha Das

Converting the configuration of planetplanet to Dragobah for dgplug

These days I am reading laws and side by side I am learning Python also. One task I received was to convert the configuration of planetplanet to Dragobah. In the old configuration file the feed url was written within []. The example configuration of Dragobah looks like

title: "Go Feeds Powered by Dagobah"  
feeds:  
    - "http://spf13.com/index.xml"
    - "http://dave.cheney.net/feed"
    - "http://www.goinggo.net/feeds/posts/default"
    - "http://blog.labix.org/feed"
    - "http://blog.golang.org/feed.atom"

The following script converted dgplug's planet configuration into Dragobah.

def parse_file(filename):  
    f = open(filename)
    lines = f.readlines()
    f.close()
    f =  open("config.yaml","w")
    f.write('title: "Go Feeds Powered by Dragobah"\nfeeds:\n')
    for line in lines:
        line = line.strip("\n")
        if line.startswith("[http") and line.endswith("]"):
            f.write('    - "%s"\n' % line.strip('[]'))
    f.close()


if __name__ == "__main__":  
    parse_file("./planet.ini")

You can see Dragobah in action here.

by Anwesha Das at July 04, 2016 04:59 AM

June 27, 2016

Dhriti Shikhar

Working on Jira and Bugzilla issue in Project Almighty

I joined Red Hat on 15/06/2016.

I was assigned two issues on project Almighty to work on:

  1. Create simple example of fetching Issues from Jira in Go
  2. Create simple example of fetching Issues from Bugzilla in Go

I started with the Jira Issue. This was my first issue in golang. While solving this issue, i learnt the usage of “go get” command in golang. It downloads + installs an upstream package. For example, this is an upstream package which I used in the Jira Issue –> github.com/andygrunwald/go-jira

So, I installed+downloaded the package using following command:

go get github.com/andygrunwald/go-jira

The package got installed:

Screenshot from 2016-06-27 12-39-46

I learnt how to take input from command-line flags using “flag” package. To do this:

  • import flag package using:

import "flag"

  • Declare the variable in which you want to store the input

var username string
flag.StringVar(&username, "uname", "", "Username")

The first argument &uname is a pointer which stores the input value.
The second argument is the flag name which you use on the command line e.g. “-username”.
The third argument is the default value of the flag input.
The fourth argument is the description of the flag.

  • Parse the flag:

flag.Parse()

Next, I learnt to work with “net/http” package and how to parse http response in Go. Although I didnt use the package for this issue but I did experiment with it.

I used “reflect” package to find out the data type of http response. The two commands i used were:

reflect.TypeOf(result)
reflect.TypeOf(result).KindOf()

I found that http response have slice data type and each slice element had struct data type.

To access the value from struct data type, I had to find out its property name. For that, I used “reflect” package:
reflect.Indirect(result).FieldByName(field)

The next issue was bugzilla issue, The golang packages for bugzilla are listed here.

I used this package to get the results –> github.com/kolo/xmlrpc

XmlRpc is used to make remote procedure calls over HTTP.

The endpoint for xml-rpc interface is xmlrpc.cgi script in the bugzilla installation. So, for Red Hat Bugzilla, the endpoint is https://bugzilla.redhat.com/xmlrpc.cgi

You can find my code here.


by Dhriti Shikhar at June 27, 2016 08:04 AM

June 23, 2016

Sanjiban Bairagya

Marble Maps in KDE Randa Meetings 2016

One more year of fun and intense productivity in Randa came to an end just a few days back, and I feel so good to have been a part of it. Much progress was made by the Marble team this year by Dennis, Torsten, Friedrich, David and me. I mostly worked on the Marble Maps Android app’s navigation feature, and would like to mention the changes here very briefly:

  • First of all, cmake was picking up the wrong target for aprs plugin, so I made cmake to skip the aprs plugin for Android, so that it does not lead to an unnecessary crash during building it.
  • There was a bug in the Route Simulation position provider plugin, it was not working in the Navigation mode. Made a fix to that.
  • Replaced the older QImage based current-position pointer, with a QML based one in the Android app. So now we are able to make our custom animations on it.
  • The current-position pointer will be staying at points on the route itself, when the user is very close to the route (not too deviated from it). With the new QML based pointer, we made sure that the radius of accuracy remains the same with respect to the Earth irrespective of which height we are viewing the map from. Plus, we have got rid of this accuracy-indicator when the position-pointer is already on the route, and are showing it only otherwise.
  • There was a minor bug with this in the desktop version as well. Imagine that while you’re simulating a navigation through a route between New York and Boston, you zoom out till the whole Earth is visible, then rotate the Earth so that the other half of the globe, for example India, is visible now, instead of America. In that case the position marker was showing up on the top-left corner of map (somewhere in the sky), when it was supposed to not be visible at all since it is theoretically present on the other “not-visible” side of the globe now. So this bug was fixed as well.
  • Used some new maneuver direction pixmaps for navigation in the Android app, getting rid of old ones, and also made them look sharper in the Navigation info-bar while they were shown during turn-by-turn navigation, by making some tweaks in the QMLs that were using them.
  • Finally, the distance text that shows on the top while in Navigation mode, its border height has been changed to match the height of that of the maneuver pixmaps shown on its left as well, so that the view looks much more uniform. Plus, a similar panel has been added at the bottom as well, that shows the speed and distance information during the navigation, each at two different sides of the panel.

That’s all about work. And adding to the yummy food that turns out to be truly delicious every single year, this time we had some more fun activities as well. We were fortunate enough to board a cable-car to ride to as high as possible in the mountains, so much that we ended up finding ourselves in snowfall ( it’s my first time being in a snowfall:) ), which was amazing! The special red tea we were greeted at a stop at a restaurant during the hike was pretty unique. We then visited a museum, and that was a lot of fun as well.

Such a lively and eventful week it was, thanks a lot to Mario and Simon for organizing the Randa Meetings one more year. Let’s keep the Marble rolling, and I hope to be a part of this again in the subsequent years to come!  :)

banner-fundraising2016.png


by sanjibanbairagya at June 23, 2016 09:42 PM

Shakthi Kannan

GNU Emacs - rcirc IRC client

[Published in Open Source For You (OSFY) magazine, October 2015 edition.]

Internet Relay Chat (IRC) provides instant communication over the Web. It is generally used for one-to-one communication or group discussion forums, also known as channels. In this next article in the GNU Emacs series, we shall learn how to use GNU Emacs as an Internet Relay Chat (IRC) client.

What is IRC?

Internet Relay Chat (IRC) is a messaging protocol that was created by Jarkko Oikarinen in 1988. An IRC server has a number of channels (or rooms, as how they are called in other chat software) where both technical and non-technical discussions take place. Every user requires a nickname to chat. You will need to register your nickname with a password to identify yourself every time you log in to the IRC server. IRC can also be used for file sharing among users.

You can connect to any one of a number of IRC servers that are available worldwide, free. The most popular is Freenode (irc.freenode.net). The other IRC servers, to name a few, are IRCNet, OFTC, and EFNet. The Debian and Ubuntu projects have their own chat servers – irc.debian.org and irc.ubuntu.com. All IRC channel names begin with ‘#’. Some channels begin with ‘##’. Examples of channels are ##linux-india, #dgplug, #emacs, #ruby, #guile, #lisp, and #scheme. You can also create your own channels, or host your own IRC server. Some examples of free and open source IRC server software are IRCd, UnrealIRCd, and Synchronet. Each IRC channel has a topic that can include useful links relevant to the channel. Sometimes announcements, or news updates are also mentioned in the topic.

Basic commands

A number of commands can be given to the IRC server. A few of them are discussed below:

  1. /list is used to provide a list of all the available channels in a server. For example: /list in irc.freenode.net returned the following:

    ...
    #linod           1       
    ##welding        3       Welcome to ##Welding, We're a little bare at the moment, but will help if we can. Tutorials: https://www.youtube.com/channel/UCJAFY2kKKb5sg79yld7T3hA
    #drupal-ph       1       "Drupalista! Welcome to Philippine Drupal Users Group. Have a good time chatting. If you have a question, please don't ask to ask but fire up your question in very specific and constructive way! Please join #drupal or #drupal-support if no one is around"
    #orx-project     4       Orx: Portable Game Engine
    #tinkerforge     5       
    #osi             10      The Open Source Initiative
    #xampp           1       
    #guitar          8       
    #bitcoin-ar      3       Comunidad Bitcoin Argentina
    #LargeHadrosaurCollider 19      Welcome to the LHC, est. 2001 | http://www.largehadrosaurcollider.net | August Birthdays: Digby 08/21, Josh 08/31 | At night it is pitch black, often for months. | http://tinyurl.com/psgdagl
    * End of /LIST
  2. /msg NickServ REGISTER password e-mail is used to register your nickname to the IRC server. /msg NickServ IDENTIFY password is used to identify yourself to the server.

  3. /me message displays the message for a user. For example:

    /me says "Hello, World!"
    
     * mbuf says "Hello, World!"
  4. /whois nickname provides useful information for a user. For example:

     /whois mbuf
    
    * [mbuf] (~shakthi@123.123.123.123): Shakthi Kannan
    * [mbuf] #guile #scheme ##linux-india #stumpwm #guix #dgplug #lisp #emacs 
    * [mbuf] kornbluth.freenode.net :Frankfurt, Germany
    * [mbuf] is connecting from *@123.123.123.123 123.123.123.123
    * [mbuf] idle 00:41:52, signon: Thu Sep  3 20:36:52
    * [mbuf] is logged in as mbuf
    * [mbuf] End of WHOIS list.
  5. /msg nickname is used to send a private message to a nickname and to start a private conversation.

  6. /help provides useful help on basic IRC commands. These commands are:

      ADDBUTTON ALLCHAN   ALLCHANL  ALLSERV   AWAY
      BACK      BAN       CHANOPT   CHARSET   CLEAR
      CLOSE     COUNTRY   CTCP      CYCLE     DCC
      DEBUG     DEHOP     DELBUTTON DEOP      DEVOICE
      DISCON    DNS       ECHO      EXEC      EXECCONT
      EXECKILL  EXECSTOP  EXECWRITE FLUSHQ    GATE
      GETFILE   GETINT    GETSTR    GHOST     GUI
      HELP      HOP       ID        IGNORE    INVITE
      JOIN      KICK      KICKBAN   KILLALL   LAGCHECK
      LASTLOG   LIST      LOAD      MDEHOP    MDEOP
      ME        MENU      MKICK     MODE      MOP
      MSG       NAMES     NCTCP     NEWSERVER NICK
      NOTICE    NOTIFY    OP        PART      PING
      QUERY     QUIT      QUOTE     RECONNECT RECV
      SAY       SEND      SERVCHAN  SERVER    SET
      SETCURSOR SETTAB    SETTEXT   SPLAY     TOPIC
      TRAY      UNBAN     UNIGNORE  UNLOAD    URL
      USELECT   USERLIST  VOICE     WALLCHAN  WALLCHOP
    
    User defined commands:
    
      ACTION    AME       ANICK     AMSG      BANLIST
      CHAT      DIALOG    DMSG      EXIT      GREP
      J         KILL      LEAVE     M         ONOTICE
      RAW       SERVHELP  SPING     SQUERY    SSLSERVER
      SV        UMODE     UPTIME    VER       VERSION
      WALLOPS   WII       
    
    Plugin defined commands:
    
      UNLOAD    UNLOAD    LOAD      PY        LOAD
      RELOADALL SOURCE    TCL       RELOADALL UNLOADALL
      PL_RELOAD RELOAD    UNLOAD    LOAD      TIMER
    
    
    Type /HELP <command> for more information, or /HELP -l
  7. /quit is used to disconnect and exit from IRC.

  8. /join #channel - is used to join a channel. For example: /join #guix.

  9. /nick newnickname changes your nick to newnickname. Suppose, you wish to move away from the computer, you can change your nick to nick|away, or nick|phone.

  10. /part is used to leave a channel.

Using rcirc

If you are using a recent GNU/Linux distribution, you should already have rcirc as part of GNU Emacs. You can simply start it by typing M-x rcirc from inside Emacs. The ‘M’ key represents the Meta key, which is usually mapped to the ‘Alt’ key. After rcirc connects to the IRC server, you can use /nick to change your nickname, register (only the first time) your nick, identify yourself, join channels, and start chatting! Since everything is a buffer in GNU Emacs, each channel is a separate buffer. For example, #emacs@irc.freenode.net is the #emacs IRC channel. All your basic buffer navigation commands will work just like they would on a file!

Some basic rcirc commands

The rcirc commands for the above mentioned IRC commands are given in the following table:

IRC rcirc
/list rcirc-cmd-list
/msg NickServ rcirc-authenticate
/me rcirc-cmd-me
/whois rcirc-cmd-whois
/msg nick rcirc-cmd-msg
/help /help
/quit rcirc-cmd-quit
/join rcirc-cmd-join
/nick rcirc-cmd-nick
/part rcirc-cmd-part

~/.emacs

GNU Emacs is an extensible editor. There are a number of locations where Emacs checks for custom configurations before launching the editor. These are: ~/.emacs, /.emacs.el, and/.emacs.d/init.el. The start-up files can be customised, and their locations can also be changed. There are a number of ways to organize, and manage your Emacs configuration. Until we get to learn Emacs lisp, and customize Emacs as a project, we shall use ~/.emacs for all our user-specific customizations.

rcirc customization

Create a ~/.emacs.d/etc folder in your $HOME directory and an Elisp file called init-rcirc.el in it. It should contain the following (change nick, user-name and full-name to suit your needs):

;; Default user.
(setq rcirc-default-nick "shaks")
(setq rcirc-default-user-name "shakthimaan")
(setq rcirc-default-full-name "Shakthi Kannan")

;; Channels to join at startup.
(setq rcirc-server-alist
      '(("irc.freenode.net" :channels ("##linux-india" "#dgplug" "#rcirc" "#emacs"))))

The above is an example of Emacs Lisp code. Comments begin with two semi-colons. The setq construct sets the second argument value to the first argument, which is a quoted symbol. For example, the symbol ’rcirc-default-nick is set to “shaks”. The rcirc-server-alist defines the initial list of channels to login at startup.

You can now start GNU Emacs from the GNOME terminal using the following command:

$ emacs -q -l ~/.emacs.d/etc/init-rcirc.el

You will then automatically connect to the four IRC channels.

How to use IRC

People join IRC channels to have their doubts regarding free and open source software clarified. Sometimes, off-topic discussions also happen. It is like live technical support, but has a social context to it. Whenever you are connected online, you must be logged in to IRC. You can have discussions in the channel, or in private, if the other party agrees. It is a good place to learn a lot about free and open source software, and you are bound to make a lot of friends. Since people from all over the world participate, which means they are online in different time zones, some channels log the discussions for future reference. As always, before asking a question, it is important for you to do your homework first. Take sufficient time and put in an effort to debug and identify the problem to the best of your ability.

Some users in the channel may ask you for more information before being able to provide you with any assistance. So, be prepared to provide all the information necessary about the bug or error when you seek help. Sometimes, people might be logged in the channel, but, they might be away from the computer. So, even if you don’t get a response, be patient; come back later and ask again.

You should not paste more than four continuous lines of text in the channel, as it will ‘flood’ the screen for everyone else. Instead, use an external paste service like gist.github.com, or fpaste.org. These services will provide a shortened URL that you can pass around in the channel. Whoever is interested in helping you will view the contents from the link. If you enter text in the channel, it means that it is addressed to everyone in the channel. If you wish to say something to a specific user, mention their nickname first, and then type in the text.

Most IRC client software provide you with panels that list the channels that you are logged in, and show the list of users. If someone mentions your nickname in a channel, then the corresponding channel will change colour or representation to indicate that there is a message for you. A few users are channel operators (or moderators) and they have special privileges. They are similar to ‘root’ users in a system, and they exist to keep the signal-to-noise ratio to a minimum, and keep a vigil on the channel.

An IRC bot is a client software that connects to the IRC server as a user, but can respond to commands. It can thus be programmed to provide many services in a channel. You can customize existing bots, or write your own. Examples of IRC bots are Cerberus, Gambot and irccd. Cinch is an example of an IRC bot building framework written in Ruby. Bots can be used during an IRC meeting session to keep track of user questions. They can evaluate programming language constructs and return meaningful errors to newbies in the channel. They can be used to send a notification to the channel if a project test build fails, or when a new bug has been filed. The possibilities are endless.

IRC meeting protocol

A free and open source software project will have a dedicated IRC channel where the project members will meet to have discussions. Meetings can be scheduled, and can happen in different time zones depending on where the users are located. There is a protocol and etiquette to be followed during such meetings. The speaker or moderator should not be interrupted during the session.

If you wish to ask a question, type ’?’ and wait. When the speaker has finished and feels that you can type in your text, you will be asked to do so. After you have finished typing your content, end with ‘EOF’. Similarly, if you need to speak during the session, type ’!’, and wait. You can give your consent or dissent to statements made in the channel using +1 or -1, respectively.

You are encouraged to read the rcirc manual and customize rcirc to your needs. If you have made it this far, do connect to irc.freenode.net, and feel free to say ‘Hi’ to me. I am ‘mbuf’ on irc.freenode.net. A screenshot of an rcirc session is shown below:

19:35 <mbuf>    http://ecb.sourceforge.net/screenshots/index.html
19:35 ***       Arpita QUIT Client Quit
19:36 <rtnpro>  !
19:36 <mbuf>    rtnpro, shoot!
19:37 <rtnpro>  How do we get the emacs code browser?
19:37 <rtnpro>  <EOF>
19:37 <mbuf>    rtnpro, 1. Need to install "ecb" from your distro package manager
                2. you could have searched this on the Internet :)
19:38 <rtnpro>  It is not in my distro
19:38 <sumitc>  !
19:38 <mbuf>    rtnpro, and which distro are you using?
19:38 <rtnpro>  Its Fedora 9
19:39 <rtnpro>  I have got emacs but not emacs code browser
19:39 <mbuf>    rtnpro, you can always install from source
19:39 <techno_freak>    rtnpro, http://ecb.sourceforge.net/downloads.html
19:39 ***       khushbu QUIT Ping timeout: 244 seconds
19:39 <rtnpro>  ok
19:39 <mbuf>    sumitc, shoot!
19:39 <sumitc>  what is a tag-file?
19:40 <rtnpro>  What factors should decide the choice of our editor?
19:40 <mbuf>    rtnpro, wait!
19:40 ***       pushkal JOIN
19:40 <mbuf>    sumitc, the TAGS file contains the details of the reference count,
                and locations of variables/functions et. al.
19:41 <sumitc>  So, a tag file is always associated with a specific file?
19:41 <mbuf>    sumitc, no, it can have information of files in a directory
19:41 <sumitc>  ok
19:41 <sumitc>  <eof>
19:42 <mbuf>    sumitc, think of it as a database that answers all your queries
               regarding code references

References

  1. Freenode. https://freenode.net/

  2. rcirc manual. https://www.gnu.org/software/emacs/manual/html_mono/rcirc.html

  3. IRC Help. http://www.irchelp.org/

  4. Fedora project - How to use IRC. https://fedoraproject.org/wiki/How_to_use_IRC

June 23, 2016 04:00 PM