|
Milotic posted:Thank you for all the kind words. I found it surprisingly fun. There's a couple of problems with that solution, one of which being it is far too quick - you don't really get the excitement of waiting for the solution. We could throw in Thread.Sleeps, but that's far too predictable. We want people on the edge of their seats. You are a god of overcomplication. I'm stunned. [edit] Although, I noticed you're not really taking advantage of the parallel task library on this one. I took the liberty of altering your code thusly: code:
New Yorp New Yorp fucked around with this message at 00:33 on May 24, 2011 |
# ? May 24, 2011 00:12 |
|
|
# ? May 14, 2024 02:20 |
|
Ithaqua posted:You are a god of overcomplication. I'm stunned. Ah yeah, that's nice. Now it's web-scale. As for being a god of overcomplication, it comes naturally. Up until Friday I was tech lead for the SharePoint platform in my country's central bank. So Enterprise, SharePoint AND Government. I have jury rigged far more hideously complex things than that in my time. Most of my maintenance guides start off apologising for the system.
|
# ? May 24, 2011 00:38 |
|
Weechat has the best scripting interface ever. Instead of your scripting language's object model, you store string representations of pointers.
|
# ? May 24, 2011 02:17 |
|
You guys are overthinking this. FizzBuzz is just a simple state machine that loops between Fi, Bu, Zz, and number printing nodes as shown here.
PDP-1 fucked around with this message at 02:36 on May 24, 2011 |
# ? May 24, 2011 02:20 |
|
If you asked someone to implement fizzbuzz and they drew an fsm what would you do
|
# ? May 24, 2011 04:57 |
|
I'd call them an ambulance.
|
# ? May 24, 2011 06:07 |
|
Contra Duck posted:I'd call them an ambulance. I'd call them a wally, but fair enough.
|
# ? May 24, 2011 15:09 |
|
qntm posted:
drat right. You should be using say.
|
# ? May 24, 2011 17:18 |
|
Ithaqua posted:Dictionary isn't thread-safe as far as I know. It's certainly keeping my 8 CPU cores occupied Dictionary is thread-safe for multiple readers as long as no one is writing to it. Of course since you have to write your own ReadOnlyDictionary class/wrapper to guarantee that no one is writing to it without a lock, I don't see how that's very useful information.
|
# ? May 24, 2011 17:50 |
|
But there's also ConcurrentDictionary, which is a thread-safe dictionary for reading and writing.
|
# ? May 24, 2011 20:14 |
|
Zhentar posted:But there's also ConcurrentDictionary, which is a thread-safe dictionary for reading and writing. And reading from a ConcurrentDictionary is also lockless, which is pretty rad.
|
# ? May 24, 2011 20:24 |
|
Pardot posted:Since we're still talking about fizzbuzz, here is the best solution: This is beautiful. I've had 4 cores pegged at 100% for almost an hour trying to find the seed in python. Not really the best use of my work time.
|
# ? May 24, 2011 21:12 |
|
The c# specification wishes to contribute!code:
|
# ? May 24, 2011 22:11 |
|
Fiend posted:The c# specification wishes to contribute! That code appears in the codebase at work where it is called BooleanFormatter and is about 10 namespaces in. The only difference is that the strings are parameterised. There is a non generic version just below it in the file, it looks like this: code:
|
# ? May 24, 2011 22:59 |
|
quote:#define in C++ deserves an entire essay on its own to explore its rich possibilities for obfuscation. Use lower case #define variables so they masquerade as ordinary variables. Never use parameters to your preprocessor functions. Do everything with global #defines. One of the most imaginative uses of the preprocessor I have heard of was requiring five passes through CPP before the code was ready to compile. Through clever use of defines and ifdefs, a master of obfuscation can make header files declare different things depending on how many times they are included. This becomes especially interesting when one header is included in another header. Here is a particularly devious example: I... I must use this.
|
# ? May 24, 2011 23:20 |
|
Arg, working with a co-worker on a php project...I see he has a bunch of echo getAcctID($acctID); in his code, so I decided to see what the gently caress, and this is what I find: header.php code:
code:
code:
You seriously wasted an hour of my time figuring out what you were doing because you set a variable, then three includes later determined it WAS that variable? I would understand IF it actually did something when it returned no value...
|
# ? May 25, 2011 00:01 |
|
Broken Knees Club posted:I... I must use this. You know about this http://www.boost.org/doc/libs/1_46_1/libs/preprocessor/doc/ right?
|
# ? May 25, 2011 00:11 |
|
Winkle-Daddy posted:Arg, working with a co-worker on a php project...I see he has a bunch of echo getAcctID($acctID); in his code, so I decided to see what the gently caress, and this is what I find: http://website.sucks/index.php?acctID=--(DROP%20TABLE%20accounts)
|
# ? May 25, 2011 00:18 |
|
NotShadowStar posted:http://website.sucks/index.php?acctID=--(DROP%20TABLE%20accounts) Thankfully SQL injection doesn't actually work where I work. Our input validation that's built into PHP/Apache is a blessing and a curse a lot of the time though... (there are probably some more coding horrors I can dig up related to our input validation). e: VVV I'd love to get into our badass validation, but I think it would potentially put my job at risk Any other Yahoo! employees out there know what I'm bitching about though. Winkle-Daddy fucked around with this message at 02:13 on May 26, 2011 |
# ? May 25, 2011 03:44 |
|
Winkle-Daddy posted:Thankfully SQL injection doesn't actually work where I work. Our input validation that's built into PHP/Apache is a blessing and a curse a lot of the time though... (there are probably some more coding horrors I can dig up related to our input validation). Anything short of prepared statements is probably vulnerable to some form of SQL injection, it's just how much effort you want to put in to get past the validation. To contribute, here's something I myself wrote last week. code:
e: 6 different groups, GroupMemberList is a list with about 50 items, PeopleList is around 80 people. Thel fucked around with this message at 21:49 on May 25, 2011 |
# ? May 25, 2011 21:44 |
|
Thel posted:Anything short of prepared statements is probably vulnerable to some form of SQL injection, it's just how much effort you want to put in to get past the validation. The real horror is the useless scope-creation/indenting code:
|
# ? May 25, 2011 23:34 |
|
Terraria is a horror. It's somewhat similar to Minecraft, but with much more of an emphasis on "action RPG" vs "building poo poo." Also its code is worse. The Item object is a great example of its problems. Every Item instance has 61 instance variables, defining: its owner (by player number, 0-7), whether it is wet, how wet it is, if that wetness is from lava, position, velocity, width & height, whether it is active, whether it is currently being grabbed, its spawn time, whether it is worn as armor, how long you've owned it, how long you've kept it, its type, name, style of being held, style of being used, whether it is an accessory (armor), its animation integer ID, use speed, current stack, max stack, its pick power, its axe power, its hammer power, how much damage it does, its knockback power, how much life it heals, how much mana it restores, whether it is a potion, " " " consumable, " " " auto-reusable (hold mouse to use), its color, alpha value, the ID of its use sound, defense value, tooltip string, rarity, the int ID of the projectile it shoots, how fast it shoots, the int ID of its ammo type, how much ammo it uses, life regen speed, mana regen speed, mana use, whether it does not have a use graphic, whether it can't be used to melee with, and a few other values I either couldn't figure out or didn't type. Items range from weapons to potions to armor, yet they all have all of those defined. All the items are defined in one method that is ~3500 lines long. Adding a new explosive item requires adding code in ten locations in three classes. Said new explosive item will work in vanilla servers because they do no validation on client data whatsoever; in fact, clients can pretty much tell servers to delete every block in the world. The class that generates worlds decompiles (from CIL/C#) to ~15,000 lines (750KB). Most of the game's control flow is done using for-loops and nested if-else blocks. Its main class has more than 300 public class/instance variables. Their order in the code is important; if they're sorted alphabetically (Reflector does this) the game will fail due to hitting nulls/going out of bounds of arrays. Also, items are stored in/loaded from character and world files using only their name string. Worth the on Steam but man is its code horrifying to me.
|
# ? May 26, 2011 02:50 |
|
Aleksei Vasiliev posted:The Item object is a great example of its problems. Every Item instance has 61 instance variables, defining: its owner (by player number, 0-7), whether it is wet, how wet it is, if that wetness is from lava, position, velocity, width & height, whether it is active, whether it is currently being grabbed, its spawn time, whether it is worn as armor, how long you've owned it, how long you've kept it, its type, name, style of being held, style of being used, whether it is an accessory (armor), its animation integer ID, use speed, current stack, max stack, its pick power, its axe power, its hammer power, how much damage it does, its knockback power, how much life it heals, how much mana it restores, whether it is a potion, " " " consumable, " " " auto-reusable (hold mouse to use), its color, alpha value, the ID of its use sound, defense value, tooltip string, rarity, the int ID of the projectile it shoots, how fast it shoots, the int ID of its ammo type, how much ammo it uses, life regen speed, mana regen speed, mana use, whether it does not have a use graphic, whether it can't be used to melee with, and a few other values I either couldn't figure out or didn't type. Terraria's written in C#, right? How can someone write a better game than I ever could and still not know what object-oriented programming is?
|
# ? May 26, 2011 03:33 |
|
Someday I hope we'll get to crack open Dwarf Fortress and get something even worse. I imagine it will be like opening the Ark of the Covenant.
|
# ? May 26, 2011 03:48 |
|
The NetHack source code is available right now.
|
# ? May 26, 2011 04:01 |
|
Ugg boots posted:The real horror is the useless scope-creation/indenting I can make it even worse than the original. code:
|
# ? May 26, 2011 04:12 |
|
quiggy posted:
More evidence that coding isn't shipping, and that s are for shippers.
|
# ? May 26, 2011 04:31 |
|
Doc Hawkins posted:More evidence that coding isn't shipping, and that s are for shippers.
|
# ? May 26, 2011 05:24 |
|
Aleksei Vasiliev posted:Terraria is a horror. It's somewhat similar to Minecraft, but with much more of an emphasis on "action RPG" vs "building poo poo." Also its code is worse. What are the chances that Reflector is choking on obfuscated code? I have no idea how anyone could ever wrangle such a codebase.
|
# ? May 26, 2011 05:28 |
|
Aleksei Vasiliev posted:Terraria is a horror. It's somewhat similar to Minecraft, but with much more of an emphasis on "action RPG" vs "building poo poo." Also its code is worse. Stand aside Minecraft, we will show you the true meaning of bad code!
|
# ? May 26, 2011 05:28 |
|
Broken Knees Club posted:What are the chances that Reflector is choking on obfuscated code? I have no idea how anyone could ever wrangle such a codebase.
|
# ? May 26, 2011 05:30 |
|
gibbed posted:It's not obfuscated. Manual obfuscation is an honorable trade, you classist.
|
# ? May 26, 2011 06:38 |
|
Could it just be heavily inlined?
|
# ? May 26, 2011 08:56 |
|
That wouldn't influence the obscene classes Terraria has though.
gibbed fucked around with this message at 09:26 on May 26, 2011 |
# ? May 26, 2011 09:17 |
|
Aleksei Vasiliev posted:Its main class has more than 300 public class/instance variables. Their order in the code is important; if they're sorted alphabetically (Reflector does this) the game will fail due to hitting nulls/going out of bounds of arrays. How the gently caress do you even accomplish this?
|
# ? May 26, 2011 09:35 |
|
dwazegek posted:How the gently caress do you even accomplish this? I could only imagine some variables refer to previous variables, and rely on the specific initialization order. int ONE = 1; int TWO = ONE+ONE; ect. zeekner fucked around with this message at 09:48 on May 26, 2011 |
# ? May 26, 2011 09:46 |
|
God drat I'm starting to hate Javascript. Firebug and other development tools have made it easy to set breakpoints and that just makes things too drat easy. function renderPoopCheckBox() Hmm, how do we get here, I can't find a reference to this function anywhere. Lets go up the call stack: code:
code:
There is no CheckBox in any file, but there is a mention of a "CheckBoxParent". So I try searching for '\bParent\b': var reg = /Parent/; And a few lines later... cl.replace(reg, ""); By the way, this is part of the code that generates that 30 element deep DOM tree that I complained about earlier. If you teach people that Go To statement is considered harmful, they will invent a better goto.
|
# ? May 26, 2011 10:16 |
|
Wheany posted:If you teach people that Go To statement is considered harmful, they will invent a better goto. I think in this case they were trying to get Javascript to do virtual method calls like "real" OO.
|
# ? May 26, 2011 10:29 |
|
Geekner posted:I could only imagine some variables refer to previous variables, and rely on the specific initialization order. Wouldn't compile though, you can't reference the current instance during initialization. Although you can do it with static members. I thought he was referring specifically to instance members, but I must've misread.
|
# ? May 26, 2011 11:41 |
|
|
# ? May 14, 2024 02:20 |
|
quiggy posted:
|
# ? May 26, 2011 13:08 |