This file contains 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
CREATE TABLE 'AcademicSubjectAssociation' ( | |
'login' char(40) NOT NULL default '', | |
'subject' char(7) NOT NULL default '', | |
'year' int(11) NOT NULL default '2000', | |
'semester' char(10) NOT NULL default 'autumn', /* enum('autumn','winter','spring','summer') NOT NULL default 'autumn', */ | |
'association' char(10) NOT NULL default 'tutor', /*enum('coordinator','assessor','lecturer','tutor','liaison','marker','admin','markedit','other','listowner','proposer','propadmin') NOT NULL default 'tutor',*/ | |
UNIQUE ('login','subject','year','semester','association') | |
); | |
CREATE INDEX 'asa_login2' ON 'AcademicSubjectAssociation' ('login','subject','year','semester'); | |
CREATE INDEX 'asa_login3' ON 'AcademicSubjectAssociation' ('login','subject'); |
This file contains 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
<? | |
.... | |
//Build and load the design into an object | |
echo "Building staging design..."; | |
chdir('../install/couchapp'); | |
$ddocstr = shell_exec('couchapp push --export'); | |
$ddoc = json_decode($ddocstr); | |
$ddoc_staging = clone $ddoc; |
This file contains 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
[minion@minion cgm]$ php tools/update_couch_design.php | |
Access granted. | |
Building staging design...done. | |
Uploading staging design...done. | |
Rebuilding all views (this may take a long time, you can track progress in the futon status window) ... done. Elapsed time: 12 seconds | |
Rebuilding lucene views (this may take a long time, too) ... done. Elapsed time: 8 seconds | |
Uploading production design...done. | |
Checking view signatures...done. Both signatures are: 7bfe586167ab93ee5c5320833b336201 | |
Testing a production view (this should be immediate) ...done. Elapsed time: 0 seconds | |
Testing a production lucene view (this should be immediate) ...done. Elapsed time: 8 seconds |
This file contains 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
function makeBrand() { | |
var key = {}; | |
class Envelope(payload) { | |
protected const contents = payload; | |
function open(k) { | |
if (k === key) { return this.contents; } | |
} | |
} | |
return { | |
sealer: function(payload) { return new Envelope(payload); }, |
This file contains 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
+V----------------+ | |
| # # # < | |
| # # # # # ######| | |
| # # # # # | | |
| # # # # ########| | |
| # # # # # | | |
| # # # # # ######| | |
| # # # | | |
|######## ####### | | |
| | |
This file contains 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
<? | |
set_time_limit(0); | |
function usage($msg) { | |
echo $msg."\n"; | |
echo "Usage: update_couch_design ADMIN_PASSWORD\n"; | |
echo "Updates the configured couchdb database's design doc and views without blocking any other users.\n"; | |
exit; | |
} | |
//Must run as a standalone script. |
This file contains 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
if (PORTB&(1<<USER_SOL_PIN)) { | |
48e: c0 9b sbis 0x18, 0 ; 24 | |
490: 02 c0 rjmp .+4 ; 0x496 <main+0x12> | |
PORTD|=(1<<UV_LAMP_PIN); | |
492: 97 9a sbi 0x12, 7 ; 18 | |
PORTB&=~(1<<BW_PUMP_PIN); | |
494: c6 98 cbi 0x18, 6 ; 24 | |
496: ff cf rjmp .-2 ; 0x496 <main+0x12> | |
Same code generated with macros: |
This file contains 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
<? | |
//Given MSA files, report for each the semesters. | |
array_shift($argv); | |
if (!$argv) $argv = array('php://stdin'); | |
foreach ($argv as $file) { | |
$in = new SplFileObject($file, 'r'); | |
$semesters = array(); | |
foreach($in as $l) | |
if (preg_match('/\d{5}_([^_]+)_.*\|(\d{4})$/',$l,$m)) |
This file contains 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
<? | |
... | |
$select = new Zend_Db_Select($db=Zend_Db_Table::getDefaultAdapter()); | |
$select->from(array('a'=>'tutors_applicant_application')); | |
//Filter on area? | |
if (isset($query['area']) and $query['area']!='all') { | |
$area = $query['area']; | |
$select->where('area=?',$area); | |
} |
This file contains 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
http://www.youtube.com/watch?feature=player_embedded&v=OoPCDiMF108 | |
1. In the battery or inside the battery plug, the current is converted to AC. | |
2. The LEDs are attached in opposite polarity, but are normal LEDs. | |
3. The switches are labelled in reverse - '0' is short, '1' is open. | |
4. Each switch has an internal diode in series, with the same polarity as their LED. | |
When both switches are '0': | |
Each switch conducts when the AC cycle forward-biases its diode, so the LED sees insufficient voltage (only 0.7V to light) |