Categories
University

Microtalks at the Computer Science Christmas Bash!

As some of you may have read on Rob Miles’ blog, I will be running one of the events at the Computer Science departmental bash this year. The event is called Microtalks and gives any student who wants to be involved 5 minutes in front of an audience of their peers. The time limit, along with a limit of 4 power-point slides mean that each students presentation will be short, snappy and interesting.

The idea of Microtalks is to get both students and lecturers here at the University of Hull sharing knowledge and success with one another, as an extension of the Hull Comp Sci Blogs initiative. Examples of things people could talk about include:

  • Talking about an open source project they’ve contributed to
  • Talking about a game or piece of software they have produced
  • A cool bit of technology they have discovered, like a new programming language or methodology
  • Anything, in fact, to do with technology!

I will be talking about my recent contributions to LibreOffice, which you can read about here.

All participants will be getting prizes provided to me by Microsoft through the Microsoft Student Partner Program, a big thanks to Rebecca Moore and Phil Cross for their contributions. There may be some even better swag for the most interesting talks 😉

If you want to talk about something cool in front of your fellow Computer Scientists sign up by clicking here, more information about the event including the time and location can be found on Rob’s blog here.

I hope to see you all there, if not to present yourself, then to listen to your friends and peers!

Danny

Categories
Computer Science Conferences Software Engineering

LibreOffice Bug #67159 or The Story of my first foray into Open Source

A few weeks ago, when I was at Campus Party: Europe, I attended a fascinating lecture by Michael Meeks about LibreOffice. Whilst his talk was mainly about getting people interested in using LibreOffice, he also suggested that people get involved in the development of open source projects. As I was interested in this particular aspect of his talk the most I put my hand up, and asked the question

How easy is it to get involved in Open Source, particularly LibreOffice?

Michael, who works at Collabora – a company which supports LibreOffice, gave a great response and asked me to speak with him after the talk. I did so, and it was at this point he mentioned the “easy hacks” list that LibreOffice developers maintain, the purpose of which is to take the fear out of getting involved in an open source project. Items on the easy hacks list should only take a few hours to complete, be simple in their nature and allow to learn about the coding standards and systems used by the project.

For those who aren’t quite as interested in productivity software as myself, LibreOffice is a Desktop Office suite which has similar functionality to that of the famous Microsoft Office package, it consists of the following programs:

  • Writer (similar to Microsoft Word)
  • Calc (similar to Microsoft Excel)
  • Impress (similar to Microsoft PowerPoint)
  • Base (similar to Microsoft Access)
  • Math
  • Draw
Michael Meeks talking about the recent addition of an iOS remote for LibreOffice Impress at Campus Party: Europe
Michael Meeks talking about the recent addition of an iOS remote for LibreOffice Impress at Campus Party: Europe

Fast forward a few weeks to the 12th of September and I stumble across an item on the easy hacks list that interests me, this item is called “Bug #67158 – FORMATTING: Add shortcut Ctrl+K (or cmd + K on OS X) for inserting hyperlinks”.  It interested me because it seemed like it would be relatively simple to add, it’s just an event handler after all, and it was marked as “Medium importance, enhancement”, this meant it was both considered more ‘important’ than some of the other easy hacks, and it was more likely to impact on users as it was an enhancement people could actively see as opposed to code formatting changes (which, of course, are equally important, just less visible to users). Another interesting aspect of this bug was that it affected Writer, Calc and Impress, and my changes would be useful to everyone who used these programs, whether they used Windows, GNU/Linux or Mac OSX as the event would work on all 3 major operating systems.

I clicked through, from the list, to the Bugzilla entry for the task and assigned the task to myself and left a comment showing my interest in taking it on.

The next thing I had to do was boot into my Fedora GNU/Linux operating system and set to work on making the development environment in which I would make my changes, This is an area in which GNU/Linux, particularly its package system, really comes into its own. To install every single resource I needed to work on the project, from libraries to images, I just had to to type

          $ yum-builddep libreoffice

Following this I just had to download the latest version of LibreOffice from their Git repository and run a shell script which dealt with everything else. It was really easy to do following this guide.

Now all I had to do was add in the event handler, and ‘fix the bug’ so to speak. Simple right? Well, sort of. LibreOffice has 7,075,071 lines of code (according to ohloh.net) so finding exactly where my fixes should go, and what exactly I should be writing to invoke the Hyperlink Editing and Insertion Dialog was a daunting task. Fortunately because my bug was assigned to the easy hack list some regular contributors to the project had left some pointers on what to do. Petr Mladek from Suse pointed me in the direction of the file which I needed to edit in order to add an event handler.

I played around with the file, finding out what the various variables did and meant and decided to swap around what Ctrl + C and the delete keydown events did, in order to see how easy it was to edit a pre-existing event handler — It was at this point I ran into my first issue.

When I attempted to build my changes it worked, however, when I ran LibreOffice Ctrl+C still copied things, and delete still deleted things. I was flummoxed. Thankfully when I reached out to Petr for help he was happy to provide it, it turned out I was providing the compiler with flags that meant it would ignore the changes I had made, with this knowledge I managed to get delete to copy things and ctrl + c to delete things, useless and in fact harmful changes, but a great test.

Having reverted the aforementioned events to do what was expected, I added in an event for Ctrl+K, using the same code style and formatting as the other event methods. To check the event was firing I made Ctrl+K Select all text in a document. Brilliantly, it worked first time.

I then set out the find what I would need to call in order to invoke the hyperlink editing dialog. This was made a lot easier by a really awesome utility LibreOffice has implemented called OpenGROK. OpenGROK allows you to search through all of LibreOffice’s code, instantly, using a web interface. I quickly found the method I needed to invoke to call the HyperLink Editing Dialog and added it to my code and compiled it. It worked! Awesome. My first patch to LibreOffice was ready to be submitted for review.

A review, in the context of open source, is when one of the project maintainers — kind of a manager of the project — looks over your code, ensures it does what it says it does and that it doesn’t break anything else, and then implements it into the main branch of code. At this point your code is part of the project and will then be made part of the next update which will be made available to the 150 million people who use LibreOffice! (thats over 100,000 downloads every day).

The LibreOffice Hyperlink Dialog in the Writer Application. Think of me when you invoke this using Ctrl + K!
The LibreOffice Hyperlink Dialog in the Writer Application. Think of me when you invoke this using Ctrl + K!

Today my code was accepted into the main branch. It’s really exciting to think that soon over 150 million people, and possibly many more in the future, will be using some of my code. I can’t wait to contribute some more, not only to this project but to others too!

You’ll be able to download my fix as part of LibreOffice 4.2, the release dates for which you can see here.

Danny