JSON - 3D Proof of Concept

A few weeks ago I wrote a post on the concept of using JSON for creating 3-D models (You can read the first JSON 3D post here). I have created a proof of concept based on MooCanvas to allow for IE support. This proof of concept is also based on the 3D cube demo for MooCanvas with some modifications.

For this proof of concept the important function is Load3D which loads and translates the JSON 3D object.

 		function Load3D(obj, translateX, translateY, translateZ){
			scene.shapes[(obj.type + ObjectCounter + "")] = new Shape();
			var p = scene.shapes[(obj.type + ObjectCounter + "")].points; // for convenience
			for(var a=0; a<obj.vrt.length; a++){
				p[a] = new Point(((obj.vrt[a][0])+translateX), ((obj.vrt[a][1])+translateY), ((obj.vrt[a][2])+translateZ));
			}
 
			// Create Shape From Points
			for(var a=0; a<obj.fac.length; a++){
					scene.shapes[(obj.type + ObjectCounter + "")].polygons.push(new Polygon(
					[ p[obj.fac[a][0]], p[obj.fac[a][1]], p[obj.fac[a][2]], p[obj.fac[a][3]] ],
					new Point(obj.nrm[a][0], obj.nrm[a][1], obj.nrm[a][2]),
					true /* double-sided */,
					Polygon.SOLID,
					[obj.mat[a][0], obj.mat[a][1], obj.mat[a][2]]
				));

			}
			ObjectCounter+=1;
 		}

For the JSON 3D object you would pass it into the Load3D function. While in this example I have put the JSON 3D object in the HTML, you would load the JSON 3D using Ajax (or a script tag) in the real world.

			var ThreeDobj = {
			"vrt":[[-10,-10,-10],[10,-10,-10],[10,10,-10],[-10,10,-10],[-10,-10,10],[10,-10,10],[10,10,10],[-10,10,10]],
			"fac":[[0,1,2,3],[4,5,6,7],[2,3,7,6],[2,3,7,6],[0,4,7,3],[1,5,6,2]],
			"nrm":[[0,0,-1],[0,0,1],[0,1,0],[0,1,0],[-1,0,0],[1,0,0]],
			"mat":[[70,70,70],[80,80,80],[80,80,80],[75,75,75],[70,70,70],[70,70,70]],
			"type":"cube"}
			Load3D(ThreeDobj, 0, 0, 0);

You can see the proof of concept here.

The proof of concept has been tested on Google Chrome, FireFox 3 and IE 7. It may work on other browsers (it should work on Safari and Opera), but has not been tested.

Ruby on Rails 2.2 Released

Tagged:  

The web application framework that broke the mold (and made Ruby famous in the process) has released version 2.2.

Key features in the update include:

  • Ruby 1.9 compatibility. Among the key features that Ruby 1.9 brings (at least for users of the "main" C-based implementation) is a single native thread for every Ruby thread. Finally. Now Rails applications can run with much less memory consumption and better processor utilization. Will you miss all those extra Mongrel instances? Probably not.
  • Thread safety. Important updates to the framework have been made to ensure thread safety. This will be a big boon to JRuby users (who have been dreaming of this for a long time), but C Ruby users will have to wait for certain dependencies to be updated before they can really enjoy its benefits (most notably those--ahem--with large amounts of C code). To enable mutli-threading, add config.threadsafe! to your config/environments/production.rb. (Note, however that this will disable automatic loading by ActiveSupport::Dependencies.) Plan on becoming more familiar with Mutex.
  • Internationalization. i18n has been baked into the framework, making localization of your application much easier.
  • ActiveRecord now has a proper connection pool.

The release notes are here.

Rails 2.2 now requires RubyGems 1.3.1, so you'll want to make sure to update it (gem update --system) first. To install the new version, do something like the following:

gem install rails
rake rails:update

Arun Gupta from Sun also gives a nice overview of how to run Rails 2.2 on GlassFish v3 Prelude and JRuby 1.1.5.

Visual WebGui 6.2.1 SDK released

I would like to share with you the release announcement of Visual WebGui 6.2.1 SDK made last week by Gizmox.
The Visual Webgui SDK now incorporates both the DHTML and the Silverlight and enables to work with both .NET 2.0 and 3.5 on the same machine. In addition, the new release includes the new wrapper feature announced earlier.

Version 6.2 presented some important enhancements mainly to the developer experience as it introduced a complete integration into Visual Studio, a consolidated installation process and compatibility with Visual Studio Express edition and DharpDevelop.

