Haswell
Computer Science Blows My Mind
“Computer science is an interesting discipline. Often, I find myself inadequately trying to communicate why I find it so fascinating. I think I get the closest when describing computer science things that ‘blow my mind’.
This post is… basically just a list of computer science things I think are cool.”
At PyCon Solomon Hykes shows docker to the public for the first time
Ubuntu for Phones
“Web apps are first class citizens on Ubuntu, with APIs that provide deep integration into the interface. HTML5 apps written for other platforms can be adapted to Ubuntu with ease, and we’re targeting standard cross-platform web app development frameworks like PhoneGap to make Ubuntu ‘just work’ for apps that use them.
Our unique web app system lets you quickly adapt any web property for installation as an app on the phone, running independently of the browser, with its own icon and access to system services. This means that all the big names will be available to Ubuntu phone users at launch.
But Ubuntu isn’t limited to HTML5. For rich applications with gorgeous movement and transitions, and graphics-heavy games, Ubuntu provides an amazing native developer environment. It uses QML to give you a really slick, easy development experience for native apps with engines in C or C++, and JavaScript for UI glue that isn’t performance critical. We also give you full native OpenGL, which the top games companies are using to make incredible games. That’s why developers like EA, Valve Software and Unity Technologies are committing to Ubuntu right now.”
Code Comprehension with Eye Tracking
Some Holiday Javascript
Since it’s almost White Anglo Saxon Winter Privilege Night, I thought I would make some falling snow with dynamic “wind” using HTML5, javascript, and a little bit of math, just for fun.
First step, building a canvas
<canvas id="canvas"></canvas>
Then, using CSS, I create my margins and choose a background color. Since I like winter nights, I chose black as the background. This can be easily changed.
* {margin:0; padding: 0;}
body{ background: #000; }
canvas { display: block; }
Now using javascript, I initialize the canvas, create some dimensions, and make some snow.
window.onload = function(){
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
var W = window.innerWidth;
var H = window.innerHeight;
canvas.width = W;
canvas.height = H;
var maxSnow = 25;
var snow = [];
for(car i = 0; i < mp; i++{
particles.push({
x: Math.random()*W,
y: Math.randon()*H,
r: Math.random()*4+1,
d: Math.random()*maxSnow
})
}
Now to draw the snowflakes
function draw(){
context.clearRect(0, 0, W, H);
context.fillStyle = "rgba(255,255,255,0.8)";
context.beginPath();
for(var i = 0; i < maxSnow; i++){
var s = snow[i];
context.moveTo(s.x, s.y);
context.arc(s.x, s.y, s.r, 0, Math.PI*2, true);
}
context.fill();
}
The best part about this script is that the snow flakes not fall in a straight line. Instead, to create the effect of wind pushing the snow back and forth, I will be using sine and cosine waves to create paths for the snow as it falls to the bottom of the page. This gives it a little more polish and more dynamic feel. Also, when the snow reaches the bottom of the page, send it back to the top.
var angle = 0;
function update(){
angle += 0.1;
for(var i=0; i < maxSnow; i++){
var s = snow[i];
p.x += Math.sin(angle) * 2;
p.y += Math.cos(angle+s.d) + 1 + s.r/2;
if(s.x > W || s.x < 0 || s.y > H){
snow[i] = {x: Math.random()*W, y: -10, r: s.r, d: s.d}
}
}
}
And the final step, animate the whole thing on a loop.
setInterval(draw, 33);
You can view an example page here. Credit to @ruby_on_tails for the help.
Merry Christmas.
New Blog
This is now going to be my personal blog. I’ll try to update it semi-frequently.
My less then serious photo/video/music blog can still be found here



