10 February 2010

Merge/split PDF files directly in Dolphin (KDE)

KDE logo

Context

I have just switched to KDE after using Gnome during many years, and I am quietly getting used to it.

But recently I had to merge 2 PDF files, so I searched for a good solution for KDE. There are many command-line tools to do this on Linux, but the few graphical interfaces are very ugly.

So I thought it would be great to integrate a merge/split PDF function directly in Dolphin, the KDE file manager. In dolphin when you right-click on a file, a menu pops up with a sub-menu “Actions”, where you can add your features. I will now explain how I did this.

Prerequisites

  • You need to be running a recent version of KDE (using Dolphin as your file manager). I have the version 4.3.5.
  • To manipulate your PDF files, you need a command-line tool, I chose pdftk. You can install the package pdftk on kubuntu, for example by typing in a terminal:
    sudo apt-get install pdftk

Create scripts to merge/split PDF files automatically

I created two scripts: one to merge PDF files, and the other one to split them. I put both files in the directory /opt/pdf-service:

  • /opt/pdf-service/pdf-service-merge.sh (download):
    #!/bin/bash
    # Run a command to merge PDF files
    # Used to add a context menu in Dolphin for PDF files
    
    pdftk "$@" cat output "${1%.pdf}_merged.pdf"
  • /opt/pdf-service/pdf-service-split.sh (download):
    #!/bin/bash
    # Run a command to split PDF files
    # Used to add a context menu in Dolphin for PDF files
    
    for file in "$@"
    do
       out_dir="${file%.pdf}_pages"
       mkdir -p "$out_dir"
       pdftk "$file" burst output "$out_dir/page_%04d.pdf"
    done

