Skip to main content

Command Palette

Search for a command to run...

Day 39/100 100 Days of Code

Info Hunter

Updated
1 min read
Day 39/100 100 Days of Code
C

AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology.

He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.

I fixed 2 critical bugs in the program.

The first was that the program was not scanning the correct URLs because I forgot to remove a test value in the request_info() method.

 // From
cpr::Response r = Scraper::request_info(Scraper::baseURL);

// To
cpr::Response r = Scraper::request_info(getUrls[counter]);

The other one was that it failed to count the number of keywords each URL has. To fix it, I removed the original code and used the std::find and std::count algorithms to find the correct number of keywords.

// From
for (const auto &url : getSettingsUrl)
            getUrls.push_back(url);
        }

        if (std::find(getUrls.begin(), getUrls.end(), url) != std::end(getUrls))
        {
            counter++;
            continue;
        }
        else
        {
            urlCounterHolder.push_back(counter);
            counter = 0;
            getUrls.push_back(url);
            counter++;
        }
    }

// To
for (const auto &url : getSettingsUrl)
    {
        if (urlCounterHolder.empty())
        {
            int count = (int)std::count(getSettingsUrl.begin(), getSettingsUrl.end(),
                                        url);
            urlCounterHolder.push_back((count));
            getUrls.push_back(url);
        }


        if (std::find(getUrls.begin(), getUrls.end(), url) != std::end(getUrls))
        {
            continue;
        }
        else
        {
            int count = (int)std::count(getSettingsUrl.begin(), getSettingsUrl.end(),
                                        url);
            urlCounterHolder.push_back((count));
            getUrls.push_back(url);
        }
    }

I am pretty happy with the current state of the application. I will have to move on to the next project for now and might return later add more features or make some fixies.

Video Demonstration

100 Days of Code

Part 39 of 50

100 days of code is a good initiative to go into hard mode and spend more time in programming. These 100 days will be focused on completing projects and research.

Up next

Day 40/100 100 Days of Code

Rebuild Back Better