Category Archives: Linux

Linux Tips & Tutos.

Mobile Broadband Modem Huawei e173 / e173s on Ubuntu 12.10 Quantal

Recently, I have been using the mobile broadband modem HUAWEI E173S in order to connect to Internet through 3G Cellular UMTS network.

It worked fine in Ubuntu 12.04 Precise Pangolin, but did not in 12.10 Quantal Quetzal.

I was though able to connect the modem thanks to the 3G utility : SAKIS3G and later through the Gnome Network Manager using a former version of Modem Manager packaged for Ubuntu.

  1. Download sakis3g :
  2. Uncompress the downloaded archive and put sakis3g file in your desktop directory.
  3. copy the sakis3g script to /usr/bin/ in order to execute it from Terminal: sudo cp ~/Desktop/sakis3g /usr/bin/
  4. Give it execution rights : sudo chmod 777 /usr/bin/sakis3g
  5. create a configuration file for your modem: gksudo gedit /etc/sakis3g.conf
  6. Append the following on the following on the newly created file:

    These settings are for the Operator Meditel so you have to modify the custom APN, the username, the password that correspond to your Mobile Operator and eventually the USBMODEN identification depending on whether you own the e173 or e173s model.

    To identify your moden while plugged (Notice that when you plug the modem, you need to wait for several seconds before it gets recognized – probably because modem-manager switches the USB stick key from USB Storage to USB Modem), type in Terminal :


    This will give you something like this :

    Bus 002 Device 008: ID 12d1:1c05 Huawei Technologies Co., Ltd. E173s 3G broadband stick (modem on)

    Copy the vendor ID and Product ID. (E173 & E173s have different product Ids).

  7. save the file and run sakis3g: sudo sakis3g connect
  8. In order to disconnect, run : sudo sakis3g disconnect
  9. If you want to be assisted through an interactive configuration, run: sudo sakis3g --interactive


However, if though you succeed in connecting with sakis3G, Ubuntu Software Center, Empathy IM and Software Updater will not be able to connect to Internet because they get Internet route from Network Manager. In order to loop the route, create a new Wireless Network and connect to it. This wireless network must be AD-HOC and SHARED to OTHER COMPUTERS.


And oh Gosh! In order to activate the Mobile Broadband Internet connection, I must send an SMS to a certain operator number. So how coud I send SMS with the Mobile Broadband Modem?

Hopefully, there is gammu and its graphical interface wammu.

