Wednesday, December 31, 2008

uvic rocks




Wow, the UVIC library has this great program called Gear2Go, where you can borrow video cameras and audio recorders overnight for school projects.

Two of the things I'm going to borrow to do a better video of SOMba are the Sony DCR-HC62 MiniDV and the D&M PMD620 Professional Handheld Recorder



Tuesday, December 30, 2008

Sunday, December 28, 2008

The Middle Show: The Great Ronald Jenkees

STS9 Collab - Using their drums to jam with!! FUN!

neato

sness






OLPC



My dear sister Melissa gave me an OLPC for Christmas! Sweeeet! It's a great little machine, the best part is that when the backlight on the display is powered off, you can view the screen in light. This means massive battery life. It was perfect on the train down from Courtney to Victoria, I had Emacs fired up and was browsing through the source code of Marsyas.

OLPC Links:

Activated Upgrade
Autoreinstallation image
Getting a developer key
Hacking your XO
Test Network Configuration
Anaconda Kickstart
Hacking the XO at geek.com
Hacking Sugar
Hacking the OLPC XO Laptop - Part 1: Initial Setup
OLPC upgrade
Upgrading the XO
How to check the OS and firmware versions
Clean-install procedure - I had problems with olpc-upgrade, so I just did a fresh install and it worked great. I went from version 656 to 767, and it was a huge change, and for the better. Now the power button suspends the laptop. Much better.
OS images
JFFS2 - Journalling Flash File System version 2. Interesting, it says that it's journalled, but on my old 656 install, a forced powerdown caused the OLPC to wait for a long time as it checked the file systems.
Release notes for 8.2.0.



overclock




Overclock your OLPC from 433MHz to 566MHz. Um, probably not a good idea, but interesting.



Saturday, December 27, 2008

OLPC Mission, Part 2: The XO Laptop, design for learning

OLPC == rocks. Sugar == way too slow.

Solution: rewrite in C.

Saturday, December 20, 2008

screencast




For doing a screencast in Linux, definitely use "recordmyscreen" and not "xvidcap". I tried xvidcap recently on Fedora 10 and had weird hangs all over the place. It looks like it's xcb that is causing the problem, but there's no real way to fix it.

So just


sudo yum install recordmydesktop -y


and then to record your desktop just go:


recordmydesktop


and you're done. It saves the file as ogg, which uploads to YouTube just fine.

Now I'm trying to find a good Linux video editor program. Cinelerra just takes .mov files as input, and doesn't like the .mov files that ffmpeg converts. I'm trying LiVES, but it's a little wacky, and takes forever to import video. Kino also is the suck.

We need something simple and better. Not a lot of transitions and stuff, just a simple way to make videos from multiple sources.


Harmonic Metalaphone on Reactable

Thunderheist - Little Booty Girl

My current favorite song in the world.

completely random




I think that celebrity collage is pretty close to random:





another try




woah.





nader









SOMba - Co-creative music generation by tracking dancers - Part II - from Camera

SOMba - Co-creative music generation by tracking dancers

air




Adobe releases AIR 1.5 for Linux.



opengl




Cool, it looks like OpenGL is making a rebound against DirectX. That is good.



stdio




A rant against stdio. Hmm, interesting.



concurrent haskell



agile git



old web



currying




In computer science, currying, invented by Moses Schoenfinkel and Gottlob Frege, and independently by Haskell Curry,[1] is the technique of transforming a function that takes multiple arguments (or more accurately an n-tuple as argument) in such a way that it can be called as a chain of functions each with a single argument.



android



coq




How man Coq programmers does it take to change a lightbulb?
Are you kidding? It takes 2 post-docs six months just to prove that the bulb and the socket are both threaded in the same direction.

More like this at Lambda the Ultimate.



Thursday, December 18, 2008

tricky part 2




Also had to do some symlinking as it couldn't find my moved vamp .h files:


sudo ln -s /usr/sness/sv/include/vamp-hostsdk /usr/include/vamp-hostsdk
sudo ln -s /usr/sness/sv/include/vamp-sdk /usr/include/vamp-sdk
sudo ln -s /usr/sness/sv/include/vamp /usr/include/vamp




