short thoughts on D (like my twitter)

Nick Sabalausky a at a.a
Sat Jun 11 04:33:45 PDT 2011


"Adam D. Ruppe" <destructionator at gmail.com> wrote in message 
news:isu59p$6sd$1 at digitalmars.com...
> Nick Sabalausky wrote:
>> But I do have something that just happens to arguably be a lot like
>> a blog and uses a blogging engine ;)
>
> Gah, only weens use blogging engines!
>
> I tend to just write my stuff as plain html files (like you can see
> here). Sometimes I'll factor out common things, but I usually
> don't venture far from plain text.
>

Heh, I have no idea what a "ween" is. I gotta (partially) agree though, I've 
yet to find a blogging engine that I'm particularly happy with. The main 
reason I didn't want to go with plain HTML though was because that makes 
creating and updating navigation a pain. Maybe something like Ddoc could 
take care of that, though. But I also like allowing comments (with captcha), 
because then I actually get occasional feedback. And some people do like RSS 
(more below...).

Of course, as you can see, it wouldn't take many features to make me happy. 
And heck, I don't really even *need* the ability to update through a web 
interface (although that does make it easier than reaching for my ftp app 
and updating a bunch of files). So it would probably be pretty easy to just 
make something myself that I'd be happy with. And I've been thinking about 
doing that. But even as simple as it would be, it's just one more thing on 
top my pile of pet projects that's already probably big enough for three 
lifetimes...

>
> On the feed issue, that's something that doesn't bug me either -
> I just keep a list of sites I like in my brain and check them
> whenever I have nothing better to do. This perhaps only works
> for me because I read so few sites!
>

I've tried out RSS feeds before, but ended up never really getting any use 
out of them. I think I'm in the same boat as you. These D NGs are about all 
I care about being up-to-date on, and I already check them directly anyway.

Of course, the ironly is despite never using them, I've actually implemented 
RSS feeds for two different paid jobs (They were surprisingly easy). In 
fact, I seem to have a pattern of occasionally winding up working on things 
that I don't personally use: I've worked on a WAP/WML site (remember those?) 
and dabbeld a little in SymbianOS dev with C/C++ and J2ME without having 
ever actually owned a cell.

Anyway, I do like to at least provide an RSS/ATOM feed since it is useful 
for some people.

>
> Some quick commentary on IFTI:
>
> I actually discovered this by accident. Of course, I use IFTI
> all over the place, like most D programmers probably do.
>
> But, since the T argument was a default one here, I often didn't
> specify it:
>
> int a = cgi.request!int("a");
>
> (Why use this instead of to!int(cgi.get["a"])? The request
> implementation checks both get and post.)
>
> Then, I started adding it, but still specified:
>
> int a = cgi.request!int("a", 100);
>
>
> One time, I just didn't write the template argument and it
> still worked!
>
>
> While it's a really mundane feature of D, I still felt a bit
> of "hey cool" when it worked.
>
>
>
> The to!enum was another thing I didn't expect. I thought it would
> do the same as casting an int, but it works from name, which is
> actually very cool. More user friendly, and that white listing
> aspect is also pretty useful.
>
> mysql.query("select * from users where " ~
>  to!string(cgi.request("field", Field.name)) ~
> " = ?", value);
>
>
> Building a sql string like that is fairly ugly, and normally, it'd
> be /completely/ insane. You're just begging for trivially easy
> sql injections.
>
>
> But, thanks to the enum acting as a whitelist, you actually can
> do that in D.
>
>
> (Note that while I'm putting this in the web.d directory and talking
> about cgi, lots of this stuff works on the command line too. Imagine
> an enum for command line flags - converting is easy, you can
> to!string one of the enums safely, you can list the arguments
> using reflection, and final switch() can be used to ensure you
> cover them all!
>
> D's enums have a lot of hidden treasures.)

Hmm, so basically: The surprises are pleasant ones. Reminds me of a certain 
other language... ;)





More information about the Digitalmars-d-announce mailing list