Class new Instanse in php Mvc Structure

I working with own project using MVC structure and autoload class using PSR-4 using composer. I choose Php Fastroute library for my router engine.

enter image description here


define('DS', DIRECTORY_SEPARATOR, true); define('BASE_PATH', dirname(__DIR__) . DS, TRUE); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);  require '../vendor/autoload.php'; require '../application/core/Core.php';  // Our framework is now handling itself the request $  app = new Framework\Core();  $  response = $  app->handle(); 


namespace App\Core;  class Controller {      public $  templates;      public function __construct()     {          // My Question         $  this->config = new \App\Core\Setting();         $  this->Language = new Language('en');         $  this->Url = new \App\Core\Url(Config::get('URL'),Config::get('URL'));         $  this->templates = new \League\PlatesEngine(Config::get('PATH_VIEW'));         $  this->Document = new \App\Core\Document();     }      public function loadModel($  name, $  path = null) {          $  path = ($  path === null) ? 'Catalog' : $  path;          $  path = '\App\'.$  path.'\Model\'.$  name;          $  this->model = new $  path;          return $  this->model;      }      public function loadController($  name) {          $  path = '\App\Catalog\Controller\'.$  name;          $  this->controller = new $  path;          return $  this->controller;      } } 


namespace App\Catalog\Controller\Home;  class IndexController extends \App\Core\Controller {     public function index()     {         $  add['power'] = $  this->config->get('on');         $  data['title'] = $  this->Language->get('text_title');         $  this->templates->addData($  data, 'common/header');         //.... More Code     } } 

In action I put class new instance(library and core class ie: Config or Ducoment or Templates or many more if need …) in __construct() Of Bridge Controller and extends IndexController. this model work for me But i dont know this method is true Or false?! Actually, I need to load Object (new instance) From Core class to my IndexController But I dont know where will it be placed(better and ture)?! (in Base Controller – In IndexController – In Core.php and require – In Index.php)??

When splitting data to a hash data structure, what is the syntax for multiple assignment?

I am going through the “Head First” Learn to Program text for python 2.7, and as I was working through one of the exercises. It gave me a clue to multiple assign a line of data, while splitting it. And since I could not guess it, I went to the solution, and I do not understand the solution.

I am running the latest python in the native IDLE


line = “101;Johnny ‘wave-boy’ Jones;USA;8.32;Fish;21”

display = {}

(display[‘ID’], display[‘Name’], display[‘Country’], display[‘Average’], display[‘Board’], display[‘Age’]) = line.split(‘;’)


I do not understand what is going on with the multiple assignment in the code above. How is the splitting making key and value pairs?

What role are the braces playing in this?

When I guessed for multiple assignment I imagined this:

(ID, Name, Country, Average, Board, Age) = line.split(;)

for a, b, c, d, e, f in line: display[ID] = Name, Country, Average, Board, Age

I thought that I could assign several values to one key, and just index or iterate the has with the keys() or items() method

Applying functions to leaves of nested list structure, when these leaves are more complex expression trees

Is there a way to apply a function h to the following nested list

{{a, b}, {c, d}, {{d, e }, {f, g}}}

where this should should become

{h[a], h[c], {h[d], h[f]}}

h is applied to the first element of each (deepest nested) sublist, replacing this sublist. The nesting is never deeper than the example displayed above. I.e. the expression tree for the list has at most depth 3.

The rest of the list structure pattern is preserved.

Here, a, c, d and f are not atoms. They are again expressions with heads. The heads are however not list-heads.

As an example, consider

{{u[a], u[b]}, {u[v[c]], d}, {{d, e}, {f, g}}}

applying h to this should yield:

{h[u[a]], h[u[v[c]]], {h[d], h[f]}}

In other words, h is applied to the leaves" of the list expression given above, where theseleaves” are more complicated expressions.

Initial Structure for wpf looking for suggestions

Hi Good Morning Every one Actually, I decided to write the initial structure for a WPF in MVVM. like Different Themes and Different languages and some other thing which is required when we are starting a project so i wrote it

Now I know it’s not the best so I’m looking for some suggestions where it can be improved did I do any mistakes. if u guys can take a look once that will so great thanks

How to modify a List/Tile without Site Content and Structure

I created a list (with tiles) in 2016. I have always performed annual modification to areas like the link location and background image. I went in a short while ago to perform the modification and cannot find ‘Site Content and Structure’ under Site Settings. After doing some research I found out it was depreciated back in Sept. 2018.

My Questions: How do you perform modification to areas such as the background image and link location within the list (with tiles)? I opened every option in Site Settings, along with the Settings within the specific list.

I even attempted a workaround that was suggested to access the page through _layouts/15/sitemanager.aspx behind the URL

Any help or suggestions will be appreciated.

spatial element count data structure eg: R-Tree, with filtering

Background: The application is a web map application with a LeafletJS front-end and NodeJS back-end with Postgres database. The application is to be used on both desktops and smartphones/ tablets in the field. The map should visualise ~30K polygons whose number grows by ~3k per year. The data set has insertions and deletions less than once every 12 hours but has queries constantly. At all zooms, a representation of the entire spatial data set should be available. At lower zooms a cluster or heatmap representation is ideal. At high zooms the individual polygons should be visible. The main issue is that the data set count represented by clustering must also be filterable by a finite number of sets each with finite number of options membership (year, type of survey etc.)

A naive implementation would be to calculate the centre/ centroid/ pole-of-inaccessibility of each polygon along with its set options and send these to a standard Leaflet clustering library on the client side to visualise when below a threshold zoom level, and to send the polygons themselves when above a zoom level. The client-controlled filter would iterate through each layer in the cluster or polygon set.

It seems to me that a better cluster would be to build a R-Tree server-side and at each node level include the total child count, then on the client-side each cluster is represented as this child count at the centre of its node’s bounding box. Above the threshold zoom, polygons for that area are also stored in a client-side R-Tree to avoid querying the database for areas that have been traversed more than once.

(A) Is this a sensible data structure and method of representing clusters?

(B) How can it be extended to compute child count of subsets at different levels of zoom, such as calculating the count of every exclusive set at each level? (eg: count of elements in years x1 to x2 and survey type a,b,c, not d)

Lie transformation group and the transformation of smooth structure from normal connected subgroup

I’m self-working on two theorems on Lie transformation group from the book Kobayashi transformation group in differential geometry, one is the following

Theorem Let $ \mathfrak{S}$ the group of differentiable transformation of manifold $ M$ and $ \mathcal{S}$ be the set of all vector fields $ X\in\mathfrak{X}(M)$ which generates 1-parameter subgroup $ \varphi_{t}=\text{exp}(tX)$ of transformation for $ M$ such that $ \varphi_{t}\in\mathfrak{S}$ . The set $ \mathcal{S}$ with brackets of vector field define a Lie algebra. Then if $ \mathcal{S}$ is finite-dimensional Lie algebra of vector fields on $ M$ then $ \mathfrak{S}$ is Lie group of transformation and $ \mathcal{S}$ its Lie algebra.

the idea of the proof is quite simple, take the Lie algebra $ \mathfrak{g}^{*}$ generated by $ \mathcal{S}$ , if $ \mathfrak{g}^{*}$ if finite-dimensional then by Lie third theorem there exist simply connected Lie group $ \mathfrak{S}^{*}$ the last can be chosen such that $ \mathfrak{S}^{*}\subset \mathfrak{S}$ using local action etc … , even more it can be shown is normal connected subgroup and open, for now, everything seems normal but then the author claiming that the smooth structure can be transformed to another connected component or simply say to $ \mathfrak{S}$ if I’m not wrong, this where I can’t get it, unless we accept that the left translation or the right for $ g\in\mathfrak{S}$ , the mapping $ L_{g}:\mathfrak{S}^{*}\longrightarrow g.\mathfrak{S}^{*}$ to be differentiable.

My question is about the idea of how we transfer smooth structure from connected normal subgroup?

There’s a paper of Richard S.Plais A global formulation of the lie theory of transformation groups, contains lots of stuff about this, but I couldn’t see where the answer precisely.

SharePoint Online button to create a new folder structure in a document library

I would like to add a button that appears on a SPO Modern Document Library that states “Create a new folder structure”. (see below image).

enter image description here

When clicked I would like that button to:

