Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!

Black Knight

Member Since 01 Jan 2002
Offline Last Active Aug 03 2015 02:32 PM

Topics I've Started

[Open Source] Introducing NodeBB: The Discussion Platform of the Future

20 June 2013 - 08:54 AM

Hey all,

I just wanted to take the time to let everybody know that my startup is releasing our first product -- NodeBB, a forum built on Node.js, Redis, and Web sockets.



The best part is the entire thing is open sourced from the start, so if this piques your interest, check out the code and jump right in!

We're also raising money through a crowdfunding round at our Indiegogo page.

Built on Node.js and Redis, we aim to tackle existing forums (almost all of which are built on LAMP stacks), and offer a product that aims to be an improvement on almost all levels... responsive design, two-way server-client communication, etc.


Planar projection shader

25 February 2013 - 07:03 PM

I am  rendering a scene to a reflection texture and then drawing a water plane with that texture using projection. Most of the samples I have seen on the web pass in a view-projection matrix to the vertex shader and transform the vertex, then in the pixel shader they do :




projection.x = input.projectionCoords.x / input.projectionCoords.w / 2.0 + 0.5;
projection.y = input.projectionCoords.y / input.projectionCoords.w / 2.0 + 0.5;


I have a shader that does the following and it works too but I don't know where I found this particular code or how it gives the same results with the above code. Here is the code I have


Vertex shader : (world is an identityMatrix, viewProj is my cameras combined viewProjection matrix:


output.position3D =  mul(float4(vsin.position,1.0), world).xyz;
output.position = mul(float4(output.position3D,1.0), viewProj);

output.reflectionTexCoord.x = 0.5 * (output.position.w + output.position.x);
output.reflectionTexCoord.y = 0.5 * (output.position.w - output.position.y);
output.reflectionTexCoord.z = output.position.w;



Pixel shader : 



float2 projectedTexCoord = (input.reflectionTexCoord.xy / input.reflectionTexCoord.z);


What confuses me is the usage of "0.5 * (output.position.w + output.position.x)" and "0.5 * (output.position.w - output.position.y)". How does this have the same effect and what does the w component mean here?


ActionScript 3 Local Timer Object Event Handler

04 May 2011 - 09:02 PM

I have the following code in a class function :

public function foo():void
var timer:Timer = new Timer(10000,1);

public function onTimerComplete(e:TimerEvent):void
// do stuff
The above code works most of the time but my concern is what happens if timer gets garbage collected? Is it possible that onTimerComplete will never fire because there are no other references to timer?

For some discussion about this : http://stackoverflow.com/questions/5891354/actionscript-3-local-timer-object-event-handler

Basically I made a test app and created 500 timers and set all their delays to a high value like 60secs and then I spammed garbage collect in my profiler and none of the timers got garbage collected. But after the event handlers ran after 60secs hitting garbage collect freed all of those timers.

I have people saying that removeEventListener must be called on each timer or they wont get released. But this is not what I am observing.

I know timer has an internal list of handlers but that won't keep it from being GC'ed i think.

[web] mysql select and insert

17 November 2010 - 12:00 PM


Is it possible to do a select and insert in a single query?

I am trying to get data from a table and if the data doesn't exists i want to create a row and set default values. Something like:

SELECT * FROM stats WHERE id=someID IF DOESNT EXISTS INSERT INTO stats VALUES(default1,default2)

[web] JSON file and IE

08 November 2010 - 02:35 PM


I've downloaded this file :

Added it to my index page before my own javascript file:
<script type="text/javascript" src="json.js"></script>

Then i try to load a txt file like so :

var getXMLHttpRequest = function()
if (window.XMLHttpRequest) {
return new window.XMLHttpRequest();
else {
try {
return new ActiveXObject("MSXML2.XMLHTTP.3.0");
catch(ex) {
return null;

var loadJSON = function(url)
var xmlHttp = getXMLHttpRequest();

if (xmlHttp != null)
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200){


return xmlHttp.responseText;

alert("Your browser does not support XML HTTP.");

The content of the text file is a simple JSON object which loads fine in Firefox, but in IE i get an error pointing to line JSON.parse(xmlHttp.responseText);

Anyone know what's wrong?