« September 2011 | Main | November 2011 »

October 30, 2011

Detect an iPad and provide a non-Flash alternative

try{ ["iPad","iPod","iPhone"].each(

  function(i){

    if(navigator.userAgent.indexOf(i) > -1){

      //Do iPad stuff here

      }

   }); } catch(e){ var meh = 'meh'; }

Posted by pj at 08:40 PM | Comments (0)

October 28, 2011

Jython and Django

Chapter 14: Web Applications With Django — Jython Book v1.0 documentation

Posted by pj at 10:00 PM | Comments (0)

Groooooooooovy

Groovy - Home

Posted by pj at 09:41 PM | Comments (0)

October 26, 2011

Matrix Asset Map for iOS

Zed Said Studio - Squiz Matrix Asset Map for iOS

Posted by pj at 09:55 PM | Comments (0)

October 21, 2011

Textastic for iPad

Textastic Code Editor for iPad on the iTunes App Store

Posted by pj at 10:40 PM | Comments (0)

October 19, 2011

Alternately colour the rows in a table with jQuery

var color = '#efefef';

var counter = 0;

function switch_bg(counter){ 

    if(eval(counter/2) == eval(counter/2).toFixed(0)){ return color; } 

    else { return 'white'; } 

    }

jQuery('tbody tr').each(

	function(){ 
	
		counter++;  
		
		jQuery(this).find('td').each(
		
			function(){ 
			
				jQuery(this).css({ 'background-color' : switch_bg(counter) }); 
				
				}
			
			);
			
		}
			 
	);

Posted by pj at 06:42 PM

October 11, 2011

Student class needs to be adjusted

	function get_hash_by_uun($uun){
		
		return $this->get_hash_by_id($this->get_id_by_uun($uun)); 
		
		}

	function get_id_by_uun($uun){

		$m = (int) str_replace('s', '', $uun);
		
		$reply = just::sql(sprintf("select student_id from student_full where matriculation_number = %d", $m));
		
		return $reply['first_row']['student_id'];		

		}
		
	function get_uun_by_id($id){
	
		$reply = just::sql(
			sprintf("select case
			when char_length(matriculation_number::varchar) = 5 then 's00'||matriculation_number
			when char_length(matriculation_number::varchar) = 6 then 's0'||matriculation_number
			else 's'||matriculation_number end as uun from student_full where student_id = %d", (int) $id)
			);
	
		return $reply['first_row']['uun'];
	
		}

Posted by pj at 06:42 PM | Comments (0)

October 10, 2011

Kill runaway Postgres threads

kill `ps -ef | grep [p]ostgres | awk '{print $2}'`

Posted by pj at 05:05 PM | Comments (0)