« first day (1498 days earlier)      last day (3452 days later) » 

user1804599
2:00 PM
@Jefffrey depends on context.
 
user1804599
Syntactic equivalence doesn't imply duplication.
 
@rightføld learn me
 
user1804599
The syntactic similarity may be completely coincidental.
 
@Jefffrey You have models.EmailField(...) and CellPhoneField(...) (without models.). Is this intentional?
 
But would it not have been better to refactor
 
2:02 PM
@rightføld One is a token used in an verification URL to verify an email. The other is sent via SMS to the user to input in some form and verify a cell phone number.
@milleniumbug Yup. Django does not provide a CellPhoneField.
 
How about having a simple inheritance hierarchy
 
user1804599
In that case generated_at, attempts_recorded and token are duplicate code.
 
Thought so.
 
user1804599
Also those aren't emails and cellphones, so don't call them that.
 
user1804599
They're email addresses and mobile phone numbers.
 
2:03 PM
Nobody cares
You can put common fields into an abstract base model
 
It is okay to have VariableAndTypeIdentifiersThisLongForTheSakeOfClarity
 
@EtiennedeMartel BizarroBartek?
 
@CatPlusPlus Problem is that token should be in the base class, but needs configurations (the random generator and the length).
 
Just inherit from the abstract base class
 
@Jefffrey No it shouldn't, it has different types
 
2:05 PM
@RonaldMunodawafa sure
 
Btw in terms of style what is better Pascal casing or Camel casing
What do you find easier to read
 
@CatPlusPlus Then I have no idea what the base class is supposed to represent.
 
Because when you are writing code it is for others to read
 
@Jefffrey Common fields
 
CommonFieldsBaseClass
 
2:07 PM
BaseToken
 
BaseToken implies that there's a token.
 
Just say that this is an implementation detail.
(the inheritance)
 
Fine have duplicated code
 
I'm just saying that it doesn't seem trivial.
 
Nobody cares what it represents or what it implies because nobody will use it directly
 
2:08 PM
Ok
 
It's p trivial you just think too much about ~~oop~~
 
Probably.
 
Why are CD players so expensive compared to e.g. Blu-ray-players?
 
Is it not wrong to define C++
beyond just saying it is a programming language
 
What if I detach the random generator from the model and I make a generic 1024 length char token field that I can use for both?
So that if I later have to change the length of each one I can do it freely?
Terrible idea. I know.
 
2:13 PM
Whatever's more comfortable
I've started writing auth in Haskell but now I'm bored and it seems like more :effort: than necessary
 
Auth of what?
 
Get a better memory
 
@FredOverflow ..because of their listed, archeological status.
CD players have to be dug up from recognised and licenced sites, much like floppy disk drives.
 
user image
3
good job
 
Isn't there a way to do this:
class EmailToken(BaseToken):
    email_address = ...

    class Meta:
        token_length = 512
        token_generator = random_email_token
        data = ('email_address')
 
2:23 PM
@MartinJames You can still buy CD players from Sony, Denon, Onkyo and others at amazon.
 
Plain CD players are as rare as Haskell IDE's and form designers.
 
user1804599
@FredOverflow Because they want people to buy BD players instead.
 
user1804599
Virtually all BD players can read CDs anyway.
 
2:29 PM
I think I broke everything you guys
 
All my ancient 'holes blown into Al film' media has been transferred to sane file systems. Fuck physical media.
 
@corvid Normal day in software.
 
@corvid That's very easy to achieve in Java:
everything:
while (true)
{
    break everything;
}
8
Q: Is using a labeled break a good practice in Java?

avgvstvsI'm staring at some old code from 2001 and came across this statement: else { do { int c = XMLDocumentFragmentScannerImpl.this.scanContent(); if (c == 60) { XMLDocumentFragmentScannerImpl.this.fEntityScanner.scanChar(); XMLDocumentFragmentScannerImpl.this....

 
@FredOverflow lol
 
That's how you spell NOP in Java ;)
 
user1804599
2:38 PM
Ugh, what the fuck.
 
user1804599
import Data.ByteString.Lazy (ByteString as LazyByteString) is a syntax error.
 
user1804599
@FredOverflow In PHP you do that as while (a) { while (b) { break 2; } } LOL.
 
user1804599
break N; breaks out of N nested loops.
 
@rightføld lol wtf
 
user1804599
In the past N could be a non-constant but they've fixed that. :D
 
2:43 PM
lollerskates
 
wtf happened there i.imgur.com/2ikvSBC.gif
4
gas pipe explosion? water pipe? wat
 
