c++ – Event tracking system

I am a learning C++ programming and just learned about basic OOP and decided to create a simple project to test my understanding and practice what’ve learned. The idea I came up is a event tracking system where you add events into a calendar and then you get all of your events displayer. I have 2 classes: Event, where you events are created and Calendar, which holds a vector of all Events. Could you please review my code saying what are the most efficient ways of doing things and the best practices to be followed.

Main.cpp

#include "Calendar.h"

int main() {
    Calendar calendar {};

    calendar.add_event("Exam", "urgent", "10/12/2020", "10:30");
    calendar.add_event("Meeting", "non-urgent", "08/11/2020", ("12:20"));

    calendar.display_events();
}

Event.h

#include <string>

class Event {
private:
    std::string event_type;
    std::string event_priority;
    std::string event_date;
    std::string event_time;

public:
    Event(std::string eventType, std::string eventPriority, std::string eventDate,
          std::string eventTime);

    bool display_event() const;

    ~Event();
};

Event.cpp

#include "Event.h"
#include <iostream>
#include <utility>

Event::Event(std::string eventType, std::string eventPriority, std::string eventDate,
             std::string eventTime) : event_type(std::move(eventType)), event_priority(std::move(eventPriority)),
                                             event_date(std::move(eventDate)), event_time(std::move(eventTime)) {
}

bool Event::display_event() const {
    std::cout << "You have " << event_type << " on " << event_date << " at " << event_time << " it's " << event_priority << "n";
    return true;
}


Event::~Event() = default;

Calendar.h

#include "Event.h"
#include <vector>

class Calendar {
private:
    std::vector<Event> calendar;

public:
    bool display_events() const;

    bool add_event(std::string event_type, std::string event_priority, std::string event_date, std::string event_time);

    const std::vector<Event> &getCalendar() const;

    bool is_event_valid(const std::string& event_date, const std::string& event_time);

    ~Calendar();
};

Calendar.cpp

#include "Calendar.h"
#include <iostream>
#include <utility>

const std::vector<Event> &Calendar::getCalendar() const {
    return calendar;
}

bool Calendar::display_events() const {
    if (!getCalendar().empty()) {
        for (const auto &event : calendar) {
            event.display_event();
        }
        return true;
    } else {
        std::cout << "Your calendar is empty n";
        return false;
    }
}

bool Calendar::add_event(std::string event_type, std::string event_priority, std::string event_date,
                         std::string event_time) {

    if (is_event_valid(event_date, event_time))
    {
        Event event {std::move(event_type), std::move(event_priority), std::move(event_date), std::move(event_time)};
        calendar.push_back(event);
        return true;
    } else {
        std::cout << "Event is not validn";
        return false;
    }
}

bool Calendar::is_event_valid(const std::string& event_date, const std::string& event_time) {
    int day{}, month{}, year{}, hours{}, minutes{};

    day = std::stoi(event_date.substr(0,2));
    month = std::stoi(event_date.substr(3, 2));
    year = std::stoi(event_date.substr(6, 4));
    hours = std::stoi(event_time.substr(0, 2));
    minutes = std::stoi(event_time.substr(3, 2));

    bool is_date_valid = (day > 0 && day <= 24) && (month > 0 && month <= 12) && (year >= 2020 && year <= 3030);
    bool is_time_valid = (hours >= 0 && hours <= 24) && (minutes >= 0 && minutes <= 60);

    if (is_date_valid && is_time_valid) {
        return true;
    } else {
        std::cout << "The event's time or date is not validn";
        return false;
    }
}

Calendar::~Calendar() = default;

I am also thinking about adding a feature where you can sort the events by date.

What happens if you disable System Firmware in Device Manager?

In Device Manager, there is the option to disable System Firmware. Just out of curiosity, what would happen if you tried to disable the System Firmware in Device Manager? Would it let you? What would the outcome be?

root access – Best adb command and system tweaks for non rooted phone to get closer to rooted experience

As I always owned rooted phones I find frustrating living with all the limitations of non-rooted phones.

