This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bad example: we should be locking the User record: | |
| user = User.find_by(foo: 'bar') | |
| Lock.acquire("perform-action-user-#{user.id}") do | |
| user.expand_snibbit! | |
| end | |
| # ...but it gets useful if there's no other way the mutex can be managed | |
| Lock.acquire("non-mutexable-resource") do | |
| NonMutexableResource.reduce_foobar! | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library ieee; | |
| use ieee.std_logic_1164.all; | |
| use ieee.std_logic_arith.all; | |
| use ieee.std_logic_unsigned.all; | |
| ENTITY Robot IS | |
| PORT( | |
| -- Horloge, entrées : | |
| clk, reset, whistle1, whistle2, SW0 :IN std_logic; | |
| -- LED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $titre = 'Accueil non connecté | Mon site'; | |
| $entete = entete("Mon site / Accueil non connecté"); | |
| $menu = formulaire(); | |
| $contenu = "Accueil non connecté [...]"; | |
| $pied = pied(); | |
| include 'gabarit.php'; | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require("connexion.php"); | |
| // fonction qui cherche le mot de passe d'un utilisateur avec un identifiant dans la base de données | |
| function mdp($db,$identifiant){ | |
| $reponse = $db->query('SELECT id, mdp FROM Utilisateurs WHERE identifiant="'.$identifiant.'"'); | |
| return $reponse; | |
| } | |
| // fonction qui cherche le mot de passe d'un utilisateur avec un identifiant dans la base de données |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| [...] | |
| <title><?php echo($titre); ?></title> | |
| </head> | |
| <div id="global"> | |
| <div id="tete"><?php echo($entete); ?></div> | |
| <hr/> | |
| <div id="corps"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // index.php | |
| if(!isset($_SESSION["userID"])){ // L'utilisateur n'est pas connecté | |
| include("Controleur/connexion.php"); // On utilise un controleur secondaire pour éviter d'avoir un fichier index.php trop gros | |
| } | |
| else { // L'utilisateur est connecté | |
| if(isset($_GET['cible'])) { // on le dirige vers la page où il veut aller | |
| switch($_GET['cible']) { | |
| case 'accueil': | |
| include("Vue/accueil.php"); |