Archive

Monthly Archives: November 2011

Played with JavaScript the entire day:
1. Trying to make Sundae.js only run one test at a time.
2. Trying to take a screen-shot of my canvas correctly.

First Issue:
– Sundae.js runs all the tests as fast as it can multi-threaded.
– CubicVR.js can only render to one canvas.
Pretty big issue. It seems impossible without a complete refactoring of Sundae to make it work on only one test at a time.

Second Issue:
I attempted everything I could think of to try and get a screen-shot of my canvas without forcing some sort of delay (see previous posts), no dice.
I’m convinced at this point that this is an issue with Firefox or CubicVR.js.
At least its all refactored and working (more or less):

function createCanvas () {
   var canvasFrame = document.getElementById('render-frame'),
       pngFrame = document.getElementById('png-frame');

   // get rendering canvas and context
   var r = window.document.createElement('canvas');
   var rCtx = r.getContext("experimental-webgl", {preserveDrawingBuffer: true});
   r.id = "render";
   r.width = 300;
   r.height = 300;
   canvasFrame.appendChild(r);

   // get the png canvas and context
   var p = window.document.createElement('canvas');
   var pCtx = p.getContext("2d");
   p.id = "pngImage";
   p.width = 300;
   p.height = 300;
   pngFrame.appendChild(p);
}

function makeScreen () {
   var render = document.getElementById('render'),
   png = document.getElementById('pngImage'),
   pCtx = png.getContext("2d");

   pCtx.drawImage(render, 0, 0);
}

function runBuilder () {
   var render = document.getElementById('render'),
       png = document.getElementById('pngImage'),
       code = document.getElementById('code');

   // run code.
   eval(code.value);	
   test(render, function () {});

   setTimeout("makeScreen()", 500);
}

Paste your code here:
paste code
Get back a Screenshot
screenshotted

I’m super overwhelmed and about ready to give up.
I need another bug.

At least I learned how much I despise writing test runners.
Save Me Humph 😦

 
 
 
As a bonus to this release I uploaded one of my summer projects to github:
Here
Totally not a stab at extra credit >_>; nope.

It allows you to inject code into a running process.
You can replace any external symbol (eg: a call to any symbol not hardcoded into the application).
This was done during my internship at Gridcentric.

The Demo:
thetime.c
This just repeats the local time over and over using asctime() to return a string
thetime

Running it
tell me the time

We inject a call to dlopen on hammertime.so (my own shared library)
dlopen() loads a library into the address space of the process.

dlopen

inject remap [pid] [symbol_to_hook] [replacement] auto searches and replaces
The toolset allows you to manually specify the symbol you wish to find / replace.
inject remap [pid] [libname:symbol_to_hook] [libname:replacement]
hook and remap asctime

It also allows you to do a one-off call to a function of your choice:
We will be calling hammer_on() to start a thread as a child of the running process
hammertime.so

Hammer_On was called.
call hammer_on