Search Results

Search found 32397 results on 1296 pages for 'reference program'.

Page 13/1296 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Class instance clustering in object reference graph for multi-entries serialization

    - by Juh_
    My question is on the best way to cluster a graph of class instances (i.e. objects, the graph nodes) linked by object references (the -directed- edges of the graph) around specifically marked objects. To explain better my question, let me explain my motivation: I currently use a moderately complex system to serialize the data used in my projects: "marked" objects have a specific attributes which stores a "saving entry": the path to an associated file on disc (but it could be done for any storage type providing the suitable interface) Those object can then be serialized automatically (eg: obj.save()) The serialization of a marked object 'a' contains implicitly all objects 'b' for which 'a' has a reference to, directly s.t: a.b = b, or indirectly s.t.: a.c.b = b for some object 'c' This is very simple and basically define specific storage entries to specific objects. I have then "container" type objects that: can be serialized similarly (in fact their are or can-be "marked") they don't serialize in their storage entries the "marked" objects (with direct reference): if a and a.b are both marked, a.save() calls b.save() and stores a.b = storage_entry(b) So, if I serialize 'a', it will serialize automatically all objects that can be reached from 'a' through the object reference graph, possibly in multiples entries. That is what I want, and is usually provides the functionalities I need. However, it is very ad-hoc and there are some structural limitations to this approach: the multi-entry saving can only works through direct connections in "container" objects, and there are situations with undefined behavior such as if two "marked" objects 'a'and 'b' both have a reference to an unmarked object 'c'. In this case my system will stores 'c' in both 'a' and 'b' making an implicit copy which not only double the storage size, but also change the object reference graph after re-loading. I am thinking of generalizing the process. Apart for the practical questions on implementation (I am coding in python, and use Pickle to serialize my objects), there is a general question on the way to attach (cluster) unmarked objects to marked ones. So, my questions are: What are the important issues that should be considered? Basically why not just use any graph parsing algorithm with the "attach to last marked node" behavior. Is there any work done on this problem, practical or theoretical, that I should be aware of? Note: I added the tag graph-database because I think the answer might come from that fields, even if the question is not.

    Read the article

  • Program instantly closing [migrated]

    - by Ben Clayton
    I made this program and when I compiled it there were no errors but the program just instantly closed, any answers would be appreciated. #include <iostream> //Main commands #include <string> // String commands #include <windows.h> // Sleep using namespace std; int main () { //Declaring variables float a; bool end; std::string input; end = false; // Making sure program doesn't end instantly cout << "Enter start then the number you want to count down from." << ".\n"; while (end = false){ cin >> input; cout << ".\n"; if (input.find("end") != std::string::npos) // Ends the program if user types end end = true; else if (input.find("start" || /* || is or operator*/ "restart") != std::string::npos) // Sets up the countdown timer if the user types start { cin >> a; cout << ".\n"; while (a>0){ Sleep(100); a = a - 0.1; cout << a << ".\n"; } cout << "Finished! Enter restart and then another number, or enter end to close the program" << ".\n"; } else // Tells user to start program cout << "Enter start"; } return 0; // Ends program when (end = true) }

    Read the article

  • Prepared statement alternatives for this middle-man program?

    - by user2813274
    I have an program that is using a prepared statement to connect and write to a database working nicely, and now need to create a middle-man program to insert between this program and the database. This middle-man program will actually write to multiple databases and handle any errors and connection issues. I would like advice as to how to replicate the prepared statements such as to create minimal impact to the existing program, however I am not sure where to start. I have thought about creating a "SQL statement class" that mimics the prepared statement, only that seems silly. The existing program is in Java, although it's going to be networked anyways so I would be open to writing it in just about anything that would make sense. The databases are currently MySQL, although I would like to be open to changing the database type in the future. My main question is what should the interface for this program look like, and does doing this even make sense? A distributed DB would be the ideal solution, but they seem overly complex and expensive for my needs. I am hoping to replicate the main functionality of a distributed DB via this middle-man. I am not too familiar with sql-based servers distributing data (or database in general...) - perhaps I am fighting an uphill battle by trying to solve it via programming, but I would like to make an attempt at least.

    Read the article

  • Run Program on Startup?

    - by Maddest Hatter
    How is it possible to have an executable run automatically on startup? Is it possible by having a shortcut to the .exe in the startup folder in the All programs section of the start menu? If that is correct, what is the full directory of the start up folder? C:/

    Read the article

  • fluent interface program in Ruby

    - by intern
    we have made the following code and trying to run it. class Numeric def gram self end alias_method :grams, :gram def of(name) ingredient = Ingredient.new(name) ingredient.quantity=self return ingredient end end class Ingredient def initialize(n) @@name= n end def quantity=(o) @@quantity = o return @@quantity end def name return @@name end def quantity return @@quantity end end e= 42.grams.of("Test") a= Ingredient.new("Testjio") puts e.quantity a.quantity=90 puts a.quantity puts e.quantity the problem which we are facing in it is that the output of puts a.quantity puts e.quantity is same even when the objects are different. what we observed is that second object i.e 'a' is replacing the value of the first object i.e. 'e'. the output is coming out to be 42 90 90 but the output required is 42 90 42 can anyone suggest why is it happening? it is not replacing the object as object id's are different..only the values of the objects are replaced.

    Read the article

  • fluent interface program in Ruby

    - by intern
    we have made the following code and trying to run it. class Numeric def gram self end alias_method :grams, :gram def of(name) ingredient = Ingredient.new(name) ingredient.quantity=self return ingredient end end class Ingredient def initialize(n) @@name= n end def quantity=(o) @@quantity = o return @@quantity end def name return @@name end def quantity return @@quantity end end e= 42.grams.of("Test") a= Ingredient.new("Testjio") puts e.quantity a.quantity=90 puts a.quantity puts e.quantity the problem which we are facing in it is that the output of puts a.quantity puts e.quantity is same even when the objects are different. what we observed is that second object i.e 'a' is replacing the value of the first object i.e. 'e'. the output is coming out to be 42 90 90 but the output required is 42 90 42 can anyone suggest why is it happening? it is not replacing the object as object id's are different..only the values of the objects are replaced.

    Read the article

  • Farseer Physics Samples and Krypton how to reference game

    - by Krell
    I'm sure this is totally simple and yes I am new at this. I am trying to set up Krypton inside farseer. 1. create a new Krypton engine in my sub screen aka AdvancedDemo1 : PhysicsGameScreen, IDemoScreen Via this.krypton = new KryptonEngine(this, "KryptonEffect"); The problem is the KryptonEngine(this wants reference to Game game, I cant seem to reference it from FarseerPhysicsGame : Game So how would I do that? or 2. I can put it directly in FarsserPhysicsGame but again I cant seem to figure out how to reference FarseerPhysicsGame in AdvancedDemo1. or 3. I can put it inside the public FarseerPhysicsGame() and do Componenets.Add(krypton) [which works] HOWEVER I cant figure out how to reference the compoenet once it is added. You should be able to stop reading here , but for more detail I simply took the Farseer XNA Samples went into FarseerPhysicsGame.cs and deleted all the screens and menus except AdvancedDemo1 so there is one option and I just click that to load into the advancedDemo1 and thats where I want to put the lights from krypton. Thanks. Edit: Figured out 1 solution though I am still curious about others. Solution 1 I was able to use ScreenManager.Game(not sure why it was there but Ill try to figure it out later)

    Read the article

  • Undefined reference to 'glib'

    - by dali1985
    I would like to parse a config file using glib in Codeblocks which I use. So I want to do exactly the example which is described here first. I have a file named myconfig.cfg and and a code programming.c. I just copy and paste the code to see if glib works but unfortunately it does not work. I did the installation of glib2.0 using sudo apt-get, I found where are the libs in glibs using pkg-config --cflags --libs glib-2.0 and in this path project->Build Options->Compiler Settings-> Other Options I added -I/usr/include/glib-2.0 -I/usr/lib/arm-linuxgnuebihf/glib-2.0/include When I build and run the programming.c I have these errors -------------- Build: Debug in programming --------------- gcc -Wall -g -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -std=c99 -c /home/pi/Desktop/programming/main.c -o obj/Debug/main.o g++ -o bin/Debug/programming obj/Debug/main.o /usr/lib/libmysqlclient.so.16 obj/Debug/main.o: In function `main': /home/pi/Desktop/programming/main.c:22: undefined reference to `g_key_file_new' /home/pi/Desktop/programming/main.c:26: undefined reference to `g_key_file_load_from_file' /home/pi/Desktop/programming/main.c:28: undefined reference to `g_log' /home/pi/Desktop/programming/main.c:34: undefined reference to `g_slice_alloc' /home/pi/Desktop/programming/main.c:37: undefined reference to `g_key_file_get_string' /home/pi/Desktop/programming/main.c:39: undefined reference to `g_key_file_get_locale_string' /home/pi/Desktop/programming/main.c:41: undefined reference to `g_key_file_get_boolean_list' /home/pi/Desktop/programming/main.c:43: undefined reference to `g_key_file_get_integer_list' /home/pi/Desktop/programming/main.c:45: undefined reference to `g_key_file_get_string_list' /home/pi/Desktop/programming/main.c:47: undefined reference to `g_key_file_get_integer' /home/pi/Desktop/programming/main.c:49: undefined reference to `g_key_file_get_double_list' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 6 seconds) 11 errors, 0 warnings Am I missing something? I tried also to do in the same way with libconfig but again I have undefined reference. Is the problem the path?

    Read the article

  • Attracting publishers to an in-house affiliate program

    - by Steve
    The cost to enter affiliate networks can be prohibitive for (cash-strapped) small business, particularly if they are simply testing the waters of an affiliate program. If such a company wanted to run an affiliate program in-house using off the shelf software, what methods would they use to attract publishers? Is it simply a case of SEO or SEM, attempting to attract publishers to the page on their website which outlines their affiliate program? Are there directories to submit one's affiliate program to?

    Read the article

  • TrippLite program not recognizing UPS via USB after reboot

    - by Nicky Bailuc
    I am having trouble with the TrippLite Poweralert Console Program. It is a OpenSUSE version because there is no version for Ubuntu or Debain. I install the program, it works, but as soon as i restart my computer, i assume something happens to the files, but when i try to load the program after reboot, it does not recognize my UPS. Here's the link to where the program can be downloaded: http://www.tripplite.com/en/support/poweralert/poweralert-local.cfm

    Read the article

  • How important is it to install on the program files folder?

    - by eran
    In a proper installation of an average software, its executables would be in the program files folder; its user data in the user's application data folder; it's non user specific data in the all users application data folder; and it should usually be able to run under non-administrative privileges. These guidelines could easily be ignored on XP, but they are an issue on Vista and 7 due to UAC. We're on the verge of releasing a major version of our software. It's a CMS, used by our clients as their main work tool, and their IT staff are well familiar with it. If we want to be fully compatible with Windows 7, we have to make quite a few changes, and we're already on a tight schedule. Question is: we can easily have our clients install our software outside of program files, or have them run it as administrators. I think it's wrong, but I need some ammunition: why should we install on program files, with all the limitations that come with it?

    Read the article

  • Download Free PowerShell Quick Reference Guides from Microsoft

    - by Akemi Iwaya
    Are you just getting started with learning PowerShell or tired of looking up less frequently used commands? Then this terrific set of PowerShell quick reference guides from Microsoft is just what you need! The first guide focuses on commonly-used Windows PowerShell commands and is available in a single .doc format document. The other guides are available as a set (six files) in .pdf format and focus on: tips, shortcuts, and common operations in Windows PowerShell 3.0, Windows PowerShell Workflow, Windows PowerShell ISE, Windows PowerShell Web Access, Server Manager for Windows Server 2012, WinRM, WMI, and WS-Man. Keep in mind that you can select all the guides or just the ones you need to download for the PowerShell 3.0 set. Windows PowerShell Quick Reference [Microsoft] Windows PowerShell 3.0 and Server Manager Quick Reference Guides [Microsoft] [via The Windows Club here and here]     

    Read the article

  • Oracle Forms 11g Customer Upgrade Reference

    - by Grant Ronald
    We have just published a reference to an Oracle customer, Callista, talking about their Forms upgrade experiences and future development plans. I'm actually seeing a huge number of Forms customers upgrading to 11g but it can take some time and effort for customers to formally agree to be a reference story, so I'm grateful to Callista for taking the time to become an 11g upgrade reference.  We have a number of other customers who are writing up their upgrade experiences and we hope to have these on OTN in the coming months. You can access this from the Forms home page on OTN.

    Read the article

  • Do NOT remove the reference to System.Core from your VS2010 Project

    - by Lee Brandt
    One of the things I routinely do when adding a new class library project, is remove all references and just add them back in as I need them. That is NOT a good idea for Visual Studio 2010. When I DID need System.Core, and went to add it back, this is what I got: "A reference to 'System.Core' could not be added. This component is automatically referenced..." After some Googling I found this article: http://connect.microsoft.com/VisualStudio/feedback/details/525663/cannot-remove-system-core-dll-reference-from-a-vs2010-project It tells you to add it back manually. Here is the part that needs back in the project file. After the last PropertyGroup node, add this node:   <ItemGroup>     <Reference Include="System.Core" />   </ItemGroup> You should be good to go again. Hope this helps.

    Read the article

  • Testing Reference Data Mappings

    - by Michael Stephenson
    Background Mapping reference data is one of the common scenarios in BizTalk development and its usually a bit of a pain when you need to manage a lot of reference data whether it be through the BizTalk Cross Referencing features or some kind of custom solution. I have seen many cases where only a couple of the mapping conditions are ever tested. Approach As usual I like to see these things tested in isolation before you start using them in your BizTalk maps so you know your mapping functions are working as expected. This approach can be used for almost all of your reference data type mapping functions where you can take advantage of MSTests data driven tests to test lots of conditions without having to write millions of tests. Walk Through Rather than go into the details of this here, I'm going to call out to one of my colleagues who wrote a nice little walk through about using data driven tests a while back. Check out Callum's blog: http://callumhibbert.blogspot.com/2009/07/data-driven-tests-with-mstest.html

    Read the article

  • Webcast Oracle: La gouvernance des données de référence pour les départements Finance

    - by Louisa Aggoune
    Inscrivez-vous dès maintenant à la session webcast du 11 juillet, de 11h à 12h organisée pour le lancement d’Oracle Data Relationship Governance Vous souhaitez centraliser et partager les données de référence des différentes applications de votre système d’information Finance pour en assurer la cohérence et en diminuer les coûts de réconciliation? Cette session est une opportunité unique de découvrir les avantages pour votre entreprise de l’offre "Oracle DRG – Data Relationship Governance". En échangeant avec nos experts dans le cadre d’une session interactive et d’une démonstration de la plateforme, vous découvrirez : Une application dédiée à la gestion des données de référence Finance : plans de comptes, entités légales, axe organisation, axes analytiques. Un processus de mise à jour du référentiel Finance via un workflow. Comment garantir la cohérence des données de référence. L’audit et l’historisation du référentiel Finance pour répondre aux exigences de contrôle et de traçabilité de la loi Sarbanes-Oxley. Détails de l'événement: Jeudi 11 juillet 2013: 11:00 – 12:00 Pour vous inscrire : cliquez içi

    Read the article

  • Consolidating hotels data from various booking sites with different IDs or reference

    - by Victor
    In one of my projects, I have data for hotels, and other booking sites are able to book this hotel. For example: Hotel A - Booking (ID = 4002), Expedia (ID = 123), Priceline (ID = 147) The three booking engines each uses their own Id to reference to Hotel A. I would need to check manually and make the right reference to the hotel. If I have 100,000 hotels, I have to check manually 300,000 (considering 3 booking sites) times? They might provide API, then I can cross check the name, address or latitude/longitude, but if they differ a little bit then I might give the wrong reference to the wrong hotel. I'm sure there are better ways to do this. There are many travel sites out there which do hotel price checking on many booking sites, but how do they do to make sure they are checking the right hotel on these booking sites? Anyone has any experience on this?

    Read the article

  • Oracle Announces New Oracle Exastack Program for ISV Partners

    - by pfolgado
    Oracle Exastack Program Enables ISV Partners to Leverage a Scalable, Integrated Infrastructure to Deliver Their Applications Tuned and Optimized for High-Performance News Facts Enabling Independent Software Vendors (ISVs) and other members of Oracle Partner Network (OPN) to rapidly build and deliver faster, more reliable applications to end customers, Oracle today introduced Oracle Exastack Ready, available now, and Oracle Exastack Optimized, available in fall 2011 through OPN. The Oracle Exastack Program focuses on helping ISVs run their solutions on Oracle Exadata Database Machine and Oracle Exalogic Elastic Cloud -- integrated systems in which the software and hardware are engineered to work together. These products provide partners with a lower cost and high performance infrastructure for database and application workloads across on-premise and cloud based environments. Leveraging the new Oracle Exastack Program in which applications can qualify as Oracle Exastack Ready or Oracle Exastack Optimized, partners can use available OPN resources to optimize their applications to run faster and more reliably -- providing increased performance to their end users. By deploying their applications on Oracle Exadata Database Machine and Oracle Exalogic Elastic Cloud, ISVs can reduce the cost, time and support complexities typically associated with building and maintaining a disparate application infrastructure -- enabling them to focus more on their core competencies, accelerating innovation and delivering superior value to customers. After qualifying their applications as Oracle Exastack Ready, partners can note to customers that their applications run on and support Oracle Exadata Database Machine and Oracle Exalogic Elastic Cloud component products including Oracle Solaris, Oracle Linux, Oracle Database and Oracle WebLogic Server. Customers can be confident when choosing a partner's Oracle Exastack Optimized application, knowing it has been tuned by the OPN member on Oracle Exadata Database Machine or Oracle Exalogic Elastic Cloud with a goal of delivering optimum speed, scalability and reliability. Partners participating in the Oracle Exastack Program can also leverage their Oracle Exastack Ready and Oracle Exastack Optimized applications to advance to Platinum or Diamond level in OPN. Oracle Exastack Programs Provide ISVs a Reliable, High-Performance Application Infrastructure With the Oracle Exastack Program ISVs have several options to qualify and tune their applications with Oracle Exastack, including: Oracle Exastack Ready: Oracle Exastack Ready provides qualifying partners with specific branding and promotional benefits based on their adoption of Oracle products. If a partner application supports the latest major release of one of these products, the partner may use the corresponding logo with their product marketing materials: Oracle Solaris Ready, Oracle Linux Ready, Oracle Database Ready, and Oracle WebLogic Ready. Oracle Exastack Ready is available to OPN members at the Gold level or above. Additionally, OPN members participating in the program can leverage their Oracle Exastack Ready applications toward advancement to the Platinum or Diamond levels in the OPN Specialized program and toward achieving Oracle Exastack Optimized status. Oracle Exastack Optimized: When available, for OPN members at the Gold level or above, Oracle Exastack Optimized will provide direct access to Oracle technical resources and dedicated Oracle Exastack lab environments so OPN members can test and tune their applications to deliver optimal performance and scalability on Oracle Exadata Database Machine or Oracle Exalogic Elastic Cloud. Oracle Exastack Optimized will provide OPN members with specific branding and promotional benefits including the use of the Oracle Exastack Optimized logo. OPN members participating in the program will also be able to leverage their Oracle Exastack Optimized applications toward advancement to Platinum or Diamond level in the OPN Specialized program. Oracle Exastack Labs and ISV Enablement: Dedicated Oracle Exastack lab environments and related technical enablement resources (including Guided Learning Paths and Boot Camps) will be available through OPN for OPN members to further their knowledge of Oracle Exastack offerings, and qualify their applications for Oracle Exastack Optimized or Oracle Exastack Ready. Oracle Exastack labs will be available to qualifying OPN members at the Gold level or above. Partners are eligible to participate in the Oracle Exastack Ready program immediately, which will help them meet the requirements to attain Oracle Exastack Optimized status in the future. Guidelines for Oracle Exastack Optimized, as well as Oracle Exastack Labs will be available in fall 2011. Supporting Quotes "In order to effectively differentiate their software applications in the marketplace, ISVs need to rapidly deliver new capabilities and performance improvements," said Judson Althoff, Oracle senior vice president of Worldwide Alliances and Channels and Embedded Sales. "With Oracle Exastack, ISVs have the ability to optimize and deploy their applications with a complete, integrated and cloud-ready infrastructure that will help them accelerate innovation, unlock new features and functionality, and deliver superior value to customers." "We view performance as absolutely critical and a key differentiator," said Tom Stock, SVP of Product Management, GoldenSource. "As a leading provider of enterprise data management solutions for securities and investment management firms, with Oracle Exadata Database Machine, we see an opportunity to notably improve data processing performance -- providing high quality 'golden copy' data in a reduced timeframe. Achieving Oracle Exastack Optimized status will be a stamp of approval that our solution will provide the performance and scalability that our customers demand." "As a leading provider of Revenue Intelligence solutions for telecommunications, media and entertainment service providers, our customers continually demand more readily accessible, enriched and pre-analyzed information to minimize their financial risks and maximize their margins," said Alon Aginsky, President and CEO of cVidya Networks. "Oracle Exastack enables our solutions to deliver the power, infrastructure, and innovation required to transform our customers' business operations and stay ahead of the game." Supporting Resources Oracle PartnerNetwork (OPN) Oracle Exastack Oracle Exastack Datasheet Judson Althoff blog Connect with the Oracle Partner community at OPN on Facebook, OPN on LinkedIn, OPN on YouTube, or OPN on Twitter

    Read the article

  • Resources on learning to program in machine code?

    - by AceofSpades
    I'm a student, fresh into programming and loving it, from Java to C++ and down to C. I moved backwards to the barebones and thought to go further down to Assembly. But, to my surprise, a lot of people said it's not as fast as C and there is no use. They suggested learning either how to program a kernel or writing a C compiler. My dream is to learn to program in binary (machine code) or maybe program bare metal (program micro-controller physically) or write bios or boot loaders or something of that nature. The only possible thing I heard after so much research is that a hex editor is the closest thing to machine language I could find in this age and era. Are there other things I'm unaware of? Are there any resources to learn to program in machine code? Preferably on a 8-bit micro-controller/microprocessor. This question is similar to mine, but I'm interested in practical learning first and then understanding the theory.

    Read the article

  • [Word2007] How to showing "only number" in picture cross-reference

    - by kornelijepetak
    I have many pictures in a document and I reference them very often in text. I don't want to lose the order so I am using Insert - Cross-reference. This opens the cross-reference dialog where I can set Reference type to Picture. For "Insert reference to", there are 5 choices: - Entire caption - List item - Only label and number - Only caption text - Page number, Above/below What I need is a reference that would be inserted like this: [4], and not like this: [Picture 4]; None of these options enable me to do it. Is there any way to make Word 2007 insert a reference to only Caption Number? Note: The document is written in Croatian language which has 7 declension cases, so using "Picture 4" would not be valid in all cases. Actually caption label Picture is set to croatian word "Slika" and when I need to say say "in the picture" I can't because it would be "na Slici 5." and not "na Slika 5." (like Word would make me do). That's why I need to reference only the caption number. Is that possible in Word 2007?

    Read the article

  • How to get javascript object references or reference count?

    - by Tauren
    How to get reference count for an object Is it possible to determine if a javascript object has multiple references to it? Or if it has references besides the one I'm accessing it with? Or even just to get the reference count itself? Can I find this information from javascript itself, or will I need to keep track of my own reference counters. Obviously, there must be at least one reference to it for my code access the object. But what I want to know is if there are any other references to it, or if my code is the only place it is accessed. I'd like to be able to delete the object if nothing else is referencing it. If you know the answer, there is no need to read the rest of this question. Below is just an example to make things more clear. Use Case In my application, I have a Repository object instance called contacts that contains an array of ALL my contacts. There are also multiple Collection object instances, such as friends collection and a coworkers collection. Each collection contains an array with a different set of items from the contacts Repository. Sample Code To make this concept more concrete, consider the code below. Each instance of the Repository object contains a list of all items of a particular type. You might have a repository of Contacts and a separate repository of Events. To keep it simple, you can just get, add, and remove items, and add many via the constructor. var Repository = function(items) { this.items = items || []; } Repository.prototype.get = function(id) { for (var i=0,len=this.items.length; i<len; i++) { if (items[i].id === id) { return this.items[i]; } } } Repository.prototype.add = function(item) { if (toString.call(item) === "[object Array]") { this.items.concat(item); } else { this.items.push(item); } } Repository.prototype.remove = function(id) { for (var i=0,len=this.items.length; i<len; i++) { if (items[i].id === id) { this.removeIndex(i); } } } Repository.prototype.removeIndex = function(index) { if (items[index]) { if (/* items[i] has more than 1 reference to it */) { // Only remove item from repository if nothing else references it this.items.splice(index,1); return; } } } Note the line in remove with the comment. I only want to remove the item from my master repository of objects if no other objects have a reference to the item. Here's Collection: var Collection = function(repo,items) { this.repo = repo; this.items = items || []; } Collection.prototype.remove = function(id) { for (var i=0,len=this.items.length; i<len; i++) { if (items[i].id === id) { // Remove object from this collection this.items.splice(i,1); // Tell repo to remove it (only if no other references to it) repo.removeIndxe(i); return; } } } And then this code uses Repository and Collection: var contactRepo = new Repository([ {id: 1, name: "Joe"}, {id: 2, name: "Jane"}, {id: 3, name: "Tom"}, {id: 4, name: "Jack"}, {id: 5, name: "Sue"} ]); var friends = new Collection( contactRepo, [ contactRepo.get(2), contactRepo.get(4) ] ); var coworkers = new Collection( contactRepo, [ contactRepo.get(1), contactRepo.get(2), contactRepo.get(5) ] ); contactRepo.items; // contains item ids 1, 2, 3, 4, 5 friends.items; // contains item ids 2, 4 coworkers.items; // contains item ids 1, 2, 5 coworkers.remove(2); contactRepo.items; // contains item ids 1, 2, 3, 4, 5 friends.items; // contains item ids 2, 4 coworkers.items; // contains item ids 1, 5 friends.remove(4); contactRepo.items; // contains item ids 1, 2, 3, 5 friends.items; // contains item ids 2 coworkers.items; // contains item ids 1, 5 Notice how coworkers.remove(2) didn't remove id 2 from contactRepo? This is because it was still referenced from friends.items. However, friends.remove(4) causes id 4 to be removed from contactRepo, because no other collection is referring to it. Summary The above is what I want to do. I'm sure there are ways I can do this by keeping track of my own reference counters and such. But if there is a way to do it using javascript's built-in reference management, I'd like to hear about how to use it.

    Read the article

  • Changing the namespace for a Web Reference in a Project to be Made Into a VS Project Template

    - by kdmurray
    When I add a web reference to a project, it comes up with a default namespace of: com.wpdevs.myservice. This is the namespace I'd have expected it to use in the application. When I add the using statement to the project, I have to add: using MyProject.com.wpdevs.myservice; I'd like to find a way to eliminate having to reference the project name in the using statement. The project I'm putting together now is destined to be converted into a VS Project template and having that rather strange reference in there, or even having a per-project reference, isn't something I'd like to have in the project.

    Read the article

  • Are there any Python reference counting/garbage collection gotchas when dealing with C code?

    - by Jason Baker
    Just for the sheer heck of it, I've decided to create a Scheme binding to libpython so you can embed Python in Scheme programs. I'm already able to call into Python's C API, but I haven't really thought about memory management. The way mzscheme's FFI works is that I can call a function, and if that function returns a pointer to a PyObject, then I can have it automatically increment the reference count. Then, I can register a finalizer that will decrement the reference count when the Scheme object gets garbage collected. I've looked at the documentation for reference counting, and don't see any problems with this at first glance (although it may be sub-optimal in some cases). Are there any gotchas I'm missing? Also, I'm having trouble making heads or tails of the cyclic garbage collector documentation. What things will I need to bear in mind here? In particular, how do I make Python aware that I have a reference to something so it doesn't collect it while I'm still using it?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >