Archive for November, 2007

Round 1 with rails

November 28th, 2007 | Category: Computers & 570x0FF

So we finally made it past the planning phase in my aggregate demand project…and we decided to use Ruby on Rails. Ruby gave me quite a pleasant surprise. It is fully object oriented, has closures, has a python-like syntax (actually, its syntax is potentially perl-like, java-like, and practically *-like…it’s so strangely lax), and even continuations. On the other side, I’ve heard that it’s quite slow. In any case, some ruby tutorials and articles later I met rails. In case that you haven’t heard, Ruby on Rails is a web application framework made to rapidly create scalable CRUD apps. And it does it well. Sometimes a bit too well.

I was dying to use rails back in my software engineering course but sadly my teacher forced us to use java. Fast forward one year and here I am, building an enterprise-level app in rails. Installing rails was as easy as an “apt-cache search” and an “apt-get install” in my ubuntu system. I also downloaded the eclipse plugin from aptana but decided to build my first rails application using only my CLI and browser. I’m a total vim-head but most of the time when it comes to building web apps I usually go the eclipse way unless I’m using django. With rails I was pleased to see that it excels in the console environment (unlike java frameworks) and you don’t really need anything else but the framework to get started. Heck, you don’t even need apache installed to test your app, rails has its own development server. I decided that my friends and I could need a web comic publishing app, so that the world can see our glorious moments of lucid stupidity. Ok so I generated my project, created the database and tables, generated the controllers, messed a bit with the views, and arrived to the scaffolding part (this is basically what the rails wiki tutorial covers). Scaffolding is what really astounded me. Adding a simple line such as:

scaffold :modelname

in the controller and bam! The views and actions that were needed to CRUD data from the database were generated. Two links away were the even prettier views generated by the ActiveScaffold plugin. After that I decided to make some database changes. For this kind of thing rails has a wonderful migration system. I first assumed that I would need to modify my database and then my app’s configuration to do this, but I was wrong. You can specify incremental changes to your database via a pseudo-version-management system by doing this:

./script/generate migration name_of_migration

This generates a ruby file with the name of your migration in the db/migrate directory and adds a number at the beginning indicating it’s version (each migration counts as a version). In the ruby file generated, you specify the self.up and self.down methods as things to do to the database when upgrading or downgrading from that particular migration (things to do include creating tables, adding or removing columns, etc). Then you simply do:

rake db:migrate VERSION=N

Where N is the version you want to migrate to (omit this parameter if you want to migrate to the incrementally consecutive migration).
So for starteres rails has a good idea of workflow and an impressive way to deliver it. However, all this code generation requires you to follow some basic standards, some of which I’m not to comfortable with. For example, model names are the singular version of the database table they represent (that’s ok if it’s done in english but how about other languages?). Also, although migrations are cool, I really prefer django’s syncdb because it follows database changes AND makes them if you want to.
All in all it’s really a good framework and I would recommend anyone interested in web dev to give it a spin.
Next I’ll be seeing its authentication package.

No comments

La historia de Ranko y Tsuname, parte I

November 09th, 2007 | Category: Personal (Español)

