|
Ryouga Inverse posted:he claims his "creates" money, too, which is interesting Does that mean we can blame him for the recession? Better fetch my broom.
|
# ? Feb 16, 2010 11:04 |
|
|
# ? Apr 28, 2024 17:19 |
|
Ryouga Inverse posted:he claims his "creates" money, too, which is interesting Hey, who doesn't want a magic money creating black box? I know I sure as hell would like one.
|
# ? Feb 16, 2010 20:24 |
|
TheSleeper posted:Hey, who doesn't want a magic money creating black box? I know I sure as hell would like one. Sometimes it kills you though.
|
# ? Feb 17, 2010 03:50 |
|
I have to fix a few of these every year (hint: guess why it comes up once a year). This is for initializing date/time pickers on windows/web forms using VB.net to by default show a report that spans from a month ago to today:code:
|
# ? Feb 17, 2010 21:52 |
|
Scaramouche posted:I have to fix a few of these every year (hint: guess why it comes up once a year). This is for initializing date/time pickers on windows/web forms using VB.net to by default show a report that spans from a month ago to today: Is it because Month is 0 indexed, and in January the result of (Now().Month - 1) is -1?
|
# ? Feb 18, 2010 07:50 |
|
WildFoxMedia posted:Is it because Month is 0 indexed, and in January the result of (Now().Month - 1) is -1? Close, but not quite. It's more that January (1) - 1 = 0. I had to switch them all to using the in-built date.AddMonths(-1) so it would roll under/over properly.
|
# ? Feb 18, 2010 18:21 |
|
Scaramouche posted:Close, but not quite. It's more that January (1) - 1 = 0. I had to switch them all to using the in-built date.AddMonths(-1) so it would roll under/over properly. Or use (Now().Month + 10)%12+1, but that won't help with the wrong year... and includes the dreaded modulus!
|
# ? Feb 19, 2010 04:17 |
|
I just inherited a codebase where the previous developer had something of a mid-life crisis and disappeared off the face of the earth when it was "about 90%" done. Not only is it actually probably that close to done, but the code actually looks like it was written by someone who knew what they were doing. I'm sure I will find a giant coding horror in here somewhere to whack me upside the head, but so far the only one has been that he didn't know that static classes can have constructors.
|
# ? Feb 19, 2010 06:04 |
|
Ryouga Inverse posted:Not only is it actually probably that close to done, but the code actually looks like it was written by someone who knew what they were doing. Or maybe he realised that static class constructors are the real horror?
|
# ? Feb 19, 2010 20:51 |
|
Ohgod code:
|
# ? Feb 21, 2010 00:07 |
|
Milotic posted:Or maybe he realised that static class constructors are the real horror? What's wrong with them? I mean, you can't/shouldn't put any logic in them that depends on the state when they're called, but if all you're doing is making a class with a bunch of constant data in it that can't be constructed through basic initializers, what's wrong with it? The alternative is having some retarded InitializeConstants() call that has to be done in a bunch of different places.
|
# ? Feb 21, 2010 00:17 |
|
Ryouga Inverse posted:What's wrong with them? I mean, you can't/shouldn't put any logic in them that depends on the state when they're called, but if all you're doing is making a class with a bunch of constant data in it that can't be constructed through basic initializers, what's wrong with it? You can get into headaches if your static constructors reference other static classes with their own static constructors. Also in .NET at least, you have no control over when it executes. And if the constructor throws an exception, it will not and cannot be called again, and then your app domain is a bit hosed. I'd rather use some form of factory / singleton pattern, and perform the initialisation either when the method is first accessed, or just at the start of the application/main loop/whatever. At least you can re-call your setup code if an exception occurs.
|
# ? Feb 21, 2010 02:06 |
|
Two instances that made us want to throw our computers out the window in frustration (both Java): Mine: code:
code:
|
# ? Feb 23, 2010 05:06 |
|
I don't get it. Did someVal or x get affected by someFunction call?
|
# ? Feb 23, 2010 06:25 |
|
RussianManiac posted:I don't get it. Did someVal or x get affected by someFunction call? This is an infinite loop: code:
|
# ? Feb 23, 2010 06:33 |
|
RussianManiac posted:I don't get it. Did someVal or x get affected by someFunction call? It's even simpler than that. Look at the semicolons
|
# ? Feb 23, 2010 06:37 |
|
Infinite Recursion posted:It's even simpler than that. Well that's what you get for using Allman style
|
# ? Feb 23, 2010 11:15 |
|
DoctorTristan posted:Well that's what you get for using Allman style edit: actually -Wextra will only warn for empty if/else/do-while loops, never mind me.
|
# ? Feb 23, 2010 11:36 |
|
Standish posted:what you get for not using -Wextra you mean. http://peter.hates-software.com/2004/08/20/6550cefa.html GCC's option flags are a horror, although of lesser magnitude than GCC's internals and much of glibc
|
# ? Feb 23, 2010 11:50 |
|
Otto Skorzeny posted:http://peter.hates-software.com/2004/08/20/6550cefa.html hey it's the elvis operator!
|
# ? Feb 23, 2010 15:10 |
|
Infinite Recursion posted:It's even simpler than that. Ohh, didn't notice that. That would be frustrating to fix assuming I had a habit of ending while loops with ;
|
# ? Feb 23, 2010 15:49 |
|
Code posted:/// <summary>
|
# ? Feb 23, 2010 21:57 |
|
DoctorTristan posted:Well that's what you get for using Allman style I like my clearly-defined starting and ending points for blocks of code
|
# ? Feb 23, 2010 22:16 |
|
Infinite Recursion posted:I like my clearly-defined starting and ending points for blocks of code Ever heard of indentation?
|
# ? Feb 23, 2010 23:04 |
|
Infinite Recursion posted:I like my clearly-defined starting and ending points for blocks of code code:
|
# ? Feb 23, 2010 23:10 |
|
Eh, I don't really mind either method; indentation is more than enough for me, I was just taught to use the Allman style, and haven't bothered to change that habit. I've even considered going to Python style*, so that the only (efficient) way to distinguish blocks of code is through indentation. *i.e.: code:
Infinite Recursion fucked around with this message at 23:55 on Feb 23, 2010 |
# ? Feb 23, 2010 23:53 |
|
Infinite Recursion posted:Eh, I don't really mind either method; indentation is more than enough for me, I was just taught to use the Allman style, and haven't bothered to change that habit. I've even considered going to Python style*, so that the only (efficient) way to distinguish blocks of code is through indentation. If I ever saw someone using this in practice, I'd probably post it in this thread.
|
# ? Feb 24, 2010 00:20 |
|
ColdPie posted:If I ever saw someone using this in practice, I'd probably post it in this thread. I have seen students do this in practice (albeit without proper indentation). Either you do grouping by indentation or you do grouping by braces; both look fine, but by god, taking grouping by indentation and appending braces to make it balance out makes it look like an afterthought.
|
# ? Feb 24, 2010 00:30 |
|
ColdPie posted:If I ever saw someone using this in practice, I'd probably post it in this thread. I'll never actually use it, of course, but it had been a consideration when I started learning Python (this was before I realised that using one language's standards for another is a terrible idea).
|
# ? Feb 24, 2010 00:31 |
|
ColdPie posted:If I ever saw someone using this in practice, I'd probably post it in this thread.
|
# ? Feb 24, 2010 01:25 |
|
fankey posted:One of my first tasks as an intern many years ago was dealing with a 5k+ line source file that some 'smart guy' programmed exactly in this way. It's really fun when you just want to comment out doSomething in the example above. This was before there were any tools ( at least that I was aware of ) for automatically reformatting code. The indention craziness was just one of the horrors involved in that file. Why oh why do the children not learn to unix in school indent(1) for the uninitiated
|
# ? Feb 24, 2010 01:43 |
|
Otto Skorzeny posted:Why oh why do the children not learn to unix in school No manual entry for indent edit: o it's in osx though Dijkstracula fucked around with this message at 06:21 on Feb 24, 2010 |
# ? Feb 24, 2010 06:09 |
|
Dijkstracula posted:ntaylor@li85-191:~$ man indent code:
|
# ? Feb 24, 2010 08:31 |
|
Dijkstracula posted:edit: o it's in osx though Not on our OSX machines here at work
|
# ? Feb 24, 2010 16:11 |
|
Sewer Adventure posted:
Everyone is using brew now instead of port
|
# ? Feb 24, 2010 16:31 |
|
Otto Skorzeny posted:Why oh why do the children not learn to unix in school
|
# ? Feb 24, 2010 17:38 |
|
Pardot posted:Everyone is using brew now instead of port
|
# ? Feb 24, 2010 19:27 |
|
I had to post this. I've seen a lot of lovely code in my day, but this is hands down the worst method I've ever seen written in my life. This simple method shows such a misunderstanding of the basic principles of coding with Java and coding in general. The method in question is in a utility to format Strings or something. code:
code:
|
# ? Feb 25, 2010 17:29 |
|
What's wrong with that, brah, haven't you ever herd of polymorphism?
|
# ? Feb 25, 2010 17:35 |
|
|
# ? Apr 28, 2024 17:19 |
|
RussianManiac posted:What's wrong with that, brah, haven't you ever herd of polymorphism? it's static "brah"
|
# ? Feb 25, 2010 21:42 |