Xeo
Looks like a water pipe burst
 
yup, there seems to be some water at the end getting out of that thing
 
user1804599
@AlexM. No idea, but it's awesome.
 
and that's just another way to say fuck you
 
Xeo
2:53 PM
What an idiot. That could've easily killed him
 
user1804599
@AlexM. Maybe there was an underground troll having a vigorous fap.
 
ITT rightfold is horny
 
lolfold
 
user1804599
@AlexM. Bullshit.
 
3:09 PM
when is rightfold not horny?
 
user1804599
Right now.
 
okeydokey
 
I mean. Ok.
 
geeuwen
 
3:17 PM
sneeuwen
meeuwen
 
user1804599
schreeuwen
 
> Babyloniënbroek
lol
 
user1804599
@ScottW that picture looks like a badly lit 3D model.
 
it was taken during plain daylight though
 
user1804599
@ScottW nah
 
3:21 PM
nature needs to learn its lightning tutorials, pronto
 
@ScottW some advanced technology right there
it can spin
the air looks fake
 
Wow these Wikipedia donation pleads have gotten quite advanced.
They're now blocking the entire page.
 
s/advanced/in your face/
 
Not mutually exclusive.
 
true
 
3:26 PM
2 * true
 
I concur
 
user1804599
I concat
 
I concode
 
user1804599
I conquer
 
user1804599
Chocolate raisins are good.
 
3:39 PM
shadowrun returns is a nice game
I was not aware cyberpunk elves worked so well
 
I saw Interstellar last night
That was nice
 
was it a stellar performance?
 
Almost
 
> 30 mensen
does this mean 30 men?
30 people?
 
3:45 PM
30 people
 
holy crap
what language is this
I need to add it to my linkedin profile
 
Dutch
 
ok I know Dutch
 
Ell
I think I'll donate to Wikipedia
I think you guys should too
 
@AlexM. great :D
 
3:46 PM
@Ell i did a year or two ago, does that count?
 
the only donation I ever made was for coliru lol
I'm a bad person who doesn't care much about causes :(
 
yay I just got another donation. only 5 EUR, but that's good.
 
I always think that my money will be used to buy drinks or w/e for whoever organizes the donations
 
user1804599
> Painful shocks are the bedrock of UTF-8 support throughout PHP infrastructure.
 
user1804599
lol
 
@StackedCrooked cppreference uses coliru right?
did they ever donate?
 
they did
 
cool
 
two times
 
thats cool of them
 
3:50 PM
I need to stop reading/watching horrors before going to bed
 
it keeps you awake
 
user1804599
@TonyTheLion cool
 
now I am not sleepy at all being nearly 3am ...
 
@TonyTheLion nice
 
3:51 PM
now put your hand in there
 
user1804599
@TonyTheLion But will it blend?
 
@rightføld Don't forget to divide first.
 
user1804599
No, I conquer in parallel.
 
with multiple soldiers?
 
user1804599
Should I make failing assertions UB when assertions are disabled?
 
3:54 PM
Thanks for forgetting my settings VLC
 
meh
the more I encounter assertions, the more I think they are a useless tool.
 
@rightføld If you have a failed assertion, the program behaviour is already undefined.
 
reminds me of IsBadReadPtr and IsBadWritePtr, a.k.a CorruptMemoryIfPossible
 
user1804599
TOP KEK
 
4:15 PM
How the fuck did I make this work?
 
yeah, exactly
By default is should work badly and it still works badly for new things, but for old things it works great.
What magic did I use, god only knows.
 
@Jefffrey s/god/compiler
 
magic
 
4:33 PM
@Puppy Can you provide a couple of examples that you consider useless?
I consider them quite useful in theory, but I almost never use them in practice.
 
That's an odd request.
assert(true);
There.
 
I was thinking real-life examples found in actual code.
 
@R.MartinhoFernandes taskkill /f smartass.exe
;)
 
Xeo
@Puppy ehhh
Assertions have been tremendously helpful, I found.
Oh yeah, also
 
4:52 PM
Fixed a broken washing machine in four minutes. Fun when things go well.
 
@JohanLarsson How about you open a store: "The fix point"
 
:)
Would appreciate feedback on:
1) UX
2) Bugs
2) Typos and other dumbs.
 
how do I run it?
 
There is a demo project, set it as startup project
 
5:00 PM
hmm
 
> Current: 0
Current == 0: False
Wat
programming is hard
 
user1804599
5:21 PM
HI
 
user1804599
@Jefffrey s/Wat/Watt/
 