Here are the steps you need to follow to get these files properly on your computer:

  • Create the /opt/pdf-service directory: type in a terminal:
    sudo mkdir /opt/pdf-service
  • Download the two files in the directory: type in a terminal:
    cd /opt/pdf-service && sudo wget http://www.viesurip.fr/wp-content/uploads/2010/02/pdf-service-split.sh http://www.viesurip.fr/wp-content/uploads/2010/02/pdf-service-merge.sh
  • Make the files executable: type in a terminal:
    sudo chmod a+x /opt/pdf-service/*.sh

Add the service to Dolphin

A service in Dolphin is declared using a simple .desktop file in the directory /usr/share/kde4/services/ServiceMenus/: Here is the file you should put as /usr/share/kde4/services/ServiceMenus/pdf-servicemenu.desktop (download):

[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=application/pdf
Actions=split;merge;

[Desktop Action split]
Name=Split PDF pages
Name[fr]=Découper les pages du PDF
Icon=gnome-mime-application-pdf
Exec=/opt/pdf-service/pdf-service-split.sh %F

[Desktop Action merge]
Name=Merge PDF files
Name[fr]=Fusionner les PDFs
Icon=gnome-mime-application-pdf
Exec=/opt/pdf-service/pdf-service-merge.sh %F

To install this file, just type in a terminal:

cd /usr/share/kde4/services/ServiceMenus && sudo wget http://www.viesurip.fr/wp-content/uploads/2010/02/pdf-servicemenu.desktop

Conclusion

Now you just need to close all opened windows of Dolphin, launch it again, and you should see the menu entries in the Actions submenu when you right-click on a PDF file.

The entries are only available in English and French in my file, but you can easily add another language in the pdf-servicemenu.desktop file.

It would be great to have an user-friendly interface to install packages that add useful submenu entries like that! Some sorf of Dolphin extensions…

No Comments yet »

14 December 2009

Django better than a CMS?

Django logo

I recently had to rewrite a website I’m maintaining for a very small business: Le fil à soi. They are 3 teacher who offer courses of chinese massage, qi gong and Gestalt therapy in Bordeaux, France. The requirements for the website are quite simple:

  • presentation of the place, the people, and contact information
  • pages for all courses sorted in categories
  • automatic management of courses dates display and RSS feed generation
  • simple backend to modify courses information (should be used by the teachers, although they don’t really like computers and prefer sending me an email…)

The version I wanted to replace was a hand-made PHP website. I started it years ago when I knew little about websites technical design, so it had become really messy and complicated to maintain. I considered letting someone else maintain the website, so I needed a cleaner version.

Using a CMS: Drupal or WordPress

A CMS (Content Management System) is a platform that makes building a website easy. WordPress is particularly intended to create blogs, but there are plenty of plugins that enable to create any type of websites. Drupal is really made to build websites of any type. There are plenty of plugins too that address about every possible needs (calendar, online shop…)

The strength of these CMSs is that they manage the two parts of the website: the user part, and the administration part. The administration part gives you many simple ways to personalize and watch the user part.

I started two small prototypes using these CMSs and came to the same conclusion: none of them perfectly addresses my very simple needs.

For example for the courses dates managment: plenty of plugins do something close enough to what I want, but none do it exactly. So I will have to personnalize a plugin, probably without real documentation of the code. This plugin will then be updated (without documentation again) by its author, and I’ll have to maintain my changes again and again…

It’s the same for the theme: plenty of themes are available but I can’t seriously download and use a design without customizing it.

So I can make my very simple website using a CMS but:

  • the result will be huge, with plenty of features I won’t use (no blog, no users management needed…)
  • it will be difficult to maintain, and I will have to watch updates to the plugins I have customized
  • I will have to make regular updates when the CMS is updated, because known security flows of well-known CMSs are rapidly used by “hackers”

This is a lot of work for such a small website.

Using Django

Django isn’t really a CMS. It’s a Python framework to build websites (comparable to PHP Zend, Ruby On Rails…). So it means that you have to actually write code to use it.

The huge difference with other web frameworks is that Django has originally be developped for a news website, so content management was very important. That’s why an impressive feature is available: an automatic administration generation.

I just had to define my models (what a course is, what a teacher is, what a date, a category is). Then it was mapped to my database and the administration part was generated. I finally defined my views, that is to say the way these models are displayed to the users (with simple tools to generate RSS feeds, sitemaps…)

The advantages of this approach are:

  • the final application is very small, no useless features
  • you get exactly what you want, you haven’t to adapt to random plugins found on the Internet
  • you know perfectly what each line of code does (even if you don’t document it…)
  • the only updates you have to watch are Python and Django updates, that are rare and usually well managed

The only possible drawbacks I see:

  • There are much fewer people who are used to Python Django than people who are used to WordPress, so it will be more difficult to find maintainers (but they will be better :p)
  • Python has to be properly supported by you host. I use OVH, that supports Django only in CGI, but it’s okay for such a small website.
  • There is no WYSIWYG editor by default in Django-generated administration: this can be bad to edit articles (or courses descriptions for me). But it’s fairly easy to add TinyMCE as it’s purely javascript.

Conclusion

If you want to create a simple full-featured blog, use WordPress. If you want complicated features like an online shop, use Drupal.

But if you want to build a simple, dynamic and easy to maintain website, and coding doesn’t scare you too much, use Python Django. You will get exactly what you want, without much efforts, and the result will be very easy to maintain.

Le fil à soi website main page

Le fil à soi website main page

Le fil à soi pages administration

Le fil à soi pages administration

No Comments yet »

24 September 2009

Jolicloud internship: first steps of a start-up

Jolicloud internship: first steps of a start-up

I just finished my internship at Jolicloud as part of my studies in TELECOM Bretagne. It lasted almost one year.

Jolicloud is a new start-up created by Tariq Krim (who created Netvibes) that builds an operating system adapted to netbooks and focused on the web technologies and services.

I lived from the inside the launching of a start-up: idea, research, launching of a private alpha, founding, arrival of big competitors (like Google Chome OS), hiring, beta and release roadmap… We were three at the beginning: Tariq Krim, Romain Huet and me.

Regarding development, it is an interesting challenge: transform a Linux distribution into an ergonomic and beautiful operating system based on web technologies instead of the usual Linux technologies (HTML instead of GTK, Javascript instead of C…).

We use Ruby On Rails and JQuery to develop the central web application that constitutes Jolicloud and python to make our web application communicate with the system.

First developments were focused on two things: modify Ubuntu to transform it into the Jolicloud OS, and create an applications directory like the one on the Apple iPhone, to install/remove/update applications in one click. This directory is based on APT, the technology used by Debian (and Ubuntu) to manage files on the system. And Prism has been fully integrated to put web applications (Google Docs, GMail, Facebook…) on the desktop.

The currently available version of Jolicloud is far from complete: it is just an idea of what we want to do. Developments go faster now and we have plenty of ideas I can’t talk about. Sadly I have to go back to school for my 3rd year at TELECOM Bretagne, but I hope I will still be able to participate in Jolicloud.

While Google Chrome OS will probably only allow to launch web applications, local applications can be used with Jolicloud. And Jolicloud wants to integrate all web services, not only Google ones… And Moblin isn’t really focused on the web. Personnally, I would like the Jolicloud concept on my notebook too, if the interface were adapted. So Jolicloud probably has a bright future… to be continued :)

1 Comment »

6 September 2009

The Internet in 2015: privacy in the cloud?

A lock

Saturday, September 26th 2015,

The Internet has evolved a lot in the last 5 years. In 2009, using online services meant trusting third-party services to keep your data safe. For example Facebook knew everything about your activities and your friends, Google Docs had all the documents you collaborated to, Gmail had all your emails… All these services had quite unclear terms of services. They claimed that they wouldn’t use your data in wrong ways but they used it to display targeted ads. And you could never be sure that they wouldn’t lose your data or get hacked. This trust problem made difficult to use cloud services systematically, though their advantages were becoming obvious.

Now this problem has been at least partly fixed thanks to Internet Service Providers. My situation is very common: I have a very fast and symmetrical optical fiber connection. My Freebox v8, my new Internet box, is always connected to the Internet and includes a server that hosts all my personal data and data from other members of my family. Our family computer, my personal notebook, my Jolicloud netbook and my IPhone are constantly synchronized to the hard disk of our Freebox (through our private network or through the Internet).

The server of the Freebox consists mainly of an HTTP server with a web interface, and many APIs. A web interface is available for each member of the family at http://nickname.free.fr. Mine is at http://twisterss.free.fr. It resembles a personal blog with many social features.

This URL also is the key to my digital life. It is used by many websites to access the APIs of my Freebox using OAuth. Facebook stores the messages, links, pictures and videos I share on my Freebox using these APIs. My freebox has the authorizations to access data of my friends too. They all have an unique URL like mine, giving acces to the same APIs. First Facebook didn’t want to use this architecture because it made them lose control over the data of their users, but seeing new competitors growing rapidly using this new architecture made them change their mind. Now they even have developed a proprietary plugin with a special API extension that is more rapid and makes more features available than the default one. I could install it on my freebox in one click, but I prefer the default open-source one, as I’m not really sure what the closed-source Facebook plugin does. Now the value of Facebook is in the way they sort data to show the most interesting, and in all the third-party applications available to manage one’s digital life. And they don’t have to pay for the huge servers they used to have for pictures and video uploads, as they are directly sent from the user’s server.

Google uses this architecture a lot too: it searches both in my friends’ data and on the Internet, and can even tell me when some friends made searches related to mine (if they agreed to make it public, obviously). As Facebook, they propose a proprietary plugin that indexes data more efficiently. Jolicloud uses my private server to synchronize apps and files on all my netbooks, and to propose me applications my friends like.

With this architecture, users have a much better control over their data, as it is stored on their private server, and most of the time only meta data is sent to the websites (links and descriptions for Google or Facebook…). All data is synchronized on all computers, so it can be restored if a hard disk fails. Data sharing is made much more efficient and fast as it isn’t sent to a central server. But this architecture isn’t perfect: if users install malicious plugins on their box, or if they give access to their data to any website through OAuth, then their privacy is still threatened.


This idea of the future is the Internet that I would like to use in 2015. For this to happen, we would need to find standards for the APIs that everyone accepts, and web services like Facebook would have to understand the importance of privacy. ISPs probably have interest to make this happen as they would play a much more important role on the Internet. But only users can make this happen if privacy really matters to them.

2 Comments »

11 January 2009

Let’s replace Facebook by blogs!

Many people who have blogs say that it’s their main social network. They interact with the commentators. They discover their blogs and enlarge their network of interesting blogs.

The interesting fact about blogs is that they aren’t centralized. So the blogger controls the information it publishes. Whereas in Facebook, only Facebook controls the information you publish. I think that with a few more functions and a dedicated interface, blogs could replace Facebook.

More opened an decentralized discussions

When someone starts a discussion on a blog, it would be interesting if other bloggers could continue the discussion in both their blog, and the original blog. Trackbacks are used for that now, but they are very too limited.

The best would be that your comment on the original blog transforms into a post in your blog, ande discussion would then continus simultaneously in both blogs. The audiences of both blogs would be merged and the discussions would become more interesting.

A Facebook-like administration panel

Many blogs already have a list of top commentators, a list of the most interesting blogs… But to transform a blog into a social network, we would need a list of commentators like the list of firends in Facebook.

It would be interesting too to be able to follow from the administration panel the last posts in the commentators’ blogs, like a Facebook news feed.

Plugins to manage pictures, events… would easily replace the most interesting Facebook functions. And we would have a decentralized network, where the users could control their data.

We could too imagin a platform like Wordpress.com that would allow you to create a social blog as easily as you now create a Facebook profile. Myspace or Skyblog have features that look like social blogs, but they don’t allow to host a blog on an external host, or to have decentralized discussions.

Realisation?

I’m hesitating to create a wordpress plugin and perhaps a small social blogs platform. Perhaps ideas like that already exist?

Il est évident que cette vision des blogs ne serait pas adaptée à tous les blogs : les blogs thématiques par exemple n’ont pas grand chose à voir avec les réseaux sociaux.

Obviously social blogs couldn’t completly replace all usual blogs, but only the ones focused on the blogger.

But I think blogs could be a more interesting, more open, and more secure social network than Facebook, because we could use our own host for our data.

3 Comments »

28 September 2008

Multilingual Wordpress blog

[lang_fr]Drapeaux multicolores dans un temple à Darjeeling en Inde[/lang_fr][lang_en]Multicolor flags in a temple in Darjeeling, India[/lang_en]

This blog uses the Wordpress blog platform. All articles are available in French and English, and the interface of the blog is fully translated.

To do this, I use the qtranslate plugin. It enables to write easily articles, tags and categories in multiple languages. Default Wordpress widgets are also supported.

Use

The plugin modifies the administration of Wordpress by adding a field for each language for articles, tags and categories. For the rest, you have to use a very simple tags system: [ lang_en]English text[ /lang_en][ lang_fr]Texte français[ /lang_fr]

I use too on this blog many other plugins (for the widgets on the right for example). I had to slightly modify almost all plugins to support the languages tags system. You just need to add a call to the __() function – used in Wordpress to translate the interface using .mo files – to translate the strings before they are displayed using the languages tags system.

To enable users to switch from a language to an other, the plugin provides a widget to display. I rather liked to add the links on the top right of the page by inserting <?php echo qtrans_generateLanguageSelectCode('both'); ?> in the header of my template.

Improvements

For now, qtranslate doesn’t provide any system to detect the user language. I added on my blog a message that shows below the header if there is a more adapted translation of the blog available for you.

To do this, I inserted in the header of my template the PHP code in this file.

2 Comments »

Tiny6 – IPv6 in sensor networks

[lang_fr]Capteur MicaZ[/lang_fr][lang_en]MicaZ sensor node[/lang_en]

During the semester I spent in India from January to June 2008, I participated to the Tiny6 project between TELECOM Bretagne in France, the Indian Institute of Technology Guwahati (IITG) and an university in China.

Goal of the project

Sensor networks arenetworks of small nodes that communicate through a wireless link. They often use their own protocol to communicate together and with a machine that fetches data and makes them available on the Internet.

IPv6 is the next version of IP, the Internet Protocol. This new version provides much more adresses than the present IPv4.

All these adresses enable us to give a specific IPv6 adress to each mote in a sensor network, and to let them communicate through the IPv6 protocol. This allows us to simplify the network and make it more reliable by using many bridges between the sensor network and the Internet.

But IPv6 is made to be used with normal computers, while sensor nodes have very limited memory and computing ressources. So it is necessary to create a light protocol, this is what the 6lowpan working group has done.

In IITG, Alexandre, Antoine and me wanted to make this light protocol work on precise sensor nodes, and to let the nodes communicate through IPv6 with TELECOM Bretagne. We used the Matus Harvan thesis, a partial implementation of 6lowpan (IPv6, ICMPv6 and UDP are partially implemented) in NesC, a language used to program the motes, but for different motes.

Difficulties

The first difficulty was to understand how the motes and the Nesc language work. Nesc is a language derived from the C used to minimize the memory and CPU use. To program the motes, we used a base plugged in our laptop through USB. We used an adapted version of Xubuntu, XubunTOS in a virtual machine as an environment to program the motes and to connect them to the Internet.

We have then adapted the code of Matus Harvan to let it work on our motes, less powerful than the ones he used. Debugging the motes was a bit complicated because we had only 2 leds to make blink to know what was happening in the motes.

Finally we had to set up an IPv6 link between TELECOM Bretagne and the IITG. It proved to be complicated because the IITG had IPv6 adresses, but the routers of its access provider weren’t compatible. So we had to establish an IPv6 over IPv4 tunnel.

The most complicated in this project was to communicate with our indian supervisers. Many mutual misunderstandings made us waste a lot of time. It has for example been very complicated to get a routable IPv4 adress to communicate with TELECOM Bretagne. We had to work in the computer center, and the adress was only allowed to communicate with one server in TELECOM Bretagne.

Results

We finally managed to make the sensor motes communicate through UDP with TELECOM Bretagne, and send their measured data. But our will to make the network simpler was made difficult by the use of an IPv6 over IPv4 tunnel between the IITG and TELECOM Bretagne, and a NAT between our virtual and real machine:

Schéma de la connexion des capteurs au réseau IPv6

2 Comments »

7 July 2008

A semester in India

[lang_fr]Maisons dans le désert en Inde[/lang_fr][lang_en]Houses in the desert in India[/lang_en]

I just spent a semester in the north-east of India in Guwahati (Assam). I was in the IITG: Indian Institute of Technology in Guwahati. I was there from january to june 2008.

Studies

This travel was an exchange with my school in France, TELECOM Bretagne. It is considered as a normal semester during which I studied computer science (Software engineering) and signal processing (Signal processing in smart antennas). We were 3 students of TELECOM Bretagne in this exchange. We were too part of a project about the implementation of IPv6 in sensor networks, but I will tell more about it in a later post.

Travel, holidays, discovery

Tgus semester was an occasion to discover India and Indians. We travelled a lot during our free time. We went to Darjeeling, in the Rajasthan and on Andaman islands. You will find more information and pictures of our adventures on the blogs of the 2 students who were with me: Alexandre and Antoine (in French).

No Comments yet »

10 June 2008

My UWA widgets

[lang_fr]Widgets UWA : write once, run everywhere[/lang_fr][lang_en]UWA widgets: write once, run everywhere[/lang_en]

I am yet migrating to this blog all the projects I maintain. As part of this process, I just migrated all the UWA widgets I created.

UWA widgets are tiny web applications that can run on platforms like Netvibes, IGoogle, Live.com, Opera, the Vista sidebar or the Apple dashboard.

I describe all these widgets in the category "UWA widgets".

Don’t hesitate to try these widgets, and please tell me in the comments on the page about the widget if you encounter problems.

No Comments yet »

1 June 2008

TvOnResEl: watch TV on your computer easily!

[lang_fr]Logo de TvOnResEl[/lang_fr][lang_en]Logo of TvOnResEl[/lang_en]

As I arrived at TELECOM Bretagne, I discovered the ResEl : the students’ network. I discovered too that they were broadcasting all free TV channels on the network. The problem : the recommended software to watch these channel was VLC, a very powerful media player, but very complicated to use and not really adapted to watch TV.

So I decided to create a Java multiplatform open-source piece of software that controls VLC with a more adapted interface: TvOnResEl. I released the first version the 16th of october 2006.

In its present version, TvOnResEl allows to watch and save TV, program savings and browse the TV program.

For more information about TvOnResEl, go to the page dedicated to the project.

No Comments yet »

  • Welcome!

    I write on this blog about my projects, my practices and my discoveries in the domains of the internet, networks and computer science.

    Tristan, French student in TELECOM Bretagne, a "grande école" specialized in telecommunications

    Contact me Twitter Facebook

    Read more »