Atiaia early releases

This was a project that me and Marco Diego created during our graduation for the Computer Graphics course. It is a ray tracing engine build from scratch in C. It was great exercise of experimentation on how implement object-oriented design patterns in ANSI C. Later Marco continued it in his master’s degree thesis implementing more features.

Parts of the sources were lost during a disk failure in the forge we hosted the project. I found some early releases and packed them here for future use. It can be useful for someone studying C or how to implement a ray tracer.

Download: atiaia_sources_by_2006.zip

Enjoy it.

ps: with this project we won the 1st place project of class and maximum grade. ;)

LG Optimus V 3G connection problem

When I came back from my last travel my 3G connection stopped working and seems that a lot of people already had the same problem. It was after I reactivated my plan when I came back to the US. Apparently they forgot to activate my data plan I’m paying for.

How to solve

I tried different things but finally I tried to simply activate the phone again using the Activate application (probably the first application on the list). After a few tries It worked and I got my 3G connection back.

Improve your battery life

One interesting thing is that during my days without 3G my battery life was quite better. So when you want to save battery, in travels for example, you can manually activate/deactivate your data plan on the Setting -> Wireless & networks settings -> Mobile Networks -> Data Enabled option.

AVCHD (.MTS) video files

I’m dealing with video format of my new camera (Panasonic Lumix DMC-TS3). It’s the AVCHD format (.MTS file extension). You can convert it to other formats using HandBrake on Ubuntu.

HTML5: CSS Sprites

See the demo.

 
<!doctype html> 
<html> 
<head> 
	<style type="text/css"> 
		.sprite {
			background:url(sheet.png);
			width:32px;
			height:48px;
		}
 
		.up { background-position-y: -7px;}
		.down { background-position-y: -102px;}
		.right { background-position-y: -55px;}
		.left { background-position-y: -151px;}
 
		.frame0 { background-position-x: -0px;}
		.frame1 { background-position-x: -36px;}
		.frame2 { background-position-x: -73px;}
		.frame3 { background-position-x: -107px;}
	</style> 
 
	<script type="text/javascript"> 
var counter=0;
setInterval(main_loop, 250);
function main_loop(){
  counter = (counter+1) % 3; // 0,1,2,3,0,1,2 ...
  document.getElementById("up").setAttribute("class", "sprite up frame"+counter);
  document.getElementById("down").setAttribute("class", "sprite down frame"+counter);
  document.getElementById("right").setAttribute("class", "sprite right frame"+counter);
  document.getElementById("left").setAttribute("class", "sprite left frame"+counter);
}
</script> 
 
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
	<title>CSS Sprites + JavaScript </title> 
</head> 
 
<body> 
	<img id="up" src="transparent.gif" /> 
	<img id="down" src="transparent.gif" /> 
	<img id="right"	src="transparent.gif" /> 
	<img id="left" src="transparent.gif" /> 
	<p>— We are not gifs!</p> 
</body> 
</html>

Credits and notes:

simple HTML5 animation: clouds over background

If you are reading this text, sorry, your browser don’t support HTML5 Canvas (or maybe I did something wrong).

Code:

var canvas;
var ctx;
 
var background;
var width = 300;
var height = 200;
 
var cloud;
var cloud_x;
 
function init() {
	canvas = document.getElementById("cloud_demo_canvas");
	width = canvas.width;
	height = canvas.height;
	ctx = canvas.getContext("2d");
 
	// init background 
	background = new Image();
	background.src = 'http://silveiraneto.net/wp-content/uploads/2011/06/forest.png';
 
	// init cloud
	cloud = new Image();
	cloud.src = 'http://silveiraneto.net/wp-content/uploads/2011/06/cloud.png';
	cloud.onload = function(){
		cloud_x = -cloud.width;
	};
 
	return setInterval(main_loop, 10);
}
 
function update(){
	cloud_x += 0.3;
	if (cloud_x > width ) {
		cloud_x = -cloud.width;
	}
}
 
function draw() {
	ctx.drawImage(background,0,0);
	ctx.drawImage(cloud, cloud_x, 0);
}
 
function main_loop() {
	draw();
	update();
}
 
init();

HTML code:

<canvas id="cloud_demo_canvas" width="640" height="480">Alternative text if browser don't support canvas.</canvas>

Credits and notes:

my new bike

I saw it once back in Brazil and I got fascinated with the concept of a folding bike. Marcelo Siqueira introduced me a bike you could fold and carry.

Here in the US I was waiting the snow and cold go away to go back biking. I’d like a bike that I would not keep on the garage and I could bring to work and commute sometimes. I got a Citizen Gotham2 20″, 7-Speed with alloy frame.

Unfolding steps:

The Citizen 20″ bike bag:

After using the bag to store the bike it also folds and can be kept in the steam or rack:

I’ve been using it for some months and it is really good. Now I want to put some more accessories to make it safer like a night flashlight.

Rules for Metro (DC)

The general rule for bikes in the DC’s metro is on  WMATA‘s ”Cyclists on Metrorail” document:

Bicycles are permitted on Metrorail (limited to two bicycles per car) weekdays except 7-10 a.m. and 4-7 p.m. Bicycles are permitted all day Saturday and Sunday as well as most holidays (limited to four bicycles per car). Bicycles are not permitted on Metrorail on July 4th or other special events or holidays when large crowds use the system.

There is an exception for folding bikes from WMATA‘s “Bike ‘N Ride Policy“:

Folding bicycles and non-collapsible bicycles of all types that are folded or disassembled and enclosed in carrying bags, cases or boxes are deemed “luggage” items and are permitted inside railcars at all times. The carrying bags or cases must be made of a sturdy material such as canvas, nylon or leather-type materials.