« first day (1868 days earlier)      last day (3082 days later) » 

2:00 AM
it’s… potentially super ultra wrong
 
@Ell I want to input utf8 and get back shaped glyph without having to care about anything else.
 
Ell
@GregorMcGregor I'm confused really. Do you have one shared resource or one resource per wrapper object?
 
maybe I should clear up that the fd is created by the wrapper itself and it's impossible to share it?
 
why doesn't the class provide a copy constructor?
 
Ell
@Prismatic you can't do that sorry
 
2:01 AM
@Rapptz shared_mutex?
 
yeah that too
 
Ell
You need locale info if you want it to be correct
 
@Ell think of it as a wrapper over a file descriptor. right now there can be only 1 wrapper for the same descriptor, but there may potentially be several wrappers protecting several descriptors.
my point being that I see no reason for the wrapper not being copyable/movable
but maybe I'm explaining it wrong
 
Even if you feed in locale info you still dont get line breaking, bidi or script detection
 
2:02 AM
In fact I think harfbuzz uses your locale to set the default language already
 
@Rapptz I dunno. :D
 
4 mins ago, by Luc Danton
or where the fds come from
 
Do you guys know if there's a way to unstage a chunk?
 
fdp
 
like I want to add the entire file except for a specific chunk
in git
 
2:05 AM
@LucDanton created by the wrapper at construction, guaranteed to be unique
 
Oh nice.
git reset --patch <file>
praise git
 
@GregorMcGregor then I prefer the unique resource to be alongside the mutex that protects it
 
@LucDanton but then the wrapper is no move/copyable so I have to dynamically allocate that one when using it as a member
 
or don’t and push the decision downstream, yeah
 
._. eventually I have to dynamically allocate
it's very frustrating
 
2:07 AM
in Rust not only it does that but it also tracks thread safety in the type-system isn’t it the best
 
git reset --patch is gr8
whoever made this gets my love for the day
 
@GregorMcGregor if that’s an obstacle then your alternative is not very good either is it?
 
it puts the dynalloc at the very top which is more convenient imo
instead of contaminating the whole composition chain
look I'm using words
~~composition chain~~
 
I don’t see any alleged convenience and you lose flexibility
composing 'restrictions' is actually a feature
i.e. otherwise the logical thing is that a copyable mutex would be a feature gain over a non-copyable one
 
I think copyability and movability are nice to have
 
2:11 AM
I mean flexibility for flexibility’s sake is kinda dumb, you can go for the thing that you want right now it’s not a crime
those are my general thoughts though
 
I just find it painful to dynalloc that wrapper everywhere when I could just dynalloc that mutex
so that's my concern
not sure how valid
oh well
 
it’s kinda a limitation of C++ and why Rust is aiming alongside the lines of dynamically-sized types
 
it’s a big deal in systems programming
@GregorMcGregor I’m wary of sharing-as-copying
 
2:14 AM
it’s another matter entirely but now you have the same file-thingy potentially being used from several places at once
 
say I want to have std::vector<Robert> where Robert has somewhere down in its members of members a mutex
 
Ell
Dynamically sized types?
 
well I need to dynalloc the member preventing the move
and that's ANNOYING potentially when there's also Simone and Jean-Eudes with similar issues
I think
 
@Ell it makes sense if C flexible members ring a bell
also VLAs, technically, but they kinda come up from different needs
 
So If I have that wrapper dynallocating its mutex then the problem doesn't bubble up
I don't know ._.
 
2:17 AM
@GregorMcGregor that’s the place where I literally see no difference
 
I'll just buy those sequoias you linked and start a botany shop I guess
 
Ell
Flexible members don't ring a bell
I looked it up though
 
@LucDanton Total amount of code written
@Ell Very common in C
 
I wonder if python has something equivalent to std::equal
 
in one case you type std::unique_ptr< and > while in the other you type std::unique_ptr< and >
 
2:18 AM
or if I have to write it myself
 
Ell
I know how to do (int n, int vinegars [n])
 
at least you don’t have to type match
 
Ell
I had no idea it worked for structs
 
@Ell that doesn’t sound right lol
think of a string/vector done right (i.e. not a C string), you care about the size, possibly the capacity, and then the data itself right?
so the naive thing is struct string { size_t size, capacity; char* data; };
but see when you’re a systems guy you kinda like to put related things together sometimes, so why not put the size and capacity right next to the data (which actually lives at *data)? but C doesn’t let you express that, until you use flexible members
 
png_magic_bytes = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]
for i, magic in enumerate(png_magic_bytes)
    if _try_ord(data[i]) != magic:
        raise Exception()
guido would be proud :')
 
2:22 AM
does that _try_ord do unholy things
 
it's a python2 compat shim
 
so, yes
 
yeah I guess
 
dig pigusting
 
2:22 AM
in python3 doing x[0] on a bytes-like object would return an int
 
Ell
Someone move to coliru and use c99 pls
 
but in python2 it obviously returns str
 
Ell
I can't because mobile but I'm sure this works
 
def _try_ord(x):
    try:
        return ord(x)
    except Exception:
        return x
It's not that bad!
could be worse I guess
 
Ell
@LucDanton oh wait
I just undersyood what you meant
 
