Es la tercera vez que le doy una probada a FreeBSD, primero fue la 6.3, despues la 7.0 y ahora la 7.1, me baje el DVD de los torrents y empece de nuevo con todo lo que me había olvidado.
observaciones:
* el instalador es igual al 6.3, se podría hacer un poco mas simple incluso para los geeks ocultando preguntas que tienden a ser defaults todo el tiempo excepto raras excepciones, fuera de eso, si peleaste contra debian, no te va a sorprender nada.
* una vez instalado, no instale el bootloader para dejar grub y tuve que poner una entrada en el grub que fue distinta a las anteriores, en este caso fue:
title Free-BSD
root (hd0,2)
chainloader +1
boot
* como siempre, no me reconoció ni el sonido, ni la wireless, pero esta vez le sumo el touchpad, que la ultima vez me lo había reconocido, para solucionarlo seguí estos pasos y anduvieron a la perfección.
http://fixunix.com/xwindows/383881-how-use-alps-glidepoint-touchpad-xorg-7-3-freebsd-7-0-release-amd64.html
un poco mas de info acá
http://wiki.freebsd.org/SynapticsTouchpad
* no recuerdo de la ultima vez, pero tuve que escribir el .xinitrc a mano y correr xorgconfig para generar el xorg.conf, me hizo preguntas muchas mas técnicas que las que hacia dpkg-reconfigure xserver-xorg en ubuntu.
* a pesar de instalar sudo y tener una sola cuenta fuera de root, me tuve que agregar en /usr/local/etc/sudoers con la entrada
mariano ALL=(ALL) ALL
* como siempre también tuve que correr sudo vipw para cambiar el shell fiero que tiene por defecto por el querido bash, recuerden que aca no es /bin/bash sino /usr/local/bin/bash
* feo que tenga firefox 2.0.20
* todavía me tengo que poner a pelear con el sonido, la wireless y como siempre, flash...
del lado bueno
* los ports son algo que se extraña de gentoo
* aguante FreeBSD :D
miércoles, enero 07, 2009
martes, enero 06, 2009
Are my ideas being stolen?
de un articulo de slashdot sale el siguiente comentario
http://ask.slashdot.org/comments.pl?sid=1082003&cid=26345371
http://ask.slashdot.org/comments.pl?sid=1082003&cid=26345371
sábado, enero 03, 2009
sábado, diciembre 27, 2008
viernes, diciembre 26, 2008
Haganme un favor
Cuando estén con migo ponganme en una situación en la que pueda decir touche de manera adecuada.
Siempre quise parecer inteligente diciendo esa palabra
Siempre quise parecer inteligente diciendo esa palabra
Book meme
Ningún Test lo es. - Sueñan los androides con ovejas eléctricas? Philip K. Dick
link: http://fitoria.net/2008/11/13/book-meme/
link: http://fitoria.net/2008/11/13/book-meme/
- Agarra el libro mas cercano
- Abrelo en la pagina 56.
- Encuentra la quinta oración.
- Postealo junto con estas instrucciones
- No vayas por tu libro favorito solo agarra el que este MAS CERCA
- Poner la url del site donde leíste el meme
lunes, diciembre 22, 2008
Xml -> dict -> objetos
En este ejemplo se muestra como convertir un string a una estructura de diccionarios y listas anidadas usando expat, tambien se proveen dos clases que permiten manipular el resultado como si fueran objetos.
primero el codigoimport xml.parsers.expat
class XmlParser(object):
'''a class that parses a xml string an generates a nested
dict/list structure
'''
def __init__(self, text):
'''constructor'''
self.parser = xml.parsers.expat.ParserCreate()
self.parser.buffer_text = True
self.result = None
self.stack = []
self.current = None
self.parser.StartElementHandler = self.start_element
self.parser.EndElementHandler = self.end_element
self.parser.CharacterDataHandler = self.char_data
self.parser.Parse(text)
def start_element(self, name, attrs):
'''Start xml element handler'''
if self.current != None:
self.stack.append(self.current)
self.current = {}
for (key, value) in attrs.iteritems():
self.current[str(key)] = value
self.current['tag'] = name
self.current['childs'] = []
def end_element(self, name):
'''End xml element handler'''
if len(self.stack):
current = self.stack.pop()
current['childs'].append(self.current)
self.current = current
else:
self.result = self.current
def char_data(self, data):
'''Char xml element handler.
buffer_text is enabled, so this is the whole text element'''
self.current['childs'].append(data)
class DictObj(dict):
'''a class that allows to access a dict as an object
'''
def __init__(self, kwargs):
'''constructor'''
dict.__init__(self, kwargs)
def __getattribute__(self, name):
if name in self:
obj = self[name]
if type(obj) == dict:
return DictObj(obj)
elif type(obj) == list:
return ListObj(obj)
return obj
else:
return None
class ListObj(list):
'''a class that allows to access dicts inside a list as objects
'''
def __init__(self, args):
'''constructor'''
list.__init__(self, args)
def __getitem__(self, index):
if index > len(self):
raise IndexError('list index out of range')
obj = list.__getitem__(self, index)
if type(obj) == dict:
return DictObj(obj)
elif type(obj) == list:
return ListObj(obj)
return obj
def __iter__(self):
'''iterate over the list'''
count = 0
while count < len(self):
yield self[count]
count += 1
def raw_string(dct_):
'''return a string containing just the string parts removing all the
xml stuff'''
def helper(dct):
result = []
for child in dct.childs:
if type(child) == str or type(child) == unicode:
result.append(str(child))
else:
result = result + helper(child)
return result
return ''.join(helper(dct_))
Simplemente creamos un objeto de tipo XmlParser pasandole el string y obtenemos el resultado parseado en la variable result. Si no queremos andar preguntado si las llaves existen antes de accederlas para evitar excepciones podemos usar la clase DictObj que nos permite acceder a las llaves como si fueran atributos, las variables que no existan como llaves contendran None. Aca va un ejemplo en la consola interactiva
>>> import XmlParser
>>> p = XmlParser.XmlParser('google test!
!')
>>> r = p.result
>>> d = XmlParser.DictObj(r)
>>> d
{'childs': [{'childs': [u'go', {'childs': [u'o'], 'tag': u's'}, u'gle'], 'href': u'google.com', 'tag': u'a'}, u' ', {'childs': [u'test'], 'tag': u'i'}, u' ', {'childs': [], 'src': u'foo.png', 'alt': u'foo', 'tag': u'img'}, u' ', {'childs': [u'!'], 'tag': u'u'}, {'childs': [u'!'], 'tag': u's'}], 'tag': u'span'}
>>> d.childs
[{'childs': [u'go', {'childs': [u'o'], 'tag': u's'}, u'gle'], 'href': u'google.com', 'tag': u'a'}, u' ', {'childs': [u'test'], 'tag': u'i'}, u' ', {'childs': [], 'src': u'foo.png', 'alt': u'foo', 'tag': u'img'}, u' ', {'childs': [u'!'], 'tag': u'u'}, {'childs': [u'!'], 'tag': u's'}]
>>> d.childs[0]
{'childs': [u'go', {'childs': [u'o'], 'tag': u's'}, u'gle'], 'href': u'google.com', 'tag': u'a'}
>>> d.childs[0].tag
u'a'
>>> d.childs[0].childs[0]
u'go'
>>> d.childs[0].childs[1].tag
u's'
sábado, diciembre 20, 2008
jueves, diciembre 18, 2008
Metacrap
buen articulo (explica por que nunca use los tags de blogger :P)
http://www.well.com/~doctorow/metacrap.htm
http://www.well.com/~doctorow/metacrap.htm
sábado, diciembre 13, 2008
sobre startups
este articulo confirma algunas cosas que tenia en mente y que no sabia si era yo nomas :D
http://www.paulgraham.com/divergence.html
quotes para los fiacosos
The reason startups no longer depend so much on VCs is one that everyone in the startup business knows by now: it has gotten much cheaper to start a startup. There are four main reasons: Moore's law has made hardware cheap; open source has made software free; the web has made marketing and distribution free; and more powerful programming languages mean development teams can be smaller. These changes have pushed the cost of starting a startup down into the noise.
Once you cross the threshold of profitability, however low, your runway becomes infinite. It's a qualitative change, like the stars turning into lines and disappearing when the Enterprise accelerates to warp speed. Once you're profitable you don't need investors' money. And because Internet startups have become so cheap to run, the threshold of profitability can be trivially low. Which means many Internet startups don't need VC-scale investments anymore.
http://www.paulgraham.com/divergence.html
quotes para los fiacosos
The reason startups no longer depend so much on VCs is one that everyone in the startup business knows by now: it has gotten much cheaper to start a startup. There are four main reasons: Moore's law has made hardware cheap; open source has made software free; the web has made marketing and distribution free; and more powerful programming languages mean development teams can be smaller. These changes have pushed the cost of starting a startup down into the noise.
Once you cross the threshold of profitability, however low, your runway becomes infinite. It's a qualitative change, like the stars turning into lines and disappearing when the Enterprise accelerates to warp speed. Once you're profitable you don't need investors' money. And because Internet startups have become so cheap to run, the threshold of profitability can be trivially low. Which means many Internet startups don't need VC-scale investments anymore.
jueves, diciembre 04, 2008
import antigravity
problema: queres pasarle uno o mas archivos a una persona, solo queres que vea archivos de una carpeta determinada y poner apache o samba no tiene sentido para vos.
solucion en una linea de python:
si lo queres correr desde la consola (te publica el directorio donde corriste el comando):
vamos a admitirlo, es un poco perlish, asi que vamos a ponerlo mas limpio:
PD: al final lo pasamos en pendrive porque eran 899MB pero cuando haces algo asi en python es con el unico fin de levantarte minas, ej:
*se aproxima a la mujer objetivo en bar, boliche o similar*
- ayer le tenia que pasar un archivo a un amigo y no tenia como
*hace gesto de desinteresada*
- sabes que hice?
*no responde*
*mira para otro lado*
- escribi un servidor web en 4 lineas de python
*lo mira*
*comienza a besarlo apasionadamente*
;)
solucion en una linea de python:
__import__('BaseHTTPServer').HTTPServer(('', 8000), __import__('SimpleHTTPServer').SimpleHTTPRequestHandler).serve_forever()
si lo queres correr desde la consola (te publica el directorio donde corriste el comando):
python -c "__import__('BaseHTTPServer').HTTPServer(('', 8000), __import__('SimpleHTTPServer').SimpleHTTPRequestHandler).serve_forever()"
vamos a admitirlo, es un poco perlish, asi que vamos a ponerlo mas limpio:
import BaseHTTPServer
import SimpleHTTPServer
server = BaseHTTPServer.HTTPServer(('', 8000), SimpleHTTPServer.SimpleHTTPRequestHandler)
server.serve_forever()
PD: al final lo pasamos en pendrive porque eran 899MB pero cuando haces algo asi en python es con el unico fin de levantarte minas, ej:
*se aproxima a la mujer objetivo en bar, boliche o similar*
- ayer le tenia que pasar un archivo a un amigo y no tenia como
*hace gesto de desinteresada*
- sabes que hice?
*no responde*
*mira para otro lado*
- escribi un servidor web en 4 lineas de python
*lo mira*
*comienza a besarlo apasionadamente*
;)
sábado, noviembre 29, 2008
Workaround
este post es un placeholder, cuando quieras sharear una url que no tenes en tus links podes ir al feed de mi blog (obviamente lo tenes en los feeds :P) y shareas este post con un comentario con la url que te parecio interesante.
Esto hasta que google reader me permita sharear urls arbitrarias sin tener que estar suscripto a su feed.
Si el post te parece muy largo puedo crear uno sin toda esta explicacion, pero esta bueno que tu share tenga la explicacion de porque estas shareando un post tan pedorro con una url que no tiene nada que ver :D
Si tildas este post como "keep unread" en reader no vas a tener que tener "all items" en mi blog, sino que solo vas a poder ver los nuevos ;)
a su servicio,
wariano
Esto hasta que google reader me permita sharear urls arbitrarias sin tener que estar suscripto a su feed.
Si el post te parece muy largo puedo crear uno sin toda esta explicacion, pero esta bueno que tu share tenga la explicacion de porque estas shareando un post tan pedorro con una url que no tiene nada que ver :D
Si tildas este post como "keep unread" en reader no vas a tener que tener "all items" en mi blog, sino que solo vas a poder ver los nuevos ;)
a su servicio,
wariano
miércoles, noviembre 26, 2008
How Software Companies Die
"Programming is the Great Game. It consumes you, body and soul. When you're caught up in it, nothing else matters. When you emerge into daylight, you might well discover that you're a hundred pounds overweight, your underwear is older than the average first grader, and judging from the number of pizza boxes lying around, it must be spring already. But you don't care, because your program runs, and the code is fast and clever and tight. You won. "
http://www.zoion.com/~erlkonig/writings/programmer-beekeeping.html
http://www.zoion.com/~erlkonig/writings/programmer-beekeeping.html
martes, noviembre 18, 2008
vimrc
set nocompatible
set smartcase
set incsearch
set hlsearch
set bs=indent,eol,start
set ts=4
set sts=4
set sw=4
set et
set tw=75
set ai
set smartindent
set smarttab
set syntax
# estas 3 son para gvim en windows
colorscheme desert
set guioptions-=T
set guifont=Consolas:h14
lo dejo para que cada vez que tenga un vim al frente tenga las settings que uso siempre en algún lado, si le sirve a alguien bien :D
set smartcase
set incsearch
set hlsearch
set bs=indent,eol,start
set ts=4
set sts=4
set sw=4
set et
set tw=75
set ai
set smartindent
set smarttab
set syntax
# estas 3 son para gvim en windows
colorscheme desert
set guioptions-=T
set guifont=Consolas:h14
lo dejo para que cada vez que tenga un vim al frente tenga las settings que uso siempre en algún lado, si le sirve a alguien bien :D
martes, noviembre 11, 2008
simple is better than complex
perl:
@$values[$count]->{$key} = $value;
python
values[count][key] = value
solo eso..
@$values[$count]->{$key} = $value;
python
values[count][key] = value
solo eso..
miércoles, noviembre 05, 2008
sábado, noviembre 01, 2008
lunes, octubre 27, 2008
minirants
1) a mi que me da verguenza cuando emesene se congela por unos segundos, la verguenza que deben pasar los de outlook que se congela todo el tiempo :P
2) aguante la opcion -c de wget
2) aguante la opcion -c de wget
jueves, octubre 16, 2008
migrar access a postgres
aca hay un pequeño script que hice para migrar de access a postgres, tuve que hacer algunos trucos para que ande bien. si a alguien le sirve...
import os
import commands
archivo = "archivo.mdb"
tables = commands.getoutput("mdb-tables -S %s" % (archivo,))
os.popen("rm carga.sql")
os.popen("rm schema.sql")
os.popen("mdb-schema -S %s postgres| sed 's/Postgres_Unknown 0x0c/Text/' | grep \"\-\-\" -v | grep \"^DROP TABLE\" -v | sed 's/Bool/Int8/' > schema.sql" \
% (archivo,))
for table in tables.split():
cmd = \
# si tenes el postgres con locales que te pide insertar la fecha con un
# formato no ISO (MDY) correr la siguiente linea antes de los inserts
# SET DateStyle TO 'MDY';
"mdb-export -I -S %s %s | sed -e 's/)$/)\;/' | sed -e s/\\\"/\\'/g >> carga.sql"
if not table.startswith('MSys'):
os.popen(cmd % (archivo, table))
domingo, octubre 12, 2008
cosas locas de java
en una clase tengo dos atributos privados, los cuales solo son modificados por un método. Hasta ahí todo bien.
El problema es que para poder serializar esa clase a json y para poder guardarla en Hibernate tienen que ser beans (osea esos atributos tienen que tener getter y setters) por lo cual me rompe todo el bendito encapsulamiento, ya que cualquiera manipulando un objeto puede romper la consistencia y relacion de los dos atributos usando el set de uno (no, no puedo deducir que hacer con el otro en base al valor de uno).
Cosas que pasan.
PD: puede que haya una forma de arreglarlo, yo no la se.
El problema es que para poder serializar esa clase a json y para poder guardarla en Hibernate tienen que ser beans (osea esos atributos tienen que tener getter y setters) por lo cual me rompe todo el bendito encapsulamiento, ya que cualquiera manipulando un objeto puede romper la consistencia y relacion de los dos atributos usando el set de uno (no, no puedo deducir que hacer con el otro en base al valor de uno).
Cosas que pasan.
PD: puede que haya una forma de arreglarlo, yo no la se.
Suscribirse a:
Entradas (Atom)
Seguidores
Archivo del Blog
-
►
2011
(74)
- ► septiembre (4)
-
►
2010
(111)
- ► septiembre (8)
-
►
2009
(96)
- ► septiembre (3)
-
►
2008
(60)
- ► septiembre (8)
-
►
2007
(64)
- ► septiembre (1)
-
►
2006
(81)
- ► septiembre (1)
!
In "The Zen of Graphics Programming", Michael Abrash (a co-author of Quake and inventor of Mode X) wrote:
-------------
Our world is changing, and I'm concerned. By way of explanation, three anecdotes.
Anecdote the first: In one of his books, Frank Herbert, author of Dune, told me how he had once been approached by a friend who claimed he (the friend) had a killer idea for a SF story, and offered to tell it to Herbert. In return, Herbert had to agree that if he used the idea in a story, he'd split the money from the story with this fellow. Herbert's response was that ideas were a dime a dozen; he had more story ideas than he could ever write in a lifetime. The hard part was the writing, not the ideas.
Anecdote the second: I've been programming micros for 15 years, and been writing about them for more than a decade and, until about a year ago, I had never-not once!- had anyone offer to sell me a technical idea. In the last year, it's happened multiple times, generally via unsolicited email along the lines of Herbert's tale.
This trend toward selling ideas is one symptom of an attitude that I've noticed more and more among programmers over the past few years-an attitude of which software patents are the most obvious manifestation-a desire to think something up without breaking a sweat, then let someone else?s hard work make you money. Its an attitude that says, "I'm so smart that my ideas alone set me apart." Sorry, it doesn't work that way in the real world. Ideas are a dime a dozen in programming, too; I have a lifetime's worth of article and software ideas written neatly in a notebook, and I know several truly original thinkers who have far more yet. Folks, it's not the ideas; it's design, implementation, and especially hard work that make the difference.
Virtually every idea I've encountered in 3-D graphics was invented decades ago. You think you have a clever graphics idea? Sutherland, Sproull, Schumacker, Catmull, Smith, Blinn, Glassner, Kajiya, Heckbert, or Teller probably thought of your idea years ago. (I'm serious-spend a few weeks reading through the literature on 3-D graphics, and you'll be amazed at what's already been invented and published.) If they thought it was important enough, they wrote a paper about it, or tried to commercialize it, but what they didn't do was try to charge people for the idea itself.
A closely related point is the astonishing lack of gratitude some programmers show for the hard work and sense of community that went into building the knowledge base with which they work. How about this? Anyone who thinks they have a unique idea that they want to "own" and milk for money can do so-but first they have to track down and appropriately compensate all the people who made possible the compilers, algorithms, programming courses, books, hardware, and so forth that put them in a position to have their brainstorm.
Put that way, it sounds like a silly idea, but the idea behind software patents is precisely that eventually everyone will own parts of our communal knowledge base, and that programming will become in large part a process of properly identifylng and compensating each and every owner of the techniques you use. All I can say is that if we do go down that path, I guarantee that it will be a poorer profession for all of us - except the patent attorneys, I guess.
Anecdote the third: A while back, I had the good fortune to have lunch down by Seattle's waterfront with Neal Stephenson, the author of Snow Crash and The Diamond Age (one of the best SF books I've come across in a long time). As he talked about the nature of networked technology and what he hoped to see emerge, he mentioned that a couple of blocks down the street was the pawn shop where Jimi Hendrix bought his first guitar. His point was that if a cheap guitar hadn't been available, Hendrix's unique talent would never have emerged. Similarly, he views the networking of society as a way to get affordable creative tools to many people, so as much talent as possible can be unearthed and developed.
Extend that to programming. The way it should work is that a steady flow of informa-tion circulates, so that everyone can do the best work theyre capable of. The idea is that I don't gain by intellectually impoverishing you, and vice-versa; as we both compete and (intentionally or otherwise) share ideas, both our products become better, so the market grows larger and everyone benefits.
That's the way things have worked with programming for a long time. So far as I can see it has worked remarkably well, and the recent signs of change make me concerned about the future of our profession.