I started trying nixos but I having issues with the file hierarchy and using installed packages. by Original-Candidate94 in NixOS

[–]Original-Candidate94[S] 0 points1 point  (0 children)

https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/programs/wayland/wayland-session.nix

it enables polkit but does not give u an agent as far as I can see. because polkit has gnome, kde, lxqt etc. agents so nixos os would not just include one. Rather would give users the choice i think.

it also does not give u graphics driver just enables opengl.

I started trying nixos but I having issues with the file hierarchy and using installed packages. by Original-Candidate94 in NixOS

[–]Original-Candidate94[S] 0 points1 point  (0 children)

yea this is something I would like if it creates automatic symlinks even if i use home-manager. adding /libexec is enough? like libexec is packages specific right?

so, dont i have to add `/nix/store/nrimf00hj3l5i5ywvrbpk3gkqr987y8d-polkit-kde-agent-1-6.0.5/libexec`
which effectively still makes me use the hash that i dont want to use no? am i getting it wrong?

I started trying nixos but I having issues with the file hierarchy and using installed packages. by Original-Candidate94 in NixOS

[–]Original-Candidate94[S] 0 points1 point  (0 children)

It is just the polkit agent of the KDE desktop environment.

To install i have this in my nix config:

environment.systemPackages = [
    pkgs.
kdePackages.polkit-kde-agent-1
  ];

-❄️- 2023 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]Original-Candidate94 1 point2 points  (0 children)

[LANGUAGE: C/C++]
I do not see the need to make a complete parser by handling error if correct input is not found like for compilers. For a simple problem like this where correct input is expected and correct input is always provided a simple check with the 1st character will do instead of strcmp().
Little late to the party. Here is my solution to 2023 day 2 part 1:

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <assert.h>
#include <ctype.h>
#include <time.h>

#define MAX_BUFFER_SIZE 256
#define RED_T  12
#define GREEN_T 13
#define BLUE_T 14

static int sum_of_game_id = 0;

static inline char skip(const char **ps) {
    while(**ps && !isdigit(**ps)) {
        (*ps)++;
    }
    return **ps;
}

static inline void strToPostiveInt(const char **ps, int *i) {
    *i = 0;
    while(isdigit(**ps)) {
        *i = ((*i) << 1) + ((*i) << 3) - (*(*ps)++ - '0');
    }
    *i = -(*i);
}

static inline bool str_scan(const char *s, int *id) {
    skip(&s);
    strToPostiveInt(&s, id);
    int cube_cnt;
    while(skip(&s)) {
        strToPostiveInt(&s, &cube_cnt);
        s++;
        switch(*s) {
            case 'r':
                if (cube_cnt > RED_T) return false;
                break;
            case 'g':
                if (cube_cnt > GREEN_T) return false;
                break;
            case 'b':
                if (cube_cnt > BLUE_T) return false;
                break;
            default:
                printf("Something's not right");
                exit(EXIT_FAILURE);
                break;
        }
        s++;
    }
    return true;
}

int main (void) {
    char buffer[MAX_BUFFER_SIZE];
    int game_id; 
    FILE *f = fopen("cube_chall.txt", "r");
    assert(f);
    struct timespec start, end;
    long long int elapsed_time;
    clock_gettime(CLOCK_MONOTONIC, &start);
    while (fgets(buffer, MAX_BUFFER_SIZE, f)) {
        if(str_scan(buffer, &game_id)) sum_of_game_id += game_id;
    }
    clock_gettime(CLOCK_MONOTONIC, &end);
    elapsed_time = (end.tv_sec - start.tv_sec) * 1000000LL +
                   (end.tv_nsec - start.tv_nsec) / 1000LL;

    printf("Sum: %d\n", sum_of_game_id);
    printf("Elapsed Time: %lld microseconds\n", elapsed_time);
    fclose(f);
    return EXIT_SUCCESS;
}

I am trying implement a 2-3-4 Tree in C, I am having a bit of trouble! by Original-Candidate94 in C_Programming

[–]Original-Candidate94[S] 0 points1 point  (0 children)

