Writing my First KRunner Plugin ft. MySQL Connection

Finally managed to make a KRunner plugin linking my Web Tech 2 project’s database. It allows the user to search the database from anywhere.

Quick Recipe KRunnerIt is really easy to do it. I followed this guide from KDE website: http://techbase.kde.org/Development/Tutorials/Plasma/PythonRunner

To make it access the database, you need to import the Python/MySQL connector

import mysql.connector

We write the codes to query the database and send the results to KRunner. q contains the text the user input.

Writing KRunner plugin with MySQL query
When its done, we compile it and install it:

plasmapkg –type runner –install ./

It’s done 🙂

Here’s the source code: qr_runner

Voting in Mauritian Municipal Election

This is the first time i went voting. I was quite surprised that they don’t ask for National Identity card when you go in the voting centers. They just ask you your name and 2 persons remove your name from their lists.

I didn’t know anyone whom i voted. Just recognized the famous symbols and gave them votes according to the pamphlets they were distributing. Some pamphlets were just some abstract words and editorials. I tend to ignore them.

Write what you will do point wise! I am NOT interested in reading long editorials about frauds and mismanagement and promises about a better management. Say WHAT you want to do and HOW will you do it!!! >.<

Anyways, whosoever get elected, wish you best of luck. Don’t forget to

1. Listen to the people

2. Work hard for the people, not for your own pockets

We would be grateful 🙂

Making My First Android App: Mera Calculator

Made a tiny calculator in a jiffy. Nothing fancy in here to see. Just seeing how the platform works 😉

Mera Android CalculatorMaking the interface:-

Adding Buttons:-

All you have to do is drag the item you want to the specific place you want them to be like in VB.NET

Android SDK on Eclipse User Interface

Adding function call to the buttons:-

Switch from the graphical view to xml view. Add this attribute in the buttons inserting the name of the function to be called.

XML view of Android buttonI added this attribute in all buttons.

Writing the Back-End:-

The number button handlers:-

Now we create methods in java file found in /src folder. Each button when pressed will concatenate the number or arithmetic operation they do and display it in a TextView named “textView1”.

The calculate function:-

We get the string in “textView1” and try to parse it in a function to get a result. The result is then casted as string then the TextView which will display the answer finally displays it 🙂

The program is very buggy and cannot calculate e.g. + and – at the same time. But at least i got a program running in Android 😛

Here are the source codes. The .apk file is found in bin folder: MeraCalculator