How to enroll Macs on Profile Manager MDM using Terminal?

I’ve been tweaking the command profiles quite sometime now but the -password parameter doesn’t work. I’ve wanted to enroll machines using an MDM profile but it will require the user to input credentials via prompt which defeats our automation.

Additional: I can install Trust profiles from macOS server via terminal by simply executing `profiles -I -F but not the MDM.

SharePoint Online: Get User’s(People picker) Manager name and email id

I am on SharePoint Online environment. I have 3 columns Author(People picker, only people, no groups), Manager Name(text field) and Manager email(text field).

When a user fills out the Author column which is a people picker, I want to populate the Managers Name and Managers email id of that particular Author(not current logged in user) from Active Directory, before submitting/saving the form. If the Author field is changed/updated, I want the Managers Name and Managers email updated accordingly.

Please suggest?

Thanks

Files manager api in c++

I’m new to this community, so I’m not sure if it should be a topic here, so just let me know if I’m not in the right place.

I wrote a files manager api in c++, to make the read-write operations easier in read/write cases’ needing of big structured data to/from multiple files. I want to get a review of the library, if it’s readable and easy to understand, and if it serve it’s purpose.

File.hpp

#ifndef FILESAPI_FILE_H #define FILESAPI_FILE_H  #include <iostream> #include <mutex> #include <fstream> #include <vector> #include <boost/assert.hpp> #include "../utilities/DesignText.hpp" #include "../utilities/Exceptions.hpp"  namespace FilesApi {      /// Use in read/write for non-vectors overload operator. e.g: file >> rw_t<T>{val, 1};     template<typename T> struct rw_s {         T*          val;         size_t      val_size;          rw_s(T &value, size_t arr_size = 1) : val(&value), val_size(arr_size) {             assert(arr_size > 0);          }          rw_s(T *value, size_t arr_size = 1) : val(value), val_size(arr_size) {             assert(arr_size > 0);             assert(value != nullptr);         }     };      /// Wrapper function for creation of rw_t object, without need for specify the type after the function name     /// Instead of call:    f << rw_t<int>(a, size);     /// Call:               f << rw_soft(a, size);     template<typename T> rw_s<T> rw_soft(T &value, size_t arr_size = 1) {         return rw_s<T>(value, arr_size);     }      template<typename T> rw_s<T> rw_soft(T *value, size_t arr_size = 1) {         return rw_soft(*value, arr_size);     }      /**      * >> if file_mode is OPEN_IN_ACTION:      * SINGLE_AND_DONE - read/write single time, and then close the file.      * SINGLE_AND_MORE - read/write single time, but don't close the file yet. After single read/write the mode will automatic update to SINGLE_AND_DONE mode.      * MULTIPLE - close the file only in programmer order, until then the file will be remain open.      */     enum class ReadWriteMode {         SINGLE_AND_DONE,         SINGLE_AND_MORE,         MULTIPLE,         DONE     };      enum class FileAction {         READ,         WRITE,         NONE     };      enum class FileMode {         ALWAYS_OPEN,         OPEN_IN_ACTION     };      class File {     private:         bool is_ready;         std::string name;         std::string path;         FileMode file_mode;         ReadWriteMode read_write_mode;         int multiple_times_left;         FileAction file_action;         std::mutex read_write_mutex;         std::fstream file_ptr;         bool is_open;         std::ios_base::openmode read_flags;         std::ios_base::openmode write_flags;         bool use_exceptions;          /**          * Open file in specific format          * \param mode_flags - fstream.open() flags.          * \param new_file_action - Open purpose.          */         void open(std::ios_base::openmode mode_flags, const FileAction &new_file_action);          /**          * Auto update for the file's mode (READ / WRITE / NONE).          */         void update_rwm();          /**          * Close file          * \param automatic - Close request from API(true) or from User(false)          */         void close(bool automatic);          /**          * Is file ready for read/write actions. Exception if file not ready.          * \return Is file name not empty.          */         bool is_file_ready(int);      public:         /**          * Ctor          * \param file_name     - if @param file_path == "" => path/to/file/filename.bin else filename.bin          * \param exceptions    - Throw exceptions on errors Or use bold cout messages.          * \param file_path     - file's path.          */         explicit File(const std::string &file_name, bool exceptions = false, const std::string &file_path = "");          /**          * Close the file.          */         ~File();          /**          * Force close the file.          */         void close();          /**          * Set file's name.          * \param new_name - New file's name.          */         void set_name(const std::string &new_name);          /**          * Set file's name.          * \param new_name - New file's name.          */         File &operator=(const std::string &new_name);          /**          * Get file's name          * \return File's name.          */         std::string get_name();          /**          * Is file ready for read/write actions. Without exception if file not ready.          * \return Is file name not empty.          */         bool is_file_ready();          /**          * Init current file's mode          * \param mode - How much reads/writes until the file will close.          * \param multiple_times - if mode is multiple note how much times (-1 for unknown - won't close the file without programmer order/interrupt).          */         void init_read_write_mode(const ReadWriteMode &mode, int multiple_times = -1);          /**          * Init read fstream flags.          * \param read_flags - When open function in read mode will occur, those flags will be in use.          */         void init_read_flags(std::ios_base::openmode read_flags = std::ios_base::in);          /**          * Init write fstream flags.          * \param write_flags - When open function in write mode will occur, those flags will be in use.          */         void init_write_flags(std::ios_base::openmode write_flags = std::ios::out | std::ios::binary | std::ios::in);          /**          * Read to non-vector variable          * \param T - variable type          * \param val - variable address          * \param data_size - in case of array- array's size.          * \return this File object.          */         template<class T>         File &read(T *val, size_t data_size = 1);          /**          * Read to vector variable          * \tparam T - vector type          * \param val - vector to read into (Have to be initialize with the size of inputs' count).          * \param data_size - vector to read into (Have to be initialize with the size of inputs' count).          * \return this File object.          */         template<class T>         File &read(std::vector<T> &val);          /**          * Write non-vector variable          * \tparam T - variable type          * \param val - variable address          * \param data_size - in case of array- array's size.          * \return this File object.          */         template<class T>         File &write(const T *val, size_t data_size = 1);          /**          * Write vector variable          * \tparam T - vector type          * \param val - vector to write.          * \return this File object.          */         template<class T>         File &write(const std::vector<T> &val);          /**          * Read to vector          * \tparam T - vector type          * \param data - vector to read into          * \return this File object.          */         template<class T>         File &operator>>(std::vector<T> &data);          /**          * Read to non-vector          * \tparam T - variable type          * \param info - {          *                  val - variable non-vector to read into          *                  val_size - in case of array- array's size (else leave as default 1)          *               }          * \return this File object          */         template<class T>         File &operator>>(const rw_s<T> &info);          /**          * Write vector to file          * \tparam T - vector type          * \param data - vector to write          * \return this File object          */         template<class T>         File &operator<<(const std::vector<T> &data);          /**          * Write non-vector to file          * \tparam T - variable type          * \param info - {          *                  val - variable non-vector to write          *                  val_size - in case of array- array's size (else leave as default 1)          *               }          * \return this File object          */         template<class T>         File &operator<<(const rw_s<T> &info);     };      template<class T>     File &File::read(T *val, const size_t data_size) {         if (!is_file_ready(0)) {             return *this;         }         open(read_flags, FileAction::READ);         std::lock_guard<std::mutex> guard(read_write_mutex);          file_ptr.read((char *) (val), sizeof(T) * data_size);          update_rwm();         return *this;     }      template<class T>     File &File::write(const T *val, const size_t data_size) {         if (!is_file_ready(0)) {             return *this;         }         open(write_flags, FileAction::WRITE);         std::lock_guard<std::mutex> guard(read_write_mutex);          file_ptr.write(reinterpret_cast<const char *>(val), sizeof(T) * data_size);          update_rwm();         return *this;     }      template<class T>     File &File::read(std::vector<T> &val) {         if (!is_file_ready(0)) {             return *this;         }         open(read_flags, FileAction::READ);         std::lock_guard<std::mutex> guard(read_write_mutex);          file_ptr.read(reinterpret_cast<char *>(val.data()), sizeof(T) * val.size());          update_rwm();         return *this;     }      template<typename T>     File &File::write(const std::vector<T> &val) {         if (!is_file_ready(0)) {             return *this;         }         open(write_flags, FileAction::WRITE);         std::lock_guard<std::mutex> guard(read_write_mutex);          file_ptr.write(reinterpret_cast<const char *>(val.data()), sizeof(T) * val.size());          update_rwm();         return *this;     }      template<class T>     File &File::operator>>(std::vector<T> &data) {         return read(data);     }      template<class T>     File &File::operator>>(const rw_s<T> &info) {         return read(info.val, info.val_size);     }      template<class T>     File &File::operator<<(const std::vector<T> &data) {         return write(data);     }      template<class T>     File &File::operator<<(const rw_s<T> &info) {         return write(info.val, info.val_size);     } }  #endif //FILESAPI_FILE_H 

FilesManager.hpp

#ifndef FILESAPI_FILESMANAGER_H #define FILESAPI_FILESMANAGER_H  #include <iostream> #include <vector> #include <map> #include <memory> #include "File.hpp"  namespace FilesApi {     using add_data = std::tuple<const std::string, const std::string>;      class FilesManager {     private:         std::map<std::string, std::shared_ptr<File>> files;         size_t max_files; // zero for unlimited         std::string files_path; // Leave "" if there is no single path for all of the files         bool use_exceptions;          void remove_unusable_files();      public:         /**          * Ctor          * \param exceptions - Throw exceptions on errors Or use bold cout messages.          * \param max_files - Maximum files number to manage in this FilesManager object (0 for unlimited).          * \param files_path - if @param files_path == "" => in new file associate you will have to supply full          *                  file path, e.g: "path/to/file/filename.bin"          *                  else supply only file name, e.g: "filename.bin", if @param files_path == "path/to/file/"          */         explicit FilesManager(bool exceptions = false, size_t max_files = 0, const std::string &files_path = "");          /**          * Add new file          * \param id - file id (will be use to get this File object).          * \param file - file's name or path (if @files_path == "").          */         void add(const std::string &id, const std::string &file);          /**          * Remove file          * \param id - file's id          */         void remove(const std::string &id);          /**          * Get file          * \param id - file's id          */         File &get(const std::string &id);          /**          * Add new file          * \param data - tuple(0) => file id. tuple(1_ => file name or path (if files path is "").          */         void operator+=(const add_data &data);          /**          * Get file          * \param id - file's id          */         File &operator[](const std::string &id);          /**          * Remove file          * \param id - file's id          */         void operator-=(const std::string &id);     }; } #endif //FILESAPI_FILESMANAGER_H 

File.cpp

#include "../headers/File.hpp"  namespace FilesApi {     File::File(const std::string &file_name, bool exceptions, const std::string &file_path) {         name = file_name;         path = file_path;         is_ready = !name.empty();         use_exceptions = exceptions;         is_open = false;         file_mode = FileMode::OPEN_IN_ACTION;         read_write_mode = ReadWriteMode::DONE;         file_action = FileAction::NONE;         write_flags = std::ios::out | std::ios::binary | std::ios::in;         read_flags = std::ios_base::in;     }      File::~File() {         std::lock_guard<std::mutex> guard(read_write_mutex);         close();     }      void File::open(std::ios_base::openmode mode_flags, const FileAction &new_file_action) {         std::lock_guard<std::mutex> guard(read_write_mutex);         if (!is_file_ready(0)) {             if (is_open) {                 file_ptr.close();                 is_open = false;             }             return;         }         if (file_action != new_file_action) {             file_ptr.close();             is_open = false;             if (file_action != FileAction::NONE) {                 std::cout                         << DesignText::make_colored("Pay attention: file mission replaced by another one. (file closed)",                                                     DesignText::Color::RED, false) << std::endl;             }         }         file_action = new_file_action;          if (!is_open) {             file_ptr.open(path + name, mode_flags);             if (file_ptr.fail()) {                 is_open = false;                 if (!use_exceptions) {                     std::cout << DesignText::make_colored("Error Opening file: " + path + name,                                                         DesignText::Color::RED, true) << std::endl;                 } else {                     throw FileOpenException(path + name);                 }             }             is_open = true;             std::cout << DesignText::make_colored("File has safely opened.", DesignText::Color::GREEN, false)                       << std::endl;         }     }      void File::close(bool automatic) {         if ((!automatic) || (file_mode == FileMode::OPEN_IN_ACTION)) {             if (is_open) {                 file_ptr.close();                 is_open = false;                 read_write_mode = ReadWriteMode::DONE;                 file_action = FileAction::NONE;                 std::cout << DesignText::make_colored("File has safely closed.", DesignText::Color::GREEN, false)                           << std::endl;             }         }     }      void File::close() {         close(false);     }      void File::update_rwm() {         if (!is_file_ready(0)) {             return;         }         switch (read_write_mode) {             case ReadWriteMode::SINGLE_AND_DONE:             case ReadWriteMode::DONE:                 close(true);                 break;             case ReadWriteMode::SINGLE_AND_MORE:                 read_write_mode = ReadWriteMode::SINGLE_AND_DONE;                 break;             case ReadWriteMode::MULTIPLE:                 if (multiple_times_left > -1 && !--multiple_times_left) {                     multiple_times_left = -1;                     close(true);                 }                 break;         }     }      void File::init_read_write_mode(const ReadWriteMode &new_mode, const int multiple_times) {         read_write_mode = new_mode;         multiple_times_left = multiple_times;     }      void File::init_read_flags(const std::ios_base::openmode new_read_flags) {         read_flags = new_read_flags;     }      void File::init_write_flags(const std::ios_base::openmode new_write_flags) {         write_flags = new_write_flags;     }      void File::set_name(const std::string &new_name) {         if (!new_name.empty()) {             name = new_name;             is_ready = true;             return;         }         if (name.empty()) {             is_ready = false;         }     }      std::string File::get_name() {         return name;     }      bool File::is_file_ready(int) {         if (!is_ready) {              if (!use_exceptions) {                 std::cout << DesignText::make_colored("Pay attention: file name is empty. can't open this file.",                                                     DesignText::Color::RED, true) << std::endl;             } else {                 throw FileNotReadyException();             }             return false;         }         return true;     }      bool File::is_file_ready() {         return is_ready;     }      File &File::operator=(const std::string &new_name) {         set_name(new_name);         return *this;     } } 

FilesManager.cpp

#include "../headers/FilesManager.hpp"  namespace FilesApi {     FilesManager::FilesManager(bool exceptions, size_t max_files, const std::string &files_path)             : max_files(max_files), files_path(files_path), use_exceptions(exceptions) {     }      void FilesManager::add(const std::string &id, const std::string &file) {         remove_unusable_files();         if (max_files == 0 || files.size() + 1 < max_files) {             files.insert(std::pair<std::string,                     std::shared_ptr<File>>(id, std::make_shared<File>(file, use_exceptions, files_path)));         }     }      void FilesManager::remove(const std::string &id) {         remove_unusable_files();         files.erase(id);     }      File &FilesManager::get(const std::string &id) {         remove_unusable_files();         File *ret_file = files[id].get();         if (ret_file == nullptr) {             files[id] = std::make_shared<File>("", use_exceptions, files_path);             ret_file = files[id].get();         }         return *ret_file;     }      void FilesManager::operator+=(const add_data &data) {         add(std::get<0>(data), std::get<1>(data));     }      File &FilesManager::operator[](const std::string &id) {         return get(id);     }      void FilesManager::operator-=(const std::string &id) {         remove(id);     }      void FilesManager::remove_unusable_files() {         for (auto &file : files) {             if (file.second && !file.second->is_file_ready()) {                 files.erase(file.first);             }         }     } } 

Use example:

#include <iostream> #include <vector> #include <complex> #include "../src/headers/FilesManager.hpp"  using namespace std; using namespace FilesApi;  int mainFilesManagerOperatorsTest() {     FilesManager fm(false, 0, "../TestFiles/");     string files[] = {"test_file.bin", "test_file2.bin"};      fm["1"] = files[0];      vector<complex<float>> wdata = {{1, 9}, {3, 75}, {213.34, 21.4}, {153.1, 15.85}};     vector<complex<float>> rdata(wdata.size());      fm["1"].init_read_write_mode(ReadWriteMode::SINGLE_AND_DONE);     //fm.get("1").write(wdata.data(), wdata.size()); // Use it as complex<float> array. Possible.     fm["1"].write(wdata);     fm["1"].init_read_write_mode(ReadWriteMode::SINGLE_AND_DONE);     fm["1"].read(rdata);      fm += add_data("5", files[1]); // Add file to collection     int a = 12;     int b;     fm["5"] << rw_soft(a); // Work     fm["5"].write(&a); // Work     fm["5"] >> rw_soft(b); // Work     cout << b << endl; // Prints 12      fm -= "5"; // Remove the file from collection     fm["5"] << rw_soft(a); // Error     fm["5"].write(&a); // Error     fm["5"] >> rw_soft(b); // Error      //fm["2"] = files[1];     fm += add_data("2", files[1]);      for (size_t i = 0; i < rdata.size(); i++) {         cout << rdata[i] << endl;     }       fm["2"].init_read_write_mode(ReadWriteMode::MULTIPLE);     for (size_t i = 0; i < 100; i++) {         fm["2"].write(&i);     }      //f.init_read_write_mode(ReadWriteMode::MULTIPLE);      size_t j;     for (size_t i = 0; i < 100; i++) {         fm["2"].read(&j);         cout << j << " ";     }     cout << endl;      return 0; } 

You can find more examples/code utilities in Github: https://github.com/korelkashri/filesApi

How do I get the boot manager to give me an option to choose from which os I want to boot?

I have a computer in which Windows 10 is installed.Recently I have installed Ubuntu on it.The boot manager automatically boots my computer with Windows.Now I want the boot manager to give me a boot menu each time I login automatically so I can choose from which OS I want to boot my computer.How can I do that?

How to set Thunar as the default file manager?

I want to set Thunar as my default file manager. T answers given here and here did not help me.

For instance, I already have Thunar as the preferred File Manager

thunar_default

But when I use a dialog box to open a file, I still get Nautilus:

still_nautilus

So how do I set Thunar as the default file manager?

It may be the case that I do not understand what “being the default file manager” means. What I want is to use Thunar all around, as it would be (I think) expected when one changes the file manager to Thunar.

Here is some possibly relevant version information:

Distributor ID: Ubuntu Description:    Ubuntu 18.04.2 LTS Release:        18.04 Codename:       bionic  GNOME nautilus 3.26.4  Thunar 1.6.15 (Xfce 4.12) 

Change Default file manager to Dolphin Lubuntu 18.04

Whatever the defualt file manager is constantly crashes under heavy load forcing me to either reboot. I’ve tried using exo tools but not only is dolphin not an option, but i get the following error every time I try to change something

Gtk-Message: 19:49:59.627: GtkDialog mapped without a transient parent. This is discouraged.  (exo-helper-1:4774): Gdk-CRITICAL **: 19:50:03.261: gdk_window_get_window_type: assertion 'GDK_IS_WINDOW (window)' failed 

I’ve also tried the following terminal commands (seperately)

xdg-mime default kde4/dolphin.desktop inode/directory

xdg-mime default org.kde.dolphin.desktop inode/directory

xdg-mime default dolphin.desktop inode/directory application/x-gnome-saved-search

i’ve also tried following these instructions to no avail both using gedit and the editor adapting it for dolphin’s desktop file “org.kde.dolphin.desktop” I’m pretty much stumped at this point.

his is the recommended method because it doesn’t mess around with the files that were installed by your package manager. Also, if it is a shared computer (eg. family, library or lab computer) then this method is your only option.

Default system settings in Ubuntu are overridden by settings in hidden files in a user’s home directory (~), if you want to change settings, this is the place to do it. The files in ~/.local/share/applications override the files in /usr/share/applications (mentioned above in MIME Types). If the directory does not exist, create it. To change the default File Manager you’ll have to edit the file defaults.list (or mimeapps.list) found in this directory but first we have to find the right .desktop file for the program you want to use.

getting the right .desktop file You have read-access to /usr/share/applications so navigate to that directory and search through the .desktop files to find the one for your desired File Manager, for example the one for Xfe is xfe.desktop.

To search for files in Nautilus start typing the name of the file. To search for files from the command line you can list the contents of the directory and search the output for the name of the file:

ls /usr/share/applications | grep xfe

If you find it you can move on to the next step, otherwise, if it doesn’t exist we’ll have to create one. As far as I know there is no .desktop file for Thunar so we’ll make one for that. Navigate to ~/.local/share/applications, make a file thunar.desktop and write the following in it

[Desktop Entry] Name=Open Folder TryExec=thunar Exec=thunar %U NoDisplay=true Terminal=false Icon=folder-open StartupNotify=true Type=Application MimeType=x-directory/gnome-default-handler;x-directory/normal;inode/directory;application/x-gnome-saved-search; 

There are lots of other things you can add if you want to but this should be enough. If you’re making a file for another file manager replace the command thunar at Exec and TryExec to the command for your file manager and name it whateverfilemaneger.desktop.

Just to remind you one last time this file is in sub-directory of your home directory (~), not somewhere in /usr!

editing the defaults.list or mimeapps.list file If you’re not in the directory ~/.local/share/applications then navigate to it now and edit the defaults.list file. You can double-click it in Nautilus to open it with Gedit or from the commandline:

editor defaults.list It shouldn’t contain much because it’s only for the MIME Types which you’re overriding. Add the following 2 lines to the file:

inode/directory=thunar.desktop x-directory/normal=thunar.desktop 

Replace thunar.desktop with whateverfilemaneger.desktop according to the file you found/created in the previous step.

And that should take care of it. No need to reboot, changes should take effect immediately!

Will Be Your Social Media Manager for $15

Experienced in Freelancing and offering services of Social Media Management & Content Creation Services Includes: Pages and group SetupContent Creation (Free Graphics & Vectors )Promotional PhotosPost Scheduling Facebook Twitter Covers Ads Setup(Cost will be charged to client as extra) Website managementI will manage your social medias (FB, twitter, LinkedIn, Pinterest, G+, IG and reddit) Blog writing(2 blog in a week) Daily content postingGenerate Targeting trafficking Build and execute social media strategy Facebook interaction postsSet up and optimize company pages within each platformOverall 3 post daily to each social media which you want to use. Thank You

by: killimanjaro
Created: —
Category: Social Networks
Viewed: 140


Creating a layout with Page Manager

I’m trying to use Panels and Page Manager in Drupal 8. My current versions of each are:

  • Page Manager: 8.x-1.0-alpha23+12-dev
  • Panels: 8.x-3.0-beta4+41-dev

My current problem is having no idea how to actually make a layout (layout_plugin is installed.) I’m seeing this screen:

enter image description here

It doesn’t matter what I change “Layout” to, the “Layout Settings” section doesn’t change. I’m somewhat familiar with Page Manager in D7, and expected there to be some sort of layout manager in there, allowing me to choose panels/blocks/etc. I know there’s a “Block Page”–and this would work for me–but in any of the tutorials, I’ve heard something about Block Page NOT being for production?

Nearly EVERY video/tutorial I’ve seen uses some other version of panels/page_manager, and the look/structure has changed. So, I’m not sure if I’m doing this right or not, if it’s broke, or if I just have no idea what I’m doing.

Panels, Page Manager and CTools was supposedly synced with their alphas last year, but they look like they’ve separated and I’m hesitant to use 5 month old versions of modules on a new release like D8 (particulary, CTools.)