extend

What's the convention for extending Linq datacontext with set based helper operations specific to one collection of entities only

Hi All I might be vaguing out here but I'm looking for a nice place to put set based helper operations in linq so I can do things like; db.Selections.ClearTemporary() which does something like db.DeleteAllOnSubmit(db.Selections.Where(s => s.Temporary)) Since I can figure out how to extend Table<Selection> the best I can do is crea...

How to extend/patch an existing module or package?

I want to extend some locale-specific features of a python application named OpenERP. All I need is implementing a third party module.function that would be called every time OpenERP calls locale.setlocale() function without changing neither OpenERP nor locale module source code. The only way I can imagine is provide a module named loca...

jQuery.extend not working in Internet Explorer, but works in Firefox

I am attempting the following: var Class1 = function() {} Class1.prototype = { MyMethod: function() { /* Do Stuff */ } } var Class2 = function() {} Class2.prototype = { AnotherMethod: function() { /* Do More Sweet Stuff */ } } jquery.extend(true, Class1, Class2); I should now expect to be able to do the following: var c = n...

Extending a singleton class

i used to create an instance of a singleton class like this: $Singleton = SingletonClassName::GetInstance(); and for non singleton class: $NonSingleton = new NonSingletonClassName; i think we should not differentiate how we create an instance of a class whether this is a singleton or not. if i look in perception of other class, i d...

CodeIgniter extend user's session expiration time

Hi, Is it possible to extend user's session expiration time in CI. What I want to do is, by default every user's session cookie lasts for example 1 day, but every time user visits the site his session expiration time is extended by one more day. I don't know if it is a good idea to do this, maybe I should just set cookies life time for...

jQuery fn.extend ({bla: function(){}} vs. jQuery.fn.bla

OK I think I get http://stackoverflow.com/questions/1991126/difference-jquery-extend-and-jquery-fn-extend in that the general extend can extend any object, and that fn.extend is for plugin functions that can be invoked straight off the jquery object with some internal jquery voodoo. So it appears one would invoke them differently. ...

Add properties to stdClass object from another object

I would like to be able to do the following: $obj = new stdClass; $obj->status = "success"; $obj2 = new stdClass; $obj2->message = "OK"; How can I extend $obj so that it contains the properties of $obj2, eg: $obj->status //"success" $obj->message // "OK" I know I could use an array, add all properties to the array and then cast t...

Re-Inventing The Label Control

Hi All, I need to reinvent/recreate the Label Control from scratch to add my own mojoness to it. Yes, I know what you're thinking (and if you're not thinking that, shouldn't you be?). Can somebody point me in the right direction? Thank you. The whole purpose for recreating the label is that I want full control over how it is drawn on...

Private members when extending a class using ExtJS

I have done some research on the ExtJS forum regarding private methods and fields inside a extended class, and I couldn't find any real answer to this. And when I say an extended class I mean something like this: Ext.ux.MyExtendedClass = Ext.extend(Ext.util.Observable, { publicVar1: 'Variable visible from outside this class', c...

Better to extend a class or modify it directly?

Hi, So I'm working on creating a visualization for a data structure in Java. I already have the implementation of the data structure (Binary Search Tree) to start with, but I need to add some additional functionality to the included node class. As far as conventions and best practices are concerned, should I create a subclass of the n...

Django design question: extending User to make users that can't log in

The site I'm working on involves teachers creating student objects. The teacher can choose to make it possible for a student to log into the site (to check calendars, etc) OR the teacher can choose to use the student object only for record keeping and not allow the student to log in. In the student creation form, if the teacher supplies ...

Is it possible to extend the DOM of a new window opened using window.open without loading prototypeJS in the new window?

Hi! Is it possible to extend the DOM of a new window that I opened, using something like this: var newWindow = window.open('about:blank', 'testWindow', ''); Element.extend(newWindow); I thought Element.extend would work.. But I done see any refference to prototype in the DOM. Any ideas? Thank you! Morten ...

jquery UI autocomplete - extended data?

I would like to use Jquery's UI autocomplete but with some additional functions: after user selects suggested item, I would also like to display additional data related with that item (for example if database of contacts are being searched, then I'd like to display contact's email, addres...) in some html element. Is there a way to acco...

Configurable Values in Enum

I often use this design in my code to maintain configurable values. Consider this code: public enum Options { REGEX_STRING("Some Regex"), REGEX_PATTERN(Pattern.compile(REGEX_STRING.getString()), false), THREAD_COUNT(2), OPTIONS_PATH("options.config", false), DEBUG(true), ALWAYS_SAVE_OPTIONS(true), THREAD_WAI...

inheritance problem OOP extend

If a Father is a Parent and a Parent is a Person and a Person has a Father I create the following: class Person{ Father father; } class Parent extends Person{} class Father extends Parent{} Instances: Person p1 = new Person(); Person p2 = new Person(); p1.father = p2; //father is of the type Father This doesn't work... Now tr...

Objective-C protocol vs inheritance vs extending?

I have a couple classes that have nearly identical code. Only a string or two is different between them. What I would like to do is to make them "x" from another class that defines those functions and then uses constants or something else to define those strings that are different. I'm not sure if "x" is inheritance or extending or wh...

How to add a method to an existing class in PHP?

I'm using WordPress as a CMS, and I want to extend one of its classes without having to inherit from another class; i.e. I simply want to "add" more methods to that class: class A { function do_a() { echo 'a'; } } then: function insert_this_function_into_class_A() { echo 'b'; } (some way of inserting the latter ...

Custom component which displays voice recognition button if available

Hi evereyone, I'd like to create a custom component which supports voice recognition. It will primarily be an extended EditText which should show the microphone button for voice recognition if it is available. I wanted to to look at the search app-widget on the homescreen but I don't find it in the source. This is intended to use the v...

How can I extend Scala collections with an argmax method?

I would like to add to all collections where it makes sense, an argMax method. How to do it? Use implicits? ...

Difficulty with MooTools Class.extend

Consider the following code: var Widget = new Class({ Implements: [Options], options: { "name" : "BaseWidget" }, initialize: function(options) { alert("Options are: " + JSON.stringify(options)); //alerts "Options are: undefined" this.setOptions(options); alert("My optio...