RSS Event Manager: My first open source project!

Finally finished going through the whole process to get a work project released as open source, check it out: http://sourceforge.net/p/rsseventmanager

We wanted a tool that would let us push events to an RSS server through a REST API. We modified our build scripts to use curl and send an HTTP Post to a server running a set of php scripts that I wrote. This replaces our old setup where we would send out constant emails to a list. It also means getting notified of events corresponding to a product is as easy as subscribing to an RSS feed.

Car Talk Puzzler - Lightbulbs

The gf and I were listening to car talk this morning and they had an interesting puzzle - imagine a hallway as long as you can see, with light bulbs going down at regular intervals, the kind with a chain you pull that toggles it on or off. Now suppose that someone walks down to the end and turns on every light. Next, another person walks down and pulls the chain on every other light (light #2, 4, 6, 8, ....). The third person pulls every third light, the forth every forth light and so on. After lots of pulls, what pattern emerges?

A simple 3d analog clock with Away3d

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly. If you don't have flash, download it here!

I wanted to recreate a simple program I made in school when I was taking a class in OpenGL. Away3d and most of the other Flash 3d libraries use the same basic principles so it was pretty straight-forward. I used a few primitive objects to represent the hour, minute and second hand, then rotated them based on the current time. You can move the camera by dragging the mouse.


package
{
       import away3d.cameras.HoverCamera3D;
       import away3d.containers.View3D;
       import away3d.materials.WireColorMaterial;
       import away3d.primitives.Cube;
       import away3d.primitives.Sphere;

       import flash.display.Sprite;
       import flash.events.Event;
       import flash.events.MouseEvent;
       import flash.geom.Vector3D;
       import flash.text.TextField;

       [SWF(width="500", height="500", backgroundColor="#ffffff")]

       public class Main extends Sprite
       {
               private var view:View3D;

               private var yAxis:Vector3D = new Vector3D(0, 1, 0);

               private var secondHand:Cube = new Cube({width:10, height:250, depth:10});
               private var minuteHand:Cube = new Cube({width:15, height:200, depth:15});
               private var hourHand:Cube = new Cube({width:20, height:150, depth:20});

               private var timeDisplay:TextField = new TextField();

               // HoverCam controls (see
http://www.flashmagazine.com/articlefiles/away3d/Triaxe.as)
               private var myCamera:HoverCamera3D;
               private var lastMouseX:Number;
               private var lastMouseY:Number;
               private var lastPanAngle:Number;
               private var lastTiltAngle:Number;
               private var mouseMove:Boolean = false;

               public function Main()
               {
                       addEventListener(Event.ENTER_FRAME, away3dloop);

                       myCamera = new HoverCamera3D({zoom:2, focus:100, distance:250});
                       myCamera.panAngle = 45;
                       myCamera.tiltAngle = 20;
                       myCamera.minTiltAngle = -90;
                       myCamera.hover(true);

                       view = new View3D({x:stage.stageWidth / 2, y:stage.stageHeight / 2,
camera: myCamera})
                       view.scene.addChild(hourHand);
                       view.scene.addChild(minuteHand);
                       view.scene.addChild(secondHand);
                       view.scene.addChild( new Sphere({radius: 20}) );

                       secondHand.movePivot(0, secondHand.height / 2, 0);
                       minuteHand.movePivot(0, minuteHand.height / 2, 0);
                       hourHand.movePivot(0, hourHand.height / 2, 0);

                       addChild(view);

                       timeDisplay.width = 200;
                       addChild(timeDisplay);

                       stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
                       stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
                       stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheel);
               }

               private function mouseDown(event:MouseEvent):void
               {
                       lastPanAngle = myCamera.panAngle;
                       lastTiltAngle = myCamera.tiltAngle;
                       lastMouseX = stage.mouseX;
                       lastMouseY = stage.mouseY;
                       mouseMove = true;
               }

               private function mouseUp(event:MouseEvent):void
               {
                       mouseMove = false;
               }

               private function mouseWheel(event:MouseEvent):void
               {
                       myCamera.zoom += event.delta;
                       trace("zoom = " + myCamera.zoom);
               }

               private function away3dloop(event:Event):void
               {
                       var date:Date = new Date();

                       timeDisplay.text = date.toString();

                       var percentSeconds:Number = date.seconds / 60;
                       var percentMinutes:Number = (date.minutes + percentSeconds) / 60;
                       var percentHours:Number = (date.hours + percentMinutes) / 12;

                       /*trace(date);
                       trace("sec = " + percentSeconds);
                       trace("min = " + percentMinutes);
                       trace("hour = " + percentHours);*/

                       secondHand.rotationZ = - percentSeconds * 360 + 180;
                       minuteHand.rotationZ = - percentMinutes * 360 + 180;
                       hourHand.rotationZ = - percentHours * 360 + 180;

                       // Approximately same speed as mouse movement
                       var cameraSpeed:Number = 0.3;

                       if (mouseMove)
                       {
                               myCamera.panAngle = cameraSpeed*(stage.mouseX - lastMouseX) + lastPanAngle;
                               myCamera.tiltAngle = cameraSpeed*(stage.mouseY - lastMouseY) +
lastTiltAngle;
                       }
                       myCamera.hover();

                       view.render();
               }
       }
}

Syndicate content