Search Results

Search found 38284 results on 1532 pages for 'object reference'.

Page 18/1532 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Avoiding Object Oriented Pitfalls, Migrating from C, What Worked for You?

    - by Stephen
    I've been programming in procedural languages for quite some time now, and my first reaction to a problem is to start breaking it down into tasks to perform rather than to consider the different entities (objects) that exist and their relationships. I have had a university course in OOP, and understand the fundamentals of encapsulation, data abstraction, polymorphism, modularity and inheritance. I read Learning to think in the Object Oriented Way and Learning object oriented thinking, and will be looking at some of the books pointed to in those answers. I think that several of my medium to large sized projects will benefit from effective use of OOP but as a novice I would like to avoid time consuming, common errors. Based on your experiences, what are these pitfalls and what are reasonable ways around them? If you could explain why they are pitfalls, and how your suggestion is effective in addressing the issue it'd be appreciated. I'm thinking along the lines of something like "Is it common to have a fair number of observer and modifier methods and use private variables or are there techniques for consolidating/reducing them?" I'm not worried about using C++ as a pure OO language, if there are good reasons to mix methods. (Reminiscent of the reasons to use GOTOs, albeit sparingly.) Thank you!

    Read the article

  • DB Object passing between classes singleton, static or other?

    - by Stephen
    So I'm designing a reporting system at work it's my first project written OOP and I'm stuck on the design choice for the DB class. Obviously I only want to create one instance of the DB class per-session/user and then pass it to each of the classes that need it. What I don't know it what's best practice for implementing this. Currently I have code like the following:- class db { private $user = 'USER'; private $pass = 'PASS'; private $tables = array( 'user','report', 'etc...'); function __construct(){ //SET UP CONNECTION AND TABLES } }; class report{ function __construct ($params = array(), $db, $user) { //Error checking/handling trimed //$db is the database object we created $this->db = $db; //$this->user is the user object for the logged in user $this->user = $user; $this->reportCreate(); } public function setPermission($permissionId = 1) { //Note the $this->db is this the best practise solution? $this->db->permission->find($permissionId) //Note the $this->user is this the best practise solution? $this->user->checkPermission(1) $data=array(); $this->db->reportpermission->insert($data) } };//end report I've been reading about using static classes and have just come across Singletons (though these appear to be passé already?) so what's current best practice for doing this?

    Read the article

  • redoing object model construction to fit with asynchronous data fetching

    - by Andrew Patterson
    I have a modeled a set of objects that correspond with some real world concepts. TradeDrug, GenericDrug, TradePackage, DrugForm Underlying the simple object model I am trying to provide is a complex medical terminology that uses numeric codes to represent relationships and concepts, all accessible via a REST service - I am trying to hide away some of that complexity with an object wrapper. To give a concrete example I can call TradeDrug d = Searcher.FindTradeDrug("Zoloft") or TradeDrug d = new TradeDrug(34) where 34 might be the code for Zoloft. This will consult a remote server to find out some details about Zoloft. I might then call GenericDrug generic = d.EquivalentGeneric() System.Out.WriteLine(generic.ActiveIngredient().Name) in order to get back the generic drug sertraline as an object (again via a background REST call to the remote server that has all these drug details), and then perhaps find its ingredient. This model works fine and is being used in some applications that involve data processing. Recently however I wanted to do a silverlight application that used and displayed these objects. The silverlight environment only allows asynchronous REST/web service calls. I have no problems with how to make the asychhronous calls - but I am having trouble with what the design should be for my object construction. Currently the constructors for my objects do some REST calls sychronously. public TradeDrug(int code) { form = restclient.FetchForm(code) name = restclient.FetchName(code) etc.. } If I have to use async 'events' or 'actions' in order to use the Silverlight web client (I know silverlight can be forced to be a synchronous client but I am interested in asychronous approaches), does anyone have an guidance or best practice for how to structure my objects. I can pass in an action callback to the constructor public TradeDrug(int code, Action<TradeDrug> constructCompleted) { } but this then allows the user to have a TradeDrug object instance before what I want to construct is actually finished. It also doesn't support an 'event' async pattern because the object doesn't exist to add the event to until it is constructed. Extending that approach might be a factory object that itself has an asynchronous interface to objects factory.GetTradeDrugAsync(code, completedaction) or with a GetTradeDrugCompleted event? Does anyone have any recommendations?

    Read the article

  • Blob object not working properly even though the class is seralized

    - by GustlyWind
    I have class which is seralized and does convert a very large amount of data object to blob to save it to database.In the same class there is decode method to convert blob to the actual object.Following is the code for encode and decode of the object. private byte[] encode(ScheduledReport schedSTDReport) { byte[] bytes = null; try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(schedSTDReport); oos.flush(); oos.close(); bos.close(); //byte [] data = bos.toByteArray(); //ByteArrayOutputStream baos = new ByteArrayOutputStream(); //GZIPOutputStream out = new GZIPOutputStream(baos); //XMLEncoder encoder = new XMLEncoder(out); //encoder.writeObject(schedSTDReport); //encoder.close(); bytes = bos.toByteArray(); //GZIPOutputStream out = new GZIPOutputStream(bos); //out.write(bytes); //bytes = bos.toByteArray(); } catch (Exception e) { _log.error("Exception caught while encoding/zipping Scheduled STDReport", e); } decode(bytes); return bytes; } /* * Decode the report definition blob back to the * ScheduledReport object. */ private ScheduledReport decode(byte[] bytes) { ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ScheduledReport sSTDR = null; try { ObjectInputStream ois = new ObjectInputStream(bais); //GZIPInputStream in = new GZIPInputStream(bais); //XMLDecoder decoder = new XMLDecoder(in); sSTDR = (ScheduledReport)ois.readObject();//decoder.readObject(); //decoder.close(); } catch (Exception e) { _log.error("IOException caught while decoding/unzipping Scheduled STDReport", e); } return sSTDR; } The problem here is whenver I change something else in this class means any other method,a new class version is created and so the new version the class is unable to decode the originally encoded blob object. The object which I am passing for encode is also seralized object but this problem exists. Any ideas thanks

    Read the article

  • Encapsulate update method inside of object or have method which accepts an object to update

    - by Tom
    Hi, I actually have 2 questions related to each other: I have an object (class) called, say MyClass which holds data from my database. Currently I have a list of these objects ( List < MyClass ) that resides in a singleton in a "communal area". I feel it's easier to manage the data this way and I fail to see how passing a class around from object to object is beneficial over a singleton (I would be happy if someone can tell me why). Anyway, the data may change in the database from outside my program and so I have to update the data every so often. To update the list of the MyClass I have a method called say, Update, written in another class which accepts a list of MyClass. This updates all the instances of MyClass in the list. However would it be better instead to encapulate the Update() method inside the MyClass object, so instead I would say foreach(MyClass obj in MyClassList) { obj.update(); } What is a better implementation and why? The update method requires a XML reader. I have written an XML reader class which is basically a wrapper over the standard XML reader the language natively provides which provides application specific data collection. Should the XML reader class be in anyway in the "inheritance path" of the MyClass object - the MyClass objects inherits from the XML reader because it uses a few methods. I can't see why it should. I don't like the idea of declaring an instance of the XML Reader class inside of MyClass and an MyClass object is meant to be a simple "record" from the database and I feel giving it loads of methods, other object instances is a bit messy. Perhaps my XML reader class should be static but C#'s native XMLReader isn't static.? Any comments would be greatly appreciated Thanks Thomas

    Read the article

  • ASP.NET 2.0: Specifying an instance of an object for an ObjectDataSource

    - by Austin Salonen
    I'm using an ObjectDataSource to bind data to a GridView; it works fine except that it always creates a new object to use as a data source. I can do all the setup just fine but I cannot use an instance of an existing object to specify as the "data source" for it. Is it possible to do this? If so, how? If it's not possible, why? EDIT: Here's the gist of what's going on (object types changed): On the first page you are editting the attributes for a dog. One of the attributes is "has puppies" and if it's true, the next page you specify the names of those puppies. What's happening in my case is that those puppies are not getting linked to the original dog but to a "new" dog. (The implication that my problem is a "female dog" was coincidental. ;-) )

    Read the article

  • object won't die (still references to it that I can't find)

    - by user288558
    I'm using parallel-python and start a new job server in a function. after the functions ends it still exists even though I didn't return it out of the function (I used weakref to test this). I guess there's still some references to this object somewhere. My two theories: It starts threads and it logs to root logger. My questions: can I somehow findout in which namespace there is still a reference to this object. I have the weakref reference. Does anyone know how to detach a logger? What other debug suggestions do people have? here is my testcode: def pptester(): js=pp.Server(ppservers=nodes) js.set_ncpus(0) fh=file('tmp.tmp.tmp','w') tmp=[] for i in range(200): tmp.append(js.submit(ppworktest,(),(),('os','subprocess'))) js.print_stats() return weakref.ref(js) thanks in advance Wolfgang

    Read the article

  • javascript "this" points to Window object again

    - by terrani
    Hello, I asked a question on http://stackoverflow.com/questions/2719643/javascript-this-points-to-window-object regarding "this" points to Window object. here is source code var archive = function(){} archive.prototype.action = { test: function(callback){ callback(); }, test2: function(){ console.log(this); } } var oArchive = new archive(); oArchive.action.test(oArchive.action.test2); Tim Down wrote "but that function is then called using callback(), which means it is not called as a method and hence this is the global object". What are differences between calling a function by its actual name and callback() as shown on the source code? How does console.log(this) in test2 points to Window when it is inside archive.action???

    Read the article

  • C# how to calculate hashcode from an object reference.

    - by Wayne
    Folks, here's a thorny problem for you! A part of the TickZoom system must collect instances of every type of object into a Dictionary< type. It is imperative that their equality and hash code be based on the instance of the object which means reference equality instead of value equality. The challenge is that some of the objects in the system have overridden Equals() and GetHashCode() for use as value equality and their internal values will change over time. That means that their Equals and GetHashCode are useless. How to solve this generically rather than intrusively? So far, We created a struct to wrap each object called ObjectHandle for hashing into the Dictionary. As you see below we implemented Equals() but the problem of how to calculate a hash code remains. public struct ObjectHandle : IEquatable<ObjectHandle>{ public object Object; public bool Equals(ObjectHandle other) { return object.ReferenceEquals(this.Object,other.Object); } } See? There is the method object.ReferenceEquals() which will compare reference equality without regard for any overridden Equals() implementation in the object. Now, how to calculate a matching GetHashCode() by only considering the reference without concern for any overridden GetHashCode() method? Ahh, I hope this give you an interesting puzzle. We're stuck over here. Sincerely, Wayne

    Read the article

  • how to avoid temporaries when copying weakly typed object

    - by Truncheon
    Hi. I'm writing a series classes that inherit from a base class using virtual. They are INT, FLOAT and STRING objects that I want to use in a scripting language. I'm trying to implement weak typing, but I don't want STRING objects to return copies of themselves when used in the following way (instead I would prefer to have a reference returned which can be used in copying): a = "hello "; b = "world"; c = a + b; I have written the following code as a mock example: #include <iostream> #include <string> #include <cstdio> #include <cstdlib> std::string dummy("<int object cannot return string reference>"); struct BaseImpl { virtual bool is_string() = 0; virtual int get_int() = 0; virtual std::string get_string_copy() = 0; virtual std::string const& get_string_ref() = 0; }; struct INT : BaseImpl { int value; INT(int i = 0) : value(i) { std::cout << "constructor called\n"; } INT(BaseImpl& that) : value(that.get_int()) { std::cout << "copy constructor called\n"; } bool is_string() { return false; } int get_int() { return value; } std::string get_string_copy() { char buf[33]; sprintf(buf, "%i", value); return buf; } std::string const& get_string_ref() { return dummy; } }; struct STRING : BaseImpl { std::string value; STRING(std::string s = "") : value(s) { std::cout << "constructor called\n"; } STRING(BaseImpl& that) { if (that.is_string()) value = that.get_string_ref(); else value = that.get_string_copy(); std::cout << "copy constructor called\n"; } bool is_string() { return true; } int get_int() { return atoi(value.c_str()); } std::string get_string_copy() { return value; } std::string const& get_string_ref() { return value; } }; struct Base { BaseImpl* impl; Base(BaseImpl* p = 0) : impl(p) {} ~Base() { delete impl; } }; int main() { Base b1(new INT(1)); Base b2(new STRING("Hello world")); Base b3(new INT(*b1.impl)); Base b4(new STRING(*b2.impl)); std::cout << "\n"; std::cout << b1.impl->get_int() << "\n"; std::cout << b2.impl->get_int() << "\n"; std::cout << b3.impl->get_int() << "\n"; std::cout << b4.impl->get_int() << "\n"; std::cout << "\n"; std::cout << b1.impl->get_string_ref() << "\n"; std::cout << b2.impl->get_string_ref() << "\n"; std::cout << b3.impl->get_string_ref() << "\n"; std::cout << b4.impl->get_string_ref() << "\n"; std::cout << "\n"; std::cout << b1.impl->get_string_copy() << "\n"; std::cout << b2.impl->get_string_copy() << "\n"; std::cout << b3.impl->get_string_copy() << "\n"; std::cout << b4.impl->get_string_copy() << "\n"; return 0; } It was necessary to add an if check in the STRING class to determine whether its safe to request a reference instead of a copy: Script code: a = "test"; b = a; c = 1; d = "" + c; /* not safe to request reference by standard */ C++ code: STRING(BaseImpl& that) { if (that.is_string()) value = that.get_string_ref(); else value = that.get_string_copy(); std::cout << "copy constructor called\n"; } If was hoping there's a way of moving that if check into compile time, rather than run time.

    Read the article

  • Bitmap manipulation as a referenced object

    - by John Maloney
    I am working with a Bitmap object that I add annotations or copyright material to the image and then return the modified bitmap. My problem is that the Bitmap won't hold the changes made to it as it moves along the chain. I am treating it as a reference type and would assume that as it gets passed to each class it would carry the changes made to it. I have verified that the code inside of the MarkImage() classes does function, but which ever one gets called last is the one that has changes. Public Shared Function GetImage(ByVal imageDef As IImageDefinition) As Bitmap Dim image As Bitmap = Drawing.Image.FromFile(imageDef.Path) If Not imageDef.Authorization.IsAllowed(AuthKeys.CanViewWithoutCopyright) Then image = New MarkCopyrightImage(image).MarkImage() End If If Not imageDef.Authorization.IsAllowed(AuthKeys.CanViewWithoutAnnotations) Then image = New MarkAnnotateImage(image).MarkImage() End If Return image End Function How do I write changes to a bitmap object and then pass that object to another class while maintaining the changes? Answers in C# or VB are fine? Thanks

    Read the article

  • wxWidgets in Code::Blocks

    - by Vlad
    Hello all, I'm trying to compile the minimal sample from the "Cross-Platform GUI Programming with wxWidgets" book but the following compile errors: ||=== minimal, Debug ===| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_frame.o):frame.cpp:(.text+0x918)||undefined reference to `__Unwind_Resume' | C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_frame.o):frame.cpp:(.text+0x931)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_frame.o):frame.cpp:(.text+0xa96)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_frame.o):frame.cpp:(.text+0xada)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_frame.o):frame.cpp:(.text+0xb1e)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_frame.o):frame.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_datacmn.o):datacmn.cpp:(.eh_frame+0x11)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x63a)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x696)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x6f2)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x74a)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.text+0x7a2)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdicmn.o):gdicmn.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menu.o):menu.cpp:(.text+0x88f)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menu.o):menu.cpp:(.text+0x927)||undefined reference to `__Unwind_Resume' | C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menu.o):menu.cpp:(.text+0x9bf)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menu.o):menu.cpp:(.text+0xb8b)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menu.o):menu.cpp:(.text+0xc87)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menu.o):menu.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menucmn.o):menucmn.cpp:(.text+0xbc0)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menucmn.o):menucmn.cpp:(.text+0xc59)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menucmn.o):menucmn.cpp:(.text+0xcf5)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menucmn.o):menucmn.cpp:(.text+0xda6)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menucmn.o):menucmn.cpp:(.text+0xdce)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_menucmn.o):menucmn.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_icon.o):icon.cpp:(.text+0x1ff)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_icon.o):icon.cpp:(.text+0x257)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_icon.o):icon.cpp:(.text+0x2af)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_icon.o):icon.cpp:(.text+0x2fc)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_icon.o):icon.cpp:(.text+0x36d)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_icon.o):icon.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdiimage.o):gdiimage.cpp:(.text+0x4a8)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdiimage.o):gdiimage.cpp:(.text+0x73a)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdiimage.o):gdiimage.cpp:(.text+0x813)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdiimage.o):gdiimage.cpp:(.text+0xc06)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdiimage.o):gdiimage.cpp:(.text+0xd3e)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_gdiimage.o):gdiimage.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_event.o):event.cpp:(.text+0x970)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_event.o):event.cpp:(.text+0xa80)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_event.o):event.cpp:(.text+0xb8c)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_event.o):event.cpp:(.text+0xc78)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_event.o):event.cpp:(.text+0xd4f)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_event.o):event.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_appcmn.o):appcmn.cpp:(.text+0x2ef)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_appcmn.o):appcmn.cpp:(.text+0x32b)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_appcmn.o):appcmn.cpp:(.text+0x43d)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_appcmn.o):appcmn.cpp:(.text+0x586)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_appcmn.o):appcmn.cpp:(.text+0x601)||undefined reference to `__Unwind_Resume'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_appcmn.o):appcmn.cpp:(.eh_frame+0x12)||undefined reference to `___gxx_personality_v0'| C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u_core.a(corelib_app.o):app.cpp:(.text+0x1da)||undefined reference to `__Unwind_Resume'| ||More errors follow but not being shown.| ||Edit the max errors limit in compiler options...| ||=== Build finished: 50 errors, 0 warnings ===| Here's the code sample from the book: #include "wx/wx.h" #include "mondrian.xpm" // Declare the application class class MyApp : public wxApp { public: // Called on application startup virtual bool OnInit(); }; // Declare our main frame class class MyFrame : public wxFrame { public: // Constructor MyFrame(const wxString& title); // Event handlers void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); private: // This class handles events DECLARE_EVENT_TABLE() }; // Implements MyApp& GetApp() DECLARE_APP(MyApp) // Give wxWidgets the means to create a MyApp object IMPLEMENT_APP(MyApp) // Initialize the application bool MyApp::OnInit() { // Create the main application window MyFrame *frame = new MyFrame(wxT("Minimal wxWidgets App")); // Show it frame->Show(true); // Start the event loop return true; } // Event table for MyFrame BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) EVT_MENU(wxID_EXIT, MyFrame::OnQuit) END_EVENT_TABLE() void MyFrame::OnAbout(wxCommandEvent& event) { wxString msg; msg.Printf(wxT("Hello and welcome to %s"), wxVERSION_STRING); wxMessageBox(msg, wxT("About Minimal"), wxOK | wxICON_INFORMATION, this); } void MyFrame::OnQuit(wxCommandEvent& event) { // Destroy the frame Close(); } MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) { // Set the frame icon SetIcon(wxIcon(mondrian_xpm)); // Create a menu bar wxMenu *fileMenu = new wxMenu; // The “About” item should be in the help menu wxMenu *helpMenu = new wxMenu; helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"), wxT("Show about dialog")); fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Quit this program")); // Now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(helpMenu, wxT("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); // Create a status bar just for fun CreateStatusBar(2); SetStatusText(wxT("Welcome to wxWidgets!")); } So what's happenning? Thanks! P.S.: I installed wxWidgets through wxPack wich afaik comes with everything precomplied and i also added the wxWidgets directory to Global variables-base in Code::Blocks so everything should be correctly set, right?

    Read the article

  • Using Zope object unique id ( _p_oid ) to access object itself

    - by Alex M
    Every Zope object has it's own unique id ( _p_oid ). To convert it into integer value: from Shared.DC.xml.ppml import u64 as decodeObjectId oid = decodeObjectId(getattr(<Object instance>, '_p_oid')) Is it possible to get object itself having it's _p_oid? I tried this: from ZODB.utils import p64 object = <RootObject instance>._p_jar[p64(oid)] But it seems it's a wrong way

    Read the article

  • BizTalk Cross Reference Data Management Strategy

    - by charlie.mott
    Article Source: http://geekswithblogs.net/charliemott This article describes an approach to the management of cross reference data for BizTalk.  Some articles about the BizTalk Cross Referencing features can be found here: http://home.comcast.net/~sdwoodgate/xrefseed.zip http://geekswithblogs.net/michaelstephenson/archive/2006/12/24/101995.aspx http://geekswithblogs.net/charliemott/archive/2009/04/20/value-vs.id-cross-referencing-in-biztalk.aspx Options Current options to managing this data include: Maintaining xml files in the format that can be used by the out-of-the-box BTSXRefImport.exe utility. Use of user interfaces that have been developed to manage this data: BizTalk Cross Referencing Tool XRef XML Creation Tool However, there are the following issues with the above options: The 'BizTalk Cross Referencing Tool' requires a separate database to manage.  The 'XRef XML Creation' tool has no means of persisting the data settings. The 'BizTalk Cross Referencing tool' generates integers in the common id field. I prefer to use a string (e.g. acme.country.uk). This is more readable. (see naming conventions below). Both UI tools continue to use BTSXRefImport.exe.  This utility replaces all xref data. This can be a problem in continuous integration environments that support multiple clients or BizTalk target instances.  If you upload the data for one client it would destroy the data for another client.  Yet in TFS where builds run concurrently, this would break unit tests. Alternative Approach In response to these issues, I instead use simple SQL scripts to directly populate the BizTalkMgmtDb xref tables combined with a data namepacing strategy to isolate client data. Naming Conventions All data keys use namespace prefixing.  The pattern will be <companyName>.<data Type>.  The naming conventions will be to use lower casing for all items.  The data must follow this pattern to isolate it from other company cross-reference data.  The table below shows some sample data. (Note: this data uses the 'ID' cross-reference tables.  the same principles apply for the 'value' cross-referencing tables). Table.Field Description Sample Data xref_AppType.appType Application Types acme.erp acme.portal acme.assetmanagement xref_AppInstance.appInstance Application Instances (each will have a corresponding application type). acme.dynamics.ax acme.dynamics.crm acme.sharepoint acme.maximo xref_IDXRef.idXRef Holds the cross reference data types. acme.taxcode acme.country xref_IDXRefData.CommonID Holds each cross reference type value used by the canonical schemas. acme.vatcode.exmpt acme.vatcode.std acme.country.usa acme.country.uk xref_IDXRefData.AppID This holds the value for each application instance and each xref type. GBP USD SQL Scripts The data to be stored in the BizTalkMgmtDb xref tables will be managed by SQL scripts stored in a database project in the visual studio solution. File(s) Description Build.cmd A sqlcmd script to deploy data by running the SQL scripts below.  (This can be run as part of the MSBuild process).   acme.purgexref.sql SQL script to clear acme.* data from the xref tables.  As such, this will not impact data for any other company. acme.applicationInstances.sql   SQL script to insert application type and application instance data.   acme.vatcode.sql acme.country.sql etc ...  There will be a separate SQL script to insert each cross-reference data type and application specific values for these types.

    Read the article

  • Open Source .Net Object Database or Document Database for use in Hosted environment

    - by runxc1 Bret Ferrier
    I am looking at creating a web site and I want to try and learn either a Object Database or a Document Database. I am going to be using a hosting provider so I won't be able to install any software. I am unable to purchase any licensing so I need to be able use either a free or open source Object/Document Database. Are there any free Object/Document Databases that don't require installation of some sort?

    Read the article

  • best way to reference business objects from presentation layer..?

    - by Vytas999
    I want to develop an enterprise app that includes a WindowsForms presentation layer, middle-tier components for business logic and data access, and a MsSQL Server database. Middle-tier components should contain some business objects and will be called from presentation layer using .NET Remoting. Whitch is the best way (and why) to reference these business objects from presentation layer? a) Create class library project, implementing business objects. Reference this project from presentation layer and middle-tier layer. b) Create interface library project defining business objects. Create class library project implementing interfaces. Reference class library project from middle-tier layer. Reference interface library project from presentation layer. c) Create separate class library projects for middle-tier and presentation layer. Reference corresponding project from presentation layer.

    Read the article

  • Passing object from PHP to Mysql Stored procedure

    - by user268982
    Hi All, Scenario :- I have to call MYSQL stored procedure from PHP and do some operations ( around 15 commands ) on the database Problem :- I have to call stored procedure with 36 parameters. Lot of parameters . I don't think it is a good idea to pass these many individual parameters and even heard passing individul parameters increases network traffic. Looking for :- I created a Data Object at PHP side and is there any way I can create similar kind of Object in MYSQL and pass this object as a parameter and extract the data from the object in MYSQL stored procedure Thanks for your help Regards Kiran

    Read the article

  • PHP, jQuery and Ajax Object Orientation

    - by pastylegs
    I'm a fairly experienced programmer getting my head around PHP and Ajax for the first time, and I'm having a bit of trouble figuring out how to incorperate object oriented PHP into my ajax webapp. I have an admin page (admin.php) that will load and write information (info.xml) from an XML file depending on the users selection of a form on the admin page. I have decided to use an object (ContentManager.php) to manage the loading and writing of the XML file to disk, i.e : class ContentManager{ var $xml_attribute_1 ... function __construct(){ //load the xml file from disk and save its contents into variables $xml_attribute = simplexml_load_file(/path/to/xml) } function get_xml_contents(){ return xml_attribute; } function write_xml($contents_{ } function print_xml(){ } } I create the ContentManager object in admin.php like so <?php include '../includes/CompetitionManager.php'; $cm = new CompetitionManager() ?> <script> ...all my jquery </script> <html> ... all my form elements </html> So now I want to use AJAX to allow the user to retrieve information from the XML file via the ContentManger app using an interface (ajax_handler.php) like so <?php if(_POST[]=="get_a"){ }else if() } ... ?> I understand how this would work if I wasn't using objects, i.e. the hander php file would do a certain action depending on a variable in the .post request, but with my setup, I can't see how I can get a reference to the ContentManager object I have created in admin.php in the ajax_handler.php file? Maybe my understanding of php object scope is flawed. Anyway, if anyone can make sense of what I'm trying to do, I would appreciate some help!

    Read the article

  • Explore a COM Object in PHP

    - by shaiss
    What would be the proper way to explode a COM object for debugging? I have a 3rd party function that returns a multilevel object. The documentation is non existant, so I'd like to be able to echo everything out of the object or debug it in Komodo IDE. Komodo just says Object and nothing else. Maybe convert to array? I know some of the existing options such as $com->Status, but there are more variables returned that I'd like to know what they are.

    Read the article

  • python object AttributeError: type object 'Track' has no attribute 'title'

    - by ccwhite1
    I apologize if this is a noob question, but I can't seem to figure this one out. I have defined an object that defines a music track (NOTE: originally had the just ATTRIBUTE vs self.ATTRIBUTE. I edited those values in to help remove confusion. They had no affect on the problem) class Track(object): def __init__(self, title, artist, album, source, dest): """ Model of the Track Object Contains the followign attributes: 'Title', 'Artist', 'Album', 'Source', 'Dest' """ self.atrTitle = title self.atrArtist = artist self.atrAlbum = album self.atrSource = source self.atrDest = dest I use ObjectListView to create a list of tracks in a specific directory ....other code.... self.aTrack = [Track(sTitle,sArtist,sAlbum,sSource, sDestDir)] self.TrackOlv.AddObjects(self.aTrack) ....other code.... Now I want to iterate the list and print out a single value of each item list = self.TrackOlv.GetObjects() for item in list: print item.atrTitle This fails with the error AttributeError: type object 'Track' has no attribute 'atrTitle' What really confuses me is if I highlight a single item in the Object List View display and use the following code, it will correctly print out the single value for the highlighted item list = self.TrackOlv.GetSelectedObject() print list.atrTitle

    Read the article

  • Dynamically add a field to an object in matlab

    - by Marc
    Say I have a MATLAB object defined in a class file classdef foo properties bar end end And I create a foo object myfoo = foo(); Now I want to add another field to foo dynamically. What I want is foo.newfield = 42; but this will throw an error. I know there is a way to dynamically add a field/property to a MATLAB object but I can't remember it or find it easily in the help. Anyone know the syntax?

    Read the article

  • reinitializing javascript object's properties

    - by Pino
    In my Javascript drag and drop build app, a variety of buildings can be built. The specific characteristics of these are all saved in one object, like var buildings = { house: ['#07DA21',12,12,0,20], bank: ['#E7DFF2',16,16,0,3], stadium: ['#000000',12,12,0,1], townhall: ['#2082A8',20,8,0,1], etcetera } So every building has a number of characteristics, like color, size, look which can be called as buildings[townhall][0] (referring to the color). The object changes as the user changes things. When clicking 'reset' however, the whole object should be reset to its initial settings again to start over, but I have no idea how to do that. For normal objects it is something like. function building() {} var building = new building(); delete building; var building2 = new building(); You can easily delete and remake it, so the properties are reset. But my object is automatically initialized. Is there a way to turn my object into something that can be deleted and newly created, without making it very complicating, or a better way to store this information?

    Read the article

  • Object Oriented Database - why most of the companies do not use them

    - by GigaPr
    Hi, I am pretty new to programming(just finished University). I have been thought in the last 4 years about Object Oriented development and the numerous advantages of this approach. My question is Isn't it easier to use a pure Object Oriented database in development applications? Why Object Oriented database are not as much diffuse as relational? From my point of view makes sense to use OO database, the latter will avoid the numerous construction necessary for the mapping of complex objects on the tables.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >