|
rarbatrol posted://TODO: validate input /** * Nobody actually told me yet where this is supposed to get the individual * tokens from or where they should be stored, so for now this just makes sure * it hasn't been used yet. Once I get actual implement info I'll fix this up. * * @todo fix this * @see ticket #88320 */
|
# ? Feb 9, 2017 01:26 |
|
|
# ? May 28, 2024 10:24 |
|
PT6A posted:Wordpress is hateful and bad and their database structure makes baby Jesus cry. why on earth are these unique access codes not simply a key to a token that is invalidated once registration is complete? that poo poo should be generated when the invite to register is granted and invalidated as soon as it's consumed. that way you could even re-use codes and you don't have to do a bunch of crazy validation to make sure a code wasn't already used.
|
# ? Feb 9, 2017 18:19 |
|
LeftistMuslimObama posted:why on earth are these unique access codes not simply a key to a token that is invalidated once registration is complete? that poo poo should be generated when the invite to register is granted and invalidated as soon as it's consumed. that way you could even re-use codes and you don't have to do a bunch of crazy validation to make sure a code wasn't already used. "I don't understand security, but I'm just going to roll my own. How hard can it be?"
|
# ? Feb 9, 2017 18:28 |
|
TooMuchAbstraction posted:"I don't understand security, but I'm just going to roll my own. How hard can it be?" i don't understand anything and i thought of that in 5 seconds
|
# ? Feb 9, 2017 18:29 |
|
LeftistMuslimObama posted:why on earth are these unique access codes not simply a key to a token that is invalidated once registration is complete? that poo poo should be generated when the invite to register is granted and invalidated as soon as it's consumed. that way you could even re-use codes and you don't have to do a bunch of crazy validation to make sure a code wasn't already used. I'm just invalidating the codes themselves after they've been used because it seemed slightly easier. It also could allow, in the future, for the client to see if a specific code that was distributed has actually been used, which may or may not be useful.
|
# ? Feb 9, 2017 22:27 |
|
nm
xtal fucked around with this message at 01:06 on Jun 20, 2018 |
# ? Feb 10, 2017 01:48 |
|
I was incredulous at the cvar usage, but the second part made me edit: hope you never try and use a threaded server with that cvar thing. Would love to see the bugs from that. necrotic fucked around with this message at 05:28 on Feb 10, 2017 |
# ? Feb 10, 2017 05:26 |
|
I don't know Rails, but model, view and controller mean pretty much the same thing as they normally would, right?
|
# ? Feb 10, 2017 18:06 |
|
No, Rails significantly misuses the terminology.
|
# ? Feb 10, 2017 18:20 |
|
Plorkyeran posted:No, Rails significantly misuses the terminology. It's true that everyone has their own definition of MVC but I can assure you this is a coding horror under any of them necrotic posted:I was incredulous at the cvar usage, but the second part made me That already came up once and our solution was to use a different server. xtal fucked around with this message at 18:38 on Feb 10, 2017 |
# ? Feb 10, 2017 18:35 |
|
after two hours trying to work out why icons aren't appearing in a dropdown list: lol, gently caress MFC
|
# ? Feb 10, 2017 19:05 |
|
xtal posted:It's true that everyone has their own definition of MVC but I can assure you this is a coding horror under any of them yeah just plop in unicorn instead. probably better for production most of the time anyway.
|
# ? Feb 10, 2017 20:12 |
|
Re: Testing Chat - one of my professors years ago had an interesting perspective... it's best to just show you:C++ code:
Evil_Greven fucked around with this message at 04:40 on Feb 11, 2017 |
# ? Feb 11, 2017 04:37 |
Evil_Greven posted:Re: Testing Chat - one of my professors years ago had an interesting perspective... it's best to just show you: This is... kind of genius. Terrible, but genius.
|
|
# ? Feb 11, 2017 05:09 |
|
I'd do it with an explicit define to enable tests, but putting simple unit tests in the same file as the code being tested can be pretty nice.
|
# ? Feb 11, 2017 05:31 |
|
It's kind of like the `if __name__ == "__main__"` trick from Python, though I don't think I've ever seen anyone use it for putting tests in the same module.
|
# ? Feb 11, 2017 05:49 |
|
VikingofRock posted:This is... kind of genius. Terrible, but genius. It remind me of some project from 15 years ago where it was something like: code:
|
# ? Feb 11, 2017 05:59 |
|
Hughlander posted:It remind me of some project from 15 years ago where it was something like: It's like unreadable X-macros!
|
# ? Feb 11, 2017 06:36 |
|
let us all just be very grateful that there is no way for a cpp macro to itself #define or #include anything
|
# ? Feb 11, 2017 12:32 |
|
I'm just grateful more languages don't have macros or a preprocessor.
|
# ? Feb 11, 2017 13:58 |
|
smackfu posted:I'm just grateful more languages don't have macros or a preprocessor. Haskell lets you use the C preprocessor for some reason
|
# ? Feb 11, 2017 15:39 |
|
vOv posted:It's kind of like the `if __name__ == "__main__"` trick from Python, though I don't think I've ever seen anyone use it for putting tests in the same module. I do that since testing Python for dumb errors that would otherwise be caught at compile time are usually really time consuming. I've seen my coworkers copy and paste that block without knowing what it does when trying to copy example code I wrote. One file I saw the other day has test blocks from two different examples in it, both of which fail now.
|
# ? Feb 11, 2017 16:00 |
|
Plorkyeran posted:I'd do it with an explicit define to enable tests, but putting simple unit tests in the same file as the code being tested can be pretty nice. I do it surprisingly often for basic unit tests -- the ones I write before/during first iteration The more comprehensive part of the test suite then gets its separate file(s).
|
# ? Feb 11, 2017 16:14 |
|
lmao I just found out golang has goto
|
# ? Feb 13, 2017 01:35 |
|
What's so funny about goto?
|
# ? Feb 13, 2017 02:16 |
|
Lots of things have goto. C# has goto. Java doesn't even have goto (it reserves the keyword but doesn't use it), but they put it in C#.
|
# ? Feb 13, 2017 02:17 |
|
sarehu posted:What's so funny about goto? It's a weird thing to have pop up in a language designed to require minimal competency.
|
# ? Feb 13, 2017 02:53 |
|
Goto does have a few good use cases so it's good to keep around. Even awful programmers have absorbed the lesson to not abuse it.
|
# ? Feb 13, 2017 03:20 |
|
It's a great idea to use goto when it's the best option.
|
# ? Feb 13, 2017 03:27 |
|
sarehu posted:It's a great idea to use goto when it's the best option. When is goto the best option?
|
# ? Feb 13, 2017 03:29 |
|
Absurd Alhazred posted:When is goto the best option? When you're implementing a flow control feature not in your language. For example, try/throw in C.
|
# ? Feb 13, 2017 03:32 |
|
If your language doesn't have multi-level break for loops, then goto is the best way imo.
|
# ? Feb 13, 2017 03:32 |
|
Absurd Alhazred posted:When is goto the best option? error handling in a language that doesn't have RAII
|
# ? Feb 13, 2017 03:33 |
|
Another good use for goto is if a non coder needs to step thru your code to debug something (like a factory technician). A bit of reach yeah.
|
# ? Feb 13, 2017 03:35 |
|
hobbesmaster posted:When you're implementing a flow control feature not in your language. For example, try/throw in C. At that point flow control is the least of your problems. You're going to have to do stack manipulation, and that means writing assembly code.
|
# ? Feb 13, 2017 03:35 |
|
I don't write C, but I think the usual idiom for it is something like:code:
|
# ? Feb 13, 2017 03:40 |
|
Absurd Alhazred posted:When is goto the best option? When you need to break out of a doubly-nested for loop. When you need to break out of a for loop, but the "reach end of loop" case needs to run an extra statement. code:
code:
A common example of the previous is when you realize the nicest way to make the function handle a specific case is for it to call itself tail-recursively with cleaned up parameters. And then you refactor that into a goto with the label at the top (tail recursion). And then you refactor that into a loop.
|
# ? Feb 13, 2017 03:52 |
|
Absurd Alhazred posted:At that point flow control is the least of your problems. You're going to have to do stack manipulation, and that means writing assembly code. Yeah, goto is acceptable when you're in the kind of mess that is low level kernel crap.
|
# ? Feb 13, 2017 04:11 |
|
sarehu posted:When you need to break out of a doubly-nested for loop. Of course, there are fine solutions for each of your examples in modern languages. In the first, replace goto feh either with whatever it needs to do right there or with a function call. Then put a break statement after it. In the second, well if you don't have tail calls you can do a regular recursive call on the function - the optimization loss in minimal in most cases on modern systems. If that does cause problems, well every recursive function can be rewritten to not have recursion at all. You have not convinced me that goto has any uses outside languages such as C and assembly that require/allow you to do low level memory manipulation yourself.
|
# ? Feb 13, 2017 08:21 |
|
|
# ? May 28, 2024 10:24 |
|
I don't know if go has fall through switch or matching but I could see how using goto to model state machines would be useful in go.
|
# ? Feb 13, 2017 09:41 |