Librehat's English Blog

There is something amazing!

Two Months in TCD

I’ve been studying in Trinity College Dublin (TCD) for about two months. The master course is very intensive here, which reminds me of the the third undergraduate year in China.

To be honest, I did’t like mathematics at all, especialy those partial equations. What a headache! And how brave I am to study master in the School of Mathematics! Well, that misery was in the past. I mean the math is still difficult for me, it just somehow makes me interested. After all, it doesn’t count as a bad thing.

It’s true that some assignments are very easy. Meanwhile, there is always at least one problem that consumes a lot of time and efforts to figure it out. And that’s good for learning from my point of view. If it’s too easy, then it’s wasting time. While it’s pointless if it’s too hard. Thus, so far so good.

However, being a foreigner is not easy for me. House renting, bins collection service, GNIB card, re-entry visa, water charges application, etc. I even assembled my bed frame and the dining table along with four chairs! Those things will never happen if I stay in China. But that definitely enriches my life, in a way. :D Feels more independent now.


Resize Partitions in ODROID MicroSD Card

I purchased an ODROID-U3 (Community Edition) from HardKernel a couple of days ago. It runs much faster than what I expected. Anyway, I’d love to share my experience related to this board. So, here we go. The first chapter: Resize partitions in the microSD card.

Requirement

  • A functional Linux* device (ODROID-U3 itself doesn’t count)
  • A microSD card reader

*: Other UNIX-like OS may do the work as well, but I didn’t test it.

Procedures

Let me write the procedures in advance.

  1. Back up the data from microSD card partitions.
  2. Using fdisk to modify the disk partition table.
  3. Make new partitions
  4. Restore the data

Why don’t we just use resize2fs? Because I need to enlarge the first partition whose format is vfat. So I have to move the second partition right, which means changing the second partition’s header. I don’t know how to manage that, so let us just go the old-fashioned way.

Read on →

Yahoo! Weather for KDE Plasma Desktop

The default weather plasmoid stop working many times. :–( So I just decided to write a new weather widget in QML. Aims to be a fast and reliable alternative.

Yahoo! Weather Widget

Yeah, the name is Yahoo! Weather Widget. Just to clarify that it’s not an official Yahoo! product. It implements Yahoo! Weather RSS API though.

QML is great but lacking of many essential elements in Qt 4. I’ve seen huge improvements in Qt Quick 2.0 which is part of Qt 5. So, hurry up! KDE Frameworks 5 and Plasma 2!

You can check this plasmoid on kde-apps. Please, feel free to comment.

Contribute to

If you speak languages other than Chinese and English, please consider contributing to this widget’s translations.

  1. Download pot file
  2. Rename it to a po file
  3. Edit it using a tool like Lokalize or just a normal text editor
  4. Send it back to me via Email (find it in About) or whatever you like

The best way to contribute to this project is to fork this project on GitHub! Modify and send me pull requests.


Play APE Files in Linux with Amarok

Although I personally prefer FLAC than Monkey’s Audio (APE), some audio files are in latter’s format. It’s easier than you may expected to play APE files in Linux.

Player Using GStreamer as Backend

Audio players including the super famous Amarok and Banshee are using GStreamer for decoding. Now let me take Fedora as an example. Just install the RPM package gstreamer-ffmpeg and voila!

su -c 'yum install gstreamer-ffmpeg'

Player Based on MPlayer

SMPlayer, UMPlayer are in this list. Nothing special you need to do. It’s already there. Play your favourite track now!


Plasma Applet about China Air Quality

Actually I’ve uploaded this plasmoid to kde-apps since about two months ago. The applet does support English and Simplified Chinese. However, the api returns only Chinese strings, which makes this applet looks like Chinese-only.

Thanks for PM25.in’s free API. Now you can check the city’s air quality index (AQI) in mainland China, just in your favourite desktop environment.

The applet is totally open-source and free for everyone. You can check the source code on Git@OSC.


Radeon Dynamic Power Management Control Plasmoid

After nearly a week silent, I’m back with a new QML plasmoid for your KDE 4.x. Though I regarded it not as very helpful… :)

I think you probably know that AMD open-source Radeon driver has already supported dynamic power management (DPM) since kernel 3.11. Like the old lousy power-profile management, it’s controlled by things like echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level. Not a big deal, but inconvenient if you got a laptop and need to control it frequently. Yeah, it won’t automatically switch to performance from battery when your laptop’s ac plugged, or vice versa.

