Search Results

Search found 8397 results on 336 pages for 'implementation'.

Page 71/336 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • boost::this_thread::disable_interruption usage confusion

    - by Evgenii
    boost/thread/pthread/shared_mutex.hpp contains this code: ... #include <boost/thread/detail/thread_interruption.hpp> ... class shared_mutex { ... void lock_shared() { boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lk(state_change); while(state.exclusive || state.exclusive_waiting_blocked) { shared_cond.wait(lk); } ++state.shared_count; } ... }; but boost/thread/detail/thread_interruption.hpp does not contain implementation of disable_interruption, only the prototype. in boost_1_42_0/libs/thread/src/pthread we don't have the implementation too how does it work!???

    Read the article

  • UIWebView appears null when calling fro a method

    - by Alexidze
    I have a major problem when trying to access a UIWebView that was created during ViewDidLoad, the UIWebView appears null here is how i declare the property @property (nonatomic, retain) UIWebView *detailsView; the implementation @implementation iPadMainViewController @synthesize detailsView; - (void)viewDidLoad { [super viewDidLoad]; detailsView = [[UIWebView alloc] initWithFrame:CGRectMake(500, 0, 512, 768)]; [self.view addSubView:detailsView]; } When accessing from - (void)loadDetailedContent:(NSString *)s { NSLog(@"%@", detailsView); } I get NULL, is it a normal behavior or am i doing something wrong? here is the touchesBegan that is being called, from the views subclass that is being touched, -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { iPadMainViewController *mycontroller = [[iPadMainViewController alloc] init]; self.delegate = mycontroller; [self.delegate loadDetailedContent:NewsId]; }

    Read the article

  • So where is this calling super?

    - by dontWatchMyProfile
    From the Core Data docs: Inheritance If you have two subclasses of NSManagedObject where the parent class implements a dynamic property and its subclass (the grandchild of NSManagedObject) overrides the methods for the property, those overrides cannot call super. @interface Parent : NSManagedObject @property(nonatomic, retain) NSString* parentString; @end @implementation Parent @dynamic parentString; @end @interface Child : Parent @end @implementation Child - (NSString *)parentString { // this throws a "selector not found" exception return parentString.foo; } @end very, very funny, because: I see nobody calling super. Or are they? Wait... parentString.foo results in ... a crash ??? it's a string. How can that thing have a .foo suffixed to it? Just another documentation bug?

    Read the article

  • Objective-C inheritance; calling overriden method from superclass?

    - by anshuchimala
    Hello, I have an Objective-C class that has a method that is meant to be overridden, which is uses in a different method. Something like this: @interface BaseClass - (id)overrideMe; - (void)doAwesomeThings; @end @implementation BaseClass - (id)overrideMe { [self doesNotRecognizeSelector:_cmd]; return nil; } - (void)doAwesomeThings { id stuff = [self overrideMe]; /* do stuff */ } @end @interface SubClass : BaseClass @end @implementation SubClass - (id)overrideMe { /* Actually do things */ return <something>; } @end However, when I create a SubClass and try to use it, it still calls overrideMe on the BaseClass and crashes due to doesNotRecognizeSelector:. (I'm not doing a [super overrideMe] or anything stupid like that). Is there a way to get BaseClass to call the overridden overrideMe?

    Read the article

  • unrecognized selector sent to instance while trying to add an object to a mutable array

    - by madpoet
    I'm following the "Your Second iOS App" and I decided to play with the code to understand Objective C well... What I'm trying to do is simply adding an object to a mutable array in a class. Here are the classes: BirdSighting.h #import <Foundation/Foundation.h> @interface BirdSighting : NSObject @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *location; @property (nonatomic, copy) NSDate *date; -(id) initWithName: (NSString *) name location:(NSString *) location date:(NSDate *) date; @end BirdSighting.m #import "BirdSighting.h" @implementation BirdSighting -(id) initWithName:(NSString *)name location:(NSString *)location date:(NSDate *)date { self = [super init]; if(self) { _name = name; _location = location; _date = date; return self; } return nil; } @end BirdSightingDataController.h #import <Foundation/Foundation.h> @class BirdSighting; @interface BirdSightingDataController : NSObject @property (nonatomic, copy) NSMutableArray *masterBirdSightingList; - (NSUInteger) countOfList; - (BirdSighting *) objectInListAtIndex: (NSUInteger) theIndex; - (void) addBirdSightingWithSighting: (BirdSighting *) sighting; @end BirdSightingDataController.m #import "BirdSightingDataController.h" @implementation BirdSightingDataController - (id) init { if(self = [super init]) { NSMutableArray *sightingList = [[NSMutableArray alloc] init]; self.masterBirdSightingList = sightingList; return self; } return nil; } -(NSUInteger) countOfList { return [self.masterBirdSightingList count]; } - (BirdSighting *) objectInListAtIndex: (NSUInteger) theIndex { return [self.masterBirdSightingList objectAtIndex:theIndex]; } - (void) addBirdSightingWithSighting: (BirdSighting *) sighting { [self.masterBirdSightingList addObject:sighting]; } @end And this is where I'm trying to add a BirdSighting instance to the mutable array: #import "BirdsMasterViewController.h" #import "BirdsDetailViewController.h" #import "BirdSightingDataController.h" #import "BirdSighting.h" @implementation BirdsMasterViewController - (void)awakeFromNib { [super awakeFromNib]; BirdSightingDataController *dataController = [[BirdSightingDataController alloc] init]; NSDate *date = [NSDate date]; BirdSighting *sighting = [[[BirdSighting alloc] init] initWithName:@"Ebabil" location:@"Ankara" date: date]; [dataController addBirdSightingWithSighting: sighting]; NSLog(@"dataController: %@", dataController.masterBirdSightingList); self.dataController = dataController; } .......... @end It throws NSInvalidArgumentException in BirdSightingDataController addBirdSightingWithSighting method... What am I doing wrong?

    Read the article

  • How is push()ing and pop()ping defined?

    - by Helper Method
    I know how the push() and pop() methods in a typical implementation of a Queue/Linked List work but what I do want to know is what you actually define as a push or a pop? When can you name a method push()/pop()? What makes the insert()/add() method in a typical Tree implementation not a push()? My understanding is that push()ing means putting something to a position some special pointer is pointing to, and pop()ping an element means putting some object away some pointer is pointing to, but it doesn't seem to be clearly defined. Or does the naming matter at all?

    Read the article

  • C++ Singleton design pattern

    - by Artem Barger
    Recently I've bumped into a realization/implementation of the Singleton design pattern for C++. It has looked like this (I have adopted it from the real life example): // a lot of methods are omitted here class Singleton { public: static Singleton* getInstance( ); ~Singleton( ); private: Singleton( ); static Singleton* instance; }; From this declaration I can deduce that the instance field is initiated on the heap. That means there is a memory allocation. What is completely unclear for me is when exactly the memory is going to be deallocated? Or is there a bug and memory leak? It seems like there is a problem in the implementation. My main question is, how do I implement it in the right way?

    Read the article

  • Basic View Switch Code Crashes iPhone simulator

    - by Ouija
    I've been trying to switch two views from two separate view controllers for a while and it never works, the simulator always crashes to the home screen. I'm using Xcode 3.2.5 and this is my code - SwitchViewsViewController.h #import <UIKit/UIKit.h> #import "SecondViewController.h" @interface SwitchViewsViewController : UIViewController { } -(IBAction)pushButton; @end SwitchViewsViewController.m #import "SwitchViewsViewController.h" #import "SecondViewController.h" @implementation SwitchViewsViewController -(IBAction)pushButton { SecondViewController *screen = [[SecondViewController alloc] initWithNibName:nil bundle:nil screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:screen animated:YES] [screen release]; } SecondViewController.h #import <UIKit/UIKit.h> @interface SecondViewController : UIViewController { } -(IBAction)pushBack; @end SecondViewController.m #import "SecondViewController.h" @implementation SecondViewController -(IBAction)pushBack{ [self dismissModalViewControllerAnimated:YES]; } In interface builder, all i've done is linked the file's owner classes and the buttons. Also made the SwitchViewsViewController load first, and not MainWindow. Everything builds but when I try to run the app it crashes and sends it to the home screen. Can anyone help me with this?

    Read the article

  • What does "static" mean in the context of declaring global template functions?

    - by smf68
    I know what static means in the context of declaring global non-template functions (see e.g. What is a "static" function?), which is useful if you write a helper function in a header that is included from several different locations and want to avoid "duplicate definition" errors. So my question is: What does static mean in the context of declaring global template functions? Please note that I'm specifically asking about global, non-member template functions that do not belong to a class. In other words, what is the difference between the following two: template <typename T> void foo(T t) { /* implementation of foo here */ } template <typename T> static void bar(T t) { /* implementation of bar here */ }

    Read the article

  • Why can't I enforce derived classes to have parameterless constructors?

    - by FrisbeeBen
    I am trying to do the following: public class foo<T> where T : bar, new() { public foo() { _t = new T(); } private T _t; } public abstract class bar { public abstract void someMethod(); // Some implementation } public class baz : bar { public overide someMethod(){//Implementation} } And I am attempting to use it as follows: foo<baz> fooObject = new foo<baz>(); And I get an error explaining that 'T' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method. I fully understand why this must be, and also understand that I could pass a pre-initialized object of type 'T' in as a constructor argument to avoid having to 'new' it, but is there any way around this? any way to enforce classes that derive from 'bar' to supply parameterless constructors?

    Read the article

  • question related to Iphone autorelease usage

    - by user524331
    Could someone help me please understand how allocation and memory management is done and handled in following scenario. i am giving a Psuedo code example and question thats troubling me is inline below: interface first { NSDecimalNumber *number1; } implementation ..... -(void) dealloc { [number1 release]; [super dealloc]; } ================================= interface second { NSDecimalNumber *number2; } implementation second ..... - (First*) check { First *firstObject = [[[First alloc] init] autorelease]; number1 = [[NSDecimalNumber alloc] initWithInteger:0]; **// do i need to autorelease number1 as well?** return firstObject; }

    Read the article

  • GCC compiler -- bug or unspecified behavior?

    - by Jared P
    When I have conflicting definitions of the ivars of a class in objective-c (not redeclaring the class in the same file, but rather naming the same class with diff ivars, no warnings or better yet errors are issued by the compiler. However, both sets of ivars are useable by the appropriate methods in the respective files. For instance Foo.m: @interface foo { int a; } - (int)method; @end @implementation foo - (int)method { return a; } @end Bar.m: @interface foo { float baz; } @end @implementation foo (category) - (float)blah { return baz; } @end compiles without warnings or errors. Is this intentional? Is this an unchecked error? (for the record, a and baz are actually the same memory location.)

    Read the article

  • Is it acceptable to design my GLSurfaceView as a main control class?

    - by Omega
    I'm trying to structure a game I'm making in Android so that I have a sound, flexible design. Right now I'm looking at where I can tie my games rules engine and graphics engine together and what should be in between them. At a glance, I've been eying my implementation of GLSurfaceView, where various screen events are captured. My rationale would be to create an instance of my game engine and graphics engine here and receive events and state changes to trigger updates of either where applicable. Further to this, in the future, the GLSurfaceView implementation could also store stubs for players during a network game and implementations of computer opponents and dispatch them appropriately. Does this seem like a sensible design? Are there any kinds of improvements I can make? Thanks for any input!

    Read the article

  • Should I combine unrelated interfaces into a single library?

    - by mafutrct
    Situation is like this: There are independent 5 services. Each service consists of a project for interface, implementation and test. Example: LocalizationService.Interfaces LocalizationService.Implementation LocalizationService.Test There is a WCF service for each of the services: LocalizationService.WcfContract (including DataContracts) LocalizationService.WcfHost The client applications are probably mostly going to use all of the services. Should I combine all service interfaces into a common one? AllServices.AllInterfaces In my opinion, this is a bad idea. The services are independent and there is no reason to introduce a dependency. I imagine that especially testing becomes more difficult. However, one may argue that having to include 5 libraries is too much of a hassle. (I'm not sure how to tag this. Feel free to retag.)

    Read the article

  • Reflection alternative for switch on enum in order to select namespace/class

    - by Am
    Hi, I have an interface named IHarvester. There are 3 implementations of that interface, each under their own namespace: Google Yahoo Bing A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations. I want some way of letting the class user say in which harvester it wants to use. And in the code select that implementation, without a switch-case implementation. Can reflection save my day? Here is the code bits: // repeat for each harvester namespace Harvester.Google { public abstract class Fetcher : BaseHarvester, IInfoHarvester {...} } public enum HarvestingSource { Google, Yahoo, Bing, } class HarvesterManager { public HarvestingSource PreferedSource {get;set;} public HarvestSomthing() { switch (PreferedSource) .... // awful... } } Thanks. I will give my 2 cents of why I want to change this. There several people writing harvesters, I want them to focus only on building more harvesters, without ever needing to update the enum, or at worst, update only the enum.

    Read the article

  • return only one document for each filter defined in the query

    - by Garytxo
    Hi all, In one of my latest projects I use Solr 1.4 for searching products.However I have ran into a slight problem, which I aint sure if its possible to do using Solr. All products are indexed by "country" and "category" and the "id", "class" and "description" are stored values. I now have been requested to extract a sample list of products that we have for a give "category" and "ONLY RETURNING ONE" product for each country where the product is available. In my current implementation, I have a dismax query to get a list of all the countries that correspond to the catergory, then I call again solr to extract all products for each country, limiting the no. rows by the size of the countries found in the previous query. The problem I have with this current implementation is I can not be certain that I have one product for each country in the list. Therefore would anyone know if it possible to tell solr that you want only one product per country provided in the query? Any guidance would be useful.

    Read the article

  • why can't you use the debug/release version of a lib interchangeably

    - by user205834
    In C++, most of the libs come in Debug/Release versions. Question 1. What are the big difference between Debug and Release versions (e.g. what advantages do you have using one versus the other). Question 2. A lib is just has an implementation of the functions, how does a function implementation change if you are using debug/release versions? Question 3. Can you ever build your app in debug mode and use a release version of a lib? Thanks.

    Read the article

  • The pImpl idiom and Testability

    - by Rimo
    The pImpl idiom in c++ aims to hide the implementation details (=private members) of a class from the users of that class. However it also hides some of the dependencies of that class which is usually regarded bad from a testing point of view. For example if class A hides its implementation details in Class AImpl which is only accessible from A.cpp and AImpl depends on a lot of other classes, it becomes very difficult to unit test class A since the testing framework has no access to the methods of AImpl and also no way to inject dependency into AImpl. This has been a problem for me lately and I am beginning to think that the pImpl idiom and writing testable code don't mix well. Has anyone come across this problem before? and have you found a solution?

    Read the article

  • Abstract class and operator!= in c++

    - by Alessandro Teruzzi
    Hi All, I have problem implementing the operator!= in a set class deriving from an abstact one. The code looks like this: class Abstract { public: //to make the syntax easier let's use a raw pointer virtual bool operator!=(const Abstract* other) = 0; }; class Implementation { SomeObject impl_; //that already implement the operator!= public: bool operator!=(const Abstract* other) { return dynamic_cast<Implementation*>(other)->impl_ != this->impl_; } }; This code works but it has the drawback to use dynamic_cast and I need to handle error in casting operation. This is a generic problem that occur when a function of a concrete class it is trying to using some internal information (not available at the abstract class level) to perform a task. Is there any better way to solve this kind of problem? Cheers

    Read the article

  • jQuery .html() vs .text() produce different result in .hover() function

    - by Paddy
    I have a issue where in I am using the .hover() function. If I use .text() fuction to add the html (anchor tag) which I am dynamically creating, it works fine, both the functions are called as desired. But when I use the .html() function instead then the second fuction of .hover() is never been called. var i = 0; textItems = new Array(); ////I am putting the value into textItems using the jquery ajax call ////and i get its value from a .each() function. //.text() implementation $('#textArea-id').hover( function() { $('#textArea-id').text(textItems[i]); }, function() { //-->mouseout function is called here } ); //.html() implementation $('#textArea-id').hover( function() { $('#textArea-id').html(textItems[i]); }, function() { //-->mouseout function is never been called } );

    Read the article

  • C#: Converting string to namespace

    - by Am
    Hi, I have an interface named IHarvester. There are 3 implementations of that interface, each under their own namespace: Google Yahoo Bing A HarvesterManager uses the given harvester. It knows the interface and all 3 implementations. I want some way of letting the class user say in which harvester it wants to use. And in the code select that implementation, without a switch-case implementation. Can reflection save my day? Here is the code bits: // repeat for each harvester namespace Harvester.Google { public abstract class Fetcher : BaseHarvester, IInfoHarvester {...} } public enum HarvestingSource { Google, Yahoo, Bing, } class HarvesterManager { public HarvestingSource PreferedSource {get;set;} public HarvestSomthing() { switch (PreferedSource) .... // awful... } } Thanks.

    Read the article

  • C# Why does calling an interface member from a class generate an error?

    - by Jack
    So I have an interface: interface IFoo { int Bar(); int this[int i] {get; set;} } And a class that derives from it class Foo : IFoo { public int IFoo.Bar() { //Implementation { public int IFoo.this[int i] { //Implementation } } Now, I try to do this: var fooey = new Foo(); int i = Fooey.Bar(); or this: int i = Fooey[4]; I would expect these to work properly. However, the compiler generates an error as if such members don't exist. Why is that? I am aware I can cast Foo as IFoo, but I am also aware that casting is costly to performance, which is often the reason to use interfaces in the first place. EDIT 1: These are the errors generated 'Foo' does not contain a definition for 'Bar' and no extension method 'Bar' accepting a first argument of type 'Foo' could be found (are you missing a using directive or an assembly reference?) "Cannot apply indexing to an expression of type 'Foo'"

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >