Search Results

Search found 1622 results on 65 pages for 'aman deep gautam'.

Page 5/65 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Deep copying of tree view nodes.

    - by Kanags.Net
    I'm trying to copy a treeview nodes to treenodecollection for some other processing. When i execute the treeview.nodes.clear() in the next line, my treenodecollection is becoming null. Can you please tell me how to copy the treeview nodes to treenodecollection and keep the copies of the nodes even after calling Clear method of actual tree view nodes? TreeNodeCollection tnc = null; private TypeIn() { tnc = treeView1.Nodes; treeView1.Nodes.Clear(); //Now my tnc becomes null, but I want the tnc for future use. }

    Read the article

  • How deep are your unit tests?

    - by John Nolan
    The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill? My question is to what level of granularity do you write you unit tests at? ..and is there a case of testing too much?

    Read the article

  • Deep relationships in Rails

    - by Neil Middleton
    I have some projects. Those projects have users through memberships. However, those users belong to companies. Question is, how do I find out which companies can access a project? Ideally I'd be able to do project.users.companies, but that won't work. Is there a nice, pleasant way of doing this?

    Read the article

  • CakePHP 3-level-deep model associatons

    - by user357452
    Hi, I am relatively new to CakePHP, I am doing fine with the documentation, but I've been trying to find a way out to this problem for weeks and I don't seem to find the solution, I am sure it is easy and maybe even automagicaly doable, but I just don't know how to find it (maybe I don't know the jargon for these kind of things) My model structure is like this: <?php class Trip extends AppModel { var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id' ), 'Start' => array( 'className' => 'Place', 'foreignKey' => 'start_id' ), 'End' => array( 'className' => 'Place', 'foreignKey' => 'end_id' ), 'Transport' => array( 'className' => 'Transport', 'foreignKey' => 'transport_id' ) ); } ?> <?php class Place extends AppModel { var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id' ), 'Country' => array( 'className' => 'Country', 'foreignKey' => 'country_id' ), 'State' => array( 'className' => 'State', 'foreignKey' => 'state_id' ), 'City' => array( 'className' => 'City', 'foreignKey' => 'city_id' ) ); var $hasMany = array( 'PlaceStart' => array( 'className' => 'trip', 'foreignKey' => 'start_id', 'dependent' => false ), 'PlaceEnd' => array( 'className' => 'trip', 'foreignKey' => 'end_id', 'dependent' => false ) ); } ?> <?php class State extends AppModel { var $belongsTo = array( 'Country' => array( 'className' => 'Country', 'foreignKey' => 'country_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); var $hasMany = array( 'City' => array( 'className' => 'City', 'foreignKey' => 'city_id', 'dependent' => false ) ); } ?> ... and so forth with User, City, Country, and Transport Models. What I am trying to achieve is to get all the information of the whole tree when I search for a Trip. <?php class TripController extends AppController { function index() { debug($this->Trip->find('first')); } } Outputs Array ( [Trip] => Array ( [id] => 6 [created] => 2010-05-04 00:23:59 [user_id] => 4 [start_id] => 2 [end_id] => 1 [title] => My trip [transport_id] => 1 ) [User] => Array ( [id] => 4 [name] => John Doe [email] => [email protected] ) [Start] => Array ( [id] => 2 [user_id] => 4 [country_id] => 1 [state_id] => 1 [city_id] => 1 [direccion] => Lincoln Street ) [End] => Array ( [id] => 1 [user_id] => 4 [country_id] => 1 [state_id] => 1 [city_id] => 4 [address] => Fifth Avenue ) [Transport] => Array ( [id] => 1 [name] => car ) ) Here is the question: How do I get in one query all the information down the tree? I would like to have something like Array ( [Trip] => Array ( [id] => 6 [created] => 2010-05-04 00:23:59 [User] => Array ( [id] => 4 [name] => John Doe [email] => [email protected] ) [Start] => Array ( [id] => 2 [user_id] => 4 [Country] => Array ( [id] => 1 [name] = Spain ) [State] => Array ( [id] => 1 [name] = Barcelona ) [City] => Array ( [id] => 1 [name] = La Floresta ) [address] => Lincoln Street ) [End] => (same as Start) [title] => My trip [Transport] => Array ( [id] => 1 [name] => car ) ) ) Can CakePHP create this kind of data? Not only for $this->Model->find() but also for $this->paginate() as for example: // filter by start if(isset($this->passedArgs['start'])) { //debug('isset '.$this->passedArgs['start']); $start = $this->passedArgs['start']; $this->paginate['conditions'][] = array( 'OR' => array( 'Start.address LIKE' => "%$start%", 'Start.State.name LIKE' => "%$start%", 'Start.City.name LIKE' => "%$start%", 'Start.Country.name LIKE' => "%$start%" ) ); $this->data['Search']['start'] = $start; } It seems like a rough question but I am sure this is extensively done and documented, I'd really appreciate any help. Thanks Cheers Naoise

    Read the article

  • Praw (Redditt API) How to retrieve replies to a comment past 10 levels deep

    - by jpreed00
    Ok, so I've written some code that, for all intents and purposes, should work: def checkComments(comments): for comment in comments: print comment.body checkComments(comment.replies) def processSub(sub): sub.replace_more_comments(limit=None, threshold=0) checkComments(sub.comments) #login and subreddit init stuff here subs = mysubreddit.get_hot(limit=50) for sub in subs: processSub(sub) However, given a submission that has 50 nested replies like so: root comment -> 1st reply -> 2nd reply -> 3rd reply ... -> 50th reply The above code only prints: root comment 1st reply 2nd reply 3rd reply 4th reply 5th reply 6th reply 7th reply 8th reply 9th reply Any idea how I can get the remaining 41 levels of replies? Or is this a praw limitation?

    Read the article

  • Invert linear linked list

    - by ArtWorkAD
    Hi, a linear linked list is a set of nodes. This is how a node is defined (to keep it easy we do not distinguish between node an list): class Node{ Object data; Node link; public Node(Object pData, Node pLink){ this.data = pData; this.link = pLink; } public String toString(){ if(this.link != null){ return this.data.toString() + this.link.toString(); }else{ return this.data.toString() ; } } public void inc(){ this.data = new Integer((Integer)this.data + 1); } public void lappend(Node list){ Node child = this.link; while(child != null){ child = child.link; } child.link = list; } public Node copy(){ if(this.link != null){ return new Node(new Integer((Integer)this.data), this.link.copy()); }else{ return new Node(new Integer((Integer)this.data), null); } } public Node invert(){ Node child = this.link; while(child != null){ child = child.link; } child.link = this;.... } } I am able to make a deep copy of the list. Now I want to invert the list so that the first node is the last and the last the first. The inverted list has to be a deep copy. I started developing the invert function but I am not sure. Any Ideas? Update: Maybe there is a recursive way since the linear linked list is a recursive data structure. I would take the first element, iterate through the list until I get to a node that has no child and append the first element, I would repeat this for the second, third....

    Read the article

  • DRYing out implementation of ICloneable in several classes

    - by Sarah Vessels
    I have several different classes that I want to be cloneable: GenericRow, GenericRows, ParticularRow, and ParticularRows. There is the following class hierarchy: GenericRow is the parent of ParticularRow, and GenericRows is the parent of ParticularRows. Each class implements ICloneable because I want to be able to create deep copies of instances of each. I find myself writing the exact same code for Clone() in each class: object ICloneable.Clone() { object clone; using (var stream = new MemoryStream()) { var formatter = new BinaryFormatter(); // Serialize this object formatter.Serialize(stream, this); stream.Position = 0; // Deserialize to another object clone = formatter.Deserialize(stream); } return clone; } I then provide a convenience wrapper method, for example in GenericRows: public GenericRows Clone() { return (GenericRows)((ICloneable)this).Clone(); } I am fine with the convenience wrapper methods looking about the same in each class because it's very little code and it does differ from class to class by return type, cast, etc. However, ICloneable.Clone() is identical in all four classes. Can I abstract this somehow so it is only defined in one place? My concern was that if I made some utility class/object extension method, it would not correctly make a deep copy of the particular instance I want copied. Is this a good idea anyway?

    Read the article

  • Python: Inheritance of a class attribute (list)

    - by Sano98
    Hi everyone, inheriting a class attribute from a super class and later changing the value for the subclass works fine: class Unit(object): value = 10 class Archer(Unit): pass print Unit.value print Archer.value Archer.value = 5 print Unit.value print Archer.value leads to the output: 10 10 10 5 which is just fine: Archer inherits the value from Unit, but when I change Archer's value, Unit's value remains untouched. Now, if the inherited value is a list, the shallow copy effect strikes and the value of the superclass is also affected: class Unit(object): listvalue = [10] class Archer(Unit): pass print Unit.listvalue print Archer.listvalue Archer.listvalue[0] = 5 print Unit.listvalue print Archer.listvalue Output: 10 10 5 5 Is there a way to "deep copy" a list when inheriting it from the super class? Many thanks Sano

    Read the article

  • difference between DataContract attribute and Serializable attribute in .net

    - by samar
    I am trying to create a deep clone of an object using the following method. public static T DeepClone<T>(this T target) { using (MemoryStream stream = new MemoryStream()) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, target); stream.Position = 0; return (T)formatter.Deserialize(stream); } } This method requires an object which is Serialized i.e. an object of a class who is having an attribute "Serializable" on it. I have a class which is having attribute "DataContract" on it but the method is not working with this attribute. I think "DataContract" is also a type of serializer but maybe different than that of "Serializable". Can anyone please give me the difference between the two? Also please let me know if it is possible to create a deepclone of an object with just 1 attribute which does the work of both "DataContract" and "Serializable" attribute or maybe a different way of creating a deepclone? Please help!

    Read the article

  • SQL Server MVP Deep Dives 2. The Awesome Returns.

    - by Mladen Prajdic
    Two years ago 59 SQL Server MVP's came together and helped make one of the best book on SQL Server out there. Each chapter was written by an MVP about a part of SQL Server they loved working with. This resulted in superb quality content and excellent ratings from the readers. To top it off all earnings went to a good cause, the War Child International organization. That book was SQL Server MVP Deep Dives. This year 63 SQL Server MVPs, me included, decided it was time do repeat the success of the first book. Let me introduce you the: SQL Server MVP Deep Dives 2 The topics in 60 chapters are grouped in 5 groups: Architecture, Database Administration, Database Development, Performance Tuning and Optimization, Business Intelligence. They represent over 1000 years of daily experience in various areas of SQL Server. I have contributed chapter 28 in Database Development group titled Getting asynchronous with Service Broker. In it I show you the Service Broker template you can use for secure communication between two or more SQL server instances for whatever purpose you may have. If you haven't heard of Service Broker it's a part of the database engine that enables you to do completely async operations in the database itself or between databases and instances. The official release of the book will be next week at PASS where there will be 2 slots where most of the authors will be there signing the books you bring. This is also a great opportunity to meet everyone and ask about any problems you may have. So definitely come say hi. Again we decided on a charity that will be supported by this book. It's called Operation Smile. They provide free surgeries to repair cleft lip, cleft palate and other facial deformities for children around the globe. You can also help them by donating. You can preorder it on at Manning Publications website or on Amazon. By having it you not only get to learn a lot, improve your skills and have fun but you also help a child have a normal life. If that's not a good cause then I don't know what it is.

    Read the article

  • Sorry For The Short Notice! November Deep Dive Demo Invitations

    - by KemButller
    If you would like to get a deep dive overview and demo of two of JD Edwards hottest products in the privacy of your own office, you are in luck!  The Oracle sales team invites you to attend their on-line seminars covering EnterpriseOne One View Reporting and EnterpriseOne Health and Safety Incident Management. You can get the details and register via these links. EnterpriseOne One View Reporting - November 13  EnterpriseOne Health and Safety Incident Management - November 20 

    Read the article

  • Here i m sending my code for presentmodelViewController

    - by aman-gupta
    Hi Please help me out i want to switch to first view from third view directly here is my code:-where i m using presentModelViewcontroller // // ExperimentAppDelegate.h // Experiment // // Created by Aman on 4/20/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import <UIKit/UIKit.h> @class ExperimentViewController; @class SecondView; @class ThirdView; BOOL parentScreenNo; @interface ExperimentAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; ExperimentViewController *viewController; SecondView *ptrSecond; ThirdView *ptrThird; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet ExperimentViewController *viewController; @property (nonatomic, retain) IBOutlet SecondView *ptrSecond; @property (nonatomic, retain) IBOutlet ThirdView *ptrThird; @end ///////////////////////////////////// // // ExperimentAppDelegate.m // Experiment // // Created by Aman on 4/20/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import "ExperimentAppDelegate.h" #import "ExperimentViewController.h" @implementation ExperimentAppDelegate @synthesize window; @synthesize viewController,ptrThird,ptrSecond; - (void)applicationDidFinishLaunching:(UIApplication *)application { parentScreenNo = NO; // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } - (void)dealloc { [viewController release]; [window release]; [super dealloc]; } @end ///////////////////////////////////////// // // ExperimentViewController.h // Experiment // // Created by Aman on 4/20/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import <UIKit/UIKit.h> @interface ExperimentViewController : UIViewController { } -(IBAction)second:(id)sender; @end /////////////////////////////// // // ExperimentViewController.m // Experiment // // Created by Aman on 4/20/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import "ExperimentViewController.h" #import "ExperimentAppDelegate.h" @implementation ExperimentViewController /* // The designated initializer. Override to perform setup that is required before the view is loaded. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ -(IBAction)second:(id)sender { ExperimentAppDelegate *app = (ExperimentAppDelegate *)[[UIApplication sharedApplication]delegate]; [self presentModalViewController:app.ptrSecond animated:YES]; } /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ /* // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } */ /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end ///////////////////////////////// // // SecondView.h // Experiment // // Created by Aman on 4/20/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> @interface SecondView : UIViewController { } -(IBAction)third:(id)sender; -(void)down; @end //////////////////////////////////////////// // // SecondView.m // Experiment // // Created by Aman on 4/20/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "SecondView.h" #import "ExperimentAppDelegate.h" @implementation SecondView /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } -(void)viewWillAppear:(BOOL)animated { if(parentScreenNo == YES) { [self performSelector:@selector(down) withObject:nil]; } [super viewWillAppear:YES]; } -(IBAction)third:(id)sender { ExperimentAppDelegate *app = (ExperimentAppDelegate *)[[UIApplication sharedApplication]delegate]; [self presentModalViewController:app.ptrThird animated:YES]; } -(void)down { [self dismissModalViewControllerAnimated:YES]; } /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end ////////////////////////////////// // // ThirdView.h // Experiment // // Created by Aman on 4/20/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> @interface ThirdView : UIViewController { } -(IBAction)back:(id)sender; @end ////////////////////////////////// // // ThirdView.m // Experiment // // Created by Aman on 4/20/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "ThirdView.h" #import "ExperimentAppDelegate.h" @implementation ThirdView /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ /* // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } */ -(IBAction)back:(id)sender { [self dismissModalViewControllerAnimated:YES]; parentScreenNo = YES; } /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end Above is my code for calling other view please tell how i can call my first view by using dismismodelViewController from third screen Please help me out

    Read the article

  • SQLCMD Restore works in Management Studio but not from DOS prompt

    - by Gautam
    Any idea why my Restore command works fine when run in Management Studio 2008 but not when run from the dos prompt? Shown below is the error when running from the dos prompt. C:\>SQLCMD -s local\SQL2008 -d master -Q "RESTORE DATABASE [Sample.Db] FROM DISK = N'C:\Sample.Db.bak' WITH FILE = 1, MOVE N'Sample.Db' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db.mdf', MOVE N'Sample.Db_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db_log.ldf', NOUNLOAD, REPLACE, STATS = 10" Msg 3634, Level 16, State 1, Server GAUTAM, Line 1 The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db.mdf'. Msg 3156, Level 16, State 8, Server GAUTAM, Line 1 File 'Sample.Db' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db.mdf'. Use WITH MOVE to identify a valid location for the file. Msg 3634, Level 16, State 1, Server GAUTAM, Line 1 The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db_log.ldf'. Msg 3156, Level 16, State 8, Server GAUTAM, Line 1 File 'Sample.Db_log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db_log.ldf'. Use WITH MOVE to identify a valid location for the file. Msg 3119, Level 16, State 1, Server GAUTAM, Line 1 Problems were identified while planning for the RESTORE statement. Previous messages provide details. Msg 3013, Level 16, State 1, Server GAUTAM, Line 1 RESTORE DATABASE is terminating abnormally. However if I execute this directly in Management Studio 2008, it works fine: RESTORE DATABASE [Sample.Db] FROM DISK = N'C:\Sample.Db.bak' WITH FILE = 1, MOVE N'Sample.Db' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db.mdf', MOVE N'Sample.Db_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\DATA\Sample.Db_log.ldf', NOUNLOAD, REPLACE, STATS = 10 There is no lock or security issues, the data base doesn't exist on the server. I can't figure it out. Any ideas?

    Read the article

  • Trouble with copying dictionaries and using deepcopy on an SQLAlchemy ORM object

    - by Az
    Hi there, I'm doing a Simulated Annealing algorithm to optimise a given allocation of students and projects. This is language-agnostic pseudocode from Wikipedia: s ? s0; e ? E(s) // Initial state, energy. sbest ? s; ebest ? e // Initial "best" solution k ? 0 // Energy evaluation count. while k < kmax and e > emax // While time left & not good enough: snew ? neighbour(s) // Pick some neighbour. enew ? E(snew) // Compute its energy. if enew < ebest then // Is this a new best? sbest ? snew; ebest ? enew // Save 'new neighbour' to 'best found'. if P(e, enew, temp(k/kmax)) > random() then // Should we move to it? s ? snew; e ? enew // Yes, change state. k ? k + 1 // One more evaluation done return sbest // Return the best solution found. The following is an adaptation of the technique. My supervisor said the idea is fine in theory. First I pick up some allocation (i.e. an entire dictionary of students and their allocated projects, including the ranks for the projects) from entire set of randomised allocations, copy it and pass it to my function. Let's call this allocation aOld (it is a dictionary). aOld has a weight related to it called wOld. The weighting is described below. The function does the following: Let this allocation, aOld be the best_node From all the students, pick a random number of students and stick in a list Strip (DEALLOCATE) them of their projects ++ reflect the changes for projects (allocated parameter is now False) and lecturers (free up slots if one or more of their projects are no longer allocated) Randomise that list Try assigning (REALLOCATE) everyone in that list projects again Calculate the weight (add up ranks, rank 1 = 1, rank 2 = 2... and no project rank = 101) For this new allocation aNew, if the weight wNew is smaller than the allocation weight wOld I picked up at the beginning, then this is the best_node (as defined by the Simulated Annealing algorithm above). Apply the algorithm to aNew and continue. If wOld < wNew, then apply the algorithm to aOld again and continue. The allocations/data-points are expressed as "nodes" such that a node = (weight, allocation_dict, projects_dict, lecturers_dict) Right now, I can only perform this algorithm once, but I'll need to try for a number N (denoted by kmax in the Wikipedia snippet) and make sure I always have with me, the previous node and the best_node. So that I don't modify my original dictionaries (which I might want to reset to), I've done a shallow copy of the dictionaries. From what I've read in the docs, it seems that it only copies the references and since my dictionaries contain objects, changing the copied dictionary ends up changing the objects anyway. So I tried to use copy.deepcopy().These dictionaries refer to objects that have been mapped with SQLA. Questions: I've been given some solutions to the problems faced but due to my über green-ness with using Python, they all sound rather cryptic to me. Deepcopy isn't playing nicely with SQLA. I've been told thatdeepcopy on ORM objects probably has issues that prevent it from working as you'd expect. Apparently I'd be better off "building copy constructors, i.e. def copy(self): return FooBar(....)." Can someone please explain what that means? I checked and found out that deepcopy has issues because SQLAlchemy places extra information on your objects, i.e. an _sa_instance_state attribute, that I wouldn't want in the copy but is necessary for the object to have. I've been told: "There are ways to manually blow away the old _sa_instance_state and put a new one on the object, but the most straightforward is to make a new object with __init__() and set up the attributes that are significant, instead of doing a full deep copy." What exactly does that mean? Do I create a new, unmapped class similar to the old, mapped one? An alternate solution is that I'd have to "implement __deepcopy__() on your objects and ensure that a new _sa_instance_state is set up, there are functions in sqlalchemy.orm.attributes which can help with that." Once again this is beyond me so could someone kindly explain what it means? A more general question: given the above information are there any suggestions on how I can maintain the information/state for the best_node (which must always persist through my while loop) and the previous_node, if my actual objects (referenced by the dictionaries, therefore the nodes) are changing due to the deallocation/reallocation taking place? That is, without using copy?

    Read the article

  • Developer Deep Dive into Oracle WebLogic Server 12c (Dec. 1)

    - by oracletechnet
    It is not often that we are compelled to direct you toward a product launch event. But this one is special. On Dec. 1, Oracle will launch (via live Webcast) Oracle WebLogic Server 12c, a major update to that product. And this release, which includes Java EE 6 support, Active GridLink for Oracle RAC, and Oracle Virtual Assembly Builder, among other things, is specifically designed to improve the process of deploying apps to the cloud. Even better: the Dec. 1 Webcast includes an hour-long, developer-focused deep-dive session in which product experts will answer your questions via live chat. (Register for this session separately.) You don't want to miss this one, folks! 

    Read the article

  • AJAX deeplinking with jQuery Address

    - by antosha
    Hello, I have a website which has many pages: For example: HOME: http://mywebsite.com/index.html SOME PAGE: http://mywebsite.com/categorie/somepage.html I decided to make my pages load dynamically with AJAX without reloading the page. So I decided to use jQuery Address plugin ( http://www.asual.com/jquery/address/docs/ ) in order to allow deeplinking and Back-Forward navigation: <script type="text/javascript" src="uploads/scripts/jquery.address-1.2rc.min.js"></script> <script type="text/javascript"> $('a').address(function() { return $(this).attr('href').replace(/^#/, ''); }); </script> Now, after installing the plugin, if I go on http://mywebsite.com/index.html (HOME) and click on SOME PAGE link, jquery successfully loads the http://mywebsite.com/categorie/somepage.html without reloading the page and the address bar on my browser displays: http://mywebsite.com/index.html/#/categorie/somepage.html which is great! However, the problem is: if I copy this dynamically generated URL: http://mywebsite.com/index.html/#/categorie/somepage.html into a web browser address bar, it will take into my website index.html page and not to the "SOME PAGE" page. Also, The Forward/Back buttons don't work correctly, they only replace the address in the URL bar but the content stays the same. I suppose that I need to write some JavaScript rule that associates the dynamic URL with the correct page? Some help would be appreciated. Thanks :)

    Read the article

  • Deeplinking with SWFAddress and Facebook connect

    - by Frederik
    After prompting the user for the login and submitting it's details, my application appears in the facebook lightbox instead of the browser window. This is not the case when I remove the SWFAddress params (all the info after the hash in the URL bar). Is it possible to tell the API to ignore the info after the hash or is there a way i can determine the redirect URL myself? Any help would be greatly appreciated,

    Read the article

  • jQuery Address changed event

    - by Dustin
    I'm trying my hand at jQuery Address http://www.asual.com/jquery/address/ On a click event I set $.address.value(mypath); This fires off the $.address.change() event. When I click a link I want the behavior to be slightly different than when this event is fired by clicking the back/forward button or with a bookmark or link. Is there a way to distinguish between the two events. I've looked at the event object passed to $.address.change() and they seem to be identical in both situations.

    Read the article

  • jQuery Address - redirect after form submit

    - by Stian
    Hello all, I use jQuery and AJAX to load content from links and forms into a content div. In addition I use the Address plugin to enable the back button and refresh. On the server side I use Java and Spring MVC. Since I'm using jQuery Address and AJAX the only page that is directly loaded is "index.html". Everything else is loaded into a content div, and what page to load is specified in the hash, ie. "index.html#/users/add.html" will load "users/add.html". Now, "users/add.html" contains a form for creating a new user. When the form is submitted and everything went OK, the controller redirects to "users/index.html". The problem is that jQuery Address doesn't know about the redirect, so the url will remain "index.html#/users/add.html". And this is a problem when you refresh the page and then get sent back to the form, instead of the index page. Is there a way to fix this problem? Thanks, Stian

    Read the article

  • jQuery Address Plugin - Not allowing loading ajax?

    - by Nic Hubbard
    I am trying to test the jQuery Address Plugin and it seems to not allow ajax to work in the change function. I am using: $.address.change(function(event) { $('#content').load(event.value+' #content'); $.address.title(event.value); }); $('a').click(function() { $.address.value($(this).attr('href')); }); While I can use event.value for other things, it just does not seem to let the .load() function work. Even trying a static URL in .load() does nothing. Is something in the plugin preventing this? I thought this was the point of the plugin!

    Read the article

  • Clone List Elements in Java

    - by Amir Rachum
    Hi all, I have a variable of type List<RelationHeader>. Now I want to copy all the elements in this list to a new list, but I want to actually copy all the members by value (clone them). Is there a quick command to do this, or do I need to iterate over the list and copy them one at a time?

    Read the article

  • Can I update window.location.hash without having the web page scroll?

    - by Jonathon Watney
    Using JavaScript, is there a way to update window.location.hash without scrolling the web page? I have clickable title elements that toggle the visibility of a div directly beneath them. I want the /foo#bar in the history when clicking titles but don't want the page scrolling about. So when navigating away from /foo#bar I'll be able to use the back button and have the div whose ID is in window.location.hash be visible upon return. Is this behavior possible?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >