Wednesday, November 30, 2016

IndexOutOfBoundsException

public class ExceptionDemo{
    public static void main(String[] args){
        int[] array = new int[2];
        try {
            System.out.println(array[100]);//non-existent
        } catch (IndexOutOfBoundsException ex){
            StackTraceElement[] e = ex.getStackTrace();
            System.err.println("Got error= " + ex + "\n"+
                               "in file "+e[0].getFileName() +"\n"+
                               "in class "+e[0].getClassName() +"\n"+
                               "in method "+e[0].getMethodName() +"\n"+
                               "in line "+e[0].getLineNumber());
            System.err.println("Full trace= ");
            ex.printStackTrace(System.err);
        }
        System.out.println("As Salamu Alaikum");
    }
}


Reference:
https://docs.oracle.com/javase/tutorial/essential/exceptions/
http://docs.oracle.com/javase/8/docs/api/java/lang/StackTraceElement.html
http://stackoverflow.com/questions/30437019/include-filename-line-number-corresponding-to-system-out-print-statements-in-ecl

Saturday, October 8, 2016

Offline Map:
http://maps.me
https://osmand.net

Street
https://www.mapillary.com/

GPS:
GPX Logger
GPS Logger
GPS Essentials


OSM Data Collection
OSM Tracker
Mapzen
Vespuscci
Mapswipe
GeoMaptool  (customized from ODK, from Sirajganj)

Worldwide Disaster Mapping
http://tasks.hotosm.org


Little Apps
Visualize:
CartoDB
Compare: 
http://osmfight.neis-one.org/
3D
http://demo.f4map.com/
OpenSourceGIS
QGis


Others:
http://openstreetview.org/
http://2016.stateofthemap.org/
http://www.omkserver.com/
http://wiki.osmfoundation.org/w/index.php?title=Licence/Why_would_I_want_my_contributions_to_be_public_domain&redirect=no



OpenStreetMap:
https://www.openstreetmap.org
http://osmlab.github.io/show-me-the-way/

Photo:
http://wiki.openstreetmap.org/wiki/Photo_mapping


JOSM:
https://josm.openstreetmap.de/

I was having connectivity issues while downloading map in JOSM
launching JAR from command line showed more details about what was going on

tried with both 10768 and the latest version

Problems were:
connection timed out, 
unknownhost

Following things did not help
Setting proxy
Replace https with http
replacing domain names with IP

Finally, organizers found out that running following line in the command prompt solves the problem

setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true

JOSM , OpenStreetMap and Map

Offline Map:
http://maps.me
https://osmand.net

Street
https://www.mapillary.com/

GPS:
GPX Logger
GPS Logger
GPS Essentials


OSM Data Collection
OSM Tracker
Mapzen
Vespuscci
Mapswipe
GeoMaptool  (customized from ODK, from Sirajganj)

Worldwide Disaster Mapping
http://tasks.hotosm.org


Little Apps
Visualize:
CartoDB
Compare: 
http://osmfight.neis-one.org/
3D
http://demo.f4map.com/
OpenSourceGIS
QGis


http://www.omkserver.com/



OpenStreetMap:
https://www.openstreetmap.org
http://osmlab.github.io/show-me-the-way/

Photo:
http://wiki.openstreetmap.org/wiki/Photo_mapping


JOSM:
https://josm.openstreetmap.de/

I was having connectivity issues while downloading map in JOSM
launching JAR from command line showed more details about what was going on

tried with both 10768 and the latest version

Problems were:
connection timed out, 
unknownhost

Following things did not help
Setting proxy
Replace https with http
replacing domain names with IP

Finally, organizers found out that running following line in the command prompt solves the problem

setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true

Saturday, September 3, 2016

Sharing Internet via WiFI

Sharing LAN Internet connectivity from laptop or desktop with wifi/wlan card. to other laptops / phones


open cmd in administrative mode

To start the network, copy paste the following two lines

netsh wlan set hostednetwork mode=allow ssid=MyWiFi key=MyPasswordHere

netsh wlan start hostednetwork



to stop the network, copy paste the following line

netsh wlan stop hostednetwork



to connect to it, use the following from phone or other laptops
Wifi name (SSID):
MyWiFi

password:
MyPasswordHere

Sunday, July 17, 2016

Install Oracle JDK with DrJava in Linux

DrJava runs fine in Linux, Mac and Windows.

Easy (but slightly inappropriate) route:

In case you do not have JDK installed,
Download JDK+netbeans bundle from
http://www.oracle.com/technetwork/articles/javase/jdk-netbeans-jsp-142931.html

Make it executable by using
chmod  +x   jdk-8u91-nb-8_1-linux-i586.sh

Install using
sudo ./ jdk-8u91-nb-8_1-linux-i586.sh



set default path using
sudo update-alternatives --install /usr/bin/java    java    /the/path/where/you/installed/jdk/bin/java  100
sudo update-alternatives --install /usr/bin/javac   javac  /the/path/where/you/installed/jdk/bin/javac 100



Take Drjava from my folder or download
https://www.cs.rice.edu/~javaplt/drjavarice/drjava.jar

Make it executable by using
chmod  +x   drjava.jar

run using
./drjava.rar


or make it runnable through double click by
right click
open with
/usr/bin/java  -jar


References
http://askubuntu.com/questions/159575/how-do-i-make-java-default-to-a-manually-installed-jre-jdk
http://annajiat.blogspot.com/2015/04/install-java-jdk-on-ubuntu-14-lts.html