|
dustgun posted:Back to crummy code.
|
# ¿ Apr 1, 2008 19:27 |
|
|
# ¿ May 7, 2024 10:12 |
|
blueberrypudding posted:I just had a look and it's actually 200 lines, and he didn't quite write it out. It makes me cringe to see this! code:
|
# ¿ Nov 8, 2009 23:24 |
|
edit: nevermind, completely missed that it was while(FALSE) and not while(TRUE), because if it were while(TRUE) it would have been appropriate to use break over goto
Khorne fucked around with this message at 20:03 on Feb 27, 2010 |
# ¿ Feb 27, 2010 19:59 |
|
An Outland Dish posted:For one of my online homework questions in my intro to programming course for c++, one of the questions was: char* day_lut[8]; day_lut[1]='sun'; day_lut[2]='mon'; ... day_lut[7]='sat'; and then day_lut[day]; with no checking to see if day is a valid number Why yes, there was tons of code like this at the place I was contracted to code for. On a better note, while that is a terrible example for the ternary operator just take comfort in the fact it could have been worse. Just look at the example you responded to. Khorne fucked around with this message at 05:21 on May 13, 2010 |
# ¿ May 13, 2010 02:39 |
|
Avenging Dentist posted:Your example is a clamp/assertion away from being the "right way" in C. Perhaps it is you who is the horror, goon sir? I personally use "that way" when I do things in C. I've even done it in scripting languages because the difference is often non-existent. The horror is when there are multiple arrays defined for the same purpose, using commonly used variable names/names that make no sense, no checking if the value is within bounds (especially when invalid values can and will be passed from time to time), and using it for everything including avoiding a simple if->else construct for two numerical values that aren't referenced anywhere else. The look up table array thing is great when you have numbers assigned to strings and it gets referenced often or used in multiple functions/places, but it's really not great when you are just using it as a lazy one-off else-if and don't implement it properly. You know all of this, but I have to defend my C coding honor. Khorne fucked around with this message at 05:27 on May 13, 2010 |
# ¿ May 13, 2010 05:15 |
|
New Yorp New Yorp posted:Have you ever explained to a room full of developers that their workflow was changing from "check out file, make changes, check in file, resolve conflicts if necessary" to The complexity of CVS/SVN exceeds git's when you start getting into really common development tasks, and instead of it being handled by the software the complexity has to be handled by maintainers, developers, and/or the organization. It's truly awful and I'm glad it's dead for common use. Git handles that stuff in a clean way with no external tools. Even as a single dev, git is extremely good and convenient due to its local nature. Kinda like using linux is really good and convenient if you're a developer. It does require some investment to learn git. A few hours and five minutes of googling here and there, like the rebase thing above, but the pay off is huge. There's a reason it's the standard now and it isn't momentum or a fad. edit: To be fair to SVN, the last time I used it was in 2009. It looks like they've updated a whole lot of things since then. Git is not without its flaws either. Even sites really biased toward svn, like https://svnvsgit.com/, don't really sell you on SVN. Most of the git flaws are "you can't do things you shouldn't be doing anyway" and "your developers might have to learn how to use it because it can do powerful things", although a few are pretty legitimate complaints for specific uses. If SVN is used in certain business environments, it's understandable and they likely have the structure and policy to properly run with it. I don't like distributed things much in general, but Git solves so many problems you encounter while using non-distributed systems that it has won me over. Khorne fucked around with this message at 00:45 on Aug 15, 2017 |
# ¿ Aug 15, 2017 00:01 |
|
New Yorp New Yorp posted:- are currently using centralized version control I'm not sure if medical, finance, or accounting make much of a difference for SVN vs git. Some argue that git doesn't let you hide stuff from some users, but I'd argue version control is probably not where those things belong in the first place. Khorne fucked around with this message at 14:01 on Aug 15, 2017 |
# ¿ Aug 15, 2017 13:09 |
|
GenJoe posted:You are a 2-3 person development shop, and you need to build out a relatively complex web application. Node.js is appealing because: I love Javascript for what it's good at. I've used Node a decent amount. Just, most of the time you should probably consider other options unless it's a small project or really time constrained. Javascript feels like you're perpetually prototyping. Khorne fucked around with this message at 16:04 on Sep 2, 2017 |
# ¿ Sep 2, 2017 15:47 |
|
PhantomOfTheCopier posted:Seemed to be getting off topic; as I said, time to move forward. I think "how do I work in change/revision control system /dev/null?" belongs in the other thread, but it's probably effectively a "how do I git?" thread so good luck with your non git questions. Are there parent and child references? I guess without parent references you need to loop through the linked list until you get to something whose child is i or j. With parents this is unbelievably straight forward unless you're trying to be like "i/j is the head node! gotcha!" edit: Oh. Uhh, wouldn't c->next=b be just wrong? There's no guarantee i+1 is supposed to point to j. It should be j-1 instead of i+1, but the variable names and structure of this function are questionable. There's no checks if you're getting a valid node, no checks for bounds (if i=head or i=tail, have fun), etc. Man what the heck. I'd definitely at least use like ni, nj, nip, njp or something and allocate them in a way that makes sense logically. It's important to be anal when writing C functions that are presumably going to be relied upon by unknown, higher level code. It's also important for code to be somewhat readable in case you screw up or someone wonders what it does. Khorne fucked around with this message at 20:23 on Sep 2, 2017 |
# ¿ Sep 2, 2017 17:42 |
|
Did you guys know you can solve the dining philosophers problem by just delaying the start of the dining? Philosopher one dines with no start delay, his adjacent philosophers dine with some small initial delay, and the last two guys dine with a larger initial delay than the previous two.
|
# ¿ Jul 14, 2018 05:13 |
|
And here I am thinking that C++11 and beyond bloated the language a bit.
|
# ¿ Jul 18, 2018 20:38 |
|
Athas posted:Well, the researcher problem is to document a parameter called "u" with the description "u". The weird parameter indexing is just... I don't know. Maybe I am the horror here, I don't know. edit: for example, one instance of my program will have 12 variables that don't change during the life of the program but you might stop your program, change the settings, and restart your program. I usually establish a struct for "settings" and then either pass it to relevant functions or keep it as a global. Stuff like time step size when it's constant, bounding box, particle count if it never changes, that kinda stuff. Khorne fucked around with this message at 16:29 on Jul 21, 2018 |
# ¿ Jul 21, 2018 12:52 |
|
Ola posted:Pass by value = Debbie doesn't swallow
|
# ¿ Jul 24, 2018 18:45 |
|
Ola posted:Have I? If she Khorne fucked around with this message at 20:04 on Jul 24, 2018 |
# ¿ Jul 24, 2018 18:59 |
|
ratbert90 posted:Low level C programmers that treat C++ like C with classes are the absolute worst. If you really want to troll open source C++ projects submit "C but functional programming". Did you know you can implement tail call optimization in a handful of lines? Khorne fucked around with this message at 23:50 on Jul 25, 2018 |
# ¿ Jul 25, 2018 23:17 |
|
rjmccall posted:There are all sorts of things you can cut out of your C++ Experience™ and still be a reasonable C++ programmer — exceptions, RTTI, complex inheritance, heavy template use, virtual dispatch, heap allocation, and so on — but I have zero reservations about saying that if you're not using classes with constructors and destructors to encapsulate data, preserve invariants, and manage resources, you are just a bad programmer and you should learn to be better. I get what what people are complaining about now if people actually do what you outlined. I also get complaining about what I described above if it's in software where you absolutely should be using the stl and writing code in a way that the rest of the project is written. Khorne fucked around with this message at 16:57 on Jul 26, 2018 |
# ¿ Jul 26, 2018 16:42 |
|
ratbert90 posted:Woah woah woah there pal. Let's not get hasty! Postgre supports JSON and JSONB and is cool and good. I haven't actually ever ran into any problems with yanking a json object out of a pgsql db and having anything bad happen to it. I assume it's probably not efficient or something when it comes to high capacity websites, but I am thinking embedded here. Ranzear's solution is a very SQL solution and makes sense sometimes for data you want to do SQL stuff to. It has its own caveats if you are talking ultra high capacity. I mean, sometimes you have a table with a lot of columns. There's nothing inherently wrong with that, although naming it "Field1 ... Fieldn" seems like total nonsense and like a blob really might be the best solution or rethinking what you're doing entirely that necessitates storing it that way. Sometimes you split that table up into a few tables, sometimes you split it up like ranzear suggested, and sometimes you serialize it and store it as a blob because you don't need to do SQL stuff to it. canis minor posted:This, but serialized data. Khorne fucked around with this message at 23:13 on Jul 27, 2018 |
# ¿ Jul 27, 2018 23:06 |
|
Jeb Bush 2012 posted:I know names are harder than anyone expects but I am still amazed that anyone would be stupid enough to think that "10 letters, no special characters" would be a reasonable restriction on a field that is required to contain someone's (exact, legally specified) name edit: Yeah, you usually see First: FNU, Last: their name. I have no idea why this guy's passport was like that, but he ended up getting on the plane anyway. Khorne fucked around with this message at 02:04 on Aug 13, 2018 |
# ¿ Aug 12, 2018 23:11 |
|
ratbert90 posted:I’m tempted to get a thread ripper 2. 32C/64T@4.2GHz. In a bizarre twist of fate, or perhaps a sign of the times, it's Windows that has poor support for the threadripper at the moment.
|
# ¿ Aug 14, 2018 17:37 |
|
TooMuchAbstraction posted:Wow, I typoed the poo poo out of that example query. I guess I know the answer considering the NoSQL "revolution" and all of the horrors there I've witnessed. Khorne fucked around with this message at 04:10 on Aug 26, 2018 |
# ¿ Aug 26, 2018 03:43 |
|
TooMuchAbstraction posted:Nope! It just gets silently truncated! I'm still working with some early 5.x MySQL servers. I don't know why because we definitely have and use up to date versions of MySQL and other databases. At least I'm not the guy managing Java and Oracle stuff from nearly two decades ago. Oh, the box running Java5 and an OS that hasn't seen an update in over ten years got compromised? Khorne fucked around with this message at 21:59 on Aug 26, 2018 |
# ¿ Aug 26, 2018 21:44 |
|
Absurd Alhazred posted:On a scale of 1 to 11, how bullshit is this? Webcam, microphone, and storage media are already securely accessible from web pages. It's not quite as insane as it sounds, and they propose similar security mechanisms.
|
# ¿ Aug 27, 2018 19:35 |
|
With FIFO and LIFO taken, I'm an octree with two spatial dimensions and one temporal.
|
# ¿ Aug 30, 2018 18:56 |
|
CPColin posted:Holy poo poo that whole repo is a loving dramabomb right now. Execution and circumstances aside, attacking organizations through the licensing of software is actually a cool concept. Khorne fucked around with this message at 20:25 on Aug 31, 2018 |
# ¿ Aug 31, 2018 20:15 |
|
Suspicious Dish posted:Old browsers were really bad and would parse <script>"<script>"</script> as a nested script tag because that's sort of weird. The text/javascript replacement either to get around some extremely sort of basic filter / block or a misunderstanding of what was going on with the "scr" + "ipt" thing. Note, that this hack hasn't been necessary since IE5. Khorne fucked around with this message at 03:08 on Sep 7, 2018 |
# ¿ Sep 7, 2018 03:00 |
|
Volguus posted:Hey, stop making fun of Gnome, they'll remove the browser completely next version. This is not a sincere question, but it's likely how the button was removed.
|
# ¿ Sep 27, 2018 04:17 |
|
Loezi posted:More of a computers-are-a-horror but I was recently made aware of the fact that given an initial state of Or perhaps in your expectation of the output of that code, because code like that is fine if you are expecting input from either state and there's a guarantee that the MOV is atomic. edit: There's also the obvious that I overlooked, that registers are thread-local. They'll always be "0" or "whatever they are set to not from your threads" if you create two threads to execute your instructions and then check EAX and EBX from the thread that launched those other threads. I was too caught up on the assembly and parallel execution. If you're reading from the threads given, one of the registers should always be zero because you're not setting it in that thread. The register you are setting will either be 0 or 1. Khorne fucked around with this message at 23:06 on Sep 28, 2018 |
# ¿ Sep 28, 2018 22:36 |
|
quote:I think that's called "software development." For example, every REST or GraphQL web app right now would have been faster and more secure as a database that properly uses authentication, authorization, triggers, relations and constraints. But once a problem is solved, you need to start coming up with more problems. So let's just use the database as a key-value store and rewrite all the rest in slow-as-hell, insecure-as-poo poo Rails. And yeah, GraphQL is/was in pure hype mode. It's a reasonable thing to use in some specific cases, but it's getting wildly overused. Khorne fucked around with this message at 17:39 on Oct 1, 2018 |
# ¿ Oct 1, 2018 17:08 |
|
Zopotantor posted:The author clearly doesn’t know what "volatile" is for, so they probably misunderstood the problem, too. Do you want to find out what inline means? Khorne fucked around with this message at 15:47 on Oct 3, 2018 |
# ¿ Oct 3, 2018 15:44 |
|
namlosh posted:...Until you can’t because the rules are too complex to be serviced by the c# Task.Parallel or other libraries.
|
# ¿ Oct 5, 2018 20:48 |
|
Jaded Burnout posted:I found the culprit for the copy/paste block of garbage single-letter variables. Of course *some* people think it's good code.. Also, you all missed the real obvious significance of these single letter variable names: c = "count of significant figures after the decimal point" d = decimal point t = triple digit separator s = sign i = I gave up trying to think of how to describe this j = justify using a triple digit separator Khorne fucked around with this message at 15:50 on Oct 12, 2018 |
# ¿ Oct 12, 2018 15:47 |
|
hailthefish posted:That would be pretty weird and horrible if that's actually what's happening. Unless it's a situation where the other players could see him on the server but the los check was failing server side too for some reason. That's more understandable I guess, but I find it less likely given that he stood still and zoomed and died. Zooming shouldn't actually change anything on the server. Khorne fucked around with this message at 15:17 on Oct 26, 2018 |
# ¿ Oct 26, 2018 15:13 |
|
I find it far fetched that both a php lambda exists and that someone also decided to use it.
|
# ¿ Nov 30, 2018 15:34 |
|
xtal posted:Lambda is basically overcomplicated, expensive CGI, so that makes perfect sense. I also don't know why someone decided to use it. Jokes aside, there are some legitimate uses. I'm not even sure how most places use Lambda. Where I've worked, it's largely used to perform cron style tasks or to trigger on certain conditions that often wouldn't be desirable or possible on a node itself. There's also a convenience factor at times. With all that said, I'm not sure why you'd write anything like that in PHP. And I don't even hate PHP or anything. I'd take a job writing PHP if the compensation and fit were right, but I've yet to see one of those. Khorne fucked around with this message at 15:47 on Nov 30, 2018 |
# ¿ Nov 30, 2018 15:38 |
|
New Yorp New Yorp posted:Not everyone has used *NIX systems extensively. Or at all. With modern editors/IDEs, is there even a difference anymore given how awesome VSCode is, the command-line stuff is mostly useful for project janitoring, setting up environments to run in, and when combined with git. And even with git, it's not nearly as useful and prolific as it was with CVS/SVN. I'd find it either suspicious or irrelevant if they didn't know what grep is depending on the language used and the projects they've had experience with. At the same time, they're a junior dev so it doesn't matter. grep, like all GNU, takes half a second to learn and a lifetime of man, --help, or googling to never master. And by that I mean, it's easy to know what a command can be used for but most are used infrequently enough that you never really commit it to memory and just look it up. Khorne fucked around with this message at 16:33 on Jan 5, 2019 |
# ¿ Jan 5, 2019 15:47 |
|
I don't get why people use anything other than command line for git. Everything else is awkward in comparison. Especially once you understand what git is doing under the hood and want to make sure the right things are happening. I work with plenty of people who use GUIs for git stuff. I'm not knocking it too much, but you're putting in way more effort to learn a cumbersome gui than it would take to just learn git. Khorne fucked around with this message at 14:31 on Sep 30, 2019 |
# ¿ Sep 30, 2019 14:26 |
|
Just wanna say thanks for the replies everybody. I asked you something I didn't want to ask my coworkers because people get all high and mighty about their preferred way of doing things, feel like you're calling them out and start questioning their life choices, or think but don't say "who cares can we talk about something else". Some good, insightful reasons as to why some people prefer GUI. A few of you just need to spam "git status" between every breath and use git diff with either HEAD~N or a remote branch name to solve your CLI woes. But some others had good points, like if you're regularly but not frequently doing complex staging workflows the CLI is going to be a pain. And some people will prefer visualization. Which makes sense, because you made me realize I sometimes check bitbucket or github or whatever for similar things. So truly, I am inferior for using a web interface instead of a GUI. I never even considered the "I use both" workflow, either. Most GUI users I know use the GUI until they're forced not to because they accidentally broke everything with the GUI. JawnV6 posted:this is some faint praise If you meant that the other way, like for me, I didn't mean it that way. I consider lots of people who replied better at programming and probably git. Khorne fucked around with this message at 05:19 on Oct 1, 2019 |
# ¿ Oct 1, 2019 05:17 |
|
Bongo Bill posted:Scrum is the compromise you resort to when you don't have the autonomy to do something sane instead. The big pluses of implementing them are consistent and predictable workload for developers (aka work sane hours/schedule how you spend your time better), product getting "this is a way to get developers to evaluate the rough time it will take to do the stories related to this feature so we can figure out how many features make it into a sprint, cut requirements, split it into two releases, or know which release it could feasibly be in", and management of developers getting "this is a way for us to predict the rough output of our team in a given sprint and for me to assign appropriate workloads to individuals, see how a junior developer matures over time, etc." The point of these systems is to create an iterative process that fosters communication between teams, gives a rough roadmap to everyone relevant in the company, and allows you to modify that roadmap if things don't go as planned. The point isn't "each developer's peak output is 13 points per week and we'll now require that". yes I've had largely positive experiences with agile/scrum/kanban, but it's not because the systems are amazing it's more that people employed techniques from them that solved actual business problems we were having in a way that was appropriate for the company.
|
# ¿ Jan 24, 2020 15:11 |
|
rjmccall posted:Why didn’t you just reorder the new columns to be last instead of making them jump through the extra hoop of figuring out that the new data is missing? Just to spite whoever does their data import? How standard it is probably depends on the language. Python is extremely common in ops/data science/analyst land and DictReader/DictWriter or pandas sees pretty prolific use there. It's also standard to never reorder columns because you want the least friction possible for any manual excel automation, "magic" bi software, index-based approaches, or "I've seen this CSV 1000 times why is this column different now it ruins everything and I will brood everytime I see the change" people. Khorne fucked around with this message at 02:43 on Jan 24, 2021 |
# ¿ Jan 23, 2021 23:10 |
|
|
# ¿ May 7, 2024 10:12 |
|
repiv posted:https://github.com/ben0x539/totally-safe-transmute/blob/master/src/lib.rs * imports C dll that writes to random memory addresses through FFI with safe wrapper and curses the lack of safety in Rust * * calls NtWriteVirtualMemory/WriteProcessMemory from safe rust and curses the compiler for not saving me from myself * Khorne fucked around with this message at 15:27 on Feb 28, 2021 |
# ¿ Feb 28, 2021 15:07 |