Here is a more detailed about this version description:

New feature Summary
ASP.NET Control Wrapper wizard Asp.Net Wrapper wizard added to Visual WebGui infrastructure.
This wizard enhances Visual WebGui abilities and allows you to use any ASP.NET thirdparty control that you have and add it to you Visual WebGui application as an out ofthe box control. Making Visual WebGui applications even richer than before.

Issue Summary
VWG-2721 Tabbing between controls bug solved
VWG-3097 Problems with Flow Layout Panel bug solved
VWG-3140 Integration package and source control problems solved
VWG-3189 Installation prerequisites warnings & errors issues fixed
VWG-3143 DateTimePicker in Time Format with ShowUpDown set to true AM/PM problem fixed
VWG-2363 TextBoxValidation IntegerMaskValidator fixed and dosent allows non-numeric characters
VWG-3139 Now you can install 2.0 and 3.5 at the same time
VWG-3178 Unnecessary padding was removed from bottom RibbonBarGroup
VWG-3130 EnterKeydown event Problem was fixed and is now fired
VWG-2460 TreeView events issues solved
VWG-3077 DataGridView border fixed
VWG-2699 Anchor in HtmlBox fix
VWG-3078 Session state serialization under IIS fixed
VWG-3076 Charting in catalog fixed
VWG-3033 Theme registration in VS2005 solved
VWG-3061 Problem with controls events in FlowLayoutPanel solved

The Visual WebGui framework is available as a free download here

Netbeans 6.5 Released

Tagged:  

In the tradition of "Release early, release often", the Netbeans team has released version 6.5, continuing the rapid release cycle the project set with 5.5, 6.0, and 6.1. There many new features, most notably support for Groovy /Grails and PHP. Here's a short list of the other "new and notables":

  • A new "Compile and Deploy on Save" feature for Java applications.
  • Support for the Nimbus look and feel in the Swing GUI builder (Matisse)
  • Big improvements in the JavaScript support, particularly in the area of debugging.
  • Support for Ruby on Rails 2.1 (JRuby 1.1.4 is bundled)
  • Improved SQL support, including SQL history and editor auto-completion.

There is also an early access release of Python support in Netbeans that is available as a separate download.

Get Netbeans 6.5 here.

JSON - 3D

Tagged:  

