How to use Intent.ACTION_TIME_TICK

In one of my applications, it was required to update a TextView every minute. The first approach that I could think of was to have an AsyncTask running a while loop till a minute (check for initial time+60,000 milliseconds in every iteration), but then I found out about ACTION_TIME_TICK broadcast action.

As per java docs:-

public static final String ACTION_TIME_TICK

Broadcast Action: The current time has changed. Sent every minute. You cannot receive this through components declared in manifests, only by explicitly registering for it with Context.registerReceiver().

This is a protected intent that can only be sent by the system.

Note: It is assumed that reader has knowledge of how to create and run a simple android application.

Continue reading “How to use Intent.ACTION_TIME_TICK”

How to use Boost library with Eclipse on Ubuntu

I was trying to use the multi-threading capability of boost C++ library, but found that there is no comprehensive(and appropriately brief) guide which shows how to use this library with Eclipse on Ubuntu, so I decided to write one myself.

Boost is a set of widely used cross platform C++ libraries which provide a lot of functionalities which are required by most of medium-large sized applications like multi-threading and regular expressions, but unfortunately are not available natively in C++(although some of these will be available in C++11).
This guide believes that you already have downloaded, installed and setup Eclipse for C++ in your computer(if not, download from here).

1.) Download the latest version(1.48.0 at the time of this writing) of boost library from here. Download boost_version.tar.bz2 file.
2.)Execute the following command in the directory where you want to put boost installation:-
tar –bzip2 -xf /[path_to_tar]/boost_1_48_0.tar.bz2
For example, if you stored “boost_1_48_0.tar.bz2” in “/media/Data/downloads” and want to put the installation in “/media/Installation” then go to “/media/installation” and execute:-
tar –bzip2 -xf /media/Data/downloads/boost_1_48_0.tar.bz2

Continue reading “How to use Boost library with Eclipse on Ubuntu”

Must Know Kannada Words

A lot of people (mostly software professionals) move to Karnataka(mainly Bangalore) everyday for job or business related purpose. Although most of the people here understand and speak English, still there are times when you are out in the market or with some Kannadiga (hailing from the state of Karnataka) friends or trying to explain your watchman/electrician/maid etc about something and you wish if you knew a bit of Kannada. I have been in Karnataka for almost 2 years now and have found that life will be much easier if one knows a few Kannada words. Below is the list of Kannada words that one must know, with their English meanings.

Continue reading “Must Know Kannada Words”

How to use Hibernate 4 with MySQL

Hibernate is an ORM (Object-Relation Mapping) tool for Java. It is used to persist and fetch data in the database via mapping the software objects to the relational model where properties of a class are mapped to a column in a table, class or an entity is mapped to table and instance of a class is a new record in a table.

This document explains the process of creating a simple Java application which uses Hibernate version 4, to store and retrieve data from MySQL database. It also explains how to create a simple MySQL  DB using XAMPP.

It is believed that the reader has a general idea of Eclipse IDE and Java.

Installing XAMPP and starting MySQL

There are various ways in which MySQL can be installed locally, namely:

I prefer using XAMPP, because it installs many other things like myPhpAdmin, Apache, FileZila, etc. and it’s free!!

Continue reading “How to use Hibernate 4 with MySQL”

Po Nee Po English Translation

Although, majority of the songs I listen to are either in Hindi or English, I do enjoy good music (definitely relative) in a lot of other Indian languages. Few days back, a friend told me about this Tamil song “Po Nee Po” sung  by “Mohit Chauhan” from the movie “3”(also has the over-hyped song “Kolaveri di”).

I have always been a Mohit Chauhan fan, but it was not just his singing that makes this a good song, Anirudh Ravichander has also done an awesome job with music. I thought other music lovers would also love to listen to and enjoy this song, and it sure is an added advantage if one knows the meaning of what he/she is listening to(makes it easier to get the feeling of the song).

So here’s an English translation of “Po nee po”, courtesy Malarvizhi Manoharan:-

Continue reading “Po Nee Po English Translation”