Blog Archives

Creating a Application Launcher in Ubuntu 14.04


Dear Readers,

I am back with a very small ubuntu tip after quite sometime. This is not something that is really new and there are many sources out there that explain how to create application launchers in Ubuntu. I needed this to create a launcher for Aptana Studio.

So I thought I will write down these steps here so that others in need can find it and also it will serve as a future reference to me.

Open a terminal and navigate to your home folder and then

cd  /.local/share/applications

In this particular folder create a file called yourapplicationname.desktop

And in this particular file add the following content.

[Desktop Entry]
Version=3.0
Name=Name of Application
Comment= a short description
Type=Application
Categories=Development;IDE;
Exec=absolutepath of application
Terminal=false
StartupNotify=true
Icon=path of icon image
Name[en_US]=AptanaStudio

Save this file and search for your application in unity and there you have your launcher.

Prepaid Manager App in Ubuntu


It was only today that I put into use my Huawei E303C modem into use. I had not used it for almost 6 months. And today I  plugged it in it with the IDEA 3G sim on Ubuntu 13.04. The Huawei linux drivers almost gave me a headache and finally to get the device working . Finally I had to uninstall it and I found out that Ubuntu 13.04 automatically detects my modem.

Now people out there who have already screwed up by trying to install the Linux drivers for Huawei modem, just uninstall and reinstall the usb-modeswitch and things should be perfect.

sudo apt-get remove usb-modeswitch usb-modeswitch-data
sudo apt-get install usb-modeswitch

Now after all these I still had one major problem in front of me. To know the balance that I have on my SIM I had to remove it from the modem insert it in to my mobile and check. It is then that I found this wonderful application in ubuntu called “prepaid manager”

sudo apt-get install prepaid-manager-applet

Once this is done you will have to change a few lines in an XML file.

go to /usr/share/mobile-provider-info

and with root permissions open the serviceproviders.xml file.

In this file go to the country and to the service provider you are using and add the following lines just before the closing gsm tag </gsm>

<balance-check>
<ussd>”USSD CODE TO GET BALANCE</ussd>
</balance-check>
<balance-top-up>
<ussd replacement=”CODE”>*USSD CODE TO RECHARGE*CODE#</ussd>
</balance-top-up>

Once this is copied make sure to change USSD CODE TO GET BALANCE to the required code for me since I was using IDEA it was *125#

Till now I have not tried the top up option, if any of my readers have done that too please eel free to comment.

Sharing Internet over Wifi Between Ubuntu and Android


I searched the internet alot for a solution to connect my PC’s internet to my android phone by creating a hotspot. In windows you have softwares like connectify to make your life easy, But in linux things are not so easy, and I was never a windows guy. I hated to logon to windows just to share the internet over wifi to my android phone. I spend many sleepless nights trying to configure hostapd in Ubuntu and make it connect to my Android. And finally after days of searching and experimenting that wonderful day of bliss occurred to me. I have combined information I received from various sites in this post.

Initially when I shared my problem in certain groups I got the advice to set up an ad-hoc wifi network in ubuntu, but Android 2.3 and lower versions do not detect ad-hoc network so that means you either have to root your phone and ad the necessary features or you have to go for an alternative way.

I was definite that there will be an alternative because in windows there are softwares like connectify that do the job, and in linux we have hostapd.

So let me get directly to the point.

Open a terminal and type

#lspci

It will show the network adapter available to you.

#lsmod

Shows that it uses the ath9k drivers (this information may help you to google for setup information specific to your machine.)

Also

#iwconfig

will give you the name of your wireless adapter like wlan0. Please notedown this name as you will be needing it later on.

Now its time to install the packages.

Either fire up the ubuntu software center and install hostapd and dhcp3-server, or fire up the terminal and type

#sudo apt-get install dhcp3-server
#sudo apt-get install hostapd

After this is done we have some serious editing to do so create a backup of all the files that are being edited.

In a terminal:

#sudo gedit /etc/hostapd/hostapd.conf

When the file is opened make the contents of the file as below.

interface=wlan0
driver=nl80211
ssid=geekpeek
channel=1
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

In this file we have declared that our wifi hotspot will be called geekpeek, it is using the adapter wlan0, and it should have a password which the connecting device has to enter. Save the file.

Next

#sudo gedit /etc/default/isc-dhcp-server

Edit the line that says

INTERFACES=”"

To

INTERFACES=”wlan0′′

Then edit

#sudo gedit /etc/dhcp/dhcpd.conf

Make sure the follow lines are Commented out ( put a hash “#” sign at the beginning of the line ) the

following lines:

# option definitions common to all supported networks...
#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;

Add the following lines to the file (copy and paste)

subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.16;
option domain-name-servers 8.8.4.4, 8.8.8.8;
option routers 10.10.0.1;
}

Here we have specified the IP of our PC as 10.10.10.1 and 15 other PCs with addresses ranging from 10.10.0.2 to 10.10.0.16 can be connected to your PC.

Next edit

#sudo gedit /etc/network/interfaces

This is how my interfaces file looks:

To whatever is existing in the file add,

auto wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0

At this stage you can reboot. And hopefully any device / laptop should connect to your wifi hotspots network via the network manager applet. On these devices search for the network “geekpeek” and type in the password.

To Connect to the internet we have some more procedures to follow.

In a terminal type:

#ifconfig

It will display the adapter name being used for connecting to the internet. I was using the LAN so my adapter name was “eth0”, if you are using modems then it might be “ppp0”

First we have to allow ip forwarding:

#sudo gedit /etc/sysctl.conf

Make sure the following line is uncommented and reads

net.ipv4.ip_forward=1

Save and close gedit. (reboot)

After reboot: Connect to the Internet and In a terminal type:

#sudo gedit /etc/rc.local

add this line just before “exit 0′′

iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE

Then reboot the system.

The eth0 should be changed to whatever adapter you are using.

Once this is done you can make other laptops connect to to youe new wifi hotpsot by assingning them IP addreses in the range of 10.10.0.2 to 10.10.0.16

To make and Android detect your wifi hotspot.

Goto the wifi settings

press the options key ( the left most key)

Select Advanced>Use Static IP

Give the IP address as something between 10.10.0.2 to 10.10.0.16

Gateway the same IP as your PC, In this case it is 10.10.0.1

Netmask as 255.255.255.0

DNS1 as 8.8.4.4

DNS2 as 8.8.8.8

Once this much has been set your android phone should be able to connect to your wifi hotspot and you can access the internet connection on your PC through your phone.

Now when you turn on your PC go to terminal and type

#sudo hostapd /etc/hostapd/hostapd.conf

Now I have made an application in Qt4 that provides a GUI to turn on and off the wifi Hotspot, You can get it from the download section

References

http://thenewbieblog.wordpress.com/2012/05/01/wifi-hotspot-setup-on-ubuntu/

http://nims11.wordpress.com/2012/04/27/hostapd-the-linux-way-to-create-virtual-wifi-access-point/

%d bloggers like this: