Search Results

Search found 4350 results on 174 pages for 'chilly child'.

Page 47/174 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Is there any way to manipulate variables passed in to a child class constructor before passing it of

    - by Matt
    Hi, Is there any way to delay calling a superclass constructor so you can manipulate the variables first? Eg. public class ParentClass { private int someVar; public ParentClass(int someVar) { this.someVar = someVar; } } public class ChildClass : ParentClass { public ChildClass(int someVar) : base(someVar) { someVar = someVar + 1 } } I want to be able to send the new value for someVar (someVar + 1) to the base class constructor rather than the one passed in to the ChildClass constructor. Is there any way to do this? Thanks, Matt

    Read the article

  • How do I change a child's parent in NHibernate when cascade is delete-all-orphan?

    - by Daniel T.
    I have two entities in a bi-directional one-to-many relationship: public class Storage { public IList<Box> Boxes { get; set; } } public class Box { public Storage CurrentStorage { get; set; } } And the mapping: <class name="Storage"> <bag name="Boxes" cascade="all-delete-orphan" inverse="true"> <key column="Storage_Id" /> <one-to-many class="Box" /> </bag> </class> <class name="Box"> <many-to-one name="CurrentStorage" column="Storage_Id" /> </class> A Storage can have many Boxes, but a Box can only belong to one Storage. I have them mapped so that the one-to-many has a cascade of all-delete-orphan. My problem arises when I try to change a Box's Storage. Assuming I already ran this code: var storage1 = new Storage(); var storage2 = new Storage(); storage1.Boxes.Add(new Box()); Session.Create(storage1); Session.Create(storage2); The following code will give me an exception: // get the first and only box in the DB var existingBox = Database.GetBox().First(); // remove the box from storage1 existingBox.CurrentStorage.Boxes.Remove(existingBox); // add the box to storage2 after it's been removed from storage1 var storage2 = Database.GetStorage().Second(); storage2.Boxes.Add(existingBox); Session.Flush(); // commit changes to DB I get the following exception: NHibernate.ObjectDeletedException : deleted object would be re-saved by cascade (remove deleted object from associations) This exception occurs because I have the cascade set to all-delete-orphan. The first Storage detected that I removed the Box from its collection and marks it for deletion. However, when I added it to the second Storage (in the same session), it attempts to save the box again and the ObjectDeletedException is thrown. My question is, how do I get the Box to change its parent Storage without encountering this exception? I know one possible solution is to change the cascade to just all, but then I lose the ability to have NHibernate automatically delete a Box by simply removing it from a Storage and not re-associating it with another one. Or is this the only way to do it and I have to manually call Session.Delete on the box in order to remove it?

    Read the article

  • ASP.NET- forcing child/container events to fire before parent onload?

    - by Hans Gruber
    I'm working on a questionnaire type application in which questions are stored in a database. Therefore, I create my controls dynamically on every Page.OnLoad. This works like a charm and ViewState is persisted between postbacks because I ensure that my dynamic controls always have the same generated Control.ID. In addition to the user control that dynamically populates the questions, my questionnaire page also contains a 'Status' section (also encapsulated by a user control) which represents the status of the questionnaire (choices are 'Complete', 'Started' or 'In Progress'). If the user changes the status of questionnaire (i.e. from 'In Progress' to 'Complete'), I need to postback to the server because the contents of the dynamic portion of the questionnaire depend on the selected status. Some questions are always present regardless of status, and yet others may not be present at all for the selected status. The point is, when the status changes, I have to postback to the page and render the right set of questions. Additionally, I need to preserve any user entered values for those questions which are 'always available'. However, due to the page life cycle in ASP.NET, the 'Status' user control's OnLoad, which contains the correct status needed to load the right questions from the DB, doesn't get executed until after the 'dynamic questions' user control has already been populated (with the wrong/stale values). To get around this, I raise an event from my 'Status' user control to the main page to indicate that the Status has changed. The main page then raises an event on the 'dynamic questions' user control. Since by the time this event bubbles up, the 'dynamic questions' user control has already loaded the 'wrong' questions from the DB, it first calls Controls.Clear. It then happily uses the new status to query the database for the 'correct' questions and does a Control.Add() on each. FYI, Control.IDs are consistent across postbacks. This solution works...sorta. The correct set of questions for the selected status do get rendered; however ViewState is getting lost for those 'always available' questions. I'm guessing this is because the 'dynamic questions' user control calls Controls.Clear when responding to the status changed event. This must somehow kill the association between ViewState and my dynamic controls, even though the Control.ID are consistent. This seems like such a common requirement, I'm virtually certain there is a better, cleaner and less error prone approach to accomplish this. In case its not plain obvious, I haven't been able to grok the ASP.NET page life-cycle despite working with it for the last year. Any help is much appreciated!

    Read the article

  • nhibernate cascade - problem with detached entities

    - by Chev
    I am going nuts here trying to resolve a cascading update/delete issue :-) I have a Parent Entity with a collection Child Entities. If I modify the list of Child entities in a detached Parent object, adding, deleting etc - I am not seeing the updates cascaded correctly to the Child collection. Mapping Files: <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Domain" namespace="Domain"> <class name="Parent" table="Parent" > <id name="Id"> <generator class="guid.comb" /> </id> <version name="LastModified" unsaved-value="0" column="LastModified" /> <property name="Name" type="String" length="250" /> <bag name="ParentChildren" lazy="false" table="Parent_Children" cascade="all-delete-orphan" inverse="true"> <key column="ParentId" on-delete="cascade" /> <one-to-many class="ParentChildren" /> </bag> </class> <class name="ParentChildren" table="Parent_Children"> <id name="Id"> <generator class="guid.comb" /> </id> <version name="LastModified" unsaved-value="0" column="LastModified" /> <many-to-one name="Parent" class="Parent" column="ParentId" lazy="false" not-null="true" /> </class> </hibernate-mapping> Test [Test] public void Test() { Guid id; int lastModified; // add a child into 1st session then detach using(ISession session = Store.Local.Get<ISessionFactory>("SessionFactory").OpenSession()) { Console.Out.WriteLine("Selecting..."); Parent parent = (Parent) session.Get(typeof (Parent), new Guid("4bef7acb-bdae-4dd0-ba1e-9c7500f29d47")); id = parent.Id; lastModified = parent.LastModified + 1; // ensure the detached version used later is equal to the persisted version Console.Out.WriteLine("Adding Child..."); Child child = (from c in session.Linq<Child>() select c).First(); parent.AddChild(child, 0m); session.Flush(); session.Dispose(); // not needed i know } // attach a parent, then save with no Children using (ISession session = Store.Local.Get<ISessionFactory>("SessionFactory").OpenSession()) { Parent parent = new Parent("Test"); parent.Id = id; parent.LastModified = lastModified; session.Update(parent); session.Flush(); } } I assume that the fact that the product has been updated to have no children in its collection - the children would be deleted in the Parent_Child table. The problems seems to be something to do with attaching the Product to the new session? As the cascade is set to all-delete-orphan I assume that changes to the collection would be propagated to the relevant entities/tables? In this case deletes? What am I missing here? C

    Read the article

  • What is the most elegant way to implement a business rule relating to a child collection in LINQ?

    - by AaronSieb
    I have two tables in my database: Wiki WikiId ... WikiUser WikiUserId (PK) WikiId UserId IsOwner ... These tables have a one (Wiki) to Many (WikiUser) relationship. How would I implement the following business rule in my LINQ entity classes: "A Wiki must have exactly one owner?" I've tried updating the tables as follows: Wiki WikiId (PK) OwnerId (FK to WikiUser) ... WikiUser WikiUserId (PK) WikiId UserId ... This enforces the constraint, but if I remove the owner's WikiUser record from the Wiki's WikiUser collection, I recieve an ugly SqlException. This seems like it would be difficult to catch and handle in the UI. Is there a way to perform this check before the SqlException is generated? A better way to structure my database? A way to catch and translate the SqlException to something more useful? Edit: I would prefer to keep the validation rules within the LINQ entity classes if possible. Edit 2: Some more details about my specific situation. In my application, the user should be able to remove users from the Wiki. They should be able to remove any user, except the user who is currently flagged as the "owner" of the Wiki (a Wiki must have exactly one owner at all times). In my control logic, I'd like to use something like this: wiki.WikiUsers.Remove(wikiUser); mRepository.Save(); And have any broken rules transferred to the UI layer. What I DON'T want to have to do is this: if(wikiUser.WikiUserId != wiki.OwnerId) { wiki.WikiUsers.Remove(wikiUser); mRepository.Save(); } else { //Handle errors. } I also don't particularly want to move the code to my repository (because there is nothing to indicate not to use the native Remove functions), so I also DON'T want code like this: mRepository.RemoveWikiUser(wiki, wikiUser) mRepository.Save(); This WOULD be acceptable: try { wiki.WikiUsers.Remove(wikiUser); mRepository.Save(); } catch(ValidationException ve) { //Display ve.Message } But this catches too many errors: try { wiki.WikiUsers.Remove(wikiUser); mRepository.Save(); } catch(SqlException se) { //Display se.Message } I would also PREFER NOT to explicitly call a business rule check (although it may become necessary): wiki.WIkiUsers.Remove(wikiUser); if(wiki.CheckRules()) { mRepository.Save(); } else { //Display broken rules }

    Read the article

  • css: make background repeat-y with growing child content?

    - by mikemikemike
    I Have a three column layout. The center div is a container which holds all of my content. The outer columns is just a .png that fades into the body's background (left and right respectively). I want the .png to repeat-y to grow with the center container's content. It will only print the image once, and ignores the repeat-y. If I specify a height to the outside columns, it will print, but only to the specified height. I tried height: 100%, which does not work. Here is my code: #ultra_contain { text-align:left; width:900px; padding: 0px; position:relative; margin:0px auto; margin-top:0px; /*border:1px dashed #996;*/ } #gradientleft { float:left; position:relative; background: url("../i/gradient_left.png") repeat-y; /*border:1px dashed #996;*/ } #gradientright { float:right; position:relative; background: url("../i/gradient_right.png") repeat-y; /*border:1px dashed #996;*/ } #container { text-align:left; width:700px; position:relative; margin:5px auto; margin-top:0px; background:#fff; /*border:1px dashed #996;*/ }

    Read the article

  • Migrating from a single entity to an abstract parent entity with child entities, NSEntityMigrationPolicy not called.

    - by Jimmy Selgen Nielsen
    Hi. I'm trying to upgrade my current application to use an abstract parent entity, with specialized sub entities. I've created a custom NSEntityMigrationPolicy, and in the mapping model I've set the Custom Policy to the name of my class. I'm initializing my persistent store like this, which should be fairly standard : NSError *error=nil; persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, nil]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) { NSLog(@"Error adding persistent store : %@",[error description]); NSAssert(error==nil,[error localizedDescription]); } When i run the app i get the following error : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The operation couldn’t be completed. (Cocoa error 134140.)' [error userInfo] contains "reason=Can't find mapping model for migration" I've verified that version 1 of the data model will open, and if i set NSInferMappingModelAutomaticallyOption i get a migration, although my entities are not migrated correctly (as expected). I've verified that the mapping model (cdm) is in the application bundle, but somehow it refuses to find it. I've also set breakpoints and NSLog() statements in the custom migration policy, and none of it runs, with or without NSInferMappingModelAutomaticallyOption Any hints as to why it seems unable to find the mapping model ?

    Read the article

  • CSS gurus, can I make my absolutely positioned child element force the main parent's height?

    - by alex
    This is kind of hard to explain. I have an absolutely positioned floating secondary content box. It works great in all occurrences. Except, when you submit a form and don't fill out the fields (see here, and push send). The box expands to show the errors, and underneath the footer there is a blank space. The best example I can give is to see it in action (link above). I've played with min-height and it didn't work too good. I'd also like to avoid expanding the footer with code in the event of form errors if I can help it. Should I ditch the absolute positioning? And try with margins? Is there any other way to get it to work?

    Read the article

  • How to modify a xml file using PHP? use a node to retrieve the value of new child nodes and add them

    - by Avinash Sonee
    I have pasted the example of what I need here : http://pastie.org/1005178 I have a xml file with say the following info <state> <info> <name>hello</name> <zip>51678</zip> </info> <info> <name>world</name> <zip>54678</zip> </info> </state> Now I need to create a new xml file which has the following <state> <info> <name>hello</name> <zip>51678</zip> <lat>17.89</lat> <lon>78.90</lon> </info> <info> <name>world</name> <zip>54678</zip> <lat>16.89</lat> <lon>83.45</lon> </info> </state> So, basically I need to add lat and lon nodes to each info element. these lat and lon correspond to the zip code which are stored in a mysql file which contains 3 fields - pin, lat and lon How do i do this recursively. I have say 1000 info elements in a file Please give me a sample code because I have already tried using simplexml and read the documentation but doesn't see to understand it properly

    Read the article

  • How can i bind parent's property to its child's property?

    - by walkor
    I have a GroupBox, which is defined like this <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Groupbox" > <Style TargetType="local:GroupBox"> <Setter Property="BorderBrush" Value="DarkGray"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Padding" Value="6"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:GroupBox"> <Grid Background="{TemplateBinding Background}"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Border BorderThickness="{TemplateBinding BorderThickness}" Grid.Row="1" Grid.RowSpan="2" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3"> <Border.Clip> <GeometryGroup FillRule="EvenOdd"> <RectangleGeometry x:Name="FullRect" Rect="0,0,300,200"/> <RectangleGeometry x:Name="HeaderRect" Rect="6,0,100,100"/> </GeometryGroup> </Border.Clip> </Border> <ContentPresenter Grid.Row="2" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/> <ContentControl x:Name="HeaderContainer" Margin="6,0,0,0" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Left"> <ContentPresenter Margin="3,0,3,0" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}"/> </ContentControl> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> And i'm using this control like this <Controls:GroupBox x:Name="GroupBox"> <Controls:GroupBox.HeaderTemplate> <DataTemplate> <CheckBox "Header" x:Name="cbHeader"/> </DataTemplate> </Controls:GroupBox.HeaderTemplate> <Controls:GroupBox> So, well, my questions - how can i bind property IsEnabled of GroupBox to the Checkbox property IsChecked? Thanks in advance.

    Read the article

  • Problems crossing the boundary between protected greasemonkey execution space and the unsafeWindow l

    - by Chilly
    Hi guys. Here is my problem: I've registered some callbacks into a Yahoo event driven webpage (betfair.com market views) and am trapping the betsPlaced events with a handler. So far so simple. Next stage is to get the event back into greasemonkey land, and while I know that from greasemoney space you can call unsafeWindow.stuff, there is no reverse operation (by design). So if I want to send the contents of the event over, say, a cometd queue, my carefully set up jquery, greasemonkey, YUI2, betfair environment fails by telling me that unsafeWindow processes cant call GM_ajax stuff. This is obviously safe and sane, but it basically stops me doing what I want to do. Has anyone tried doing this (ignore the cometd stuff, just general ajax calls) and succeeded? I've had a look at pages like this: http://wiki.greasespot.net/0.7.20080121.0%2B_compatibility but it doesnt appear to work for all the calls.

    Read the article

  • How to access child div elements under a given condition with javascript?

    - by hlovdal
    My main question is to calculate the last alert message, but any other information is also welcome. I am trying to learn javascript (to use with greasemonkey later), but I am struggling a bit to grasp the DOM and how to process it. <html> <head> <script type="text/javascript"> function my_test() { var elements = document.getElementsByTagName("div"); // prints "found [object HTMLCollection] with length 8" alert("found " + elements + " with length " + elements.length); // prints "0:[object HTMLDivElement]" alert("0:" + elements[0]); // how to calculate the following? alert("for intereting one is AAAA and three is CCCC"); } </script> </head> <body> <div class="interesing"> <div class="one">AAAA</div> <div class="two">BBBB</div> <div class="three">CCCC</div> </div> <div class="boring"> <div class="one">1111</div> <div class="two">2222</div> <div class="three">3333</div> </div> <input type="button" onclick="my_test()" value="my test" </body> </html> So elements is now an array of elements and I can access each of them individually. But where can I find what methods/properties these elements have?

    Read the article

  • is there a better way to write this frankenstein LINQ query that searches for values in a child tabl

    - by MRV
    I have a table of Users and a one to many UserSkills table. I need to be able to search for users based on skills. This query takes a list of desired skills and searches for users who have those skills. I want to sort the users based on the number of desired skills they posses. So if a users only has 1 of 3 desired skills he will be further down the list than the user who has 3 of 3 desired skills. I start with my comma separated list of skill IDs that are being searched for: List<short> searchedSkillsRaw = skills.Value.Split(',').Select(i => short.Parse(i)).ToList(); I then filter out only the types of users that are searchable: List<User> users = (from u in db.Users where u.Verified == true && u.Level > 0 && u.Type == 1 && (u.UserDetail.City == city.SelectedValue || u.UserDetail.City == null) select u).ToList(); and then comes the crazy part: var fUsers = from u in users select new { u.Id, u.FirstName, u.LastName, u.UserName, UserPhone = u.UserDetail.Phone, UserSkills = (from uskills in u.UserSkills join skillsJoin in configSkills on uskills.SkillId equals skillsJoin.ValueIdInt into tempSkills from skillsJoin in tempSkills.DefaultIfEmpty() where uskills.UserId == u.Id select new { SkillId = uskills.SkillId, SkillName = skillsJoin.Name, SkillNameFound = searchedSkillsRaw.Contains(uskills.SkillId) }), UserSkillsFound = (from uskills in u.UserSkills where uskills.UserId == u.Id && searchedSkillsRaw.Contains(uskills.SkillId) select uskills.UserId).Count() } into userResults where userResults.UserSkillsFound > 0 orderby userResults.UserSkillsFound descending select userResults; and this works! But it seems super bloated and inefficient to me. Especially the secondary part that counts the number of skills found. Thanks for any advice you can give. --r

    Read the article

  • How to use IO.popen to write-to and read-from a child process?

    - by mackenir
    I am running net share from a ruby script to delete a windows network share. If files on the share are in use, net share will ask the user if they want to go ahead with the deletion, so my script needs to inspect the output from the command, and write out Y if it detects that net share is asking it for input. In order to be able to write out to the process I open it with access flags "r+". When attempting to write to the process with IO#puts, I get an error: Errno::EPIPE: Broken pipe What am I doing wrong here? (The error occurs on the line net_share.puts "Y") (The question text written out by net share is not followed by a newline, so I am using IO#readpartial to read in the output.) def delete_network_share share_path command = "net share #{share_path} /DELETE" net_share = IO.popen(command, "r+") text = "" while true begin line = net_share.readpartial 1000 #read all the input that's available rescue EOFError break end text += line if text.scan("Do you want to continue this operation? (Y/N)").size > 0 net_share.puts "Y" net_share.flush #probably not needed? end end net_share.close end

    Read the article

  • How to bring the parent element with floated child elements to the center of the document?

    - by Starx
    I have organized a menu. Its HTML is as follows: <ul class="topmenu"> <li><a href="sample.html">Text 1</a></li> <li><a href="sample.html">Text 2</a></li> <li><a href="sample.html">Text 3</a></li> <li><a href="sample.html">Text 4</a></li> <ul> This is a horizontal menu, so I have floated the list items to left to appear them in a horizontal line. I could have used display:inline to appear them in a single line, but since IE does not support it and I don't know any other way to do so, I used float:left;. It's css is: .topmenu { list-style:none; margin:0; padding:0; } .topmenu li { float:left; } This brings the menu in a perfect horizontal line, but the entire list is floated to the left. I want to bring the .topmenu to appear in the center of the document and keep the listitem inside it floated towards the left. I found that this is achievable by defining width property of the .topmenu, but I dont want to fix its width as the list-items are dynamically generated and thus could increase and decrease. Any one know of any solution?

    Read the article

  • Query Tamino server with xql parameter in URL. Exclude nodes with specific child.

    - by Anon
    I have to query a Tamino database through HTTP. http://example.com/db?DocumentType=publication&year=all gives me a list of all publication in the database, something like: <publication> <title> The first publications title </title> <author> Author, M </author> <LastModification> <year> 2008 </year> <month> 05 </month> </LastModification> <year> 2006 </year> </publication> <publication> <title> The second publications title </title> <author> Secauthor, M </author> <LastModification> <year> 2005 </year> <month> 01 </month> </LastModification> <year> 2000 </year> </publication> <publication> <title> Another publications title </title> <author> Anauthor, M </author> <year> 2008 </year> </publication> (Simplified values) There is a xql parameter that can be specified and that can be used to filter the output, so I can do: http://example.com/db?DocumentType=publication&year=all&xql=LastModification/year~>2008 Which results in: <publication> <title> The publications title </title> <author> Author, M </author> <LastModification> <year> 2008 </year> <month> 05 </month> </LastModification> <year> 2006 </year> </publication> <publication> <title> Another publications title </title> <author> Anauthor, M </author> <year> 2008 </year> </publication> There is very little documentation... I want to be able to first get all publications that have changed since the last update (and only those), and then in a second query all publications that do not have a <LastModification> tag.

    Read the article

  • Android: How to make launcher always open the main activity instead of child activity? (or otherwise

    - by yuku
    I have activities A and B. The A is the one with LAUNCHER intent-filter (i.e. the activity that is started when we click the app icon on home screen). A launches B using startActivity(new Intent(A.this, B.class)). When the user has the B activity open, and then put my application into the background, and later my application's process is killed, when the user starts my application again, B is opened instead of A. This caused a force close in my app, because A is the activity that initializes the resources my app needs, and when B tried to access the uninitialized resources, B crashes. Do you have any suggestions what should I do in this situation?

    Read the article

  • In which controller do you put the CRUD for the child part of a relationship?

    - by uriDium
    I am using ASP.Net MVC but this probably applies to all MVC patterns in general. My problem, for example I have companies and in each company I have a list of contacts. When I have selected a company I can see its details and a list of the contacts for that company. When I want to add a new contact for that company, should the implementation of that action go into the company controller as an "AddContact" action or should it go into the contact controller into a "New" action and we pass the Company ID in the URL? What is the usual way of dealing with this sort of thing in ASP.Net MVC? Is there a better stategy?

    Read the article

  • XML configuration of Zend_Form: child nodes and attributes not always equal?

    - by Cez
    A set of forms (using Zend_Form) that I have been working on were causing me some headaches trying to figure out what was wrong with my XML configuration, as I kept getting unexpected HTML output for a particular INPUT element. It was supposed to be getting a default value, but nothing appeared. It appears that the following 2 pieces of XML are not equal when used to instantiate Zend_Form: Snippet #1: <form> <elements> <test type="hidden"> <options ignore="true" value="foo"/> </test> </elements> </form> Snippet #2: <form> <elements> <test type="hidden"> <options ignore="true"> <value>foo</value> </options> </test> </elements> </form> The type of the element doesn't appear to make a difference, so it doesn't appear to be related to hidden fields. Is this expected or not?

    Read the article

  • Recommendations for IPC between parent and child processes in .NET?

    - by Jeremy
    My .NET program needs to run an algorithm that makes heavy use of 3rd party libraries (32-bit), most of which are unmanaged code. I want to drive the CPU as hard as I can, so the code runs several threads in parallel to divide up the work. I find that running all these threads simultaneously results in temporary memory spikes, causing the process' virtual memory size to approach the 2 GB limit. This memory is released back pretty quickly, but occasionally if enough threads enter the wrong sections of code at once, the process crosses the "red line" and either the unmanaged code or the .NET code encounters an out of memory error. I can throttle back the number of threads but then my CPU usage is not as high as I would like. I am thinking of creating worker processes rather than worker threads to help avoid the out of memory errors, since doing so would give each thread of execution its own 2 GB of virtual address space (my box has lots of RAM). I am wondering what are the best/easiest methods to communicate the input and output between the processes in .NET? The file system is an obvious choice. I am used to shared memory, named pipes, and such from my UNIX background. Is there a Windows or .NET specific mechanism I should use?

    Read the article

  • WinForms: How to determine if window is no longer active (no child window has focus)?

    - by Marek
    My application uses multiple windows I want to hide one specific window in case the application loses focus (when the Active Window is not the application window) source I am handling the Deactivate event of my main form. private void MainForm_Deactivate(object sender, EventArgs e) { Console.WriteLine("deactivate"); if (GetActiveWindow() == this.Handle) { Console.WriteLine("isactive=true"); } else { Console.WriteLine("isactive=false"); } } [DllImport("user32.dll")] static extern IntPtr GetActiveWindow(); The output is always deactivate isactive=true I have observed the same behavior if a new window within my application receives focus and also if I click into a different application. I would expect GetActiveWindow to return the handle of the new active window when called from the Deactivate handler. Instead it always returns the handle of my application window. How is this possible? Is the Deactivate event handled "too soon"? (while the main form is still active?). How can I detect that my application has lost focus (my application window is not the active window) and another application gained it without running GetActiveWindow on a timer?

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >