PaperVision 3D Cubes Experiment

May 26th, 2009 · 2 Comments

I spent my Memorial Day evening setting up a PaperVision 3D project to serve as a demo for a customer and I just so happened to save the project as I was getting the basics implemented.  I thought it would make a perfect blog post for those just getting started with PV3D.

The project covers moving the camera around in 3D space (including focusing in on objects) as well as object distribution including in a straight (horizontal) line and random distribution in 3D space (more screenshots after the jump).

There are two classes in this file, the first (called CustomCube) extends the PaperVision Cube class.  This is very basic, the only custom code in here creates random colors for each face and sets a random X/Y position.  The other class, which does all the heavy lifting, extends BasicView and includes an ArrayCollection to keep track of references to the CustomCube classes.  This class has built in functions to move the camera and distribute CustomCube objects in 3D space.

I’m using the Tweener Libraries to move the camera and cubes.

Check it out below, source code included.

View the Project in Action
View the Source Code

Papervision 3D Random Cubes Screenshot

[Read more →]

→ 2 CommentsTags: ActionScript · Flex · PaperVision 3D

Energy Dashboard

March 17th, 2009 · 3 Comments

I haven’t posted in a while so I thought I’d take a second and post something that I’ve been working on for BuildingLogix.  Over the last six months we have worked closely with a partner in Pennsylvania to develop a dashboard for campus of office buildings in the Philadelphia area.   The dashboard is created entirely in Adobe Flex 3 and runs in the Flash Player.  It used to keep track of and analyze electricity data in real time as well as historically.

Unfortunately the live site is only available with VPN access, however we have created a demo of the application with junk data available on the web at http://energy.buildinglogix.net/

Our next project is redeveloping the BuildingLogix web site which is almost complete – look for that soon (also fully developed in Adobe Flex).

We have developed other Energy Dashboard applications in the past including EcoRate which can be demoed here: http://www.buildinglogix.net/ecorate/

→ 3 CommentsTags: ActionScript · Flex · Work

URLLoader Caching Nightmares

January 11th, 2009 · 4 Comments

Why people are still using Internet Explorer 6 (or any version for that matter) is beyond me; but recently when developing a trending application for a company that only supports IE6 I ran into the age-old caching issue.  Normally, I would add a random number at the end of the URL string, however, this application has 30-40 different URLLoaders and that would just be annoying.  

For those who may not be aware, when loading dynamic XML data in Flash or Flex, say from a PHP page, if you are using the same link over and over again, IE6 decides that it only needs to check the link once.

It seems the easiest way to prevent caching in Internet Explorer is to set the Headers on the response of your data to “Pragma: no-cache” and “Cache-Control: no-store”.  Now this may be a little overkill, but for my problem, this was the only option.  You could try and allow a little more caching by using “Pragma: public” but this didn’t work in my case.

I’m using Java to serve XML data, so my code looks something like this (where op is a servlet request)

  1. op.getResponse().addHeader("Cache-Control", "no-store");
  2. op.getResponse().addHeader("Pragma", "no-cache");

But in PHP you could do this:

  1. Header("Cache-Control: no-store");
  2. Header("Pragma: no-cache");

Just remember, as always with the PHP Header() function, that you put this before anything is sent to the client – include any white space before your beginning <?php tag.

A great resource for more information (including a testing client) is located on the Less Rain Blog at http://www.blog.lessrain.com/flash-loading-and-browser-cache-test-suite/

→ 4 CommentsTags: ActionScript · Flash · Flex

The Great Southern Ohio Black Out

September 15th, 2008 · No Comments

Sunday afternoon we southern Ohioians got some bad… baaaaaad winds – people getting blown off the highways, trees down and debris everywhere.  I was only without power for about 6 hours last night before my electric company (a “rural electric cooperative”) got me back up and running.  Most people around this area use Duke Electric or DP&L – both of which have around 225,000 customers without power (each) as I write this blog.  While sitting in the dark with my MacBook running on battery power, connected to the internet doing some work with my Sprint air card it sort of hit me how far we’ve come technology-wise in just the last 10 years.  I thought it was awesome I was able to access my computer and the internet even though the power was down for miles – so much so that I had to blog about it 🙂

Here are some interesting pictures of the damage (from whiotv.com)

[Read more →]

→ No CommentsTags: Personal

MacFUSE and SSHFS

September 4th, 2008 · No Comments

I have been using MacFUSE and SSHFS by Google for a while now, and today it struck me just how nice it makes my life – especially when working on web sites remotely. If you’ve never heard of MacFUSE/SSHFS it’s a suite of file system utilities for Mac OS X. Google explains it as:

…software that allows you to write arbitrary file systems as user-space programs. You can think of it as a library for easily developing file systems. Another crude way to look at this would be to think of MacFUSE as something that makes Mac OS X work like a microkernel for the purpose of writing/running file systems.

Most users, especially web developers, are used to using FTP or SSH to connect to a remote web server and upload or download files.  This usually requires some type of client, even if it is popping open the command line and working from there.  With SSHFS you can open the icon in your dock and you are able to map “drives” (which are just folders on remote hosts) as if they were a network drive on your LAN.

