custom list – Uncaught error Fullcalendar is not a function

I am using FullCalendar v3.10.2 and trying to run a script to prevent mutiple day selection. I searched and found that the fullcalendar function is not recognized. I am not sure what to do. My script is as follows(I have mentioned the html tags first which isbeing used in a separate file):

”’

$(function(){

var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

$(‘#calendar’).fullCalendar({

   selectable: true,
  selectHelper: true,
  editable: true,
  defaultView: 'agendaMonth',

  select: function (start, end) {
      var mEnd = $.fullCalendar.moment(end);
      var mStart = $.fullCalendar.moment(start);

      if (mEnd.isAfter(mStart, 'day')) {
          $('#calendar').fullCalendar('unselect');
      } else {
          $('#calendar').fullCalendar('renderEvent', {
              start: mStart,
              end: mEnd,
              allDay: false
          },
          true // stick the event
          );
          $('#calendar').fullCalendar('unselect');
      }
  }

});
});”’

list manipulation – How can I sort in increasing order?

sample = RandomVariate(NormalDistribution(0, 1), {1000, 10, 10});
trp = Map(Transpose, sample);
GOEe = sample + trp;
eigs = Flatten(Map(Eigenvalues, GOEe));
distpars = 
  FindDistributionParameters(Eigens, NormalDistribution(mu, sigma));

Show(Histogram(eigs, Automatic, "PDF"), 
 Plot(PDF(NormalDistribution(mu, sigma) /. distpars, x), {x, -20, 20}))


 
(*Sorted Eigs*) 
sortedEigs = eigs(ordering(eigs));

Hello, this is my code to sort eigs in increasing order. However, I keep getting message errors.
Can you help me? Thank you

why java List interface implements 10 methods of(..) instead of just one varargs version?

With absolutely no prior knowledge of the specific case, I would guess: performance.

Given a function with a fixed set of parameters, a compiler can optimise how those parameters are laid out in memory, and even optimise the entire function to a fixed set of processor instructions.

A generalised implementation instead needs machinery for detecting the number of parameters actually passed, collecting them into some intermediate representation, and iterating over them.

Consider an example of sum, in an imaginary language, implemented variadically:

function sum(int() ...args) {
    local accumulator = 0;
    foreach ( args as next_arg ) {
        accumulator += next_arg;
    }
    return accumulator;
}

Even without knowing the low-level mechanics of passing and allocating variables, we can see that there’s a lot going on here. Now compare to implementations with fixed argument lists:

function sum(int a) { return a; }
function sum(int a, int b) { return a + b; }
function sum(int a, int b, int c) { return a + b + c; }
function sum(int a, int b, int c, int d) { return a + b + c + d; }

Here, no intermediate storage needs to be allocated for args and accumulator, and the implementations are easy to map to low-level instructions.

While it’s possible for a sufficiently powerful compiler to generate the optimised cases from the generalised one, it’s far from easy. So where performance matters more than human convenience, it can be worth hand-crafting at least some of the cases.

list manipulation – Specifying the position of the bottom element in a matrix when the last few elements are missing

Suppose I have a matrix (nested list) with some missing elements in the bottom region:

m={{1,5},{2,6},{3},{4}};
m//TableForm

1   5
2   6
3   
4   

As you see, there are two missing elements at the position of m((3,2)) and m((4,2)).

I want to specify the position of the bottom element in the 2nd column, i.e., I want to specify the position of the element just before the position of the missing data.
In this example, at the 2nd column, the bottom element is 6 and lies at m((2,2)).
Thus, the answer should be m((2,2)).

Suppose that I do not know both the bottom value (6, in this case) and how many rows are missing in the 2nd column (because my real data has very long column).

To achieve this, I tried to calculate the length of the 2nd column:

Length@m((All,2))

But, this does not work, because part 2 of the 3rd and 4th rows do not exist.
Any ideas would be appreciated.

function construction – Passing list into another list

Suppose I have a zero matrix Amat and a list of values ltest that contains the values of the matrix Amat for the some of its diagonal elements:

