Monday, December 30, 2013

How to fix when your 3G USB Dongle is not recognized by Ubuntu?

I faced this issue about an year ago. This is a common situation for most non-huawei 3G dongles in Ubuntu. I tried various suggestions there were on internet, but nothing worked. And finally, I found this life saving simple tool called 'sakis3g'. It works perfectly with any type of 3G dongle. 

You can download it from here or here.

There are 2 ways you can run this.

1) GUI

Double click on the script and select 'Run'. Then you'll see a simple GUI like this.

Select Connect with 3G > USB Device > USB Modem > Custom APN 

Then give correct APN for your connection, username and password. If there is no any username or password, just type anything, when asked.  You will have to give root password in the middle of this.

You are done, and now connected to internet. 

To disconnect you can simply run the script and select Disconnect.

2) Console


> sudo bash <PATH>/sakis3g MENU=CONNECT OTHER="USBMODEM" USBMODEM="<Modem_ID>" APN="<Your_APN>" APN_USER="<Your_Username>" APN_PASS="<Your_Password>"

* Even if you don't have username/password for APN, you have to specify those arguments with non-empty value. (Type anything.)

* To know the <Modem_ID> value, use following command.

> lsusb

Bus 001 Device 033: ID 1c9e:9605 OMEGA TECHNOLOGY


sudo bash <PATH>/sakis3g MENU=DISCONNECT

The official website of sakis3g is not avaialable now. But you can find its source here.

Sunday, December 29, 2013

Programming Magic

I found this cool programming trick on a StackOverflow question. I won't give the original link yet, because there it explains how it works, and that will stop you from thinking, which spoils the real fun.

Here is the simple Java code. If you are too lazy to open your IDE, use this. :)

Think yourself!!! 

Friday, December 27, 2013

How to Setup a MySQL Cluster in Ubuntu

A MySQL cluster has 3 types of nodes. Those are Management node (ndb_mgmd), SQL nodes (mysqld) and Data nodes (ndbd). The terms inside brackets are the names of servers that should be installed in each type of node. 

And we can use a management client for management node to monitor the status of the cluster. For that, it is recommended to use the management client (ndb_mgm) on the management server host.

1) Introduction to Node Types

Management Node

The management server is the process that reads the cluster configuration file and distributes this information to all nodes in the cluster that request it.

SQL Nodes 

SQL nodes are through which SQL clients connect to MySQL cluster.

Data Nodes

Data nodes handle all the data in tables using the NDB Cluster storage engine. They are responsible for distributed transaction handling, node recovery, checkpointing to disk, online backup etc.

In this post, we will be setting up a MySQL cluster with 5 nodes. (1 Management node, 2 SQL nodes and 2 Data nodes)

Thursday, December 26, 2013

[Maven Bundle Plugin - BND] How to copy resources from jars to bundle

When we use Maven Bundle plugin to create an OSGi bundle from a jar, we might want to copy certain resource files from jar to OSGi bundle.

We can use <Include-Resource> element to do this. Recently I used it here.

In this example, we have copied 3 files from openjpa-2.2.0.jar. This copies the files to the same path inside the OSGi bundle.

Wednesday, December 25, 2013

How to Retrieve Cassandra Statistics through MBeans

Cassandra exposes its statistics through MBeans. So we can simply access its MBeans and retrieve those information. There are several ways you can access MBeans  I'll explains them one by one.

1) JConsole

Type 'jconsole' in your console you will get a window like follows.

If your Cassandra server is already up, you will see in Local Process List. Double click on it and you will get following window.