So first thing to do is : sudo apt-get nstall gammu wammu
Then create a configuration file for gammu : gedit .gammurc
and append the following (reference :
port = /dev/ttyUSB0
connection = at115200
synchronizetime = yes
logfile = ~/gammu.log
logformat = textalldate
use_locking =
gammuloc =

Info: Make sure that the attached port is correct. You can use the command
dmesg|grep tty

Network Manager must be killed in order to liberate the port ttyUSB0:
sudo stop network-manager
then, start wammu:
gksudo wammu
Then, from the menu: PHONE -> Connect



Info: You can achieve a manual configuration through the Phone Wizard in WAMMU. But be sure before that Network-Manager is killed.


What if you did not like SAKIS3G and want to use the Network Manager.

For now Ubuntu Packaged version of ModemManager is buggy and is responsible for Huawei e173 connection failure.

All you need to do is replace this version by a former one. Get it from LAUNCHPAD, through this link (this amd64 package, if you have a 32bits system, replace amd64 by i368 in the link below):

– Uninstall the current installed version (0.6):

sudo apt-get remove modemmanager

and install the downloaded version (0.5.2) by double cliking on the debian file.
Reboot. Plug your modem, wait for 30 seconds. Connect through the Network Manager applet. You’re done.
You will be later prompted to update modemmanager. Don’t, untill the bug is fixed.
To make sure you installed version 5.2, run this command:
dpkg -s modemmanager

Calculate your Body Mass Index

Bomico is a tiny java application that computes an individual’s body mass index based on some measurements.

The application is free software released under GPL 3.

You can contribute to it if you want to. Checkout the code at . You must register to GitHub in order to become a contributor (it’s free for open source projects).

If you want just to install it: you can download it here :

Note that if you’re running Ubuntu 12.04, Bomico supports Ubuntu Global menu and thus HUD. Be sure before installation, you have a Java JRE installed (Oracle JRE or OpenJDK 6 or 7).

After installation you can check that installation was completed by typing the following command in your Terminal:

bomico --version

If you download and want to run the jar file, (supposing you have set your java home classpath already), copy the jar file (bomico_1.0.2.jar) to your desktop and do as follows, in a terminal:

java -jar ~/Desktop/bomico_1.0.2.jar

bomico-screenshot (Ubuntu 12.04)



Create GTK based Java applications on Linux with Java GTK library

Thanks to   libjava-gnome-java   – Java-gnome language bindings project – library, you can create java applications based on GTK toolkit for GUI displaying, instead of Java Swing. GTK has the widgets you need to build from basic to complex GUI.

First of all, install the library. If you’re running Ubuntu Linux or Debian, you can do it this way:

sudo apt-get install libjava-gnome-java

The library should be installed in: /usr/share/java/gtk.jar

You can therefore import it to your java project’s classpath in your favorite IDE, along with the javadoc (install libjava-gnome-java-doc as well).



The example above is a basic GTK window as illustration that you can achieve with the following portion of code:

package com.otika.samples;

 * Basic example of how one can use Java Gnome Library to build a GUI.
 * @author <a href="">Hanynowsky - OTIKA</a>
import java.util.logging.Level;
import java.util.logging.Logger;
import org.gnome.gdk.Event;
import org.gnome.gdk.Pixbuf;
import org.gnome.gtk.*;

public class HelloGTK extends Window {

Window window;
 Dialog Hello;
 Label label;
 VBox vbox;
 Button button;
 Dialog msg;
 Button but;
 Button exit;
 String message = "Java Gnome Library is great!";
 Alignment align;
 Alignment align2;
 AboutDialog about;
 Pixbuf icon;
 File pic = new File(System.getProperty("user.home") + File.separator + "linux.png");

 * COnstructor
 public HelloGTK() {

try {
 align = new Alignment(0, 0, 0, 0);
 align2 = new Alignment(0, 0, 0, 0);
 msg = new MessageDialog(null, true, MessageType.INFO, ButtonsType.OK_CANCEL, "Change text to -" + message + "- ?");
 Hello = new InfoMessageDialog(null, "GTK Modal Dialog", "Thanks to Java Gnome Library I exist");
 window = new Window();
 window.setTitle("GTK Window");
 window.setDefaultSize(390, 400);
 icon = new Pixbuf(pic.getPath(), 48, 48, false);
 window.connect(new Window.DeleteEvent() {

 public boolean onDeleteEvent(Widget source, Event event) {
 return false;

exit = new Button("Exit");
 exit.setSizeRequest(70, 30);
 exit.connect(new Button.Clicked() {

 public void onClicked(Button source) {

label = new Label("This window has been made with the <b>java-gnome</b> "
 + "project.\nTo get more information, you should check out the"
 + "\ndocumentation.");
 vbox = new VBox(true, 5);
 vbox.setSizeRequest(window.getWidth() - 2, window.getHeight() - 2);
 but = new Button("Click It");
 but.connect(new Button.Clicked() {

 public void onClicked(Button source) {
 System.out.println("Clicked it");
 button = new Button("Click me");
 button.connect(new Button.Clicked() {

 public void onClicked(Button source) {
 vbox.packEnd(but, false, false, 0);
 vbox.packStart(exit, false, false, 0);

 MenuBar menuBar = new MenuBar();
 MenuItem fileItem = new MenuItem("File");

Menu quitMenu = new Menu();
 MenuItem quitItem = new MenuItem("Quit");

quitItem.connect(new MenuItem.Activate() {

 public void onActivate(MenuItem menuItem) {


vbox.packStart(menuBar, false, false, 3);
 about = new AboutDialog();
 String[] people = {"Hanynowsky <>", "Gnome <>"};
 about.setCopyright("@ 2012 - Copyright");
 about.setLicense("GNU GPL v3");
 about.setProgramName("Java Gnome Hello World");
 Fixed fixed = new Fixed();
 Button aboutMe = new Button("About");
 aboutMe.connect(new Button.Clicked() {

 public void onClicked(Button source) {;
 aboutMe.setSizeRequest(70, 30);
 vbox.packStart(fixed, false, false, 0);
 HSeparator hsep = new HSeparator();
 vbox.packStart(hsep, false, false, 0);
 // vbox.add(exit);
 String s = "コーヒーとコードを飲む。";
 String p = "بطريق";
 vbox.add(new Label(s));
 vbox.add(new Label(p));
 } catch (IOException ex) {
 Logger.getLogger(HelloGTK.class.getName()).log(Level.SEVERE, null, ex);

public static void main(String[] args) {
 HelloGTK hw = new HelloGTK();
 System.err.println("Running The GTK Window");
 // Gtk.main();

private void showMe() {

ResponseType response =;
 if (response == ResponseType.OK) {
 } else {

private void showIt() {;

private void showWindow() {

 * Copies a logo file in user home folder
 private void pasteLogoFile() {
 if (!pic.exists()) {
 try {
 InputStream is = getClass().getResourceAsStream("linux.png");
 try (OutputStream output = new FileOutputStream(pic)) {
 int read;
 byte[] bytes = new byte[1024];
 while ((read = != -1) {
 output.write(bytes, 0, read);
 System.out.println("Logo created");
 } catch (IOException ex) {
 Logger.getLogger(HelloGTK.class.getName()).log(Level.SEVERE, null, ex);

 * Exists the application
 public void exit() {

if (pic.exists()) {

You can download and run the example using this jar file :

on terminal :

java -jar /path_to_this_jarFile/HelloGTK.jar