dannyman.toldme.com


Technical

lnk.to Progress Modest

I keep messing with how the database table should work, and I had a hard time figuring out how to create a new key within a class referring to an object that I am hash-tieing to the lnkto table with Tie::DBI, but the good news is, that I’ve actually gotten started. It is a little frustrating at the moment, but the knowledge that I am building a class that will make writing the actual web site so much easier is good for morale.

Oh, and I have tuned the rewrite rule so that it will be easier to add static HTML and additional cgi files to the site, because only URLs that match \w+ will get redirected:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule   ^/(\w+)$ /redirect.cgi?key=$1
    </IfModule>

So:
http://lnk.to/foo will be handled by redirect.cgi?key=foo
http://lnk.to/foo.html will read foo.html

Back to table concerns …

# DROP TABLE lnk;
CREATE TABLE lnk (
-- Unique numeric ID (auto-increment)
  `id` INT UNSIGNED NOT NULL auto_increment,
-- The URL key.  Not unique perse, but would be unique per chainId
-- Can be null, when we're first creating the Lnk.
  `key` VARCHAR(16),
-- The payload.  Definately not null!
  `url` TEXT NOT NULL,
-- "publication date" of an item
  `pubDate` DATETIME,
-- date item added to Lnkto
  `addDate` DATETIME NOT NULL DEFAULT 'NOW()',
-- HTML TITLE tag but should be user-editable
  `title` VARCHAR(128),
-- META description
  `description` TEXT,
-- We'll eventually handle "add from feed" type chains ...
-- 'hilite' is an idea where you could hilite a Lnk into your own chain
-- ... basically a reference thingus
  `source` ENUM('feed', 'manual', 'hilite') DEFAULT "manual" NOT NULL,
-- Which chain we belong to.  For now, only 0
  `chainId` INT UNSIGNED DEFAULT 0 NOT NULL,
-- Numeric ID of "author" which will ref another table, with author
-- name, email, etc.  Can be useful for "tipping" and some day crafting
-- suggested reading
  `authId` INT UNSIGNED DEFAULT 0 NOT NULL,
-- For classic lnk.to, we like to keep score, which is roughly +1 per
-- clickthrough, divided by 2 every night.
  `score` FLOAT UNSIGNED DEFAULT 1 NOT NULL,
  UNIQUE (
    `id`
  )
);

It is a work in progress.

Oh, and Firefox “tab sessions” rock, because you can create a “dev” window with a bunch of appropriate tabs in there, and then save that tab set in a session when you go home, and reload it the next day. A great complement to the screen command!

Another note, it may be a very healthy work style to comment on progress here in the morning, and let the hindbrain think about things during the day. I do the dev work “after work” at the office, after 3pm, when my shift formally ends. (Though, I’ll still kick the occasional work ticket when I need a break.)

Read More

Next:
Previous:
Categories: Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading