Search Results

Search found 8850 results on 354 pages for 'libreoffice base'.

Page 16/354 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • WCF REST Starter Kit not filling base class members on POST

    - by HJG
    I have a WCF REST Starter Kit service. The type handled by the service is a subclass of a base class. For POST requests, the base class members are not correctly populated. The class hierarchy looks like this: [DataContract] public class BaseTreeItem { [DataMember] public String Id { get; set; } [DataMember] public String Description { get; set; } } [DataContract] public class Discipline : BaseTreeItem { ... } The service definition looks like: [WebHelp(Comment = "Retrieve a Discipline")] [WebGet(UriTemplate = "discipline?id={id}")] [OperationContract] public Discipline getDiscipline(String id) { ... } [WebHelp(Comment = "Create/Update/Delete a Discipline")] [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "discipline")] public WCF_Result DisciplineMaintenance(Discipline discipline) { ... } Problem: While the GET works fine (returns the base class Id and Description), the POST does not populate Id and Description even though the XML contains the fields. Sample XML: <?xml version="1.0" encoding="utf-8"?> <Discipline xmlns="http://schemas.datacontract.org/2004/07/xxx.yyy.zzz"> <DeleteFlag>7</DeleteFlag> <Description>2</Description> <Id>5</Id> <DisciplineName>1</DisciplineName> <DisciplineOwnerId>4</DisciplineOwnerId> <DisciplineOwnerLoginName>3</DisciplineOwnerLoginName> </Discipline> Thanks for any assistance.

    Read the article

  • Generic Func<> as parameter to base method

    - by WestDiscGolf
    I might be losing the plot, but I hope someone can point me in the right direction. What am I trying to do? I'm trying to write some base methods which take Func< and Action so that these methods handle all of the exception handling etc. so its not repeated all over the place but allow the derived classes to specify what actions it wants to execute. So far this is the base class. public abstract class ServiceBase<T> { protected T Settings { get; set; } protected ServiceBase(T setting) { Settings = setting; } public void ExecAction(Action action) { try { action(); } catch (Exception exception) { throw new Exception(exception.Message); } } public TResult ExecFunc<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult> function) { try { /* what goes here?! */ } catch (Exception exception) { throw new Exception(exception.Message); } } } I want to execute an Action in the following way in the derived class (this seems to work): public void Delete(string application, string key) { ExecAction(() => Settings.Delete(application, key)); } And I want to execute a Func in a similar way in the derived class but for the life of me I can't seem to workout what to put in the base class. I want to be able to call it in the following way (if possible): public object Get(string application, string key, int? expiration) { return ExecFunc(() => Settings.Get(application, key, expiration)); } Am I thinking too crazy or is this possible? Thanks in advance for all the help.

    Read the article

  • Objective C - creating concrete class instances from base class depending upon type

    - by indiantroy
    Just to give a real world example, say the base class is Vehicle and concrete classes are TwoWheeler and FourWheeler. Now the type of the vehicle - TwoWheeler or FourWheeler, is decided by the base class Vehicle. When I create an instance of TwoWheeler/FourWheeler using alloc-init method, it calls the super implementation like below to set the value of common properties defined in the Vehicle class and out of these properties one of them is type that actually decides if the type is TwoWheeler or FourWheeler. if (self = [super initWithDictionary:dict]){ [self setOtherAttributes:dict]; return self; } Now when I get a collection of vehicles some of them could be TwoWheeler and others will be FourWheeler. Hence I cannot directly create an instance of TwoWheeler or FourWheeler like this Vehicle *v = [[TwoWheeler alloc] initWithDictionary:dict]; Is there any way I can create an instance of base class and once I know the type, create an instance of child class depending upon type and return it. With the current implementation, it would result in infinite loop because I call super implementation from concrete class. What would be the perfect design to handle this scenario when I don't know which concrete class should be instantiated beforehand?

    Read the article

  • Multiple collections tied to one base collection with filters and eventing

    - by damienc88
    I have a complex model served from my back end, which has a bunch of regular attributes, some nested models, and a couple of collections. My page has two tables, one for invalid items, and one for valid items. The items in question are from one of the nested collections. Let's call it baseModel.documentCollection, implementing DocumentsCollection. I don't want any filtration code in my Marionette.CompositeViews, so what I've done is the following (note, duplicated for the 'valid' case): var invalidDocsCollection = new DocumentsCollection( baseModel.documentCollection.filter(function(item) { return !item.isValidItem(); }) ); var invalidTableView = new BookIn.PendingBookInRequestItemsCollectionView({ collection: app.collections.invalidDocsCollection }); layout.invalidDocsRegion.show(invalidTableView); This is fine for actually populating two tables independently, from one base collection. But I'm not getting the whole event pipeline down to the base collection, obviously. This means when a document's validity is changed, there's no neat way of it shifting to the other collection, therefore the other view. What I'm after is a nice way of having a base collection that I can have filter collections sit on top of. Any suggestions?

    Read the article

  • Followup: Python 2.6, 3 abstract base class misunderstanding

    - by Aaron
    I asked a question at Python 2.6, 3 abstract base class misunderstanding. My problem was that python abstract base classes didn't work quite the way I expected them to. There was some discussion in the comments about why I would want to use ABCs at all, and Alex Martelli provided an excellent answer on why my use didn't work and how to accomplish what I wanted. Here I'd like to address why one might want to use ABCs, and show my test code implementation based on Alex's answer. tl;dr: Code after the 16th paragraph. In the discussion on the original post, statements were made along the lines that you don't need ABCs in Python, and that ABCs don't do anything and are therefore not real classes; they're merely interface definitions. An abstract base class is just a tool in your tool box. It's a design tool that's been around for many years, and a programming tool that is explicitly available in many programming languages. It can be implemented manually in languages that don't provide it. An ABC is always a real class, even when it doesn't do anything but define an interface, because specifying the interface is what an ABC does. If that was all an ABC could do, that would be enough reason to have it in your toolbox, but in Python and some other languages they can do more. The basic reason to use an ABC is when you have a number of classes that all do the same thing (have the same interface) but do it differently, and you want to guarantee that that complete interface is implemented in all objects. A user of your classes can rely on the interface being completely implemented in all classes. You can maintain this guarantee manually. Over time you may succeed. Or you might forget something. Before Python had ABCs you could guarantee it semi-manually, by throwing NotImplementedError in all the base class's interface methods; you must implement these methods in derived classes. This is only a partial solution, because you can still instantiate such a base class. A more complete solution is to use ABCs as provided in Python 2.6 and above. Template methods and other wrinkles and patterns are ideas whose implementation can be made easier with full-citizen ABCs. Another idea in the comments was that Python doesn't need ABCs (understood as a class that only defines an interface) because it has multiple inheritance. The implied reference there seems to be Java and its single inheritance. In Java you "get around" single inheritance by inheriting from one or more interfaces. Java uses the word "interface" in two ways. A "Java interface" is a class with method signatures but no implementations. The methods are the interface's "interface" in the more general, non-Java sense of the word. Yes, Python has multiple inheritance, so you don't need Java-like "interfaces" (ABCs) merely to provide sets of interface methods to a class. But that's not the only reason in software development to use ABCs. Most generally, you use an ABC to specify an interface (set of methods) that will likely be implemented differently in different derived classes, yet that all derived classes must have. Additionally, there may be no sensible default implementation for the base class to provide. Finally, even an ABC with almost no interface is still useful. We use something like it when we have multiple except clauses for a try. Many exceptions have exactly the same interface, with only two differences: the exception's string value, and the actual class of the exception. In many exception clauses we use nothing about the exception except its class to decide what to do; catching one type of exception we do one thing, and another except clause catching a different exception does another thing. According to the exception module's doc page, BaseException is not intended to be derived by any user defined exceptions. If ABCs had been a first class Python concept from the beginning, it's easy to imagine BaseException being specified as an ABC. But enough of that. Here's some 2.6 code that demonstrates how to use ABCs, and how to specify a list-like ABC. Examples are run in ipython, which I like much better than the python shell for day to day work; I only wish it was available for python3. Your basic 2.6 ABC: from abc import ABCMeta, abstractmethod class Super(): __metaclass__ = ABCMeta @abstractmethod def method1(self): pass Test it (in ipython, python shell would be similar): In [2]: a = Super() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Super with abstract methods method1 Notice the end of the last line, where the TypeError exception tells us that method1 has not been implemented ("abstract methods method1"). That was the method designated as @abstractmethod in the preceding code. Create a subclass that inherits Super, implement method1 in the subclass and you're done. My problem, which caused me to ask the original question, was how to specify an ABC that itself defines a list interface. My naive solution was to make an ABC as above, and in the inheritance parentheses say (list). My assumption was that the class would still be abstract (can't instantiate it), and would be a list. That was wrong; inheriting from list made the class concrete, despite the abstract bits in the class definition. Alex suggested inheriting from collections.MutableSequence, which is abstract (and so doesn't make the class concrete) and list-like. I used collections.Sequence, which is also abstract but has a shorter interface and so was quicker to implement. First, Super derived from Sequence, with nothing extra: from abc import abstractmethod from collections import Sequence class Super(Sequence): pass Test it: In [6]: a = Super() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Super with abstract methods __getitem__, __len__ We can't instantiate it. A list-like full-citizen ABC; yea! Again, notice in the last line that TypeError tells us why we can't instantiate it: __getitem__ and __len__ are abstract methods. They come from collections.Sequence. But, I want a bunch of subclasses that all act like immutable lists (which collections.Sequence essentially is), and that have their own implementations of my added interface methods. In particular, I don't want to implement my own list code, Python already did that for me. So first, let's implement the missing Sequence methods, in terms of Python's list type, so that all subclasses act as lists (Sequences). First let's see the signatures of the missing abstract methods: In [12]: help(Sequence.__getitem__) Help on method __getitem__ in module _abcoll: __getitem__(self, index) unbound _abcoll.Sequence method (END) In [14]: help(Sequence.__len__) Help on method __len__ in module _abcoll: __len__(self) unbound _abcoll.Sequence method (END) __getitem__ takes an index, and __len__ takes nothing. And the implementation (so far) is: from abc import abstractmethod from collections import Sequence class Super(Sequence): # Gives us a list member for ABC methods to use. def __init__(self): self._list = [] # Abstract method in Sequence, implemented in terms of list. def __getitem__(self, index): return self._list.__getitem__(index) # Abstract method in Sequence, implemented in terms of list. def __len__(self): return self._list.__len__() # Not required. Makes printing behave like a list. def __repr__(self): return self._list.__repr__() Test it: In [34]: a = Super() In [35]: a Out[35]: [] In [36]: print a [] In [37]: len(a) Out[37]: 0 In [38]: a[0] --------------------------------------------------------------------------- IndexError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() /home/aaron/projects/test/test.py in __getitem__(self, index) 10 # Abstract method in Sequence, implemented in terms of list. 11 def __getitem__(self, index): ---> 12 return self._list.__getitem__(index) 13 14 # Abstract method in Sequence, implemented in terms of list. IndexError: list index out of range Just like a list. It's not abstract (for the moment) because we implemented both of Sequence's abstract methods. Now I want to add my bit of interface, which will be abstract in Super and therefore required to implement in any subclasses. And we'll cut to the chase and add subclasses that inherit from our ABC Super. from abc import abstractmethod from collections import Sequence class Super(Sequence): # Gives us a list member for ABC methods to use. def __init__(self): self._list = [] # Abstract method in Sequence, implemented in terms of list. def __getitem__(self, index): return self._list.__getitem__(index) # Abstract method in Sequence, implemented in terms of list. def __len__(self): return self._list.__len__() # Not required. Makes printing behave like a list. def __repr__(self): return self._list.__repr__() @abstractmethod def method1(): pass class Sub0(Super): pass class Sub1(Super): def __init__(self): self._list = [1, 2, 3] def method1(self): return [x**2 for x in self._list] def method2(self): return [x/2.0 for x in self._list] class Sub2(Super): def __init__(self): self._list = [10, 20, 30, 40] def method1(self): return [x+2 for x in self._list] We've added a new abstract method to Super, method1. This makes Super abstract again. A new class Sub0 which inherits from Super but does not implement method1, so it's also an ABC. Two new classes Sub1 and Sub2, which both inherit from Super. They both implement method1 from Super, so they're not abstract. Both implementations of method1 are different. Sub1 and Sub2 also both initialize themselves differently; in real life they might initialize themselves wildly differently. So you have two subclasses which both "is a" Super (they both implement Super's required interface) although their implementations are different. Also remember that Super, although an ABC, provides four non-abstract methods. So Super provides two things to subclasses: an implementation of collections.Sequence, and an additional abstract interface (the one abstract method) that subclasses must implement. Also, class Sub1 implements an additional method, method2, which is not part of Super's interface. Sub1 "is a" Super, but it also has additional capabilities. Test it: In [52]: a = Super() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Super with abstract methods method1 In [53]: a = Sub0() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: Can't instantiate abstract class Sub0 with abstract methods method1 In [54]: a = Sub1() In [55]: a Out[55]: [1, 2, 3] In [56]: b = Sub2() In [57]: b Out[57]: [10, 20, 30, 40] In [58]: print a, b [1, 2, 3] [10, 20, 30, 40] In [59]: a, b Out[59]: ([1, 2, 3], [10, 20, 30, 40]) In [60]: a.method1() Out[60]: [1, 4, 9] In [61]: b.method1() Out[61]: [12, 22, 32, 42] In [62]: a.method2() Out[62]: [0.5, 1.0, 1.5] [63]: a[:2] Out[63]: [1, 2] In [64]: a[0] = 5 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/aaron/projects/test/<ipython console> in <module>() TypeError: 'Sub1' object does not support item assignment Super and Sub0 are abstract and can't be instantiated (lines 52 and 53). Sub1 and Sub2 are concrete and have an immutable Sequence interface (54 through 59). Sub1 and Sub2 are instantiated differently, and their method1 implementations are different (60, 61). Sub1 includes an additional method2, beyond what's required by Super (62). Any concrete Super acts like a list/Sequence (63). A collections.Sequence is immutable (64). Finally, a wart: In [65]: a._list Out[65]: [1, 2, 3] In [66]: a._list = [] In [67]: a Out[67]: [] Super._list is spelled with a single underscore. Double underscore would have protected it from this last bit, but would have broken the implementation of methods in subclasses. Not sure why; I think because double underscore is private, and private means private. So ultimately this whole scheme relies on a gentleman's agreement not to reach in and muck with Super._list directly, as in line 65 above. Would love to know if there's a safer way to do that.

    Read the article

  • ASP.NET MVC input is not a valid Base-64 string Error

    - by Cas Sakal
    Hello all, I am trying to post a from in an asp.net mvc page which contains files(user uploads) and a few string fields. However, when I click on the submit I get the following error; The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. does anyone have an idea what is this about? I cannot debug it since it gives the error at the time of the binding of the page. Any help would be appreciated, cas

    Read the article

  • C# Using Reflection to copy base class properties

    - by David Liddle
    I would like to update all properties from MyObject to another using Reflection. The problem I am coming into is that the particular object is inherited from a base class and those base class property values are not updated. The below code copies over top level property values. public void Update(MyObject o) { MyObject copyObject = ... FieldInfo[] myObjectFields = o.GetType().GetFields( BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); foreach (FieldInfo fi in myObjectFields) { fi.SetValue(copyObject, fi.GetValue(o)); } } I was looking to see if there were any more BindingFlags attributes I could use to help but to no avail.

    Read the article

  • Base 36 to Base 10 conversion using SQL only.

    - by EvilTeach
    A situation has arisen where I need to perform a base 36 to base 10 conversion, in the context of a SQL statement. There doesn't appear to be anything built into Oracle 9, or Oracle 10 to address this sort of thing. My Google-Fu, and AskTom suggest creating a pl/sql function to deal with the task. That is not an option for me at this point. I am looking for suggestions on an approach to take that might help me solve this issue. To put this into a visual form... WITH Base36Values AS ( SELECT '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' myBase36 FROM DUAL ), TestValues AS ( SELECT '01Z' BASE36_VALUE, 71 BASE10_VALUE FROM DUAL ) SELECT * FROM Base36Values, TestValues I am looking for something to calculate the value 71, based on the input 01Z. As a bribe, each useful answer gets a free upvote. Thanks Evil.

    Read the article

  • Rails route error? uninitialized constant ActiveResource::Base

    - by Marco
    I'm following the Getting Started with Rails guide but ran into an issue opening http://localhost:3000 Shell output: [2010-03-23 19:19:14] ERROR NameError: uninitialized constant ActiveResource::Base Error in the browser: Internal Server Error uninitialized constant ActiveResource::Base WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12) at localhost:3000 I followed the directions exactly as they were specified in the guide: Ran rails generate controller home index I removed index.html Added root :to = "home#index" to config/routes.rb I checked app/views/home/index.html.erb and it is indeed there. I then used rails server to launch the server. At first attempt the browser loads a blank page, but afterwards starts showing the browser error above. Why is it that Rails can't locate the index.html.erb file? Or is the error something different? - Running Rails 3.0beta with Ruby 1.8.7

    Read the article

  • Best approch for creating Base control

    - by akjoshi
    Hi, I am looking for a solution for this scenario - I need to implement a feature to allow user to add various controls to canvas(WPF, custom and third party ) and then select any one of them and modify some properties in property grid(changes needs to be reflected in UI). I don't want to expose all the properties of any control only some of them(relevant to end user); apart from this there are some properties which will be common for all controls e.g. Title, Value(Value will be bound to some property of a control, say Text of TextBox and Content of Label) etc. I am thinking of putting all the common proeprties at one place. Things I am confused aout - How to create such base class, whether to use UserControl or Custom Control for this? How will the binding work between Control, base class proeprties and PropertyGrid? What type of object will I expose to property grid? Any idea on what approch should be followed in this case, any kind of input will really be helpful.

    Read the article

  • Knowledge base web app -- need a demo mode

    - by Smandoli
    I was contracted to build an on-line knowledge base that searches and cross-references many thousands of replacement parts for a niche industry. My client furnishes this app to his customers on a subscription basis. It uses MySQL and PHP and it works great. I want to deploy it in "demo mode" to sell my skills. I want the user to see the functions, but I have to guard the data for my client. My first idea was to obfuscate the results. That's at cross-purposes with showing how well it searches. I'm considering a limit on how many searches you can perform, but that's awkward too as someone could visit every day and get more answers than we would prefer. Other posts I've found are about letting people interact with an app, but without the challenge of protecting a big knowledge base. Can you suggest an approach? (Note, I put the tag obfuscation, but not sure it applies because java code obfuscation seems to be unrelated.)

    Read the article

  • Convert/Cast base type to Derived type

    - by user102533
    I am extending the existing .NET framework class by deriving it. How do I convert an object of base type to derived type? public class Results { //Framework methods } public class MyResults : Results { //Nothing here } //I call the framework method public static MyResults GetResults() { Results results = new Results(); //Results results = new MyResults(); //tried this as well. results = CallFrameworkMethod(); return (MyResults)results; //Throws runtime exception } I understand that this happens as I am trying to cast a base type to a derived type and if derived type has additional properties, then the memory is not allocated. When I do add the additional properties, I don't care if they are initialized to null. How do I do this without doing a manual copy?

    Read the article

  • Castle Windsor - Resolving a generic implementation to a base type

    - by arootbeer
    I'm trying to use Windsor as a factory to provide specification implementations based on subtypes of XAbstractBase (an abstract message base class in my case). I have code like the following: public abstract class XAbstractBase { } public class YImplementation : XAbstractBase { } public class ZImplementation : XAbstractBase { } public interface ISpecification<T> where T : XAbstractBase { bool PredicateLogic(); } public class DefaultSpecificationImplementation : ISpecification<XAbstractBase> { public bool PredicateLogic() { return true; } } public class SpecificSpecificationImplementation : ISpecification<YImplementation> { public bool PredicateLogic() { /*do real work*/ } } My component registration code looks like this: container.Register( AllTypes.FromAssembly(Assembly.GetExecutingAssembly()) .BasedOn(typeof(ISpecification<>)) .WithService.FirstInterface() ) This works fine when I try to resolve ISpecification<YImplementation>; it correctly resolves SpecificSpecificationImplementation. However, when I try to resolve ISpecification<ZImplementation> Windsor throws an exception: "No component for supporting the service ISpecification'1[ZImplementation, AssemblyInfo...] was found" Does Windsor support resolving generic implementations down to base classes if no more specific implementation is registered?

    Read the article

  • Inserting the record into Data Base through JPA

    - by vinay123
    In my code I am using JSF - Front end , EJB-Middile Tier and JPA connect to DB.Calling the EJB using the Webservices.Using MySQL as DAtabase. I have created the Voter table in which I need to insert the record. I ma passing the values from the JSF to EJB, it is working.I have created JPA controller class (which automatcally generates the persistence code based on the data base classes) Ex: getting the entity manager etc., em = getEntityManager(); em.getTransaction().begin(); em.persist(voter); em.getTransaction().commit(); I have created the named query also: @NamedQuery(name = "Voter.insertRecord", query = "INSERT INTO Voter v values v.voterID = :voterID,v.password = :password,v.partSSN = :partSSN,v.address = :address, v.zipCode = :zipCode,v.ssn = :ssn, v.vFirstName = :vFirstName,v.vLastName = :vLastName,v.dob = :dob"),But still not able to insert the record? Can anyone help me in inserting the record into the Data base through JPA.(Persistence object)?

    Read the article

  • RMIC task failing with base not supported

    - by Aaron
    I am running the following target in my build.xml <target name="rmiserver"> <rmic base="../bin" classname="com.deleted.ctiv.remote.IvProvisionerResponseImpl"></rmic> </target> and I get the following error [startAnt] [exec] BUILD FAILED [startAnt] [exec] /home/gtaadm/gta/tomcat-5.5.20-8/webapps/taiga-2.0/project/working/EBIG_1.1/revision-1722/build.xml:44: The following error occurred while executing this line: [startAnt] [exec] /home/gtaadm/gta/tomcat-5.5.20-8/webapps/taiga-2.0/project/working/EBIG_1.1/revision-1722/ebig/ear/build.xml:57: The <rmic> type doesn't support the "base" attribute. It works when I run it eclipse, but not in my automated build environment.

    Read the article

  • Compiler doesn't find methods from base class

    - by Paul
    I am having a problem with my virtual methods in a derived class. Here are my (simplified) C++ classes. class Base virtual method accept( MyVisitor1* v ) { /*implementation is here*/ }; virtual method accept( MyVisitor2* v ) { /*implementation is here*/ }; virtual method accept( MyVisitor3* v ) { /*implementation is here*/ }; class DerivedClass virtual method accept( MyVisitor2* v ) { /*implementation is here*/ }; The following use causes VS 2005 to give: "error C2664: 'DerivedClass::accept' : cannot convert parameter 1 from 'Visitor1*' to 'Visitor2 *'". DerivedClass c; MyVisitor1 v1; c.accept(v1); I was expecting the compiler to find and call Base::accept(MyVisitor1) for my DerivedClass as well. Obviously this is not working, but I don't understand why. Any ideas? Thanks, Paul

    Read the article

  • Missing prop-base file problem

    - by Tony
    I am using Eclipse and SVNSubversion as a repository for a Java project. After updating the local repository and starting Eclipse, an error (in the Problems tab) appeared stating that a specific prop-base file was missing from the build path. Being inexperienced, I have accidentally deleted the prop-base file icon from the project build-path library section. Since then the numbers of errors have grown exponentially... What should I do? Updating the local repository and/or starting a new Eclipse project from the same source did not solve the problem, does anyone have an idea?

    Read the article

  • Duplicate an AppEngine Query object to create variations of a filter without affecting the base quer

    - by Steve Mayne
    In my AppEngine project I have a need to use a certain filter as a base then apply various different extra filters to the end, retrieving the different result sets separately. e.g.: base_query = MyModel.all().filter('mainfilter', 123) Then I need to use the results of various sub queries separately: subquery1 = basequery.filter('subfilter1', 'xyz') #Do something with subquery1 results here subquery2 = basequery.filter('subfilter2', 'abc') #Do something with subquery2 results here Unfortunately 'filter()' affects the state of the basequery Query instance, rather than just returning a modified version. Is there any way to duplicate the Query object and use it as a base? Is there perhaps a standard Python way of duping an object that could be used? The extra filters are actually applied by the results of different forms dynamically within a wizard, and they use the 'running total' of the query in their branch to assess whether to ask further questions. Obviously I could pass around a rudimentary stack of filter criteria, but I'd rather use the Query itself if possible, as it adds simplicity and elegance to the solution.

    Read the article

  • StructureMap - Injecting a dependency into a base class?

    - by David
    In my domain I have a handful of "processor" classes which hold the bulk of the business logic. Using StructureMap with default conventions, I inject repositories into those classes for their various IO (databases, file system, etc.). For example: public interface IHelloWorldProcessor { string HelloWorld(); } public class HelloWorldProcessor : IHelloWorldProcessor { private IDBRepository _dbRepository; public HelloWorldProcessor(IDBRepository dbRepository) { _dbRepository = dbrepository; } public string HelloWorld(){ return _dbRepository.GetHelloWorld(); } } Now, there are some repositories that I'd like to be available to all processors, so I made a base class like this: public class BaseProcessor { protected ICommonRepository _commonRepository; public BaseProcessor(ICommonRepository commonRepository) { _commonRepository = commonRepository; } } But when my other processors inherit from it, I get a compiler error on each one saying that there's no constructor for BaseProcessor which takes zero arguments. Is there a way to do what I'm trying to do here? That is, to have common dependencies injected into a base class that my other classes can use without having to write the injections into each one?

    Read the article

  • How to implement User base security not role base in asp.net?

    - by Gaurav
    Hi, I have to implement User base security in my Web project using .Net3.5. Followings are some we need: Roles can be Admin, Manage, Editor, Member etc User can have multiple roles Every roles has its own dynamic menus and restrictions/resources All menus and interface will populate dynamically from Database I heard some where this kind of i.e user base security can be implemented using HashTable but I dont know how is it? Today I came to know that for this kind of work Java people use Interceptor Design patterns. So, how could I do the same in asp.net C#?

    Read the article

  • Inheritance policy when designing the base class

    - by Xaqron
    I have a base class and a derived class both in design phase. The base class will remain one but many derived class will inherit from it. So it's very costly to make change to derived classes in the future and I'm looking for the best design to prevent this. In fact derived class only needs a few methods to override (if needed) but it's tempting to reveal more details to it. My question is about the policy which is extensible in future. Can I minimize the inherited methods/properties to derived class and reveal more in the next versions if needed without any change to derived classes ? Or I should reveal anything that maybe used by derived classes in the future and let them to choose if they need them or not ? Thanks

    Read the article

  • How to access base (super) class in Delphi?

    - by Niyoko Yuliawan
    In C# i can access base class by base keyword, and in java i can access it by super keyword. How to do that in delphi? suppose I have following code: type TForm3 = class(TForm) private procedure _setCaption(Value:String); public property Caption:string write _setCaption; //adding override here gives error end; implementation procedure TForm3._setCaption(Value: String); begin Self.Caption := Value; //it gives stack overflow end;

    Read the article

  • extension-base file associations

    - by Maurice Perry
    Hi there, I am using ubuntu 9.10, and I would like to associate thunderbird to all the files with the extension .eml. The problem is that is seems that ubuntu is attributing the mime type text/plain to these files, based on their content, which meens that if I set thunderbird as the default application for .eml files, all the other text files (.txt for instance) will be opened with thunderbird. Is it possible to add a rule to impose a mime type based on the file extension, regardless of its content?

    Read the article

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