News for hackers. Stuff that matters.
Re:What Is Wrong with TOML? by dagw on Wednesday September 13, 2023 @06:57AM (#37495062)
One of the more interesting config formats I've come across was an application that used an Excel file. Once you get over the horror of such a terrible decision, it was actually a quite interesting choice that allowed a fair few advantages. First of all each config subcategory was on a separate sheet making easy to navigate and find what you where looking for. You could use formulas to relate different config options (If you wanted A to be 20% of B you just set that in a formula). You could use drop-down for fields where there were only a limited number of valid values. You could include as much comments and documentation as you wanted (including diagrams and images) as long you only wrote in unused cells. And finally, my favourite, when configuring colours, instead of typing in RGB or hex values you simply changed the colour of the cell to the colour you wanted.

Now I would obviously never ever recommend doing this, but it was certainly an interesting and eyeopening experience.

Re:What Is Wrong with TOML? by fluidcruft on Wednesday September 13, 2023 @07:37AM (#37495376)
At my co-op decades ago we used to use Excel "templates" as masters to generate/maintain text config files (and iirc a few C headers). You would save as text to make it usable. The grid layout, ability to highlight/color/border/style etc and use formulas and plot was very helpful.
Re:What Is Wrong with TOML? by ics on Wednesday September 13, 2023 @08:50AM (#37496072)
Underrated technique. I’ve used it similarly to generate scripts and it works great when used with care (error checking generally must happen at a different stage).
Re:What Is Wrong with TOML? by btreecat on Wednesday September 13, 2023 @07:11AM (#37495164)
That's just begging to be an actual database.

Imagine if you said everything with SQLite instead of Excel, and all of a sudden your just talking about structured config in a database. Not new, not crazy, and generally a decent practice.

Re:What Is Wrong with TOML? by dagw on Wednesday September 13, 2023 @07:18AM (#37495219)
The big difference is that every Windows computer (in a professional environment) comes with a very nice GUI tool for easily editing Excel files. A tool that basically everybody know how to use. The same cannot be said for SQLite.

SQLite is great for storing application state and config options set from within the app, but it is a pretty terrible format for end users to edit.

Re:What Is Wrong with TOML? by johannes1234321 on Wednesday September 13, 2023 @10:01AM (#37496885)
While I'm not sure I'd be happy about "end users" to edit the Excel files as config. Somehow they get the cells mixed up and you get utter mess. And then excel confuses some value for a date and stores some other mess ...

For a somewhat trained audience however it can be quite interesting for some specific problem domain ...

Re:What Is Wrong with TOML? by eternityforest on Thursday September 14, 2023 @01:04AM (#37505176)
Why doesn't Microsoft just add SQLite to Excel, so your formulas can query it?
Re:What Is Wrong with TOML? by btreecat on Thursday September 14, 2023 @08:04AM (#37507807)
Because how else would they push MS Access?
Re:What Is Wrong with TOML? by btreecat on Thursday September 14, 2023 @08:07AM (#37507826)
>SQLite is great for storing application state and config options set from within the app, but it is a pretty terrible format for end users to edit.

I think you are conflating the file with the workflow. A proper UI is the solution to making something not "terrible for end users to edit".

Re:What Is Wrong with TOML? by harperlee on Wednesday September 13, 2023 @07:22AM (#37495251)
Well, that's a complete apples-to-oranges proposal with completely different requirements.

With the original solution, you have an autocontained file that virtually any user knows how to edit, structure, expand, version, email, compare, discuss...

The level of user knowledge that you need for a similar solution based on a standalone SQLite file that you can version is another different world, e.g. to relate two values you would need to perhaps create a view or a trigger. And even with the most knowledgeable user you would still lack functionality such as simply pasting an image as a means of documentation and be able to see it, or WYSIWYG colors.

Re:What Is Wrong with TOML? by sofixa on Wednesday September 13, 2023 @08:20AM (#37495745)
> version, compare

Gonna have to disagree with you here. Very few people know how to version, compare, let alone if there are multiple collaborators, Excel files. Is there even a decent way of doing that outside of Excel Online / Google Sheets?

Re:What Is Wrong with TOML? by harperlee on Wednesday September 13, 2023 @02:42PM (#37500106)
Well I've seen a great deal of people comparing two Excels by quickly alt-tabbing, and doing Sheet1!A1=Sheet2!A1 comparisons in a third sheet, and dragging the formula.

Yes, that's horrible. But millions of people can autonomously resort to this, and they would be incapable of doing anything with a SQLite file.

Same with version control: you just add _v17_20230909_final to the name. Yes, it's horrible. Yes, it's buggy. But yes, it also runs the world.

Re:What Is Wrong with TOML? by btreecat on Thursday September 14, 2023 @08:03AM (#37507793)
>But millions of people can autonomously resort to this, and they would be incapable of doing anything with a SQLite file.

Are you trying to suggest that either you can't do that with sqlite, or that people didn't require training to do this in Excel?

Re:What Is Wrong with TOML? by harperlee on Friday September 15, 2023 @03:19AM (#37519628)
harperlee: open list of affordances that an average user comfortably identifies with an Excel file, not really with sqlite

sofixa: version and comparison is not really supported in Excel

harperlee: agree that software support is not there, but in practice average user knows how to do it and is quite comfortable doing it in Excel

btreecat: sqlite also has filenames and you can learn how to use it

harperlee: agree on the filename, Excel files and sqlite files are externally, opaquely versionable in the same way. the point about people learning is moot though, average user already knows Excel because they were forced to in the past, but does not have the time to learn new things.

Re:What Is Wrong with TOML? by btreecat on Thursday September 14, 2023 @08:02AM (#37507774)
Fundamentally they need a tabular data store. Most everything else is a nice to have/usability point.

SQLite is also an auto contained file. There are similar tabular GUI tools that could let you interact with sqlite using a similar workflow. Users knowing that thing is not inherent, they had to be trained on it, and they can be retrained as they will be for other workflows and business tools.

Remember, you still need an external app (Excel) to open it's files, the files themselves are just data, exactly like sqlite. So you could just make an excel plugin to interface with SQLite.

SQLite is as version-able as an excel file, as in not very with standard tools.

Why are you pasting images into excel? Doesn't matter, sqlite handles that fine actually. https://www.sqlite.org/fasterthanfs.html

The main argument against sqlite is that you would need to build an interface or figure out how to train folks on existing tools. That's not a huge argument against it in my experience, it's a strong social/political one in many orgs but rarely a technical issue.

Re:What Is Wrong with TOML? by harperlee on Friday September 15, 2023 @03:26AM (#37519691)
> The main argument against sqlite is that you would need to build an interface or figure out how to train folks on existing tools. That's not a huge argument against it in my experience, it's a strong social/political one in many orgs but rarely a technical issue.

The design of a solution needs to look into way more requirements than just the technical ones, time and money being 2 big ones. I think most of the HN readers would agree that you could end up building an interface with most of the Excel functionality, even more perhaps, on top of sqlite, and have your particular group of users trained on it.

Re:What Is Wrong with TOML? by michaelbuckbee on Wednesday September 13, 2023 @07:16AM (#37495205)
Now I just want a spreadsheet style front end to SQLite and I'm nerd sniped into trying to figure out how to do formulas (triggers I suppose).
Re:What Is Wrong with TOML? by speed_spread on Wednesday September 13, 2023 @07:55AM (#37495521)
Congratulations, you're about to reinvent MS Access / DBase / FoxPro... 30 years later.
Re:What Is Wrong with TOML? by michaelbuckbee on Wednesday September 13, 2023 @08:22AM (#37495775)
That's an excellent point.
Re:What Is Wrong with TOML? by speed_spread on Wednesday September 13, 2023 @08:40AM (#37495958)
I'm sorry for the initial sarcasm, it would actually be pretty cool to have those type of apps back. With everything going web-first nowadays, you could take inspiration from SQLite's own SCM, Fossil, that can run both as a CLI or a Web server.
Re:What Is Wrong with TOML? by eternityforest on Thursday September 14, 2023 @01:38AM (#37505381)
I've been thinking it would be cool to build something like this. What gets me stuck is version controllability and backups.

I think ideally you'd want multiple backends, either SQLite, or flat files that are Git/SyncThing friendly.

I was even thinking the file format could have a file UUID and record timestamps, so that if you put a different version of the same file in the same folder(Like with a SyncThing conflict file) it would give you a merged view, with newest-record-wins logic.

Formulas I think would be the easy part. Just write it all in Python and use one of the many Excel compatible formulas implementations, and just make sure all changes went through the app.

Maybe you could even have a REST API to build other things on top of it.

The web frontend wouldn't be too hard, it could just be a Vue3 app with an HTML table element.

Then you could have a cell type who's value was a query, which would embed a DB browser list widget in the cell, and that cell type could have the option to bind its selected row to another cell.

Like VB+Excel+Access+My fork of Freeboard with inputs in one!

Re:What Is Wrong with TOML? by masklinn on Wednesday September 13, 2023 @08:17AM (#37495708)
For the most simplistic row-wise formulas, sqlite has generated columns.

I’d assume the issue will be that an sql table is not free form, you can’t randomly decide to write in some other cell.

Re:What Is Wrong with TOML? by lucumo on Wednesday September 13, 2023 @07:06AM (#37495130)
Were there any downsides? Because this sounds kind of awesome.
Re:What Is Wrong with TOML? by dagw on Wednesday September 13, 2023 @07:14AM (#37495189)
Once you got used to it, honestly not really, other than needing Excel (not a huge deal since it was a Windows only application). I've no idea what the config parsing code looked like, but with the right library I doubt it was worse than any other non-trivial config parsing code. Mainly it just felt very wrong to my Unix, everything must be a text file, brain.
Re:What Is Wrong with TOML? by throwaway290 on Wednesday September 13, 2023 @09:42AM (#37496634)
Well, xlsx is just a zipped dir of text (XML) files, so you can think of it as sort of following the .d pattern...
Re:What Is Wrong with TOML? by kagevf on Wednesday September 13, 2023 @11:07AM (#37497770)
> the .d pattern

What's that? I ddg'd it and I got a bunch of hits for regex \d ...

Re:What Is Wrong with TOML? by throwaway290 on Wednesday September 13, 2023 @11:17AM (#37497903)
conf.d, init.d
Re:What Is Wrong with TOML? by kagevf on Wednesday September 13, 2023 @11:46AM (#37498285)
Ah, got it, thanks!
Re:What Is Wrong with TOML? by urinotherapist on Thursday September 14, 2023 @01:06AM (#37505183)
Re:What Is Wrong with TOML? by kagevf on Thursday September 14, 2023 @06:11PM (#37515500)
That was an informative read - thank you!
Re:What Is Wrong with TOML? by arethuza on Wednesday September 13, 2023 @10:56AM (#37497589)
There are some pretty awesome libraries for reading and working with Excel files - Aspose.Cells being one I used for years - basically a headless re-implementation of most of Excel usable via an API.
Re:What Is Wrong with TOML? by sowbug on Wednesday September 13, 2023 @02:27PM (#37499898)
Never thought I'd get a chance to tell this story.

Early 1990s, college internship. The company did presentations for clients, like many do. They had an unusual way of presenting data that required using actual protractors to draw circles and curves, with pencil, on otherwise computer-generated charts. They read numbers from Excel spreadsheets and plotted them on paper.

I was shocked, to say the least. I proposed writing a program that read Excel spreadsheets and emitted the graphics. They loved the idea, especially from a summer intern.

So I wrote a letter to Microsoft asking for documentation of the Excel file format. A week later I got a thick envelope with a photocopied manual completely describing the format. I remember the word BIFF throughout. I wrote the program, it worked great, and I even negotiated a hefty lump-sum payment to sell it to them at the end of the summer.

It left me with a very positive impression of Microsoft as a developer-friendly company. Makes sense; developers are their platform's customers, and they're good at serving their customers.

Re:What Is Wrong with TOML? by andrew_eu on Wednesday September 13, 2023 @11:02AM (#37497686)
For better or worse I created a very similar system, but using Google Sheets instead of Excel files and fetched with the GSheets API. In that case the configuration was gigantic (many of the configuration values were product-decisions, and it ran in hundreds of different environments with different tweaks), so the tabular structure made navigating things very natural. It also had the advantage of structurally highlighting how environments differed. Doing it with Google Sheets came with some extra nice benefits: online sharing, versioning, access control down to specific ranges, etc.

Basically every engineer who joined the team thought it was a unforgivable blemish on the system, yet it survived a few years with no major issues, long enough for the team to build an internal backoffice and port the whole sheet structure into a proper CRUD API.

Re:What Is Wrong with TOML? by hot_gril on Wednesday September 13, 2023 @03:21PM (#37500557)
Biggest downside I've discovered by doing this is that there's no great way to diff separate versions of one sheet. Best I've done is export to CSV and use a generic text diff.
Re:What Is Wrong with TOML? by smitty1e on Wednesday September 13, 2023 @07:04AM (#37495114)
.xlsx and openpyxl For The Win!

Cross-platform; copious spreadsheet applications; no-one needs training; scales.

Re:What Is Wrong with TOML? by zelphirkalt on Wednesday September 13, 2023 @08:13AM (#37495675)
I see it more like:

(1) A huge dependency in the project for reading Excel files.

(2) Everyone needs training, as usually people in my profession have rarely if ever any need for Excel.

(3) Visuals != contained text, so the config might be different from what you see on screen as the config value.

(4) No proper version control, even a csv file would be better.

(5) scales? lul, have fun trying to solve merge conflicts. Also don't come with any Excel git plugins. It will only make the bad decision worse.

Re:What Is Wrong with TOML? by baq on Wednesday September 13, 2023 @11:40AM (#37498226)
xlsx is zipped xml. it might actually work. your profession must be very weird, though - knowing about git merge conflicts and not knowing how to use excel sounds like an empty venn diagram.
Re:What Is Wrong with TOML? by zelphirkalt on Wednesday September 13, 2023 @04:57PM (#37501644)
I wrote "usually people in my profession have rarely if ever any need for Excel". But I will explain.

Many software developers usually have no need for something like Excel. Either they use some free/libre alternative, because they know about it existing, or they use an actual programming language, or some might even use something like Emacs org-mode spreadsheets, or they use some library like Pandas for things, where it is reasonable to get out the tools. Software developers are also more likely to be aware of the technical debt incurred by storing anything inside Excel formats and will avoid it, if they are wise.

As such many software developers rarely use Excel, if at all. I personally don't use it at all. All my simple spreadsheet needs are covered by Libreoffice Calc or Emacs org-mode. If I had to use Excel now, I would not know the names of functions (translated perhaps, because Excel does that silly stuff) or how to reference cells (Is it $ and then the number? And : as a separator between col and row?). So yeah, to properly use it, many of us would have to learn at least a little of it.

Many if not most cases of Excel usage are actually due to people not knowing the alternatives, or perhaps knowing they exist, but not having the knowledge to use them (like with programming and quickly dishing out a few Pandas calls or Emacs org mode spreadsheets).

Re:What Is Wrong with TOML? by baq on Thursday September 14, 2023 @01:19AM (#37505253)
FWIW when I say Excel, I mean one of the big spreadsheet tools.

Excel is like Python: the second best tool for a lot of problems. There are problems which take five minutes to solve in the shell or in a text editor (maybe less now when LLMs can straight produce certain solutions with a simple prompt) and they take 10 seconds in a spreadsheet including copy and paste. I really recommend spending some time with Excel just as I recommend reading the table of contents of your primary DBMS’ manual.

I’d actually argue that being able to solve a problem quick and dirty in excel and in then in a more proper way in pandas is a good thing.

Re:What Is Wrong with TOML? by abenga on Thursday September 14, 2023 @01:26AM (#37505297)
All my life I have used Excel, OO Calc (now LO), and Google Sheets interchangeably and I have found experience in one carries across both the others pretty seamlessly. I actually think of them as just one thing. Formulas are pretty much the same, especially.
Re:What Is Wrong with TOML? by NateEag on Thursday September 14, 2023 @12:50AM (#37505109)
I have resolved many, many git conflicts.

I am perennially lost in all but the very simplest spreadsheets.

Re:What Is Wrong with TOML? by baq on Thursday September 14, 2023 @01:24AM (#37505278)
If it helps, you can think of excel as a purely functional programming language with a 2D UI for memory visualization and editing.
Re:What Is Wrong with TOML? by kagevf on Wednesday September 13, 2023 @07:43AM (#37495428)
Did they version the spreadsheets? Or maybe converted them to text and versioned the text format?
Re:What Is Wrong with TOML? by speed_spread on Wednesday September 13, 2023 @07:52AM (#37495502)
Excel sheets are an underappreciated tool for sharing technical info with analysts. They're easy to write and read from both dev and analyst side. They can be safely zipped, archived, emailed, saved on a USB drive by the user without any additional programming. Editing in Excel makes the expected schema clear. It's an excellent data interface.
Re:What Is Wrong with TOML? by nonethewiser on Wednesday September 13, 2023 @09:41AM (#37496623)
Most of these sound like things a native programming language can do. With the being a damn excel file. So it’s basically an argument for making your config files JavaScript, Python, etc.
Re:What Is Wrong with TOML? by mnstngr on Wednesday September 13, 2023 @09:46AM (#37496683)
Having a visual way to configure this makes it much more accessible to non-programmers, with error checking available through the host (Excel, in this case), while also reducing the eng effort in building this.

At Google, many internal tools use Sheets as their source of truth for config data, and it works really well.

Re:What Is Wrong with TOML? by nonethewiser on Wednesday September 13, 2023 @12:23PM (#37498772)
> Having a visual way to configure this makes it much more accessible to non-programmers

I agree completely but thats not the point he appears to be making making. He never stated this was the use case and he reiterated that it was a bad idea which should never be done.

Regardless, I’m saying those arent really unique advantages to excel. They just look unique compared to json, toml, yaml, etc.

Re:What Is Wrong with TOML? by hot_gril on Wednesday September 13, 2023 @03:01PM (#37500331)
I can't think of any data entry method more easily understood by non-programmers than an Excel spreadsheet (or Google Sheets etc). Repetitive data in particular is a breeze since you can drag-expand and use formulas. We use GSheets at work for configs created by non-programmers, and it works great.
Re:What Is Wrong with TOML? by nonethewiser on Wednesday September 13, 2023 @09:20PM (#37503766)
What is your point? You can see from my previous comment I already agree excel is user friendly for non programmers.
Re:What Is Wrong with TOML? by hot_gril on Wednesday September 13, 2023 @10:07PM (#37504094)
The user-friendliness is a unique advantage of Excel.
Re:What Is Wrong with TOML? by dagw on Wednesday September 13, 2023 @09:52AM (#37496755)
You're missing the point. Power came not from Excel the file format, but Excel the GUI tool for editing Excel files. You cannot have drop-downs and colour pickers and separate tabs and embedded images in a single python file without writing a a whole custom GUI config tool.
Re:What Is Wrong with TOML? by nonethewiser on Wednesday September 13, 2023 @12:21PM (#37498748)
Python can and often is edited by GUI tools with color pickers and dropdowns. IDEs such as Vscode have these.
Re:What Is Wrong with TOML? by LeonenTheDK on Wednesday September 13, 2023 @09:57AM (#37496833)
I think the difference there though is that an Excel file is a lot more approachable to non-technical folks (even superficially). Depends on what's being configured and by whom though.
Re:What Is Wrong with TOML? by macNchz on Wednesday September 13, 2023 @09:50AM (#37496734)
Too many encounters with Excel’s “smart” date parsing would make me very concerned about using it this way.

https://support.microsoft.com/en-gb/office/stop-automaticall...

Re:What Is Wrong with TOML? by Rygian on Wednesday September 13, 2023 @10:03AM (#37496910)
That page is such a gem.

> "make it easier to enter dates. For example, 12/2 changes to 2-Dec"

12/2 is obviously the 12th of February in my locale. But I need to keep Excel in English as a company policy, so this is not only unhelpful, it's outright wrong.

> Unfortunately there is no way to turn this off.

How does Microsoft justify this choice?

Re:What Is Wrong with TOML? by macNchz on Wednesday September 13, 2023 @10:44AM (#37497429)
I’ve never understood why they don’t provide the option to disable it, it’s not like Excel is a sleek, minimalist piece of software with strong opinions and limited configuration.

I also love how the support article describes a behavior of their own software as “very frustrating”.

Re:What Is Wrong with TOML? by WeAddValue on Wednesday September 13, 2023 @10:51AM (#37497516)
I use a Google Sheet as it can be accessed from anywhere. Even my non-techie business folks can make changes (they feel at home in spreadsheets). I even added a menu button to the gsheet to launch a re-build (it is a static site on Netlify; the build fetches it's config/data from the gsheet).
Re:What Is Wrong with TOML? by hot_gril on Wednesday September 13, 2023 @03:05PM (#37500374)
It doesn't sound terrible. This is what we do at work for large configs that non-programmers touch, except it's Google Sheets instead of Excel. It works, and they'll refuse to use anything else.