Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Saturday, August 6, 2011

Qt Programming in Malayalam Part-2

Before reading this tutorial, read my previous post "Qt programming in Malayalam" if you have not read it yet.
    Have you ever wonder about easy switching from English to other languages such as French, Spanish etc. in software applications? Even though Malayalam switching is rare, translation is possible in Malayalam as well like any other language. Qt provides an easy way of language switching by means of Qt linguist. This tutorial describe how to build a Malayalam switchable application in Qt. An easy to start tutorial is packaged with Qt Help itself. Here is a quick tutorial of how to build a Malayalam application if you have the source code of the English version. Before we start, I assume:
1) You have Qt installed in your PC.
2) You have a very basic knowledge of Qt programming. How to compile, build and all.
    If the above is not qualified, sorry, it is better to pause here and read this and resume. Suppose you have a Qt application in English (If you have not your own, a lot of examples  are there in qtdir/qt/examples. (qtdir is the directory where you installed Qt). For better understanding, I prefer an application named 'QMusicPlayer' from examples(qtdir/qt/examples/phonon/qmusicplayer). You can take other examples as well. Open qmusicplayer.pro using Qt, then build and run it. You will get a minimal musicplayer in English. Now our aim is to make the malayalam version of the same application.


Now we need to edit two files 'main.cpp' and 'qmusicplayer.pro' as follows:

main.cpp

#include

#include "mainwindow.h"
#include

//![1]
int main(int argv, char **args)
{
    QApplication app(argv, args);
    QTranslator translator;
    translator.load("malayalam");
    app.installTranslator(&translator);

    app.setApplicationName("Music Player");
    app.setQuitOnLastWindowClosed(true);

    MainWindow window;
    window.show();

    return app.exec();
}

qmusicplayer.pro

QT        += phonon

HEADERS   += mainwindow.h
SOURCES   += main.cpp \
             mainwindow.cpp
TRANSLATIONS = malayalam.ts

# install
target.path = $$[QT_INSTALL_EXAMPLES]/phonon/qmusicplayer
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
sources.path = $$[QT_INSTALL_EXAMPLES]/phonon/qmusicplayer
INSTALLS += target sources

wince*{
DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout
}

symbian:TARGET.UID3 = 0xA000CF6A

Changes made in the code are highlighted. The changes in code simply add a Translator feature to your application. While running, your application will seek a file named 'malayalam.qm' which contains one to one translation of all English words used in program to Malayalam. 'malayalam.qm' is a binary file and is to be generated from a file named 'malayalam.ts'. This file is automatically generated using the command in terminal:

lupdate -verbose qmusicplayer.pro

Then the newly generated file - 'malayalam.ts' can be seen in the project directory. But it is an empty file and we need to update that file with all one to one translations. To do so, open the file with Qt linguist:

linguist malayalam.ts

If you couldn't find any command like 'lupdate' or 'linguist', most probably, you have not added the qt directory to the PATH. To do this use the following command Linux,

PATH=$PATH:qtdir/qt/bin/

directory may be different and must change it as your needs. Then use 'lupdate' and 'linguist'. If you are still stucked, check whether you completely installed Qt SDK. In Windows, if you are using Qt enabled prompt, I hope there will be no any problem.

    Now I assume you opened 'malayalam.ts' successfully in Qt Linguist. It shows all english words which translation is enabled. (Refer fig). Click on each english word in 'Source Text' list and add curresponding Malayalam translation in the 'English Translation' edit box at the bottom (highlighted on figure). Repeat the process for all words and save. Then File->Release. It will generate the binary file 'malayalam.qm' in the same directory.
    Now run the qmusicplayer application with file 'malayalam.qm' is placed in the same directory of the executable. Now you can see the malayalam version of 'qmusicplayer'.

In the absense of the file 'malayalam.qm', there will be no run time error in the program, it simply shows the english version. Similarly you can build a multi-lingual swithable version.

Saturday, July 16, 2011

LED Matrix pattern designer

LEDmatrix pattern designer is a tool used to generate matrix(2D) patterns in hex numbers for displaying LED matrix using a micro controller.

It is based on Qt framework and hence cross platform. It supports up to 16x16 matrix size. You can increase it by making minor changes in the sourcecode, but 16x16 is enough for most cases. This is done from the same pace of my previous project - ChaserDesigner. Only you need to do is that, specify the 2D pattern either manually or using the enhancing tools provided by the software. Then you can generate it's hex equivalent by a single click. A 2D pattern can be scanned either horizontally or vertically. The scanning mode can be switched in the software while making frames.

I think most of the features of the software are self explanatory. If you have any doubts, please comment. All files associated with this project are free to download.
Project source(Linux, Windows)
Windows executable
Required dlls for Windows executable

Monday, February 14, 2011

Make yourself a Qt Hacker

A presentation of Qt for beginners was held in Jyothi Engineering College for ISTE students. It was taken by me and I have just put the presentation and the associated files here and think it may be useful for those people who have attended. For any doubts, feel free to ask me.
Download files here

Sunday, April 11, 2010

Qt - Ping Pong Example


This is a simple ping pong (not game) play area example in Qt. You can modify this program to make your own arkanoid/ping pong games. I think it is useful for somebody. All files associated with the program with source can be downloaded. If you are Qt beginner like me, this example will help you how to use QTimer class and time interrupts.

Download ArkanoidArea

Monday, March 22, 2010

FEL: Introduction to MCU8051IDE


There is a lot of free and propitiatory IDEs for micro controllers. Here I like to write about MCU 8051 IDE - An open source project packaged under FEL (Fedora Electronic Lab). Intel 8051 is a standard micro controller and that's why it is essential in engineering syllabus even though some good stuffs are there in newer micro controllers from Microchip, Atmel etc. Simulating 8051 is pretty easy if you own a good 8051 IDE. There is a lot of IDEs available for 8051 simulation and emulation. But it is not a good idea to spent your valuable money for that, if such good free and open source IDEs are available. I am just coming to my point. It is about MCU 8051 IDE. It is packaged with fedora electronic lab. If you intend to stick with other OS, you need to compile the source code. Currently it supports more than 79 MCUs. Know more and how much powerful it is. I have uploaded a screencast of MCU 8051 IDE and I think it is enough to start with for a beginner who knows assembly level programming in 8051. Of course, one can write and simulate the program in C also.
Download video tutorial mcu8051.ogv.

You can view the screencast with VLC media player or any other ogv supported media player.

mcu8051IDE for Windows

Monday, December 7, 2009

How to simulate PyS60 in your PC

You can do your experiments in PyS60 without touching your mobile phone. The experimentation is easy while you set up everything in your PC. Here I am explaining how to set up the PyS60 environment in WinXP platform. I didn't try this attempt on my Linux yet. I will surely post about it if I get some good mobile stuff on Linux. This will be a boon for python developers in Nokia S60 mobile phones. But rarely it can be seen that some python scripts works neatly on simulator may cause strange responses on your real world system. I would like to here about it if you get any funny experience on your S60 device.
Download the required things:

1)Download S60_3rd_Edition_SDK_Feature_Pack_2_v1_1_en.zipfrom the following link:
http://www.forum.nokia.com/info/sw.nokia.com/id/807ec36d-0a8e-4bda-8e10-4d5e5bb4764a/S60_3rd_Edition_SDK_Feature_Pack_2_v1_1_en.zip.html