I would like to list here all the adb commands you can issue and system settings you can tweak to get your non-rooted phone experience closer to a rooted one. In a way decreasing “security” when connected to a PC.

Especially targeting Android 10+

Of course we all know everything starts enabling Developer Options and USB Debug

I can execute some pm disable package or pm uninstall package to get rid of some bloat system apps.

Then I can do some setting put global parameter n to tweak some system settings.
I.E. setting put global dropbox_max_files 9 limits the number of files in /data/system/dropbox directory (unaccessible) to 9 instead of hundreds (if not thousands).
Dropbox app not installed, but there is log activity in /data/system/dropbox

Finally there’s pm grant com.package.name android.permission.WRITE_SECURE_SETTINGS to play with…

OXOO – Android Live TV & Movie Portal App with Subscription System

Tutifruti submitted a new resource:

OXOO – Android Live TV & Movie Portal App with Powerful Admin Panel – Android Live TV & Movie Portal App with Powerful Admin Panel

View attachment 24473

OXOO is an amazing android live TV & movie portal application.Which included PHP admin dashboard script.You will able to…​

Read more

mysql – Unknown system variable ‘post_content’

Why Error – Unknown system variable ‘post_content’

foreach( $posts as $post ) {

            $post_content = $this->add_image_dimensions( $post->post_content );

            if( $post_content != $post->post_content ) {

                $query = "UPDATE " . $wpdb->prefix . "posts";
                $query = " SET post_content = '" . $post_content . "' WHERE ID = " . $post->ID;

                $wpdb->query( $query );

            }

Sorry for my English

linux – How to change the file system of a partition in a RAID 1?

First, sorry if the question has already been asked and correctly answered, I did not find anything that satisfies me.

I rent a dedicated machine in a datacenter, the machine run with a Debian 10 and has two drives in RAID 1, there are 3 partitions: one for the boot, one for the swap and one for the rest.

The third (/dev/md2) uses the ext4 file system and I would like to use XFS instead.

I am not used to changing the filesystem and this is the first time I have a machine with RAID so I do not know how to do it.

This is a new installation so there is no risk of losing data.

I tried a mkfs.xfs /dev/md2 but it didn’t work:

root@Debian-105-buster-64-minimal ~ # mkfs.xfs /dev/md2
mkfs.xfs: /dev/md2 contains a mounted filesystem

And I don’t know how it should be unmount/mount due to the RAID.

Thank you in advance for the help.

The df -Th command :

root@Debian-105-buster-64-minimal ~ # df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs   32G     0   32G   0% /dev
tmpfs          tmpfs     6.3G  516K  6.3G   1% /run
/dev/md2       ext4      437G  1.2G  413G   1% /
tmpfs          tmpfs      32G     0   32G   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/md1       ext3      487M   53M  409M  12% /boot
tmpfs          tmpfs     6.3G     0  6.3G   0% /run/user/1000

the fdisk -l command :

root@Debian-105-buster-64-minimal ~ # fdisk -l
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLB512HAJQ-00000
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0289e0d1

Device         Boot    Start        End   Sectors   Size Id Type
/dev/nvme0n1p1          2048   67110911  67108864    32G fd Linux raid autodetect
/dev/nvme0n1p2      67110912   68159487   1048576   512M fd Linux raid autodetect
/dev/nvme0n1p3      68159488 1000213167 932053680 444.4G fd Linux raid autodetect


Disk /dev/nvme1n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLB512HAJQ-00000
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbcb5c0d2

Device         Boot    Start        End   Sectors   Size Id Type
/dev/nvme1n1p1          2048   67110911  67108864    32G fd Linux raid autodetect
/dev/nvme1n1p2      67110912   68159487   1048576   512M fd Linux raid autodetect
/dev/nvme1n1p3      68159488 1000213167 932053680 444.4G fd Linux raid autodetect


Disk /dev/md1: 511 MiB, 535822336 bytes, 1046528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md0: 32 GiB, 34325135360 bytes, 67041280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md2: 444.3 GiB, 477076193280 bytes, 931789440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

The mdstat :

root@Debian-105-buster-64-minimal ~ # cat /proc/mdstat
Personalities : (raid1) (linear) (multipath) (raid0) (raid6) (raid5) (raid4) (raid10)
md2 : active raid1 nvme0n1p3(0) nvme1n1p3(1)
      465894720 blocks super 1.2 (2/2) (UU)
      bitmap: 0/4 pages (0KB), 65536KB chunk

md0 : active (auto-read-only) raid1 nvme0n1p1(0) nvme1n1p1(1)
      33520640 blocks super 1.2 (2/2) (UU)
        resync=PENDING

md1 : active raid1 nvme0n1p2(0) nvme1n1p2(1)
      523264 blocks super 1.2 (2/2) (UU)

unused devices: <none>

infinity – Queueing system M/M/∞

Queueing system M/M/∞
Customers arrive at a queueing system according to a Poisson process with
rate λ. The number of service stations is unlimited, such that all customers
are served at once. The service times for the different customers are assumed
independent and exponentially distributed with cumulative distribution function
F(t) = 1 − e
−µt, µ > 0.
Customers that have finished service leave the system immediately.
Let X(t) be the number of customers in service at time t. Assume X(0) =
0.
a) Explain why X(t) is a birth and death process and give the birth and
death rates for this process.
b) What is the expected time until there are four customers within the
system for the first time? Find this probability when λ = 57 per hour
and µ = 1.05 per minute.
c) Find M(t) = E(X(t)) by deriving and solving a differential equation.