tricky




I was having major issues installing sonic-visualiser from source. The problems arose because I wanted to compile my own rubberband and vamp plugins, and the lame qmake installation that sonic-visualiser uses couldn't find them.

To get around this, I just installed rubberband and vamp with yum:


yum install vamp-plugin-sdk-devel vamp-plugin-sdk rubberband rubberband-devel -y


Then copied their pkgconfig .pc files somewhere:


mkdir save-pkgconfig
cp /usr/lib/pkgconfig/* save-pkgconfig


Then removed the original packages:


rpm -e vamp-plugin-sdk-devel vamp-plugin-sdk rubberband rubberband-devel


Modified the prefix line in the .pc files:


prefix=/usr/sness/sv
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: vamp-sdk
Version: 1.3.0
Description: Development library for Vamp audio analysis plugins
Libs: -L${libdir} -lvamp-sdk
Cflags: -I${includedir}


Copied these files back to the pkgconfig directory:


cp *pc /usr/lib/pkgconfig


And compiled sonic-visualiser.


Wednesday, December 17, 2008

Monday, December 15, 2008

flash debug




Debug and standalone versions of Adobe Flash Player.



Saturday, December 13, 2008

pulse audio




Pulse audio sucks. I just installed Fedora 10 and it was totally not working with either MPlayer or Marsyas, so I just took out all of the pulse audio nonsense:


rpm -e pulseaudio-libs pulseaudio-libs-glib2 pulseaudio-module-gconf pulseaudio-utils pulseaudio-module-x11 pulseaudio-core-libs pulseaudio-esound-compat pavucontrol libcanberra xine-lib-pulseaudio gstreamer-plugins-good gnome-settings-daemon alsa-plugins-pulseaudio gdm control-center gnome-applets totem-gstreamer libcanberra-gtk2 pulseaudio gnome-session orca totem gdm-user-switch-applet compiz-gnome plymouth-gdm-hooks totem-nautilus gnome-session-xsession totem-xine totem-mozplugin gnome-panel


Come on Fedora guys, get with the program and get some audio that actually works.



threads




The basics of threads.



clojure




Macros in Clojure. Gotta learn Clojure one of these days.



pygame




Writing a game in Python with Pygame. Looks like a really nice API. I did a bunch of coding in Python for SOMba, and really enjoyed it. Python pretty well rocks.

I did a lot of the coding in C++ as well, with the C++ API in Marsyas, which also rocked.

Next week will be all haXe and Ruby on Rails.



distcc




distcc - a fast, free distributed C/C++ compiler




Friday, December 12, 2008

lisp + ruby + jvm




Calling Clojure from JRuby. This is where we start seeing some neat things happening. Calling Lisp code from Ruby inside the JVM with all those Java libraries. This is sweet.



Tuesday, December 09, 2008

Saturday, December 06, 2008

latex




latex symbols. i heart latex.



j




jQuery in Action - A new book on jQuery. Want have.



ext4

alien comet




An alien comet might be in the solar system. That totally rocks.



rockstar




I recently had a situation where I needed to screenscrape data from a website. I did it in Ruby with wget, which worked super well.

wget with --post-data rocks


wget http://website.com --post-data="thingy=#{id}"


Turned out that just doing this didn't work, it had some kind of validation code that it was POSTing as well. To figure this out I used the excellent Tamper Data plugin for Firefox, which let me see exactly what data was being POSTed to the website.

It was then just a matter of using Ruby to scan through the page to get the data I wanted and output this as a .csv file.






cat map












web analytics



acid test




Opera 10 alpha aces Acid3 browser test

Nice. I use Opera and Firefox for my daily browsing, Opera for reading large amounts of information, it's tabbed browsing totally rocks.


uc



twitters



objc




Finally a good Objective C book.

So many languages, so little time.




FAIL



js



couchdb




More reasons why CouchDB rocks.



twoooo



3




Get some love for Python 3000.



learn




Statistics vs. Machine Learning.

After CSC 589 this year at UVIC, I finally understand Bayesian statistics. It's actually quite simple, and totally cool.



analytics



Friday, December 05, 2008

bear hoods



LIMIT



very small drums




One potential application for graphene (sheets of graphite only one or several layers thick) is as a resonator in nanoelectromechanical systems, in part because of the high ratio of stiffness to mass. However, the formation of large-area films of exfoliated graphene and manipulation of the graphene flakes are experimentally challenging. An alternative is to use a related material, graphene oxide, in which the graphene film is chemically modified with oxygenated substituents. Robinson et al. rapidly deposited graphene oxide platelets onto glass by spin casting along with rapid solvent evaporation, which formed ultrathin continuous films. These films could then be chemically reduced, and despite being as thin as 4 nm, could be released from the substrate by being dipped into basic solution. They could then be suspended onto substrates patterned with circular holes (between about 3 and 7 ?m in diameter) in order to form drum resonators. Laser interferometry revealed that these membranes resonate in the radiofrequency range and have quality factors up to 4000, which is comparable to those of diamond oscillators and exceeds typical values for graphene oscillators (10 to 200). This increase relative to graphene reflects the enhanced adhesion of graphene oxide to glass surfaces through surface oxygen groups. -- PDS

Nano Lett. 8, 3441 (2008).



simle








Thursday, December 04, 2008

yes




http://api.yes.com/ - The API for yes.com, Develop applications using radio now playing information gathered from thousands of broadcast and online stations

Nice.



clojure




A podcast about programming Clojure.



rails




Another person is stopping developing with Rails.

All good points, especially about the gems, which are not-well-thought-out, and the community problems. Also, I would add that the dramatic changes between releases also really suck.

But I'm totally going to keep developing everything in Rails, it fits perfectly into the plans I have for websites, and really does have some sweet syntax sugar. Mmmm, syntatical sugar... Tastes good.



moon and venus








Wednesday, December 03, 2008

Tuesday, December 02, 2008

Annie Hall

clojure



wait




What Your Computer Does While You Wait. Interesting analysis of the Core 2 architecture.



amazon security rules



ai in games




Bots Get Smart - New uses for AI in computer games.

Interesting, Jonathan Schaeffer is one of the coauthors.



AI Landscape








git



ipe




ipe - is a drawing editor for creating figures in PDF or (encapsulated) Postscript format. It supports making small figures for inclusion into LaTeX-documents as well as making multi-page PDF presentations that can be shown on-line with Acrobat Reader.

Excellent program. Suggested to me by Dr. S. Ganti.



Saturday, November 29, 2008

jericho




Jericho - is believed to be one of the oldest continuously-inhabited cities in the world, with evidence of settlement dating back to 9000 BCE. Woah.



glacial




The Wurm Glaciation. This was the last glacial period.



Orca Song 2008

fs




On File Systems - Current thoughts on Linux filesystems.



link



iPhone




Sweet, Linux on the iPhone. Nice.



edit




Good editors aren't better or worse, just different. Totally. People's brains just think different, so find the editor that fits the way you think the best.

My brain fits Emacs the best, although over the last 10 years it's been a combination of me making Emacs fit me better, and me changing my brain to fit Emacs better. I'll be using Emacs when I'm 90.



gui




This is very cool, a GUI that changes based on the users skill level.

Totally the future. The interface should adapt to you as you learn it better. Emacs has a function where if you enter the full command name with M-x, it tells you the keys that could be used to type it, this adaptive interface is the next step in this.




Friday, November 28, 2008

vb



i7




mmm, Intel Core i7. Pretty.



bitfields




An interesting article about how bitfields are not as cool as they seem. I never thought about it this way, interesting.




Wednesday, November 26, 2008

Justice vs. Simian - We Are Your Friends

D.A.N.C.E - Justice

JUSTICE!

YELLE

last yelle for tonight, i promise.

YELLE

Yelle

more more more

YELLE

Saw this on xlr8rtv. rock.

processing




Processing 1.0 - The first non beta version of Processing has just been released. Sweet.



js909




JS-909 - Drum machine in Javascript



Monday, November 24, 2008

dilithium






A dilithium star this year, that's all she wrote. I just don't have time for a Hat Trick try this year. But I do have
the bragging rights that I only started one character and ascended her. My favorite, a Chaotic Female Elven Wizard.

Had 4 unused wishes left.

Man Nethack is sure simple compared to Slash'em, which is my prefered variant now.



experimentation






total lol irl.



Rachmaninov - Piano Concerto no. 3 (Cecile Licad) 3/6

Watch for when the lights go out and she keeps on playing for a minute. That is deep knowledge.

Bruce Lee plays ping pong with nunchuck.flv

gauss



math




Covariance matrix
Math in Ruby
Matrix in Ruby
Matrix multiplication

I found that Ruby was very nice for doing some statistics with a Gaussian classifier:


covariance_matrix = Matrix.diagonal(var_x,var_y)
inv_covariance_matrix = covariance_matrix.inverse
determinant_covariance_matrix = covariance_matrix.determinant





Friday, November 21, 2008

sweet ruby goodness




Wow. Great tip here:


>> "%.2f" % 45.4324234321421
=> "45.43"

>> "[%s]" % "Hey you dirty old ruby, put me in brackets. NOW!"
=> "[Hey you dirty old ruby, put me in brackets. NOW!]"

For more complex substitutions, pass the arguments as an array:
>> "[%s] And a number:%.1f" % ["Hey you dirty old ruby, put me in brackets. NOW!",43.4323]
=> "[Hey you dirty old ruby, put me in brackets. NOW!] And a number:43.4"



plop



minimal apis



old old old




Gobekli Tepe: The World?s First Temple? - 11,000 years old, crafted and arranged by prehistoric people who had not yet developed metal tools or even pottery.

We are old.



code_art




Art and code.

Code == Art.




ruby




The Opposite of Momentum - About problems with Ruby.

Yes. Definitely. I love Ruby and program all my scripts in it, plus all of my websites. But I'm learning Python and encourage people to learn Python instead of Ruby.

Kids, learn Python. And Ruby, if you have the extra brainpower.

Ruby is prettier, but Python will win.



gcc hacks




GCC hacks in the Linux kernel - The Linux? kernel uses several special capabilities of the GNU Compiler Collection (GCC) suite. These capabilities range from giving you shortcuts and simplifications to providing the compiler with hints for optimization. Discover some of these special GCC features and learn how to use them in the Linux kernel.



slb




Sounds Like Bach - Essay on music by Douglas Hofstadter



Thursday, November 20, 2008

alchemy




Alchemy - is a research project that allows users to compile C and C++ code that is targeted to run on the open source ActionScript Virtual Machine (AVM2). The purpose of this preview is to assess the level of community interest in reusing existing C and C++ libraries in Web applications that run on Adobe Flash Player and Adobe AIR.



algorithms




CS 294-5 Great Algorithms. Cool.



exact




33 exact string matching algorithms.

Check out the Horspool algorithm. He's from our department!



Monday, November 17, 2008

MC Chris - Nrrrd Grrrl music video

MARSYAS Genre Meter

so. totally. cool.

and this is from 2001!

got to do this in Qt.

zeroes and ones




Zeros and Ones, a course I am taking in January. Knuth rocks.



Sunday, November 16, 2008

dyn




Introduction to Dynamic Programming.



source control




Use source control like you would use save points in a videogame. Excellent analogy.



Friday, November 14, 2008

math



wiid



3dwii




3d Wii Application

This is a small program which utilizes the Cwiid API to detect the x, y and z coordinates of an infrared light source. The intent was to make something which could demonstrate the posibilities of using the wiimotes in this alternative manner. Usually the wiimote uses an IR source to determine if it has moved positions. What this program does instead is uses the wiimote as a stationary sensor, which detects the position of the IR source. In addition, by using two wiimotes, it's possible to determine the depth of the IR source as well.



liblo




liblo API.



wiiosc




WiiOSC is a tiny Linux program to use the Nintendo Wii Controller as a control device for music programs.
It sends out the Wii data as OSC messages to a port of your choice, and can receive OSC data to turn on LEDs or the rumble.

love. it.

I'm using it in SOMba, my samba music generator program for dancers. Might rewrite it to more closely match what I need, but it's pretty awesome as it is.



tender tub






umm?


heela




Strasheela is a highly expressive constraint-based music composition system.



hadoop




hadoop is a software platform that lets one easily write and run applications that process vast amounts of data.

It's like MapReduce from Google, but how Yahoo does it (which probably means not as good). But it's part of Apache incubator, which is very cool.

Hadoop at wikipedia
is a dataflow programming environment for processing very large files.

CouchDB is also now in Apache incubator.
CouchDB at wikipedia.

This came from me researching a class I taught recently at UVIC on Functional Programming.

Charming Python: Functional programming in Python
Functional Programming HOWTO in Python
Ocaml - I couldn't figure out the OCaml logo, but the class figured out that it looked like a Camel. lol. droll lol.
Monads
From Monoids to Monads




Zwölftonwerbung - Twelve tone commercial

lol!

Thursday, November 13, 2008

Wednesday, November 12, 2008

14 second boot



synth




synth - Sound synthesis using haXe targetting Flash 10. All the sourcecode is GPLed, sweeeeeeet!



Monday, November 10, 2008

fys




fuck yeah sharks. this takes the lolcat meme to a whole different place.



omnet




For a course that I'm taking, CSC 546 : Operations Research

OMNet++
omnet docs
OMNeT++ in a Nutshell
FIFO
omnet user manual
omnet API



zeros and ones



getc




getc and termios
while getchar



select




select() is your friend.



wiimote



marlpc




MarLPC - The best part of this app is that it takes Open Sound Control (OSC) messages as input. It uses Qt to do this, and is a little funky, but not in a good way. I'm looking to do something similar with liblo instead.





wiiosc




wiimote + osc. Uses cwiid. Sweet.



Central Molecular Zone








Sunday, November 09, 2008

knuth








gsr




A mouse that measures Galvanic Skin Response.





rain music




A wall that makes music when it rains:





Thursday, November 06, 2008

ascii7




I was having big problems with 'pdftotext' producing wacky characters that were making life difficult when I would edit the file. The trick is to set the encoding to ASCII7:


pdftotext -enc ASCII7 file.pdf


I added a line to my .zshrc with the following alias


alias pdftotext='pdftotext -enc ASCII7'





Tuesday, November 04, 2008

somba2




Emilia is 35 years old and is a choreographer and has her own
modern dance company. She has been commissioned to produce a new
dance piece for the opening of the newly refurbished Chisenhale
Dance Space in London. She wants to incorporate new media and
music into the performance, and has decided to use the SOMba system
to make the music for the dancers.

She first contacts a local Brazilian musician, Ayrton, to obtain
music for a few different types of samba rhythms. Ayrton provides
her sheet transciptions of these rhythms for each of 10 different
Brazilian percussion instruments. Aryton has a large collection of
percussion instruments, and records samples of each of them for
Emilia.

Emilia then uses the SOMba system to generate audio files for each
of the parts in the samba rhythms, using the transcribed music and
the recorded samples, both provided by Ayrton. She then uses the
SOMba system to produce a Self-Organized Map of the audiofiles.
She then tries out the different SOMs by using the graphical SOM
browser in the SOMba system. The first few maps she produces do
not fit in with her desired choreography, so she generates SOM maps
until she finds one she is happy with.

Emilia then choreographs and practices with the dancers in her
dance company, trying out different dance techniques, and different
timings for when the dancers show and hide their infrared glowing
orbs. The performance is a rousing success, and Emilia is invited
to Berlin to stage another performance.




somba




Keti is a new music composer based in New York. She currently has
writers block in writing a new piece of music to be performed at
the Julliard School. Keta is at the stage of having a variety of
musical motifs that she is happy with, but is having trouble
putting all these pieces of music together into a unifed whole.

She first creates audiofiles of the various motifs in her score,
breaking these motifs into small one bar measures. Some of the
motifs are rhythmical, some are melodic segments and some are
environmental sounds. She then uses the SOMba system to create
three different Self-Organizing maps, one for rhythm, one for
melody, and one for the environmental sounds.

She then loads up three different instances of the SOMba GUI
browser, and starts placing the icons at different points in the
three different self organizing maps. She adjusts the volume of
each of the clips on the screen, and moves the clips around until
she finds a pleasing arrangement of sounds.

She then takes her 8 sound orbs and puts them on the floor of her
studio apartment, in roughly the places that she had on the
graphical user interface. Keti then moves around space, moving
audio clips slightly to produce exactly the timbres and
juxtapositions of music she is interested in producing.

Somewhere along this process she has the realization that she could
produce this music in real time, on stage by moving the sound orbs
herself. She develops her symphony now with this idea in mind.
When she performs it, the audience is initally shocked by the
composer moving around the stage, but soon begins to appreciate it,
and the performance ends to thunderous applause.




Sunday, November 02, 2008

(Rock Paper Scissors)^2








spicules








sweet




Awesome, I love it when my work is already done: wiiosc, is a tiny Linux program to use the Nintendo Wii Controller as a control device for music programs. Excellent, one step closer.



Saturday, November 01, 2008

flash osc




Flash and OSC. I think I am going to do this in haXe, but it might be a lot of work.



wii




I'm setting up the wii mote on Linux to do my project for CSC 589 here at UVIC. Here's some useful links:

cwiid - a collection of Linux tools written in C for interfacing to the Nintendo Wiimote.
ubuntu wii
Sending simulated mouse events using uinput
wminput
wiimote
wiimote driver
libwiimote
Control X.Org cursor with Wiimote
Tracking Your Fingers with the Wiimote


I personally found the cwiid project to work the best for me. The other big project, libwiimote is cool but doesn't seem to read the IR sensors correctly, and that's what I need.

I'm currently extracting code from wmdemo to have a small little program to send out OSC messages for the data for the IR leds on the wiimote.

Now, with two wiimotes I can track 8 dancers in real time for my SOMba project. It is gonna be sweet.










Friday, October 31, 2008

Wednesday, October 29, 2008

matlab



matlab




Introduction to Computer Programming with MATLAB Lecture 9: Spectral Analysis



sawtooth



octave




GNU Octave - Functions and Scripts
Waveforms
sawtooth wave in matlab
Reading data files into matlab
highlevel.m - Loading and saving data in matlab


%This file demonstrates the bahvior of LOAD and SAVE


clear all % Clear all variables
x = 5; x2 = 10; % Create x and x2
whos
pause
save xdata x % Save only x into xdata.mat
clear all % Clear all variables
load xdata % Load xdata.mat
whos % Note that x is back
pause
x2 = 10; % Recreate x2
whos
pause
save xdata x* % Now save using a wild card
clear all % Clear all variables
load xdata % Load xdata.mat
whos


MATLAB code for test tone synthesis, selection, and all-pass filtering




aurora








octave




Executable Octave Programs


#! octave-interpreter-name -q -f # comment


plotting in octave


x = (-10:0.1:10)';
y = sin(x)
plot(y)






phasor




Phasor (sine waves) - at wikipedia
Phasor - At mathworld
Phasors




wii



math



y




CSC 485-eh? - System Infrastructure Design & Construction Techniques
planet-lab.org




tex




TeX live - is an easy way to get up and running with TeX. It provides a comprehensive TeX system with binaries for most flavors of Unix, including GNU/Linux, and also Windows. It includes all the major TeX-related programs, macro packages, and fonts that are free software, including support for many languages around the world.



hidden



Monday, October 27, 2008

mmm




This weekend was a major baking weekend, I made my usual mega multigrain loaves, with spelt, kamut, sunflower seeds and sesame seeds. Then, on Sunday I made white bread with seasame seeds on top and a batch of kaiser buns. Then in the evening I made possibly the most intense brownies ever, with triple chocolate, sweetened condensed milk caramelized layer, and an icing layer with chocolate chips and extra cocoa, all of this then dusted with powdered cocoa. when i was cutting it this morning i was kind of blown away. any takers?



Friday, October 24, 2008

Nerd Porn

d




1987
DMSO.

2007
DVNO.

2013
DMTO




mix



ascii








pronuncation vs. enunciation




http://wiki.answers.com/Q/What_is_the_difference_between_pronunciation_and_enunciation

"Pronunciation" refers to which sounds one says and what stress patterns one uses. For example, does the pronunciation of data resemble "d-at-uh" or "day-tuh"? Is the pronunciation of formidable more like "FORmidable" or "forMIDable"?

[Accuracy in pronunciation is a complex topic, for in America, the only authority, the only standard, is usage.]

"Enunciation" is an old fashioned term. When it was in vogue, is referred to saying sounds correctly. Mumbling, slurring, and lisping were examples of poor enunciation.

Thus, one could enunciate a word poorly but pronounce it accurately, or enunciate it well but pronounce it inaccurately.



Wednesday, October 22, 2008

deepcopy




deepObjectCopy.as

function deepObjectCopy(obj:Object):Object {

if (typeof obj != "object"
|| object instanceof Button
|| object instanceof TextField
|| object instanceof MovieClip) {

// display object (return reference)
// or non-object value (return value)
return obj;
}

var copy;

// define copy object type
// Boolean, Number, and String objects can be defined
// as objects with a base value (and can be given properties)
// class valueOf used to retrieve base value
if (obj instanceof Boolean) {
copy = new Boolean(Boolean.prototype.valueOf.call(obj));
} else if (obj instanceof Number) {
copy = new Number(Number.prototype.valueOf.call(obj));
} else if (obj instanceof String) {
copy = new String(String.prototype.valueOf.call(obj));

// for other objects
} else if (obj.__constructor__) {

// if a clone method exists, use that
if (typeof obj.clone == "function") {
copy = obj.clone();

// make sure the copy is of the same type
// in case clone was inherited
if (copy.__proto__ == obj.__proto__) {
return copy;
}
}

// if no clone or clone was not a valid
// use object's __constructor__ to create copy
// if exists; assumes no required parameters
copy = new obj.__constructor__();

// __constructor__ will not be available for
// Array and Object instances defined in shorthand
} else if (obj instanceof Array) {
copy = [];
} else {
copy = {};
}

// copy object properties
for (var p in obj) {

// only copy properties unique to object
// assumes all properties enumerable
if (obj.hasOwnProperty(p)) {

// deep copy the property being assigned
copy[p] = arguments.callee(obj[p]);
}
}

// return copy
return copy;
}



copy.as




Add a copy() function to Flash.



Sunday, October 19, 2008

Saturday, October 18, 2008

Friday, October 17, 2008

Friday, October 10, 2008

flare




Extract the sourcecode from a Flash .swf file with Flare. Nice.



selection algorithm




Selection algorithm - In computer science, a selection algorithm is an algorithm for finding the kth smallest number in a list, called order statistics.



math




Variance
Expected value
statistical review - Excellent resource
Variance sum law
PDF - Probability density function - For continuous functions
PMF - Probability mass function - for discrete distributions



Wednesday, October 08, 2008

th




I must go see Thunderheist here in Victoria:

November 19, 2008

Victoria, CA
Venue: TBA




Tuesday, October 07, 2008

tex tex tex




Watch out if you are using pdflatex and you have a weird unicode character. pdflatex won't like it.

If you are as unlucky as me to have it in a section heading, it will get written to the .toc file, and even when you fix it in your file, pdflatex will still not work. I learned this the hard way.



Sunday, October 05, 2008

Public Enemy vs Benny Benassi - Bring The Noise Remix (Pump-kin Remix)

Mason vs. Princess Superstar - Perfect (Exceeder)

Princess Superstar - Perfect

nethack tournament




Oh noes, I don't think I'll have much time to participate in this years Nethack tournament. Still, I need to ascend at least an Elven Wizard just to keep my name in there. Won't be a hat trick this year.



cheat magit




magit cheat sheet


-------

M-x magit-status

Status Buffer
-------------

l show history buffer starting from head
L show history buffer starting from a specified point

b check out a different branch
B create and check out a new branch
d compare working tree with specified branch

m manual merge
M automatic merge

R rebase / continue to rebase

F pull
P push
p show a buffer with push/pull command transcript

g refresh
s add a file to the staging area
i ignore a file

S move all hunks of all diffs into the staging area
U unstage all hunks

In a hunk

s stage hunk
u unstage hunk

c pop up a buffer to write the change description
C-c C-c to commit the staged changes

History Buffer
--------------

RET show more info about the commit
l use commit as starting point of the history buffer
R revert selected commit in working tree and staging area
P apply current commit in the normal way
C switch your current working tree to the commit
. mark current commit
= diff marked commit and current commit
x soft reset to current commit
X hard reset to current commit


Sweeet.



mini




Hands on with the Dell Inspiron Mini 9. Interesting. I like those tiny laptops, but my fingers are too big. I need to implement that muscle listening system that I've been meaning to make. Someday, when things are less crazy.

I am just one human being, after all.

Even with all that alien energy.



conk




Conkeror Installation - Conkeror is a totally rad browser that uses Emacs keybindings. Too bad it's implemented in Javascript and not Lisp, and could use more Emacs integration, but still amazing.



magit




magit - A Emacs mode for Git. Nice.



rosetta




A rosetta stone for UNIX. Nice. My favorites are Linux and IRIX.



mp3




Build an MP3 decoder in Haskell. Warped but cool.



iphone pocket guitar








xo




the XO abides - XO continues, despite major problems with the OLPC. Open source always wins in the end.



tetris tiles








lhc



Friday, October 03, 2008

Wednesday, October 01, 2008

scroll




Wow, sexy scrollbars in HTML.



Tuesday, September 30, 2008

pretty pretty iphone



kali








python 1



yegge




The Bellic School of Management Training. As in Nico Bellic from GTA IV.



conk



complement




2s complement. For my CSC 111 lab that I'm TAing.



bad code smells



maintainable CSS



higher




Higher-order shell - How UNIX commands in scripts are like higher-order commands in functional languages like Haskell.

By the way, I was volunteering at ICFP 2008 (International Conference in Functional Programming) last week, and got to meet many of the luminaries in functional programming. Some smart people there, let me tell you.



acm




I'm going to be presenting a talk at a workshop coming up:

The Many Faces of Multimedia Semantics
MS08
It used to be called Robust Multimedia Learning in Broad Domains.



Monday, September 29, 2008

navaratri 2008




Navaratri One: Kali

Begins tonight. Om Kali Namaha!



haxe2




I've just switched over to haxe 2.0. It seemed to be quite an easy switch, not much seemed to break, and now I have default arguments in the variable list, which makes porting AS3.0 code so much easier.



Friday, September 26, 2008

android




Android
Android documentation
Getting started with Android
Android FAQs
Installing the Android SDK - The API is Java
Developing and Debugging Android - You use Eclipse as the SDK
Hello world app with Android


package com.android.hello;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}



Android uses ALSA for audio
Android media API

Recording audio with Android:

Start recording:

recorder = new MediaRecorder();
ContentValues values = new ContentValues(3);

values.put(MediaStore.MediaColumns.TITLE, SOME_NAME_HERE);
values.put(MediaStore.MediaColumns.TIMESTAMP, System.currentTimeMillis());
values.put(MediaStore.MediaColumns.MIME_TYPE, recorder.getMimeContentType());

ContentResolver contentResolver = new ContentResolver();

Uri base = MediaStore.Audio.INTERNAL_CONTENT_URI;
Uri newUri = contentResolver.insert(base, values);

if (newUri == null) {
// need to handle exception here - we were not able to create a new
// content entry
}

String path = contentResolver.getDataFilePath(newUri);

// could use setPreviewDisplay() to display a preview to suitable View here

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);

recorder.prepare();
recorder.start();


Stop recording

recorder.stop();
recorder.release();


Location-based Service APIs


locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = locationManager.getCurrentLocation("gps");


How to Program Google Android