« first day (876 days earlier)      last day (4071 days later) » 

11:00 PM
@Ell, do you think I need a library for yaml? Because I don't think I'm allowed to use any other library except the standard one and Qt.
 
user142019
Use Erlang terms.
 
YAML is human readable and it looks easy to parse
 
@Ell binary is pretty easy...
 
binary is not exactly hard to write custom formats in though
 
user142019
Use Lisp.
 
11:05 PM
Does any of you have any nice guide on writing a good binary data structure?
 
there really isn't much to it
 
@Jueecy I think you've missed the point
 
user142019
Wat.
 
user142019
You have a data structure that's good for your application.
 
user142019
Binary serialization is irrelevant.
 
11:06 PM
@Jueecy [type of data][sizeofdata][data]repeat until out of data.
 
Protobuf
 
user142019
Binary/text is about serialization; as in writing it to a file or sending it over the network.
 
you will want to figure out some sort of header for your file, so that you know things like what version of your file you are reading, not really a requirement, but can help future proof. Then it's just a case or writing out all the data that is relevant for your program. You may need to add meta data for things like 'what type of thing is next' and 'how big is this next thing'
 
user142019
Custard cake FTW.
 
But it really does depend on the data in your program
 
user142019
11:09 PM
@Jueecy look at documentation of popular data formats and you'll get the idea.
 
I'll probably just have numeric data associated with a string key. For a single chart for example I'll have something along the line of "USA" => 223, "Italy" => 102, "Canada" => 67 etc...
 
Ell
Meh binary is easy.
 
user142019
ELF, PNG, MP3, Java class files, whatever.
 
@Zoidberg, I'll take a look.
 
@Jueecy oh, so your data is basically just two columns of data?
 
11:11 PM
@Zoidberg only ones I've ever really looked at was WAV and BMP :/
 
well, more of a key:value pair?
 
user142019
If your data is just a bunch of string-string pairs I wouldn't even bother with custom format and just use JSON or INI or whatever.
 
@thecoshman, actually I'd like to have multiple charts in a single file. Each chart will have a string name and inside it there'll be string => double data.
 
user142019
Unless you need very fast lookup.
 
user142019
In which case you'd use a binary format and a hash table.
 
11:12 PM
@Jueecy then you can just do some sort of header line in a sort of '###TABLE NAME###' style, followed by all the lines that make up the data in 'KEY:VALUE' pairs, one per line until the next header or EOF
 
oh gawd guys i feel so nerdy now
 
The data structure is something along the lines of: std::map<string, std::map<string, double>>;.
 
laying in my bed with a laptop with pendrivebuntu
 
user142019
> nerdy
 
user142019
> Ubuntu
 
user142019
11:13 PM
Pick one.
 
user142019
@Jueecy INI file with sections. :P
 
@thecoshman, yeah I thought about that too. I'm afraid of writing parsers though.
 
user142019
[abc]
a = 42
b = 42
[def]
a = 78
c = 12
 
Parsers in C++ are annoying
 
##STRING##
STRING:VALUE
STRING:VALUE
etc. etc.
 
11:14 PM
@Zoidberg, then I'll have to parse it on my own?
 
@Mysticial confirmation we've all been trolled
I get it. I thought of similar idea. :S Next time I will read more carefully. But thanks to that many people have 'nice' problem to solve'. — Kostek 30 mins ago
 
user142019
@Jueecy Yes, or you use one of the five hundred billion existing INI parsing libraries.
 
user142019
With Spirit it shouldn't be too difficult.
 
@nneonneo Yeah... we've all been had. It'd be even better if he did it intentionally. lol
 
the only tricky bit is deciding what to use to separate the key from the value
 
11:15 PM
@Zoidberg, I'll have to write it on my own, but it doesn't seems that hard.
 
FYI if you want to go with XML I think Qt has QXmlStreamReader/Writer
 
it really isn't. Just open file, read line by line, keep track of what table you are currently reading data for
 
@Rapptz, yeah I know thanks.
 
user142019
JSON would also just be fine.
 
an ini parser is easy, just read line by line
 
user142019
11:17 PM
{
    meh: { moo: 42.1337, muh: 3.14 },
    foo: { bar: 1, baz: 0 }
}
 
@Mysticial now, just have to prove the original is NP-complete
lol
 
user142019
But yeah INI would be easiest.
 
user142019
Well, no.
 
user142019
Binary format would be easiest.
 
@nneonneo It's definitely not harder than the SCP, since it's a special case of SCP.
 
11:18 PM
well, it's obviously in NP
the decision version is
and therefore the optimization problem is also in NP
contrary to what some comments seem to think
 
