Posts

Showing posts from 2012

Javascript, animation and easing functions

I recently had to create an animation, which obey to the laws of physics, using javascript and HTML5. Among the gravity and free falling, one of these animations had to also apply sort of bouncing and elastic laws. After creating it first with CSS3 and HTML, we realized that most of the Android devices does not support it fully yet. Especially versions prior to Ice Cream Sandwich, such as Android 2.1, 2.2, 2.3 and lower (Froyo and its siblings). So, I had to transfer everything into HTML5 Canvas, and instead of applying the css-transitions, I had to implements everything alone. The first website I encountered and would like to highly recommend is Timothee Groleau's easing generator which can be found here : http://timotheegroleau.com/Flash/experiments/easing_function_generator.htm Originally made for Flash - but can easily adopted to Javascript HTML5 too. The output of his generator is basically a function describes a certain movement of an object. Such movement may b

TreePanel generated from TreeStore

Apparently, generating a treePanel from a treeStore is not 'out-of-the-box' like generating a grid or even generating tree from static json in Ext-JS. In addition, at the moment there are not a many examples out there that explains how it should be done. Most of the examples are using a static JSON (memory). But what if you are using a store with an already-made JSON which you need to customize to be a tree? listeners to the rescue The way to make it happen, is to alter the store a bit. we start by defining a store as usual: Ext.define('MyTreeStore', { extend: 'Ext.data.TreeStore', config: { someConfig: 0 }, constructor: function (cfg) { var me = this; cfg = cfg || {}; me.callParent([Ext.apply({ autoLoad: true, storeId: 'MyTreeStoreID', root: { expanded: true }, proxy: { type: 'rest', url: 'http:/

C#, Entity Framework, WCF and JSON serialization

Ever tried to serialize Entity Framework with WCF? Have you tried it with the Lazy-Initialization feature? And how about the Proxy Creation Enabled? There's a problem of circular reference if one table is referencing another table - which referencing the first one. We have had a great deal of problems with it. We even tried to consult an external expert of Entity Framework who simply told us it's impossible to serialize it on WCF. oh darn... :( We tried many solutions before we gave up: like that one: http://geekswithblogs.net/danemorgridge/archive/2010/05/04/entity-framework-4-wcf-amp-lazy-loading-tip.aspx and that: http://blogs.microsoft.co.il/blogs/gilf/archive/2011/10/17/avoiding-circular-reference-for-entity-in-json-serialization.aspx We even used t4templates to create a whole new set of flattened objects (!!!) But it doesn't really make life easier as one has to load separately each and every object. But this was not what we were looking for. We needed a solution that

ExtJS 4.0 - Class system, object inheritance and config

Recently we've started using the new Ext-JS 4.0 class system. one of the obstacles I came across with was using the configuration while making inheritance. On most of the examples in the web - it works seamlessly perfect. but what happens when you try to extend an existing object? for example, 'Ext.panel.Panel' ? Suddenly - weird stuff happens and it doesn't work any longer. So for example: Ext.define('ProductionMap.popup.serverExplorer', { extend: 'Ext.panel.Panel', config: { ParameterConfig: '', }, constructor: function (cfg) { this.initConfig(config); return this; }, initComponent: function () { ... } will give an error. took me an hour to figure it out - but I found the solution and it's REALLY simple. It's all about the constructor: instead of that code, use: constructor: function (cfg) { this.initConfig(config); this.callParent([config]); return this; },