Find the Geopgraphical Location of an IP Address
There are a few applications that give the geographical location of an IP address *. My favorite one is VisualRoute. It not only maps the location of the source and destination IP addresses, but also all the hops in between. The down side to it is that it is not available for Linux and it costs $50 per user.
The http://mapulator.com site gives you pretty much the same information online for free, but it has been down for quite some time now.
Lately I have been using http://whatismyipaddress.com/ip-lookup. But it only maps the destination IP address.
If anyone knows of a Linux application that would map all the hops and the final IP destination, please leave a comment!
* IP addresses do not have a geographical location per se. Any program that maps IP addresses can only give you where the whole class of IP addresses (that the specified IP address belongs to) is registered to be located at. They do this by querying a database that has that information. This is accurate down to a city level at best. Do not expect to find where someone lives by their IP address!
Install Subversion and Subclipse for Eclipse on Ubuntu
If you do not have Eclipse installed yet, run:
sudo apt-get install eclipse
Install Subversion
sudo apt-get install subversion
Install the Subversion plugin for Eclipse
Get the Java bindings for Subversion:
sudo apt-get install libsvn-java
Now we are ready to install the plugins in Eclipse.
Open Eclipse.
Go to Help -> Install New Software
Then hit the “Add” button.
Put “Subclipse 1.6.x (Eclipse 3.2+)” under Name and “http://subclipse.tigris.org/update_1.6.x” under Location:
The above is for Elclips 3.2+ and Subversion 1.6.x.
If you have different Eclipse or Subversion versions, check this list and substitute accordingly:
Name: Subclipse 1.6.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.6.x
Name: Subclipse 1.4.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.4.x
Name: Subclipse 1.2.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.2.x
Name: Subclipse 1.0.x (Eclipse 3.0/3.1)
URL: http://subclipse.tigris.org/update_1.0.x
More info about the different versions: http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
Then hit “OK”. You will now be presented with these options:
If you are unsure what Subclipse component you will need, you can check all of them. Also, keep in mind that you can always go back to this in the future and install/uninstall any of the components as needed.
Then “Next” and “Finish” on the subsequent screens.
After the plugins are installed, it will prompt you to restart Eclipse. Go ahead and do so.
You are not done yet. You need to fix the JavaHL.
Edit the eclipse.ini file:
sudo vi /usr/lib/eclipse/eclipse.ini
Add the following line under -vmargs:
-Djava.library.path=/usr/lib/jni
Here is what my eclipse.ini file looks like:
$ cat /usr/lib/eclipse/eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-startup
--launcher.library
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-startup
/usr/lib/eclipse/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
/usr/lib/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-vmargs
-Djava.library.path=/usr/lib/jni
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=//usr/share/eclipse/dropins
-Xms40m
-Xmx256m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=//usr/share/eclipse/dropins
For more info on fixing JavaHL if you need it: http://subclipse.tigris.org/wiki/JavaHL#head-bb1dd50f9ec2f0d8c32246430c00e237d27a04fe
You should be able to use Subversion with Eclipse for your projects at this point.
How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
If you do any Android development in Ubuntu it is much better to test your applications on a real device rather than just relying on the emulator.
If you just connect the phone to the computer through USB and run adb devices you will find out that your phone is not recognized:
$ adb devices
List of devices attached
???????????? no permissions
This is easily fixable in Ubuntu. You have to add a line to a file in the /etc/udev/rules.d directory.
What line in which file depends on the manufacturer and model of the device. You can find out the Vendor ID number and Product ID number of the device by running (after you connected it via USB of course):
$ lsusb
For example, if you had a Nexus One connected you would get:
Bus 002 Device 004: ID 18d1:4e12
In this case the Vendor Id is “18d1″ and the Product ID is “4e12″. Please keep in mind that the Vendor ID for HTC changed from “0bb4″ to “18d1″. The older HTC phones like the G1 have a Vendor ID of “0bb4″.
Here is how to set up some of the major Android phones:
Step 1. Enable Unknown sources and USB debugging:
Go to Settings -> Applications and check the Unknown sources check-box, then go to Development and enable the USB debugging.
Step 2. Depending on your phone follow these instructions:
- G1
Create/edit a file in /etc/udev/rules.d called 51-android.rules:$ sudo gedit /etc/udev/rules.d/51-android.rulesAdd the following line to it and save it:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c01″, MODE=”0666″
- HTC Hero
Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c02″, MODE=”0666″
- HTC EVO
Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0c8d”, MODE=”0666″
- HTC EVO Shift
Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0ca5″, MODE=”0666″
- HTC ThunderBolt
Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bb4″, ATTRS{idProduct}==”0ca4″, MODE=”0666″
- LG OPTIMUS LG-P506
Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”1004″, ATTRS{idProduct}==”618e”, MODE=”0666″
- Motorola Xoom
Add to the file (or create it if it does not exist- see above) /etc/udev/rules.d/51-android.rules the following line:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct}==”70a9″, MODE=”0666″
- Motorola Droid
Create/edit a file in /etc/udev/rules.d called 10-motorola-droid.rules:$ sudo gedit /etc/udev/rules.d/10-motorola-droid.rulesAdd the following line to it and save it:
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”22b8″, ATTRS{idProduct} ==”41db”, MODE=”0600″
- Nexus One
Create/edit a file in /etc/udev/rules.d called 99-android.rules:$ sudo gedit /etc/udev/rules.d/99-android.rulesAdd the following line to it and save it:
SUBSYSTEM==”usb”, ATTRS{idVendor}==”18d1″, SYMLINK+=”android_adb”, MODE=”0666″
Step 3. Restart udev:
$ sudo restart udev
Check if the device is recognized:
$ adb devices
You may need to stop and start the adb server:
$ adb kill-server
$ adb start-server
Update: Please note that some devices require to disconnect the usb cable at this point and then reconnecting it.
You should be good to go…
Extract Audio (.mp3) from Video Files Like .flv, .mov, .avi and Others with Ubuntu
It is very easy to extract the audio track from video files using Linux. All you need is ffmpeg and some codecs.
Let’s get started…
Note: The commands below are for Ubuntu (or Debian derivatives) but you can do the same with any other Linux distribution provided you can install the necessary packages.
1. Add the Medibuntu’s repository to your sources.list:
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
2. Install ffmpeg:
sudo apt-get install ffmpeg
3. Let’s get the restricted packages and some codecs installed:
sudo apt-get install ubuntu-restricted-extras libmp3lame0 libdvdcss2 w32codecs
The above command is for i386 architecture. If you have an amd64 architecture, substitute w32codecs with w64codecs.
Note: This is not a complete list of codec packages by any stretch of the imagination. It will get you started though and you will be able to do most formats, but you might have to add codecs as you go along.
4. Now we are ready to extract the audio from the video files:
ffmpeg -i input_file.flv output_file.mp3
The above command will extract the audio from a Flash video file. You can do the same for a QuickTime file as well:
ffmpeg -i input_file.mov output_file.mp3
Or for an Audio Video Interface file:
ffmpeg -i input_file.avi output_file.mp3
YouTube and other video web sites:
Having done all this, now we can download flash files from places like YouTube and strip the audio from them. All you need besides the steps above is a way to save the Flash files (.flv) from YouTube. An easy way to do that is by using Firefox Add-ons like Download Flash and Video or Flash Video Downloader.
The quality of the audio in the YouTube videos for example is 64 bit/sec. Most of the mp3 files are normally compressed to 128 bit/sec or above. Obviously the quality will not be the same, but a human year cannot tell the difference.
The quality of the extracted mp3 will depend on the quality of the audio track in the video file. So the above statement about the 64 bit/sec audio is mostly the case for the files on some video sharing sites.
How to Resume Partial File Transfers
I work primarily with UNIX and Linux machines and scp is my main choice to transfer files with. It is both convenient, short and secure.
Example:
scp localfile user@remotecomputer:/path/to/target/dir
Recently I was transferring an 8GB file and due to a network issue, the transfer was interrupted at nearly 40%.
I have learned over the years that there is often little which can be done to prevent such interruptions. I know that many people go to great lengths to find Broadband which is reliable, but sometimes disruptions simply cannot be avoided. Of course, this can be both frustrating and time-consuming, but there is a quick fix. Although such disruptions can’t be prevented, there is a fast and easy way to resume them. Resuming has relatively few system requirements, and can save a lot of time and hassle when transferring large files.
I found a solution at joen.dk ,which uses rsync to resume the transfer:
rsync --partial --progress --rsh=ssh host:remote_file local_file
Now we can improve this slightly by shortening the above command. We can substitute –rsh=ssh with -e ssh, and use -P instead of –partial –progress. Also, you can add user@host if you need to specify a different remote shell user:
rsync -P -e ssh user@host:remote_file local_file
This above example will work with any file that was partially transfered. How the transfer was started does not really matter. It could be through scp, nc or even ftp. After you execute the above command it will take rsync a little time to verify the previously downloaded part before it continues with the rest. Be patient, depending on your network speed rsync could take some time to go through what you have already transfered. Of course this is much faster than if you were to start the download all over again and it shows you the progress in percentages.
Keep in mind that there have to be a couple of requirements in place in order to resume the file transfer with rsync:
1. You should have remote shell access.
2. The remote machine should have rsync installed. Since rsync is by default on most Linux distributions that generally should not be an issue.
Search
Archive
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Nov | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | ||||
Recent Comments
- wesley on How to sign an unsigned Android package (.apk file)
- dimitar on Android – Displaying Dialogs From Background Threads
- Salmpy on Android – Displaying Dialogs From Background Threads
- Mark Quinn on How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
- Mark Quinn on How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
Categories
Blogroll
Online Tools
Other
BLOG ARCHIVE
- November 2011 (1)
- August 2011 (1)
- April 2011 (1)
- January 2011 (2)
- September 2010 (1)
- August 2010 (2)
- July 2010 (2)
- June 2010 (2)
- May 2010 (1)
- January 2010 (2)
- December 2009 (2)
- November 2009 (3)
- October 2009 (1)
- September 2009 (3)
- July 2009 (1)
- May 2009 (1)
- March 2009 (1)
- February 2009 (2)
- January 2009 (2)
- December 2008 (1)
- November 2008 (4)
- October 2008 (5)