looking for a script – Which Content Management System (CMS)/Wiki should I use?

The Webmasters FAQ outlines the nature of acceptable questions for this site: researching available solutions and providing anecdotal advice falls outside the purpose of this StackExchange site, so this type of question would be better-suited to chat or another discussion forum.

That being said, there are a variety of free and open source content management systems, as well as licensed software and paid services, which may meet your requirements.

Some of the most popular content management systems include:

  • WordPress (PHP, free and open source) – a blogging platform which has expanded to include many other features – See the wordpress stackexchange if you have any questions.
  • Joomla (PHP, free and open source)
  • Drupal (PHP, free and open source) – See the drupal stackexchange if you have any questions.
  • DotNetNuke (ASP, proprietary or free and open source option)
  • MediaWiki (PHP, free and open source) – the software that powers Wikipedia
  • Umbraco (MVC.NET, open source)
  • DokuWiki (PHP, free and open source) – a simple but powerful wiki software
  • Typo3 (PHP, Open Source (GPL)) – powerful for medium and large projects

All of the content management systems listed above are built around the concept of plug-ins which extend the application’s functionality—there are many plug-ins, with new plug-ins authored every day.

Sites like The CMS Matrix and WikiMatrix can help you compare CMS’s (but is best suited for looking for very particular combinations of requirements).

If you have researched content management systems and available plug-ins but cannot find anything that will meet your needs, you should consult a developer who can build something to your specifications either as a plug-in for an existing content management system or as a stand-alone application.

memory – How does one completely scrub all definitions from the system so that an evaluation of a notebook starts fresh?

I tend to code in small chunks before putting it all together into a larger sum that does a lot more. In doing so I often need to erase or delete as much as possible from memory and cache (including all symbols and messages) so that I can do a fresh new Evaluation of a Notebook without hidden definitions, bugs, etc. corrupting my work. Here is what I usually do.

FrontEndExecute(FrontEndToken("DeleteGeneratedCells"))
ClearAll("Global`*")
Remove(list of symbols)
ClearSystemCache("Symbolic")

For context I am only running Mathematica locally. Am I doing this correctly? Should I do more? Should I do less? Is any of this redundant? How would you scrub the entire system so you have a completely fresh start every time you do an Evaluation?

stability theory – Show that the system is $ell{infty}$ stable with zero bias

I have this problem:
Consider a system defined by the memoryless function $y=u^frac{1}{3}$ and show that the system is $ell{infty}$ stable with zero bias.

What does it mean, physically, that a system is $ell{infty}$ stable and have zero bias?

What makes $ell{infty}$ stability different from e.g. $ell_2$ stability?