Monday, December 20, 2010

Manually Connecting to an SSL IMAP Server

A good quick article on how to manually log into an IMAP Server using SSL is at:

http://www.jaharmi.com/2007/09/26/using_openssl_securely_connect_your_imap_account

The important part is:

As an example, here’s how you could log into an Exchange account, select the “Inbox” folder, and log out:

$ openssl s_client -connect server:port -crlf
? LOGIN username password
? SELECT Inbox
? LOGOUT


Thursday, October 28, 2010

Wednesday, May 12, 2010

Minimal OpenGL Program on RedHat EL 4.0

Here is a minimal OpenGL program on RedHat EL 4.0. The Makefile:



all:
gcc -L/usr/X11R6/lib -L/usr/X11R6/lib/modules/extensions exampleGlx.c -o dssglx -lX11 -lglx -lGL

And the program:



#include <GL/glx.h>
#include <GL/gl.h>
#include <X11/Xdmcp.h>
#include <unistd.h>

static int attributeListSgl[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None };
static int attributeListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None };

static Bool WaitForNotify(Display *d, XEvent *e, char *arg)
{
return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
}

int main(int argc, char **argv)
{
Display *dpy;
XVisualInfo *vi;
Colormap cmap;
XSetWindowAttributes swa;
Window win;
GLXContext cx;
XEvent event;
int swap_flag = FALSE;

dpy = XOpenDisplay(0);

vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeListSgl);
if (vi == NULL)
{
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeListDbl);
swap_flag = TRUE;
}
cx = glXCreateContext(dpy, vi, 0, GL_TRUE);

cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone);
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = StructureNotifyMask;
win = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 100, 100,
0, vi->depth, InputOutput, vi->visual,
CWBorderPixel|CWColormap|CWEventMask, &swa);
XMapWindow(dpy, win);
XIfEvent(dpy, &event, WaitForNotify, (char*)win);

glXMakeCurrent(dpy, win, cx);
glClearColor(1,1,0,1);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
if (swap_flag) glXSwapBuffers(dpy,win);
sleep(10);
}
</unistd.h>