Gunnar Wolf: Hope...
Exists. Feels nice. Makes me float. Is it real?On the other hand... Fear exists as well...
And there even are nice sparks in my temporal reality...
Exists. Feels nice. Makes me float. Is it real?
I think I should follow up on Victor's lament. Yes, we have a Rails application which works fine most of the time... But quite often, throws out a segmentation fault I just have been unable to pin-point. It might be related to rmagick, the only non-pure-Ruby component I am using (and I'm tempted to try minimagick instead, even if I prefer in-memory operations than on-disk, piping an image and slurping it again).
#!/usr/bin/ruby require 'yaml' confdir = '/etc/mongrel-cluster/sites-enabled' restart_cmd = '/etc/init.d/mongrel-cluster restart' needs_restart = false (Dir.open(confdir).entries - ['.', '..']).each do site conf = YAML.load_file "# confdir /# site " pid_location = [conf['cwd'], conf['pid_file']].join('/').gsub(/\.pid$/, '*.pid') pid_files = Dir.glob(pid_location) pid_files.each do pidf pid = File.read(pidf) begin Process.getpgid(pid.to_i) rescue Errno::ESRCH warn "Process # pid (cluster # site ) is dead!" File.unlink pidf needs_restart = true end end end system(restart_cmd) if needs_restart
[Attention] Personal content follows. If you got to this post expecting technical or organizational content, go ahead and skip it.
The recent OpenSSL incident can not be hidden. It was a very important blow to the Debian project's public face and reputation. A major hole slipped under the door in the form of a bugfix - and with all the good intention. This was not a deliberate attack, nor was it the result of a bad or sloppy maintainer - It was a honest, although painful, human mistake.
I usually don't like me too comments... But this is something that really disappoints me of my otherwise-favorite development framework. I must echo Matt Palmer's comment on Luke Kanies' entry:
Every now and then, I want to understand a bit better English. Today, when Joeyh mentioned nettle soup, I had to ask Wikipedia what a nettle is. And Joey, no wonder it itches... It refers to around 45 species of genus Urtica in the family Urticaceae - In Spanish, of course, urtica is known as ortiga, or as blind person's herb, as even a blind person will quickly recognize it to touch - Touching it will cause the apt-named urticaria, which Joey seems to have discovered and learnt to fear. At least in Spanish, urticaria is generalized and used to call all kinds of skin diseases.
May 1st is a holiday in many countries around the world - It is, at least, here in Mexico. So, what's a man to do when faced with really-crappy network connectivity at home?
We face automobile traffic with our naked bodies as the best way of defending our dignit and exposing the unique dangers faced by cyclists and pedestrians as well as the negative consequences we all face due to dependence on oil, and other forms of non-renewable energy.Of course, Mexican groups take part in this interesting activity - Ciclomarcha nudista.

