Featured Post

Batalha de RAP de geeks

ShareVeja como os geeks fazem uma batalha de RAP: djahandarie: we ain’t here to do e-c-e djahandarie: we’re here to do c-s-e on the w-e-b djahandarie: listen to me spit these rhymes djahandarie: while i program lines djahandarie: and commit web accessibility crimes djahandarie: word, son http402:...

Read More

Talk is cheap. Show me the code!

Posted by Luiz Picanço | Posted in Linguagem | Posted on 05-01-2011

Tags:

2,578

Essa é a camisa!
Task is cheap. Show me the code


Removendo a acentuação e os caracteres especiais de uma String

Posted by Luiz Picanço | Posted in .Net, C# | Posted on 28-05-2010

Tags: , ,

2,087

Estava precisando remover a acentuação e os caracteres especiais do nome de um arquivo. Para isso, desenvolvi um extension method para a classe String.

Exemplo:
String de entrada:
Adobe Acrobat – Pacy-Paraná_05.12_áèïôúã+.pdf

String de retorno:
AdobeAcrobatPacyParana_05.12_aeioua.pdf

Desenvolvi o método utilizando uma HashTable e expressão regular. Caso você tenha alguma sugestão de melhoria, poste aí nos comentários.

Extension method:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public static String RemoveSpecialCharacters(this String self)
{
	var normalizedString = self;
 
	// Prepara a tabela de símbolos.
	var symbolTable = new Dictionary<char, char[]>();
	symbolTable.Add('a', new char[] {'à', 'á', 'ä', 'â', 'ã'});
	symbolTable.Add('c', new char[] { 'ç' });
	symbolTable.Add('e', new char[] { 'è', 'é', 'ë', 'ê' });
	symbolTable.Add('i', new char[] { 'ì', 'í', 'ï', 'î' });
	symbolTable.Add('o', new char[] { 'ò', 'ó', 'ö', 'ô', 'õ' });
	symbolTable.Add('u', new char[] { 'ù', 'ú', 'ü', 'û' });
 
	// Substitui os símbolos.
	foreach (var key in symbolTable.Keys)
	{
		foreach (var symbol in symbolTable[key])
		{
			normalizedString = normalizedString.Replace(symbol, key);
		}
	}
 
	// Remove os outros caracteres especiais.
	normalizedString = Regex.Replace(normalizedString, "[^0-9a-zA-Z._]+?", "");
	return normalizedString;
}

Criando um relógio analógico com Processing JS

Posted by Luiz Picanço | Posted in Processing | Posted on 26-05-2010

Tags: , ,

3,746

Excelente tutorial do Thej, do blog Thejesh GN, sobre processingjs.

Nesse tutorial, ele ensina como criar um relógio analógico usando processing.

Getting started with Processingjs by writing Analog clock

Processing Labs: Game Of Life

Posted by Luiz Picanço | Posted in Javascript, Processing | Posted on 25-05-2010

Tags: , ,

2,771

Comecei a estudar processing. Processing é uma linguagem de programação para trabalhar com visualização de dados. Processing.js é um porte da linguagem para Javascript.

Como primeiro experimento, o famoso Game of Life.

Webcam Life Log

Posted by Luiz Picanço | Posted in ActionScript, AIR, LifeHack | Posted on 23-05-2010

Tags: , , , ,

2,148

O Webcam Life Log é um utilitário que tira fotos com a webcam, em um intervalo de tempo definido. Desenvolvi ele utilizando o Adobe AIR.

Para instalar, basta clicar na imagem abaixo.

Please upgrade your Flash Player
This is the content that would be shown if the user does not have Flash Player 6.0.65 or higher installed.

Screenshot:

O código-fonte está disponível no google code:
http://code.google.com/p/webcamlifelog