Monday, May 28, 2012

Apache, PHP, MySql for development purposes in Windows

No comments:

Important: The Following is for development machine only.

Apache - httpd-2.2.22-win32-x86-no_ssl.msi Link: http://httpd.apache.org/download.cgi
PHP - php-5.2.17-Win32-VC6-x86.zip Link: http://windows.php.net/download/
MySql - mysql-installer-5.5.24.0.msi Link: http://www.mysql.com/downloads/installer/

Slected: Apache module + PHP V6-Thread Safe

(I) Configuring Apache

1. Install Apache

2. add the following in [Apache]\conf\httpd.conf
LoadModule php5_module "C:/php/php5apache2_2.dll"
<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>
<IfModule mime_module>
AddType application/x-httpd-php .php
</IfModule>
3. Restart Apache

Your webroot will be at [Apache]\htdocs. You can change this path by editing the lines mentioned below in [Apache]\conf\httpd.conf
Eg:
DocumentRoot "C:/.../Apache Software Foundation/Apache2.2/htdocs" to
DocumentRoot "D:/ htdocs"
and
<Directory "C:/.../Apache Software Foundation/Apache2./htdocs"> to
<Directory "D:/htdocs">

(II) Configuring PHP

1. Extacted PHP zip to 'C:\php'

2. copy and rename [php]\php.ini-dist to [php]\php.ini

3. add the following in php.ini
extension=php_mysql.dll
extension_dir = "c:\php\ext"
4. copy [php]\libmysql.dll and [php]\php.ini to [Apache]\bin

5. Restart Apache

(III) Configuring MySql

Install as per your requirement.

Wednesday, May 23, 2012

Open Google Chrome browser in incognito mode by default

2 comments:
Step:

1. Create a shortcut of Google Chrome browser
2. Right click the shortcut and click Properties
3. Add  --incognito to the end of the Target



That's all !!!

Sunday, May 20, 2012

Google Maps JavaScript API v3 Example in asp.net

No comments:


<head runat="server">
    <title>Google Maps JavaScript API v3 Example in asp.net</title>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
    <script type="text/javascript">

        google.maps.event.addDomListener(window, 'load', initialize); //run when after page load
        var map;
        var markercode;
        var markermyLatlng;
        var markermyLatlngCount=0;

        function initialize() {
            var Lat=<%= dbLat %>;
            var Lon=<%= dbLon %>;
            var myOptions = {
                center: new google.maps.LatLng(Lat, Lon),
                zoom: 10,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);


            markercode = new google.maps.Marker({
                draggable:false,
                animation: google.maps.Animation.DROP,
                map:map,
                position: new google.maps.LatLng(Lat, Lon),
                title:"mattanchery - from code page!"
            });

            google.maps.event.addListener(markercode, 'click', toggleBounce);
        }

        function toggleBounce() {
            if (markercode.getAnimation() != null) {
                markercode.setAnimation(null);
            } else {
                markercode.setAnimation(google.maps.Animation.BOUNCE);
            }
        }

        function BtnLocateMe_onclick() {
            var myLatlng;
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function (position) {
                    myLatlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

                    if(markermyLatlngCount==0){
                        markermyLatlng = new google.maps.Marker({
                            draggable:true,
                            animation: google.maps.Animation.DROP,
                            map:map,
                            position: myLatlng,
                            title:"I am here!"
                        });
                        markermyLatlngCount=markermyLatlngCount+1;
                    }
                    else
                    {
                        map.setCenter(myLatlng);              
                    }
                },
                function () {
                    handleNoGeolocation(true);
                });
            } else {
                handleNoGeolocation(false);
            }
        }

        function handleNoGeolocation(errorFlag) {
            if (errorFlag) {
                var content = 'Error: The Geolocation service failed or blocked.';
            } else {
                var content = 'Error: Your browser doesn\'t support geolocation.';
            }
            alert(content);
         }

    </script>
    <style type="text/css">
        #map_canvas
        {
            height: 543px;
            width: 754px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input id="BtnLocateMe" type="button" value="Locate Me" onclick="BtnLocateMe_onclick()" />
    <div id="map_canvas"></div>
    </div>
    </form>
</body>

CODE:


    public string dbLat = "9.964455";
    public string dbLon = "76.253099";
    protected void Page_Load(object sender, EventArgs e)
    {


    }