2)You can find ActivePerl 5.6.1 build 635 here:
http://downloads.activestate.com/Act...SWin32-x86.msi

3)Download PythonForS60 _1_4_5_SDK_3rdEdFP1.zip from http://sourceforge.net/projects/pys60/files/

First install ActivePerl because S60 SDK requires it.
Then install S60 SDK. Please note to install it in C:\ drive to avoid confusion.
Extract PythonForS60_1_4_5_SDK_3rdEdFP1.zip. Then you get another archived file sdk_files.zip.
Extract it again and you get a directory named 'epoc32'.
Copy this directory into "C:\S60\devices\S60_3rd_FP2_SDK_v1.1"
Then probably Windows XP asks to replace the already existing folder 'epoc32'. Click yes.
You have done. Cheers!

Saturday, October 10, 2009

Mouse gestures for Mozilla Firefox


Mozilla Firefox one of the leading power of internet browsers, shows its real power and beauty only when the appropriate add on-s are installed. You can download and use them from Firefox add on page. There are a plenty of add-ons available and no need to specify which is good because it greatly depend upon your tastes. Recently I installed an add-on named All-in-one gestures and I feel it very interesting. You can install by clicking 'add to Firefox' button as you usually do while installing add-on. There provision to change the gesture pattern in the 'preferences' mode. Mouse gesture means that, some operations you done in Firefox such as 'back', 'forward', 'refresh' etc can be done simply by moving your mouse. I experienced no problem with both Windows and Linux platforms. There are tons of interesting add-ons like this. It is really fun to experiment with Firefox add-ons.