Below is the quick and easy process: [Read more →]

→ No CommentsTags: Mac

Google Gadget Cache

June 9th, 2008 · 7 Comments

Today I was updating one of our Google Gadgets at work and after almost an hour of changing random stuff in the code with no different result on iGoogle I realized I had forgotten about the cache!  Google seems to cache XML gadget files and Flash content for at least 1 hour.  I haven’t found a way to disable this per gadget (although I spent no time looking) but what you can do is use the Developer’s Gadget to control the cache for each gadget on your homepage.  This is a must have if you’re doing any type of Google Gadget development… add it to your iGoogle page by clicking here.

→ 7 CommentsTags: Google Gadget · xml

PHP: Object to URL Data

June 3rd, 2008 · No Comments

This is a simple, but very handy function when working with PHP and Flash.  This will turn an object into a string of URL data – this is very helpful converting a mySQL object from mysql_fetch_object to Flash variables.

  1. function object2URLData($obj)
  2. {
  3.      $data = "";
  4.      foreach($obj as $key=>$prop)
  5.      {
  6.           if($data != ""){ $data .= "&"; }
  7.                $data .= "$key=$prop";
  8.      }
  9.      return $data;
  10. }

→ No CommentsTags: Flash · PHP

Adam 1, oBIX None

June 2nd, 2008 · 3 Comments

After a hard day’s work on the oBIX to Flash project I blogged about yesterday, I am happy to report that progress is moving fast.  The module (currently called FloBIX) is able to parse oBIX and convert it into a collection of ActionScript 3 objects – usable in Flex 3 or Flash CS3.  It currently supports the following oBIX primitive types: Abstime, Bool, Icon, Int, Obj, Real, Ref, Str and Uri.   These primitives support all documented attributes.  The next step is finishing up Reltime and dealing with Contracts and Ops.  

All objects other than the main class (FObix) are subclasses of an abstract object called FAbstractElement.  This class supports all common attributes in oBIX and is extended for the various elements (or objects as they are referred to in the oBIX specification).

The FIcon class extends Sprite and is able to be called on by your ActionScript code to actually display the icon file that oBIX points you to – the loading of the graphic file is taken care of automatically by the FIcon class based on the URI given in the icon attribute.  Example: this.content = obix.Root.Children.SomeControlPoint.Icon; will set a Sprite or MovieClip’s content to the icon property of an oBIX object.

Like most Flash objects, FloBIX is completely event driven.  A custom event wrapper has been written for all FloBIX asynchronous calls which can be handled just like any other event in ActionScript.

The main class accepts a string of XML data or a URI to an oBIX feed and then parses the XML into a collection of Flash objects.  Example: obix.setXMLByURI(new URLRequest(“http://192.168.1.255/obix/Device”));  By utilizing the URLRequest object you can specify other data such as POST variables – which may be required for authorization on some devices/servers.

An ArrayCollection is being used currently, however I intend to write a custom class for collection which will allow for querying of children by URI, name, etc.  In lieu of this custom class, helper methods are being used for this type of access i.e. methods like getChildByName(), getChildByURI(), etc.

I am starting to get excited about implementing this library in an actual project when it’s completed, but I’ve had about all the oBIX I can stand for one night!

→ 3 CommentsTags: ActionScript · Flash · Flex · oBIX · Work · xml

Software Releases and Airport Life

June 1st, 2008 · 2 Comments

I’m finally back from a long month of traveling, Tampa Florida and Portland Oregon were the two big destinations in May.  Unfortunately that means I had little time to do anything of value (code wise) – I feel like I’ve was in airports more than destinations.  During layovers I was happy to find out that two of my favorite apps have beta versions of new releases out.

VMWare Fusion 2.0 Beta – Finally has multiple display support!  Woot! I’ve been dreaming of this day for a long time and it’s finally here, and the feature works perfectly.  The new version doesn’t play so well with Spaces, but VMWare says this is an Apple problem – I haven’t noticed anything since the 10.5.3 update for Leopard so maybe that fixed it.

Dreamweaver CS4 Beta – Just released last week – has some pretty interesting features.  I love the use of WebKit for instant previews of dynamic content right inside of the app.  I haven’t had a whole lot of time to play around with it but I’ll probably do a full report sometime soon.

Lately I’ve been working on some internal Flex charting apps, I’ll probably post a demo link when we release it to our customers.  Tomorrow I’m going to start work on a Flash implementation of oBIX (an XML standard for machine to machine communication of building data).  I would like to open source this project at some point, but one step at a time.  I’ll write about it when there is more to report.

Until next time…

→ 2 CommentsTags: Dreamweaver · Mac · Travel · Work

PHP: Get IP/Host and Proxy Information

April 12th, 2008 · 3 Comments

Below is a method I use to detect the IP Address and Host Name as well as Proxy Information of a visitors.

  1. if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != ""){
  2.      // for proxy
  3.      $IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
  4.      $proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
  5.      $host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);
  6. }else{
  7.      // for normal user
  8.      $IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];
  9.      $host = @gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);
  10. }

→ 3 CommentsTags: PHP