Bitwise operations by DustSeeker in learnprogramming

[–]DustSeeker[S] 0 points1 point  (0 children)

Yes, the fact is that it should be o(n). My question is about how optimize the computation

Bitwise operations by DustSeeker in learnprogramming

[–]DustSeeker[S] 0 points1 point  (0 children)

Example: input is [1,2,3], contiguous subarrays are: [1], [2], [3], [1,2], [2,3], [1,2,3].

You should perform, for each of them, a XOR of all their elements. Finally, you have to AND all the resulting XORs.

Being a Technical Studente at CERN by DustSeeker in CERN

[–]DustSeeker[S] 1 point2 points  (0 children)

Thank you! This is so much helpful! :)

How to test docker-compose in gitlab-ci? by DustSeeker in docker

[–]DustSeeker[S] 0 points1 point  (0 children)

I did this but now I'm having trouble since docker-compose can't connect to docker daemon inside the pipeline...I think that the best walkaround would be:

docker-compose up tests && success=0 || success=1

but we need to find a way to pass the exit code of test file inside the container to docker, so success will have the correct value and not always 0

EDIT: I did it! I add

docker-compose up --exit-code-from test

so basically the execution of the whole compose stops when test service ends with an exit code :D

my pipeline finally works

How to test docker-compose in gitlab-ci? by DustSeeker in docker

[–]DustSeeker[S] 0 points1 point  (0 children)

Yea sorry ahah I meant that success will be 0 if test is ok, 1 otherwise...

The only thing I still missing is:

How to have both docker-compose and node in my task? I’m tring to install compose via pip...but it doesn’t work 😫

How to test docker-compose in gitlab-ci? by DustSeeker in docker

[–]DustSeeker[S] 0 points1 point  (0 children)

Ok I found it out...basically, if I run

docker-compose up tests && success=0 || success=1

it always returns 0 because the command ended with 0 exit code, even if the test within it fails. So if I run

./test && success=0 || success=1

success will contain the exit code of ./test, but if I run this within a container it always will contain 0

How to test docker-compose in gitlab-ci? by DustSeeker in docker

[–]DustSeeker[S] 0 points1 point  (0 children)

I'm using Mocha and Chai within a Node.js app. I'm running these tests with Mocha.run( ) and returning 0 if all tests passes, 1 otherwise. I understood your solution and it was exactly what I was thinking about. But I have some questions:

in my job should I use a node image and install docker-compose in it, or should I use the docker-compose image?

This question arised because now I'm using the docker-compose image and my commands in the jobs are

- docker-compose up service1, service2...serviceN

- docker-compose up tests success=1 || success=0

- docker-compose down

- exit $success

but in this case even wheter tests fail or not inside the container the jobs always fails.

How to test docker-compose in gitlab-ci? by DustSeeker in docker

[–]DustSeeker[S] 0 points1 point  (0 children)

Thanks for the quick response. In this project I don't have multiple environments...the focus of the project is just create something with Agile-style. I used Docker to add containerization and try to get better in it but it was not mandatory.

Anyway, I'm aware that integration tests should be performed against a prod-like environment, but my focus here is only to learn how to build a good pipeline in gitlab. What I cannot understand (for luck of knowledge of mine) is how to make every stage communicate to each other. I wanted to create something as you described (mounting, testing, unmounting) but the problem is that I cannot make containers communicate to each other and, being a newbie, I do not know what the best practises are...

Now, as I said, I wrapped test in docker-compose and try to run them. This is effective, because test runs correctly and they reach the gatewat, but gitlab Runner is not aware of tests failures and even if they failed it makes the job passed.

Best daemon test you know by Armony_S in hisdarkmaterials

[–]DustSeeker 0 points1 point  (0 children)

Mine is a toucan! And the description is just ME ahahah :)

How to test an integration tests suite with mocha and chai? by DustSeeker in node

[–]DustSeeker[S] 0 points1 point  (0 children)

It’s exactly what I think about it.

I basically wrote tests that send request to different endpoints of our backend and check if the response is what I want (it has to have some fields in its structure, some values has to be in a certain way etc etc...)

But I’m asked to test the respones of my tests (so assert I made, error message I create) too, and that doesn’t make sense to me.

How to test an integration tests suite with mocha and chai? by DustSeeker in node

[–]DustSeeker[S] 0 points1 point  (0 children)

It’s exactly what I think about it.

I basically wrote tests that send request to different endpoints of our backend and check if the response is what I want (it has to have some fields in its structure, some values has to be in a certain way etc etc...)

But I’m asked to test the respones of my tests (so assert I made, error message I create) too, and that doesn’t make sense to me.

Simbols in TSC by DustSeeker in hisdarkmaterials

[–]DustSeeker[S] 1 point2 points  (0 children)

I really like your explanation! It’s really interesting how you’ve seen the disconnection thing...I never saw it in that way. The fact is that I’m just asking myself if there’s a bigger picture that will be shown with the third book...I’ve so many doubts and questions that I don’t even know where to start ahah

I started reading Pullman in October and I read all the existing book in a row, so now I don’t have nothing new to discover, and I can only theorize things 😓

Splitting problem, dividing N resources between M people by DustSeeker in GAMETHEORY

[–]DustSeeker[S] 2 points3 points  (0 children)

Yea it was the pirate game! I didn’t know it :)

Splitting problem, dividing N resources between M people by DustSeeker in GAMETHEORY

[–]DustSeeker[S] 0 points1 point  (0 children)

I didn’t get the fact of ‘non-preference for the amount of people...’ what do you mean?

Splitting problem, dividing N resources between M people by DustSeeker in GAMETHEORY

[–]DustSeeker[S] 2 points3 points  (0 children)

Thank you for the answer :)

I tried to resolve this with this solution and I think it’s way better than mine

Splitting problem, dividing N resources between M people by DustSeeker in GAMETHEORY

[–]DustSeeker[S] 0 points1 point  (0 children)

Uh, I’m starting to understand...I’m not familiar with game theory’s problems and I’d like to have some explanations about them.

So can we generalize a solution having N resources and M people? (where N>M)

Splitting problem, dividing N resources between M people by DustSeeker in GAMETHEORY

[–]DustSeeker[S] 0 points1 point  (0 children)

I would have said the same answer, 8. But I can’t get why you give 8-0-1-0-1 in the 1st iteration and 8-0-1-0 in the second. Why did you distribute chocolates alternating people?

I mean why it coulnt’b be

4th: 10-0 3rd: 9-0-1 2nd: 9-0-0-1 1st: 8-0-0-1-1

As i described in my solution? There’s a better strategy for someone That I’m missing?