extend

Appending a list to a list of lists in R

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 03:15:17
I'm having issues appending data to a list which is already in a list format. I have a program which will export results objects during a simulation loop. The data itself is stored as a list of matrices. My idea is to store those lists in a list, and then save this list of lists as an R object for later analysis, however I'm having some issues achieving this correctly. I'll show what I've done with small abstract example just using values instead of the matrix data from my simulation: Say I've run the simulation loop for 3 times. During the iterations, the results lists need to be collected

How to create simple jQuery plugin?

大城市里の小女人 提交于 2019-11-28 01:40:07
This test plugin, is supposed to work like this: When an element is clicked, it moves down. Simple as that. jQuery.fn.moveDown = function(howMuch){ $(this).css("border", "1px solid black"); $(this).click(function(){ $(this).css("position", "relative"); $(this).animate({top: '+='+howMuch}); }); } The problem is, when an element is clicked, it not only moves the clicked element but also ALL the other elements which the plugin was applied to. What is the solution for this? For plugin authoring try this way, much more solid: Edit: Here is working jsFiddle example. PLUGIN: (function($){ $.fn.extend

Scala, Extend object with a generic trait

删除回忆录丶 提交于 2019-11-28 01:10:18
I'm using Scala and I want to extend a (singleton) object with a trait, which delivers a data structure and some methods, like this: trait Tray[T] { val tray = ListBuffer.empty[T] def add[T] (t: T) = tray += t def get[T]: List[T] = tray.toList } And then I'll would like to mix-in the trait into an object, like this: object Test with Tray[Int] But there are type mismatches in add and get : Test.add(1) // ... How can I'll get this to work? Or what is my mistake? Travis Brown The problem is that you're shadowing the trait's type parameter with the T on the add and get methods. See my answer here

Sass extend with pseudo selectors

有些话、适合烂在心里 提交于 2019-11-28 01:00:36
问题 I am using compass to manage some sass files on mac osx. I have these files: sass/ screen.scss partials folder/ ... _fonts.scss _functions.scss ... In fonts I have this rule which I would like to reuse @extend. //fonts.scss .icon-ab-logo, { font-family: 'icomoon'; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; } .icon-ab-logo:before { //i want to reuse this. content: "\e000"; } In functions

how to force schema compiled classes to extend specific class outside schema

天涯浪子 提交于 2019-11-28 00:13:58
Need help with following situation: Users can generate their own data structures which are stored as JAXB-ready XSD sources like below: <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Group" type="Group"/> <xs:element name="Parameter" type="Parameter"/> <xs:complexType name="Group"> <xs:sequence> <xs:element name="caption" type="xs:string" minOccurs="0"/> <xs:element name="parameters" type="Parameter" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="Parameter"> <xs:sequence> <xs:element name=

Is it possible to extend a class dynamically?

只谈情不闲聊 提交于 2019-11-27 21:08:01
I have a class which I need to use to extend different classes (up to hundreds) depending on criteria. Is there a way in PHP to extend a class by a dynamic class name? I assume it would require a method to specify extension with instantiation. Ideas? I don't think it's possible to dynamically extend a class (however if I'm wrong I'd love to see how it's done). Have you thought about using the Composite pattern ( http://en.wikipedia.org/wiki/Composite_pattern , http://devzone.zend.com/article/7 )? You could dynamically composite another class (even multiple classes - this is often used as a

How extend Windows 8 Explorer Ribbon with custom controls?

故事扮演 提交于 2019-11-27 18:23:41
问题 As example, I want make simple resizer, where you can select image in explorer and set new dimensions. 回答1: It is not possible to modify the Windows Explorer 8 ribbon. However, add-ins will not be able to plug into the ribbon UI. This was a difficult engineering choice for us and we expect that many of you will read this and suggest we add the capability--of course if we could get it right this time around we would have done that. A big part of this blog is sharing these choices--tradeoffs-

Adding the same context menu to multiple activities

笑着哭i 提交于 2019-11-27 18:20:18
问题 I'm trying to figure out how to include common pieces of code in multiple activities. More specifically, I have a context menu that I would like to include in several activities. I saw this, but just don't understand how to extend to multiple activities. http://developer.android.com/guide/topics/ui/menus.html I have this set up as Menu.java public class Menu extends Activity{ // bottom menus public static final int Menu1 = 1; public static final int Menu2 = 2; public static final int Menu3 =

jquery .serializeArray(); add another value on top for passing to ajax

泪湿孤枕 提交于 2019-11-27 17:26:43
问题 im doing following var data = $(form).serializeArray(); // now i want to add another value on this data data.username = 'this is username'; i want to know how can i add another value after doing serializeArray(), i tried all the things i know, but nothing is getting it to work. any ideas pls. 回答1: try data[data.length] = { name: "username", value: "The Username" }; 回答2: var data = $(form).serializeArray(); data.push({name: 'username', value: 'this is username'}); see also: jQuery post() with

Javascript: Extend a Function

回眸只為那壹抹淺笑 提交于 2019-11-27 16:51:23
The main reason why I want it is that I want to extend my initialize function. Something like this: // main.js window.onload = init(); function init(){ doSomething(); } // extend.js function extends init(){ doSomethingHereToo(); } So I want to extend a function like I extend a class in PHP. And I would like to extend it from other files too, so for example I have the original init function in main.js and the extended function in extended.js . With a wider view of what you're actually trying to do and the context in which you're doing it, I'm sure we could give you a better answer than the