I like them. And if there is such a thing, I hope they carry good luck with them - Not that I believe in good luck, but anyway - Yesterday was a very good day, in quite many fronts. And it's nice to make a nice, closed leap on so many bases:
>> puts [was,am].map age [98,111,100,120].map s sprintf "%# s.chr ", age .join(', ')
11111, 37, 31, 1f
100000, 40, 32, 20
And just for coolness sake: It gets even better when looking at coincidence with my father - at least for the next couple of months:
>>puts [f_was, f_is].map age [98,111,100,120].map s sprintf "%# s.chr ", age .join(', ')
111111, 77, 63, 3f
1000000, 100, 64, 40
So, in most useful systems, we are both in a very nice and closed number. Sadly, I can no longer say that five bits should be enough for anybody.
I'm about to leave for Monterrey, Nuevo Le n, some 700Km North. Why? Because I was invited to be at the Monterrey FLISOL. And what exactly is a FLISOL? A very nice and interesting idea: Festival Latinoamericano de Instalaci n de Software Libre, Latin American Free Software Install Festival.
One week ago, I went to a branch office of Servicio de Administraci n Tributaria, the government office in charge of processing taxes. This year, I plan on doing something quite bold, as my Mexican friends will acknowledge: I will prepare my (quite simple, I hope) tax declaration by myself. I do not want to be held hostage of the accountant guild - So I might end doing some fuckup which in the end costs me money or time. I hope it is not the case.
It seems everybody is ranting in Planet Debian about what our planet should be about, what content should be acceptable, whether technical-only, Debian-only, everything-goes... Even archiving the posts via a mailing-list interface has been mentioned. Besides, following the planet seems to have become mandatory to people linked to Debian, almost as mandatory as following debian-devel-announce.
Wouter, you seem to enjoy using huge filesystem volumes. So, dear lazyweb...
No, the king id not dead. Still, congrats to Steve.
And yes, I was wrong in that I expected more people to vote
111- or equivalent (perhaps those people didn't vote at all instead?) About
voter turnout: In Switzerland, everybody is really, really happy when 49% of
the population does vote. Usually, we have participation between 30 and 40%,
sometimes even lower, IIRC in one case it was as low as 26% all issues were so
non-controversial (usually, it's referendums (referenda? referendi?
referendumthingies) on factual issues and no elections, though, so the
comparison might not be entirely fair.)
Vicm3, you know I'd probably ignore this, as following internet memes goes against my principles. But what are the principles there, if not to break them?
Of course, this post is about the results for the recent Debian Project Leader elections. Although I've written quite a bit about politics in my country, I cannot sadly hold any hopes for decent electoral (or post-electoral, or political in general) results here in Banana-land. All hail our de-facto president, BTW.
This is the third plugin I have been working on for Rails - It's the one that still needs most work to be fully usable (for what I originally envisioned it), but is almost there - I have not touched it (nor the other two I recently presented here, acts_as_catalog and Real FK because real-life has demanded my time on various other fronts.
create_table :people, :force => true do t
t.column :name, :string
end
create_table :project_types, :force => true do t
t.column :name, :string
end
create_table :projects, :force => true do t
t.column :name, :string
t.column :project_type_id, :integer
end
create_table :people_projects, :force => true, :id => false do t
t.column :person_id, :integer
t.column :project_id, :integer
end
Using acts_as_magic_model, you can skip declaring the relations in your models, like this: (of course, each of the classes still has to be declared in its own file)
class Person < ActiveRecord::Base
acts_as_magic_model
end
class Project < ActiveRecord::Base
acts_as_magic_model
end
class ProjectType < ActiveRecord::Base
acts_as_magic_model
end
And the gaps will be filled in for you - that is, you can go on and ask for Project.find(:first).people, ProjectType.find(:first).projects.size, Person.find(:first).projects.map pr pr.project_type , and whatever you fancy.
As stated yesterday, I have recently worked on some plugins for Ruby on Rails, and I do think they are usable (and useful!) for audiences larger than myself. So, today I'll present here the second such plugin.
def Mytable < ActiveRecord::Base
acts_as_catalog
belongs_to :some_other_table
end
A catalog is often accessed to populate i.e. drop-down selection or radio boxes, passing what is called collections in Rails-speak. You will often want collections to be sorted by ID or by name, thus:
collection = Mytable.collection_by_id another_col = Mytable.collection_by_nameMigrations You can specify all the catalogs you need to create for a specific migration with a single instruction from inside your self.up method, by giving a list of catalog table names to create_catalogs:
def self.up
create_catalogs :countries, :states
...
end
Likewise, you can destroy the created catalogs in a single command. The
def self.down
...
drop_catalogs :states, :countries
end
Tests
This plugin provides the base functionality to include in your unit tests ensuring the catalog is properly declared. Just include ‘catalog_test_helper’ and include the CatalogTest mixin in your test classes, declare the model name, and off you go. This is, a complete unit test for you Mytable catalog model could be:
require File.dirname(__FILE__) + '../test_helper'
require 'catalog_test_helper'
class MytableTest < Test::Unit::TestCase
include CatalogTestHelper
def setup
@model = Mytable
end
end
I have mostly shifted my main development language to Ruby, as most of the work I do tends to be pretty well covered with Rails. That's not new, however - What is new is that I feel I have got to the point where I actually have something to share. And it feels very good.
def self.up
create_table :proposals do t
(...)
end
create_table :proposal_types do t
(...)
end
create_table :proposal_statuses do t
(...)
end
add_reference :proposals, :proposal_types
add_reference :proposals, :proposal_statuses, :null => false, :default => 1
end
The corresponding fields (proposal_type_id and proposal_status_id, respectively) will be created in proposals, and the RDBMS will impose a Foreign Key constraint. The references can be removed via remove_reference, i.e., for inclusion in down migrations:
def self.down
remove_reference :proposals, :proposal_types
remove_reference :proposals, :proposal_statuses
drop_table :proposal_statuses
drop_table :proposal_types
drop_table :proposals
end
Of course, in this case the remove_reference call is not really needed - But if you are dropping a table that is referred to from a table that will remain existing, you will have to remove the foreign key constraints (that is, the referring columns).
Join (HABTM) tables
When you define a simple has_and_belongs_to_many (HABTM) relation in your model, you are expected to create an extra table representing this relation. This is a very simple table (i.e. it has only a row for each of the related table‘s IDs), and it carries foreign key constraints.
def self.up
create_table :people do t
(...)
end
create_table :conferences do t
(...)
end
create_habtm :people, :conferences
end
def self.down
drop_habtm :people, :conferences
drop_table :people
drop_table :conferences
end
The last call will create a conferences_people table (according to Rails' conventions, table names are sorted alphabetically to get the join table‘s name).Next.