Sunday, July 22, 2007
The KhoiKhoi/Bushmen
As artists they painted rich scenes of animals and hunts, never a battle scene, a peaceful group of people that strove for harmony with nature and other peoples.
So what happened to these peaceful people, well first the migration south of the strip farming Bantu tribes on the fertile eastern seaboard, who enslaved, incorporated or displaced them. Evidence of the bushman influence is found in the Xhosas who have incorporated some of the "clicks" into their language
(Nelson Mandela is such a remarkable humanist?)
Then came the European Settlers who initially traded then stole the Bushmens valuable livestock and introduced deadly diseases (Spanish Influenza virtually wiped out the settlements)
I took a trip to the Cederberg Mountains and viewed a rock painting of a fifteenth century sailing boat, alongside some colourful Eland and a strong scent of camphor trees growing in the rocky outcrop, looking out at the empty hills completely empty of these ancient artists I wonder at what has been done that can never be undone
Saturday, July 14, 2007
Books I am reading
I have always enjoyed Le Guin's style and pace as an author, enjoyed the "Earthsea" series
2) "A History of Western Philosophy" by "Bertrand Russell"
I haven't managed to finish this book in over a year! The modern and religious philosophers have put me off :) Stuck on page 627 with something about Cromwell, oh well
3) "The Persian Expedition" by "Xenophon"
430-354 BC old news? A Rex Warner translation
Tri Nations
Johan Muller the Bok captain showed great honour and courage has probably proved that the so called Jake White's B side is at least equal to the first choice team with the exception of Breyton Paulse who seems to have had instructions not to tackle but rather hop around trying to get an interception, this idiotic tactic cost the first try against the Boks
On the subject of idiotic tactics, did Jake White insist that all the hard earned possession won by Muller's forwards be kicked mid field so that the All Blacks could get more opportunities to score points?
Well I guess its just a game, however I would prefer that play on the field should be rewarded rather than the aspirations of administrators
Friday, July 13, 2007
One Laptop per Child
Chip-maker Intel has joined forces with the makers of the $100 laptop project.
The agreement marks a huge turnaround for both the not-for profit One laptop per Child (OLPC) foundation and Intel.
In May this year, Nicholas Negroponte, the founder of OLPC said Intel "should be ashamed of itself" for efforts to undermine the $100 laptop initiative.
He accused Intel of selling its own cut-price laptop - the Classmate - below cost to drive him out of markets in the developing world.
"What happened in the past has happened," said Will Swope of Intel. "But going forward, this allows the two organisations to go do a better job and have better impact for what we are both very eager to do which is help kids around the world."
"Intel joins the OLPC board as a world leader in technology, helping reach the world's children. Collaboration with Intel means that the maximum number of laptops will reach children," said Nicholas Negroponte, founder of One Laptop per Child.
The new agreement means that Intel will sit alongside companies such as Google and Red Hat as partners in the OLPC scheme.
They will also join rival chip-maker AMD, which supplies the processor at the heart of the $100 laptop.
"Intel's apparent change of heart is welcome, and we're sure they can make a positive contribution to this very worthy project for the benefit of children all over the world," read a statement from AMD
Initially there are no plans to switch the processor to one designed by Intel. However, the servers used to back up the XO laptops, as they are known, will have Intel technology at their core.
Decisions about the hardware inside the XO laptop would be made by OLPC, said Mr Swope.
"OLPC will decide about which products they choose to offer or not offer," he said.
Friday, July 6, 2007
Kirstenbosch
My morning walk ritual to the contour path, about 1000 steps, getting the blood rushing and then down for a quick breakfast with the morning paper before the start of day.
The mountains enormous variety of plants is remarkable, from the Cape Cedar to the myriad varieties of Leucospernums (Pincushions), Leucodendrons (Cone bushes) and Mimetes (Long stemmed flower)
With the plant abundance and variety come the birds, like the iridescent malachite sunbird, who also put up a great show
Monday, July 2, 2007
Start Mongrel Cluster on Boot - ubuntu fiesty
http://rails.aizatto.com/2007/05/20/deploying-ruby-on-rails-on-ubuntu-feisty-fawn-via-mongrel-cluster-and-apache/
I did the "Start Mongrel Cluster on Boot" section slightly differently.
first create a script for init.d (and make it runnable ie chmod +x your_script_name)
#!/usr/bin/env ruby
#
# app_name This is a startup script for use in /etc/init.d
#
# chkconfig: 2345 80 20
# description: Description of program / service
APP_START = '/var/www/railsapp.com/startme'
APP_STOP = '/var/www/railsapp.com/stopme'
case ARGV.first
when 'start':
exec APP_START
when 'stop':
exec APP_STOP
when 'restart':
#TODO
end
unless %w{start stop restart status}.include? ARGV.first
puts "Usage: #{APP_START} {start|stop|restart}"
exit
end
2) Then create the "startme" script in your rails app directory
(You can uncomment the cluster::configure for the first run)
(and make it runnable ie chmod +x your_script_name)
#!/bin/bash
#sudo mongrel_rails cluster::configure -e production -p 8000 -N 6 -c /var/www/railsapp.com -a 127.0.0.1 -l /var/www/railsapp.com/log/mongrel.log
mongrel_rails cluster::start -C /var/www/railsapp.com/config/mongrel_cluster.yml
3) Add start line in /etc/rc.local file
(Assuming you called your script "mongrel_processes")
/etc/init.d/mongrel_processes start
before the
exit 0
4) That should be it , start the script from init.d, if it works, well . . .
I find this version slightly easier to read and maintain.
Peter
Sunday, July 1, 2007
Mysql and Rails live data transformation
I decided to post a series of steps i needed to take to add a table and repair a table in a running application with live data.
It may be helpful to someone even though its very specific to a particular scenario
If you need help with a data transform you are welcome to ask - I will help if I can :)
I use a combination of mysql client as well as the rails console (Active Record) to get things done
1) Get latest data (shell prompt)
% mysql -u root lotus_development < id="st" name="st" class="st">script/console)
Quote.destroy_all(["accepted_status='cancelled'
3) Delete duplicate invoices (mysql prompt)
mysql> delete from invoices where care=0;
4) Add invoice column to deliveries (mysql prompt)
mysql> alter table deliveries add invoice_no varchar(100) default "none";
5) Dump invoices table (shell prompt)
% mysqldump -u root lotus_development invoices > invoices.sql
6) Add temp id column (mysql prompt)
ALTER TABLE `lotus_development`.`invoices` ADD COLUMN `id_bc` INTEGER NOT NULL FIRST;
7) Copy invoice numbers to new id column (./script/console)
a = Invoice.find (:all)
a.each do |li|
li.update_attribute(:id_bc, li.context_number)
end
8) Remove the autoincrement from original id (mysql prompt)
ALTER TABLE `lotus_development`.`invoices` MODIFY COLUMN `id` INTEGER DEFAULT NULL;
9) Add the autoincrement to the new id (mysql prompt)
ALTER TABLE `lotus_development`.`invoices` MODIFY COLUMN `id_bc` INTEGER NOT NULL AUTO_INCREMENT,
DROP PRIMARY KEY,
ADD PRIMARY KEY(`id_bc`, `id`);
10) Change the old id to id_old(mysql prompt)
ALTER TABLE `lotus_development`.`invoices` CHANGE COLUMN `id` `id_old` INTEGER NOT NULL DEFAULT 0,
DROP PRIMARY KEY,
ADD PRIMARY KEY(`id_bc`, `id_old`);
11) Drop the old id as primary key(mysql prompt)
ALTER TABLE `lotus_development`.`invoices` CHANGE COLUMN `id_bc` `id` INTEGER NOT NULL DEFAULT NULL AUTO_INCREMENT,
DROP PRIMARY KEY,
ADD PRIMARY KEY(`id`, `id_old`);
12) Add the new id as primary key(mysql prompt)
ALTER TABLE `lotus_development`.`invoices` CHANGE COLUMN `id_bc` `id` INTEGER NOT NULL DEFAULT NULL AUTO_INCREMENT,
MODIFY COLUMN `id_old` INTEGER DEFAULT 0,
DROP PRIMARY KEY,
ADD PRIMARY KEY(`id`);
The invoice data should now look like this (sample)
+------+--------+-------------
| id | id_old | created_at | quote_id | note | printed_remark | first_printed | print_discount | date_payable | care | context_number |
+------+--------+-------------
| 5780 | 5780 | 2007-06-16 12:29:19 | 3058 | NULL | NULL | 0 | 0 | NULL | 1 | 5780 |
| 2897 | 5776 | 2007-05-24 13:21:18 | 3065 | NULL | | 1 | 0 | 2007-06-25 | 1 | 2897 |
+------+--------+-------------
top is a new record and bottom is an old record - notice that new id now has the same value as the context number - context number left for compatablilty
This is an example console script to create a new table from existing data
a = Invoice.find(:all)
a.each do |li|
count = 0
li.quoted.line_items.each do |b|
count = count + 1
d = Delivery.new
d.save
d.update_attribute(:quote_id, li.quote_id)
d.update_attribute(:delivery_no, li.id)
d.update_attribute(:invoice_no, li.id)
d.update_attribute(:line_item_id, b.id)
d.update_attribute(:line_item_no, count)
d.update_attribute(:line_item_sub, li.quoted.line_items.size)
d.update_attribute(:total_line_items, li.quoted.line_items.size)
d.update_attribute(:created_at, li.created_at)
b.add_invoice(li)
end
end
