Good collection for implementing Undo/Redo?

I was reading around for undo/redo techniques, I understand how should it be implemented (I found it intuitive). However I'm thinking about the collection that should be used as history, A lot of...

Treating a java array of more than two dimensions as a list

I am using Groovy to write a DSL handling BASIC and I would like some assistance with how to handle multi (more than 2) dimensional arrays. I am dealing with BASIC code like this: 100 LET X = A(1,...

WinRT hierarchical data displaying

I need to display hierarchical data like: public class Element { public string Name { get; private set; } public Element[] Elements { get; private set; } } It would be just vertical...

How to get the previous and next elements of an array loop in JavaScript?

In a simple array loop of Javacript as for (var i=0; i<array.length; i++) { var previous=array[i-1]; var current=array[i]; var next=array[i+1]; } I need to get the previous and next elements...

What is the limit of nested OR's in a CAML Query?

From the question 'SQL IN equivalent in CAML' I learned that SharePoint 2010 has a SQL "IN" equivalent for CAML. Also that the 2007 version does not support this. The OP solved this by nesting a...

how to input a string of charater(100,101,102.....)(number of character is unlimited) and store numbers in array in C

i'm new member. And now, i'm having a exercise: "input a string of character(100,101,102...)(number of character is unlimited) and store numbers in array". My teacher provide us a function. It is...

XSD Include of schema does not work with maxOccurs="unbounded"

I am slowly but surely getting some XML together with a lot of help from the stackoverflow community. I have a schema for some XML which works fine, and contains a lot of Type definitions. So, I...

Algorithm of Permutation with Limited Repetition

Is there an algorithm to list out all the permutations with a limited repetition? If there is an existing Java library, it would be so nice! Let's say we have 3 items {A, B, C}. We want a...

jQuery organisational chart plugin suitable for wordpress category loop

I am making family tree portion of the wordpress site I am building. On the admin side, administrator should be able to set child or parent entries and create a family tree structure. Each node...

Render Django-CMS plugins differently on different splaceholders/templates

Short version: I'd like to have the same kind of cmsplugin use different templates in different placeholders. Is this possible? Or, should I go and make my custom plugin? Long version: Using...

serializing two different models with django

I have two models Property and PropertyImage. Property holds all the data and PropertyImage is only for allowing an unlimited number of images to be uploaded. class PropertyImage(models.Model): ...

How to remove multi-level menu item with children in MySQL?

I have unlimited level menu structure in MySQL, where parent and children elements are connected with column p_id: +----+------+------+----------------+ | id | p_id | sort | name_en ...

What Regex to use in this example

I am parsing a string that I know will definitely only contain the following distinct phrases that I want to parse: 'Man of the Match' 'Goal' 'Assist' 'Yellow Card' 'Red Card' The string that I...

php. Need idea how to distinct categories/subcategories/product/page=

Here are some examples of url 0 | 1 | 2 ----------------------------- .com / en / page=x / product .com / en / category / product .com / en / category / page=x .com / en...

Proper API architecture for building AngularJS applications

Lately I have been talking with a lot of my mid-tier developers about how to structure the APIs in order to better accommodate the 2-way binding that AngularJS offers. We have been trying to...

IE vertical centering bug with table-cell parent and absolutely positioned pseudo-element

I'm building a flexible progress-bar with a number of constraints. It needs to be able to contain any number of items within it, have these items all be the same width, vertically centered,...

How to implement zip with foldl (in an eager language)

A Clojure programmer I know recently remarked that it's possible to implement lots of sequence functions in terms of Clojure's reduce (which is Haskell's foldl'), but that regrettably there's no...

Adding dynamic elements to Symfony form on PRE_SUBMIT

I am trying to use Symfony Form Component with Silex framework at the moment. I added some fields in buildForm method of my form type class. Also user can click on a button and add unlimited...

How to limit an element to zero or one in DTD with other unrestricted elements

In a DTD I can see how in an element can be limited with zero or one by using the "?" symbol: <!ELEMENT basket apple?> But I also want to have no restriction on two other types of elements in...

Python - Iterate through CSV rows and create XML string

I have a CSV file that contains a header row followed by a potentially unlimited number of rows with values. For...

XSD schema with unordered required, optional and arbitrary tags

I am trying to come up with a XSD 1.0 schema with the following constraints: There is no ordering Some elements must appear exactly once Some elements may appear zero or unbounded times Allow...

Mix two lists python

I am trying to create a function to mix two lists in python, or I rather say put the element of list2 into list1. It is required that in the output list, no more than two elements next two each...

JQuery UI Draggable - Helper function which returns clone() only clones once if arguments passed to clone()

I am cloning elements as they are dragged out of a JQuery UI Draggable list using JQuery's clone() method. Looking at the clone() documentation, I see that I can clone events already bound to...

jQuery can't show/hide element based on select option

I am building a wordpress widget that allows users to build a simple form in the customizer preview. Part of my form builder is to have a dropdown select input with several form elements listed...

Transforming flat XML to a hierarchy (XML or Object) with C# and LINQ

I see there are a few articles on the same topic but the combination of a few factors makes this problem a little more challenging. I need to transform flat XML that looks like this: string myXML...

Comparing the order of specific elements in a python list

How to implement the following comparison using Python 2 Input is composed of two groups: Different lists collected from Experiments. All accepted sequences of some of these elements. How to...

PostScript execution of specific types (Array)

I'm having a hard times with executing arrays. PostScript Language Reference Manual page 50: An executable array or executable packed array (procedure) object is pushed on the operand stack if it...

Set Simplification

Say I have two sets, set1 = {a,b,c,d,e,f} and set2 = {a,b,c,d,e,g}. Rather than expressing these explicitly, I want to create something like common = {a,b,c,d,e} set1 = common + f set2 = common +...

React dynamic, sortable and draggable grid

I have a task for React with JS ES6 which I have been trying to complete for the last two weeks. Examples and code are at the bottom of this post. My goal is to make a “dynamically sortable...

Writing to file multiple times vs Saving it in memory and writing once

I hope it's okay to ask questions about optimization here, if not let me know where I can and i'll delete this post. Also if it matters, I'm using NodeJS. So I'm coming up to a point in time where...