Ok thank you lads.
 
the real question is: is it NP-complete?
 
@Rapptz you never made one? character escaping, duplicate sections, (ignorable) whitespace, comments (trailing) and the combination with whitespace, line continuations...
 
it may in fact be amusing, yet remarkably difficult, to come up with gadgets for encoding something like 3SAT
 
@sehe I've made one before, still pretty trivial. :|
 
11:20 PM
@Rapptz Did you implement the features I just enumerated, carefully?
0
A: Cross-platform way to get line number of an INI file where given option was found

seheOnce again, took the opportunity to play with Boost Spirit. This time I got to play with line_pos_iterator. Here is the fruit of my labour: https://gist.github.com/1425972 When POSITIONINFO == 0 input is streaming output is raw strings (well, map<string, map<string, string> > for ...

 
no, yes, yes, yes, yes, no
 
I implemented that in Spirit
 
I don't know what you mean by character escaping, and I ignored duplicate sections.
comments were with with #
 
Ah, the code was actually in a gist gist.github.com/sehe/1425972
 
user142019
Bah.
 
user142019
11:22 PM
Binary format is much easier.
 
@Rapptz gist.github.com/sehe/1425972#file-example-ini The test ini file I created for that parser.
 
yeah I never did C-style comments
 
user142019
In Perl it would be ten million times shorter. :^)
 
You'd want to at least be able to escape the # char, for obvious reasons
@Zoidberg Meh. It would be precisely as tricky to get the corner cases right. Less code, yes. Less complex, no
 
I just did # for commenting
 
11:24 PM
@Rapptz Precisely, this means that no value can contain '#'... "I just did" sounds like it is ok, but... I doubt whether that's intentional
 
Oh so you mean that by character escaping?
 
Cough. You're being a bit slow, really
 
user142019
Hmm.
 
user142019
Shall I write my game in Python.
 
user142019
Or maybe in Perl!
 
11:25 PM
@sehe ah, obviously the more robust you want to make it, the trickier things become. but most of those things are relatively trivial problems to solve
 
@Rapptz That was what the example.ini shows, and what I said ~8 message ago
@Zoidberg Ada! Ada is so much underappreciated
 
any hoops
 
Yeah, I saw.
 
I is heading off for the night
see y'all
 
user142019
I'll do it in Erlang.
 
11:29 PM
man
I did a dumb.
 
user142019
s/b/p/
 
nope
 
user142019
lol
 
@Zoidberg you won't finish it anyway. And don't use Perl for god's sake.
 
user142019
Why wouldn't I use Perl?
 
11:32 PM
Well, it's a joke not a language
Unless you are developing a game such groundbreaking as tic-tac-toe
 
Ell
Fuck i have so much work to do. How to stay awake?! :O
 
adrenaline
beats caffeine every time
 
Willpower, mother fuckers.
 
user142019
@Ell turn your lights on.
 
user142019
Also.
 
11:37 PM
@nneonneo but it is harder to come by
 
user142019
Do the work earlier.
 
user142019
Instead of procrastinating it.
 
@sehe bah, adrenaline is easy. I don't do caffeine.
 
@nneonneo how do you "do" adrenaline?
 
Play a scary horror game.
With all the lights off.
In surround sound.
 
11:43 PM
Bingo!
 
Proceed to do massive amounts of AAAGH OOH SHIT OH MY GODH FUCK HUAAAH
FUCK SHIT FUCK FUCK FUCK OH MY GOD RUN RUN RUN RUN
HNNNNNNNNNGH JUMP, JMP JUMP JUMP JUMP MOTHER FUCKER JUMP
 
The trick is to be productive while getting the shit scared out of you
 
Any ways. I thought you guys were friends. I can finally throw my awesome Spirit INI-file parser at you, complete with tests and explanations, and YET no-one upvotes that answer.
It's been sitting there, gathering dust, humbly, since Dec 3 '11...
With not a single upvote :(
It's the only answer as well :| I'm stupefied, really. Usually, this is what happens when I answer a question that existed for ages, and had a dozen useful answers.
 
well
just sent off my four proposals.
wish me the lucks
 
Good luck! (Will you be presenting them "live"?)
 
11:49 PM
hopefully
Bristol is only in about five weeks.
 
What does it depend on? You need a formal invite?
 
no
anyone can attend, and attendance is free
 
@Jueecy Did you see my link?
 
all I have to do is show up, convince the Committee to accept them, and that's that.
 
user142019
Hope you're not sick that day. :P
 
11:52 PM
six of them
 

« first day (876 days earlier)      last day (4071 days later) »