MySQL tinkering

mysql> create database jeffdatabase
-> ;
Query OK, 1 row affected (0.03 sec)

mysql> show databases;
| Database |
| information_schema |
| jeffdatabase |
| mysql |
3 rows in set (0.00 sec)

mysql> use jeffdatabase
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> create table songs (hindi VARCHAR(20));
Query OK, 0 rows affected (0.03 sec)


Text :
Read Voraciously.
Meaning :
Do lots of reading with eagerness.
A figure of speech is a use of a word that diverges from its normal
meaning, or a phrase with a specialized meaning not based on the literal
meaning of the words in it

The saying "I got your back" almost never has the literal meaning of
receipt or possession of another's spine. It is a figure of speech that
means the speaker intends to protect the listener, actually or

Reference :

screenshots of tinkering

(gdb) bt
#0 clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:84
#1 0x00007ffff509db24 in do_clone (pd=0x7ffff03bd710,
attr=0x7ffff50a7f20, stackaddr=0x7ffff03bd9e0, stopped=1,
fct=, clone_flags=) at
#2 0x00007ffff509e0d2 in create_thread (newthread=, attr=,
start_routine=, arg=) at
#3 __pthread_create_2_1 (newthread=,
attr=, start_routine=,
arg=) at pthread_create.c:561
#4 0x0000000000401a82 in timer_exe (window=0x638400) at cairoanimation.c:138

(gdb) frame 4
#4 0x0000000000401a82 in timer_exe (window=0x638400) at cairoanimation.c:138
138 iret = pthread_create( &thread_info, NULL, do_draw, NULL);
(gdb) info locals
thread_info = 140737223841552
iret = 0
first_execution = 0
drawing_status = 0
width = 0
height = 6300768
(gdb) info args
window = 0x638400
(gdb) x/s thread_info
0x7ffff03bd710: "20327;360377177"
(gdb) set thread_info="20327;360377176"
(gdb) info locals
thread_info = 6794336
iret = 0
first_execution = 0
drawing_status = 0
width = 0
height = 6300768

(gdb) x/t height
0x602460 : 00000001
(gdb) x/d height
0x602460 : 1
(gdb) x/c height
0x602460 : 1 '01'
(gdb) x/u height
0x602460 : 1

/* Jeffrin Jose Licensed GPL v3 Copyright
August 2010 GPL --> */


//the global pixmap that will serve as our buffer
static GdkPixmap *pixmap = NULL;

