Sunday, February 28, 2010

Thursday, February 25, 2010

sorting a dictionary




How to sort a dictionary in Python:


s = sorted(dm_value.items(), key=lambda(k,v):(v,k))





mpi




Why not MPI? - Interesting reddit thread and timely, we were just talking about MPI yesterday.



Tuesday, February 23, 2010

Monday, February 22, 2010

mir




Music as Embodied Knowledge: Info-Seeking Behaviour in a Flamenco Guitar Workshop with guest speaker, Margaret Lam, Masters of Information Studies Candidate.

Wednesday, February 24
KMDI Lab ? Bahen Centre, 50 St. George Street, 7231

4:30 pm -5:30 pm

Abstract:

Much research has been done in the field of information seeking behaviour, information retrieval, information architecture and system design to facilitate the sharing of musical content. With all the advances in the field, there remains an emerging research area, namely, how musical knowledge is being renegotiated in the information age. In this presentation, the preliminary results of a pilot ethnographic study will be presented in the context of multiple disciplines such as information science, ethnomusicology, music education and knowledge media design, highlighting a rich area for innovative interdisciplinary collaboration. This is a version of Margaret's talk which will be given at the British Forum for Ethnomusicology's Annual Conference in Oxford this April.






pad




An Adobe Flash developer on why the iPad can?t use Flash - The reason is - no mouseover. This is a real problem with touchscreen interfaces.



Sunday, February 21, 2010

Saturday, February 20, 2010

immortal




Immortal Jellyfish - and other long lived species.

Humans, you have no clue, or rather, you are just starting to get the inkling of a clue.

Free your mind.



Friday, February 19, 2010

sound.py




How to play a sound in Python

and my Linux only version with comments:


#!/usr/bin/python

from wave import open as waveOpen
from ossaudiodev import open as ossOpen
from ossaudiodev import AFMT_S16_NE

# Open the sound file
file='abacus_click.wav'
s = waveOpen(file,'rb')
(nc,sw,fr,nf,comptype, compname) = s.getparams( )

# Open the sound card
dsp = ossOpen('/dev/dsp','w')

# Setup the sound card
dsp.setparameters(AFMT_S16_NE, nc, fr)

# Read the sound file
data = s.readframes(nf)
s.close()

# Play the sound
dsp.write(data)

# Close the DSP device
dsp.close()




3d sun




3d sun - Cool new iPhone app



Wednesday, February 17, 2010

minus s




Ah tricky! I was trying to debug a file with gdb, and was using the -g flag, but gdb still would tell me "no debugging symbols found".

Turns out this was because I had accidently added the "-s" flag to LDFLAGS, which strips the executable...



Tuesday, February 16, 2010

sleeeep




A trick on Linux when you are "tail -f"ing the flashlog.txt file when using a local flashplayer applet. I was having some terrrible tracing issues, because the file was getting truncated and looked the same after it was truncated, so I wouldn't always see it change. To fix this, lower the sleep interval to the tail command:


tail -f -s0.01 flashlog.txt




nn




Auto-encoder - An auto-encoder is an artificial neural network used for learning efficient codings.
Boltzmann machine - A Boltzmann machine is the name given to a type of stochastic recurrent neural network.



Monday, February 15, 2010

tricky!




I had some getters and setters in Actionscript that were accessing a private member variable _status, which looked like:


private var _status:String;

// Getters and setters for status
public function get status():String {
return _status;
}

[Bindable(event="statusChanged")]
public function set status(value:String):void {
_status = value;
statusChanged = true;
invalidateProperties();
dispatchEvent(new StatusChangeEvent(value));
}


I couldn't figure out how to call the setter function from Actionscript, and looked all over. Turns out the solution is way easier than I imagined, just set the "status" variable:


status = STATUS_BUSY;


This calls the appropriate setter.



tiger




2010 is the Year of the Tiger - symbol of vivacious bravery!



sch




Schroedinbug - a bug that manifests only after someone reading source code or using the program in an unusual way notices that it never should have worked in the first place, at which point the program promptly stops working for everybody until fixed.



Friday, February 12, 2010

ml




Machine Learning: An Algorithmic Perspective - Example code from a book. In Python. nice.



algo




Favorite algorithms

"Debugging it was awful though, as one wrong move and you end up with an angry ball of polygonal hate."



Monday, February 08, 2010

gotcha




I just encountered a little gotcha when compiling Flex. I like to separate out my .mxml and .as files, so I had something like:

GetDrawData.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">

<mx:Script>
<![CDATA[

include "GetDrawData.as"

]]>
</mx:Script>

<mx:Label width="100%" color="blue" text="abctest123"/>
</mx:Canvas>


and then had a .as file called GetDrawData.as. When I tried to compile this I got the following error message


Error: Could not resolve <sness:GetDrawData> to a component implementation.


The solution is to rename GetDrawData.as to something like _GetDrawData.as.


<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">

<mx:Script>
<![CDATA[

include "GetDrawData.as"

]]>
</mx:Script>

<mx:Label width="100%" color="blue" text="abctest123"/>
</mx:Canvas>


Tricky!



transcribe




The Bentham Papers Transcription Initiative - Crowdsourcing the transcription of paper archives.



semi




vegetative semiotics, or phytosemiotics; vegetative semiosis occurs in all organisms at their cellular and tissue level;



Thursday, February 04, 2010

newline




How to get a newline in a caption of a figure in Latex:


\usepackage[justification=centering]{caption}




cochlea




Great talk about the cochlea by Richard Lyon.



mood enhancer




moodagent - Fantastic music player on iPod