Search Results

Search found 10381 results on 416 pages for 'delegate and events'.

Page 130/416 | < Previous Page | 126 127 128 129 130 131 132 133 134 135 136 137  | Next Page >

  • Monitoring your WCF Web Apis with AppFabric

    - by cibrax
    The other day, Ron Jacobs made public a template in the Visual Studio Gallery for enabling monitoring capabilities to any existing WCF Http service hosted in Windows AppFabric. I thought it would be a cool idea to reuse some of that for doing the same thing on the new WCF Web Http stack. Windows AppFabric provides a dashboard that you can use to dig into some metrics about the services usage, such as number of calls, errors or information about different events during a service call. Those events not only include information about the WCF pipeline, but also custom events that any developer can inject and make sense for troubleshooting issues.      This monitoring capabilities can be enabled on any specific IIS virtual directory by using the AppFabric configuration tool or adding the following configuration sections to your existing web app, <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> <diagnostics etwProviderId="3e99c707-3503-4f33-a62d-2289dfa40d41"> <endToEndTracing propagateActivity="true" messageFlowTracing="true" /> </diagnostics> <behaviors> <serviceBehaviors> <behavior name=""> <etwTracking profileName="EndToEndMonitoring Tracking Profile" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>   <microsoft.applicationServer> <monitoring> <default enabled="true" connectionStringName="ApplicationServerMonitoringConnectionString" monitoringLevel="EndToEndMonitoring" /> </monitoring> </microsoft.applicationServer> Bad news is that none of the configuration above can be easily set on code by using the new configuration model for WCF Web stack.  A good thing is that you easily disable it in the configuration when you no longer need it, and also uses ETW, a general-purpose and high-speed tracing facility provided by the operating system (it’s part of the windows kernel). By adding that configuration section, AppFabric will start monitoring your service automatically and providing some basic event information about the service calls. You need some custom code for injecting custom events in the monitoring data. What I did here is to copy and refactor the “WCFUserEventProvider” class provided as sample in the Ron’s template to make it more TDD friendly when using IoC. I created a simple interface “ILogger” that any service (or resource) can use to inject custom events or monitoring information in the AppFabric database. public interface ILogger { bool WriteError(string name, string format, params object[] args); bool WriteWarning(string name, string format, params object[] args); bool WriteInformation(string name, string format, params object[] args); } The “WCFUserEventProvider” class implements this interface by making possible to send the events to the AppFabric monitoring database. The service or resource implementation can receive an “ILogger” as part of the constructor. [ServiceContract] [Export] public class OrderResource { IOrderRepository repository; ILogger logger;   [ImportingConstructor] public OrderResource(IOrderRepository repository, ILogger logger) { this.repository = repository; this.logger = logger; }   [WebGet(UriTemplate = "{id}")] public Order Get(string id, HttpResponseMessage response) { var order = this.repository.All.FirstOrDefault(o => o.OrderId == int.Parse(id, CultureInfo.InvariantCulture)); if (order == null) { response.StatusCode = HttpStatusCode.NotFound; response.Content = new StringContent("Order not found"); }   this.logger.WriteInformation("Order Requested", "Order Id {0}", id);   return order; } } The example above uses “MEF” as IoC for injecting a repository and the logger implementation into the service. You can also see how the logger is used to write an information event in the monitoring database. The following image illustrates how the custom event is injected and the information becomes available for any user in the dashboard. An issue that you might run into and I hope the WCF and AppFabric teams fixed soon is that any WCF service that uses friendly URLs with ASP.NET routing does not get listed as a available service in the WCF services tab in the AppFabric console. The complete example is available to download from here.

    Read the article

  • Multithreaded UI desktop application issues

    - by igor
    I am involved into development a rich UI project: desktop windows application. Application uses asynchronous invocations and in its turn it should be ready to process external messages (events). The problem is clear: at first time it was built as a simple prototype and it was not stress tested and all was fine. Then application was grown: the number of calls to server and number of events from server are high and performance is low. What is more users noticed that sometimes performance is extremal low. Asynchronous invocations based on thread pool (BeginInvoke, EndInvoke), external events are going from WCF service (.NET 3.5). My goal is synchronization of all tasks and putting priorities to every executions in desktop application. My question is: is there any practice how to reach my goal: patterns, task priority list, others? What should I do at first, second and next times? Thanks

    Read the article

  • Multithreded UI desktop application issues

    - by igor
    I am involved into development a rich UI project: desktop windows application. Application uses asynchronous invocations and in its turn it should be ready to process external messages (events). The problem is clear: at first time it was built as a simple prototype and it was not stress tested and all was fine. Then application was grown: the number of calls to server and number of events from server are high and performance is low. What is more users noticed that sometimes performance is extremal low. Asynchronous invocations based on thread pool (BeginInvoke, EndInvoke), external events are going from WCF service (.NET 3.5). My goal is synchronization of all tasks and putting priorities to every executions in desktop application. My question is: is there any practice how to reach my goal: patterns, task priority list, others? What should I do at first, second and next times? Thanks

    Read the article

  • Why does my application hang in interruptible state?

    - by Greg
    Hello, I am running on Ubuntu 10.04 LTS Server an GTK application that used to work fine. It suddenly started to hang in interruptible state (Sl+) without any apparent reason. Here is a snippet of the strace: poll([{fd=3, events=POLLIN}, {fd=5, events=POLLIN}], 2, 0) = 0 (Timeout) poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLOUT}]) writev(5, [{"\2\30\4\0\224\4\240\0\0@\0\0\37\0\240\0\2\4\4\0\224\4\240\0\0@\0\0\37\0\240\0"..., 192}, {NULL, 0}, {"", 0}], 3) = 192 read(5, 0x2ba9ac4, 4096) = -1 EAGAIN (Resource temporarily unavailable) I googled that line read(5, 0x2ba9ac4, 4096), which seems to be more significant, and it seems that many other applications tend to have the same problem. I tried to restart my X server, but it didn't help. Do you have an idea how to solve this problem?

    Read the article

  • Why is my google translate data not showing up in analytics?

    - by learnvst
    I have a google translate widget on my website with gaTrack set to true and the correct gaId, but no translate events show up in analytics under content Events Overview after a week of the widget being live. The code snippet below was auto generated by the translate website, and works fine on the site. Any ideas why I'm not getting any translate events data? <li> <div id="google_translate_element"></div><script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, gaTrack: true, gaId: 'UA-blahblah'}, 'google_translate_element'); } </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> </li>

    Read the article

  • Use of Service Bus in a Pub-Sub Engine

    - by JoseK
    In one of our projects, we've built a Publisher - Subscriber Engine on Oracle Service Bus. The functionality being a series of events are published and subscribers (JMS queues) receive these whenever a new event is published. We are facing some technical issues now, performance-wise and hence an architectural review is underway. Now for my questions: Architecturally the ESB has to publish events into a DB and read from the DB which users wish to be notified, then push the event onto their respective queues. There is a high amount of DB interaction and the question is whether ESB should be having such high amount of interaction with the DB in the first place? Or should there have been some alternate component responsible for doing this. Alternately is there any non-DB approach in which we can store the events and subscribers? Where else can this application data be held within the ESB context?

    Read the article

  • Is it a good pattern that no objects should know more than what it needs to know?

    - by Jim Thio
    I am implementing a viewController class. The view controller class got NSNotification when the Grabbing class start or finish updating. I have 2 choices. I can make the grabbing class to provide a public read only property so all other classes can know whether it is still uploading. Or I can let view Controller to listen to 2 different events. Start updating and finish updating events. The truth is the viewController do need to know whether the grabbing class is still updating or not at any other time. So I am thinking of creating 2 events would be a better way to go. Actually, what do you think?

    Read the article

  • How SQL Saturday could be better

    - by AaronBertrand
    I've been to a lot of SQL Saturdays. They are great events to attend - from a community standpoint, from a learning standpoint, and from a speaker growth standpoint. Who could ask for more, right? Great sessions, from passionate speakers willing to both teach and learn, fantastic networking opportunities and lunch. All for free, or at a very low cost - some events need to recover costs and charge $10 for lunch. Still a phenomenal bargain IMHO. But we all know that these events aren't perfect... there...(read more)

    Read the article

  • Version hash to solve Event Sourcing problems

    - by SystematicFrank
    The basic examples I have seen about Event Sourcing do not deal with out of order events, clock offsets in different systems and late events from system partitions. I am wondering if more polished Event Sourcing implementations rely on a version stamp of modified objects? For example, assuming that the system is rendering the entity Client with version id ABCD1234. If the user modifies the entity, the system will create an event with the modified fields AND the version id reference to which version it applies. Later the event responder would detect out of order events and merge them.

    Read the article

  • SharePoint Saturday Huntsville in need of Speakers and Sponsors&hellip;

    - by MOSSLover
    So I’ve been to events with Cathy, Lori, and Laura.  They are good people.  Honestly, the best event I ever attended was SharePoint Saturday Ozarks.  I had a crappy week and I got there the actual day of the event.  Hanging out with the three of them plus Joy made everything so much better.  Then there was devLink and SharePoint Saturday DC and a few other events sprinkled into the mix.  I was going to attend Birmingham but the timing was bad and other things occurred.  Now I have the opportunity to attend Huntsville.  I know some of you are thinking Alabama what’s to offer there?  You won’t know until you go to the event.  Come on guys you know you want to speak or sponsor there event so go here:  http://www.sharepointsaturday.org/huntsville. Technorati Tags: SharePoint Saturday,Huntsville,SharePoint Events

    Read the article

  • Data architecture for event log metrics?

    - by elliot42
    My service has a large ongoing number of user events, and we would like to do things like "count occurrence of event type T since date D." We are trying to make two basic decisions: What to store? Storing every event vs. only storing aggregates (Event log style) log every event and count them later, vs. (Time-series style) store a single aggregated "count of event E for date D" for every day Where to store the data In a relational database (particularly MySQL) In a non-relational (NoSQL) database In flat log files (collected centrally over the network via syslog-ng) What is standard practice / where can I read more about comparing the different types of systems? Additional details: The total event stream is large, potentially hundreds of thousands of entries per day But our current need is only to count certain types of events within it We don't necessarily need real-time access to the raw data or aggregation results IMHO, "log all events to files, crawl them at a later time to filter and aggregate the stream" is a pretty standard UNIX Way, but my Rails-y compatriots seem to think that nothing is real unless it's in MySQL.

    Read the article

  • What to use for an event listing site? [on hold]

    - by Vykintas
    I have a site which lets users buy & sell tickets, but it's built on wordpress & buddypress. So it's very heavy and messy. I would like to re-do the whole site on something lighter, cleaner and solid. The main functionality for user would have to be as follows: Register or login via Facebook. Create events and sell tickets to them. See ticket sales statistics Upload photos and associate those with events. Buy event tickets, print pdf ticket. Comment, favourite and like events. What would be your suggestions? PHP framework? CMS? CMF? I must say that I'm a front-end dev so building a system from scratch on my own would take a while. I'd be interested more in a "skeleton" app solution or something similar.

    Read the article

  • How is this paradigm/style called?

    - by McMannus
    I have the following situation: I'm developing an add-in for a UML modeling tool. The models that can be created by the user are stored inside the main application and a limited access to the models is given through its API. However, the add-in has a lot of callbacks for events that are triggered by the main application, when changes to the model occur by the user. Since the models are already stored once in the main application, I considered it not practicable to duplicate the models in the add-in, which leads to the fact that I have only behavior in the add-in, rather than having a state. This behavior is mainly expressed by static functions, that are organized in functional cohesive classes. The callbacks for the events have always references to the model elements relevant for the specifc event that ocurred. First, it seemed to me that this is a procedural style in general, but procedural style doesn't consider events/callbacks, so this boils down to the question. How is this programming style called?

    Read the article

  • Do games use threads?

    - by Nubcake
    I understand that the concept of how a game runs i.e while (game_loop = true) { //handle events // input/output/sound etc } But it has come to my attention while programming in another HLL is do some games use threads for certain operations? For example take any Pokemon game ; during interaction a textbox appears to display information. Now I've been trying to simulate that sort of textbox and the only way I could have got it to be exactly the same is by using a loop and yes once a loop is started there is no way to handle window events unless they are handled again inside the loop itself. I couldn't have used this loop inside a different thread other than the main one (due to a DirectX limitation) so the only option was to use it inside the main program thread. I was wondering if some games work like this ; do they only use the main program thread and handle events again if they're inside a loop? Edit: I forgot to mention this is about console games not PC games! Thanks Nubcake

    Read the article

  • Stanford iPhone dev Paparazzi 1 setup help

    - by cksubs
    Hi, I'm having trouble using a tab bar control. Basically, when I build and run I'm just getting the blank white default "Window" screen. I was following this guide: http://www.iphoneosdevcafe.com/2010/03/assignment-4-part-1/#comment-36 Drag a Tab Bar Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Tab Bar Controller. Drag a Navigation Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Navigation Controller. Drag a second Navigation Controller from the Library to MainWindow.xib. Control drag from the App Delegate to the Navigation Controller. This completes all the connections between the App Delegate and the tab bar and two navigation controllers. By using IB to set up the tab bar and navigation controllers in this way, you need not allocate and init the controllers in AppDelegate.m. When you build and run this, you will see the tab bar controller and two navigation controllers. Is there a step there that he missed? How do I hook the Tab Bar Controller up to the Window? EDIT: Do I need to do something like this? mainTabBar = [[UITabBarController alloc] init]; [window addSubview:mainTabBar.view]; That's still not working, but I feel like I'm on the right track? Why can't this all be done from Interface Builder?

    Read the article

  • CALayer won't display

    - by Paul from Boston
    I'm trying to learn how to use CALayers for a project and am having trouble getting sublayers to display. I created a vanilla View-based iPhone app in XCode for these tests. The only real code is in the ViewController which sets up the layers and their delegates. There is a delegate, DelegateMainView, for the viewController's view layer and a second different one, DelegateStripeLayer, for an additional layer. The ViewController code is all in awakeFromNib, - (void)awakeFromNib { DelegateMainView *oknDelegate = [[DelegateMainView alloc] init]; self.view.layer.delegate = oknDelegate; CALayer *newLayer = [CALayer layer]; DelegateStripeLayer *sldDelegate = [[DelegateStripeLayer alloc] init]; newLayer.delegate = sldDelegate; [self.view.layer addSublayer:newLayer]; [newLayer setNeedsDisplay]; [self.view.layer setNeedsDisplay]; } The two different delegates are simply wrappers for the CALayer delegate method, drawLayer:inContext:, i.e., - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { CGRect bounds = CGContextGetClipBoundingBox(context); ... do some stuff here ... CGContextStrokePath(context); } each a bit different. The layer, view.layer, is drawn properly but newLayer is never drawn. If I put breakpoints in the two delegates, the program stops in DelegateMainView but never reaches DelegateStripeLayer. What am I missing here? Thanks.

    Read the article

  • Why does Facebook iOS dialog for feed publish disappear after login?

    - by Mason G. Zhwiti
    I'm trying to use the Facebook iOS "feed" dialog call to allow my app's user to share something on their Facebook wall. When the facebook app is not installed, it attempts to let them authenticate within the app (presumably using a web view). The issue is that this dialog just disappears once they authenticate. I was expecting the web view to return to the "feed" sharing view. How do I detect that they authenticated so that I can re-open the feed dialog? I've added fbDidLogin to my app delegate, but it's not being called. (I wasn't sure if this would normally be called or not, but I read several people recommending this.) SBJSON *jsonWriter = [SBJSON new]; // The action links to be shown with the post in the feed NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: @"More Videos",@"name",@"http://www.example.com/",@"link", nil], nil]; NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"Test Caption", @"caption", @"Test Description", @"description", @"https://s3.amazonaws.com/example/images/test.png", @"source", self.video.blogLink, @"link", @"01234567890123", @"app_id", actionLinksStr, @"actions", nil]; [delegate facebook].sessionDelegate = delegate; [[delegate facebook] dialog:@"feed" andParams:params andDelegate:self];

    Read the article

  • What's the proper way to setup different objects as delegates using Interface Builder?

    - by eagle
    Let's say I create a new project. I now add two text fields to the view controller in Interface Builder. I want to respond to delegate events that the text fields create, however, I don't want to have the main view controller to act as the delegate for both text fields. Ideally I want a separate file for each text field that acts as the delegate. Each of these objects also needs to be able to interact with the main view controller. My question is how I would set this up and link everything correctly? I tried creating a new class that inherits from NSObject and implements UITextFieldDelegate. I then added an instance variable called "viewController" of the same type of my view controller and marked it with IBOutlet (this required me to add #import "myViewcontroller.h"). I then went to Interface Builder and opened up my view controller which contains the two edit boxes. I added an NSObject to the form and changed it's type to be of the new class I created. I set its viewController property to the File's Owner, and set one of the textbox's delegate properties to point to this new object I created. Now when I run the program, it crashes when I touch the text box. It gives the error EXC_BAD_ACCESS. I'm guessing I didn't link stuff correctly in IB. Some things I'm not sure about which might be the problem: Does IB automatically know to create an instance of the class just by placing the NSObject in the ViewController? Can it properly assign the viewController property to an instance of itself even though it is creating itself at the same time?

    Read the article

  • WPF: UnauthorizedAccessException using anonymous methods.

    - by Diego Pacheco Pedemonte
    Here is the thing, I want to create a simply app that copy many files from one site, and move them to another; but using async methods and create a new thread. private void button3_Click(object sender, RoutedEventArgs e) { //progressBar1.Maximum = _FileInfoArray.Count; DispatcherTimer dt1 = new DispatcherTimer(); foreach (FileInfo Fi in _FileInfoArray) { Thread t = new Thread(new ThreadStart(delegate() { DispatcherOperation _dispOp = progressBar1.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(delegate() { File.Copy(txtdestino.Text, Fi.FullName, true); //progressBar1.Value = n; //txtstatus.Content = ("Copiados " + n.ToString() + " archivos"); //Thread.Sleep(100); } )); _dispOp.Completed += new EventHandler(_dispOp_Completed); } )); t.Start(); } } UnauthorizedAccessException is throw! It says that I can't access to txtdestino content. Some clues? -------------------------------------------------------------------------------Edited This is the version with all the changes, get the same error :( any clues? private void button4_Click(object sender, RoutedEventArgs e) { //First: Build mynames List<string> mynames = new List<string>(); foreach (FileInfo fi in _FileInfoArray) { mynames.Add(fi.FullName); } Thread t = new Thread(new ThreadStart(delegate() { foreach (string fullname in mynames) { DispatcherOperation _dispOp = progressBar1.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(delegate() { string destino = System.IO.Path.Combine(@"C:\", System.IO.Path.GetFileName(fullname)); File.Copy(fullname, destino, true); //Some progressbar changes } )); _dispOp.Completed += new EventHandler(_dispOp_Completed); } } )); t.Start(); } File.Copy(txtdestino.Text, Fi.FullName, true); // here the exception is throw

    Read the article

  • pushViewController Not Displaying UIView/Nib with tabbar and nav bar

    - by james
    I'm relatively new to objective c but not programming and am stuck with my iphone app. I created a nav based app with both a navbar and a tab bar controller. I set the tab bar as the root controller. I'm able to switch between each tab without any issues to various UIViews and UITableViews. My issue is that in one of my UITableViews that I call from the TabBarController, didSelectRowAtIndexPath function is suppose to display a new UIView. The below code does not give any errors and runs fine but does not show the new Nib. if(newViewController == nil) { NSLog(@"yes nil"); BookViewController *aNewViewController = [[BookViewController alloc] initWithNibName:@"BookOptionView" bundle:nil]; self.newViewController = aNewViewController; [aNewViewController release]; } BookAppDelegate *delegate = (BookAppDelegate *)[[UIApplication sharedApplication] delegate]; [delegate.appNavBar pushViewController:newViewController animated:YES]; Now when I do the below, it works fine but it gets rid of the nav and tab which I'm assuming because its a modal call instead of pushing the view controller. BookViewController *screen = [[BookViewController alloc] initWithNibName:@"BookOptionView" bundle:[NSBundle mainBundle]]; screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:screen animated:YES]; [screen release]; Any ideas why I can't get the View Controller to push correctly? In my application delegate file, I declared an AppNavBarController object (inherit from UINavigationController) called appNavBar. Any help would be appreciated!

    Read the article

  • Can I write this regex in one step?

    - by Marin Doric
    This is the input string "23x +y-34 x + y+21x - 3y2-3x-y+2". I want to surround every '+' and '-' character with whitespaces but only if they are not allready sourrounded from left or right side. So my input string would look like this "23x + y - 34 x + y + 21x - 3y2 - 3x - y + 2". I wrote this code that does the job: Regex reg1 = new Regex(@"\+(?! )|\-(?! )"); input = reg1.Replace(input, delegate(Match m) { return m.Value + " "; }); Regex reg2 = new Regex(@"(?<! )\+|(?<! )\-"); input = reg2.Replace(input, delegate(Match m) { return " " + m.Value; }); explanation: reg1 // Match '+' followed by any character not ' ' (whitespace) or same thing for '-' reg2 // Same thing only that I match '+' or '-' not preceding by ' '(whitespace) delegate 1 and 2 just insert " " before and after m.Value ( match value ) Question is, is there a way to create just one regex and just one delegate? i.e. do this job in one step? I am a new to regex and I want to learn efficient way.

    Read the article

  • WPF Designer has bug with parsing generic control with overrided property

    - by Ivan Laktyunkin
    I've created a generic lookless control with virtual property: public abstract class TestControlBase<TValue> : Control { public static readonly DependencyProperty ValueProperty; static TestControlBase() { ValueProperty = DependencyProperty.Register("Value", typeof(TValue), typeof(TestControlBase<TValue>)); } protected TestControlBase() { Focusable = false; Value = default(TValue); } public virtual TValue Value { get { return (TValue)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } } Then I've made a control derived from it and overrided Value property: public class TestControl : TestControlBase<int> { public override int Value { get { return base.Value; } set { base.Value = value; } } } So I use it in a Window XAML: <TestControls:TestControl /> When I open window in designer all is OK, but when I put mouse cursor to this line, or to this control in designer I receive exception: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) Ambiguous match found. at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) at System.Type.GetProperty(String name) at MS.Internal.ComponentModel.DependencyPropertyKind.get_IsDirect() at MS.Internal.ComponentModel.DependencyPropertyKind.get_IsAttached() at MS.Internal.ComponentModel.APCustomTypeDescriptor.GetProperties(Attribute[] attributes) at MS.Internal.ComponentModel.APCustomTypeDescriptor.GetProperties() at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultExtendedTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties() at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes) at System.ComponentModel.TypeDescriptor.GetProperties(Object component) at MS.Internal.Model.ModelPropertyCollectionImpl.GetProperties(String propertyNameHint) at MS.Internal.Model.ModelPropertyCollectionImpl.<GetEnumerator>d__0.MoveNext() at MS.Internal.Designer.PropertyEditing.Model.ModelPropertyMerger.<GetFirstProperties>d__0.MoveNext() at MS.Internal.Designer.PropertyEditing.PropertyInspector.UpdateCategories(Selection selection) at MS.Internal.Designer.PropertyEditing.PropertyInspector.OnSelectionChangedIdle() Who know this problem? Please explain :) I have no ideas except that WPF Designer doesn't like generics. If I replace generics by Object all is OK.

    Read the article

  • IUsable: controlling resources in a better way than IDisposable

    - by Ilya Ryzhenkov
    I wish we have "Usable" pattern in C#, when code block of using construct would be passed to a function as delegate: class Usable : IUsable { public void Use(Action action) // implements IUsable { // acquire resources action(); // release resources } } and in user code: using (new Usable()) { // this code block is converted to delegate and passed to Use method above } Pros: Controlled execution, exceptions The fact of using "Usable" is visible in call stack Cons: Cost of delegate Do you think it is feasible and useful, and if it doesn't have any problems from the language point of view? Are there any pitfalls you can see? EDIT: David Schmitt proposed the following using(new Usable(delegate() { // actions here }) {} It can work in the sample scenario like that, but usually you have resource already allocated and want it to look like this: using (Repository.GlobalResource) { // actions here } Where GlobalResource (yes, I know global resources are bad) implements IUsable. You can rewrite is as short as Repository.GlobalResource.Use(() => { // actions here }); But it looks a little bit weird (and more weird if you implement interface explicitly), and this is so often case in various flavours, that I thought it deserve to be new syntactic sugar in a language.

    Read the article

  • DRY Authenticated Tasks in Cocoa (with distributed objects)

    - by arbales
    I'm kind of surprise/infuriated that the only way for me to run an authenticated task, like perhaps sudo gem install shi*t, is to make a tool with pre-written code. I'm writing a MacRuby application, which doesn't seem to expose the KAuthorization* constants/methods. So.. I learned Cocoa and Objective-C. My application creates a object, serves it and calls the a tool that elevates itself and then performs a selector on a distributed object (in the tool's thread). I hoped that the distributed object's methods would evaluated inside the tool, so I could use delegation to create "privileged" tasks. If this won't work, don't try to save it, I just want a DRY/cocoa solution. AuthHelper.m //AuthorizationExecuteWithPrivileges of this. AuthResponder* my_responder = [AuthResponder sharedResponder]; // Gets the proxy object (and it's delegate) NSString *selector = [NSString stringWithUTF8String:argv[3]]; NSLog(@"Performing selector: %@", selector); setuid(0); if ([[my_responder delegate] respondsToSelector:NSSelectorFromString(selector)]){ [[my_responder delegate] performSelectorOnMainThread:NSSelectorFromString(selector) withObject:nil waitUntilDone:YES]; } RandomController.m - (void)awakeFromNib { helperToolPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/AuthHelper"]; delegatePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/ABExtensions.rb"]; AuthResponder* my_responder = [AuthResponder initAsService]; [my_responder setDelegate:self]; } -(oneway void)install_gems{ NSArray *args = [NSArray arrayWithObjects: @"gem", @"install", @"sinatra", nil]; [NSTask launchedTaskWithLaunchPath:@"/usr/bin/sudo" arguments:args]; NSLog(@"Ran AuthResponder.delegate.install_gems"); // This prints. } ... other privileges tasks. "sudo gem update --system" for one. I'm guessing the proxy object is performing the selector in it's own thread, but I want the current (privileged thread) to do it so I can use sudo. Can I force the distributed object to evaluate the selector on the tool's thread? How else can I accomplish this dryly/cocoaly?

    Read the article

  • BackgroundWorker.ReportProgress() not updating property and locking up the UI

    - by Willem
    i am using a backgroundWorker to do a long running operation: BackgroundWorker backgroundWorker = new BackgroundWorker() { WorkerSupportsCancellation = true, WorkerReportsProgress = true }; backgroundWorker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { }; backgroundWorker.ProgressChanged += delegate(object s, ProgressChangedEventArgs args) { someViewModel.SomeProperty.Add((SomeObject)args.UserState); }; backgroundWorker.DoWork += delegate(object s, DoWorkEventArgs args) { someViewModel.SomeList.ForEach(x => { someViewModel.SomeInterface.SomeMethod(backgroundWorker, someViewModel, someViewModel.SomeList, x); }); }; backgroundWorker.RunWorkerAsync(); Then in SomeInterface.SomeMethod: public void SomeMethod(BackgroundWorker backgroundWorker, SomeViewModel someViewModel//....) { //Filtering happens backgroundWorker.ReportProgress(0, someObjectFoundWhileFiltering); } So, when it comes to: backgroundWorker.ProgressChanged += delegate(object s, ProgressChangedEventArgs args) { someViewModel.SomeProperty.Add((SomeObject)args.UserState);//Adding the found object to the Property in the VM }; On the line someViewModel.SomeProperty.Add((SomeObject)args.UserState);, the set on the Property is not firering and the UI just locks up. What am i doing wrong? Is this the correct way to update the UI thread?

    Read the article

< Previous Page | 126 127 128 129 130 131 132 133 134 135 136 137  | Next Page >