El miedo desbordaba la capacidad de sus sentidos. Humo, estallido y frenesí adquirían más capacidad del paisaje en un ritmo constantemente acelerado. Si bien la situación de caos y guerra habían sido precursores de actos de violencia desenfrenada y aleaotorios gritos de tanto vícitimas como victimarios, el contagio de esa plaga emocional había pasado por su aspecto de manera equivalente a una espiga de trigo cayendo lentamente sobre una estatua milenaria de roca y acero. Lo de ellos era pánico, lo suyo miedo. Cabe resaltar que el pánico tiene varias ventajas sobre el miedo. Una criatura en estado de pánico no tiene conciencia de su situación, tan alarmante como pueda ser, y reacciona ante todo basado en mera aleatoriedad filtrada por un instinto vago y risible de supervivencia. El miedo en cambio es algo que no se olvida. Es anticipación e impotencia ante lo obscuro. Aclarada tal diferencia, volvamos a lo nuestro. Tsuname tenía miedo. Muchas veces había escuchado de alguno de sus compañeros de más alto grado del olor de la muerte. El muchacho había descrito con un circular cinismo y refinada presición la manera en que la muerte se arrastra de aquí para allá dejando un rastro inequívoco de sensaciones olfatorias tan densas que estaba seguro se podían degustar con la lengua también. Sin embargo, el estado actual de Tsuname era aún más macabro. La muerte la sentía. Con la piel. Punzadas arrítmicas de diversos intervalos de presión y temperatura que se estampaban con su empidermis, provocando una convincente sensación de estar siendo acechado segundo a segundo. De pronto, una luz de esperanza. Ante lo inevitablemente fatal de la situación actual, manchada de conflicto, acero, sangre y polvo arcano, se alzaba la figura de una muchacha pequeña y agachada. Estaba en la esquina de un edificio derrumbado, su hermosa cabellera rojiza contrastando con las brutales y efímeras explosiones que servían como curioso fondo de la escena. Un “por aquí!” fue suficiente para que Tsuname saliera del trance y siguiera con borrosa visión a la chiquilla, como cuando un joven con alcohol en las venas escucha el llamado de su propia nostalgia y se encamina con pasos quebrados en una dirección incierta. Es importante notar el cambio de emoción que tuvo Tsuname en este momento. Bien podríamos compararlo con pasar de un lugar insoportablemente caliente o frío a un utópico espacio donde la noción de temperatura no existe. No digo que es importante notar el cambio por el mezquino hecho de resaltar una pequeña variable de la manera en que Tsuname siente, sino por la analogía tan conmovedoramente exacta que se puede hacer entre ese instante y este momento. En este momento me encuentro bajando una corta escalinata, pensando en lo agria que puede llegar a ser la vida y sumido en un cúmulo de pensamientos perversos y nihilistas. De manera esperada mi mirada se topa con la presencia medianamente lejana de un amigo, la rutina de todas las semanas. De manera inesperada alcanzo a vislumbrar la mirada de una mujer que lo acompaña. He ahí el instante. La mirada me dice muchas cosas. Me platica de miedos y sueños, de pureza y verdad, de incertidumbre, valor y coraje. Su pasional forma de conversar dibuja tonos de una vida gris y desgarrada por un lado y llena de color y alada y volátil no por el otro lado, sino por la delgada línea que separa los dos lados. Le pregunto a la mirada que hay del otro lado de esa vida pero la respuesta me es adelantada por mi propia mentalidad de naturaleza ineficaz y metafísica: no hay otro lado, no en este mundo, no en este plano…

No comments

To the next level

November 08th, 2007 | Category: Computers & 570x0FF

Open source contribution. It’s been in my head for quite a while. I’ve always wanted to do something meaningful for the community that has given me so much. Ideas have come and go, none of them relevant enough. “Join a project then!”, some may say. And that I shall, but first I want to create something original for the benefit of the community.

Yesterday came and with it the news of Android (you know, the mobile OS) and the Open Handset Alliance. At the time I was “t-w-inkering” with my twitter micro-blog and wondering how to make better use of a network of connected computers and phones. “What do people need?” was the question ricocheting in the (sometimes hallow) caverns of my mind. A mirror image of myself answered: “For starters, more people”. And it’s true. Homo sapiens (sapiens) is a social animal by nature. We get work done mostly thanks to the work done by other people. The open source movement and to more extremes the Free Software Foundation, are examples of how the will of many can achieve complex goals. Connected people, aggregate creation, defero synthesis. Combine the idea of connection of twitter with the project administration vision of sourceforge. “Lame” the critics say. Indeed, a lame idea when it comes to software projects. However, a potent tool for other types of projects. Imagine that you have a great idea but not enough “manpower” to make it happen. So you publish this idea and people who are interested contact you. A micro-community is made around your idea, connected through any type of communication apparatus by the power of micro-blogging (micro-milestoning, how’s that huh?).

“But that isn’t really an open source project”. Granted. True. Admitted. It is not an open source project. It is an open project enabler. A benefactor of sorts. Ubiquitous defero synthesis.

“Umm, you mentioned Android…what about it?” I’ll let you figure out where that piece of technology fits in.

No comments

In the beginning…

November 04th, 2007 | Category: Uncategorized

There was none.

A fragile box

of cardboard and crystal ….

A hand, made of vertices innumerable

A face, a sound, of gentle grass trimming

This is how it begins. With me. With you. rm -rf *. Press return.

No comments