  1. Prompt the user to enter a Name and hit OK.
  2. Create a pre-defined folder structure of multiple sub-folders where the top-most folder is the name they entered in the above step.

E.g. the end outcome is a folder structure as below.

  • “My Folder Name I entered”
    • Sub-Folder 1
      • Sub-Sub-Folder 1.1
      • Sub-Sub-Folder 1.2
    • Sub-Folder 2
      • Sub-Sub-Folder 2.1
    • Sub-Folder 3

I’m not quite sure where to even start…How might I go about achieving this from a no-code and code perspective..?

Could this be achieved with a combination of Flow + PowerApps?


If I go down the path of SPFx, is there any good starting point examples that someone could point me to build from?

p.s: I’m aware of Document Sets and creating a Folder that is copy and pasted as solutions, however I’m more interested in something custom.


Database Structure

To keep in practice with good techniques of java programming, I’ve decided to write a database. All it does it store employees, allows users that are logged in to get/set employees, and has a login mechanism that prevents any methods from being used if you are not logged in. I’m looking for feedback in the following areas:

  • Structure Is the overall structure of the program good? Are there any improvements that can be made to make the structure of the program more efficient/compact?
  • Login Mechanism Is the way I implemented this system okay? Is there a better way I can implement this login system?
  • Exceptions I created two custom exceptions for this program. Is the way I coded these exceptions acceptable? Should I have had a CustomException class that they could inherit from, so I can just have the message in printErrorMessage as a parameter/hard coded? I used Eclipse while writing these exceptions, so the serialVersionUID is auto-generated.
  • Efficiency/Compactness Is there any way this program can be made more efficient? Such as the getHighestSalary method in the Database class.

Any and all suggestions are invited and appreciated. Style and other neatness tips are encouraged as well.

package database;  import java.util.ArrayList; import java.util.Collections; import java.util.List;  public class Database {      private ArrayList<Employee> employees;     private final String username;     private final String password;     private boolean loggedIn;      public Database() {          this.employees = new ArrayList<Employee>();         this.username = generateUsername();         this.password = generatePassword();         this.loggedIn = false;          populateEmployees();     }      public void addEmployee(Employee employee) throws LoginException {         if(loggedIn) {             this.employees.add(employee);             sortEmployees();             return;         }         throw new LoginException("Not Logged In!");     }      public Employee getHighestSalary() throws LoginException {         if(loggedIn) {             Employee highest = this.employees.get(0);             for(Employee employee : this.employees) {                 if(employee.getSalary() > highest.getSalary()) {                     highest = employee;                 }             }             return highest;         }         throw new LoginException("Not Logged In!");     }      @SuppressWarnings("unchecked")     public void sortEmployees() throws LoginException {         if(loggedIn) {             Collections.sort((List)this.employees);              return;         }         throw new LoginException("Not Logged In!");     }      public Employee getEmployee(String name) throws EmployeeNotFoundException, LoginException {         if(loggedIn) {             for(Employee employee : this.employees) {                 if(employee.getName().equals(name)) {                     return employee;                 }             }             throw new EmployeeNotFoundException("Employee Not Found!");         }         throw new LoginException("Not Logged In!");     }      //Filler for tester class     private void populateEmployees() {         for(int i = 0; i < 10; i++) {             this.employees.add(new Employee("Employee" + i));         }     }      public void login(String username, String password) {         if(this.username.equals(username) && this.password.equals(password)) {             this.loggedIn = true;         }     }      public ArrayList<Employee> getEmployees() throws LoginException {         if(loggedIn) {             return this.employees;         }         throw new LoginException("Not Logged In!");     }      //Used for testing     private String generateUsername() {         return "username123";     }      //Used for testing     private String generatePassword() {         return "password123";     }  }

package database;  public class Employee {      private final String name;     private int age;     private int salary;       public Employee(String name) { = name;     }      public Employee(String name, int age) { = name;         this.age = age;     }      public Employee(String name, int age, int salary) { = name;         this.age = age;         this.salary = salary;     }      public String getName() { return; }     public int getAge() { return this.age; }     public int getSalary() { return this.salary; }      public String toString() {         return "Name: " +;     }  }

package database;  public class LoginException extends Exception {      private static final long serialVersionUID = 1L;      public LoginException(String message) {         super(message);     }      public void printErrorMessage() {         System.out.println("LoginException: Not logged in!");     }  }

package database;  public class EmployeeNotFoundException extends Exception {      private static final long serialVersionUID = 1L;      public EmployeeNotFoundException(String message) {         super(message);     }      public void printErrorMessage() {         System.out.println("EmployeNotFoundException: The employee you are searching for could not be found!");     }  }

package database;  public class Tester {      @SuppressWarnings("unused")     public static void main(String[] args) {         Database database = new Database();         database.login("username1234", "password123");          //Should throw `LoginException`         try {             for(Employee employee : database.getEmployees()) {                 System.out.println(employee);             }         } catch (LoginException e) {             e.printErrorMessage();         }          //Should throw `EmployeeNotFoundException`         try {             Employee test = database.getEmployee("Ben");         } catch (EmployeeNotFoundException e) {             e.printErrorMessage();         } catch (LoginException e) {             e.printErrorMessage();         }      }  } 

calculating a shortest path in a table structure that changes in real time

I have a table that looks like this

enter image description here

In table NPC – are AI like characters that move from one point to another. Player – a character that is controlled by the user.

In any moment the player character might move to any cell of the table. But NPC has a particular goal cell that they should reach while moving. For example, blue NPC needs to read blue cell.

enter image description here

Other NPC are also moving. My goal is to write an algorithm that would allow NPC to reach the cell using the shortest path. As far as I understand it is a typical shortest path problem.

My question is – is there some algorithm that particularly optimized to handle such workflows, or any algorithms will suffice – just with recalculating the path after each move?