2:23 AM
@Ell call to printf not done
 
I should catch TypeError instead
 
Ell
Yeah I'd never heard of flexible members until now, only this variable array length trick
One variable array length trick to give you perfect size of in just 1 hour
 
yeah flexible member is the standardese name for the feature that’s really the hack glorified into the language
 
time to look up magic bytes for jpeg
 
@LucDanton right
 
2:25 AM
no point calling it a hack/trick when it’s a feature though
 
Ell
Yeah I never thought I'd say it but I'm looking forward to java at this point
Too muh C4me
 
lol
 
@LucDanton no but that thing is used all over the place
 
> JPEG image files begin with FF D8 and end with FF D9. JPEG/JFIF files contain the ASCII code for "JFIF" (4A 46 49 46) as a null terminated string. JPEG/Exif files contain the ASCII code for "Exif" (45 78 69 66) also as a null terminated string, followed by more metadata about the file.
wow this is ugly
 
Ell
Use free image :P
 
2:26 AM
what the hell is a JPEG/JFIF file
 
stick to png
 
Ell
Its what happens when you mispronounce "gif"
 
regular JPEG is okay
 
Ell
You get a jfif
 
FF D8 and ends with FF D9 isn't so bad
 
2:26 AM
I use Boost.GIL because I hate my compiler
 
Ell
That's terrible
Boost gil is not for loading images :3
Though whatever gets the job done easiest I suppose
 
sure but it’s not like you load images not to do anything with them
 
why is jpg still around
 
Ell
I mostly just load them and send them to the GPU which is basically nothing :P
 
isnt webp or whatever good enough yet
 
2:28 AM
do they all start with FF D8 FF
would wikipedia lie to me
> The file format known as "JPEG Interchange Format" (JIF) is specified in Annex B of the standard. However, this "pure" file format is rarely used, primarily because of the difficulty of programming encoders and decoders that fully implement all aspects of the standard and because of certain shortcomings of the standard:
o..k
 
@GregorMcGregor all that said the _ptr family (and their factories) could certainly be done better, to reduce pain no matter where used
4 mins ago, by Luc Danton
stick to png
jpeg alarm
 
pastebin.com/gbRXpXbR are you saying guido is not proud of me
 
@LucDanton not what I meant ._.
i wanna cri
 
@GregorMcGregor it’s related
consider a world where you could drop in a whatever<foo> wherever there is a foo
 
are you saying I can't
that's a very black and white world friend
 
2:33 AM
@LucDanton ya ok
 
@Rapptz is it not possible to substr (subbytes?) the bytes and match that against a prefix in bytes form?
 
I don't know if startswith works with bytes
I can check
 
anyway I'll go with your solution for the moment being
 
Ell
I wonder when we'll get proper beefcake ARM processors
Or RISC processors
 
hi
 
2:37 AM
oh hey
 
cus a lot of the *_ptr<X> functionality is in storing the X, but access remains plain and dumb and not something the rest of the code cares
 
it actually does have startswith
 
I helped
 
god speed python 3.5 for not ruining my day
 
@Rapptz guido loves all pythonistas
 
Ell
2:37 AM
Okay note evetojr
Night dvdyons
 
just remember to keep it pythonic(tm)
 
Ell
Fuck it main
 
this is pretty sexy now
def _get_mime_type_for_image(data):
    if data.startswith(b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'):
        return 'image/png'
    elif data.startswith(b'\xFF\xD8') and data.endswith(b'\xFF\xD9'):
        return 'image/jpeg'
    else:
        raise InvalidArgument('Unsupported image type given')
I'll take it
 
> Tout à fait d'accord. On a quand même une tradition millénaire de persécution des juifs, ça me fait chier quand on oublie, respectez nos valeurs bordel de merde.
2
 
I think bytes has encode too
 
2:44 AM
yeah
 
AttributeError: 'bytes' object has no attribute 'encode'
curse you guido
it has decode but not encode
this makes no sense to me
time to look up the chump way of converting bytes into base64
I think there was a module for it
base64.b64encode
 
@Rapptz oh I misremembered which is which then
decode bytes into object (de-marshall), encode object into bytes (marshall)
I love late-night shitposting
 
> Basiquement
I’m seeing this more and more
ok maybe I just saw it twice this week
 
reminds me of this fake poll that's plastered all over the bus stops in my area
it goes like this:
> It is known the mental control program of the USA had unexpected consequences such as the apparition of AIDS, homosexuals and [other things].
> According to you, what should the government do to fix these issues?
> a) take full responsibility b) offer a public apology c) ...
I forget the rest (I should take a picture and post it here)
Essentially the poll is just designed to disseminate propaganda and the questions are there to make you ~~interact~~ without challenging the content
 
2:56 AM
Toom uch wine
 
AJA il y a 2 films OSS 117 avec Jean Dujardin, jsuis vraiment pas culturé
 
ja ja naturlich
Or something
 
Probably sch
 
Man, making sense of compiler error messages with expression templates is a struggle
 
2:59 AM
Why are Pixar films so good
 
and what did I tell you yesterday
don't use expression templates
 

« first day (1868 days earlier)      last day (3082 days later) »