Graphical Visualization of databases with PostgreSQL Autodoc

When it comes to software, database systems are beneficial in many ways. They offer us to keep our data organized and a fast way to access them. However as the number of components in a software project increases, it gets harder to preserve the organized structure. In situations like this, visualizing the scheme helps to understand the structure and the relations between the tables.

PostgreSQL Autodoc provides simple tools for description of the PostgreSQL databases in various formats such as HTML, DocBook, Dia and GraphViz.

Linux Snippets

Sharing Screen Sessions

Recently, I learned a new feature of screen, it is referred as “multi display mode” in the manual. You can attach to a screen session that is not detached and the session is simply shared. In this mode, anything you typed are transferred simultaneously to the other display(s) as well. My mentor from my Google Summer of Code project used this feature to work collaboratively. In order to get in to multi display mode, you need to use “-x” parameter:

screen -x

If there are multiple sessions, you need to provide the session name as well:

screen -x session_name
Linux Python Programming Snippets

Quick Guide to D-Bus with Python

Recent weeks, I dealt with D-Bus for my Google Summer of Code project. I was trying to control system services, and systemd has a D-Bus interface. In the beginning, D-Bus seemed a little confusing for me, but I believe I understand it now. In this post I will try to explain it in simple terms and an example.

D-Bus is a interprocess communication tool. It delivers messages to applications. The most confusing thing for me was that taxonomy of D-Bus having several terms such as bus names, objects, paths, methods, signals, properties, interfaces, proxies… But when you learn their meanings, the bigger picture gets more clear.

  • Bus names are applications. They often have well known names in a format similar to namespaces in Java (e.g “com.onurguzel.MyIntergalacticApplication”).
  • Objects are synonymous to the objects in programming languages, and paths are the object instances.
  • Methods are functions that is run on the object, and signals are the broadcasts from the object. Properties are the constants or variables in the object.
  • Interfaces are the types of the object. Thus, some object may support several interfaces. Their format is the same as bus names, but they should not be mixed with each other.
  • Proxies are higher level objects. When a method is invoked on the proxy, it is converted to D-Bus method call message, sent, and reply message is returned. They offer easier operation with D-Bus then manually creating messages, sending them and waiting for a reply.

Since all major Linux distributions use NetworkManager for network connections, I preferred to create this tutorial with it.

import dbus

bus = dbus.SystemBus()

# Warning: Bus names and interfaces are different terms.
# Just because they contain same format or even same data
# does not mean they are the same thing.
# I used these variables to denote the diffrance where bus names and
# interfaces are used.
NM_BUSNAME = 'org.freedesktop.NetworkManager'
NM_IFACE = 'org.freedesktop.NetworkManager'

# Create Python object from /org/freedesktop/NetworkManager instance
# in org.freedesktop.NetworkManager application.
nm = bus.get_object(NM_BUSNAME, '/org/freedesktop/NetworkManager')

# Get list of active connections from the properties
# "Get" method is in "org.freedesktop.DBus.Properties" interface
# It takes the interface name which has the property and name of
# the property as arguments.

connections = nm.Get(NM_BUSNAME, 'ActiveConnections',

# While invoking a method on the object, dbus_interface keyword
# argument is provided to specify which interface has the method.

# Now, lets disconnect. This time we are using the NetworkManager
# interface: "org.freedesktop.NetworkManager"
for path in connections:
    nm.DeactivateConnection(path, dbus_interface=NM_IFACE)

If you have questions about this tutorial, you can ask in the comments section below. For more information about D-Bus, my references:


A Very Delayed Update on My GSoC Status

It has been over a month since summer coding started. Unfortunately, although I am not a procrastinator, I could not perform my best on the project. Besides following news about #OccupyGezi, I have read the Pyramid documentation in the community bonding period. Coding time has also past reading documentations. I spent my time reading and understanding SQLAlchemy and designing the modules for the project in my head.

I have managed to get my focus on my work, two weeks ago. Now, I have several weeks to catch up. The mistakes I’ve made so far:

  • I did not ask my mentor for advices.
  • I got distracted a lot. It was very hard to handle both summer school and summer coding. Because, school has its own assignments, too.
  • Even though I make my commits atomic, instead of pushing them regularly, I kept them local until I finished working on the feature.
  • I did not write any blog posts about my status or what I have done.

I am not proud of this failure or mentioning it here. However, I have learned from my mistakes, and I will not repeat them. You will see more frequent updates on my project status here. Keep following!


Google Summer of Code Heyecanı

Google Summer of Code‘a kabul edilen projelere baktığım an muhteşemdi. Öğrenciler arasında arama yapmak için adımı yazdım ve sayfa “Yükleniyor…” ibaresiyle takılı kaldı. Aramayı tekrar tetiklemek için son harfi silip tekrar yazdım, ama ekrana bakamadım. Gözlerimi kapattım, gerçekten, ve cesaretimi toplayıp açtım. İçinde adım geçen bir sonuç vardı. İnanamadım, o yüzden az önce yaptıklarımı tekrarladım: adımı yazdım, gözlerimi kapattım ve tekrar açtım. Pardus’a stajyer olarak seçildiğimi öğrendiğim andan çok da farklı değildi. Yüzümdeki gülümsemeye engel olamıyordum, heyecandan titriyordum. Hiçbir şeye tepki veremeyecek kadar kilitlenmiştim ve bolca terliyordum. Kendime sürekli nefes almam gerektiğini hatırlatıyordum. Elimi telefona uzatım birkaç dakika önce görüştüğüm annemi tekrar arayıp anlattım. Bu iki buçuk dakikayı hayatım boyunca hatırlayacağım.


Passion of Google Summer of Code

It was an epic moment when I was checking the accepted projects for Google Summer of Code. I typed my first name and searched through students. The page stuck “Loading…” I erased the last letter ‘r’, and typed it again to trigger the search once more. I literally closed my eyes, and prayed, and dared to open. There was a result, with my name. I couldn’t believe, so I repeated my last process: typed my name, closed my eyes, and opened again. It was not so much different the moment I was selected for internship at Pardus. I could not stop myself from smiling, and I was shaking, a lot! I was shocked, and constantly reminded myself to breathe. I hit the redial button on my phone, told my mom. I will remember that two and half minutes forever.