Search Results

Search found 9771 results on 391 pages for 'equivalence classes'.

Page 117/391 | < Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >

  • Using TDD: "top down" vs. "bottom up"

    - by Christian Mustica
    Since I'm a TDD newbie, I'm currently developing a tiny C# console application in order to practice (because practice makes perfect, right?). I started by making a simple sketchup of how the application could be organized (class-wise) and started developing all domain classes that I could identify, one by one (test first, of course). In the end, the classes have to be integrated together in order to make the application runnable, i.e. placing necessary code in the Main method which calls the necessary logic. However, I don't see how I can do this last integration step in a "test first" manner. I suppose I wouldn't be having these issues had I used a "top down" approach. The question is: how would I do that? Should I have started by testing the Main() method? If anyone could give me some pointers, it will be much appreciated.

    Read the article

  • Cygwin diff won't exclude files if a directory is included in the pattern

    - by Dean Schulze
    I need to do a recursive diff using cygwin that needs do exclude all .xml files from certain directories, but not from other directories. According to the --help option I should be able to do this with with the --exclude=PAT option where PAT is a pattern describing the files I want to exclude from the diff. If I do this: diff -rw --exclude="classes/Services.xml" the diff does not ignore the Services.xml file in the classes directory. If I do this diff -rw --exclude="Services.xml" the diff does ignore the Services.xml file in all directories. I need to do something like this: diff -rw --exclude="*/generated/resources/client/*.xml" to ignore all .xml files in the directory */generated/resources/client/. Whenever I add path information to the --exclude pattern cygwin does not ignore the file(s) I've specified in the pattern. Is there some way to make cygwin diff recognize a pattern that identifies certain files in certain directories? It seems to not be able to handle any directory information at all.

    Read the article

  • what's a good way to implement something that looks like Dictionary<string, string, Dictionary<strin

    - by jcollum
    I've got a data structure that is Key, Value, OtherValues(key, Value). So the OtherValues are attached to the first Key and aren't always there. I can do this as Dictionary<Key, ValueAndListOfOptionalValues> where ValueAndListOfOptionalValues is a class with a string and a Dictionary<string, string>. I'm wondering if that's really the best way to do it? Sometimes I think that I'm missing some important classes in the Generics namespace, maybe there are better classes out there that I'm not aware of.

    Read the article

  • Imitating Multiple Inheritance in PHP

    - by fabieno
    I am working on my own MVC framework and found myself stuck. I need the following construction: Controller -- Backend_Controller -- Backend_Crud_Controller -- Frontend_Controller -- Frontend_Crud_Controller Both 'Backend_Crud_Controller' and 'Frontend_Crud_Controller' have the same functionality and thus they should extend another class named 'Base_Crud_Controller', the only difference comes from the 'Backend/Frontend' Controllers which implement different mechanisms. Basically they should inherit both classes but my problem is that 'Backend/Frontend' controller doesn't necessarily extend 'Base_Crud_Controller'. I know multiple inheritance doesn't exist in PHP but I am looking for a solution, I choose to refrain Mixins (like in Symfony) as I don't consider that an elegant solution. Interfaces do not suit me as all of these end up as concrete classes that should implement methods.

    Read the article

  • Select all items of union but not the last one!

    - by 100r
    I have few texboxes, dropdown lists, etc.. They have their css classes. I want to select all elements of specific class(es) but NOT the last element from group of all classes. <asp:TextBox ID="TextBox1" runat="server" CssClass="class1" ></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server" CssClass="class2" ></asp:TextBox> <asp:TextBox ID="TextBox3" runat="server" CssClass="class2" ></asp:TextBox> I want to select only TextBox1 and TextBox2, not TextBox3! selector should be something like this $("(.class1,.class1):not(:last)") or something like $(".class1,.class1").filter(":not(:last)") but of course none of it is working :) any sugestions? tnx in advance!

    Read the article

  • Vector of objects

    - by Paul
    I've got a abstract class class A { public: virtual void somefunction() = ; }; and some different classes that inherit this class: class Ab { public: void somefunction(); }; etc. I want to make a vector containing some objects of these classes (how many depends on input parameters) so I can access these easily later. However I'm a bit lost on how to do this. My best idea is vector<A> *objectsVector; Ab AbObject; objectsVector.push_back(AbObject); However this gives me a huge amout of errors from various .h files in /usr/include/c++ How should i solve this?

    Read the article

  • c++ property class structure

    - by Without me Its just Aweso
    I have a c++ project being developed in QT. The problem I'm running in to is I am wanting to have a single base class that all my property classes inherit from so that I can store them all together. Right now I have: class AbstractProperty { public: AbstractProperty(QString propertyName); virtual QString toString() const = 0; virtual QString getName() = 0; virtual void fromString(QString str) = 0; virtual int toInteger() = 0; virtual bool operator==(const AbstractProperty &rightHand) = 0; virtual bool operator!=(const AbstractProperty &rightHand) = 0; virtual bool operator<(const AbstractProperty &rightHand) = 0; virtual bool operator>(const AbstractProperty &rightHand) = 0; virtual bool operator>=(const AbstractProperty &rightHand) = 0; virtual bool operator<=(const AbstractProperty &rightHand) = 0; protected: QString name; }; then I am implementing classes such as PropertyFloat and PropertyString and providing implementation for the comparator operators based on the assumption that only strings are being compared with strings and so on. However the problem with this is there would be no compiletime error thrown if i did if(propertyfloat a < propertystring b) however my implementation of the operators for each derived class relies on them both being the same derived class. So my problem is I cant figure out how to implement a property structure so that I can have them all inherit from some base type but code like what I have above would throw a compile time error. Any ideas on how this can be done? For those familiar with QT I tried using also a implementation with QVariant however QVariant doesn't have operators < and defined in itself only in some of its derived classes so it didn't work out. What my end goal is, is to be able to generically refer to properties. I have an element class that holds a hashmap of properties with string 'name' as key and the AbstractProperty as value. I want to be able to generically operate on the properties. i.e. if I want to get the max and min values of a property given its string name I have methods that are completely generic that will pull out the associated AbstactProperty from each element and find the max/min no matter what the type is. so properties although initially declared as PropertyFloat/PropertyString they will be held generically.

    Read the article

  • jQuery: I need something like ':visible' that works even if the parent is display=none

    - by Master Morality
    I have a list where elements are hidden for multiple reasons, each corresponding to a css class i.e: <style> .filteredOut { display: none; } .somethingElse { display : none; } ... </style> I want to apply alternating css classes via .filter(':even').addClass('even') but only to classes that are visible. The problem is that the parent is hidden when this happens so .filter(':visible') returns 0 elements. I need something like .filter(':visibileEventIfParentIsNot') Further more, I'd rather not have to call a function with this in it every time I call a function that changes what's visible in a list. This may be a pipe dream, but is there a way to do this ala live() or something similar? I'm open to off the wall ideas.

    Read the article

  • Constructors with inheritance in c++

    - by Crystal
    If you have 3 classes, with the parent class listed first shape- 2d shapes, 3d shapes - circle, sphere When you write your constructor for the circle class, would you ever just initialize the parent Shape object and then your current object, skipping the middle class. It seems to me you could have x,y coordinates for Shape and initialize those in the constructor, and initialize a radius in the circle or sphere class, but in 2d or 3d shape classes, I wouldn't know what to put in the constructor since it seems like it would be identical to shape. So is something like this valid Circle::Circle(int x, int y, int r) : Shape(x, y), r(r) {} I get a compile error of: illegal member initialization: 'Shape' is not a base or member So I wasn't sure if my code was legal or best practice even. Or if instead you'd have the middle class just do what the top level Shape class does TwoDimensionalShape::TwoDimensionalShape(int x, int y) : Shape (x, y) {} and then in the Circle class Circle::Circle(int x, int y, int r) : TwoDimensionalShape(x, y), r(r) {}

    Read the article

  • How to use SQLiteOpenHelper without or less restrictive use of Context?

    - by Pentium10
    If you extend SQLiteOpenHelper, for the Constructor you have to use a Context. I am wondering if there is a way to leave this out, and be able to work with database tables without a Context. Or at least be least restrictive, I mean a way of project/class structure that will make history the several context passings I have to do now. As it is my application has several level of classes, chained in each other, and there are a few that connects to the database, but have no whatsoever influence on the interface, so they don't actually need the Context. Are you creating your classes in the way that you pass each time a Context to them? If not, how you do, how you reuse a Context in a short class?

    Read the article

  • C++ abstract class template + type-specific subclass = trouble with linker

    - by user333279
    Hi there, The project in question is about different endpoints communicating with each other. An endpoint sends events (beyond the scope of the current problem) and can process incoming events. Each event is represented in a generic object as follows: #pragma interface ... // some includes template<typename T> class Event { public: Event(int senderId, Type type, T payload); // Type is an enum Event(int senderId, Type type, int priority, T payload); virtual ~Event(); virtual int getSenderId(); virtual int getPriority(); virtual T getPayload(); void setPriority(const int priority); protected: const int senderId; const Type type; const T payload; int priority; }; It has its implementing class with #pragma implementation tag. An endpoint is defined as follows: #pragma interface #include "Event.h" template<typename T> class AbstractEndPoint { public: AbstractEndPoint(int id); virtual ~AbstractEndPoint(); virtual int getId(); virtual void processEvent(Event<T> event) = 0; protected: const int id; }; It has its implementing class too, but only the constructor, destructor and getId() are defined. The idea is to create concrete endpoints for each different payload type. Therefore I have different payload objects and specific event classes for each type, e.g. Event<TelegramFormatA>, Event<TelegramFormatB> and ConcreteEndPoint for TelegramFormatA, ConcreteEndPoint for TelegramFormatB respectively. The latter classes are defined as class ConcreteEndPoint : AbstractEndPoint<TelegramFormatA> { ... } I'm using g++ 4.4.3 and ld 2.19. Everything compiles nicely, but the linker complaints about undefined references to type-specific event classes, like Event<TelegramFormatA>::Event(....) . I tried explicit instantiation using template class AbstractEndPoint<TelegramFormatA>; but couldn't get past the aforementioned linker errors. Any ideas would be appreciated.

    Read the article

  • Eclipse is not importing jar dependencies between two projects in the same workspace

    - by jax
    Here is the situation. I have a java project "LicenseGenerator" in eclipse that depends on commons-codec. I have therefore added the commons-codec jar file to the build path. I have Junit tests and everything is working fine. I have made a different project in the same workspace - which happens to be an Android project - that needs to use my LicenseGenerator classes. I added LicenseGenerator to the "projects" tab in the build path - the classes were recognized and I was able to use them. Everything compiled and ran. However, when the part of the LicenseGenerator that used the commons-codec was called from my Android project I got the following error. Could not find method org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString, referenced from method This basically tells me that the commons-codec was not packaged which the Android project, so I added the commons-codec to the android project as well but the same error appears. how do I fix this?

    Read the article

  • Eclipse is not importing jar dependencies between two projects in the same workspace

    - by jax
    Here is the situation. I have a java project "LicenseGenerator" in eclipse that depends on commons-codec. I have therefore added the commons-codec jar file to the build path. I have Junit tests and everything is working fine. I have made a different project in the same workspace - which happens to be an Android project - that needs to use my LicenseGenerator classes. I added LicenseGenerator to the "projects" tab in the build path - the classes were recognized and I was able to use them. Everything compiled and ran. However, when the part of the LicenseGenerator that used the commons-codec was called from my Android project I got the following error. Could not find method org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString, referenced from method This basically tells me that the commons-codec was not packaged which the Android project, so I added the commons-codec to the android project as well but the same error appears. how do I fix this?

    Read the article

  • where to put business logic in a library?

    - by fayer
    i'm going to create a library that consists of a lot of separate classes. i'm very familiar with mvc but have never created a pure library before. i wonder where i should put the business logic? the logic that is in the controller in a mvc. should it be in a class? or in a "bootstrap" file? and should one file include every class, or should only one class include its classes it uses? thanks!

    Read the article

  • Parsing HTML tags to find a specific Table Row

    - by moutonc
    Hello everyone I was set up with a Challenge where I must parse through an HTML page to find the end date of all the classes. I am using the HTMLAgilityPack but, this is the first time I have used it, also the webpage who ever set it up has no classes or Id's and the end dates are stored in a Tr H4 tag. I am not sure how to Parse through any hits? My Code: HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(txtURL.Text); sw.WriteLine("GET /academics/academic-calendar/ HTTP/1.1"); sw.WriteLine(); String response = sr.ReadToEnd(); txtHTML.Text = response;

    Read the article

  • Intellij UML diagram does not show one to many relationships

    - by Calm Storm
    I am trying to follow http://www.jetbrains.com/idea/features/uml_class_diagram.html I have a few classes so when I do Ctrl + Alt + U I only see all classes and just Extends relationships. Please note that I have set the "Diagrams" options in my settings to show one to many etc. I do not see One to One, One to Many relationships at all ? I have used JPA OneToOne Annotations and they dont turn up at all? Pressing Ctrl Shift F12 does not do anything? Can someone please explain?

    Read the article

  • What did I do wrong here when trying to unit test a class that references a web service

    - by zachary
    So I had a class that referenced a class that referenced another class that called a web service. So I learn how to create an interface using partial classes. I inject the web service through the constructor. Then my unit test fails because I am newing up the actual web service in the second level of the class. So I end up modifying all three classes to pass the web service down through the constructor... was not happy :-( gave up.... what should I be doing in this case?

    Read the article

  • C# - Making fields/properties read only conditionally

    - by Alistair77
    I have three classes; Classes A and B both reference class C. How can I make it so members of class C can be modified when referenced from class A but not modified when referenced from class B? IE, the following should be possible; classA myClassA = new classA(); myClassA.myClassC.IssueNumber = 3; But this should not be possible; classB myClassB = new classB(); myClassB.myClassC.IssueNumber = 3; Making classB.classC read-only still allows properties of classC to be altered. I'm sure this is basic stuff but can't find a simple answer. Thanks, A

    Read the article

  • JAX-B annotations for elements that inherit from a parent

    - by AlexM
    When adding JAX-B Java annotations for Java classes - if I have a parent Class Entry, with two children, Book and JournalArticle, Would I add these annotations for all three classes: @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement ie: @XmlSeeAlso({au.com.library.Book.class, au.com.library.JournalArticle.class}) @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public abstract class Entry implements Serializable{ private static final long serialVersionUID = -1895155325179947581L; @XmlElement(name="title") protected String title; @XmlElement(name="author") protected String author; @XmlElement(name="year") protected int year; and @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public class Book extends Entry { @XmlElement(name="edition") private String edition; @XmlElement(name="publisher") private String publisher; @XmlElement(name="placeOfPublication") private String placeOfPub; and @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement public class JournalArticle extends Entry { @XmlElement(name="journalTitle") private String journalTitle; @XmlElement(name="volume") private String volume; @XmlElement(name="issue") private String issue; @XmlElement(name="pageNumbers") private String pgNumbers;

    Read the article

  • Returning and instance of a Class given its .class (MyClass.class)

    - by jax
    I have an enum that will hold my algorithms. I cannot instantiate these classes because I need the application context which is only available once the application has started. I want to load the class at runtime when I choose by calling getAlgorithm(Context cnx). How do I easily instantiate a class at runtime given its .class (and my constructor takes arguments)? All my classes are subclasses of Algorithm. public enum AlgorithmTypes { ALL_FROM_9_AND_LAST_FROM_10_ID(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class), ALL_FROM_9_AND_LAST_FROM_10_CURRENCY_ID(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class), DIVIDE_BY_9_LESS_THAN_100(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class), TABLES_BEYOND_5_BY_5(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class); private Class<? extends Algorithm> algorithm; AlgorithmTypes(Class<? extends Algorithm> c) { algorithm = c; } public Algorithm getAlgorithm(Context cnx) { return //needs to return the current algoriths constructor which takes the Context Algorithm(Context cnx); } }

    Read the article

  • Attribute vector emptying itself

    - by ravloony
    Hello, I have two classes, derived from a common class. The common class has a pure virtual function called execute(), which is implemented in both derived classes. In the inherited class I have an attribute which is a vector. In both execute() methods I overwrite this vector with a result. I access both classes from a vector of pointers to their objects. The problem is when I try to access the result vector form outside the objects. In one case I can get the elements (which are simply pointers), in the other I cannot, the vector is empty. Code: class E; class A{ protected: vector<E*> _result; public: virtual void execute()=0; vector<E*> get_result(); }; vector<E*> A::get_result() { return _result; } class B : public A { public: virtual void execute(); }; B::execute() { //... _result = tempVec; return; } class C : public A { public: virtual void execute(); }; C::execute() { //different stuff to B _result = tempvec; return; } main() { B* b = new B(); C* c = new C(); b->execute(); c->execute(); b->get_result();//returns full vector c->get_result(); //returns empty vector!! } I have no idea what is going on here... I have tried filling _result by hand from a temp vector in the offending class, doing the same with vector::assign(), nothing works. And the other object works perfectly. I must be missing something.... Any help would be greatly appreciated.

    Read the article

  • Can .NET AppDomains do this?

    - by Eloff
    I've spent hours reading up about AppDomains, but I'm not sure they work quite like I'm hoping. If I have two classes, Foo in AppDomain #1, Bar in AppDomain #2: App Domain #1 is the application. App Domain #2 is something like a plugin, and can be loaded and unloaded dynamically. AppDomain #2 wants to create Foo and use it. Foo uses lots of classes in AppDomain #1 internally. I don't want AppDomain #2 using object foo with reflection, I want it to use Foo foo, with all the static typing and compiled speed that goes with it. Can this be done considering that AppDomain #1, containing Foo, is never unloaded? If so, does any remoting take place here when using Foo? When I unload AppDomain #2, the type Foo is destroyed?

    Read the article

  • Adding a Jar to ext and using it in Eclipse

    - by Bob Breznak
    I am providing a client with a lab station image for a school program. There is a library that I'd like to directly add to the JRE so that students can use the library without needing to fiddle with adding the classpath. As this is a basic after school program, the goal is to just get students into programming with as little overhead additions as possible. At this point, I have the lib put into the jre/lib/ext and Eclipse is able to find it, however it will not allow access to any of the classes. I see it in the JRE System Library and the classes and packages are showing up there but when I go to use it, I am getting an "Access restriction" error. When I remove the JRE System Library then add it back in, everything works swimmingly. The library is accessible exactly as intended. Any ideas on how to resolve this?

    Read the article

  • How do you keep Cocoa controllers from getting too big?

    - by zoul
    Hello! Do you have some tricks or techniques to break Cocoa controller classes into smaller chunks? I find that whatever I do the controllers end up being one of the more complicated classes in my design. The basic stuff is simple, but once I have several pop-overs or action sheets running, things get uncomfortably complex. It's not that bad, but still I would like to refactor the code into several standalone chunks. I thought about categories, but the code is not that independent (a lot of times it needs to tap into viewWillAppear, for example) and I find that I spend a long time fighting the compiler. I also thought about adding functionality in layers using inheritance, but that feels like a hack.

    Read the article

  • Overload and hide methods in Java

    - by Marco
    Hi, i have an abstract class BaseClass with a public insert() method: public abstract class BaseClass { public void insert(Object object) { // Do something } } which is extended by many other classes. For some of those classes, however, the insert() method must have additional parameters, so that they instead of overriding it I overload the method of the base class with the parameters required, for example: public class SampleClass extends BaseClass { public void insert(Object object, Long param){ // Do Something } } Now, if i instantiate the SampleClass class, i have two insert() methods: SampleClass sampleClass = new SampleClass(); sampleClass.insert(Object object); sampleClass.insert(Object object, Long param); what i'd like to do is to hide the insert() method defined in the base class, so that just the overload would be visible: SampleClass sampleClass = new SampleClass(); sampleClass.insert(Object object, Long param); Could this be done in OOP?

    Read the article

< Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >