KBD

Keith Devens .com

Saturday, August 30, 2008 Flag waving
If we wish to count lines of code, we should not regard them as *lines produced* but as *lines spent*. – Edsger Dijkstra

Archive: March 10, 2002

← March 09, 2002March 11, 2002 →

Daily link icon Sunday, March 10, 2002

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?

Awesome rant from Julian Bond: "MS refuse to ship a PERL interpreter with XP and IE6. Quick, sue them for... ONE BILLION dollars! It's not fair they refused to ship a Python interpreter. Sue the bastards. There's no PHP interpreter shipped with XP. Call the lawyers. Back in the real world, they stopped shipping a JVM and licensing Java from SUN. So SUN sues them for 1 billion Dollars!... Can't SUN compete by just shipping better code, dammit? Macromedia seem to be able to manage this with Flash and Director, why not SUN?"

Via the DayPop Top 40, Wired: Accidental Genius. "What turns a good idea into the next insanely great thing? Inspiration, perspiration, and the law of unintended consequences."

You know, now that I've added comments to my site and have lost some degree of editorial control, I think I may participate in BlogSnob (please change your website design, it's too hard to read) or bombstickers one of these days.

Speaking of Google bombs, I think I'll add to the bomb that is Scientology.

Oh, and my only problem with doing the text ads is that I don't know that there's a way to remove myself from the system if I don't want to play anymore. So... I just sent an e-mail to the person behind BlogSnob.

Wow, GoogleWhack.com. "The search for The One"

I hate English... I hate it I hate it I hate it.

I'm all pissed. I missed Sarah Hughes' parade today because I overslept. At least I'm glad it was sunny today, considering they postponed it last time because of the weather.

Holy crap, MySQL is so hopelessly broken it's ridiculous. I want to do a fairly simple query that would be a piece of cake in Access that MySQL can't even do. And MySQL won't get subqueries until version 4.1 or so, and who knows when that'll be out. Roar. Looks like I'll have to do a whole bunch of queries to replace the one that I should be able to do.

Awesome, Hosting Matters now has an IRC channel. They rock.

← March 09, 2002March 11, 2002 →
August 2008
SunMonTueWedThuFriSat
 12
3456789
10111213141516
17181920212223
24252627282930
31 



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

Recent comments XML

new⇒Johnny Walker Blue Label

Wow, thanks for the scotch review​:D

Lagavulin and Laphroaig are​some of...

Keith: Aug 29, 3:35pm

Girls, please don't get breast implants

Wow, After all this time, the​comments on this page continue to​grow. It wa...

Ajeet: Aug 25, 2:36am

Generated in about 0.066s.

(Used 7 db queries)

mobile phone