command line – argon one case script for fan/power switch not working on ubuntu

i am trying to install the software for the argon one case for controlling fan and power switch.
the makers software does not work on ubuntu, i found script that is supposed to resolve this problem but i get the following fault chmod: missing operand after ‘755’ the line generating this fault is sudo chmod 755 $configscript .i am totally new to linux and have very limited knowledge of programming in general.if anyone could point me in the right direction to resolving this problem it would be greatly appreciated.i would like to get the case fan and power switch working but for me the most important thing would be understanding the reason for the fault as i am trying to learn linux and so far have managed to understand and solve the problems i have come up against with a little online research but with this i don’t see the problem
system details
raspberry pi 4 8gb
ubuntu 20.10 groovy gorilla
argon one case

many thanks for taking the time to read my question

gui design – One checkbox or two radio buttons? Is there a case where both are acceptable?

I read an interesting article talking about the philosophy behind the use of checkboxes versus radio buttons. Of course, in most cases you would argue that the decision is pretty obvious because radio buttons are predominantly used for a single mandatory selection from a number of options (of a reasonable size hopefully) while checkboxes are for non-mandatory multiple selection from a number of options.

Of course, at the end of such articles, the author notes that the answer to the question is that it really depends on the use case as I described previously.

I wonder if there actually is an affect or difference that asking yes/no questions using radio buttons or checkboxes has on the users, since the article gathers a lot of opinions and ideas but it would be interesting to see actual research on this.

Also, I have a suspicion that there might be cases in which there is no difference how the user input is collected, even though we are used to certain types of questions being asked one way (e.g. opt-in/opt-out using checkboxes) and certain types of questions being asked another way (e.g. gender using radio buttons). I supposed the problem is that you have to ask a question in the affirmative or negative with checkboxes, so maybe there is no scenario in which both options can be equivalent.

response time – Skeleton screens – do we display them in case of lack of content or lower amount of content than suggested in skeleton screens lay out?

Currently, we add skeleton screens with a progress bar while the page is loading with data (in a data-driven platform). I’m wondering what in the case where after loading time no data is available or ie. just one card is available not a few cards – like skeleton card suggested. Do we still use skeleton cards in this case? what’s the usual model?

libraries – What is the best place to ask about package upgrades (in this case, freeglut)?

I’m not as active as I used to be on places like the Ubuntu forums and Launchpad, so I’m not sure where the best place to direct a feature request is.

Currently Ubuntu 20.10 ships with freeglut 2.8, which dates all the way back to 2013. Current version is 3.2. Oddly enough, freeglut 2.8 is listed as freeglut3 in the repositories, even though it’s still technically freeglut2.

Reason for the query: the version of Asymptote (2.67) that ships with Ubuntu 20.10 (via TeXLive 2020) throws a segfault whenever you try to compile a 3D image to PDF. In particular: take any Asymptote example that loads the three library and run asy -f pdf -noprc example.asy.

You’ll get output, but you also get a segmentation fault. (I learned after plenty of correspondence with one of the Asymptote devs that it’s actually a floating point exception, but in any case…)
If you install the latest freeglut3 from source, using the instructions provided on the Asymptote website, everything works fine.

I’m not really sure why freeglut has been held back to a version that’s 7 years old.

usa – Is it possible to go through the Otay crossing as a pedestrian without taking any stair (e.g., in case of wheelchair or heavy luggage)?

There are ramps to/from the bridge over the freeway.

enter image description here

Ramp up to bridge:

enter image description here

Ramp down:

enter image description here

The rotating gate might seem like an obstacle, but I believe it is quite large/wide. There are a lot of people who pass through these with large parcels, crates, trolleys, luggage, strollers, etc. I imagine a wheelchair should be fine but I haven’t seen anyone pass through with these.

Here is a screenshot from Google Street View showing the gate. That could be another gate to the left of the fence, but it doesn’t look like that actually has access from the ramp.

enter image description here

postgresql – Case Insensitive ORDER BY clause using COLLATE

I have spent a long time looking for this, and I am getting mixed messages.

In other DBMSs (tested in SQLite, Oracle, MariaDB, MSSQL) I can override the default sort order using the COLLATE clause:

SELECT *
FROM orderby
ORDER BY string COLLATE … ;

--  SQLite:     BINARY | NOCASE
--  MariaDB:    utf8mb4_bin | utf8mb4_general_ci
--  Oracle:     BINARY | BINARY_CI
--  MSSQL:      Latin1_General_BIN | Latin1_General_CI_AS

I have pored over the documentation and searched high and low, but I can’t find anything so straightforward for PostgreSQL.

Is there a COLLATE clause value that would sort Case Insensitive?

I know there are many questions regarding case sensitivity, but (a) most of them are old and (b) none that I have seen relate to the COLLATE clause.

