Wednesday, July 1, 2015

How to embed google map on a web page using javascript

 First create an HTML DOC type:
<!DOCTYPE html>
Then create a script that connects to the google API
 
note: API stands for Application Programming Interface :
<script src="http://maps.googleapis.com/maps/api/js"></script>






The next step is to create a javascript function, then declare a variable in the function and give it any name of your choice, in the case i used "map1" after creating the function i set the latitude and longitude in my variable
<script>
function initialize() {
  var map1 = {
    center:new google.maps.LatLng(53.508742,-0.129950),
    zoom:5,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };
note: I defined the map type as "ROADMAP" in my MapTypeId ,
the next step below is to create a new variable using the "new" keyword to connect to my google map and also using the document method to call the map function created :
  var map=new google.maps.Map(document.getElementById("googleMap"),map1);
}
here my javascript event load up and initialise the map into the web browser
google.maps.event.addDomListener(window, 'load', initialize);



here i used the html "div" element to show the area the map would occupy on the web page
<div id="googleMap" style="width:500px;height:380px;"></div>


Here is the full code for the map to display on the web page :


<!DOCTYPE html>

<head>
<script src="http://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
  var map1 = {
    center:new google.maps.LatLng(53.508742,-0.129950),
    zoom:5,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };
  var map=new google.maps.Map(document.getElementById("googleMap"),map1);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>

<body>
<div id="googleMap" style="width:500px;height:380px;"></div>
</body>

</html>


note : You need to have a fundamental knowledge of html javascript to be able to understand the codes written above 
For more information you can contact the author. 
Read More »

Friday, May 22, 2015

INSTALLING JAVA ON DEBIAN OR ON LINUX PLATFORM


 Install Java........

Install Java on Debian

Step 1: Get the Latest Sun JVM for Debian Linux Platform. Click here 

Step 2: Installing Java on Debian is an easy task, there is a package that can do all the hard task for you. The package is “java-package” which can be installed with:
apt-get -u install java-package
Ensure the repository is up to date before installing this package, as you might encounter some problems.

Step 3: Here you create the “.deb” package from the file. You have to be a non-root user to perform this step. Create a temporary directory and copy the java file “.bin” into it. Enter the following command:
Newroot make-jpkg jdk-1_5_0-linux-i586.bin
You can Change the name of the Java “.bin” if you have to.
Now you can install the package as a root, if successful it should show:
The Debian package has been created in the current directory. You can install
the package as a root
(e.g. dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb).
Step 4: You have to be root to issues the command here, so if you’re not root, switch over to root.
 “dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb 
If this is not the name of your package you can specify another one, you should get the name
from the previous success message. 

Testing: The Testing is easy. Just run the following command:
“java -version”
It would be okay to run the command as root and normal user to ensure everything is working fine. You should the following output:
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
 
by Koffi seglo 



Read More »

INSTALLING JAVA ON WINDOWS PLATFORM

Install Java........

Install Java........
Java is Installing

Thursday, 4 August 2011

How To Install Java on Windows:

In 4 easy steps i describe how to install Java.

1. Download either the JRE or the JDK.
2. Install.
3. Configure
4. Test.

1. Download either the JRE or the JDK:
    You have to download the JRE/JDK from Sun microsystems website.
To download the JRE click here.
To download the JDK click here.

2. Install:
    After downloading open the file to start the installer.
    It will install by itself, all you have to do is to continue by clicking next
    as you go through the setup. It is quite easy.

3. Configure:
    After installation, you have to configure the JDK in order for you to start development.
    In three easy steps:
    1. Right click the My Computer Icon on your Desktop and Click Properties.
    2. In the Option provided, Click the Advanced Tab(on Windows XP), this will be
        Advanced System Settings (Windows 7).
    3. Below you will see the Enviroment Variables button, Click it.

   4. Another Dialog Window Opens, in the dialog wondow, there are two options, the
       “User Variables” and the “System Variables”. We are working with the “System Variables”
       in the System Variables scroll down till you see the “Path”, Double click the “Path”,
       or highlight the “Path” and click Edit.

     Note: You have to be careful with this step, because if you edit the “Path” wrongly,
                   it might affect your “cmd(command prompt) commands ” because the cmd
                   uses the “Path” arguments to work with its command.

    5. Now go to the end of all the texts. At the end type a semicolon “;” and add the
        directory to the bin folder in the location where Java was installed on your system.
        Note: The bin folder will be located in “C:\Program Files\Java\jdk1.6.0_25\bin”
                 because i installed Java in the C: directory of my system, so this is what
                 i will be adding to the end of the Path’s text
                 “ ;C:\Program Files\Java\jdk1.6.0_25\bin ”.

    6.  Now Go to the CLASSPATH variable in the same System Varaibles,
         it is below the Path variable. If the CLASSPATH variable does not exist,
         create a new one by Clicking new, specify name as CLASSPATH and
         placing a period and semicolon “ .; ” then adding the location to the
         tools.jar file in the lib folder. But if the CLASSPATH as already been
         created, simply add a semicolon “ ; ” to the end of the text the same
         way you did for Path and the location to the tools.jar file.

    Note: The tools.jar file is in the lib folder which is located in
                  “C:\Program Files\Java\jdk1.6.0_25\lib\tools.jar” because
                  i installed java in the C: directory of my system, so this is what
                  i will be adding to the end of the CLASSPATH’s variable:
                  “ .;C:\Program Files\Java\jdk1.6.0_25\lib\tools.jar ” for New CLASSPATH.
                  “ ;C:\Program Files\Java\jdk1.6.0_25\lib\tools.jar ” for already
                  existing CLASSPATH.
                 Please don’t copy and paste the directory I specified here, it is just a guide, 
                 because, the location of your JDK might be different from mine.

    7. Now Click OK to complete the Configuration and OK again to
        exit the Advanced Tab;

4. Test:
    To test the Java configuration:
    1. Create a Java file in any Text Editor suitable for you.
        I'll advise you to use NotePad++ or Crimson Editor because of Keyword
        highlights and other nice features.
   2. Type the following code:
        public class Hello{
           public static void main(String[] args){
               Hello hello = new Hello(); 
 System.out.println("Hello, Java was successfully installed");
           }
        }
  3. Save the file as Hello.java
  4. Open cmd (command prompt) and go to the current directory of where the file was saved.
  5. In the current directory, type "javac Hello.java" , this will compile the Hello.java file to the java byte code.
      Note: Be careful as you type and save the file as Java is case sensitive.
                It is safe to copy and paste the the code itself.
  6. After typing this nothing should happen, else if it displays any message, that means it has not compiled and
      something is wrong with your configuration.
  7. Type "java Hello" to run the application.
  8. You should see an output like this:

That is it, You have successfully installed Java on your System. 
Read More »