3 ms·
Call me crazy, but html is a great way to track time in plain text. That was actually one of the use cases that opened my eyes to the power of html over markdow
by bachmeier 6y ago
Call me crazy, but html is a great way to track time in plain text. That was actually one of the use cases that opened my eyes to the power of html over markdown as a plain text format. One example:
<div><li class="start">202102010845</li><li class="end">202002010930</li></div>
You can argue that's ugly. And you're right, if you open it in a text editor. Thing is, you can use a browser to display it pretty darn nicely. It has all the advantages of plain text, but one massive additional advantage - you can use JS to work with the DOM to do all your queries and calculations in a few lines of code. HTML can be verbose at times, but it doesn't really matter if you use text snippets.
This is not intended to take anything away from this project. I'm just saying there's a powerful alternative that doesn't require the writing of a special processor.
- onion2k 6y agoyou can use JS to work with the DOM to do all your queries and calculations in a few lines of code There's nothing wrong with the approach you took, and there's a lot to be said for just getting stuff done, but I suspect knowing a tool for handling HTML is the reason you're using HTML as a data format rather than any specific virtue of HTML. Rather than use something 'better', you used something familiar. I see that a lot. I'd argue that you missed an opportunity to examine ways to store that specific time series data in a format that could do more stuff faster with the same level of effort, and an opportunity to learn something that is a bit more appropriate for the task. But, ultimately, you made something that works for you, and maybe that's more important.
- alpaca128 6y agoI'd just go for csv files then, which are trivial to process in any language.
- jotaen 6y agoAs an idea, you could consider to use HTML5 elements in order to make it more semantic. <dl> <dt><time>2018-07-07 14:54:39</time> - <time>2018-07-07 17:12:05</time></dt> <dd>Did this and that</dd> </dl> Native support for time ranges (e.g. through ISO8601 or a <range> element) might be coming soon in the HTML spec. Durations are already supported.