mercredi 4 janvier 2023

How to create a visual editor for any third party websites

I want to create a visual editor for any third party websites which has my script.

  • when a user enters a url it should navigate to that url
  • users can point and click and make changes to there websites like you can see here
  • and this changes should persist (how do i save the changes what users made to their website)

Im not sure how to approach this problem, whats the system design to do so?

I did try to show the websites in iframe and interact with them through postmessage but it wasn't as smooth of a experience like this

What is the name of the design pattern used to create Laravel's service container?

My question: what is the general name of the design pattern used to build Laravel's "Service Container", the thing that Laravel binds stuff to when bootstrapping the app? By general, I mean in general programming terms. The reason I'm asking is that I'm going to start a project in another language (Python's FastAPI) and from my own research so far, that concept, the service container, doesn't exist (Although it does have dependency injection)? Am I gonna have to implement my own or are there other options?

What is the best architecture for several DTO's to be called by the same method

I am projecting API, where I have 1 controller and several services for preparing some kinds of reports. Let's say it's ReportA, ReportB and ReportC. All services inherit from abstract class ReportBase, where I have some methods common for all services, fe. GetTotalUsage, which download data from database before calculating the report.

Now it is the tricky part:

method GetTotalUsage use the ReportARequestDto, but I would like to make it take any kind of the DTO (also ReportBRequestDto and ReportCRequestDto).

All DTO's have common properties (StationId,MediaName,DateTimeRange) and some unique.

I could make base class for all DTO's and inherit from it, but it's not a best solution, since I may need to modify and use different properties in the future for another method.

The composite pattern makes the DTO's complex.

What is the most appropiate aproach?

mardi 3 janvier 2023

Best design patterns for sending SMS through multiple gateways

I've multiple SMS gateways and I want to send SMS though any one vendor who is having high success ratio and less in cost. I've the data ready with me of cost and success ratio.

Which design pattern will best suit to switch between SMS gateway on runtime to keep my SMS wrapper up 100% and cost effective.

How to make low level design especially Class Diagram

I am stuck how to think or proceed to make class diagram as i am making a chat application using TCP socket programming using NodeJs.

I made the High level design of this application in form of Use Cases. I just need how to make low level design especially class diagram from this use cases. ANY HELP WOUL BE APPRICIATED.

Usecase1-

o   User starts the client program. Client connects with the server. & Now client is asking user to enter his/her name.
o   User will Enter his/her name “xyz”, and take this text input and convert it into JSON and Send it to the Server.
o   Now Server will receive this data from client and convert it into JSON Object. And it will store its username to its database i.e. HashMap. And display “new client connected” to server console.
o   And moreover Server will make an array of all username presents in map (if there are username present into map), convert this to JSON and send back to client who initiated the cmd.
o   And Client will receive the data, convert back to JSON Object (along with that it stores in an array) and display it to the user, from where user can select the username he/she wants to chat

Usecase1.1-

o   If any new user is connected/exit from the server, (following usecase1).
-   As soon as it connects, we send String “username join the chat” to each connected client that are connected to server except client which just connected.
-   We have a function which reads command prompt input, and as user typed “exit”, client send “username left the chat” to each connected client and request to end its connection to server. 


Usecase2-

o   User will Enter, username whom he/she wants to chat. Client take the input and check that username present in the client array or not. If username is not present in the array, then simply display “Enter valid user”.
o   If username is present in the array, Client ask user to “Enter message”.


Usecase3 –
    
Now user1 will enter message he/she wants to send to user2.
Client take the input and convert it into JSON having attributes, cmd: Send, Sendby:user1, Sendto:user2, message: “message”. And send it to the server.
Where server receives the data, convert it into JSON Object and look for attribute cmd i.e. Send, and look for the sendto user i.e. user2 in hashmap (i.e. user still connected with the server) and if user2 connected with the server then simply send this data to Sendto user i.e. user2 in JSON format & return msg: “success” to sender user (user1), else return msg “User disconnected”, in JSON format having attributes cmd: “server reply” & msg: User disconnected” to sender user i.e. user1. 
Now user2 receives the data, convert it into JSON Object, and look for attribute message and sendby, and Simply display the message to user2.And send msg: “received” to server.


Usecase4 –
If any user wants to end the connection. Simply enter ‘quit’ in, client send this data as command to server in JSON, server check the cmd attributes and disconnect along with remove that user name from array & hashmap, & send this message “username left the chat” to every connected client.

What design pattern to use? [closed]

The task is as follows. When creating a page, you need to choose which template it should use. Each template consists of a set of components (text, image, gallery, iframe, etc.), each component has its own properties (text size, image size, duration, etc.).

Can someone draw the structure of the database, and explain which design pattern to use for this task with an example of a UML diagram?

Can anyone help me use Bridge design pattern to develop a School Management System [closed]

Use Bridge design pattern to develop a School Management System. The requirements:

• Unlike Student, Teacher shall be able to add a new homework. • Unlike Teacher, Student shall be able to submit a solution. • Unlike Local Person, Foreigner shall be able to request for a dormitory. • Unlike Foreigner, Local Person shall be able to request for loan.

When the program starts, let the main class create four different kinds of users: a local teacher, a foreign teacher, a local student and a foreign student. You will be asked to demo to show how each of these users can use the functionalities listed above.

  • i have no idea it seem very difficult