Search Results

Search found 30246 results on 1210 pages for 'object persistence'.

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

  • wanna store Object in MySQL database

    - by kandarp
    I have a variable in java which return type is Object(java.lang.Object). I want to store this variable value in MySQL database without casting in any other primitive data type. Is there any data type available in MySQL related to Object? If anybody knows, please reply at your earliest time. Thanks,

    Read the article

  • What question(s) does an object's behavior answer?

    - by Corwin
    Reading a book I have found the following statement: (Object) Behaviors answer either of two questions: What does this object do (for me)? or What can I do to this object? In the case of an orange, it doesn’t do a whole lot, but we can do things to it. One behavior is that it can be eaten. In my understanding of object behaviour the statement above is correct regarding the first question and is incorrect in case of the second. However, I often see classes with methods like Orange::eat(), and this makes me uncertain about my design skills. So I would like to ask is it a design mistake to give oranges a behaviour eat? (oranges and eat are used just for example)

    Read the article

  • Looking for early paper about compiling object-oriented code

    - by Robert Kosara
    I remember reading a paper a long time ago that talked about object-oriented programming. I believe that this was from the early 1980s or perhaps even before then. This was at the time when object-oriented programming was still done through pre-processors, and one thing that stuck with me is this: it argued that you could write code in either procedural or object-oriented fashion, and after preprocessing/compiling, you would end up with the exact same machine code. Does anybody know which paper I'm talking about?

    Read the article

  • Creating/populating Javascript custom object

    - by Ek0nomik
    I've created an ashx page which is going to serve me an XML document full of basic user information. I'm not sure which is the best way to go about creating and populating my custom javascript object. I've seen them created in two ways: function User() { this.Id; this.FirstName; this.LastName; this.Title; } and var User2 = { Id: null, FirstName: null, LastName: null, Title: null } I could populate each of these by doing something like: //first object User.Id = 1 //second object User2.FirstName = 'John' Is one method of creating the object better than the other?

    Read the article

  • problem in getting value of the object attribute in flex

    - by madanmohan
    i have an xml which contains 'interface' sub tag, iam converting xml to object using SampleXmlDecoder. compiler did not allow me to access the value of the 'inteface' attrible of the resultobject. var xml:XML = event.result as XML; var xmlDoc : XMLDocument = new XMLDocument(xml.toString()); var decoder : SimpleXMLDecoder = new SimpleXMLDecoder(true) var resultObj : Object = decoder.decodeXML(xmlDoc); var o:Object = new Object(); o.someprop = resultObj.maintag.item.interface; its treating interface as keyword. can anyone tell me the solution for this. Thanks in advance

    Read the article

  • From Java Object class to C++

    - by Rui
    Hi, I'm relative new to C++ and my background is in Java. I have to port some code from Java to C++ and some doubts came up relative to the Object Java's class. So, if I want to port this: void Algorithm::setInputParameter(std::string name, Object object) { ..... } I believe I should use void* type or templates right? I don't know what's the "standard" procedure to accomplish it. Thanks

    Read the article

  • C#. Binding object to object

    - by w1z
    Hello all, I develop the part of app functionality. I have the databinding object 'A' and another object 'B'. public class SomeProxy { public SomeProxy(BindingSource A) { var b = new B(); } } public class B { public int SomePropertyFromA{get;set;} //Some autocalculated propeties, that are based on SomePropertyFromA //I want to reculculate them, when the SomePropertyFromA will be changed } 'B' object culculates some values, based on the property 'a' of the 'A' object. I want to bind property in object 'B' to the same property 'a' in 'A'. It's need to handle on changes of the 'a' property, because some UI controls are binded to 'B'-s properties. How can I do this? Sorry for some oddness. Thanks

    Read the article

  • Does string inherits from Object in Javascript?

    - by Morgan Cheng
    Is Object the base class of all objects in Javascript, just like other language such as Java & C#? I tried below code in Firefox with Firebug installed. var t = new Object(); var s1 = new String('str'); var s2 = 'str'; console.log(typeof t); console.log(typeof s1); console.log(typeof s2); The console output is object object string So, s1 and s2 are of diffeent type?

    Read the article

  • Removing object/array difference from different arrays [duplicate]

    - by Kay Singian
    This question already has an answer here: remove objects from array by object property 3 answers I have two JavaScript objects: object_1 = [ {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' }, {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' }, {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' }, {'value': '10:30', 'text':'10:30 am', 'eventtime':'10:30:00' }, {'value': '11:00', 'text':'11:00 am', 'eventtime':'11:00:00' }, {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' }, ]; object_2 = [ {'eventtime': '10:30:00'}, {'eventtime': '11:00:00'} ]; I want to remove the object in object_1 which has the same eventtime value and store it in a new array/object . Please help me do so, I cant find a solution to this. This will be the new array/object: object_new = [ {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' }, {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' }, {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' }, {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' }, ];

    Read the article

  • Sample domain model for online store

    - by Carel
    We are a group of 4 software development students currently studying at the Cape Peninsula University of Technology. Currently, we are tasked with developing a web application that functions as a online store. We decided to do the back-end in Java while making use of Google Guice for persistence(which is mostly irrelevant for my question). The general idea so far to use PHP to create the website. We decided that we would like to try, after handing in the project, and register a business to actually implement the website. The problem we have been experiencing is with the domain model. These are mostly small issues, however they are starting to impact the schedule of our project. Since we are all young IT students, we have virtually no experience in the business world. As such, we spend quite a significant amount of time planning the domain model in the first place. Now, some of the issues we're picking up is say the reference between the Customer entity and the order entity. Currently, we don't have the customer id in the order entity and we have a list of order entities in the customer entity. Lately, I have wondered if the persistence mechanism will put the client id physically in the order table, even if it's not in the entity? So, I started wondering, if you load a customer object, it will search the entire order table for orders with the customer's id. Now, say you have 10 000 customers and 500 000 orders, won't this take an extremely long time? There are also some business processes that I'm not completely clear on. Finally, my question is: does anyone know of a sample domain model out there that is similar to what we're trying to achieve that will be safe to look at as a reference? I don't want to be accused of stealing anybody's intellectual property, especially since we might implement this as a business.

    Read the article

  • Who are the outspoken critics of Object-Oriented design?

    - by Xepoch
    Sure, object-oriented techniques are great and have stuck around for a while. I know only less than a handful of critics of the OO principles. It seems as though most non-OO designs and architectures are shunned, yet we continue to write a lot of good software in C and solve a lot of data changes via awk/sed and countless other examples. Correct tool for the correct job, yes? I'm having a hard time finding articles, presentations, or published criticisms of OO (even Fred Brooks has blessed information hiding). Are there any well-known, published and/or outspoken critics of OO?

    Read the article

  • What would you do if your client required you not to use object-oriented programming?

    - by gunbuster363
    Would you try to persuade your client that using object-oriented programming is much cleaner? Or would you try to follow what he required and give him crappy code? Now I am writing a program to simulate the activity of ants in a grid. The ant can move around, pick up things and drop things. The problem is while the action of the ants and the positions of each ant can be tracked by class attributes easily (and we can easily create many instances of such ants) my client said that since he has a background in functional programming he would like the simulation to be made using functional programming. What would you do?

    Read the article

  • Which programming language to go for in order to learn Object Oriented Programming? [closed]

    - by Maxood
    If someone has a good grasp in logic and procedural programming then which language to start with for learning OOP. Also why C++ is mostly taught at schools whereas Java is a pure Object Oriented language(also language for making android apps)? Why not Objective C is being taught for making apps on the iPhone? I am seeking for the right answer keeping in view of these 2 factors: Background of the learner in procedural programming Economic or job market market demand of programming languages Here is a list of 10 programming languages, i would like to seek justifications for: Java C++ Objective C Scala C# PHP Python Java Javascript (not sure if it is a fully featured OOP language) 10.Ruby (not sure if it is a fully featured OOP language)

    Read the article

  • Patterns for a tree of persistent data with multiple storage options?

    - by Robin Winslow
    I have a real-world problem which I'll try to abstract into an illustrative example. So imagine I have data objects in a tree, where parent objects can access children, and children can access parents: // Interfaces interface IParent<TChild> { List<TChild> Children; } interface IChild<TParent> { TParent Parent; } // Classes class Top : IParent<Middle> {} class Middle : IParent<Bottom>, IChild<Top> {} class Bottom : IChild<Middle> {} // Usage var top = new Top(); var middles = top.Children; // List<Middle> foreach (var middle in middles) { var bottoms = middle.Children; // List<Bottom> foreach (var bottom in bottoms) { var middle = bottom.Parent; // Access the parent var top = middle.Parent; // Access the grandparent } } All three data objects have properties that are persisted in two data stores (e.g. a database and a web service), and they need to reflect and synchronise with the stores. Some objects only request from the web service, some only write to it. Data Mapper My favourite pattern for data access is Data Mapper, because it completely separates the data objects themselves from the communication with the data store: class TopMapper { public Top FetchById(int id) { var top = new Top(DataStore.TopDataById(id)); top.Children = MiddleMapper.FetchForTop(Top); return Top; } } class MiddleMapper { public Middle FetchById(int id) { var middle = new Middle(DataStore.MiddleDataById(id)); middle.Parent = TopMapper.FetchForMiddle(middle); middle.Children = BottomMapper.FetchForMiddle(bottom); return middle; } } This way I can have one mapper per data store, and build the object from the mapper I want, and then save it back using the mapper I want. There is a circular reference here, but I guess that's not a problem because most languages can just store memory references to the objects, so there won't actually be infinite data. The problem with this is that every time I want to construct a new Top, Middle or Bottom, it needs to build the entire object tree within that object's Parent or Children property, with all the data store requests and memory usage that that entails. And in real life my tree is much bigger than the one represented here, so that's a problem. Requests in the object In this the objects request their Parents and Children themselves: class Middle { private List<Bottom> _children = null; // cache public List<Bottom> Children { get { _children = _children ?? BottomMapper.FetchForMiddle(this); return _children; } set { BottomMapper.UpdateForMiddle(this, value); _children = value; } } } I think this is an example of the repository pattern. Is that correct? This solution seems neat - the data only gets requested from the data store when you need it, and thereafter it's stored in the object if you want to request it again, avoiding a further request. However, I have two different data sources. There's a database, but there's also a web service, and I need to be able to create an object from the web service and save it back to the database and then request it again from the database and update the web service. This also makes me uneasy because the data objects themselves are no longer ignorant of the data source. We've introduced a new dependency, not to mention a circular dependency, making it harder to test. And the objects now mask their communication with the database. Other solutions Are there any other solutions which could take care of the multiple stores problem but also mean that I don't need to build / request all the data every time?

    Read the article

  • Ruby/Rails - Add records to an object with each loop iteration / Object vs Arrays

    - by ChrisWesAllen
    I'm trying to figure out how to add records to an existing object for each iteration of a loop. I'm having a hard time discovering the difference between an object and an array. I have this @events = Event.find(1) @loops = Choices.find(:all, :limit => 5) #so loop for 5 instances of choice model for loop in @loops @events = Event.find(:all,:conditions => ["event.id = ?", loop.event_id ]) end I'm trying to add a new events to the existing @events object based on the id of whatever the loop variable is. But the ( = ) operator just creates a new instance of the @events object. I tried ( += ) and ( << ) as operators but got the error "You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil" I tried created an array events = [] events << Event.find(1) @loops = Choices.find(:all, :limit => 5) #so loop for 5 instances of choice model for loop in @loops events << Event.find(:all,:conditions => ["event.id = ?", loop.event_id ]) end But I dont know how to call that arrays attributes within the view With objects I was able do create a loop within the view and call all the attributes of that object as well... <table> <% for event in @events %> <tr> <td><%= link_to event.title, event %></td> <td><%= event.start_date %></td> <td><%= event.price %></td> </tr> <% end %> </table> How could i do this with an array set? So the questions are 1) Whats the difference between arrays and objects? 2) Is there a way to add into the existing object for each iteration? 3) If I use an array, is there a way to call the attributes for each array record within the view?

    Read the article

  • Can I assume interface oriented programming as a good object oriented programming?

    - by david
    I have been programming for decades but I have not been used to object oriented programming. But for recenet years, I had a great opportunity to learn OOP, its principles, and a lot of patterns that are great. Since I've learned OOP, I tried to apply them to a couple of projects and found those projects successful. Unfortunately I didn't follow extreme programming that suggests writing test first, mainly because their time frame were tight. What I did for those projects were Identify all necessary classes and create them with proper properties and methods whenever there is dependency between classes, write interface between them see if there is any patterns for certain relationships between classes to replace By successful, I meant that it was quick development effort, the classes can be reused better, and flexible enough so that another programmer does not have to change something else to fix another part. But I wonder if this is a good practice. Of course, I know I need to put writing unit tests first in my work process. But other than that, is there any problem with this approach - creating lots of interfaces - in long term?

    Read the article

  • What are some techniques I can use to refactor Object Oriented code into Functional code?

    - by tieTYT
    I've spent about 20-40 hours developing part of a game using JavaScript and HTML5 canvas. When I started I had no idea what I was doing. So it started as a proof of concept and is coming along nicely now, but it has no automated tests. The game is starting to become complex enough that it could benefit from some automated testing, but it seems tough to do because the code depends on mutating global state. I'd like to refactor the whole thing using Underscore.js, a functional programming library for JavaScript. Part of me thinks I should just start from scratch using a Functional Programming style and testing. But, I think refactoring the imperative code into declarative code might be a better learning experience and a safer way to get to my current state of functionality. Problem is, I know what I want my code to look like in the end, but I don't know how to turn my current code into it. I'm hoping some people here could give me some tips a la the Refactoring book and Working Effectively With Legacy Code. For example, as a first step I'm thinking about "banning" global state. Take every function that uses a global variable and pass it in as a parameter instead. Next step may be to "ban" mutation, and to always return a new object. Any advice would be appreciated. I've never taken OO code and refactored it into Functional code before.

    Read the article

  • [Smalltalk] Store List of Instruction

    - by Luciano Lorenti
    Hi all, I have a design Problem. i have a Drawer class wich invokes a serie of methods of a kind-of-brush class and i have a predefined shapes which i want to draw. Each shape uses a list of instance methods from the drawer. I can have more than 1 brush object. I want to add custom shapes on runtime in the drawer instance, especifying the list of methods of the new shape. i've created a class method for every predefined shape that returns a BlockClosure with the instruccions. Obviously i have to give to each BlockClosure the brush object as parameter. I imagine a collection with all the BlockClosures in each instance of the Drawer Class. Maybe i can inherit a SequenceableCollection and make a instruccion collection. Each element of the collection it's a instruction and i give the brush object when i instance this new collection. I really don't know the best way to store these steps. (Maybe a shared variable?)

    Read the article

  • Is it poor design to create objects that only execute code during the constructor?

    - by Curtix
    In my design I am using objects that evaluate a data record. The constructor is called with the data record and type of evaluation as parameters and then the constructor calls all of the object's code necessary to evaluate the record. This includes using the type of evaluation to find additional parameter-like data in a text file. There are in the neighborhood of 250 unique evaluation types that use the same or similar code and unique parameters coming from the text file. Some of these evaluations use different code so I benefit a lot from this model because I can use inheritance and polymorphism. Once the object is created there isn't any need to execute additional code on the object (at least for now) and it is used more like a struct; its kept on a list and 3 properties are used later. I think this design is the easiest to understand, code, and read. A logical alternative I guess would be using functions that return score structs, but you can't inherit from methods so it would make it kind of sloppy imo. I am using vb.net and these classes will be used in an asp.net web app as well as in a distributed app. thanks for your input

    Read the article

  • PHP access data of an object

    - by sea_1987
    I have an object of which I am looking to get a piece of data from, the object looks like this, Product Object ( [name] => Simon Test Cup [code] => 123456789 [category_id] => 3 [range_id] => 26 [price] => 10.00 [price_logo_add] => 0.25 [image_id] => 846 [rank] => [special_offer] => N [cartProps] => Array ( ) [section] => [vatPercentage] => 17.5 [id] => 551 [date_created] => 2010-05-25 12:46:57 [last_updated] => 2010-05-25 14:10:48 [user_id_updated] => 0 [_aliases] => Array ( [id] => 551 [date_created] => 2010-05-25 12:46:57 [date_updated] => 2010-05-25 14:10:48 [user_id_updated] => 0 [name] => Simon Test Cup [code] => 123456789 [category_id] => 3 [range_id] => 26 [price] => 10.00 [price_logo_add] => 0.25 [image_id] => 846 [range_image_id] => 848 [main_image_id] => 847 [rank] => [special_offer] => N ) [_default] => Array ( [special_offer] => N ) [_related] => Array ( [_related] => Array ( [range] => stdClass Object ( [key] => range [group] => _related [foreignKey] => range_id [indexName] => id [tableName] => cc_range [objectName] => Range [userFieldlyColName] => name [criteria] => id='{%range_id%}' [sqlPostfix] => [populateOnLoad] => [objects] => Array ( [26] => Range Object ( [name] => Shot glasses [url_name] => shot-glasses [description] => Personalized shot glasses make great commemorative gifts, souvenirs and wedding favours. Just select your favourite shape and send us a customization form with your logo. See our glassware sale page for info on free logo origination. [leader] => Customized shot glasses make great commemorative gifts, promotional items and wedding favours. Individual gift boxes are available so you can give the glasses away easily. [category_id] => 3 [site_id_csv] => [image_id_main] => 565 [image_id_thumb] => 566 [rank] => [site] => main [id] => 26 [date_created] => 2008-05-18 21:39:52 [last_updated] => 2009-02-03 13:49:10 [user_id_updated] => 0 [_aliases] => Array I am wanting to get the id from the [range] = stdClass Object

    Read the article

  • GAE python database object design for simple list of values

    - by Joey
    I'm really new to database object design so please forgive any weirdness in my question. Basically, I am use Google AppEngine (Python) and contructing an object to track user info. One of these pieces of data is 40 Achievement scores. Do I make a list of ints in the User object for this? Or do I make a separate entity with my user id, the achievement index (0-39) and the score and then do a query to grab these 40 items every time I want to get the user data in total? The latter approach seems more object oriented to me, and certainly better if I extend it to have more than just scores for these 40 achievements. However, considering that I might not extend it, should I even consider just doing a simple list of 40 ints in my user data? I would then forgo doing a query, getting the sorted list of achievements, reading the score from each one just to process a response etc. Is doing this latter approach just such a common practice and hand-waved as not even worth batting an eyelash at in terms of thinking it might be more costly or complex processing wise?

    Read the article

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