December 17, 2003

Bulk view

Revised sacha/perl-training/suck-data-in

(defun sacha/perl-training/suck-data-in ()
  "Insert BBDB records for all the Perl trainees."
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward "^\\([[:digit:]]+\\)" nil t)
    (let ((data (split-string (buffer-substring-no-properties (line-beginning-position) (line-end-position)) "|"))
          record)
      (setq record
            (bbdb-create-internal (elt data 1) ; Name
                                  "PLDT" ; Company
                                  (elt data 2) ; E-mail
                                  nil
                                  nil
                                  (concat "Perl training 2003.12.17 - 2003.12.19; " (elt data 3))))
      (bbdb-record-set-aka record (list (concat "pldt" (elt data 0))))
      (bbdb-change-record record nil))))

Elisp code to insert all

Data is of the form

number|Name|e-mail|Expectations
(defun sacha/perl-training/suck-data-in ()
  "Insert BBDB records for all the Perl trainees."
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward "^\\([[:digit:]]+\\)" nil t)
    (let ((data (split-string (buffer-substring-no-properties (line-beginning-position) (line-end-position)) "|"))
          record)
      (bbdb-record-set-aka
            (bbdb-create-internal (elt data 1) ; Name
                                  "PLDT" ; Company
                                  (elt data 2) ; E-mail
                                  nil
                                  nil
                                  (concat "Perl training 2003.12.17 - 2003.12.19; " (elt data 3)))
            (list (concat "pldt" (elt data 0)))))))

Extracting the trainees’ files and packaging them

Shell scripting to the rescue!

# Zip their work up
for DIR in *; do ( cd $DIR; zip perl-day1.zip * ); done

# Realize that I have to get rid of the archives temporarily because
# I might want to insert all the files into a buffer, so back it up first
tar zcvf archive.tar.gz $(find -name \*.zip)

# Remove all the zip files
find -name \*.zip -exec rm {} \;

Extracting all the mail addresses from the programs

grep -ri 'mail' * -A 10 -B 10 | less

This displays enough context information around the data so that I can
grab it easily.

Project ideas

Rating system – they’ve got this already

Perl focus

- Reading source code, testing, adapting software to their own needs
- 4 programmers

Stuff at [[../learn/perl/training/day1]] so far

Oh no, it’s 12:05 and I haven’t even started on Real Text Processing…

Teaching.Perl