Thus, here is the plasmoid applet I cooked today, it’s premature but capable. Although a few things I should mention here.

  1. Display may be incorrect after switching forced performance level.
  2. Buttons won’t adjust their height, hence it’s ugly if you resize the widget to a taller one.
  3. QML doesn’t support access to external files directly, so the method is dirty and you might not like it.

Well, if you want to know, I’ll talk about the implemention of write and read in QML.

Read

Thankfully, /sys/class/drm/card0/device/power_dpm_force_performance_level is a plain text file, at least it can be treated as one. So I use XMLHttpRequest to read this file. @_@ I told you that you won’t like it.

Write

We tend to use echo to write into DPM files, so just go on, use plasmoid.runCommand to execute echo.

I really appreciated aseigo in #plasma IRC chanel to help me figure this out. Just to blame KDE documentations for putting plasmoid API stuff under Javascript sector so I can’t find these in QML sector.

Before use runCommand, one should add LaunchApp as a required extension in metadata.desktop file.

X-Plasma-RequiredExtensions=LaunchApp

Basically, plasmoid.runCommand(exec, [,argsList]) equals exec args1 args2 args3 etc.


Things I Learnt from Making Plasmoid Kdictionary

I was busy making a KDE plasmoid named kdictionary recently. And I found myself actually learnt a lot through this process.

QtQuick

Of course. I never programme in QML before but now I am a big fan of it. It’s very easy to get start and cook couples of small applications. Although I used QtQuick 1.1 from Qt 4.8, I recommend you use QtQuick 2.0 from Qt 5 for the sake of convience and new Qt magic.

Qt

Haha.. Qt is another thing. I start another project kdictionary-lingoes to port LingoesLD2Reader.java to C++ realm. Well, Qt provides tons of useful and powerful libraries which you definitely need outside of standard C++.

Hmm.. I have to mention that function QString::toStdString() actually implements toascii(), which result in losses of some unicode character. To fix that, you need to use std::string() to wrap the data of QString. i.e. std::string(getDef(input).toUtf8().data())

KDE Plasmoid

Out of question. I made plasmoid of course I knew something new from it.

The configuration dialog UI file is config.ui, use QtDesigner to finish design work. Make sure that the name of checkbox or some control stuffs like that has a prefix kcfg_ (Just check what I done in kdictionary). Because that will let Plasmoid and QML do a magic work to integrate the UI file and the configuration data file main.xml.

Oh, use plasmate to cook your plasma-stuffs. But remember that tool has a lot of bugs and TODOs. :–)

REALLY looking forward to taste KDE 5 and Plasma 2. (some annoying problems are only fixed in Qt5, along with many long-waited functions.)


Migrated from Blooger to Octopress

I’m proudly to claim this to you, my friends, that my English blog has migrated from Blogger to Octopress.

One drawback of this migration is the loss of comments. If you want to check that legacy, please check the old blogger.

Except from that, Octopress provides a really fast and responsive blog-aware service. And I believe you have already noticed that. :D

More details? I’ll update this post tomorrow. It’s night here. So, Good night. :–)

Why Octopress

  • It’s static! FAST than ever. No databases, no php, only HTML, CSS and some javascripts.
  • More secure! I don’t need to worry about any violent attack which may get my administration password. There’s not such a thing.
  • It supports markdown and HTML as well. Markdown is something that every hacker must give a try. Elegant and easy-to-read. Don’t want to write blog in Markdown? All right, HTML will serve as well.
  • It’s in active development.
  • What’s more important? It’s open-source and totally free.

Demerits

  • As I mentioned yesterday. Migration causes comments loss since I don’t know how to import comments to Disqus.
  • Need more involvement than Blogger, WordPress, etc.
  • Dynamic contents are not very easy to be inserted.

Why OpenShift?

  • OpenShift provides much more freedom and capability than Github Pages.
  • Deployment is easy, not as easy as to GitHub Pages, though.

How could I deploy Octopress on OpenShift?

I just follow the instructions on this blog. But there are something I have to emphasize.

  1. If you use branch 2.5 of Octopress, please use my Rakefile instead of original one or Reza’s.
  2. Still. You need to make alterations based on my Rakefile. But there is no need to fill in rsync settings coz we use git.
  3. Remember to change _config.yml!
  4. Once you change a theme of Octopress, you have to re-install it to make it work.

Right… Which editor to edit markdown files? I’m using Kate which supports Markdown highlighting by default.