Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/bundle.js
	lib/entry.js
	package.json
  • Loading branch information
bpostlethwaite committed Aug 8, 2012
2 parents b7e05b5 + 373cd61 commit 05b69d6
Show file tree
Hide file tree
Showing 11 changed files with 281 additions and 85 deletions.
12 changes: 4 additions & 8 deletions README.md
@@ -1,15 +1,11 @@
# Droplets # Droplets
A Javascript physics engine and real-time server-client setup project with node.js which evolved into my personal website. A Javascript physics engine and real-time server-client setup project with node.js which evolved into my personal website.


The backend computations handling the wave-field physics are written in javascript and solve the wave equation PDE using the finite-difference Euler Method. The transparent overlay animations are all CSS3. Websockets connect the server to clients and employs a broadcast facility to register droplets clicked by a single user to all clients simultaneously. The server also parses markdown files which hold the site content into html and streams this data to the client upon connection. The backend computations handling the wave-field physics are written in javascript and solve the wave equation PDE using the finite-difference Euler Method. The module that solves the physics is called [pde-engine](https://github.com/bpostlethwaite/pde-engine) and I have published this to [npm](https://npmjs.org/). The transparent overlay animations are all CSS3. Websockets connect the server to clients and employs a broadcast facility to register droplets clicked by a single user to all clients simultaneously. The server also parses markdown files which hold the site content into html and streams this data to the client upon connection.


_The website runs best on Chrome._ _The website runs best on Chrome._


### Todo ### Todo
1. Turn javascript function wavefield into a node.js module and publish to NPM 1. Test CSS3 animations with IE
2. Test CSS3 animations with IE 2. xlen and ylen resolution sizes should be dependent on overall screen size. Smaller screen sizes can computationally afford better resolutions.
3. xlen and ylen resolution sizes should be dependent on overall screen size. Smaller screen sizes can computationally afford better resolutions. 3. Finish coding and implementing the Poisson Equation (gravity and electrostatics)

### Issues
1. Strange Firefox bug: content does not fade in with delay on second access. I suspect the `opacity` property is not being reset to `0` when unselected.

40 changes: 25 additions & 15 deletions docs/CV.md
Expand Up @@ -3,31 +3,41 @@
* <http://www.benpostlethwaite.ca> * <http://www.benpostlethwaite.ca>
* 778-869-9361 * 778-869-9361


## Education ### Education


*Geophysics, M.S.* #### Geophysics, M.Sc.
Fall 2006 - present
University of British Columbia, Vancouver Canada.


*First Aid Level I* Fall 2010 - present
University of British Columbia, Vancouver Canada.


*WHIMIS certifications* #### Geophysics, B.Sc.


## Proficiency Fall 2006 - Fall 2010
I have experience managing hard-rock and soft-rock geophysical datasets, handling information flow and visualization. I have performed inversions and written inversion code for gravity, DC and seismic data. I have strong mathematical ability especially linear algebra and numerical optimation. I can write code in Matlab, C, C++, Python and Javascript and have the base skills necessary to quickly pick up additional languages. I have written programs in all of these languages including desktop applications, server-side web programs and simulation and numerical solvers. I am a proficient Linux administrator and have run several servers including virtualized machines. I have spent a great amount of time outdoors and enjoy mountaineering and outdoor life. I consider this an asset for positions which involve extended periods working from camps. University of British Columbia, Vancouver Canada.


## Experience ### Proficiency
### Aurora Geosciences
#### Crew Chief - April 2011 to September 2011 * Managing large geophysical datasets, handling information flow and performing data mining and visualization.
I was a crew chief with [Aurora Geoscience](http://www.aurorageosciences.com) running magnetic, VLF and ELF surveys as well as working with an HLEM crew. * Inversions with third party code as well as my own inversion code for gravity, DC and seismic data.
* Strong mathematical ability especially in the linear algebra and numerical optimation domains.
* Proficiently coding in Matlab, C, Python and Javascript and have the base skills necessary to quickly pick up additional languages.
* Written programs spanning desktop applications, server-side web programs and simulation and numerical solvers.
* Proficient Linux administrator and have managed several servers and virtualized machines.
* Outdoor enthusiast specifically mountaineering and kayaking. I consider this an asset for positions which involve extended periods working from camps.

### Experience

#### Aurora Geosciences - April 2011 to September 2012 - Summer work

Junior Geophysicist and Crew Chief with [Aurora Geoscience](http://www.aurorageosciences.com) running magnetic, VLF and ELF surveys as well as working with an HLEM crew.


* Managed crew and equipment to complete survey goals safely and on time. * Managed crew and equipment to complete survey goals safely and on time.
* Tested prototype ELF geophysical equipment and established a method for visualizing and working with output data. * Tested prototype ELF geophysical equipment and established a method for visualizing and working with output data.
* Identified areas that would be amenible to automation and wrote Perl and Python programs/scripts to speed up and reduce error in geophysical processing and survey design. * Identified areas that would be amenible to automation and wrote Perl and Python programs/scripts to speed up and reduce error in geophysical processing and survey design.


### Active Turf Irrigation #### Active Turf Irrigation - March 2008 to September 2010
#### Installation and Maintenance Serviceman - March 2008 to September 2010
I was an installer and serviceman with [Active Turf Irrigation](http://activeturfirrigation.com) working on larger industrial projects or handling maintainance contracts with a service van. I was an installation and maintenance serviceman with [Active Turf Irrigation](http://activeturfirrigation.com) working on larger industrial projects or handling maintainance contracts with a service van.


* Worked with larger crews in fast paced environment. * Worked with larger crews in fast paced environment.
* Worked with, and managed expectations of, customers in planning and job roll out. * Worked with, and managed expectations of, customers in planning and job roll out.
12 changes: 4 additions & 8 deletions docs/README.md
@@ -1,15 +1,11 @@
# Droplets # Droplets
A Javascript physics engine and real-time server-client setup project with node.js which evolved into my personal website. A Javascript physics engine and real-time server-client setup project with node.js which evolved into my personal website.


The backend computations handling the wave-field physics are written in javascript and solve the wave equation PDE using the finite-difference Euler Method. The transparent overlay animations are all CSS3. Websockets connect the server to clients and employs a broadcast facility to register droplets clicked by a single user to all clients simultaneously. The server also parses markdown files which hold the site content into html and streams this data to the client upon connection. The backend computations handling the wave-field physics are written in javascript and solve the wave equation PDE using the finite-difference Euler Method. The module that solves the physics is called [pde-engine](https://github.com/bpostlethwaite/pde-engine) and I have published this to [npm](https://npmjs.org/). The transparent overlay animations are all CSS3. Websockets connect the server to clients and employs a broadcast facility to register droplets clicked by a single user to all clients simultaneously. The server also parses markdown files which hold the site content into html and streams this data to the client upon connection.


_The website runs best on Chrome._ _The website runs best on Chrome._


### Todo ### Todo
1. Turn javascript function wavefield into a node.js module and publish to NPM 1. Test CSS3 animations with IE
2. Test CSS3 animations with IE 2. xlen and ylen resolution sizes should be dependent on overall screen size. Smaller screen sizes can computationally afford better resolutions.
3. xlen and ylen resolution sizes should be dependent on overall screen size. Smaller screen sizes can computationally afford better resolutions. 3. Finish coding and implementing the Poisson Equation (gravity and electrostatics)

### Issues
1. Strange Firefox bug: content does not fade in with delay on second access. I suspect the `opacity` property is not being reset to `0` when unselected.

95 changes: 72 additions & 23 deletions lib/entry.js
Expand Up @@ -12,7 +12,7 @@ $(document).ready(function() {
//var socket = io.connect("http://droplets.benjp.c9.io") //var socket = io.connect("http://droplets.benjp.c9.io")
var socket = io.connect("wss://droplets.jit.su") var socket = io.connect("wss://droplets.jit.su")
//var socket = io.connect("http://192.168.1.113:8081") //var socket = io.connect("http://192.168.1.113:8081")
, field , field = engine()
, canvas = document.getElementById('canvas') , canvas = document.getElementById('canvas')
, c = canvas.getContext('2d') , c = canvas.getContext('2d')
, xlen = 12 , xlen = 12
Expand All @@ -21,6 +21,7 @@ $(document).ready(function() {
, cols , cols
, xpix , xpix
, ypix , ypix
, intID = []


// This turns on and off button selected class for animations // This turns on and off button selected class for animations
$(".category").click(function() { $(".category").click(function() {
Expand All @@ -35,43 +36,89 @@ $(document).ready(function() {
} }
}) // end click }) // end click


// This turns on and off button selected class for mode info text
$(".mode").click(function() {
var mode = null
//turn of all previously selected
$('.selectedII').not(this).removeClass('selectedII')
// Toggle this buttons class.
$(this).toggleClass('selectedII')
// If it wasn't previously selected then continue and engage.
if ( $(this).hasClass('selectedII') ) {
// get mode ID
mode = $(this).attr('id')
//find matching classes associated w/ ID
$("." + mode).addClass('selectedII')
}
// Start up appropriate physics mode
switch(mode) {
case "mode1":
waveEqnMode();
break;
case "mode2":
diffusionEqnMode();
break;
case "mode3":
noMode();
break;
default:
noMode();
} // end switch
}) // end mode click



// CONTENT SOCKETS ///////////////////////////////////////////////// // CONTENT SOCKETS /////////////////////////////////////////////////
socket.on('readme', function(data) { socket.on('readme', function(data) {
$('.content.tog3').html(data) $('.content.tog3').html(data)
}) })
socket.on('cv', function(data) {
$('.content.tog4').html(data)
})


// MODE FUNCTIONS /////////////////////////////////////////////////// // MODE FUNCTIONS ///////////////////////////////////////////////////


// Function called on window resize which resets both canvas dims // Function called on window resize which resets both canvas dims
// as well as calling physics engine resize method. // as well as calling physics engine resize method.
// Also acts as a general clearing house. // Also acts as a general clearing house.
function reset() { function resetScreen() {
$(window).resize(function(e) { $(window).resize(function(e) {
rows = Math.floor(window.innerHeight / xlen) rows = Math.floor(window.innerHeight / xlen)
cols = Math.floor(window.innerWidth / ylen) cols = Math.floor(window.innerWidth / ylen)
field.setResolution(rows, cols) field.setResolution(rows, cols)
canvas.width = window.innerWidth canvas.width = window.innerWidth
canvas.height = window.innerHeight canvas.height = window.innerHeight
field.s = buildSprites(10) //field.s = buildSprites(10)
}) })
$(window).trigger('resize') $(window).trigger('resize')
} }


// Function to clear previous bindings and interval
// timers from previously selected modes
function clearMode() {
var i
$(canvas).unbind("mousemove")
$(canvas).unbind("click")
for (i = 0; i < intID.length; i++) {
clearInterval(intID[i])
}
}

function waveEqnMode() { function waveEqnMode() {
clearMode()
field = engine( { field = engine( {
dt: 0.1 dt: 0.1
, gamma: 0.02 , gamma: 0.02
, eqn: "wave" , eqn: "wave"
}) })
reset() // Call reset which inits field to window size resetScreen() // Call reset which inits field to window size
var colorgrada = buildColorGrad("#000092", 41, -1).reverse() var colorgrada = buildColorGrad("#000092", 41, -1).reverse()
, colorgradb = buildColorGrad("#000092", 41, 1) , colorgradb = buildColorGrad("#000092", 41, 1)
colorgradb.shift() colorgradb.shift()

field.mag = 15 field.mag = 15

// Bind Click ////////////////////////////////////////// // Bind Click //////////////////////////////////////////
$(canvas).unbind() // get rid of previous bindings $(canvas).bind("click", function(evt) {
canvas.addEventListener("click",function(evt) {
var xp = evt.pageX var xp = evt.pageX
, yp = evt.pageY , yp = evt.pageY
socket.emit('clientDroplet',{ socket.emit('clientDroplet',{
Expand All @@ -86,30 +133,27 @@ $(document).ready(function() {
field.adj = 40 field.adj = 40
field.cg = colorgrada.concat(colorgradb) field.cg = colorgrada.concat(colorgradb)
// Start Animation // Start Animation
setInterval(renderField, 30) intID[0] = setInterval(renderField, 30)


} // END WAVEEQNMODE } // END WAVEEQNMODE




function diffusionEqnMode() { function diffusionEqnMode() {
clearMode()
field = engine( { field = engine( {
dt: 0.1 dt: 0.1
, gamma: 0.02
, eqn: "diffusion" , eqn: "diffusion"
, alpha: 1 , alpha: 0.5
}) })
reset() // Call reset which inits field to window size resetScreen() // Call reset which inits field to window size
field.mag = 30 field.mag = 30
xpix = 0.5*Math.round(window.innerWidth)
ypix= 0.5*Math.round(window.innerHeight)
// Click Binding ////////////////////////////////////////// // Click Binding //////////////////////////////////////////
$(canvas).unbind() $(canvas).bind("mousemove", function(evt) {
$(canvas).mousemove(function(e){ xpix = evt.pageX
xpix = e.pageY ypix = evt.pageY
ypix = e.pageX
}) })


setInterval(tracedrops, 50) intID[0] = setInterval(tracedrops, 50)


function tracedrops() { function tracedrops() {
field.addSource( (ypix / ylen) | 0 , (xpix / xlen) | 0 , field.mag) field.addSource( (ypix / ylen) | 0 , (xpix / xlen) | 0 , field.mag)
Expand All @@ -126,9 +170,8 @@ $(document).ready(function() {
field.adj = 0 field.adj = 0
field.cg = buildColorGrad(null) field.cg = buildColorGrad(null)



// Start Animation // Start Animation
setInterval(renderField, 50) intID[1] = setInterval(renderField, 50)


} // END DIFFUSIONEQMODE } // END DIFFUSIONEQMODE


Expand Down Expand Up @@ -165,6 +208,15 @@ $(document).ready(function() {


} // END PoissonEqnMode } // END PoissonEqnMode



// Default mode when engine not engaged.
function noMode() {
clearMode()
resetScreen()
}



// If any event newDroplet, it acts no matter the mode! // If any event newDroplet, it acts no matter the mode!
socket.on('newDroplet', function(d) { socket.on('newDroplet', function(d) {
var yp = Math.round( d.y * window.innerHeight ) //recover from percentage var yp = Math.round( d.y * window.innerHeight ) //recover from percentage
Expand Down Expand Up @@ -256,9 +308,6 @@ $(document).ready(function() {
return s return s
} }


// SET MODE /////////////////////////////////////////////////////
//poissonEqnMode()
waveEqnMode()
}) // end JQuery }) // end JQuery




Expand Down
30 changes: 30 additions & 0 deletions npm-debug.log
@@ -0,0 +1,30 @@
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'init' ]
2 info using npm@1.1.46
3 info using node@v0.8.5
4 verbose config file /home/ben/.npmrc
5 verbose config file /usr/etc/npmrc
6 verbose config file /usr/lib/node_modules/npm/npmrc
7 verbose read json /home/ben/programming/node/droplets/package.json
8 silly package data undefined
9 info init written successfully
10 error Error: canceled
10 error at Interface.<anonymous> (/usr/lib/node_modules/npm/node_modules/read/lib/read.js:53:13)
10 error at Interface.EventEmitter.emit (events.js:115:20)
10 error at Interface._ttyWrite (readline.js:606:16)
10 error at ReadStream.onkeypress (readline.js:98:10)
10 error at ReadStream.EventEmitter.emit (events.js:115:20)
10 error at emitKey (readline.js:1057:12)
10 error at ReadStream.onData (readline.js:806:7)
10 error at ReadStream.EventEmitter.emit (events.js:88:17)
10 error at TTY.onread (net.js:403:14)
11 error If you need help, you may report this log at:
11 error <http://github.com/isaacs/npm/issues>
11 error or email it to:
11 error <npm-@googlegroups.com>
12 error System Linux 3.4.7-1-ARCH
13 error command "/usr/bin/node" "/usr/bin/npm" "init"
14 error cwd /home/ben/programming/node/droplets
15 error node -v v0.8.5
16 error npm -v 1.1.46
17 verbose exit [ 1, true ]
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"author": "Ben Postlethwaite <post.ben.here@gmail.com>", "author": "Ben Postlethwaite <post.ben.here@gmail.com>",
"name": "droplets", "name": "droplets",
"description": "Personal website with nodejs wavefield generator and interactive html display", "description": "Personal website with nodejs wavefield generator and interactive html display",
"version": "0.2.3", "version": "0.3.2",
"homepage": "https://github.com/bpostlethwaite/droplets", "homepage": "https://github.com/bpostlethwaite/droplets",
"repository": { "repository": {
"type": "git", "type": "git",
Expand All @@ -20,7 +20,6 @@
"optionalDependencies": {}, "optionalDependencies": {},
"engines": { "engines": {
"node": ">=0.6" "node": ">=0.6"
"node": ">0.6"
}, },
"subdomain": "droplets", "subdomain": "droplets",
"domains": [ "domains": [
Expand Down

0 comments on commit 05b69d6

Please sign in to comment.