Saturday, September 5, 2009

How to find the IP address of the email sender in Gmail

When you receive an email, you receive more than just the message. The email comes with headers that carry important information that can tell where the email was sent from and possibly who sent it. For that, you would need to find the IP address of the sender. The tutorial below can help you find the IP address of the sender.

Note that this will not work if the sender uses anonymous proxy servers.

Also, note that if you receive an email sent from a Gmail account through the web browser, you may not be able to find the real IP address because Google hides the real IP address of the sender. However, if someone sends you a mail from his/her Gmail account using a client like Thunderbird, Outlook or Apple Mail, you can find the originating IP address.

Finding IP address in Gmail

  • Log into your Gmail account with your username and password.
  • Open the mail.
  • To display the email headers,
    • Click on the inverted triangle beside Reply. Select Show Orginal.
  • You may copy the headers and use my IP address detection script to ease the process. Or if you want to manually find the IP address, proceed to 5.
  • Look for Received: from followed by the IP address between square brackets [ ].
    Received: from [69.138.30.1] by web31804.mail.mud.yahoo.com
  • If you find more than one Received: from patterns, select the last one.
  • Track the IP address of the sender using some tracking sites

Sunday, December 14, 2008

Overloading new and delete in C++

Here's an example that might help (should compile as is):

#include iostream

using namespace std;

class Base
{
public:
Base();
void* operator new(size_t size, char const * file, int line);
void operator delete(void* p);
};

class Derived :
public Base
{
public:
Derived();
};


Base::Base()
{
cout << "Base::Base()" <<>
}

void* Base:perator new(size_t size, char const * file, int line)
{
void* p = malloc(size);
//
cout << "New called! file: " <<>
" <<>
//
return p;
}

void Base:perator delete(void* p)
{
//
cout << "Delete called! p: " <<>
//
free(p);
}


Derived:erived()
{
cout << "Derived:erived()" <<>
}

int main()
{
Base* x = new(__FILE__, __LINE__) Derived;
delete x;
return 0;
}

A Smidgen of OpenGL Code

An OpenGL program can be complicated. However, the basic structure of a useful program can be simple: Its tasks are to initialize certain states that control how OpenGL renders and to specify objects to be rendered.

Before you look at some OpenGL code, let’s go over a few terms. Rendering, which you’ve already seen used, is the process by which a computer creates images from models. These models, or objects, are constructed from geometric primitives - points, lines, and polygons - that are specified by their vertices.
The final rendered image consists of pixels drawn on the screen; a pixel is the smallest visible element the display hardware can put on the screen. Information about the pixels (for instance, what color they’re supposed to be) is organized in memory into bitplanes. A bitplane is an area of memory that holds one bit of information for every pixel on the screen; the bit might indicate how red a particular pixel is supposed to be, for example. The bitplanes are themselves organized into a framebuffer, which holds all the information that the graphics display needs to control the color and intensity of all the pixels on the
screen.
Now look at what an OpenGL program might look like.













White Rectangle on a Black Background

Chunk of OpenGL Code

#include
main() {
InitializeAWindowPlease();
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush();
UpdateTheWindowAndCheckForEvents();
}
The first line of the main() routine initializes a window on the screen: The InitializeAWindowPlease()routine is meant as a placeholder for window system-specific routines, which are generally not OpenGL calls. The next two lines are OpenGL commands that clear the window to black: glClearColor()establishes what color the window will be cleared to, and glClear() actually clears the window. Once the clearing color is set, the window is cleared to that color whenever glClear() is called. This clearing color can be changed with another call to glClearColor(). Similarly, the glColor3f() command establishes what color to use for drawing objects - in this case, the color is white. All objects drawn after this point
use this color, until it’s changed with another call to set the color.
The next OpenGL command used in the program, glOrtho(), specifies the coordinate system OpenGL assumes as it draws the final image and how the image gets mapped to the screen. The next calls, which are bracketed by glBegin() and glEnd(), define the object to be drawn - in this example, a polygon with four vertices. The polygon’s "corners" are defined by the glVertex3f() commands. As you might be able
to guess from the arguments, which are (x, y, z) coordinates, the polygon is a rectangle on the z=0 plane. Finally, glFlush() ensures that the drawing commands are actually executed rather than stored in a buffer awaiting additional OpenGL commands. The UpdateTheWindowAndCheckForEvents()placeholder routine manages the contents of the window and begins event processing.

Actually, this piece of OpenGL code isn’t well structured. You may be asking, "What happens if I try to move or resize the window?" Or, "Do I need to reset the coordinate system each time I draw the rectangle?" Later in this chapter, you will see replacements for both InitializeAWindowPlease() and UpdateTheWindowAndCheckForEvents() that actually work but will require restructuring the code to make it efficient.

Continue......

Tuesday, October 23, 2007