[philiptellis] /bb|[^b]{2}/
Never stop Grokking


Friday, November 14, 2003

Self extracting tarball

install_tar.sh:
   #!/bin/bash

   skip=9
   # blah blah blah
   tail -n +$skip $0 | tar jxvf - | (while read a; do echo -n "."; done; echo;)

   exit
   __LINE_8_END_OF_CODE__

and then cat whatever.tar.bz2 >> install_tar.sh

voila, you have a self extracting tarball. Don't forget the exit just before the __LINE_8_END_OF_CODE__, and make sure that that *is* the last line of your shell code.

set skip to the line where your tar.bz2 data starts.

Wednesday, November 12, 2003

Thoughts on MovableType

[cloned from my livejournal]

So, after having used MT for a while, and reading everyone's blogs, and listening to cribs, I'm finally ready to write something on it. Here goes.

On the whole, it's a nice tool, and yes, it does cut down on the work required to publish sites. Once mastered, MT can prove to be a very useful CMS... but... I think it's too cumbersome to customise. Anyone who's tried editing their templates will concur.

So, what do I like and what do I not like.

I like the fact that MT, and most CMSes for that matter, take away the need to write a lot of HTML. A poster can concentrate on content, and forget about presentation. Anyone not familiar with HTML will love this. The new entry screen is quite simple and straightforward, and has a help button associated with every field. I think that's a good idea, but then I did do the same for the reviewer interface in the conference management system :)