Monday, September 14, 2009

Hackthissite.org A hacker's university!

Hackthissite.org seems like a hacker's university. This website provides a good stuffs useful for hackers (crackers also). The hackers community is really powerful and active. Only you have to do is facing different types of hacking problems and find a quick and easy way to solve it. If you are a perl programmer or a javascript hacker, it is a plus. Innovative php users get the points more. A deep knowledge in html is not needed. Above all, the most important thing is your common sense. The problem phase is broadly classified in to:
personally I felt basic and javascript is good for beginners, but advanced problems like programming missions are needed to eat more points. Earning points is not for just earning points, but it will give you some reputation. You are ranked by your points:

Pentitioner-0 Points
Script Kiddie-700 points
Apprentice-1700 points
Wiseman-3200 points
Master-5400 points
Hacker-7000 points
Elite-8400 points
Sage-10000 points

W3schools help you a lot in learning web programming. Navigate to hackthissite.org and show who you are.

Friday, September 11, 2009

Make your own animations using Gimp


Hey Gimpers,
Gimp is not only an 'image manipulation' program. You can build your own animations using Gimp. It is very very easy. Just try it. There are plenty of tutorials available on the Gimp official website.
Click here for a nice and intuitive video tutorial.

Wednesday, September 2, 2009

Bhuvan, still have a lot of void


ISRO(Indian Space Research Organization), launched Bhuvan , a Google earth for India (But more than Google earth) after the successful launching of Chandrayan-1. In the first sight, it is like Google earth, but tons of information is there and covering almost all over India. Bhuvan is a strong rival for Google earth, and seems better view than Google earth and have some good features, and is more informative. Currently, Bhuvan works only on Win32 platform. You need a program (about 15MB) and a need a good broad band internet. Bhuvan works fairly well in my system with 2GB RAM. All you need to play with Bhuvan is included in their website.
Bhuvan has enough tools to find exact area, length and other terrestrial info. Bhuvan works well even though you have low bandwidth network because it is designed such a way that it covers almost Indians. I personally don't know Bhuvan supports current GPS systems.

Thursday, August 13, 2009

Resize images in Gimp



Resizing pictures is quite easy and there are several free programs available for this purpose. Resizing images by mouse is quite easy, but here is how to resize images in a professional way. It is quite easy.

Here is two images, one is the resized form of the other. To know the actual size difference, please download these images.

step1: Open GIMP
Applications->Graphics->GIMP in Linux (you can enter command 'gimp' in your terminal window as geeks do)
start->programs->GIMP in Windows

step2: Open image in Gimp

step3: Rigt click on the image and select image->scale image..
step4: Change width and height. If you change any one of them, the other will automatically be changed.

step5: Click 'scale' button

step6: Save yoiur image

Wednesday, July 22, 2009

Teach your computer how to speak!

It is good idea to teach computer to speak!. There a number of programs available for winXP paltform, but here is a unique program "espeak" for your linux. Just enter the command in terminal,

$espeak "Boss, I can speak now"

will work fine. It is useful for some scripts in linux to remind some status of computer to the user like a personal assistant. espeak is not an internal bash command and need to be installed. I simply installed in my Debian from repository.

#apt-get install espeak


The command above will work well with ubuntu systems also. If you are using any other distro, you need to download and install it manually. Click here to know more.

Here is a simple python program which uses espeak as system command. To use it you require python and espeak installed.

#! /usr/bin/python
# File: speak.py

import os
from Tkinter import *

class App:

def __init__(self, master):

frame = Frame(master)
frame.pack()
self.button = Button(frame, text="Click", command=self.activate)
self.button.pack(side=LEFT)


def activate(self):
os.system('espeak "Boss, I can speak now"')
print "Boss, I can speak now"

root = Tk()

app = App(root)

root.mainloop()

Just copy the above program into a new file named speak.py and 'cd' into the directory and enter,

python speak.py


You are free to use this program anywhere since espeak is under GPL.