Database Integration Development Tutorials, Guides & Insights
Unlock 4+ expert-curated database integration tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your database integration skills on DeveloperBreeze.
Adblocker Detected
It looks like you're using an adblocker. Our website relies on ads to keep running. Please consider disabling your adblocker to support us and access the content.
Build a Facial Recognition Attendance System
import cv2
import face_recognition
import pickle
from datetime import datetime
# Load encodings
with open("encodings.pickle", "rb") as f:
data = pickle.load(f)
# Initialize webcam
video_capture = cv2.VideoCapture(0)
# Track attendance
attendance_log = set()
while True:
ret, frame = video_capture.read()
if not ret:
break
# Resize frame for faster processing
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
rgb_frame = small_frame[:, :, ::-1]
# Detect faces and compare
face_locations = face_recognition.face_locations(rgb_frame)
face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)
for face_encoding, face_location in zip(face_encodings, face_locations):
matches = face_recognition.compare_faces(data["encodings"], face_encoding)
name = "Unknown"
if True in matches:
match_index = matches.index(True)
name = data["names"][match_index]
# Log attendance
if name not in attendance_log:
attendance_log.add(name)
print(f"{name} marked present at {datetime.now()}")
# Display bounding box and name
top, right, bottom, left = [v * 4 for v in face_location]
cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2)
cv2.putText(frame, name, (left, top - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
# Show video feed
cv2.imshow("Attendance System", frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
video_capture.release()
cv2.destroyAllWindows()Store the attendance data in an SQLite database for record-keeping.
Connecting a Node.js Application to an SQLite Database Using sqlite3
This command creates a package.json file with default configurations.
To interact with SQLite databases, install the sqlite3 package using npm:
Integrating Laravel and React with Vite: Using Databases and PHP in a Full-Stack Project
For applications requiring authentication, Laravel offers built-in tools like Sanctum or Jetstream. You can protect API routes and access them from React using tokens or cookies.
To protect API routes, use Laravel’s middleware:
Creating a Simple REST API with Flask
curl http://127.0.0.1:5000/api/items- Get a specific item: