ExtJS 4–Managing dynamically loaded views with single controller

1 במאי 2012

Since lots of digging in the web had to be done in order to find answer to this I decided to write this down: When facing with the problem of dynamic loading of widgets we need to understand exactly how to load the view dynamically and how to associate them with their controller. Lots of questions should be answered in this scenario, for example: 1. Should there be an instance of the same type of controller many times for each of the views or should there be only one instance of the controller that manages all views? 2. Is there a single...
tags: ,
one comment

ExtJS 4– using config for creating automatic methods

24 באפריל 2012

Hi all, When you define a class using ExtJS you can specify a config section (just like you can add many cool things). By using the config you can create automatic methods that will be generated for you, for example: This will automatically create 8 methods for you. 4 methods for each property in the config section. getXXXX – returns the current value setXXXX – sets the property value to a new value resetXXX – reverts the property value to its default value applyXXXX– this is a template method that you can choose to define. It is called whenever setTitle is called. This great...
tags: ,
one comment

ExtJS 4–Loading controllers dynamically

Hi all, Since I had to look it up really hard in the network I decided to write this important post in order to understand how to load a controller dynamically when using ExtJS 4.0.7 MVC. So here goes, Lets say  you are building a web application using ExtJS MVC and you wish to load some views and their corresponding controllers dynamically. this can be used to load certain views for different user roles or simply to provide a “bag” of widgets that can be added if the user wishes to add them to its page/workspace/dashboard. So lets suppose we have...
tags: ,
2 comments

JavaScript Callee property

29 בינואר 2012

Hi all, It always amazes me how I discover another JavaScript feature I wasn’t aware of. The feature I want to discuss here in this post is the Callee property we have from the arguments property we have when we are in a function scope. This property will return the current function being executed right now. In addition we have the caller property that we can use to get a reference to the calling function.Imagine you could even do crazy stuff like getting the caller function and its argument by doing something like: arguments.callee.caller.arguments. Here...
2 comments

How to easily search SQL stored procedures and objects

26 באוקטובר 2010

Hi all, Lately I have been working on a Migration project in which I had to move data from an old SQL DB into a new one with a different schema (slightly different). In order to understand the differences I downloaded several free tool in which I could compare both schema. There are lots of good tool for that but during the project I also had to look out for things like: 1. Which stored procedures and Tables FK uses a given column? 2. Which tables contains a given ID and much much more questions of...
tags: ,
2 comments

ASP.NET Ajax 4/3.5 CDN support

17 ביוני 2010

Today I found out a cool nice thing. As we all know Microsoft ASP.NET Ajax 4.0 is shipped with the new caching support for the JS library it uses. This feature is called the CDN and basically it is working and increasing performance by spreading lots of servers around the world that store JS files like the ASP.NET Ajax 4.0 and the Jquery library files. From Microsoft: “By taking advantage of the Microsoft Ajax CDN, you can significantly improve the performance of your Ajax applications. The contents of the Microsoft Ajax CDN are cached on servers located around the world” For...

Adding/Firing custom event using JavaScript

16 במאי 2010

Today I found out a very cool way for adding custom events and fire them for any Client side object. This can be done using ASP.NET Ajax very easily. (Thank you Igor). In order to create these events and fire them we will use the Sys.EventHandlerList Class. This class Creates a dictionary of client events for a component, with event names as keys and the associated handlers as values. It’s main method we need are the addHandler and getHandler. Lets see a simple example which is pretty self explanatory. This sample creates a Book and a Library “classes”. The Library class...
one comment

Ever forgot “alert()” when deployed to production

25 באפריל 2010

As developers we often forget to remove debug code on the client side such as “alert” calls , “debugger” statements and so on. So in order to avoid our team leader throw a chair at us here is a simple solution to this problem: On the page startup ( page load or when ever you find it necessary) simply override the alert method like this: Set alert to work only in debug var originalAler = window.alert; window.alert = function(message) { if (Sys.Debug.isDebug) { ...
one comment

Using C# 4 to implement lazy initialization

8 באפריל 2010

Sometimes we wish to improve performance and improve memory usage by making sure the Object we create and initialize is really needed. A couple of scenarios that we might thing of are: We have an object that is expensive to create and there might be situations when we don't really need it. Lets say we have an Employee object in memory and this Employee has a property by the name FormerEmployers that describe all the places he worked at. This information is initialized from a DB. If the consumer of this Employee object never reading this data there is no...
tags: ,
one comment

ASP.NET 4.0 New features – HTML, JS, ASP.NET Snippets

30 בנובמבר 2009

                                            In previous version of VS.NET we encountered the new snippet solution for creating a chunk of code that is usually reusable and then using it during programming or even lecturing. This feature was available for both C# and VB.NET coders. But we could not create or use snippets for the markup we are writing like HTML, JavaScript or even the ASP.NET page. VS.NET 2010 allows us to do just that! Lets see some of the “out of the box” snippets we can use: HTML Snippets:     AS you can see the same snippet sign is now available on the ASPX page...
2 comments