www.coreygoldfeder.com
    Home     Research     Publications     CV     Selected Code     Fiction     Comics     Contact Me     Blog
This section of the website will include whatever recent code I've written that I think is cool enough to share with the world. In general, I make no guarantees about the safety or correctness of anything here.

C++ Heapaware Mixin

Suppose in C++ that you want to know if a class was created on the heap or the stack. Bad news - there's no way to tell. This means, for example, that if you assign the address of a stack object to a smart pointer, the smart pointer has no way of detecting that and you are in for a nasty surprise when it tries to delete the pointer.

But what if you really want to know if an object is on the heap? Most C++ programmers will tell you that it can't be done. (A few of the wiser ones will tell you that maybe it can be done, but it shouldn't be. I won't argue that point.) The good news is that I've solved the problem for you - all you need to do is include my "heap_aware.h" and have your classes inherit from "HeapAware". You get a new member function "OnHeap()" which tells you exactly what you wanted to know. It isn't thread safe yet, but otherwise it works as advertised.

HeapAware is licensed under the GPL. The code is available on SourceForge.

Java 3D engine

This project is a 3D engine (Phong and Gouraud shading), written entirely from scratch in pure Java. When I was beginning to learn about 3D graphics, I was frustrated that there was nothing online to show this sort of simple low level implementation. Most sites just show you how to use a package like OpenGl or DirectX and not what's going on inside. The code is somewhat old (I wrote it in 2003 as an undergrad), but it should still work. It's copyrighted, but you can use it as long as you:

  • Leave a notice in the program that mentions my name and this website
  • Send me an email so that I can know if anyone is making use of it
  • Do not submit this as your own work for any sort of class

A functional applet version of the engine (it works as an applet or as an application) is available here.

Here is the code:

Java Distributed Whiteboard

My distributed whiteboard is also in Java and also from my undergraduate days. This one is just one file, WhiteboardClient.java, and I'm posting it here as a demonstration of how to write distributed network applications. It's a reasonably intelligent client in that it maintains distributed control and synchronizes any number of peers without any sort of central server. If you wirsh to use this code, the licensing terms are the same as for the 3D engine above.                                                                                                                                

www.coreygoldfeder.com
copyright 2007, all rights reserved
text this small isn't meant to be read