gboolean on_window_configure_event(GtkWidget * da, GdkEventConfigure * event, gpointer user_data){
static int oldw = 0;
static int oldh = 0;
//make our selves a properly sized pixmap if our window has been resized
if (oldw != event->width || oldh != event->height){
//create our new pixmap with the correct size.
GdkPixmap *tmppixmap = gdk_pixmap_new(da->window, event->width, event->height, -1);
//copy the contents of the old pixmap to the new pixmap. This keeps ugly uninitialized
//pixmaps from being painted upon resize
int minw = oldw, minh = oldh;
if( event->width width; }
if( event->height height; }
gdk_draw_drawable(tmppixmap, da->style->fg_gc[GTK_WIDGET_STATE(da)], pixmap, 0, 0, 0, 0, minw, minh);
//we're done with our old pixmap, so we can get rid of it and replace it with our properly-sized one.
pixmap = tmppixmap;
oldw = event->width;
oldh = event->height;
return TRUE;

gboolean on_window_expose_event(GtkWidget * da, GdkEventExpose * event, gpointer user_data){
da->style->fg_gc[GTK_WIDGET_STATE(da)], pixmap,
// Only copy the area that was exposed.
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width, event->area.height);
return TRUE;

static int currently_drawing = 0;
//do_draw will be executed in a separate thread whenever we would like to update
//our animation
void *do_draw(void *ptr){

currently_drawing = 1;

int width, height;
gdk_drawable_get_size(pixmap, &width, &height);

//create a gtk-independant surface to draw on
cairo_surface_t *cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_t *cr = cairo_create(cst);

//Vertical Line
cairo_move_to(cr, 200,30);

//Horizontal Line
cairo_move_to(cr, 120,120);


//do some time-consuming drawing
static int i = 0;
++i; i = i % 300; //give a little movement to our animation
cairo_set_source_rgb (cr, .9, .9, .9);
cairo_set_source_rgb (cr, 0.8, 0.5, 0.9);
cairo_move_to(cr, 50,50);

int j,k;
/* for(k=0; k<100; ++k){*/ //lets just redraw lots of times to use a lot of proc power
for(j=0; j 100)
cairo_move_to(cr, 200,76);
cairo_arc(cr, 200+i,76+i,0,0,0);
cairo_arc(cr, 100+i,76,0,0,0);

/* cairo_rectangle(cr,50+i,50+i,50,50); */

/* }*/

//When dealing with gdkPixmap's, we need to make sure not to
//access them from outside gtk_main().

cairo_t *cr_pixmap = gdk_cairo_create(pixmap);
cairo_set_source_surface (cr_pixmap, cst, 0, 0);



currently_drawing = 0;

return NULL;

gboolean timer_exe(GtkWidget * window){

static gboolean first_execution = TRUE;

//use a safe function to get the value of currently_drawing so
//we don't run into the usual multithreading issues
int drawing_status = g_atomic_int_get(&currently_drawing);

//if we are not currently drawing anything, launch a thread to
//update our pixmap
if(drawing_status == 0){
static pthread_t thread_info;
int iret;
if(first_execution != TRUE){
pthread_join(thread_info, NULL);
iret = pthread_create( &thread_info, NULL, do_draw, NULL);

//tell our window it is time to draw our animation.
int width, height;
gdk_drawable_get_size(pixmap, &width, &height);
gtk_widget_queue_draw_area(window, 0, 0, width, height);

first_execution = FALSE;

return TRUE;


int main (int argc, char *argv[]){

//we need to initialize all these functions so that gtk knows
//to be thread-aware
if (!g_thread_supported ()){ g_thread_init(NULL); }

gtk_init(&argc, &argv);

GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GdkColor color; = 0xffff; = 0xffff; = 0;
gtk_widget_set_size_request (GTK_WIDGET (window), 500, 400);
gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(window), "expose_event", G_CALLBACK(on_window_expose_event), NULL);
g_signal_connect(G_OBJECT(window), "configure_event", G_CALLBACK(on_window_configure_event), NULL);

//this must be done before we define our pixmap so that it can reference
//the colour depth and such

//set up our pixmap so it is ready for drawing
pixmap = gdk_pixmap_new(window->window,700,700,-1);
//because we will be painting our pixmap manually during expose events
//we can turn off gtk's automatic painting and double buffering routines.
gtk_widget_set_app_paintable(window, TRUE);
gtk_widget_set_double_buffered(window, FALSE);

(void)g_timeout_add(33, (GSourceFunc)timer_exe, window);


return 0;

Visual Verification

The function cairo_arc was used in program
and was visually found to possess a certain degree of correctness.


There is an Arc with Radius 0.

system administration command

$pnginfo osauxiliaryvector.png
Image Width: 1600 Image Length: 1200
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 4
Pixel depth (Pixel Depth): 32
Colour Type (Photometric Interpretation): RGB with alpha channel
Image filter: Single row per byte filter
Interlacing: No interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: 2835, 2835 (pixels per meter)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 1 of 9
Comment (xTXt deflate compressed): Created with GIMP


$pngcp -s 3 osauxiliaryvector.png osvnew.png
Expanding from 4 channels to 3 channels
Target byte depth is 1 bytes

$pnginfo osvnew.png
Image Width: 1600 Image Length: 1200
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 3
Pixel depth (Pixel Depth): 24
Colour Type (Photometric Interpretation): RGB
Image filter: Single row per byte filter
Interlacing: No interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: 0, 0 (unit unknown)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 0 of 0



create a new PNG file, having changed some attributes

The number of components per pixel.
SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color
images. SamplesPerPixel is usually 3 for RGB images. If this value is
higher, ExtraSamples should give an indication of the meaning of the
additional channels.

source :

code exposition

248: gui.line(x1,y1,x2,y2,color)
250: else --(x1 ~= x2) and (y1 ~= y2)
251: gui.line(x1 ,y1 ,x2-1,y1 ,color) -- top
252: gui.line(x2 ,y1 ,x2 ,y2-1,color) -- right
253: gui.line(x1+1,y2 ,x2 ,y2 ,color) -- bottom - GPL - Lua

computer architecture and physics

Computer Architecture.
Pointer Register :
BP - Base Pointer . Used to pass data to and from the stack.
source :

Electromagnetic radiation that has a wavelength in the range from about
4,000 (violet) to about 7,700 (red) angstroms and may be perceived by
the normal unaided human eye.

source :