linux – Need a simple High Availability file share

I am looking for the simplest way to share a single file in a high availability way between a pair of linux servers. (Version and distribution are unimportant, I’m looking for a generic solution.)

I have two servers, each with their own local disks and NFS shares and other services between them. I have a file that both servers need to access, but nothing other than those servers needs to access it.

If either server crashes, I want the most recent possible contents of that file to be available to the remaining server. (Obviously the other server should pick up changes on recovery.)

The file is a state file, and likely only one server at a time will be writing to it.

Without adding external hardware, what options are there for a high availability file share like this?

Benchmark (Simple Product w/Product Options) versus (Configurable Product)

For a long time only simple products with custom options such as size and color were used in the stores I provide maintenance for. Being about stores that had all the variants in stock there was no problem of creating dependencies between the variants.

Recently I encountered a new situation where not all variants are available in stock and then I had to analyze between going for (Configurable Product + Aitoc Configurable Product Pro) or (Simple Product + Mageworx Advanced Product Options). If I choose for the first option, I don’t really like the fact that for a product that has 6 sizes and 6 colors I will get 36 simple products. In addition, obviously if there are 1.000 products in the first variant there will be 36.000 simple products while in the second variant only 1.000.

Has anyone ever made a benchmark of a store with simple products and one with configurable?

8 – How to create a simple date range calendar popup that lets users select a date range when optional dates that cannot be selected?

I’ve upgraded a D7 site D8 and the Availability Calendar that we use for letting users select a date range to reserve will not be upgraded to D8. After much research, we haven’t found a suitable alternative so we’ll need to implement one ourselves. The concept seems simple but I’m not sure what the best (and simplest) way to achieve this would.


Admins can create days that cannot be selected. For example, a holiday that they’re closed or a day that they’ve reached capacity.

Users see a popup calendar with closed days above noted and not selectable.

Users select a date range (start and end date) then click to reserve their spot.

**We do not need to do anything with the dates except pass them on to the next step. So basically the calendar is just for display to allow users to select dates. The dates are not stored and do not affect the calendar.

We will not use times, dates only.

Example on existing D7 site:

enter image description here

Given a simple undirected graph, how to direct its edges to make it transitive

I am currently looking for an algorithm to determine whether we can direct every edge (no adding or deleting edges allowed) so that the graph is transitive (meaning that if (x,y) and (y,z) are edges then so is (x,z)).

One way to do it is to use PQ trees as I had an interaction with a professor and this is what he had to say but we are looking for a faster algorithm. When I try to do it myself, my mind keeps looping back to the PQ-tree technique. Each edge is allowed only one direction (if in the underlying undirected graph {a,b} is an edge then exactly one of (a,b) and (b,a) is an edge).

Perhaps there is one algorithm better in the sense of lower complexity than the PQ-tree approach, but we can’t seem to find it in literature. Do we take it that doing a PQ-tree approach is the best way?

The title of this post is the best I could do in the google search bar. Any help is appreciated.

Inverse Galois problem on simple groups

Im trying to find a way to connect a possible solution of the inverse Galois problem on simple groups to a more general solution on any finite group.

I’ve tryied to mess with the embedding problem for a bit but with no success, any help?

Very simple scripting language (interpreter) in C

I made very simple scripting language (interpreter) in C and now, I want to make my code better.

Here is my code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TRUE (1 == 1)
#define FALSE (1 == 0)


#define MAX_STRING_LENGTH 2048

char *strr(char *str, char *output, int x, int y)
    int i;
    for (i = x + 1; i < y; i++)
        output(i - (x + 1)) = str(i);
    return output;

int is_string(char *str)
    if (str(0) == '"' & str(strlen(str) - 1) == '"')
        return TRUE;
        return FALSE;

int is_sint(char *str)
    int i = 0;
    while (str(i))
        if (str(i) >= '0' & str(i) <= '9')
            return TRUE;
            return FALSE;

void lang_prints(char *s)
    char output(MAX_STRING_LENGTH) = "";
    if (is_string(s))
        strr(s, output, 0, strlen(s) - 1);
        printf("%sn", output);

void lang_printi(int i)
    printf("%dn", i);

