|
It must be a parody. Please, let it be a parody.
|
# ¿ Jul 6, 2010 23:42 |
|
|
# ¿ Apr 28, 2024 11:32 |
|
How I landed a high-paying new jobquote:If applicable, flirt heavily with whomever is receiving the application - getting someone on your good side can only help you.
|
# ¿ Jul 6, 2010 23:47 |
|
There was an extremely short polyglot quine in an IOCCC entry a while back: Description code:
|
# ¿ Jan 1, 2011 18:44 |
|
If that's C#, you could havecode:
|
# ¿ Jan 9, 2011 02:03 |
|
Treating generated code as anything other than an object file is a horror itself. You're not supposed to read it, so it's fine for a generator to make life easy on itself with stuff like do { ....} while (false) and whatever.
|
# ¿ Jan 31, 2011 10:03 |
|
I prefer to declare variables at the point of first use, because then it's completely impossible to accidentally use the variable uninitialised.
|
# ¿ Sep 25, 2011 23:21 |
|
I think C# does a reasonable job of it. You can't do the nearly as much with C# generics as with C++ templates, but unlike Java it doesn't have type erasure, so generics make sense and don't need heaps of stupid casts everywhere. It still managed to inherit the array covariance misfeature though.
|
# ¿ Nov 28, 2011 21:02 |
|
GrumpyDoctor posted:I would love to see a C implementation where the undefined behavior was things like "changes your desktop wallpaper to a picture of dogs playing poker" instead of just crashing. http://www.feross.org/gcc-ownage/
|
# ¿ Feb 18, 2012 12:12 |
|
I came across this today:code:
|
# ¿ Jun 29, 2012 00:03 |
|
That's a lot of words he used just to say that his new project management software doesn't scale.
|
# ¿ Aug 13, 2012 00:01 |
|
Admiral H. Curtiss posted:The best part is how he actually uses stack.size() (I'm assuming "stack" is an ArrayList) in that insane method -- if he knows it exists, why not just return that? It looks to me like the sort of code that people send as a joke to idiots who ask programming forums to do their homework for them.
|
# ¿ Oct 10, 2012 01:02 |
|
Deffon posted:What am I missing here exactly? At first I though that p wasn't NULL-terminated, but then I saw that 2 bytes were copied from "/" to p. "/" is a string with two bytes, a '/' and a null. Copying those two bytes null-terminates p. It doesn't matter that the first memcpy doesn't null-terminate, because it's immediately followed by one that does.
|
# ¿ Nov 7, 2012 09:09 |
|
Bunny Cuddlin posted:a lot of for loops in the codebase where I work have (int ii = 0; ii < whatever; ii++) and I just realized why this is. I'd have thought it was so someone could search for 'ii' and find the loop variable, rather than trying to search for 'i' and finding every drat thing.
|
# ¿ Dec 6, 2012 09:11 |
|
When I'm writing a delete statement, I start off by writing "WHERE butts='Yes' AND farts=4" then go back and fill in the DELETE FROM once I'm happy with how the rest of it looks.
|
# ¿ Feb 13, 2013 01:50 |
|
HappyHippo posted:Huh? The problem C# has with array covariance is this: C# code:
|
# ¿ Mar 10, 2013 20:21 |
|
HappyHippo posted:Right. But does that affect this case (with the stack class the prof is trying to make)? No, that's fine. C# isn't as crazy as Java, it's just a bit crazy.
|
# ¿ Mar 10, 2013 22:50 |
|
ManlyWeevil posted:From a code review: #define flase 1 I'm sure it's in some header somewhere
|
# ¿ Mar 14, 2013 09:31 |
|
1337JiveTurkey posted:Semi-serious idea: Cut out the middleman and store the parse tree directly in an open format like XML, YAML or JSON. Then have editors use a grammar to display the file for editing and to save the edited file. Use stylesheets to format the displayed source code. If you don't give a gently caress about whitespace, then you might as well have a language that doesn't give a gently caress about whitespace. The problem with normalised formatting schemes is that people come up with the idea, then as they refine it they make a series of decisions that seemed to make sense at the time, and end up proposing a system that uses XML.
|
# ¿ Jul 10, 2013 18:20 |
|
Another reason to commit often is that if you make some changes that don't work out, it's really easy to get back to where you were before you started, without losing any actual correct work.
|
# ¿ Sep 9, 2013 18:58 |
|
Someone's trying to outdo losethos with their own homegrown language/OS monstrosity: http://www.urbit.org/2013/08/22/Chapter-0-intro.html quote:If I can summarize Hoon’s goal, it’s to be the C of functional programming So, how great an idea is this? Let's take a look at the networking code: https://github.com/cgyarvin/urbit/blob/6012eed7a31f7dc9db323dbc4b1cbf361923f620/lib/191/arvo/ames.hoon code:
|
# ¿ Sep 24, 2013 19:07 |
|
He has unorthodox ideas about software versioning, too:quote:In Kelvin versioning, releases count down by integer degrees Kelvin. At absolute zero, the system can no longer be changed. At 1K, one more modification is possible. And so on. For instance, Nock is at 9K. It might change, though it probably won't. Nouns themselves are at 0K - it is impossible to imagine changing anything about those three sentences
|
# ¿ Sep 24, 2013 19:44 |
|
SintaxError posted:OK, am I insane for thinking that C include files should include any dependencies in them? It sounds like total bs to me. I hate it when people write headers that aren't self-contained.
|
# ¿ Oct 10, 2013 20:35 |
|
Compilers these days can detect when a header has include guards and skip it the second time without having to re-read it.
|
# ¿ Oct 10, 2013 22:40 |
|
At a previous job, this is what the system did to look up a user's email address stored in a database: 1) In another database, look up the application ID in a different database to find the location of the database with the user information in it. 2) Convert the request to XML, and http post it to something running ASP.NET on the same server 3) The asp.net page converts the XML request into a different format of XML, and looks up the application ID in a database to find out what port the application is listening on. 4) asp.net does an http post back to the original application with the XML request. 5) The application reads the database information and request out of the XML, and retrieves the email address from the database, and packages it up in XML top send back to asp.net 5) asp.net converts the response XML into different XML, and returns it to the application. I'd been asked to look into why the system was too slow. I replaced all that with a function call.
|
# ¿ Oct 26, 2013 09:37 |
|
Doctor w-rw-rw- posted:PHP horrors are almost run of the mill, but nevertheless... If people are curious what's going on here: In 4.3.0-5.0.5, strtotime("February") returns -1, ie one second before epoch, so the last second in December 1969. In 5.1.0-5.1.6, strtotime("February") returns nothing, which is interpreted as epoch, ie January 1970. In 5.2.0-5.5.5, strtotime("February") returns the current date and time, with the month forced to February, ie 31st February, which in true PHP style is the 3rd March.
|
# ¿ Oct 31, 2013 21:53 |
|
Why does this guy have permission to push to 180 repositories he's not involved with, anyway?
|
# ¿ Nov 12, 2013 09:22 |
|
Is there another mutex class in the codebase that isn't threadsafe?
|
# ¿ Dec 19, 2013 08:47 |
|
nielsm posted:In languages that lack an explicit expression-if construction, having "and" and "or" return its arguments is a massive help. For instance in Lua, foo and bar or baz, equivalent to C ternary foo?bar:baz. The same also works in Python, and I prefer it to the bar if foo else baz construct, only because it keeps the condition first instead of stuffing it in between the two values. I don't like it, because it looks like it's equivalent to foo?bar:baz but isn't.
|
# ¿ Dec 20, 2013 10:43 |
|
Look Around You posted:Lmfao at the guy in the comments suggesting md5-hashing strings to make sure they're equal. And then someone replying to him cautioning about hash collisions (instead of pointing out how absurd it is to use a hash function to test for routine string equality). That guy's comment is amazing. quote:Sometimes when you compare two strings that look "the same", you will find that they aren't. If you don't want to bother finding out why, then this is a simple solution: Skimming the documentation, it looks like that "$string = implode(str_split($string));" just gets back to the original string. Is it just the commenter being dumb or does that code do something for some reason? Qwertycoatl fucked around with this message at 10:47 on Jul 26, 2014 |
# ¿ Jul 26, 2014 10:45 |
|
omeg posted:https://github.com/coapp-packages/bzip2/blob/master/decompress.c It's pretty wtf and could do with a giant comment explaining what's going on, but it's a pretty neat way of doing coroutines.
|
# ¿ Oct 7, 2014 20:58 |
|
The Laplace Demon posted:Can the number of topics only be even? The floor makes it equivalent to: The "min + (max - min)/2" looks like he heard about how to take an average without integer overflow messing things up, but didn't really believe it so cast everything to doubles just in case.
|
# ¿ Nov 7, 2014 09:38 |
|
Honest Thief posted:The problem is they have a method signature setting, I guess, the flag to false to force the new logic, and yet kept the method signature as it is and the whole code. Because, I dunno. The only other place its used the flag is always true, so I dunno, either it's leftover code from whenever or.. It's not forcing the flag to false, it's setting a default value, so if a caller doesn't specify the flag it'll be false, but if they want it to be true they can set it.
|
# ¿ Dec 15, 2014 20:12 |
|
ErIog posted:Is there anyone running a message board by abusing Git commit/merge/clone/message behavior yet? That would qualify for this thread. Not exactly, but
|
# ¿ Feb 10, 2015 01:45 |
|
code:
|
# ¿ May 14, 2015 23:04 |
|
return0 posted:whoa, why does this work It relies on integer overflow. If you repeatedly square an even number, it will become 0 mod 2^32. If you repeatedly square an odd number, it will become 1 mod 2^32. When one of those things happens, the for loop will terminate and the answer will come out.
|
# ¿ May 15, 2015 22:56 |
|
The best bit is that when you're in the nested function, you can use a goto to jump to a label in the outer function
|
# ¿ Jun 25, 2015 23:18 |
|
Volmarias posted:I saw this style a few days ago as well. I'd always heard legends, but never imagined I'd see it myself. The best one I've seen in real life looked like this: code:
|
# ¿ Feb 20, 2016 18:08 |
|
I normally like early return, especially for "bail early in error situations", but there's one situation where I end up regretting it. When debugging, I often find it useful to temporarily add in some logging to a function, like "called foo with parameter 3", "foo returned 7". With multiple return, it's a (minor) annoyance to add this in because the outbound logging has to go into multiple places (or I have to rename foo to foo_inner and make a wrapper).
|
# ¿ Feb 29, 2016 22:18 |
|
Hammerite posted:Less flippantly, it seems like the proper answer to this situation would be to have an option on the archive-unpacking tool that says "if the contents aren't in a top-level directory, then create one for me, named after the archive, and put the files in there instead" (or that could be the default behaviour and there could be an option to suppress it). I use dtrx to extract everything. It does exactly that, and also saves me from having to remember how the command line options for tar work.
|
# ¿ Mar 24, 2016 00:38 |
|
|
# ¿ Apr 28, 2024 11:32 |
|
Cuntpunch posted:
This is my favourite part of this code. It's like the codinghorror "for sale: baby shoes, never worn"
|
# ¿ Aug 4, 2016 22:58 |