How We Migrated Hundreds of Posts from Hugo to Webflow

Featured Imgs 23

We have recently completed the migration of Nebula Graph’s website from Hugo to Webflow, moving from a static website to a more interactive one. There were a number of reasons for this decision, but most notably it was the performance and the ability to do things like form submission and no-code design.

While the redesign of the website on Webflow was easy, since we have an amazing in-house design team and Webflow is also very friendly to designers, the difficult part is migrating more than 100 blog posts we already published from Hugo to Webflow’s Content Management System (CMS).

Troubleshooting Memory Leaks With Heap Profilers

Featured Imgs 23

After a system runs for a long time, the available memory may decrease, and some services may fail. This is a typical memory leak issue that is usually difficult to predict and identify. Heap profilers are useful tools to solve such problems. They keep track of memory allocations and help you figure out what is in the program heap and locate memory leaks.

This article introduces how to use heap profilers, and how widely-used heap profilers, such as Go heap profiler, gperftools, jemalloc and Bytehound, are designed and implemented. I hope this article can help you better understand and use heap profilers for your own projects. 

Writing Into a txt file using linked list. The code I have listed is for re

558fe5180e0e8fc922d31c23ef84d240

This is the code for reading from a txt file, but creating a code for writing into a txt file that goes along with this reading code is pretty difficult and am looking for any ideas that can help me in implementing this using linked list along with txt files

I want to create a code to write Into a text file that goes along with the read code that I have listed down all using linked list.
Any ideas would be a big help and appreciated

#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>

using namespace std;

struct person_tag
{
    string name;
    string id;
};

struct course_tag
{
    string course_name;
    int no_of_units;
    int marks[4];
    double avg;
};

struct tutor_tag
{
    person_tag tutor_info;
    course_tag course_info;
    tutor_tag *next;
};

typedef struct tutor_tag Tutor_Tag;
typedef Tutor_Tag *Tutor_TagPtr;

Tutor_Tag *hptr;
Tutor_Tag *cptr;
Tutor_Tag *nptr;

//function protypes
void menu();
void read();
void display_tutors();

void
read()              //readfile function
{
    hptr = nptr = NULL;              //intialized to null
    string filename = "tutors.txt";
    ifstream inFile(filename);

    if (inFile.fail())               // if file doesnt open successfully
    {
    cout << "The File was not opened successfully\n";
    cout << "Please check that the file currently exists\n";
    exit(1);
    }
    while (true)         // until the end of the file
    {
    cptr = new Tutor_Tag;
    cptr->next = NULL;
    // Read the data into the new item
    inFile >> cptr->tutor_info.name;
    inFile >> cptr->tutor_info.id;
    inFile >> cptr->course_info.course_name;
    inFile >> cptr->course_info.no_of_units;
    for (int j = 0; j < cptr->course_info.no_of_units; j++) {
        inFile >> cptr->course_info.marks[j];
    }

    // Did you read it okay?
    if (inFile.fail()) {
        delete cptr;    // don't need it
        break;
    }

    // Okay, you read it. Add to the list
    if (hptr == NULL) {
        // First item in the list. Point hptr at it
        hptr = cptr;
    } else {
        // Not the first item, append it to the tail.
        nptr->next = cptr;
    }
    nptr = cptr;        // Move the tail pointer
    }
    inFile.close();              //close file
}

void
display()
{
    tutor_tag *ptr;
    ptr = hptr;
    while (ptr != NULL) {
    cout << "The Tutor Name: " << ptr->tutor_info.name << "  \n";
    cout << "The Tutor ID: " << ptr->tutor_info.id << "  \n";
    cout << "The course name: " << ptr->course_info.course_name << "  \n";
    cout << "Number of units " << ptr->course_info.no_of_units << "  \n";
    cout << " Rating recieved: \n";
    for (int j = 0; j < ptr->course_info.no_of_units; j++) {
        cout << ptr->course_info.marks[j] << "  \n";
    }
    cout << "The marks average is : " << ptr->course_info.avg << "  \n";
    ptr = ptr->next;
    }
}

int
main()
{
    read();
    cout << "The linked list is: ";
    display();
    return 0;
}