Categories: , ,
Posted by: bjb

Not surprisingly, the blog spam commenters found my blog. Now I am investigating ways to ensure that only people comment on my blog.

With a little searching, I found that recaptcha is the recommended method these days. However, since Google has bought the recaptcha organization, you have to agree to a large legal agreement between yourself and Google to use it.

I’m not really up for that. It’s too bad as I might have liked to contribute to the “digitize old books” effort. So now I’m looking into regular captchas.

Categories:
Posted by: bjb

db migration:

When creating several tables in one migration, put them all in the same class. Give the class the same name as the migration. For example:

file: 001_create_tables.rb

class CreateTables < ActiveRecord::Migration

  def self.up

    create_table :sites do |t|
      t.string      :name     
      t.integer     :group_id,      :null => true
      t.integer     :moh_id                      
      t.integer     :playlist_id                 
      t.timestamps                               
    end                                          

    create_table :songs do |t|
      t.string         :title 
      t.integer        :site_id,     :null => true
      t.timestamps                                
    end                                           

    create_table :groups do |t|
      t.string        :name    
      t.timestamps             
    end

    create_table :playlists do |t|
      t.string       :name
      t.integer      :song_id,    :null => true
      t.timestamps
    end
  end

  def self.down
    drop_table :sites
    drop_table :songs
    drop_table :groups
    drop_table :playlists
  end

end

If several migrations are placed into one file like this:

files: 001_create_tables.rb


class CreateSites < ActiveRecord::Migration
  def self.up

    create_table :sites do |t|
      t.string            :name
      t.integer           :group_id,         null => true
      t.integer           :moh_id
      t.integer           :playlist_id
      t.timestamps
    end

  def self.down
    drop_table :sites
  end

end

class CreateSongs < ActiveRecord::Migration
  def self.up
    create_table :songs do |t|
    end

  def self.down
    drop_table :songs
  end

end

… etc

Then this error is likely: uninitialized constant CreateTables

(I guess because there wasn’t a class called “CreateTables” in the create_tables migration.)

Categories:
Posted by: bjb

Glen Newton writes about a study done on bug-fixing speed and reliability for econometric software packages. Five proprietary packages were measured in 2004 with a common set of tests, those five packages and one open source package were measured again in 2010.

The study concludes that the open-source software has fewer known bugs at any given time (they are fixed shortly after being found) while more than half the proprietary software had many of the bugs discovered in 2004, still open in 2010. For example, after applying the basic set of tests to the open-source project, they found: “all of the errors were corrected within a week of our reporting.” But, after all those tests were applied to the proprietary projects in 2004, only two of the vendors had solved all of those problems by 2010.

They might have picked a model open-source project for this study, but still it shows what can happen if you pick a good open-source product.

Still, when you are choosing your suite of software, choose carefully (even if every candidate for your suite is free). Try to pick the lively, active projects (but not the ridiculously lively ones, that don’t bother to go back and fix their bugs at all).

Categories:
Posted by: bjb

The pressure to know stuff quickly in high tech is enormous. I was glad to run across this article about the absurdity of it.

Categories:
Posted by: bjb

The byteflow community has a user mailing list and a hacker mailing list:

  1. users mailing list
  2. hackers mailing list

There is more info on the byteflow wiki and in the docs directory of the sources.

Also they talk on jabber: byteflow@conference.jabber.ru (logs)

Categories: ,
Posted by: bjb

The first two steps in fixing the html on my page have been taken. I’ve decided that no, I’m not going to fix it the easy way (by getting rid of the category cloud). And I upgraded my byteflow to the latest development version.

I looked at mercurial, and decided I didn’t want to learn yet another revision control system, so created a local git repository for my copy of byteflow, and checked the latest byteflow into it. Then created a branch for my changes and put my customizations into it. I have a separate sandbox where I can check out the latest from hg, test it, and check in to the main git repo. That’ll be fun.

Next, will be to report the problem to the byteflow people, and possibly try to fix it myself (if they don’t do it first).

UPDATE:

byteflow ticket 152

Categories: ,
Posted by: bjb

The Redhat-ish way to start and stop daemons is to use the service command. I just learned the Debian-ish way to do that is with the invoke-rc.d command. For example:

$ sudo invoke-rc.d apache2 reload

04/7: byteflow

Categories: , ,
Posted by: bjb

I tried validating (see below) the html on my new(ish) blog — it didn’t validate. It seems the category cloud is non-compliant. But I fixed up the CSS and that validates now.

I will check into the category cloud later.

<a href="/bjb/tag/android/"
title="Click to filter by android"
alt="count: 2"
class="tag-2"
rel="tag">android</a>

<a href="/bjb/tag/apache/"
title="Click to filter by apache"
alt="count: 1"
class="tag-1"
rel="tag">apache</a>

...

The validator doesn’t like “alt” tags on the “a” elements, for starters. The question is, why is it there? Of course it could be commented out (it’s in templates/tagging/tag_cloud.html) but what would break? … Stay tuned.

 continue reading
Categories:
Posted by: bjb

I just learned how to do a couple of things in emacs:

  1. put the line that has point in it at the top of the window: M-0 C-l (meta-zero control-ell)
  2. toggle the buffer to read-only or writeable ( M-x view-mode )
Categories:
Posted by: bjb

I was trying to integrate django’s user model with my application. I had extended the user with extra data in a UserProfile class, and had made a view require login. The web page was successfully redirected to the login page when visited for the first time, but upon logging in the user was not redirected to the original page. The user was redirected to the /accounts/profile page.

It was because I had not noticed that you had to add something to the login template — you need to add a hidden field called “next” to your login form. Once I added that, and changed the form action to “./?next={{ next }}” it started working correctly.

 continue reading