Author Archive

Apunts de Sistemes Operatius

Introducció Un sistema operatiu és un programa que gestiona el maquinari d’un ordinador, proporciona una base per a d’altres programes i fa d’intermediari entre l’usuari de l’ordinador i el maquinari (fent així el seu ús més fàcil, eficient i segur). El primer sistema operatiu va ser creat el 1956 per General Motors, per a un […]

Sending messages to BlackBerry Push API from PHP

<?php // Source: // // create a new cURL resource $ch = curl_init(); $messageid = microtime(); $appid = ‘****-******************’; // Your App ID $password = ‘********’; // Your Pwd $data = ‘–mPsbVQo0a68eIL3OAxnm’. “\r\n” . ‘Content-Type: application/xml; charset=UTF-8’ . “\r\n\r\n” . ‘<?xml version=”1.0″?> <!DOCTYPE pap PUBLIC “-//WAPFORUM//DTD PAP 2.1//EN” “”> <pap> <push-message push-id=”‘ . $messageid […]

GPG Key Transition Statement 2010

So, to make the Debian keyring maintainers happier people, I’ve created a new 4096 bit key. Below you’ll find a transition statement signed with both the new and my previous key. Incidentally, I’ve also revoked my first (1024 bit) key which I had transitioned away from a year ago. —–BEGIN PGP SIGNED MESSAGE—– Hash: SHA256 […]

Triggers in MySQL

DELIMITER $$ CREATE TRIGGER messages_ins_recipientuser BEFORE INSERT ON messages FOR EACH ROW BEGIN SET NEW.recipient_user_id := (SELECT FROM users WHERE ORDER BY id ASC LIMIT 1); END; $$ delimiter ; Run this in the MySQL prompt; MySQL Administrator (MySQL Query Browser) won’t take it. To see all the database’s triggers: SHOW TRIGGERS; Other […]

CakePHP: Using a model inside a component

Apparently this is discouraged for some mysterious reason, but if like me you want to have nice code where models are used from within components (so you don’t have to clutter up your controllers or shell classes), here’s how: $this->ModelName = ClassRegistry::init(‘ModelName’); Source For example, you can place it like this at the start of […]

Skip to toolbar