Quaratine Objectives?

Yeah almost exclusively in the terminal. Not often though

Forum for Maximum Shitposting

Now this is a cause I’m ready to support.


Don’t know if I’m essential employee or not but it doesn’t matter if I’m at the office or working form home there’s still too much to do and too little time.

But things I try to or want to focus on:

  • Get enough sleep
  • Play games and relax after work.
  • Exercise at least a little
  • Tinker more with AwesomeWM
  • Maybe finally start some online Java course from Udemy
  • Install ZSH and see what’s the fuss is all about.
3 Likes

I am looking to build a home server, and then L1 just put out a video about “World Backup Day!” Sweet.

2 Likes

Since I am complete retard and bored off my tits I decided to do something completely useless…
I am programing an algorithm for building spaceships…
It’s much less exciting than it sounds.

Still working at home like I was before quarantine.

It’s OK though. My procrastination has been trying to patch the ~45 1-inch holes drilled into the drywall around my house from the dry out process when my house flooded. :slight_smile: I’d rather work on work than that.

1 Like

Personally, my goal is to get through my O’Reilly web development book. I got XAMPP set up on my desktop on Ubuntu 19.10 with no help from the book because it only gets into specifics for macOS and Windows. So far the beginning of the book is all terms and concepts so I’m kinda just breezing through it to get an overview because I won’t remember the specifics anyways.

I’d also like to get into game development a little bit. Just some really simple stuff. I found a website called The 7drl Challenge that I would like to do if I still have time after getting through my book.

1 Like

Dodged a bullet there

Oh yeah? Watch me! :smiling_imp:


Realistically I am about to put my media NAS together … on a bench table. Weird, I know. It kinda makes sense, trust me.
I also still have to sell tons of stuff which needs to be photographed, I’ll probably do that first.

1 Like

Quarantine objective

7 Likes

for(i = 0; i < sizeof(fptr); i++)

sizeof(fptr) will be 4 or 8 depending on your architecture, I think what you wanted was the filesize, not the size of *FILE. See fseek and ftell, or stat

Really though if you are reading the entire file you should just loop until fgets returns EOF. If you are trying to get a line count which it looks like, you need to first read the entire file and count how many lines there are.

1 Like

what are you doing to that poor thinkpad?

-edit- nvm, libreboot.

How’d it go?

1 Like

To transform into a guitar ? :stuck_out_tongue:

4 Likes

Get my plex server fully loaded.

1 Like

Yes - roundabout intro when?

2 Likes

Fucking game changer. I never had more than 8 todos in the app. You were right, as soon as I added a 9th it didn’t work.

1 Study C
2 Discrete Mathematics
3 Review Code
4 Be Tony Stark
5 Tell Wendell you love him
6 Exercise
7 Build AdminDevOS
8 Time travel

Added a function to get line count

1 Study C
2 Discrete Mathematics
3 Review Code
4 Be Tony Stark
5 Tell Wendell you love him
6 Exercise
7 Build AdminDevOS
8 Time travel
9 Write Supernatural fanfic
[chris@adlabs-server todo]$ ./todo add "Last task"
[chris@adlabs-server todo]$ ./todo list
1 Study C
2 Discrete Mathematics
3 Review Code
4 Be Tony Stark
5 Tell Wendell you love him
6 Exercise
7 Build AdminDevOS
8 Time travel
9 Write Supernatural fanfic
10 Last task

[chris@adlabs-server todo]$ ./todo delete 7
[chris@adlabs-server todo]$ ./todo list
1 Study C
2 Discrete Mathematics
3 Review Code
4 Be Tony Stark
5 Tell Wendell you love him
6 Exercise
7 Time travel
8 Write Supernatural fanfic
9 Last task

It’s appalling how much I suck at C but I am appreciative for all the help :smiley:

2 Likes

You’re on your way :smiley:

3 Likes

<3 <3 thank you

I keep little nicknacks around to remind me every day

4 Likes

If you never intend to edit the file with a plain text editor I would suggest you use a binary format that has a header with the line count, that way you wouldn’t have to iterate the entire list just to get the number of lines.

You could even go futher, since your todo entries are short, use a fixed length record which would then let you just jump to entries because you can calculate their offsets, and if storing records you could even store some status information, ie.

Note: untested pseudo code written at midnight off the top of my head

#include <stdint.h>
#include <stdio.h>

#define TODO_FILE_VERSION 0x0101 // 1.01

struct ToDoHeader
{
  uint16_t version;     // file format version
  uint16_t recordCount; // 16-bit, max 65536
};

#define STATUS_NOT_STARTED 0
#define STATUS_IN_PROGRESS 1
#define STATUS_ON_HOLD     2
#define STATUS_COMPLETED   3

const char * RecordStatusStr[] = {
  "Not Started", "In Progress", "On Hold", "Completed" };

struct ToDoRecord
{
  uint8_t status;
  char data[256]; // the text, null terminated
};

void printToDo(uint16_t number)
{
  struct ToDoHeader header;
  FILE *fp = fopen("todo.dat", "r");

  if (!fp) {
    printf("failed to open the file\n");
    return;
  }

  if (fread(&header, sizeof(header), 1, fp) != 1) {
    printf("failed to read the header\n");
    fclose(fp);
    return;
  }

  if (header.version != TODO_FILE_VERSION) {
    printf("unsupported file version 0x%04x\n", header.version);
    fclose(fp);
    return;
  }

  if (number >= header.recordCount) {
    printf("invalid ToDo number\n");
    fclose(fp);
    return;
  }

  const long int entryOffset = sizeof(struct ToDoRecord) * number;
  if (fseek(fp, entryOffset, SEEK_CUR) != 0) {
    printf("failed to seek\n");
    fclose(fp);
    return;
  }

  struct ToDoRecord record;
  if (fread(&record, sizeof(record), 1, fp) != 1) {
    printf("failed to read the record\n");
    fclose(fp);
    return;
  }

  printf("%d. %s (%s)\n", number, record.data, RecordStatusStr[record.status]);
  fclose(fp);
}

I will leave the write functionallity side of this as an excersise for you :slight_smile:

2 Likes

not finished yet. went back to work and havent had time. next week probably.


To everyone:

image0%20(1)

3 Likes

o-okay…

drinks glass of water