Search Results

Search found 4 results on 1 pages for 'bluefox'.

Page 1/1 | 1 

  • What's the best practice to add default function to jQuery Dialog open/close events?

    - by BlueFox
    Hi All, I'm trying to define some default behaviours for my jQuery Dialogs like the following: (function($) { /** * Overriding default options **/ $.ui.dialog.defaults.bgiframe = true; $.ui.dialog.defaults.open = function() { if ($('.ui-widget-overlay').length == 0) return; if ($.browser.msie) { // scrollbar fix for IE $('html').css('overflow-y','hidden'); $('html').css('overflow-x','hidden'); } else { // disable scrollbar for other browsers $('body').css('overflow','hidden'); } }; $.ui.dialog.defaults.beforeclose = function(event, ui) { if ($('.ui-widget-overlay').length == 0) return; if ($.browser.msie) { // scrollbar fix for IE $('html').css('overflow-y','auto'); $('html').css('overflow-x','auto'); } else { // disable scrollbar for other browsers $('body').css('overflow','auto'); } }; })(jQuery); The above works when I have no custom open/beforeclose function specified when the dialog is created. So I'm wondering what is the best practice to add these functionality into all my dialogs, while preserving the ability to specify open/beforeclose functions.

    Read the article

  • Performance of delegate and method group

    - by BlueFox
    Hi I was investigating the performance hit of creating Cachedependency objects, so I wrote a very simple test program as follows: using System; using System.Collections.Generic; using System.Diagnostics; using System.Web.Caching; namespace Test { internal class Program { private static readonly string[] keys = new[] {"Abc"}; private static readonly int MaxIteration = 10000000; private static void Main(string[] args) { Debug.Print("first set"); test7(); test6(); test5(); test4(); test3(); test2(); Debug.Print("second set"); test2(); test3(); test4(); test5(); test6(); test7(); } private static void test2() { DateTime start = DateTime.Now; var list = new List<CacheDependency>(); for (int i = 0; i < MaxIteration; i++) { list.Add(new CacheDependency(null, keys)); } Debug.Print("test2 Time: " + (DateTime.Now - start)); } private static void test3() { DateTime start = DateTime.Now; var list = new List<Func<CacheDependency>>(); for (int i = 0; i < MaxIteration; i++) { list.Add(() => new CacheDependency(null, keys)); } Debug.Print("test3 Time: " + (DateTime.Now - start)); } private static void test4() { var p = new Program(); DateTime start = DateTime.Now; var list = new List<Func<CacheDependency>>(); for (int i = 0; i < MaxIteration; i++) { list.Add(p.GetDep); } Debug.Print("test4 Time: " + (DateTime.Now - start)); } private static void test5() { var p = new Program(); DateTime start = DateTime.Now; var list = new List<Func<CacheDependency>>(); for (int i = 0; i < MaxIteration; i++) { list.Add(() => { return p.GetDep(); }); } Debug.Print("test5 Time: " + (DateTime.Now - start)); } private static void test6() { DateTime start = DateTime.Now; var list = new List<Func<CacheDependency>>(); for (int i = 0; i < MaxIteration; i++) { list.Add(GetDepSatic); } Debug.Print("test6 Time: " + (DateTime.Now - start)); } private static void test7() { DateTime start = DateTime.Now; var list = new List<Func<CacheDependency>>(); for (int i = 0; i < MaxIteration; i++) { list.Add(() => { return GetDepSatic(); }); } Debug.Print("test7 Time: " + (DateTime.Now - start)); } private CacheDependency GetDep() { return new CacheDependency(null, keys); } private static CacheDependency GetDepSatic() { return new CacheDependency(null, keys); } } } But I can't understand why these result looks like this: first set test7 Time: 00:00:00.4840277 test6 Time: 00:00:02.2041261 test5 Time: 00:00:00.1910109 test4 Time: 00:00:03.1401796 test3 Time: 00:00:00.1820105 test2 Time: 00:00:08.5394884 second set test2 Time: 00:00:07.7324423 test3 Time: 00:00:00.1830105 test4 Time: 00:00:02.3561347 test5 Time: 00:00:00.1750100 test6 Time: 00:00:03.2941884 test7 Time: 00:00:00.1850106 In particular: 1. Why is test4 and test6 much slower than their delegate version? I also noticed that Resharper specifically has a comment on the delegate version suggesting change test5 and test7 to "Covert to method group". Which is the same as test4 and test6 but they're actually slower? 2. I don't seem a consistent performance difference when calling test4 and test6, shouldn't static calls to be always faster?

    Read the article

  • Is it normal that .Net combobox postback always contains data items?

    - by BlueFox
    I have a dynamically populated ComponentArt:ComboBox with Autopostback property set to true. So every time the selection changes, a postback to server would be fired. Everything seems to work fine except that the lists of all available items are also posted back to the server. from Firebug: ComboBox1_Data %3Cr%3E%3Cc%3E%3Cr%3E%3Cc%3E%3Cr%3E%3Cc%3EText%3C%2Fc%3E%3Cc%3E150%20Mile%20House%3C%2Fc%3E%3C%2Fr%3E%3C%2Fc%3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%2Fc%3E%3Cc%3E%3Cr%3E%3Cc%3E%3Cr%3E%3Cc%3EText%3C%2Fc%3E%3Cc%3EAartselaar%3C%2Fc%3E%3C%2Fr%3E%3C%2Fc%3E%3C%2Fr%3E%3C%2Fc%3E%3Cc%3E%3Cr%3E%3Cc%3E%3Cr%3E%3Cc%3EText%3C%2Fc%3E%3Cc%3EAavasaksa%3C%2Fc%3E%3C%2Fr%3E%3C%2Fc%3E%3C%2Fr%3E%3C%2Fc%3E%3C%2Fr%3E ComboBox1_Input Aalst ComboBox1_SelectedIndex 7 As most my clients are using slow connections, this amount of postback has a huge impact on their user experience. Since I'm storing the viewstates in session already, there's really no need for any of the component to restore states from the client. So I'm wondering if this is normal for ComponentArt:ComboBox to do this and not other controls, or this is the normal way of doing things?

    Read the article

  • Does GenerateScriptType support NonSerialized?

    - by BlueFox
    I have an object that's used both on the client and server side. GenerateScriptType(typeof(MyClass)) However, there are some fields that I don't need on the client, so my question is there any way to prevent those fields being serialized? (For example, Field2 and Field3 in MyClass) I tried marking the fields with [NonSerialized] but they still get serialized... public class MyClass { public string Field1; public string Field2 { get; set; } private string _field3; public string Field3 { get { return _field3 ?? (_field3 = "lala"); } } } Regards,

    Read the article

1