6:07 PM
What would be a good name for a function that checks if a token have not had too many failed attempts at guessing the code?
The body is simply: return self.failed_attempts < max_attempts
 
I'd flip it and call it attempts_exhausted
 
Just fill it under 'is valid'
 
@R.MartinhoFernandes I've updated my points on Nomic because they were miscounted apparently. Can someone check if that's correct?
 
It was my mistake. It's correct now.
 
@CatPlusPlus Well, then there's also an is_valid function that uses this function + other 2 to check a generic validity, but this one is supposed to be specific.
is_bruteforce_safe lol
 
6:11 PM
What for
 
Why they are split in 3 functions you mean?
For readability and SRP I guess
 
lol srp
 
what?
 
6:24 PM
@FredOverflow Pretty much all of them.
for an assertion to be useful, you'd need a condition that is both reliably detectable and inevitably ruins your process, and the only things I can think of that satisfy b) like memory corruption pretty much don't satisfy a).
 
0
Q: Implementing Enumeration types in C++

ShadowViperSo i am trying to create a class that is of enum type except that i have never used enum types before and im in the process of learning. I understand that enumeration type is basically enum a(red, blue green); where red would =0, blue =1 and green =2. But from there i dont quite understand how to...

 
Asserts are for invariants
 
@Columbo lol
 
@Columbo wat
 
@rightføld Nice.
 
6:31 PM
@CatPlusPlus No, they're not.
that's the same thing as "Exceptions are for exceptional situations".
 
Not really no
 
the real issue is
if you're writing a function X, just because your invariants are violated does not mean that the invariants of the whole program are violated.
so there's no useful way to know whether or not it really is invariant.
 
0
Q: Understanding Pointer to constant pointer to integer constant (const int * const * variable)

Node.javaGiven an example const int limit = 500; const int * const cpci = &limit; const int * const * pcpci = &cpci; I am having difficulty understanding what the last line means. Basically in array terms the value pcpci it's just an array of (const int * const)'s. But i can't seem to make multiple co...

wot
 
If the rest of the program can violate your invariants then your interface is shit
 
6:33 PM
if by that you mean, "Didn't duplicate all the error handling logic", then yes.
 
lol i.4cdn.org/v/1416596558547.gif /cc @LightnessRacesinOrbit
 
if you check for an invariant violation inside your function, then in order to call it safely, I have to duplicate that check outside the function and do my own error handling on top.
so I'm duplicating all the error conditions.
pointlessly.
 
@AlexM. haha shouldn't laugh no wait haha
 
6:35 PM
Asserts are not for checking argument validity
 
what would be better is if the author of the function would simply inform me in a sane way, like an exception or something, that my user made a mistake, and then I can just use that.
 
External data is not subject to your invariants
 
ITT Puppy is once again using redefinition as an argument tactic.
 
depends on the program you've written
 
No it doesn't
 
6:36 PM
well, let's say that I have a C++ interpreter, and the interpreted program contains something bad, like pop_back on an empty vector.
 
That's not an invariant
 
how is the interpreter going to handle that problem without duplicating the error checking logic?
bringing down the whole thing because the user input was bad is obviously bad, and duplicating all the error checking logic is also bad.
 
You're arguing about misuse of asserts not asserts
 
ok
 
User input is not invariant
 
6:38 PM
then why don't you supply a simple example of a condition which is both reliably asserted on and failure of that assertion is absolutely unrecoverable for the whole process
@CatPlusPlus Right; but if you convert user input into operations, like an interpreter or something, then they become invariant. But doing so safely would involve duplicating all the invariants.
 
assert(true);
@Puppy lolwut
 
Broken invariant is not recoverable
 
You're writing a vector-like class. Obviosly assert(size() <= capacity())
 
@Puppy What
No
 
@milleniumbug But how did that assertion come to fail in the first place? That can only happen in the case of something like memory corruption.
 
6:41 PM
Or a bug in the internals
 
hm does anyone know why int result = boost::lexical_cast<int>("3"); would return the result 0xCCCCCCCC ?
 
Which is why broken invariants is not a user-facing exception
 
Check this: You're writing a class. You're checking for your own bugs.
 
@Puppy It's much more likely to fail due to a problem in the code--and that's exactly what the assert should catch.
 
right.
but again, if I'm interpreting a C++ program, and that program fails, that does not mean that my interpreter should be brought down too.
 
6:41 PM
Why are you even bringing this up it's not relevant???
 
Oh god, you're still ranting against LLVM, aren't you?
 
That's why asserts are disabled for release?
 
We get it LLVM and Clang use asserts badly
 
no, it's a general question.
 
