Sunday, September 11, 2011

Google's Geolocation service in asp.net app

I have implemented geolocation in my project and it works like charm :)


You can test it at classifindz.com


Following is more detail about it.


The Geolocation API enables a web application to obtain a user's geographical position.



The Geolocation API enables a web application to:
  • Obtain the user's current position, using the getCurrentPosition method
  • Watch the user's position as it changes over time, using the watchPosition method
  • Quickly and cheaply obtain the user's last known position, using the lastPosition property
The Geolocation API provides the best estimate of the user's position using a number of sources (called location providers). These providers may be onboard (GPS for example) or server-based (a network location provider). The getCurrentPosition and watchPosition methods support an optional parameter of typePositionOptions which lets you specify which location providers to use.
To find out how to implement your own network location provider for use with the Geolocation API, see the description of the Geolocation API network protocol that Gears uses to communicate with network location providers.


for more reference see

:)

Wednesday, April 7, 2010

An example code to simulate mouse programmatically in vb6



' Simulate moving the mouse to the center of the
' PictureBox and clicking.
Private Sub cmdClick_Click()
Const NUM_MOVES = 3000
Dim pt As POINTAPI
Dim cur_x As Single
Dim cur_y As Single
Dim dest_x As Single
Dim dest_y As Single
Dim dx As Single
Dim dy As Single
Dim i As Integer

    ' Things are easier working in pixels.
    ScaleMode = vbPixels
    picClicker.ScaleMode = vbPixels

    ' mouse_event moves in a coordinate system where
    ' (0, 0) is in the upper left corner and
    ' (65535,65535) is in the lower right corner.

    ' Get the current mouse coordinates and convert
    ' them into this new system.
    GetCursorPos pt
    cur_x = pt.X * 65535 / ScaleX(Screen.Width, vbTwips, _
        vbPixels)
    cur_y = pt.Y * 65535 / ScaleY(Screen.Height, vbTwips, _
        vbPixels)

    ' Convert the coordinates of the center of the
    ' picClicker PictureBox into this new system.
    pt.X = picClicker.ScaleWidth / 2
    pt.Y = picClicker.ScaleHeight / 2
    ClientToScreen picClicker.hwnd, pt
    dest_x = pt.X * 65535 / ScaleX(Screen.Width, vbTwips, _
        vbPixels)
    dest_y = pt.Y * 65535 / ScaleY(Screen.Height, vbTwips, _
        vbPixels)

    ' Move the mouse.
    dx = (dest_x - cur_x) / NUM_MOVES
    dy = (dest_y - cur_y) / NUM_MOVES
    For i = 1 To NUM_MOVES - 1
        cur_x = cur_x + dx
        cur_y = cur_y + dy
        mouse_event _
            MOUSEEVENTF_ABSOLUTE + _
            MOUSEEVENTF_MOVE, _
            cur_x, cur_y, 0, 0
        DoEvents
    Next i

    ' Move the mouse to its final destination and click it.
    mouse_event _
        MOUSEEVENTF_ABSOLUTE + _
        MOUSEEVENTF_MOVE + _
        MOUSEEVENTF_LEFTDOWN + _
        MOUSEEVENTF_LEFTUP, _
        dest_x, dest_y, 0, 0
End Sub

Saturday, March 13, 2010

Hiding IP

mitesh: do you have idea to hide our IP on net?
friend: it depends on how you connect to internet?
friend: how are you connected to internet
mitesh: bsnl broadband
friend: i.e. bsnl phone line is connected to your computer directly?
mitesh: phone line is connected with adsl modem and from modem it is connected
friend: so then on internet what will be displayed is your adsl mode IP and not your computer IP
friend: your computer will get IP generated by adsl modem
mitesh: yes
mitesh: so i am using internet from proxy. right?
friend: no
friend: adsl just routes internet access request from your computer to internet and back...
mitesh: ok ok
mitesh: if suppose I want to make a program which changes ip address on each request of webpage. is it possible?
friend: changes IP address of which computer?
mitesh: it should show different here : http://www.whatismyip.com/
friend: you mean every time a user goes to this site, his computer IP address should be displayed different?
mitesh: yes
friend: point 1) software can be written to change a computer's IP address, considering the code will run with valid user access permissions/account
friend: 2) but to change the IP address of computer connected directly to Internet, will require that the IP address is registered with some service provider
mitesh: ok
friend: for e.g. if somehow  change the IP address of ADSL modem then your internet access might get stop based on service provider, as each service provider has a system of providing dyamic IP address to each user device connecting to it
mitesh: yes
friend: but for any device which is connected to internet with a valid static IP address can be changed considering that the IP address is changed to another valid static IP address
friend: or else the network response might stop working
mitesh: ok but i got one software which can give me this functionality, if i press new identity it changes my identity on http://www.whatismyip.com
mitesh: http://www.torproject.org/
mitesh: you can see this
friend: this software actually does not change the computer's IP address
friend: it uses a technique of relaying all internet access request to another server's on internet which intern processes the request and sends it back... and this routing can be from n number of devices...
friend: so it is like the request goes from your computer through many proxy servers available on internet dynamically
mitesh: ok
mitesh: can we have this service in our program?
friend: it depends, this program which is installed on the computer is like a client software which works with other such software running on many other computers on internet like in p2p way...
friend: checkout http://www.torproject.org/overview.html.en#thesolution to understand how it works...
mitesh: so nobody can track us
mitesh: right?
friend: yes that's the idea
mitesh: cool