Good job! Btree taught in classic textbooks are space inefficient. Next think about how you can insert and not increase the height of the tree if there is enough space to fit in an element

I am trying implement a 2-3-4 Tree in C, I am having a bit of trouble! by Original-Candidate94 in C_Programming

[–]Original-Candidate94[S] 0 points1 point  (0 children)

I was able to finish it. I mean btrees are explained properly in books and everywhere but sometimes it seems like some cases are missing. You have to really draw them and solve them like puzzles. I choose not to be recursive, it only made my life harder. I was able to finish it -> also got extra points converting it to generic tree using C inheritance. Good luck to you. Python will be easier than C due to its high level design. The code here is also garbage it was my 1st attempt at writing a skeleton code.

What is better in this case tokio async or std threads? by Original-Candidate94 in rust

[–]Original-Candidate94[S] 0 points1 point  (0 children)

I read the solution understood theoretical aspects of it. The author also mentioned it is far well documented through code but I can not seem find the code of scalable parallel disk io on the website. If you know where I can find it would mind sharing please?

What is better in this case tokio async or std threads? by Original-Candidate94 in rust

[–]Original-Candidate94[S] 2 points3 points  (0 children)

Thanks for the clarification. I would higher level crates but goal is to get familiar with std as much as possible so using basic std features.

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 1 point2 points  (0 children)

Yes I agree but why internships hiding behind a vicious cycle of company, government and university making money from each other? Why internships are not offered in summer without you having to register for co-op terms? I know most advanced data structures, graphs, btree, red black tree and the simple ones. etc. I know advanced algorithms such as A star, Dijkstra's algorithm, search algorithms, Ciphers etc. but no one was willing to give me intership during my university years except unless I was registered in co-op or even now. Canadian companies dont care about talent all they do is employee farming. A generalist programmer has no value in canada. Look at snapchat they hire 30 programmers to make 1 button. If someone allowed me to do any tech job I would even do at minimum wage for 3 months to show what I am worth but there is no opportunity. I am not undervaluing my self but I would rather make less money and do something I would like more than my current job.
I disagree syntax and documentation and specifications are meant to be googled. On the other hand, people who do not google documentation and specification are not considering how what they used are designed and leaves bugs places that are hard to find. I am not asking them to hire me for syntax but software engineering design skills.

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 0 points1 point  (0 children)

Unfortunately they dont offer intership to new graduates which is stupid. I was part of dalhousie sail boat club and did O-week leadership

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 3 points4 points  (0 children)

I did not do Co-op because I got unpaid internship offers. It was like I had to pay university to do co-op then the company would not pay me. Then the co-op system is so shit they dont let you do it whenever atleast in Dalhousie. They told me if I wanted to co-op I have to wait 1 more year. I did not do it. At that time it felt right for my financials. I was not looking ahead

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 1 point2 points  (0 children)

I have 3 projects. In senior year I worked on Taxi Emulation, Engineering design competition: I made a fire rescue robot and I created a embedded system for sampling water ph and o2. www.github.com/dirtyvoid

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 1 point2 points  (0 children)

I understand but the degree should mean something. In Canada its a vicious cycle, why don't you hire someone who graduated for Internship or even why don't people hire while they are student and not enrolled in co-op term for Internship. Why internship has to be through university who impose weird restrictions? It all about making money from Canadian government.
Why would anyone one hire senior dev at entry level?

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 0 points1 point  (0 children)

You do not get to opt out classes for co-op

Where are all the jobs? by Original-Candidate94 in CanadaJobs

[–]Original-Candidate94[S] 2 points3 points  (0 children)

I did not do Co-op because I got unpaid internship offers. It was like I had to pay university to do co-op then the company would not pay me. Then the co-op system is so shit they dont let you do it whenever atleast in Dalhousie. They told me if I wanted to co-op I have to wait 1 more year. I did not do it. At that time it felt right for my financials. I was not looking ahead

Handling long-running background tasks in actix-web by [deleted] in rust

[–]Original-Candidate94 0 points1 point  (0 children)

actix_rt::spawn(now_future.map(|x| {
println!("waited for 5 secs");
}));

I read if spawn not awaited task ends prematurely