@Puppy No, of course not. assert is for checking that the internal logic of your code is consistent (and consistently followed).
 
6:42 PM
A very-specific general question.
 
lol
 
omg I want to cry so hard now, that code worked yesterday :/
and boost is undebuggable
 
@JerryCoffin Right, but you're still bringing down the whole process if it's not followed, even though I may well have other parts of my code that are reasonably isolated from having that happen.
 
@Gizmo Your problem is else where.
 
6:44 PM
@Puppy Yes, you're bringing down the whole process, because when you discover a bug you want to fix it rather than letting the buggy code continue and produce incorrect results, destroy data, etc.
 
5 mins ago, by Cat Plus Plus
Broken invariant is not recoverable
 
right, but stopping the program is not equal to terminating the process.
for simple example, if it's an interpreter, you just stop interpreting.
 
yeah I don't know where, but the breakpoints I set on that clearly tell me boost lexical cast returns 0xCCCCCCCC for any number now.
 
@Puppy It's certainly true that if (for example) you have some sort of server that has to keep running, no matter what happens, having active asserts in it is probably a poor idea.
 
but maybe my debugger is lying :/
I hope so
 
6:45 PM
If assert in interpreted code brings down interpreter, then the interpreter is shit, not the code that's asserting
 
but then again, the result is needed and that needed thing doesn't work without the correct result
 
@Puppy lol running debug build version of program on a production environment
 
It's literally irrelevant to anything
 
well, admittedly, you'd probably want to try to isolate the code anyway, in case it de-refs null or something.
 
6:46 PM
@Rapptz yeah I know the code itself works, it worked yesterday, I only added a few more static const float arrays[] and now it doesn't
 
but that's no excuse to inflict more such conditions on people
 
@Puppy Why the fuck does your interpreter provide the interpreted code with an instruction that brings down the interpreter in a non-graceful manner?
 
and there's plenty of memory free and available
 
I can't help you bub.
 
@Puppy Are you talking about an assert firing in the interpreter itself, or an assert firing in the code that it's interpreting?
 
6:47 PM
I'll take a screen
 
user1804599
lolwot
 
@R.MartinhoFernandes Possibly, it just needs to call into some external code with a value provided from the interpreted script, like FFI.
 
I haven't played factorio today.
 
Please don't.
 
Latter and it magically brings down the interpreter because that's obviously how interpreters work
 
6:47 PM
@JerryCoffin In the interpreted code.
 
I feel so proud.
 
user1804599
So in this mission I had to save a guy and it appears it was the game's director.
 
wat
 
Are you some kind of an agent?
 
6:48 PM
@Puppy In that case, the "process" of the interpreted code should exit, but the interpreter should continue (e.g., to allow debugging of the code it's interpreting).
 
user1804599
PMC leader.
 
why
 
@JerryCoffin Seems obvious what should happen, I'm merely wondering how you make that happen if you FFI or JIT code that asserts.
 
user1804599
 
user1804599
dat mission
 
6:50 PM
is that Hideo Kojima?
 
user1804599
Yeah.
 
user1804599
lol now he sits in the helicopter in the main menu.
 
okay found it
stupid bug..
 
kill it with fire
 
upon closer inspection, please don't name your variables similarely
 
6:53 PM
@Puppy You should not run arbitrary code in your process if you care about that, regardless of asserts.
 
so it worked because of the randomness of memory ;o
 
@Puppy Are you proposing that your C++ interpreter doesn't abort if your interpreted program calls std::abort? Nice and nonstandard.
 
@milleniumbug Er, no?
Your program ends but the interpreter doesn't have to.
 
Oh, that's right
 
@R.MartinhoFernandes Right, but I'm not really thinking about the case of arbitrary code, I'm thinking about even if you provided some pre-existing APIs that you think are known-good.
 
6:56 PM
Still, the semantics of assert are loose enough that your implementation can put a breakpoint. Visual C++ does that
 
Why do you provide APIs that can bring the host down?
 
because they are generic libraries that I happen to have written a wrapper for, like I dunno, filesystem or networking or something.
 
That's arbitrary code!
 
it's not really arbitrary, I know what it does.
 
6:57 PM
lol
 
the only alternative would be to re-implement every library for this special case.
 
"I let the guest run code that brings the host down and I know it, and the guest should feel bad"
 
I mean, if I write a script language and I want to provide filesystem access, I should write all my own filesystem handling again instead of delegating to boost::filesystem?
 
I still fail to see how it's relevant to anything
 
I actually don't know if they do this, it's just an example.
 

« first day (1498 days earlier)      last day (3452 days later) »