FWIW, I am testing on PostgreSGL 11.8. I have a test fiddle on http://sqlfiddle.com/#!17/05cab/1, but it’s only for PostgreSQL 9.6.

c++ – Generic test case templates

I often find that when I am writing, refactoring, or reviewing code that I want to do some simple testing. There are many existing test frameworks such as gtest and cppunit but my desire was to create something much simpler and with fewer features.

Specifically, I have two use cases in mind:

  1. I have some test input values with known desired outputs
  2. I have an existing function that I want to optimize but keep correct

For both of these, I’ve create a very simple pair of templated objects after studying my own use of such techniques in existing code. In looking at how I use such code, I find that I have three general uses:

  1. I want pretty color printing to the screen with good values in green and bad ones in red
  2. I want to redirect the output to a file without the pretty colors
  3. I want to run all the tests and just silently get a bool that indicates whether all tests passed

Here are the templates I’d like to get reviewed.

testcase.h

#ifndef EDWARD_TEST_CASE
#define EDWARD_TEST_CASE

#include <string>
#include <string_view>
#include <vector>
#include <iomanip>
#include <iostream>

namespace edward {

static const std::string CSI{"x1b("};
static const std::string RED{CSI + "31m"};
static const std::string GREEN{CSI + "32m"};
static const std::string RESET{CSI + "0m"};

static const std::string badgood(2)(2){ 
    { "(BAD) ", "(OK) " },
    { RED + "(BAD) " + RESET, GREEN + "(OK)  "+ RESET },
}; 

template <class InputType, class OutputType>
class TestCollection {
    struct TestCase {
        InputType input;
        OutputType expected;
    };
public:
    TestCollection(OutputType (*testfunc)(InputType), std::vector<TestCase> tests) 
        : testfunc{testfunc}
        , tests{tests}
    {}
    bool testAll(bool verbose = true, bool color = true) const {
        return verbose ? verboseTest(color) : quietTest();
    }
private:
    bool quietTest() const {
        bool good{true};
        for (const auto& t : tests) {
            good &= (testfunc(t.input) == t.expected);
        }
        return good;
    }
    bool verboseTest(bool color = true) const {
        bool good{true};
        std::size_t i{0};
        for (const auto& t : tests) {
            auto result = testfunc(t.input);
            bool isOK = result == t.expected;
            good &= isOK;
            std::cout << badgood(color)(isOK)
                << "Test #" << i << ": "
                << std::boolalpha << "got "" << result 
                << "", expected "" << t.expected 
                << "" from "" << t.input << ""n";
        }
        return good;
    }
    OutputType (*testfunc)(InputType);
    std::vector<TestCase> tests;
};

template <class InputType, class OutputType>
class DynamicTest {
public:
    DynamicTest(OutputType (*testfunc)(InputType), OutputType (*trustedfunc)(InputType))
        : testfunc{testfunc}
        , trustedfunc{trustedfunc}
    {}
    bool test(InputType in, bool verbose = true, bool color = true) const {
        return verbose ? verboseTest(in, color) : quietTest(in);
    }
private:
    bool quietTest(InputType in) const {
        return testfunc(in) == trustedfunc(in);
    }
    bool verboseTest(InputType in, bool color = true) const {
        OutputType result{testfunc(in)};
        OutputType expected{trustedfunc(in)};
        bool isOK{result == expected};
        std::cout << badgood(color)(isOK)
            << std::boolalpha << "got "" << result 
            << "", expected "" << expected 
            << "" from "" << in << ""n";
        return isOK;
    }

    OutputType (*testfunc)(InputType);
    OutputType (*trustedfunc)(InputType);
};

}; // end of namespace EDWARD

#endif // EDWARD_TEST_CASE

Here is some sample test code that exercises both templates and illustrates the intended use. Note that these use this idiom to decide whether or not to print color:

bool color{static_cast<bool>(isatty(STDOUT_FILENO))};

This works on Linux (or any POSIX compliant) machines but is not, to my knowledge, portable to Windows. Rather than make the template non-portable, I simply omit it from the templates and rely on the caller. Also note that the printing is only done to std::cout in the template. Here again, I found that it’s the only way I used existing code, so I didn’t incorporate features I’ve never used.

main.cpp

#include "testcase.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <unistd.h>

bool isInteger(const std::string& n) {
    if (n.size() > 1) {
        return std::all_of(n.begin() + 1, n.end(), isdigit)
            && (isdigit(n(0)) || (n(0) == '-') || (n(0) == '+'));
    }
    return isdigit(n(0));
}

