• Print

Author Topic: Idea to make editing plain text files a little easier?  (Read 28 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Idea to make editing plain text files a little easier?
« on: July 11, 2010, 09:32:36 am »
What would y'all think if we were to use a format like JSON instead of our current key-value format? I'm not suggesting this for ULX 3.5, but maybe a future version.

Pros:
  • Standard format (pretty much any language can read it easily)
  • Lots and lots and lots of tools. IE, someone has a problem? Throw it through a validator (assuming we don't have one in our code already)
  • More tools for editing, even nifty online editors are available.

Cons:
  • Other lua addons wouldn't be able to read it without using our library or another JSON reader
  • Not garry friendly. Or is this a pro?
  • Something new for users to learn if they want to edit it by hand without a tool

Personally, I like it. Especially if we ever want to leave the garry-arena.

[JamminR - Edit] - corrected URL tag for wiki JSON article
« Last Edit: July 11, 2010, 10:12:49 am by JamminR »
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Idea to make editing plain text files a little easier?
« Reply #1 on: July 11, 2010, 10:10:20 am »
I'm of the opinion at first glance that your first two cons aren't cons at all.
As long as, at least in the ULib world, we import the standard garry information (users/bans/server.cfg/whatever gmod wiki gives info on editing) or find a way to coexist with it, I'm ok with it.

[EDIT] - Now, actually having looked over the wiki article examples of text... JSON in no way looks any easier than the lua key values most are used to.
Perhaps writing a module to read/write it for ULib for those who wish to tinker/learn/practice with it would be plausible, but as a replacement for current text storage, I don't see the benefit.
« Last Edit: July 11, 2010, 10:17:31 am by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Idea to make editing plain text files a little easier?
« Reply #2 on: July 11, 2010, 12:04:41 pm »
[EDIT] - Now, actually having looked over the wiki article examples of text... JSON in no way looks any easier than the lua key values most are used to.

But does it look anymore difficult? And what about the tools to help people edit it?

As far as supporting both, that's really something I wouldn't want to do. It should be 100% one or the other.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Idea to make editing plain text files a little easier?
« Reply #3 on: July 11, 2010, 01:09:27 pm »
Two formats are always more difficult than one.
If you can get every other mod/script/addon writer to use JSON for thier flat files, then no, it's not any more difficult.
Remember, we still have people confused going from release to SVN ULib storage. I can't imagine the additional support hour nightmare going to yet another, actually bigger, change.
If the other mod writers use it for flat files, it becomes 'same or easier'.
If not, that means more work for us on the support role. Sure, validators are great, but we still get questions of "the validator says it's not right...why not?"

Right now, many already are using sqlite.db, SQL, or text lua key value files.
Throwing one more configuration type into the mix (JSON) just doesn't seem logical, tools to assist or not.
I think you may just as well spend your time writing a Lua key value flat file validator.

I'm not saying JSON is bad. It would be great for other projects. I just can't imagine it being good in the Gmod world of ULib.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Idea to make editing plain text files a little easier?
« Reply #4 on: July 11, 2010, 09:07:30 pm »
If you would like tools to help users edit flat files for the current ULX system, I actually had started a project like that at one point using Visual Studio, I wouldn't mind picking something like that up as a side project when I get back to the States.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Idea to make editing plain text files a little easier?
« Reply #5 on: July 11, 2010, 09:41:15 pm »
I think a web version would be great for server side admins. Know any PHP?
I've been tinkering with it again for my neighborhood. Forgot just how versatile it is.

As for client side group/user editing, I would hope that XGUI would be all that is needed, once it's incorporated with ULib.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Idea to make editing plain text files a little easier?
« Reply #6 on: July 12, 2010, 11:49:33 am »
I do in fact know a little PHP. Though I don't know how the average user would plug this in to their server. Maybe a web script that lets them input their current flat files, make changes using web form controls and then get an output that they would then copy and paste over their flat file? Though this still leaves us open to human error.

I still think that for users who insist on managing their flat files outside of the garrysmod environment, that having some sort of foolproof device to aid is a good idea though.

Basically XGUI in a windows control environment. Open your flatfile, make your changes using the built-in tools, then the tool generates or replaces your original file that you just upload to your server.

I dunno.. it's something maybe I'll play around with if I'm bored.. I mean it can't hurt.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Idea to make editing plain text files a little easier?
« Reply #7 on: July 12, 2010, 03:52:47 pm »
Re: PHP. Basically, yes.
I was thinking forms, pulldowns, etc.
If you have a known working groups.txt file, you click an 'upload/import/whatever you call it' button, or, paste it into a field.
Then have the PHP parse it, separating out whatever it needs. Show it to the user in nice form.
Then have 'add group', 'copy group', with inherit from group. Controls like that.
Modify functions to copied/new group. Add functions to existing/remove from.
Final step would allow download or copy/paste into new groups.txt file.
Basically, all that XGUI does in client game but in PHP/web browser form.

Heck. Learn Javascript and it could be done all local!

Speaking of PHP/groups.txt ... Megiddo, whatever happen to web based user file spit out web form thingy for ULX 1?
I know it would never work now, but the conversation just reminded me of it.

Re: JSON - It after all is said and done would really depend on what the majority of users of ULib thought.
I just imagine more support nightmare since they can't figure out (what to me is) simpler editing now anyway.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Idea to make editing plain text files a little easier?
« Reply #8 on: July 12, 2010, 04:29:16 pm »
Heck. Learn Javascript and it could be done all local!

Keep in mind we now have an extremely capable browser at our disposal in GMod. HTML 5 should be supported now, among just about everything else.

Speaking of PHP/groups.txt ... Megiddo, whatever happen to web based user file spit out web form thingy for ULX 1?
I know it would never work now, but the conversation just reminded me of it.

It was created by Golden-Death. I've never been much for web development, but it's an area I've been looking at more lately... I'll keep something like that in mind.

Re: JSON - It after all is said and done would really depend on what the majority of users of ULib thought.
I just imagine more support nightmare since they can't figure out (what to me is) simpler editing now anyway.

Could it possibly get any worse? The two relevant additions are ':' and ',' to each line... which isn't a problem when copying and pasting. It's something that's hard (in my opinion) to miss if someone thinks they left something out. And even better is that there's less ambiguousness in JSON grammar, so we could give them more precise errors on what they screwed up on. But mainly, I think all the freebies that come with the conversion to JSON makes any additional support pains worth it.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Idea to make editing plain text files a little easier?
« Reply #9 on: July 12, 2010, 06:24:49 pm »
When all is said and done, I'm still middle ground on the farther edge of nay.
Most users can't handle default gmod users.txt, or the commas now at the end of "string" for each table key.
Sure, throw in some colons.
End users will smell it up just as bad.
Pun intended.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print