xxxxxxxxxx
// Import necessary modules
import lists
// Define the match function which evaluates two profiles and returns a match if both agents accept
fun match (profile1, profile2) {
// Extract agents' decisions and profiles for each other
val (accept1, profileFor2) = agent1(profile2)
val (accept2, profileFor1) = agent2(profile1)
// If both agents accept, return a match, otherwise return no match
if (accept1 and accept2) {
return (true, profileFor1, profileFor2)
} else {
return (false, (), ())
}
}
// Define the server function which listens for new profiles
fun server () {
// Initialize an empty list for storing profiles
val profiles = []
// Server loop
while (true) {
// Receive a new profile
val newProfile = receiveNewProfile()
// Match the new profile with all existing profiles
foreach (existingProfile in profiles) {
val (isMatch, profileForExisting, profileForNew) = match(newProfile, existingProfile)
// If a match is found, send "NEWMATCH" messages
if (isMatch) {
sendNewMatch(existingProfile.pid, profileForNew)
sendNewMatch(newProfile.pid, profileForExisting)
}
}
// Add the new profile to the list
profiles.append(newProfile)
}
}
// Define the sendNewMatch function which sends a new match to a client
fun sendNewMatch (pid, profile) {
// Declassify the preference booleans and outer labels if needed
val safeProfile = declassify(profile)
sendMessage(pid, ("NEWMATCH", safeProfile))
}
// Define the receiveNewProfile function which receives a new profile
fun receiveNewProfile () {
val ("NEWPROFILE", data) = receiveMessage()
// Declassify the incoming profile if needed
return declassify(data)
}
// Define the main function which sets up the server
fun main () {
// Register the server
registerServer()
// Start the server
server()
}
// Define helper functions for communication and security
fun registerServer () { /*...*/ }
fun sendMessage (pid, message) { /*...*/ }
fun receiveMessage () { /*...*/ }
fun declassify (data) { /*...*/ }
// Start the server by calling main
main()
xxxxxxxxxx
+------------------------+
| Produit |
+------------------------+
| - nom: String |
| - description: String |
| - prixDetail: Float |
| - prixGros: Float |
| - categorie: Categorie |
| - image: Image |
+------------------------+
+------------------------+
| Categorie |
+------------------------+
| - nom: String |
| - produits: List<Produit>|
+------------------------+
+------------------------+
| Image |
+------------------------+
| - url: String |
+------------------------+
xxxxxxxxxx
+-----------------------------------------+
| User Interface |
| |
| +-----------------------------+ |
| | Web App | |
| +-----------------------------+ |
| | |
+---------------|-------------------------+
|
v
+-----------------------------------------+
| API Gateway |
| |
| +-------------+ +-------------+ |
| | Service A | | Service B | |
| +-------------+ +-------------+ |
| | | |
| v v |
| +-------------+ +-------------+ |
| | Database | | Database | |
| +-------------+ +-------------+ |
+-----------------------------------------+
xxxxxxxxxx
| Ingrediente | Cantidad | Precio de Compra (por kg) | Costo por Porción |
|-------------------|----------|---------------------------|---------------------|
| Masa | 200g | $2 | $0.40 |
| Salsa de Tomate | 100g | $1 | $0.10 |
| Queso | 150g | $4 | $0.60 |
| Pepperoni | 50g | $5 | $0.25 |
| Costos Indirectos | - | - | $0.50 |
Costo Total por Porción (sin margen de beneficio): $1.85
Margen de Beneficio (30%): $0.56
**Precio de Venta por Porción: $2.41**
xxxxxxxxxx
# requirements.txt
# ... (other dependencies)
# Use pre-built mysqlclient binary wheel
mysqlclient==2.1.0
xxxxxxxxxx
# requirements.txt
# ... (other dependencies)
# Use pre-built mysqlclient binary wheel
mysqlclient==2.1.0
xxxxxxxxxx
FUNCTION displayMenu():
PRINT "1. Rent a car"
PRINT "2. Return a car"
PRINT "3. Display available cars"
PRINT "4. Exit"
FUNCTION rentCar():
INPUT customerName
INPUT carType
IF carType is available THEN
Mark carType as rented
PRINT "Car rented to", customerName
ELSE
PRINT "Sorry, the requested car is not available"
FUNCTION returnCar():
INPUT customerName
INPUT carType
IF carType is rented by customerName THEN
Mark carType as available
PRINT "Car returned by", customerName
ELSE
PRINT "Invalid input. The car is not rented by", customerName
FUNCTION displayAvailableCars():
PRINT "Available cars:"
FOR EACH carType in carInventory
IF carType is available THEN
PRINT carType
# Main program
carInventory = {
"Compact": available,
"Sedan": available,
"SUV": available
}
WHILE True:
displayMenu()
INPUT choice
IF choice is 1 THEN
rentCar()
ELSE IF choice is 2 THEN
returnCar()
ELSE IF choice is 3 THEN
displayAvailableCars()
ELSE IF choice is 4 THEN
EXIT the program
ELSE
PRINT "Invalid choice. Please choose again."
xxxxxxxxxx
/backend
/src
/controllers
/models
/routes
/middlewares
/config
server.js
app.js
package.json
.env
xxxxxxxxxx
RAID 5 Configuration (Example with 4 Disks)
Disk 1 Disk 2 Disk 3 Disk 4
| | | |
+---------+---------+---------+
| Parity
xxxxxxxxxx
+--------------+ +------------------------+ +----------------------+
| Start | --> | Identification of PC | --> | Choose Vendor & |
| | | Requirements | | Products |
+--------------+ +------------------------+ +----------------------+
| | Yes |
v v |
+----------------+ +---------------------+ +---------------------+
| Identify PC | --> | Vendor Quotations | --> | Quotation Approval |
| Requirements | +---------------------+ +---------------------+
+----------------+ | Yes |
| | v |
v v +---------------------+
+----------------+ +---------------------+ | Approval & Tracking|
| Choose Vendor | --> | Quotation Approval | +---------------------+
| & Products | +---------------------+ |
+----------------+ | Yes |
| | v |
v v +---------------------+
+----------------+ +---------------------+ | Product Procurement|
| Vendor Quotations| | Vendor Informs | +---------------------+
| Requested | --> | Product Status | |
+----------------+ +---------------------+ No |
| |--------+
v |
+----------------+ +---------------------+ +----------------------+
| Quotation | --> | Product Reception | --> | Quality Inspection |
| Approval | +---------------------+ +----------------------+
+----------------+ |
| |
v |
+----------------+ |
| Approval & | |
| Tracking | |
+----------------+ |
| |
v |
+----------------+ |
| Product | |
| Procurement | |
+----------------+ |
| |
v |
+----------------+ |
| Operational | ----------------------------------+
| Setup |
+----------------+
xxxxxxxxxx
MyTable.SETRANGE("Field Name", StartValue, EndValue);
IF MyTable.FINDSET THEN
REPEAT
// Process each record in the range
// ...
UNTIL MyTable.NEXT = 0;