Search Results

Search found 958 results on 39 pages for 'extending'.

Page 6/39 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Problem with entityForName & ManagedObjectContext when extending tutorial material

    - by Martin KS
    Afternoon all, I tried to add a second data entity to the persistent store in the (locations) coredata tutorial code, and then access this in a new view. I think that I've followed the tutorial, and checked that I'm doing a clean build etc, but can't see what to change to prevent it crashing. I'm afraid I'm at my wits end with this one, and can't seem to find the step that I've missed. I've pasted the header and code files below, please let me know if I need to share any more of the code. The crash seems to happen on the line: NSEntityDescription *entity = [NSEntityDescription entityForName:@"Album" inManagedObjectContext:[self managedObjectContext]]; There is one other line in the code that refers to galleryviewcontroller at the moment, and that's in the main application delegate: galleryViewController.managedObjectContext = [self managedObjectContext]; GalleryViewController.h #import <UIKit/UIKit.h> @interface GalleryViewController : UIViewController { NSManagedObjectContext *managedObjectContext; int rowNumber; IBOutlet UILabel *lblMessage; UIBarButtonItem *addButton; NSMutableArray *imagesArray; } @property (readwrite) int rowNumber; @property (nonatomic,retain) UILabel *lblMessage; @property (nonatomic,retain) NSMutableArray *imagesArray; @property (nonatomic, retain) NSManagedObjectContext *managedObjectContext; @property (nonatomic, retain) UIBarButtonItem *addButton; -(void)updateRowNumber:(int)theIndex; -(void)addImage; @end GalleryViewController.m #import "RootViewController.h" #import "LocationsAppDelegate.h" #import "Album.h" #import "GalleryViewController.h" #import "Image.h" @implementation GalleryViewController @synthesize lblMessage,rowNumber,addButton,managedObjectContext; @synthesize imagesArray; /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { // Custom initialization } return self; } */ -(void)updateRowNumber:(int)theIndex{ rowNumber=theIndex; LocationsAppDelegate *mainDelegate =(LocationsAppDelegate *)[[UIApplication sharedApplication] delegate]; Album *anAlbum = [mainDelegate.albumsArray objectAtIndex:rowNumber]; lblMessage.text = anAlbum.uniqueAlbumIdentifier; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addImage)]; addButton.enabled = YES; self.navigationItem.rightBarButtonItem = addButton; /* Found this in another answer, adding it to the code didn't help. if (managedObjectContext == nil) { managedObjectContext = [[[UIApplication sharedApplication] delegate] managedObjectContext]; } */ NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Album" inManagedObjectContext:[self managedObjectContext]]; [request setEntity:entity]; // Order the albums by creation date, most recent first. NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"imagePath" ascending:NO]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [request setSortDescriptors:sortDescriptors]; [sortDescriptor release]; [sortDescriptors release]; // Execute the fetch -- create a mutable copy of the result. NSError *error = nil; NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; if (mutableFetchResults == nil) { // Handle the error. } [self setImagesArray:mutableFetchResults]; int a = 5; int b = 10; for( int i=0; i<[imagesArray count]; i++ ) { if( a == 325 ) { a = 5; b += 70; } UIImageView *any = [[UIImageView alloc] initWithFrame:CGRectMake(a,b,70,60)]; any.image = [imagesArray objectAtIndex:i]; any.tag = i; [self.view addSubview:any]; [any release]; a += 80; } } -(void)addImage{ NSString *msg = [NSString stringWithFormat:@"%i",rowNumber]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Add image to" message:msg delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil]; [alert show]; [alert release]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; } - (void)dealloc { [lblMessage release]; [managedObjectContext release]; [super dealloc]; } @end

    Read the article

  • Extending Throwable in Java

    - by polygenelubricants
    Java lets you create an entirely new subtype of Throwable, e.g: public class FlyingPig extends Throwable { ... } Now, very rarely, I may do something like this: throw new FlyingPig("Oink!"); and of course elsewhere: try { ... } catch (FlyingPig porky) { ... } My questions are: Is this a bad idea? And if so, why? What could've been done to prevent this subtyping if it is a bad idea? Since it's not preventable (as far as I know), what catastrophies could result? If this isn't such a bad idea, why not? How can you make something useful out of the fact that you can extends Throwable?

    Read the article

  • Trouble Extending Network with Apple Airport Extreme (PC won't connect with Ethernet)

    - by 0x783czar
    So I have an Apple Airport Extreme base station that I use to create a wifi network at my house. But on a separate story from this station i have a PC (running Windows 7) that does not have a wireless card. Luckily, I have another Airport Extreme Base Station, so I figured I'd have my second station "extend" the existing network. I asked Apple if this was possible, which it was, and walked through the setup wizard to extend the network. Then I ran an ethernet cable from the Station to my PC. However the PC refuses to connect to the Internet. It says it can access the network, "Unidentified Network (Limited Connectivity)", but that's it. It tells me that my computer does not have an IP address. I tried running the cable to another computer (my Apple MacBook Pro) and got a similar error. Any thoughts?

    Read the article

  • Extending the SketchFlow player

    - by Aravind
    I would like to add some controls to the SketchFlow player. For example, I would like to add a combo box with a list of values for a specific variable, and selecting a value will make a specific screen/state show up in the SketchFlow player canvas. Is this possible? I have seen that using the PlayerContext allows access to some controls/events in the Player, but I am not sure how extensible the Player itself is.

    Read the article

  • Extending Java Enums

    - by CaseyB
    Here's what I am looking to accomplish, I have a class that has an enum of some values and I want to subclass that and add more values to the enum. This is a bad example, but: public class Digits { public enum Digit { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } } public class HexDigits extends Digits { public enum Digit { A, B, C, D, E, F } } so that HexDigits.Digit contains all Hex Digits. Is that possible?

    Read the article

  • Extending Controller

    - by MakDotGNU
    Hi, I'm very new to Kohana and I'm trying to make a project in kohana 2.x, in my previous projects i had created a Base controller which used to extends Controller. and all other controller to Base_Controller. in Kohana I'm facing the problem. here is my structure. class Base_Controller extends Template_Controller class Home_Controller extends Base_Controller both these Controllers are in application/controller folder Fatal error: Class 'Base_Controller' not found in /home/myadav/public_html/innteract/innteract/controllers/home.php on line 2

    Read the article

  • Extending configuration for .Net 3.5 Applications

    - by Maximiliano Rios
    Due to a requirement in my current project, I have to build a configuration manager to handle configurations that merge local config info with database one. Custom configuration doesn't fit my needs, problem is that I don't know what's the type before loading certain information, for example: Loading database information I will able to know what's myhandler's type. Not previously. So I thought to write my own handler but I can't let set blank as type for sections, in fact .net requires to know what's the type to match myhandler nodes. I'm thinking on building a different parser to read XML nodes but I would prefer to match this structure. I've not found any information to do that yet, is there any way? Can I extend or hook up something into the framework to be capable of loading on-the-fly types and validate nodes? Thanks in advance.

    Read the article

  • Reporting framework for extending definition & execution to the end users (ASP.Net)

    - by Kabeer
    Hello. My application is a product which will have reporting capabilities. The product, when in production, is expected to have several ad-hoc report defined by the end users. I am looking for a platform that can be tailored to harness the business entities and extend reporting capabilities (definition & execution) to the end user. Here are some constraints: From the usability standpoint, I like what MS Access reports offer. But of course it is not suitable for the target web application. However, it certainly is a source of inspiration usability wise. Cost is a constraint. So something recommended from open source world will be appreciated. Otherwise too I'd like to know. The product in question is somewhat 'generic' in nature. Mine is a ASP.Net platform.

    Read the article

  • Extending Object in Javasript

    - by smsteel
    I'm trying to extend Object functionality this way: Object.prototype.get_type = function() { if(this.constructor) { var r = /\W*function\s+([\w\$]+)\(/; var match = r.exec(this.constructor.toString()); return match ? match[1].toLowerCase() : undefined; } else { return typeof this; } } It's great, but there is a problem: var foo = { 'bar' : 'eggs' }; for(var key in foo) { alert(key); } There'll be 3 passages of cycle. Is there any way to avoid this?

    Read the article

  • Extending an entity

    - by Kim L
    I have class named AbstractUser, which is annotated with @MappedSuperclass. Then I have a class named User (@Entity) which extends AbstractUser. Both of these exist in a package named foo.bar.framework. When I use these two classes, everything works just fine. But now I've imported a jar containing these files to another project. I'd like to reuse the User class and expand it with a few additional fields. I thought that @Entity public class User extends foo.bar.framework.User would do the trick, but I found out that this implementation of the User only inherits the fields from AbstractUser, but nothing from foo.bar.framework.User. The question is, how can I get my second User class to inherit all the fields from the first User entity class? Both User class implementation have different table names defined with @Table(name = "name").

    Read the article

  • Trouble extending event log messages

    - by Matt H
    Hi. I'm trying to add some extended error codes to the event log but I get the following error. The description for Event ID ( 109 ) in Source ( PumpServer ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: The event log file is corrupt.. The message file looks like this and I added the one on the end:- <---snip---> MessageId= SymbolicName=EVMSG_BADREQUEST Language=English The service received an unsupported request. . MessageId= SymbolicName=EVMSG_DEBUG Language=English %1 . MessageId= SymbolicName=EVMSG_STOPPED Language=English The service was stopped. . MessageId= SymbolicName=EVMSG_INVALIDLICENCE Language=English The service does not have a valid licence. Initialization failed. . It compiles fine. The mc program is running over this file and producing a header file of the same name with my new message id showing. // // MessageId: EVMSG_INVALIDLICENCE // // MessageText: // // The service does not have a valid licence. Initialization failed. // #define EVMSG_INVALIDLICENCE 0x0000006DL Any ideas why it's not finding my message? All the others work.

    Read the article

  • Extending the IndexController with a BaseController in Zend

    - by BillA
    I'm trying to extend my controllers with a global base controller as such: class BaseController extends Zend_Controller_Action { // common controller actions public function listAction() { // do stuff } } class IndexController extends BaseController { // index controller specific actions } class LoginController extends BaseController { // login controller specific actions } But I get this error: PHP Fatal error: Class 'BaseController' not found in /var/www/Zend/project/application/controllers/IndexController.php on line 3 Any ideas on how to get Zend to "see" this controller?

    Read the article

  • Using ControllerClassNameHandlerMapping with @Controller and extending AbstractController

    - by whiskerz
    Hey there, actually I thought I was trying something really simple. ControllerClassNameHandlerMapping sounded great to produce a small spring webapp using a very lean configuration. Just annotate the Controller with @Controller, have it extend AbstractController and the configuration shouldn't need more than this <context:component-scan base-package="test.mypackage.controller" /> <bean id="urlMapping" class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" /> to resolve my requests and map them to my controllers. I've mapped the servlet to "*.spring", and calling <approot>/hello.spring All I ever get is an error stating that no mapping was found. If however I extend the MultiActionController, and do something like <approot>/hello/hello.spring it works. Which somehow irritates me, as I would have thought that if that is working, why didn't my first try? Does anyone have any idea? The two controllers I used looked like this @Controller public class HelloController extends AbstractController { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView modelAndView = new ModelAndView("hello"); modelAndView.addObject("message", "Hello World!"); return modelAndView; } } and @Controller public class HelloController extends MultiActionController { public ModelAndView hello(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView modelAndView = new ModelAndView("hello"); modelAndView.addObject("message", "Hello World!"); return modelAndView; } }

    Read the article

  • Extending both T and SomeInterface<T> in Java

    - by Graeme Moss
    I want to create a class that takes two parameters. One should be typed simply as T. The other should be typed as something that extends both T and SomeInterface. When I attempt this with public class SomeClass<T, S extends SomeInterface<T> & T> then Java complains with "The type T is not an interface; it cannot be specified as a bounded parameter" and if instead I attempt to create an interface for S with public interface TandSomeInterface<T> extends SomeInterface<T>, T then Java complains with "Cannot refer to the type parameter T as a supertype" Is there any way to do this in Java? I think you can do it in C++...?

    Read the article

  • Redirecting to a Facelet is not working when extending FaceletViewHandler

    - by Abel Morelos
    I'm overriding the handleRenderResponse method defined in com.sun.facelets.FaceletViewHandler: protected void handleRenderException(FacesContext context, Exception ex) I'm overriding this method so I can redirect the user to a custom error page (which contain the desired look and feel and other stuff). This is the way I'm trying to String errorPage = "/error.xhtml"; String contextPath = context.getExternalContext().getRequestContextPath(); String errorPagePath = contextPath+errorPage; context.getExternalContext().redirect(errorPagePath); The previous code is what I'm using to perform the redirect to this custom error page. Anyway, when I perform the redirect I'm prompted with a download dialog (this is with Internet Explorer, in Firefox the page does not display properly or as I would expect). I tried changing "/error.xhtml" to "/error.jsf" but in that case I get a 404 error. Somehow I think that the XHTML file is not being handled to the Facelets ViewHandler after the redirect, if I open the downloaded xhtml file I can see that the EL expressions were not resolved and the the ui tags were not handled. I don't have problems with other pages in my application, only when doing the redirect programatically. Important data from my web.xml: facelets.VIEW_MAPPINGS is set to *.xhtml javax.faces.DEFAULT_SUFFIX is set to .xhtml servlet-mapping for the "Faces Servlet" is ".jsf" and "/faces/"

    Read the article

  • Extending Enums, Overkill?

    - by CkH
    I have an object that needs to be serialized to an EDI format. For this example we'll say it's a car. A car might not be the best example b/c options change over time, but for the real object the Enums will never change. I have many Enums like the following with custom attributes applied. public enum RoofStyle { [DisplayText("Glass Top")] [StringValue("GTR")] Glass, [DisplayText("Convertible Soft Top")] [StringValue("CST")] ConvertibleSoft, [DisplayText("Hard Top")] [StringValue("HT ")] HardTop, [DisplayText("Targa Top")] [StringValue("TT ")] Targa, } The Attributes are accessed via Extension methods: public static string GetStringValue(this Enum value) { // Get the type Type type = value.GetType(); // Get fieldinfo for this type FieldInfo fieldInfo = type.GetField(value.ToString()); // Get the stringvalue attributes StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes( typeof(StringValueAttribute), false) as StringValueAttribute[]; // Return the first if there was a match. return attribs.Length > 0 ? attribs[0].StringValue : null; } public static string GetDisplayText(this Enum value) { // Get the type Type type = value.GetType(); // Get fieldinfo for this type FieldInfo fieldInfo = type.GetField(value.ToString()); // Get the DisplayText attributes DisplayTextAttribute[] attribs = fieldInfo.GetCustomAttributes( typeof(DisplayTextAttribute), false) as DisplayTextAttribute[]; // Return the first if there was a match. return attribs.Length > 0 ? attribs[0].DisplayText : value.ToString(); } There is a custom EDI serializer that serializes based on the StringValue attributes like so: StringBuilder sb = new StringBuilder(); sb.Append(car.RoofStyle.GetStringValue()); sb.Append(car.TireSize.GetStringValue()); sb.Append(car.Model.GetStringValue()); ... There is another method that can get Enum Value from StringValue for Deserialization: car.RoofStyle = Enums.GetCode<RoofStyle>(EDIString.Substring(4, 3)) Defined as: public static class Enums { public static T GetCode<T>(string value) { foreach (object o in System.Enum.GetValues(typeof(T))) { if (((Enum)o).GetStringValue() == value.ToUpper()) return (T)o; } throw new ArgumentException("No code exists for type " + typeof(T).ToString() + " corresponding to value of " + value); } } And Finally, for the UI, the GetDisplayText() is used to show the user friendly text. What do you think? Overkill? Is there a better way? or Goldie Locks (just right)? Just want to get feedback before I intergrate it into my personal framework permanently. Thanks.

    Read the article

  • Best practices for extending third party databases?

    - by Eric Watkins
    I have a situation where our developers extended a Third party database (MS SQL) by adding tables, views, stored procedures, and functions. Recently when the vender issued updates to the database they dropped all of our custom objects. The question now is what are some best practices that will allow us to extend the third party database but keep our objects safe from future updates? My first thought is to create a separate database but then I’m stuck with fully qualifying all the references back to the original database which may cause issues promoting database changes from test to production.

    Read the article

  • Extending rst container to output extra div attributes

    - by Manwe
    I'm starting to use pelican with reStructuredText rst page format. I have custom javascript (jQuery) things that I'd like to control with div attributes like data-default-tpl="basename" with nested content. What to extend and what. I've looked at Directives and nodes, but I just can't wrap my head around how to do it. .. rstdiv:: class1 class2 :name: namessid :extra: thisIsMyextra .. rstdiv:: nested class3 :name: nestedid :extra: data-default-tpl="basename" some text .. container:: This is normal rst container :name: contid text From rst to html with pelican. <div id="nameisid" class="class1 class2" thisIsMyextra> <div id="nestedid" class="nested class3" data-default-tpl="basename"> some text </div> </div> <div id="contid" class="container This is normal rst container"> text </div>

    Read the article

  • Java: extending Object class

    - by Fabio F.
    Hello, I'm writing (well, completing) an "extension" of Java which will help role programming. I translate my code to Java code with javacc. My compilers add to every declared class some code. Here's an example to be clearer: MyClass extends String implements ObjectWithRoles { //implements... is added /*Added by me */ public setRole(...){...} public ... /*Ends of stuff added*/ ...//myClass stuff } It adds Implements.. and the necessary methods to EVERY SINGLE CLASS you declare. Quite rough, isnt'it? It will be better if I write my methods in one class and all class extends that.. but.. if class already extends another class (just like the example)? I don't want to create a sort of wrapper that manage roles because i don't want that the programmer has to know much more than Java, few new reserved words and their use. My idea was to extends java.lang.Object.. but you can't. (right?) Other ideas? I'm new here, but I follow this site so thank you for reading and all the answers you give! (I apologize for english, I'm italian)

    Read the article

  • extending urlize in django

    - by hymloth
    the urlize function from django.utils.html converts urls to clickable links. My problem is that I want to append a target="_blank" into the "< href..", so that I open this link in a new tab. Is there any way that I can extend the urlize function to receive an extra argument? or should I make a custom filter using regexes to do this stuff? Is this efficient?

    Read the article

  • Problem with extending JPanel

    - by Halo
    I have an abstract entity: public abstract class Entity extends JPanel implements FocusListener And I have a TextEntity: public class TextEntity extends Entity Inside TextEntity's constructor I want to put a JTextArea that will cover the panel: textArea = new JTextArea(); textArea.setSize(getWidth(),getHeight()); add(textArea); But getWidth() and getHeight() returns 0. Is it a problem with the inheritance or the constructor?

    Read the article

  • Extending existing Class in Symfony

    - by Dar Hamid
    I am new to symfony. I have created a registration form using the code: $user = new Register(); $form = $this->createForm(new RegisterType(), $user); In the RegisterType class i have 5 fields (for example).I store the values in database when the user registers with the system. Now I display the EDIT page using following code: $user = $em->getRepository('MysiteUserBundle:Register')->find($id); $form = $this->createForm(new RegisterType(), $user); The problem with the EDIT code however is that it displays me all of the fields mentioned in RegisterType class.Is it possible to display only some fields. If yes how can this be achieved. Any help will be appreciated

    Read the article

  • Is extending a base class with non-virtual destructor dangerous in C++

    - by Akusete
    Take the following code class A { }; class B : public A { }; class C : public A { int x; }; int main (int argc, char** argv) { A* b = new B(); A* c = new C(); //in both cases, only ~A() is called, not ~B() or ~C() delete b; //is this ok? delete c; //does this line leak memory? return 0; } when calling delete on a class with a non-virtual destructor with member functions (like class C), can the memory allocator tell what the proper size of the object is? If not, is memory leaked? Secondly, if the class has no member functions, and no explicit destructor behaviour (like class B), is everything ok? I ask this because I wanted to create a class to extend std::string, (which I know is not recommended, but for the sake of the discussion just bear with it), and overload the +=,+ operator. -Weffc++ gives me a warning because std::string has a non virtual destructor, but does it matter if the sub-class has no members and does not need to do anything in its destructor? -- FYI the += overload was to do proper file path formatting, so the path class could be used like class path : public std::string { //... overload, +=, + //... add last_path_component, remove_path_component, ext, etc... }; path foo = "/some/file/path"; foo = foo + "filename.txt"; //and so on... I just wanted to make sure someone doing this path* foo = new path(); std::string* bar = foo; delete bar; would not cause any problems with memory allocation

    Read the article

  • Weird syntax for extending jQuery

    - by cantabilesoftware
    I recently saw this code on another post ( http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area ) new function($) { $.fn.setCursorPosition = function(pos) { // function body omitted, not relevant to question } } (jQuery); After too long trying to understand what it was doing I finally figured out that it's just creating a new function with a parameter $ and then invoking it with jQuery as the parameter value. So actually, it's just doing this: jQuery.fn.setCursorPosition = function(pos) { // function body omitted, not relevant to question } What's the reason for the original, more confusing version?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >