|
I started this job as a network contractor, I was only supposed to run some cabling and hook up some new workstations. Then my shop burned down and he offered me a position full time. My job now is to port this complete disaster over to a more modern and secure system than VBA in Access 2000. The best part is that there's only four full time employees here, and not a single one of them knows how the entire system works, so I'm forced to actually try to translate this disaster on my own and make it work on a new platform without knowing a single thing about operations here. (This has been live and in use by the company for seven years now) tAutonumber has one record in it, who's sole duty is to hold the value of the most recent order number created so the table that stores the orders knows to increment the order value by one. code:
|
# ? Jul 11, 2008 16:49 |
|
|
# ? May 15, 2024 04:51 |
|
code:
|
# ? Jul 11, 2008 18:08 |
|
ryanmfw posted:I've seen some elegant solutions at programming competitions: 6 hours? this was the best I could come up with, took me about 15min. code:
(really, I am curious)
|
# ? Jul 11, 2008 21:26 |
|
wolf_man posted:Is there a more elegent/better way of solving this problem ? Probably not using PHP would make it more elegant
|
# ? Jul 11, 2008 22:03 |
|
wolf_man posted:6 hours? this was the best I could come up with, took me about 15min. wolf_man posted:Is there a more elegent/better way of solving this problem ?, which requires a few hours to figure out?
|
# ? Jul 12, 2008 02:00 |
|
wolf_man posted:Is there a more elegent/better way of solving this problem ?, which requires a few hours to figure out? Heh, this was fun. I don't know if this is more elegant, but it can sure spell out a lot of numbers! In Java: code:
|
# ? Jul 12, 2008 05:51 |
|
Save the whales posted:
Bug report. Severity: Critical.
|
# ? Jul 12, 2008 06:04 |
|
Smackbilly posted:Bug report. Severity: Critical. Arrrgh! *dies* edit: quote:Here's a hint. Jesus. Settle down. Save the whales fucked around with this message at 08:02 on Jul 12, 2008 |
# ? Jul 12, 2008 06:10 |
|
Is this going to become another fizzbuzz? As with that, anyone who posts a solution is probably not fit to do so.
|
# ? Jul 12, 2008 06:25 |
|
Chain Chomp posted:Is this going to become another fizzbuzz? As with that, anyone who posts a solution is probably not fit to do so. I had forgotten that utter clusterfuck until now. There was like one correct solution in the several hundred solutions posted to that blog. It was atrocious. And hilarious. I forget who's blog it was, but man it must have sucked to be that guy. "Gee, a pile of morons make up my readership. "
|
# ? Jul 12, 2008 07:29 |
|
crazypenguin posted:I forget who's blog it was, but man it must have sucked to be that guy. "Gee, a pile of morons make up my readership. " Here's a hint. quote:Coding horrors: post the code that makes you laugh (or cry)
|
# ? Jul 12, 2008 07:41 |
|
I was bored. On a friday night. Oh god.code:
|
# ? Jul 12, 2008 07:45 |
|
Chain Chomp posted:Is this going to become another fizzbuzz? As with that, anyone who posts a solution is probably not fit to do so. OneEightHundred fucked around with this message at 09:33 on Jul 12, 2008 |
# ? Jul 12, 2008 09:28 |
|
mofmog posted:I was bored. On a friday night. Oh god. Oh dear, difficult to be so concise in C: code:
|
# ? Jul 12, 2008 13:59 |
|
For some reason when I did problem 17 on eulerproject, I decided to do this for teens:code:
To contribute something other than my lovely code - the Fortran code I'm seeing as a vacation student in a physics department makes me cringe. Maybe I'm just too dumb to understand what the indecipherable variable names are for (given that all the code is in a single function anyway, all 12 pages or so), or understand the flow given the complete lack of comments.
|
# ? Jul 13, 2008 00:01 |
|
chips posted:To contribute something other than my lovely code - the Fortran code I'm seeing as a vacation student in a physics department makes me cringe. Maybe I'm just too dumb to understand what the indecipherable variable names are for (given that all the code is in a single function anyway, all 12 pages or so), or understand the flow given the complete lack of comments. Nope, that is how physicists program in Fortran. Most of the ones I've known see programing as that unfortunate necessity of doing research and therefore learn just enough to hack together spaghetti code and leave it at that. One of my friends who is a physics grad student was handed a program by a professor written by the professor and told to set it up on a small cluster the university just bought. He was instructed that he was not allowed to make any changes, despite the fact that the program doesn't compile on the cluster due to different compilers. Yet he is still somehow supposed to make this work.
|
# ? Jul 13, 2008 00:58 |
|
chips posted:To contribute something other than my lovely code - the Fortran code I'm seeing as a vacation student in a physics department makes me cringe. Maybe I'm just too dumb to understand what the indecipherable variable names are for (given that all the code is in a single function anyway, all 12 pages or so), or understand the flow given the complete lack of comments. See my story on the previous page! With a younger generation of physicists rising in academia, the programming standards are improving by a lot, but much of the older stuff is truly horrendous. The worst are old codes that can't possibly be changed because every useful piece of software depends on them.
|
# ? Jul 13, 2008 23:55 |
|
sarehu posted:I wrote one in XSLT How did you do that? Wouldn't the nesting of call-templates cause a stack overflow? Or did you <xsl:for-each select="//node()[position() < 999999]"><xsl:value-of select="position()"/></xsl:for-each> or something? I want to see this abomination N.Z.'s Champion fucked around with this message at 00:28 on Jul 14, 2008 |
# ? Jul 14, 2008 00:26 |
|
N.Z.'s Champion posted:How did you do that? Wouldn't the nesting of call-templates cause a stack overflow? There really aren't that many levels of recursion needed, I don't know what kind of crazy algorithm you're thinking of. sarehu fucked around with this message at 04:27 on Jul 14, 2008 |
# ? Jul 14, 2008 02:31 |
|
code:
|
# ? Jul 25, 2008 16:15 |
|
code:
code:
|
# ? Jul 25, 2008 17:20 |
|
Save the whales posted:Jesus. Settle down. I may be misinterpreting this whole chain of events, but I'm pretty sure Chain Chomp is not insulting this thread itself, but referencing the fact that the blog on which the whole fizzbuzz thing occurred was named Coding Horror and using the thread title as a hint to its name.
|
# ? Jul 25, 2008 19:20 |
|
I don't remember the exact code syntax, but one engineer who no longer works with us essentially wrote something like this:code:
This same person obviously wasn't terribly familiar with C or C++, because I caught one bug that was caused by him C-style casting a pointer to a different type that wasn't related by inheritance. He was literally getting an int out of this class where the address of an int would be in some other class. Also a header for a function I wrote when I was in my "templates and boost are awesome" phase (which I'm still in). code:
|
# ? Jul 26, 2008 07:03 |
|
I came across the original version of the Ken's Labyrinth source code by Ken Silverman of BUILD engine fame (which powered Duke3D) here. It's 8000 LOC in one single C file. It's pasted here for the time being: http://rafb.net/p/mrXyPD73.html
|
# ? Jul 26, 2008 18:08 |
|
Tetrad posted:He was literally getting an int out of this class where the address of an int would be in some other class. I've seen strcpy used on std::string, and it worked. The strcpy prototype was brought into scope from gcc header files copied into the project directory tree. With date stamps in the early 90s; this was in 2005. quote:Also a header for a function I wrote when I was in my "templates and boost are awesome" phase (which I'm still in). Nothing wrong that :-)
|
# ? Jul 29, 2008 09:29 |
I just discovered about 120 lines of code in an application that were ripped wholesale from EX-DESIGNZ.NET (totally radical). It's also code that I have to debug and fix. The best part is you can tell it was stolen from a website because it's the only code in our 150,000 line codebase that has comments.
|
|
# ? Jul 31, 2008 16:53 |
|
code:
|
# ? Jul 31, 2008 17:12 |
|
Zombywuf posted:Words fail me. code:
|
# ? Jul 31, 2008 17:46 |
|
As posted in ##c++ on freenode:code:
|
# ? Jul 31, 2008 18:33 |
|
Vanadium posted:As posted in ##c++ on freenode: Would it have been so hard to keep a second vector of invalid nodes and then invalidate those after the for loop?
|
# ? Jul 31, 2008 18:56 |
|
chocojosh posted:Would it have been so hard to keep a second vector of invalid nodes and then invalidate those after the for loop? Keeping a vector of invalid nodes does not solve the problem at all because that just replaces the Dirty() check with a check against the vector of invalid nodes. The proper solution (edit: which is not directly compatible with the guy's architecture, yeah) looks like code:
Vanadium fucked around with this message at 20:04 on Jul 31, 2008 |
# ? Jul 31, 2008 20:01 |
|
Sorry, I wasn't clear, I meant:code:
|
# ? Jul 31, 2008 20:42 |
|
You're both missing the real problem. DestroyEvent() takes a CGameEvent* (or CGameEvent*&); it's not invalidating any iterators. So, that comment is ironic, because the remaining events won't be iterated. mEvents.begin() isn't going to change, so re-accessing or deleting that element that got destroyed on the first iteration will probably crash the program. edit: What's an "lIterator" supposed to be, anyhow? Loser Iterator? Mustach fucked around with this message at 21:17 on Jul 31, 2008 |
# ? Jul 31, 2008 21:14 |
|
Mustach posted:You're both missing the real problem. DestroyEvent() takes a CGameEvent* (or CGameEvent*&); it's not invalidating any iterators. So, that comment is ironic, because the remaining events won't be iterated. mEvents.begin() isn't going to change, so re-accessing or deleting that element that got destroyed on the first iteration will probably crash the program. I assumed that DestroyEvent was going to modify the vector on its own, looking up the element being destroyed by value.
|
# ? Jul 31, 2008 21:39 |
|
Oh man, that would make that segment of code a lot worse.
|
# ? Jul 31, 2008 22:48 |
|
_aaron posted:No, see, this is great, because then you can do things like: I can't help but feel you've missed everything that's wrong with the code I posted.
|
# ? Aug 1, 2008 10:12 |
|
Zombywuf posted:I can't help but feel you've missed everything that's wrong with the code I posted. You didn't post it all either, the Boolean Utilities class has four methods. Only one of which uses the Formatter method, the other two use the ternary operator. A method so useful he couldn't be bothered to use it.
|
# ? Aug 1, 2008 11:03 |
|
Oh god I wish I had the space to paste all the bad code I've seen. Here's a list of some of the worst: #1 Worst I once inherited an ASP site that pushed everything it did through a generic page called something like "functions.asp" that had about a bazillion if statements to handle every possible posting from any page on the site. For instance if you changed the name of someone then changename.asp would post to functions.asp to make the change and then redirect to whatever.asp. Also there were many many many cases where the difference between two things was one line, with 100+ lines copied and pasted, so functions.asp was like 30,000 lines long. I'm not even joking about that. Needless to say I was very happy that project was rarely used and no one ever requested changing anything large in it otherwise I would have had to recode the entire thing. #2 Worst The current website I'm working on is half written in .NET and half in vanilla ASP. The ASP side uses Mysql, and the .NET side works with SQL Server. Both sides represent half of each of our products, and there is hardly any sharing of information across the two. When I say half of our products I don't mean half of our store is one one side and the other half is on the other, I mean each product has half of its information in MySQL and the other half in SQL Server and each site's product pages just cross-link to each other. If that sounds confusing that's because it is, people here get lost on our site so our customers really have no hope and I'm pretty sure we make sales purely on luck. My project for the last few months has been to scrap both sites and rewrite the entire thing. If that wasn't bad enough, the .NET side is a rather complex online-book system. This system uses a completely different DAL for the user side as opposed the admin side, and neither DAL maps tables or views to objects, they merely map queries to datareaders and have very static insert/update functions that need to be adjusted or created whenever you want to do something different. We're currently converting everything to be based on extended SubSonic objects. #3 Worst Regrettably this happened on a project where I was leading the development. A programmer we hired because he was very experienced (20 years) but never wrote any .NET decided the best way to handle database results was to load everything into parallel arrays. Parallel arrays that existed in the default page. So in Default.aspx.cs you would have an array for each field that was returned, for every query. These arrays were also where information that was to be inserted and updated were stored and that was handled by many many many specialized functions that made absolutely no sense to me. Luckily this was limited to just the sign-up section and didn't effect the main application and was easily rewritten. Note this happened after I walked him through our DAL as well. It certainly explained why it took him 3 weeks to create a couple of registration pages.
|
# ? Aug 5, 2008 21:46 |
code:
|
|
# ? Aug 7, 2008 15:00 |
|
|
# ? May 15, 2024 04:51 |
|
code:
code:
|
# ? Aug 7, 2008 17:21 |