Live data from Hacker News

HTMLy: Databaseless Blogging Platform (Flat-File Blog)

github.com

41–50 of 66 posts

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#41
post #29

Never really understood why people try to avoid DBs? It's OK for a very basic pile-of-online-texts blog, but the moment you try to show whatever relation between blogposts (e.g. the related articles or the latest articles) you end up reinventing the wheel

Most blogs are small enough that caching all the content in memory and sorting/selecting is so cheap and simple it really makes no difference these days, and you gain simplicity.

My blog is flat file because I like to work on a version on my home server, editing stuff in emacs, commit to git and push an updated version atomically. Even if I continue writing at my current pace for the next 100 years, my current server would hardly notice having to re-read every single article.

As for reinventing the wheel, the code for pulling in the articles from flat files and slicing and dicing them simply by iterating over an in memory connection is so small and simple that there's hardly any wheel to re-invent.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#42

Earlier quoted context omitted.

Outside of "the bubble" the web is basically made of php and perl. Its like the dark matter of the internet. If you want to reach all they way down to the weekend dabbler, you really need to choose one of those 2, and of those 2, php seems more immediately accessible.

Sadly the web is made up of a lot of php code. Luckily this graph lets me sleep better at night: http://www.indeed.com/jobtrends?q=php&l=&relative=1

I think you'll find that graphs like that are meaningless. I work for an agency that does mostly PHP work, and we never advertise, because for common skills like PHP, recruiters and potential hires inundate us with calls every single day. I expect the very common skills like PHP are severely under-represented in ads for this reason. For less common skills, you need to advertise, as people won't know where to go.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#43
post #13

Earlier quoted context omitted.

If only Mark Karpeles had simply written mtgox in another language, there's no way he would have lost 750,000 bitcoins.

Wouldn't he have just recreated the same bug in another language? I think you are confusing a bug in implementation/code with the language.

I believe you're missing the dripping sarcasm.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#44
post #26

Earlier quoted context omitted.

It's not fair to compare to compare pure PHP and Jinja2. Twig is the PHP-equivalent of Jinja2, and it is an extremely well designed templating engine.

What's not fair about it when talking about PHP as a templating language? My point is that while PHP is often lambasted as a terrible programming language, people forget that its HTML templating part is even more abysmal. If you need to have a templating system in your "advanced templating language", this really tells you everything you need to know about its capabilities.

It's not fair because PHP came way earlier than Jinja2. Both Twig and Jinja2 could learn from its predecessors.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#45

The biggest problem with static blogs is the lack of comments. I see this project uses either facebook or disqus which is a solution a lot of people like. I prefer not to rely upon external comment-providers though, which is why I wrote my own self-hosted comment-server: https://github.com/skx/e-comments/

I use jekyll for my blog and looked for ways to integrate comments. I ended up with a simple solution: Provide a per-post unique email address where people can send comments to. The idea was then to manually process the comments and only put the most useful ones on the website. I wanted to think that the hurdle is very low. It's a bit higher than just entering text in a text box and clicking a button. But sending an…

I find that a very interesting solution, but I suspect I'd not use it in practice (to submit comments).

Moving away from the browser to my mail-client to compose things would distract me and cause me to be a little confused.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#46

The biggest problem with static blogs is the lack of comments. I see this project uses either facebook or disqus which is a solution a lot of people like. I prefer not to rely upon external comment-providers though, which is why I wrote my own self-hosted comment-server: https://github.com/skx/e-comments/

It's interesting that we're still writing such applications by hand. One thing that interested me when I learned about CouchDB was the possibility of skipping that and just exposing the database to the browser, with a few schemas and a couple of data validation functions configured. After all, that system is almost a dumb HTTP storage mechanism.

Presumably that means that users can mass-scrape the submitted comments though? (Potentially allowing the email addresses users submitted to be harvested.)

Other than that it doesn't seem like an unreasonable approach.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#48
post #20

Replacing the database with flat files? We have gone full circle, haven't we. I can think of a lot of disadvantages with not using an actual database. What's the benefit of going back to flat files?

> What's the benefit of going back to flat files?

Edit in your editor of choice. Use your source control for edit history. Trivial to keep a separate instance to edit/test on, and push with rsync. Makes it trivial to treat the code and the content as one unit, so that e.g. if you change parsing of the articles, update the articles and need to revert, you don't need to mess with reversing database updates separately).

Fewer moving parts. For a typical modern blog with comments farmed out to Disqus or similar, the data is likely to be tiny and very static. My blogs data, for example, is about 8.3MB of text that changes maybe a couple of times a month, so the 1-2 second cost of reading every article I've ever written in from individual files on disk is hardly an issue.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#49
post #44

Earlier quoted context omitted.

What's not fair about it when talking about PHP as a templating language? My point is that while PHP is often lambasted as a terrible programming language, people forget that its HTML templating part is even more abysmal. If you need to have a templating system in your "advanced templating language", this really tells you everything you need to know about its capabilities.

It's not fair because PHP came way earlier than Jinja2. Both Twig and Jinja2 could learn from its predecessors.

Your rebuttal would only be correct if the two following propositions were both true:

- software cannot evolve

- the notion of sanitizing input/output has magically appeared out of thin air in the last 15 years (I'm pretty sure that Perl Mason could do that when it first came out, around the same time PHP did)

Since clearly neither is, attributing the current state of affairs to bad technical decisions early on followed by inertia is the most logical explanation.

It's like comparing Java and C#: C# has managed to regularly introduce interesting features, while Java has stagnated for a long time. Of course it's easier when you start from scratch, but especially for simple features like escaping, which I highly doubt would require major changes in architecture, there is simply no excuse.

Re: HTMLy: Databaseless Blogging Platform (Flat-File Blog)

#50
post #44

Earlier quoted context omitted.

What's not fair about it when talking about PHP as a templating language? My point is that while PHP is often lambasted as a terrible programming language, people forget that its HTML templating part is even more abysmal. If you need to have a templating system in your "advanced templating language", this really tells you everything you need to know about its capabilities.

It's not fair because PHP came way earlier than Jinja2. Both Twig and Jinja2 could learn from its predecessors.

Sure. But it /is/ a fair comparison, _in this discussion_, as essentially I did say - rightly or wrongly - in the grandparent to your original post that PHP was a reasonable templating language.

The fact is that it has been surpassed by Twig, Jinja2, Cheetah, and many other templating languages - which rather proves the point of @mercurial who you're arguing with, which is that PHP is not a great language to use for templating.

And, to be honest, I agree with him, actually. I'd be very very hard pushed to start a new project in PHP. Python+Jinja2 is a much more powerful and sane way to work.

However, as a templating language, for basic blogging stuff, if you're careful, PHP can be made to work, and, on a cheap host, may end up being easier to deploy than a technichally better system.

Just as BASH can sometimes be an easier solution to some problems than python or perl or whatever else. I'd never claim that BASH was a nice language to work in, but for very simple scripting, it can end up being an easier automation system than the alternatives.

Post reply on HN