Recently I have been looking at 3D as it pertains to the web and controlled through JavaScript without the aid of plug-ins (this is a topic that interests me as in my early programming I created a lot of 3D applications). While Canvas is currently good for 2D rendering (on most browsers and IE with a little help from Google) we are still a ways off from cross browser Canvas 3D support. While I have found a few 3D engines written with Canvas, they all seem to bomb on IE (even with Google's IE Canvas script).

Even if a good 3D solution was available for the web we still have the issue of being able to load all the models for a scene. This got me thinking a bit about how the loading of scene information could be made to work on the Web.

The concept that I have come up with is fairly simply. You would load a map of the scene (this map may could be stored in JSON and could be made to work as a BSP [Binary Space Partitioning] tree) and on the map you would have various check points. Each checkpoint would load the needed models using JSON.

Below is an example of what the JSON for a cube may look like.

{"obj":[{"vrt":[[-5,-5,5],[5,-5,5],[-5,5,5],[5,5,5],[-5,-5,-5],[5,-5,-5],[-5,5,-5],[5,5,-5]],"fac":[[0,2,3,1],[3,1,0,1],[4,5,7,0],[7,6,4,0],[0,1,5,4],[5,4,0,4],[1,3,7,3],[7,5,1,3],[3,2,6,5],[6,7,3,5],[2,0,4,2],[4,6,2,2]],"nrm":[[0,0,-1],[0,0,-1],[0,-0,1],[-0,0,1],[0,-1,0],[0,-1,0],[1,0,-0],[1,-0,0],[0,1,0],[0,1,0],[-1,0,0],[-1,-0,-0]]}],"mat":[{"r":150,"g":225,"b":219},{"r":150,"g":162,"b":223}]

While this is just a concept and we are still waiting on the technology to make the possible. It is interesting to think of how we may be able to use JSON - 3D in the near future.

You can see a demo of Canvas 3D by nihilogic.dk using JSON for models here (this works on Firefox, but may not work on other browsers).

I Want My Type Information (Back)

Tagged:  

As Neal Gafter explained a while ago, there is a backdoor in Java's generic type erasure:

getClass().getGenericSuperclass()

Google Guice makes use of this backdoor to enable the construction of a generic type literal (or Super Type Token): its TypeLiteral class. Now (the soon to be released) Guice 2.0 goes a step further: it can inject a TypeLiteral into your class, thereby reifying your generic types (well, sort of). All the details of the changes to com.google.inject.InjectorImpl are here.

As Neal Gafter also explained, java.lang.reflect.Type really should be retrofitted. Until then, Guice offers you a little help.

jMaps - jQuery Google Maps Plugin

jQuery has quickly become one of the most used JavaScript libraries around. Google Maps is possibly the most popular mapping website on the web. Wouldn't it be nice to connect the two easily using a small library? Well, jMaps is a library that does just that and version r64 has just been released.

Below is a rundown of the main features as posted on the jMaps Google Code page.

jMaps is a jQuery plugin that provides a really easy API to create and manage multiple google maps on any page.

  • Geocode and reverse any valid address in the world via Google's geocoding API
  • Search for directions to and from any location
  • Add and remove Markers
  • Add and remove polygons and polylines
  • Add and remove graphic layers on the map
  • Add and remove Google adsense layers
  • Add and remove Traffic layers
  • Get information back such as map center, map size, map type, etc

You can go to the Google Code page here.

50 Must-read Books on Web Development

Tagged:  

Looking for a good book on web development? Well, over at Nettuts they have put together a good list of 50 good books. So, if you are looking for a good book on web development this list should have quite a few good suggestions.

Below is an excerpt from the list.

Frameworks

8. Agile Web Development with Rails

Ever since Rails took the development world by storm a few years back, there has been plenty written about the Ruby framework. But you can't find a much better resource than one written by Rails creator David Heinemeier Hansson.

  • 9. Python Web Development with Django

    Django is an excellent python framework, and one that is highly respected in the development community. Python Web Development with Django is 400 pages of excellent techniques and tutorials for learning django development.

  • 10. Professional CodeIgniter

    CodeIgnitor is a PHP-based framework that has shown excellent promise amongst other frameworks. Professional CodeIgnitor gives an overview of MVC programming, and outlines how to build excellent web applications with CodeIgnitor.

  • 11. Beginning CakePHP: From Novice to Professional

    Beginning CakePHP: From Novice to Professional is a handy paperback for beginners trying to learn the MVC-based framework, but also, as the name implies, is highly useful for an intermediate or advanced CakePHP programmer. The book claims it's geared for...

    ...an audience of developers already familiar with PHP but who may not be PHP experts. This book is tailored for those new to CakePHP and who want a thorough tutorial.

  • You can read the full post here.

    The 'Empty Client' AJAX Approach

    The new 'empty client' approach lead by Visual WebGui to AJAX is set to offer fundamental, infrastructure solutions to the three major setbacks of AJAX listed bellow. This approach shifts all processing, including UI logic to server, much like the old Main Frame paradigm did, and leaves the web client empty.

    The first setback of traditional AJAX is the complexity in creating AJAX application for enterprise's scenarios which is time consuming and therefore brings doubtful ROI. The second setback is that there is a lack of AJAX technologies that can support high level data centric enterprise applications. The last but not least in importance, is security concerns as AJAX is known to raise real security concerns which enterprise applications with sensitive data cannot tolerate.

    If the client is empty, everything is processed on the server. This concept enables highly productive, desktop development methodologies for web development as well as allowing complex applications running responsively on the network. Finally, since there is no data, no logic and no open services on the client, this approach presents a highly secured alternative to conventional client-side AJAX.

    You can read more about the design time and runtime advantages of the 'empty client' AJAX on VisualWebGui.com

    Merb 1.0 Released

    After two years of development, the first serious contender to challenge Ruby on Rails in the area of Ruby web application frameworks has reached 1.0 status: Merb. Created by Ezra Zugmuntowicz, Merb is built to be lightweight, less monolithic than Rails--i.e., you have your own choice of ORM, JavaScript, and templating frameworks--as well as thread-safe (which Rails, prior to the upcoming version 2.2 at least, was not).

    You can get the gem from RubyForge with (something like) the following :

    $ sudo gem install merb --include-dependencies

    (Alternative site: —source http://edge.merbivore.com)

    You can then generate your first Merb project and run it with the following:

    $ merb-gen app my_application
    $ cd my_application
    $ merb

    Then, of course, you'll want to read the documentation.

    Syndicate content