Another thing I like is the ability to save an entry without publishing it yet. One is well aware of how many times one has lost a long post because `the browser just closed'. Well, whatever the reason for the browser closing, the Save button down there ensures that we don't have to redo too much work.

Hmm, what else do I like? Trackback is a nice feature, but I haven't used it too much. I guess it isn't too useful when I'm doing TBs on myself. Then there's the look and feel of the management interface, yeah, nice, docs are nice too...

Now, my cribs.

Where the hell is the Access Control? Vivek Nallur has a post on his private blog that shows how to edit another author's permissions. I don't know about others, but if I were deploying MT in a multi-author environment, I'd like some kind of access and work-flow control. Working on trust alone may be fine for the authoring process, but it just does not work at the admin level (think CVS).

Then there's the oh-so-cumbersome template editors. When I said the new entry interface was easy to use without knowing HTML, I meant exactly that. It's easy to use if you don't know HTML, and only if you don't know, or at least don't need to use, HTML.

The moment you need to edit code of any kind, HTML text boxes are a pain. Editing code requires a code editor. Even if it's just notepad, the fact that a TAB inserts a TAB rather than taking one to the next field makes a huge difference. Then, there's search and replace, and of course, a nice large code editing window. Ok, I'm cribbing. In reality, you can link the template to a local file, and edit that instead... but then file permissions come into play, and that's another headache that I won't go into just yet.

Ok, so you're done with editing code, now you need to rebuild the pages. That pops up a new window, from which you select which pages to rebuild. This is fine if you're just doing it once a week, or even once a day, but try doing it once a minute and you'll know what a pain it is. Frankly, I like to be able to just edit my stylesheet and hit refresh on the browser to see what it looks like.

So, finally, I come to file permissions. When creating a new blog, MT requires the new blog's directory to already exist. So, just create a directory under your web path, and tell MT about it right? Wrong. Since MT needs to write to that directory, it needs to either be owned by MT, or in the same group as MT, with group write permissions, or world writable. The first case is not possible unless you are the MT user or root - these are the only two users who can create directories owned by MT. To enable the second option, you must be in the MT group... and so must all other authors... which leads to the same problem that we have with world writable directories.

Agreed, this isn't such a big problem, as these folders only contain generated files. The real data is stored in a database owned by MT and writable only by MT. Still, I'd like to see MT be able to create blog subdirectories on its own, and provide a sensible default for a new blog path.

Yes, I do have a small wishlish, and I might at some point fix some of these issues with MT - if time and licences permit. MT is not distributed under a Libre licence, so any changes I make will remain in house only, or sent back to MT. Right now I don't think I should even look at the code, because if it does in any way influence future code that I write, there could be problems.

Sunday, October 05, 2003

Generating random names

Had to generate a lot of names and emails for a project I'm working on.
Aborts, Weidman weidman@shock.net
Abreast, Periclean periclean@tier.org
Adequately, Misconstrues misconstrues@quartets.net
Antibody, Dodged dodged@sparking.org
Arteries, Shiver shiver@perpetual.net
Attired, Cindy cindy@became.net
Awaiting, Gillette gillette@crimson.com
Babying, Billed billed@arithmetical.net
Bacilli, Versailles versailles@mervin.net
Belabors, Humoring humoring@available.org
Benedikt, Microarchitecture microarchitecture@cezannes.com
Bites, Transposition transposition@husker.com
Botanical, Caboose caboose@uselessness.net
Brimful, Trickiest trickiest@mcgowan.org
Bunters, Prosper prosper@wacke.org
Buttressing, Revolutionize revolutionize@pandas.com
Cashew, Crave crave@avalanches.org
Chagrin, Debussy debussy@pistol.net
Commitments, Incapacitate incapacitate@westinghouse.org
Concentration, Greetings greetings@subspace.org
Counterexamples, Screwing screwing@bellicosity.com
Counters, Bryce bryce@simplicity.net
Cowered, Coasting coasting@accessing.org
Cultivate, Sophias sophias@sherwin.com
Demanded, Prediction prediction@transplanted.com
Dent, Subprocesses subprocesses@international.com
Dinghy, Rickets rickets@lexicographic.org
Dostoevsky, Fritz fritz@shoveled.org
Doughnuts, Arbitrariness arbitrariness@noon.com
Drip, Flatly flatly@subsegment.com
Enid, Bunter bunter@propagandist.net
Envious, Belonging belonging@nests.com
Epaulet, Wilder wilder@timers.net
Europeanizations, Crasher crasher@hews.com
Evokes, Confusions confusions@clap.com
Excusable, Filming filming@colonist.net
Fascinates, Gantry gantry@frisk.net
Fates, Regressions regressions@abides.net
Fiddle, Holiness holiness@unwrap.net
Fifteen, Francois francois@pithing.org
Finishers, Assenter assenter@prospered.org
Fleischman, Cocktail cocktail@perishable.net
Formants, Import import@flexibly.net
Freakish, Predominantly predominantly@checks.net
Glen, Obese obese@midrange.net
Greeted, Kneecap kneecap@fancifully.net
Grievance, Yellow yellow@loy.org
Guam, Herring herring@cobblestone.com
Hepburn, Felix felix@limitations.net
Highly, Pounced pounced@chirps.org
Homicide, Mute mute@vertical.net
Imagery, Athenians athenians@comforts.com
Incites, Dusk dusk@infighting.net
Industrialized, Viscous viscous@hoarsely.com
Input, Scale scale@jolla.org
Intellectuals, Raritan raritan@five.org
Joule, Farmyard farmyard@boisterously.com
Langford, Canberra canberra@forbearance.org
Leadership, Vibrate vibrate@rockaway.com
Librarian, Generic generic@hoff.com
Loopholes, Sequester sequester@fairchild.com
Makable, Avis avis@sprinkled.net
Marinade, Prominently prominently@stumps.com
Massachusetts, Angriest angriest@formatively.com
Milkiness, Marxism marxism@modulated.net
Mississippians, Teresa teresa@hike.net
Oligocene, Consenting consenting@ivy.com
Pavilion, Alertedly alertedly@anglo.org
Popish, Cicada cicada@very.org
Possessor, Hawks hawks@currently.org
Prepositions, Believers believers@condemnations.com
Pressings, Toad toad@sheriff.net
Refilled, Coarseness coarseness@poster.com
Ruined, Charity charity@qualifications.net
Rumpled, Blabbermouths blabbermouths@averaged.com
Scots, Gregory gregory@realest.org
Skillfulness, Entrenched entrenched@disillusionment.org
Slower, Mcmullen mcmullen@desirous.com
Snakelike, Arisen arisen@wakeup.org
Solids, Exertion exertion@encoded.com
Squabbles, Bridge bridge@piloting.com
Squinting, Catholicism catholicism@circumspect.net
Standards, Breakdown breakdown@bullseye.net
Starting, Unconditional unconditional@rooting.org
Stratify, Repudiate repudiate@assailant.net
Stupendous, Cochran cochran@wagner.net
Subgraph, Unfamiliar unfamiliar@hanoverian.com
Surpasses, Introspect introspect@sealed.com
Swallowed, Restlessly restlessly@padlock.net
Swallowing, Solidified solidified@unemployment.com
Taster, Calcutta calcutta@attractor.com
Thames, Limiter limiter@arterial.org
Tiresomely, Achiever achiever@glimpse.org
Tracers, Charlie charlie@busy.net
Unravels, Voided voided@bituminous.net
Unties, Conveyances conveyances@outbreak.net
Urinates, Balkiness balkiness@conveyances.net
Waltzes, Coulomb coulomb@quasar.net
Wiping, Foresee foresee@championships.com


I used /usr/share/dict/words as my wordlist - over 45000 words.
my @words = <>;
die "No wordlist" unless @words;
my $MAX = @words;

$dbh = DBI->connect("dbi:mysql:$db_name;host=$db_host", $db_user, $db_pass,
  { RaiseError => 1, AutoCommit => 0 })
 or die $DBI::errstr unless $dbh;

my $sth=$dbh->prepare(qq{INSERT INTO account (name, email) VALUES (?, ?)});
for my $i (1..100) {
 my $fname = $words[rand($MAX)];
 my $lname = $words[rand($MAX)];
 my $domain = $words[rand($MAX)];

 $fname =~ s/(\w+)/\u\L$1/;
 $lname =~ s/(\w+)/\u\L$1/;

 chomp($lname, $fname, $domain);
 my $email = lc "$fname\@$domain." . (qw(com net org))[rand 3];

 $sth->execute("$lname, $fname", $email);
}
The program took 0.1036 seconds to execute.

Wednesday, January 01, 2003

Categorical Index

Preface

System level hacks

Databases

Web stuff

Programming

Ideas and Applications

Hacks

...===...