Featured Post

Ruby on Rails: A plataforma de desenvolvimento da web 2.0

ShareEis a web 2.0. Para acompanhar essa tendência, Ruby on Rails. Ruby on Rails é o framework para desenvolvimento de aplicações web para a linguagem Ruby. Traz consigo, diversas classes de apoio (Helpers), para trabalhar com ajax, javascript, widgets (controles), efeitos visuais etc. O slogan...

Read More

Obtendo as Properties pela ordem de declaração no C#

Posted by Luiz Picanço | Posted in .Net | Posted on 18-08-2009

Tags: , , ,

1,788

Em alguns momentos, pode ser necessário obter a lista de properties de um objeto. Um jeito simples de fazer isso é:

1
2
3
4
private IEnumerable<PropertyInfo> GetProperties(Type type)
{
    return type.GetProperties();
}

O problema é que, segundo a Microsoft, a ordem em que as properties são retornadas não é garantido:

The GetProperties method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies.

Uma solução para resolver esse problema é ordenar a lista de properties pela property MetadataToken.

O código então, ficaria assim:

1
2
3
4
private IEnumerable<PropertyInfo> GetProperties(Type type)
{
    return type.GetProperties().OrderBy(p => p.MetadataToken);
}

Se a intenção for obter as properties na ordem inversa, o código ficaria assim:

1
2
3
4
private IEnumerable<PropertyInfo> GetPropertiesDescending(Type type)
{
    return type.GetProperties().OrderByDescending(p => p.MetadataToken);
}

O ideal é que o seu código não dependa da ordem dos membros para executar, mas em alguns casos, como geração automática de código, isso pode ser útil.

Jamais compre um notebook HP !!!

Posted by Luiz Picanço | Posted in Tecnologia | Posted on 02-07-2009

Tags: , , ,

3,925

Eu fui proprietário de um notebook HP, modelo tx1070br, que parou de funcionar de forma repentina. Pesquisando nos fóruns, qual não foi a minha surpresa ao constatar que CENTENAS de pessoas tiveram o mesmo problema ?

Em quase todos os casos, para não generalizar, a HP ignorou o caso e como a maioria dos problemas “estranhamente” ocorreram logo após o término de garantia, cobrou pelo serviço. Algumas pessoas pagaram e logo após receberem o notebook de volta(após 2 meses), o notebook apresentou o mesmo problema.

Pesquisando mais sobre o assunto, descobrir que diversos modelos de notebook da HP estão “morrendo” logo após o término da garantia (aproximadamente 1 mês depois).

Eu sempre respeitei os produtos da HP, mas isso não pode passar assim em branco. Uma empresa do porte da HP tem o dever de respeitar os consumidores.

Link para um outro blog que relata o mesmo problema:
NEVER buy an HP laptop | Cheap Laptop Blog

Guia rápido do Grails

Posted by Luiz Picanço | Posted in Grails, Groovy, Java | Posted on 26-04-2009

Tags: , ,

6,069

É bom ver a comunidade Grails crescendo no Brasil.

O Henrique Weissmann produziu esse ótimo guia sobre o Grails.

O guia está divido da seguinte forma:

1 – Introdução
2 – Como instalar o Grails
3 – Groovy – O básico para quem for aprender Grails
4 – Grails

Acesse aqui: Grails: um guia rápido e indireto « /dev/Kico

Batalha de RAP de geeks

Posted by Luiz Picanço | Posted in Ruby on Rails | Posted on 17-04-2009

1,879

Veja 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: You talk like your big on these I-Net kicks,
http402: But your shit flows slower than a two-eighty-six.
http402: I’m tracking down hosts and nmap scans,
http402: While Code Igniter’s got you wringing your hands.
http402: Cut the crap rap,
http402: Or I’ll run ettercap,
http402: Grab your AIM chat,
http402: N’ send a PC bitch-slap!
http402: peace
djahandarie: you’re talkin bout down hosts and nmap scans
djahandarie: while i got other plans
djahandarie: you’re at your new job, but you can’t even do it right
djahandarie: you just create a plight with your http rewrites
djahandarie: i’ve been on the web since the age of three
djahandarie: you just got on directly off the bus from mississippi
djahandarie: respect yo’ elders, bitch
http402: You’ve been webbin’ since three, but still ain’t grown up,
http402: Gotta update your config and send the brain a SIGHUP.
http402: You say you’re that old? No wonder you’re slow!
http402: You’re knocking at the door while I run this show!
http402: Elders my ass, you’re shit’s still in school,
http402: Hunt and pecking at the keyboard like a spaghetti-damned fool,
http402: Rim-riffing your hard drive like a tool,
http402: Face it. I rule.
djahandarie: i erase my harddrives with magnets (bitch)
djahandarie: all you can do is troll on the fagnets
djahandarie: and son, my brain’s wrapped in a nohup
djahandarie: it wont be hurt by the words you throwup
djahandarie: dont mind me while i emerge my ownage
djahandarie: while you’re still over there apt-getting your porridge
djahandarie: you say i’m still in school
djahandarie: but the fact is that i know the rule
djahandarie: cuz you need to go back to grade three
djahandarie: and you better plea, that they take sucky graduates from c-s-e
http402: Time to bend over and apply a patch,
http402: Your brain’s throwing static like a CD with a scratch.
http402: Your connection got nuked and you’ve met your match.
http402: You run a single process like a VAX with a batch.
http402: I’d pass the torch to a real winner
http402: But it’d just scorch a while-loop spinner
http402: Caught in a loop that you cant escape,
http402: I run clock cycles around your words and flows,
http402: Cuz your rhyme is like a PS fan: it’ blows,
http402: Your water-cooled lyrics leak and it shows,
http402: Take your ass back to alt.paid.for.windows.
djahandarie: Good god, I can’t even respond to that. :P
djahandarie: You win haha

Fonte: http://www.bash.org/?870063

Client para twitter em .Net

Posted by Luiz Picanço | Posted in .Net, Projetos | Posted on 25-03-2009

Tags: , , ,

2,506

Criei um client para twitter utilizando a plataforma .Net.

Funcionalidades:

  • Lista as mensagens dos seus amigos
  • Lista os seus replies
  • Lista as suas mensagens
  • Adiciona novas mensagens

A aplicação está funcional mas precisa de aprimoramentos no layout. Com o tempo vou atualizando.

Screenshot da tela principal:

Twitter.Net Screenshot

Twitter.Net Screenshot

Faça o download:
Twitter.Net

O código pode ser acessado aqui:
twitterclient – Google Code