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.

Monday, July 22, 2013

How to get rid of Question Mark icons in Ubuntu Unity Launcher

This is an annoying problem we sometimes face with certain applications in Ubuntu. But the solution is very simple. For the convenience, let's go step by step. (I'm facing this problem for IntelliJ IDEA.) 

Step 1:

We have to create a Desktop Entry File (with .desktop extention) in ~/.local/share/applications. Desktop Entry File is a configuration file describing how a particular program is to be launched, how it appears in menus, etc. 

I'm creating jetbrains-idea.desktop file.

vi ~/.local/share/applications/jetbrains-idea.desktop 

Step 2:

Add following text to the file and save it.

Sunday, July 14, 2013

How to enable http level request/response logs for WSO2AS [With Tomcat 7]


To enable http level request/response logs in WSO2AS, we can use Access_Log_Valve [1] which is provided in Tomcat 7.

To enable logging, you have to put following xml element under  /Server/Service/Engine/Host/ element in  {WSO2AS_HOME}/repository/conf/tomcat/catalina-server.xml, and restart the AS server.

This will create a log file named “localhost_access_log_sample.{DATE}.log” inside {WSO2AS_HOME}/repository/logs directory.

Here, ‘pattern’ parameter is the one we can use to specify which parts of the request/response needs to be logged. In above sample, xxx stands for the header name we need to log. Here  %{xxx}i stands for request headers and  %{xxx}o for response headers.

Sunday, June 9, 2013

How to Retrieve ORACLE Usage Statistics

As promised before, I'm going to tell you how to retrieve ORACLE usage statistics. Just as MySQL, ORACLE also stores its statistics in some internal databases.Here is an SQL script to retrieve its disk usage statistics.

NOTE: Make sure you replace ":owner" with admin username.


Next post will be on how to retrieve statistics data in Apache Cassandra.

Saturday, June 8, 2013

How to Retrieve MySQL Usage Statistics

In enterprise applications, monitoring usage statistics of database servers it uses is useful in many ways. It can be a situation where you need to meter and bill usage of system, or just to keep track of how data grows and system works. 

I'm trying to make you aware of different ways of statistic retrieval methods of some popular DBMS systems. As the first step, in this post I'm going to talk about how to retrieve MySQL usage statistics.

MySQL itself stores statistics data and metadata in some of its internal databases, namely mysql, information_schema and performance_schema. We can access those databases to get what we need. MySQL also gives some special queries for that.

Let's start with a simple one. This is how you can retrieve current session statistics.

And this is how you can see global statistics.

This is one way you can retrieve disk usage statistics for each database.