KBD

Keith Devens .com

Friday, July 4, 2008 Flag waving
And we know that in all things God works for the good of those who love him, who have been... – Paul (Romans 8:28)
← Entry 1599Entry 1601 →

Daily link icon Sunday, March 10, 2002

Entry 1600

Adam: "I'm running into all sorts of conceptual problems with my custom weblog code. All due to my weird editing requirements that don't map well to RDBS tables." ... "My editing weirdness is that I like to play around with a whole day's worth of entries at once, possibly rearranging or combining them. Which wreaks havoc with all the permalink systems I've come up with so far."

What's the problem? This stuff seems easy. Rearranging is easy. Just have an "order_in_day" field. The interface is kind of a pain: do you have numbers you fill in and can change, or do you have up and down arrows that will let you move a post within the day? In the past I've chosen the latter, but I've done it and it's not too hard. There's your rearranging.

As for combining two entries... the easiest way is to just put all the text for one of the entries in the other, and just make the deleted entry a "pointer" somehow. Either just put the id number of the entry it points to in the text of the entry, and write code to recognize that and get the correct entry, or have a "point_to" field, and recognize that when the text field is null (or when the point_to field isn't null), get the "point_to" entry instead. None of your links break. Does this work?

And by the way, if you wind up combining more than once, you can still keep to a scheme where there's never a "chain" of pointed entries. In other words, there's only one level, so when retrieving an entry, you can say something like: "select * from entry where entry_id = coalesce((select point_to from entry where entry_id = $entry_id), $entry_id)" (but oh yeah, this won't work in MySQL). That's just how to do it in one query (which I think is correct), though it's probably not the best way. It's probably just best to do it in code and only go back to look another entry if the first entry is a pointer (and that way you can actually return a 302 code and redirect to tell spiders or whoever that the posts have been joined).

Don't use flat files. Databases are meant for this kind of stuff. You get searching for free, it's much much less work, and it's much much faster to use a database.

I guess that's about it for now. Well, one more thing: "It's kind of funny seeing all these sites enabling comments, and then seeing "0 comments" straight down the page. I'm not sure why I think it's funny, but it's probably meant in a mean way. Which means that it's about time for The Conversatron to be live so I can just be mean on there instead." Are you talking about me? Smiley I've thought the same thing for awhile, but then I ran into a few times when I wished I would have comments on my site (this was one of them), so I took an hour and a half and wrote the feature. It doesn't hurt being there for the times I want it, and if I never used it I could do away with it.

And... what's the Conversatron?

← Entry 1599Entry 1601 →

Comments XML gif

Adam Vandenberg wrote:

The Conversatron is the "humor" site that I co-program and co-write for in my copious free time.

It's currently down, as the Conversatron Curse has taken another hosting company out of business.

With any luck it should be back up this week or next.

∴ Adam Vandenberg | 11-Mar-2002 2:33am est | #59

anonymous wrote:

Congratulations, you're a Googlewhack.
That being, Googlewhack Conversatron.

∴ anonymous | 20-Apr-2002 11:49pm est | #258

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

new⇒Court rejects death penalty for raping children - Yahoo! News

Keith is not a person. I have this​on good authority. He's actually a​very,...

M. Bean: Jul 4, 2:05am

Girls, please don't get breast implants

> And no, you will not be receiving​a picture.

:-(...

Keith: Jul 2, 6:05am

Javascript clone function

This is a clever way to clone an​object if you are using YAHOO UI.​Same tec...

Antonio: Jul 1, 12:47pm

I hate Norton Antivirus

Oh just one other thing norton is​great at keeping people out of your​compu...

kevin.sands: Jul 1, 12:50am

Terminator 3 was awful

I think the biggest reason why T3​totally blew was because Edward​Furlong g...

76.167.172.64: Jun 29, 3:06am

Generated in about 0.111s.

(Used 8 db queries)

mobile phone