L = 10000;
Amat = 0. IdentityMatrix[L];
ltest = {{-0.70710, 1329}, {-0.25, 5607}, {-0.3535, 1261}, {-0.25, 4393}, {-0.5, 4358},
{-0.3511, 1009}, {-1., 3815}, {-0.25, 3784}, {-0.133, 3667}, {-0.88, 909}};

Now in order to pass the second column of ltest to Amat I can do:

For[i = 1, i <= Length[ltest], i++, Amat[[ltest[[All, 2]][[i]], ltest[[All, 2]][[i]]]] = ltest[[All, 1]][[i]]]

Is there a shorter way without using For?

list manipulation – getting keys of an Association

Suppose you have an association of the type:

a = {1, 0, 0, 0}; b = {0, 1, 0, 0}; c = {0, 0, 1, 0}; d = {0, 0, 0, 1}; e = {2, 0, 0, 0}; 
f = {0, 2, 0, 0}; g = {0, 0, 2, 0}; h = {0, 0,0, 2};
assoc = Association(1 -> a, 2 -> b, 3 -> c, 4 -> d, 5 -> e, 6 -> f, 7 -> g, 8 -> h)

(*=> <|1 -> {1, 0, 0, 0}, 2 -> {0, 1, 0, 0}, 3 -> {0, 0, 1, 0}, 4 -> {0, 0, 0, 1}, 
 5 -> {2, 0, 0, 0}, 6 -> {0, 2, 0, 0}, 7 -> {0, 0, 2, 0}, 8 -> {0, 0, 0, 2}|> *)

In general the association may contain much more terms.
You can access the keys, given the values using PositionIndex, e.g:

PositionIndex(assoc)({2, 0, 0, 0}) 
(*=> {5} *)

Suppose the output of a calculation is of the form:

-0.2*{0, 1, 0, 0} + 0.4*{2, 0, 0, 0} + 0.11*{0, 0, 2, 0} + 0.7*{0, 0, 1, 0}

How can you get a list of pairs where the pair consists of the coefficient and the corresponding key of the element of assoc, i.e for the above output how can you create the list:

{{-0.2, 2}, {0.4, 5}, {0.11, 7}, {0.7,3}} 

c – Dynamic list in C99

I’m experimenting with C after working in high level languages for the last 15+ years, and trying to feel comfortable with C code bases again.

One thing I needed for the code I’m writing was a resizable list collection that can grow as items are added to it. It seems to work under the basic case, so I’m wondering if I missed something in it.

list.h

#ifndef CRENDERER_LIST_H
#define CRENDERER_LIST_H

#include <stddef.h>

/**
 * Creates a new growable list
 * @param initialCapacity how many items the list should initially have memory for
 * @param itemSize The size of each item
 * @return returns a pointer to the newly created list, or `NULL` if list creation failed
 */
void* kcr_list_create(int initialCapacity, size_t itemSize);

/**
 * Appends a new item to the end of an existing list.  If the list does not have the capacity for the item than
 * the list will be resized to account for it.
 * @param list Existing list to append the item onto
 * @param item A pointer to the item to add to the list
 * @param itemSize The memory size of the item to add.  This must be the same as specified during creation
 * @return returns a pointer to the latest location of the list.  Consumers must always reference the list from
 * the value returned and not re-use the previous pointer, as when the list grows it may end up in a new spot
 * to accomodate the size it needed to grow into.
 *
 * Will return `NULL` if appending failed
 */
void* kcr_list_append(void* list, void* item, size_t itemSize);

/**
 * Removes the item from the list at the specified index
 * @param list list to remove the item from
 * @param index Index of the item to remove
 * @param itemSize The memory size of the items in the list
 */
void kcr_list_remove(void* list, int index, size_t itemSize);

/**
 * Gets the number of items that exist in the list
 * @param list The existing list
 * @return Number of items in the list
 */
int kcr_list_length(const void* list);

/**
 * Frees the list
 */
void kcr_list_free(void* list);

#endif //CRENDERER_LIST_H

list.c

#include <malloc.h>
#include <mem.h>
#include <math.h>
#include "list.h"

#define MIN_GROWTH 10
#define RAW_LIST(list) ((int*) list) - 2
#define LIST_LEN(list) (RAW_LIST(list))(0)
#define LIST_CAP(list) (RAW_LIST(list))(1)
#define FIRST_ELEMENT(list) ((int*) list) + 2

void* kcr_list_create(int initialCapacity, size_t itemSize) {
    int* memory = malloc(sizeof(int) * 2 + itemSize * initialCapacity);
    if (memory == NULL) {
        return NULL;
    }

    memory = FIRST_ELEMENT(memory);
    LIST_LEN(memory) = 0;
    LIST_CAP(memory) = initialCapacity;
    return memory;
}

void *kcr_list_append(void *list, void *item, size_t itemSize) {
    if (list == NULL) {
        return NULL;
    }

    int capacity = LIST_CAP(list);
    int count = LIST_LEN(list);
    if (count + 1 > capacity) {
        // Grow it by either 1.25x or by MIN_GROWTH items, whichever is larger.  Item Minimum allows to keep a bunch of
        // small growths reallocating.
        int newCapacity = capacity + (int) roundf((float) capacity * 1.25f);
        if (newCapacity < MIN_GROWTH) {
            newCapacity = capacity + MIN_GROWTH;
        }

        int* newList = realloc(RAW_LIST(list), sizeof(int) * 2 + itemSize * newCapacity);
        if (newList == NULL) {
            return NULL;
        }

        list = FIRST_ELEMENT(newList);
        LIST_CAP(list) = newCapacity;
    }

    void* slot = list + itemSize * count;
    memcpy(slot, item, itemSize);
    LIST_LEN(list) = count + 1;

    return list;
}

void kcr_list_remove(void *list, int index, size_t itemSize) {
    if (list == NULL || index < 0) {
        return;
    }

    int count = LIST_LEN(list);
    if (index >= count) {
        return;
    }

    if (index < count - 1) {
        // Not the last item, so shift everything after it over
        void* slotToRemove = list + itemSize * index;
        int itemsToShift = count - index - 1;
        memmove(slotToRemove, slotToRemove + itemSize, itemsToShift * itemSize);
    }

    LIST_LEN(list) = count - 1;
}

int kcr_list_length(const void *list) {
    if (list == NULL) {
        return 0;
    }

    return LIST_LEN(list);
}

void kcr_list_free(void *list) {
    if (list != NULL) {
        free(RAW_LIST(list));
    }
}

Test Usage

int main() {
    struct KCR_Vec3* vectors = kcr_list_create(5, sizeof(struct KCR_Vec3));
    for (int x = 0; x < 30; x++) {
        struct KCR_Vec3 vector = {(float) x, (float) x + 1, (float) x + 2};
        struct KCR_Vec3* array = kcr_list_append(vectors, &vector, sizeof(struct KCR_Vec3));
        if (array == NULL) {
            fprintf(stderr, "Failed to add item #%in", x);
        }

        vectors = array;
    }

    kcr_list_remove(vectors, 10, sizeof(struct KCR_Vec3));
    kcr_list_remove(vectors, 20, sizeof(struct KCR_Vec3));

    for (int x = 0; x < kcr_list_length(vectors); x++) {
        printf("Vector #%i: {%f, %f, %f}n", x, vectors(x).x, vectors(x).y, vectors(x).z);
    }

    kcr_list_free(vectors);
}
```

dnd 5e – Can the Wish spell change my spell list?

I’m 20 level Bard this was my first PC. So I was not very experienced and I’m not happy with the spells I chose so I would like to find a way to change my spell list.

I thought “wish” spell could help me on that and I want know whether I can use the Wish spell to change my spell list?

8 – How to list entities and sort them by delta?

I have a “stations” and “railways” node types and a custom “notification” entity type.
In “railways” node type I have an entity reference field (“field_stations”) where I can select “stations” nodes which is good.
In “notification” entity type I have an entity reference field where I can select related stations. (entity reference to “stations” nodes)
I would like to create a view to list “stations” nodes with grouping and sorting. I would like to group them by “railways” and sort them by delta (“field_stations”).

I tried it but I could not get the right order and get a lot of duplications. I have tried views_order_by_delta module as well with no luck.

Do you have any recommendations?

List of all measures

Let Ω be a four-element set (elements do not matter).

How can I find a list of all measures µ: P(Ω)→ N, for which µ(Ω) = 7, where P(Ω) is Power set of Ω.