Search Results

Search found 817 results on 33 pages for 'overriding'.

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

  • Adobe After Effects Plugin With Cocoa (Overriding malloc)

    - by mustISignUp
    Messing about a bit, i have a working Adobe After Effects plugin with a bit of Obj-c / Cocoa in it (NSArray and custom objects - not ui stuff). The SDK guide states:- Always use After Effects memory allocation functions. In low-memory conditions (such as during RAM preview), it’s very important that plug-ins not compete with After Effects for OS memory, and deal gracefully with out-of-memory conditions. Failing to use our functions can cause lock-ups, crashes, and tech support calls. Don’t do that. If you’re wrapping existing C++ code, overloading new and delete to use our functions will save substantial reimplementation. On Windows, derive all classes from a common base class which implements new and delete. so my question.. is something compatible with the above statement possible in Obj-c?

    Read the article

  • overriding previously-bound click events

    - by JamesBrownIsDead
    When I use this code with an element whose id is "foobar": $("#foobar").click(function () { alert("first"); }); $("#foobar").click(function () { alert("second"); }); I get two alerts: "first" and "second" second. How do I specify a click event that also clears out any previous click events attached to the element? I want the last $("#foobar").click(...) to erase any previously bound events.

    Read the article

  • Best practise for overriding static classes

    - by maxp
    As it is not possible to override a static class in c#, if i want to override a method I generally define a delegate matching the signature of the static method, then modify the method along the lines of: public static void foo(int bar) { if (delegatename!=null) { delegatename.Invoke(bar); } else { //execute previous code as normal } } I feel a twinge of guilt, knowing this is a bit messy. Can anyone suggest a neater solution to this problem (other than rewriting the original structure)

    Read the article

  • Django: Overriding ModelAdmin save_model not working

    - by tufelkinder
    Even after obj.save(), the obj still does not have an id, so I cannot access or manipulate the m2m records. Just keep getting a "instance needs to have a primary key value before a many-to-many relationship can be used" error. def save_model(self, request, obj, form, change): obj.save() # this doesn't work super(Table2Admin, self).save_model(request, obj, form, change) # still doesn't save for tb1 in obj.table1.all: tb1_obj = ThroughTable.objects.get(table1=bk, table2=obj) # do other stuff What am I doing wrong? Why do I need to do to save this model?

    Read the article

  • Overriding properties of child view controller vs setting them via parent view controller

    - by robinjam
    If you want to modify the default behaviour of a View Controller by changing the value of one of its properties, is it considered better form to instantiate the class and set its property directly, or subclass it and override the property? With the former it would become the parent View Controller's responsibility to configure its children, whereas with the latter the children would effectively configure themselves. EDIT: Some more information: The class I am referring to is FetchedTableViewController, a subclass of UITableViewController that I made to display the results of a Core Data fetch operation. There are two places I want to display the results of a fetch, and they each have different fetch requests. I'm trying to decide whether it's better to create a subclass for each one, and override the fetchRequest property, or make it the responsibility of the parent controller to set the fetchRequest property for its children.

    Read the article

  • Django Database design -- Is this a good stragety for overriding defaults

    - by rh0dium
    Hi SO's I have a question on good database design practices and I would like to leverage you guys for pointers. The project started out simple. Hey we have a bunch of questions we want answered for every project (no problem) Which turned into... Hey we have so many questions can we group them into sections (yup we can do that) Which lead into.. Can we weight these questions and I don't really want some of these questions for my project (Yes but we are getting difficult) And then I'm thinking they will want to have each section have it's own weight.. Requirements So there's the requirements - For n number of project Allow a admin member the ability select the questions for a project Allow the admin member to re-weigh or use the default weights for the questions Allow the admin member to re-weight the sections Allow team members to answer the questions. So here is what I came up with. Please feel free to comment and provide better examples models.py from django.db import models from django.contrib.sites.models import Site from django.conf import settings class Section(models.Model): """ This describes the various sections for a checklist: """ name = models.CharField(max_length=64) description = models.TextField() class Question(models.Model): """ This simply provides a simple way to list out the questions. """ question = models.CharField(max_length=255) answer_type = models.CharField(max_length=16) description = models.TextField() section = models.ForeignKey(Section) class ProjectQuestion(models.Model): """ These are the questions relevant to the project """ question = models.ForeignKey(Question) answer = models.CharField(max_length=255) required = models.BooleanField(default=True) weight = models.FloatField(default = XXX) class Project(models.Model): """ Here is where we want to gather our questions """ questions = models.ManyToManyField(ProjectQuestion) Immediate questions: - When I start a project - any ideas on how to "pre-populate" the questions (and ultimately the weights) for the project? - Is there a generally accepted method for doing this process that I am missing? Basically the idea that you refer to the questions overide your own default weight, and store the answer? - It appears that a good chuck of the work will be done in the views and that a lot of checking will need to occur there? Is that OK? Again - feel free to give me better strategies!! Thanks

    Read the article

  • Overriding PEAR error handler

    - by Rolf
    Hi everyone, I'm currently working on an application that requires lots of external libraries. My job right now is set a unique error handler that will manage every error. So far, I found 7 different types of PEAR errors: PEAR_ERROR_RETURN: PEAR_ERROR_EXCEPTION: PEAR_ERROR_CALLBACK: PEAR_ERROR_EXCEPTION: PEAR_ERROR_PRINT: PEAR_ERROR_TRIGGER: PEAR_ERROR_DIE: I want to handle only the serious error (like the native E*_ERROR). The only problem is I have absolutely no idea about PEAR error criticity ! Those names are more related to the way of handling them than to their seriousness... Is there a real documentation about it ? I guess a better solution would consist in using their pushErrorHandling, but I just don't understand how to use it... If someone here knows, I'd be grateful... Thanks in advance !

    Read the article

  • Dynamically overriding an abstract method in c#

    - by ng
    I have the following abstract class public abstract class AbstractThing { public String GetDescription() { return "This is " + GetName(); } public abstract String GetName(); } Now I would like to implement some new dynamic types from this like so. AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "My.TempAssembly"; AssemblyBuilder assemblyBuilder = Thread.GetDomain().DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("DynamicThings"); TypeBuilder typeBuilder = moduleBuilder.DefineType(someName + "_Thing", TypeAttributes.Public | TypeAttributes.Class, typeof(AbstractThing)); MethodBuilder methodBuilder = typeBuilder.DefineMethod("GetName", MethodAttributes.Public | MethodAttributes.ReuseSlot | MethodAttributes.Virtual | MethodAttributes.HideBySig, null, Type.EmptyTypes); ILGenerator msil = methodBuilder.GetILGenerator(); msil.EmitWriteLine(selectionList); msil.Emit(OpCodes.Ret); However when I try to instantiate via typeBuilder.CreateType(); I get an exception saying that there is no implementation for GetName. Is there something I am doing wrong here. I can not see the problem. Also, what would be the restrictions on instantiating such a class by name? For instance if I tried to instantiate via "My.TempAssembly.x_Thing" would it be availble for instantiation without the Type generated?

    Read the article

  • Overriding disabled input and textarea with CSS

    - by igluratds
    Hi, Im trying to override the grey text of a disabled input and textarea. At the moment Im only really concerned with it working in Webkit and Mozilla. At the moment Im currently using every trick in the book that I know of: input[@disabled=true], input[@disabled], button[disabled]:active, button[disabled], input[type="reset"][disabled]:active, input[type="reset"][disabled], input[type="button"][disabled]:active, input[type="button"][disabled], select[disabled] > input[type="button"], select[disabled] > input[type="button"]:active, input[type="submit"][disabled]:active, input[type="submit"][disabled],input[disabled="disabled"], input[disabled] { color: black !important; } Sure it does change the colour if I change it to something else, however when I choose black it is still greyed out a bit. Any ideas? I am using Ext JS if I can use that to manipulate it. Thanks.

    Read the article

  • Overriding constructors

    - by demas
    Here is sample code: class One def initialize(*args) case args.size when 0 puts "one initialize" when 1 puts "one initialize #{args[0]}" end end end class Two def initialize(*args) if args.size == 2 then puts "two initialize #{args[0]} and #{args[1]}" else super(args) end end end one = One.new one = One.new("thing") two = Two.new("some", "other") two = Two.new("some") Now I'm launching the code and getting the error message: [[email protected]][~/temp]% ruby test2.rb one initialize one initialize thing two initialize some and other test2.rb:17:in `initialize': wrong number of arguments(1 for 0) (ArgumentError) from test2.rb:17:in `initialize' from test2.rb:26:in `new' from test2.rb:26:in `<main>' How can I call parent's constructor from class Two ?

    Read the article

  • The new operator in C# isn't overriding base class member

    - by Dominic Zukiewicz
    I am confused as to why the new operator isn't working as I expected it to. Note: All classes below are defined in the same namespace, and in the same file. This class allows you to prefix any content written to the console with some provided text. public class ConsoleWriter { private string prefix; public ConsoleWriter(string prefix) { this.prefix = prefix; } public void Write(string text) { Console.WriteLine(String.Concat(prefix,text)); } } Here is a base class: public class BaseClass { protected static ConsoleWriter consoleWriter = new ConsoleWriter(""); public static void Write(string text) { consoleWriter.Write(text); } } Here is an implemented class: public class NewClass : BaseClass { protected new static ConsoleWriter consoleWriter = new ConsoleWriter("> "); } Now here's the code to execute this: class Program { static void Main(string[] args) { BaseClass.Write("Hello World!"); NewClass.Write("Hello World!"); Console.Read(); } } So I would expect the output to be Hello World! > Hello World! But the output is Hello World Hello World I do not understand why this is happening. Here is my thought process as to what is happening: The CLR calls the BaseClass.Write() method The CLR initialises the BaseClass.consoleWriter member. The method is called and executed with the BaseClass.consoleWriter variable Then The CLR calls the NewClass.Write() The CLR initialises the NewClass.consoleWriter object. The CLR sees that the implementation lies in BaseClass, but the method is inherited through The CLR executes the method locally (in NewClass) using the NewClass.consoleWriter variable I thought this is how the inheritance structure works? Please can someone help me understand why this is not working?

    Read the article

  • IronPython overriding __setattr__ and __getattr__

    - by yodaj007
    I'm trying to implement a class in C# with a method that intercepts the Python __setattr__ and __getattr__ magic methods. I found this bug report: http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=8143 But that is from 2008, and nowhere can I find ICustomAttributes or PythonNameAttribute. I don't see anything useful in Interfaces.cs either. Can someone point me in the right direction?

    Read the article

  • Overriding content_type for Rails Paperclip plugin

    - by Fotios
    I think I have a bit of a chicken and egg problem. I would like to set the content_type of a file uploaded via Paperclip. The problem is that the default content_type is only based on extension, but I'd like to base it on another module. I seem to be able to set the content_type with the before_post_process class Upload < ActiveRecord::Base has_attached_file :upload before_post_process :foo def foo logger.debug "Changing content_type" #This works self.upload.instance_write(:content_type,"foobar") # This fails because the file does not actually exist yet self.upload.instance_write(:content_type,file_type(self.upload.path) end # Returns the filetype based on file command (assume it works) def file_type(path) return `file -ib '#{path}'`.split(/;/)[0] end end But...I cannot base the content type on the file because Paperclip doesn't write the file until after_create. And I cannot seem to set the content_type after it has been saved or with the after_create callback (even back in the controller) So I would like to know if I can somehow get access to the actual file object (assume there are no processors doing anything to the original file) before it is saved, so that I can run the file_type command on that. Or is there a way to modify the content_type after the objects have been created.

    Read the article

  • Overriding an ActiveRecord attribute

    - by jspooner
    I have a model with a completed:boolean column that I'd like override so I can add some conditional code. I've never override an ActiveRecord attribute before and wanted to know if the method below is good practice? class Article < ActiveRecord::Base def completed=(b) write_attribute(:completed, b) # IF b is true then do something end end

    Read the article

  • Overriding rubies spaceship operator <=>

    - by ericsteen1
    I am trying to override rubies <= (spaceship) operator to sort apples and oranges so that apples come first sorted by weight, and oranges second, sorted by sweetness. Like so: module Fruity attr_accessor :weight, :sweetness def <=>(other) # use Array#<=> to compare the attributes [self.weight, self.sweetness] <=> [other.weight, other.sweetness] end include Comparable end class Apple include Fruity def initialize(w) self.weight = w end end class Orange include Fruity def initialize(s) self.sweetness = s end end fruits = [Apple.new(2),Orange.new(4),Apple.new(6),Orange.new(9),Apple.new(1),Orange.new(22)] p fruits #should work? p fruits.sort But this does not work, can someone tell what I am doing wrong here, or a better way to do this?

    Read the article

  • Overriding the admin Media class

    - by shacker
    Given an admin media class that sets up a rich text editor, like: class TutorialAdmin(admin.ModelAdmin): fields... class Media: js = ['/paths/to/tinymce.js',] I would like the ability to selectively override js depending on a field value in the model it references. I've added a "use_editor" boolean to the Tutorial model. The question is, how can I detect whether the current instance has that bool set? I'd like to end up with something like: class Media: if self.use_editor: js = ['/path/to/tinymce.js',] else: js = '' Ideas? Thanks.

    Read the article

  • Maven profile properties are not "overriding"

    - by Nazar
    I have Maven multi-module project with such structure: parent-pom-project -- module1 -- module2 At the parent-pom-project I have such pom.xml <modules> <module>module1</module> </modules> ... <profiles> <profile> <id>local</id> <properties> <prop>local_prop</prop> </properties> </profile> <profile> <id>test</id> <modules> <module>module2</module> </modules> <properties> <prop>test_prop</prop> </properties> </profile> </profiles> At all pom.xml files I have such tag: <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> <resource> <directory>src/test/resources</directory> <filtering>true</filtering> </resource> </resources> </build> At module1 and module2 in resource directory I have properties files with such text: prop=${prop} The problem is that after mvn clean install or mvn clean install -Ptest or even mvn clean install -P test I get prop=local_prop If I user test profile for build module2 is also builded, but properties are used from local profile. I use Maven 3.0.3. Anybody have any ideas?

    Read the article

  • Overriding iPhone shutter sound through SDK

    - by Suresh
    In my iPhone app, I am using the UIImagePickerController with source type UIImagePickerControllerSourceTypeCamera. When the user takes a picture, the phone plays the familiar camera shutter sound. How can I replace this with my own custom sound? I know it's possible because I've seen other apps from the App Store do it (e.g. Red Laser). Thanks in advance!

    Read the article

  • Overriding a method in statically created objects

    - by I82Much
    All, Due to a bug in a library I'm using, I need to override the dispose() method on all objects extending a certain class and make it a NO-OP. I know that if I'm making new instances of the classes directly, this is easy to do: layerManager = new LayerManagerLayer(wwd) { @Override public void dispose() {} }; The problem is that a lot of the object instances I get are not directly constructed by my client code, but instead are created via static library method calls. // Here I want to override the dispose method, but I cannot. Layer l = ShapefileLoader.makeShapefileLayer(this.getClass().getResource("polylines10.shp")); Is there a way I can inject my dispose method into that statically created object without modifying the original sourcecode?

    Read the article

  • IE6/7 CSS Class Overriding

    - by Joda Maki
    I have a css file like: #SomeTable.hideAll .hide { display: none; } #SomeTable.showXYZ .show { display: block } When I add the class showCol to a td, the display overrides to block in chrome, FF, and IE8. But in IE6/7, the display stays none like it is not being overridden. Is there something odd you have to do in old IE's to do a css override like this? I suspect it has something to do with it either not being possible, or I just don't understand rules for determining an override.

    Read the article

  • Overriding unique indexed values

    - by Yeti
    This is what I'm doing right now (name is UNIQUE): SELECT * FROM fruits WHERE name='apple'; Check if the query returned any result. If yes, don't do anything. If no, a new value has to be inserted: INSERT INTO fruits (name) VALUES ('apple'); Instead of the above is it ok to insert the value into the table without checking if it already exists? If the name already exists in the table, an error will be thrown and if it doesn't, a new record will be inserted. Right now I am having to insert 500 records in a for loop, which results in 1000 queries. Will it be ok to skip the "already-exists" check?

    Read the article

  • jquery group validator plugin overriding the first items

    - by christian
    SO Question: jQuery Validate - require at least one field in a group to be filled I uses the sample rule from the above link and it works, but the problem was it overrides the fields that going to be validated it jumps directly to the group validation, when validates a form the messages in my error container only contains error for the group fields.

    Read the article

  • How to improve variable overriding/overwriting in XSL?

    - by ChrisBenyamin
    I want to do the following: Declare a variable Go into a if-statement Overwrite the variable XSL says I can't declare a variable twice, so what can I do to improve this step? Another approach was to check if a variable is set at all. I did this, because i skipped the first step and declared the variable in the if-statement. In another if-statement I wanted to check if the variable exists at all.

    Read the article

  • Overriding setter on domain class in grails 1.1.2

    - by Pavel P
    I have following two domain classes in Grails 1.1.2: class A implements Serializable { MyEnumType myField Date fieldChanged void setMyField(MyEnumType val) { if (myField != null && myField != val) { myField = val fieldChanged = new Date() } } } class B extends A { List children void setMyField(MyEnumType val) { if (myField != null && myField != val) { myField = val fieldChanged = new Date() children.each { child -> child.myField = val } } } When I set B instance's myField, I get the setter into the cycle... myField = val line calls setter again instead of assiging the new value. Any hint how to override the setter correctly? Thanks

    Read the article

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