Breaking Bad: Pequeño homenaje
Fantastico ensayo en wired acerca de BB y la masculinidad.
"If you're committed enough, you can make any story work. I once told a woman I was Kevin Costner, and it worked because I believed it"
Skyler:
"All I can do is wait . . . for the cancer to come back
Mike Ehrmantraut:
"Just because you shot Jesse James doesn't mean you are Jesse James."
Marie Schrader:
"They’re rocks"
Walter White, Jr.:
"He's a great father, a great teacher. He knows like everything there is to know about chemistry. He's patient with you, he's always there for you. He's just decent. And he always does the right thing and that's how he teaches me to be."
Gustavo Fring:
"I hide in plain sight, same as you"
Jesse Pinckman
"Yeah, bitch! Magnets!"
Hank Schrader:
"Heisenberg? Heisenberg! You two-faced sack of s--t! I will put you under the jail"
Vince Gilligan (Breaking Bad creator):
"You take Mr. Chips and turn him into Scarface."
Walter White:
"I am not in danger, Skyler. I am the danger! A guy opens his door and gets shot and you think that of me? No. I am the one who knocks!"
Source: The Telegraph
Picture: AMC
Django desde un template llamar a un procedimiento del primer objeto de un query
Puede usarse el with con esta sintaxis:
<img {% with im.inmuebleimagen_set.all|first as imagen %}
src="{{imagen.get_url}}"{%endwith%}
/>
Django cambiar de lenguaje desde el view
Para cambiar el LANG en el servidor, asumiendo que tenemos todo el sistema de traducción correctamente configurado, llamamos via POST a la ficha setlang y le pasamos el campo language con la lengua seleccionada:
En settings definimos los lenguajes con los que trabajamos:
LANGUAGES = (
('es', ugettext(u'Español')),
('de', ugettext(u'German')),
('en', ugettext(u'English')),
);
En urls, incluimos las url de i18n:
(r'^i18n/', include('django.conf.urls.i18n')),
Y ya en el template podemos llamar a la ficha /i18n/setlang para setear el lenguaje:
<li class="gbt">
<form name="setLangSpanish" action="/i18n/setlang/" method="POST">{% csrf_token %}
<input name="next" type="hidden" value="/" />
<input type="hidden" name="language" value="es" />
<a href="#" class="language_off" onclick="document.setLangSpanish.submit();return false;">
<span class="language_off sprachwahl">Español</span></a>
</form>
</li>
<li class="gbt">
<form name="setLangEnglish" action="/i18n/setlang/" method="POST">{% csrf_token %}
<input name="next" type="hidden" value="/" />
<input type="hidden" name="language" value="en" />
<a href="#" class="language_off" onclick="document.setLangEnglish.submit();return false;">
<span class="language_off sprachwahl">English</span></a>
</form>
</li>
<li class="gbt">
<form name="setLangDeusch" action="/i18n/setlang/" method="POST">{% csrf_token %}
<input name="next" type="hidden" value="/" />
<input type="hidden" name="language" value="de" />
<a href="#" class="language_off" onclick="document.setLangDeusch.submit();return false;">
<span class="language_off sprachwahl">Deusch</span></a>
</form>
</li>
Fuente: oscarcp http://blog.oscarcp.com/?p=163
Mysql borrado rápido filas duplicadas
En este sitio he encontrado una forma muy rápida de eliminar duplicados. Tan rápida que puede hacerse con una sola línea, se trata de crear ununique index con la palabra clave IGNORE. Tal que esto:
ALTER IGNORE TABLE dupTest ADD UNIQUE INDEX(a,b);
Guay eh?