int main()
    int i;
    char function_names(FUNCTION_COUNT)(MAX_FUNCTION_NAME_LENGTH) = {
    char input(MAX_STRING_LENGTH);
    char output(MAX_STRING_LENGTH);
    char function_name(MAX_FUNCTION_NAME_LENGTH) = "";
    char function_arg(MAX_FUNCTION_ARG_LENGTH) = "";
    printf("> ");
    scanf("%s", input);
    for (i = 0; i < FUNCTION_COUNT; i++)
        strr(input, function_name, -1, strlen(function_names(i)));
        strr(input, function_arg, strlen(function_names(i)), strlen(input) - 1);
        if (strcmp(function_name, function_names(i)) == FALSE)
            if (input(strlen(function_name)) == '(' & input(strlen(function_name) + strlen(function_arg) + 1) == ')')
                switch (i)
                    case 0:
                    case 1:
                        if (is_sint(function_arg))

(Use prints to print string and printi to print integer)

linux – writing simple lsm in kernel 5.x

I’m trying to write a simple lsm module that also do nothing. but I have several problems.

static int rdwn_task_kill(
    struct task_struct* p,
    struct siginfo *info,
    int sig, 
    u32 secid
) {
        return 0;

static struct security_hook_list rdwn_hooks() = {
        LSM_HOOK_INIT(task_kill, rdwn_task_kill)

static __init rdwn_init(void) {
    security_add_hooks(rdwn_hooks, ARRAY_SIZE(rdwn_hooks), "rdwn");

    printk(KERN_INFO "RDWN:  Initializing.n");

    return 0;

// How to load module??     

as you know, writing and loading lsm was more simple in the previous versions of kernel.
but now, acutely I’m confused about this. before, there was some functions like security_initcall. but what about now??? how can I load lsm in kernel 5 and later?? I had a look at other lsm codes like selinux and apparmor and they was used macro DEFINE_LSM that defines a struct and nothing more (actually I don’t see any more). Is it enough? and is it right way to loading lsm? what’s happens if I use module_init instance all of them??? finally what is true way to register and load a lsm into kernel?

other question: when I compile above code (when I complete that), I get something like this errors:

error modpost: security_add_hooks undefined! 

error modpost: security_hook_heads undefined! 

what is this? and why I getting this errors?? the interesting note is when I implement my own struct_add_hooks and security_hook_heads (exactly same but changing in their names), this error disappeared. why?

any one can help me to implement a good lsm? 🙂

performance – Index not used in simple select query mysql

I have a simple query on a table with 66k rows and the index is not used.

Query :

select * from products p where p.upc = '771313251785'

MySQL version : 8

Here is the create table :

CREATE TABLE `produits`
                          n `pharmacieidbjc` INT NOT NULL,
                          n `upc`            VARCHAR(14) DEFAULT NULL,
                          n `sap`            VARCHAR(15) DEFAULT NULL,
                          n `iditem`         VARCHAR(20) NOT NULL,
                          n `description`    VARCHAR(100) DEFAULT NULL,
                          n `fournisseur`    VARCHAR(10) DEFAULT NULL,
                          n `coutant` DOUBLE DEFAULT NULL,
                          n `prix` DOUBLE DEFAULT NULL,
                          n `categorie`       VARCHAR(10) DEFAULT NULL,
                          n `sousdepartement` VARCHAR(10) DEFAULT NULL,
                          n `departement`     VARCHAR(10) DEFAULT NULL,
                          n `marque`          VARCHAR(30) DEFAULT NULL,
                          n `din`             VARCHAR(8) DEFAULT NULL,
                          n `crx`             VARCHAR(6) DEFAULT NULL,
                          n `esttaxablefed`   TINYINT(1) DEFAULT NULL,
                          n `esttaxableprov`  TINYINT(1) DEFAULT NULL,
                          n PRIMARY KEY (`pharmacieidbjc`,`iditem`),
                          n KEY `ix_upc` (`upc`)
                          /*!80000 INVISIBLE */
                          n KEY `ix_sap` (`sap`),
                          n KEY `ix_din` (`din`),
                          n KEY `ix_dep` (`departement`),
                          n KEY `ix_sousdep` (`sousdepartement`),
                          n KEY `ix_cat` (`categorie`),
                          n FULLTEXT KEY `ix_upc_full` (`upc`)n
             engine=innodb DEFAULT charset=utf8

Index configuration