void one() {
    bool verbose{true};
    bool color{static_cast<bool>(isatty(STDOUT_FILENO))};

    static const edward::TestCollection<const std::string&, bool> tc{ isInteger, {
        {"+", false},
        {"-", false},
        {"0", true},
        {"3", true},
        {"9", true},
        {"a", false},
        {"99a9", false},
        {"9909", true},
        {"", false},
        {"this test lies", true},  // deliberately bad test
        {"-3.14", false},
        {"+32768", true},
        {"-32768", true},
    }};
    auto result{tc.testAll(verbose, color)};
    std::cout << "All tests " << (result ? "passed" : "did NOT pass") << "n";
}

int square_it(int x) {
    return std::pow(x, 2);
}

void two() {
    bool verbose{true};
    bool color{static_cast<bool>(isatty(STDOUT_FILENO))};

    edward::DynamicTest<int, int> dt{()(int x)->int{return x*x;}, square_it };
    bool result{true};
    for (int i{-5}; i < 5; ++i) {
        result &= dt.test(i, verbose, color);
    }
    std::cout << "All tests " << (result ? "passed" : "did NOT pass") << "n";
}

int main() {
    one();
    two();
}

I’m interested in a general review.

web app – What UI/UX best practices are applicable in the case of RWAs?

Recently, we have started work on a Rich Web Application (RWA) project. In the process of choosing a suitable UI framework, and web components. Is there a difference between choosing design patterns for a RWA and a standard website? If yes, what are those differences?

We have many UI frameworks on the market, UI/UX best practices and design patterns for the web. If a solution (e.g. Bootstrap) is widely accepted and it has been used, could we consider such solution suitable for a RWA?

Thanks in advance.

gui design – What Website UI/UX best practices are applicable in case of RWAs?

Recently, we have started a Rich Web Application (RWA) project. In the process of choosing a suitable UI framework –and also web components-, we faced with a problem; Is there any difference(s) between choosing a design pattern/approach for a RWA and for a normal website, in aspect of perspective and/or principles? If yes, what are those differences?

In other words, we have many UI frameworks in the market, many UI/UX best practices and some well-known design patterns for the web. If a solution (e.g. Bootstrap) is widely accepted and it has been used, could we consider such solution suitable for a RWA and vice versa? Basically, is it distinguishable?

Thanks in advance.

c – Erro “cannot jump from switch statement to this case label” ao adicionar outro case ao meu switch

Estou tentando adicionar outro case ao meu switch, porem apresenta esse erro acima. já verifiquei e não falta nenhum break nos cases anteriores. Porem, se eu excluir somente o case anterior ele não mais apresenta esse erro. Abaixo segue o código do case anterior.

case 5:
      printf("nDigite o valor da Largura e Comprimento da sala de aula e a distancia minima em metros recomendada respectivameten");
    scanf("%f %f %f", &Largura, &Altura, &Distancia_Minima);
    Semanas_Para_Fechar_O_Ciclo = ceil ((float) Cont_Quantidade_Aluno(Aln) / ((Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1)));
    printf("nnA turma com %d aluno(s) do nao grupo de risco foi dividida em %d grupo(s) para que haja o distanciamento adequado na sala de aula levando em consideracao a area da sala de aula e a distancia minima entre duas carteiras, sera preciso uma quantidade de %d semana(s) para que todos os alunos tenham a mesma quantidade de aulann",Cont_Quantidade_Aluno(Aln), Semanas_Para_Fechar_O_Ciclo, Semanas_Para_Fechar_O_Ciclo);
    printf("nnO grupo de alunos do grupo de risco contem uma quantidade de %d aluno(s) e eles deverão assistir as aulas de forma remotann",Cont_Quantidade_Aluno(Alunos_Grupo_De_Risco));
    //printf("nnnn");
    //printf("nQuantidade de alunos cadastrados = %dn", Cont_Quantidade_Aluno(Aln));
    //printf("nQuantidade maxima de alunos menos o professor = %dn", Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1);
    //printf("nProporcao de alunos na turma = %dn", Semanas_Para_Fechar_O_Ciclo);
    char Alocacao(Semanas_Para_Fechar_O_Ciclo)(Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1)(41);
    Aloca_Turma(Aln, (Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1), Semanas_Para_Fechar_O_Ciclo, Alocacao);
    //int L = Semanas_Para_Fechar_O_Ciclo;
    //int C = (Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1);
    //printf("nnLinhas = %d Colunas = %d", L, C);
    //for(i = 0; i < Semanas_Para_Fechar_O_Ciclo; i++){
    //  printf("nnTurma de numero %dnn", (i+1));
    //  for (j = 0; j < (Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1); j++){
    //    printf("nnPosicao (%d)(%d)Alunos = %s nn",i,j, Alocacao(i)(j));
    //  }
    //}
    Imprime_Turma_Alocada(Semanas_Para_Fechar_O_Ciclo, (Quantidade_Alunos_Sala(Altura, Largura, Distancia_Minima) - 1), Alocacao, Dias_Letivo, Horario_Escolar);
    break;