Programando na madrugada

Tecnologia

Erro ao utilizar o mysql no ruby: LIBMYSQL.dll is missing

by Luiz Picanço on Feb.21, 2010, under Ruby, Ruby on Rails

Um erro muito comum que costuma acontecer no ruby/rails, em ambiente windows é: “LIBMYSQL.dll is missing from your computer”

LIMYSQL.dll is missing

E a mensagem também pode aparecer no console da seguinte forma:

ruby.exe - Unable to locate Component
This application has failed to start because LIBMYSQL.DLL was not
found. Re-installing the application might
fix this problem.

Esse erro ocorre porque a dll do mysql, LIBMYSQL.dll, não foi localizada. Para resolver esse problema, faça o seguinte:

1 – Instale a gem do mysql

1
gem install mysql

2 – Copie o arquivo LIBMYSQL.dll do diretório bin do mysql(ex.: c:\mysql\bin) para o diretório bin do ruby (ex.: c:\ruby\bin)

3 Comments :, , , more...

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

by Luiz Picanço on Aug.18, 2009, under .Net

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.

2 Comments :, , , more...

Jamais compre um notebook HP !!!

by Luiz Picanço on Jul.02, 2009, under Tecnologia

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

1 Comment :, , , more...

Guia rápido do Grails

by Luiz Picanço on Apr.26, 2009, under Grails, Groovy, Java

É 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

Leave a Comment :, , more...

Batalha de RAP de geeks

by Luiz Picanço on Apr.17, 2009, under Ruby on Rails

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

Leave a Comment more...

Arquivo