|
LOOK I AM A TURTLE posted:I blame stuff like this partly on the relative difficulty of doing little ad-hoc checks for membership in some constant list in C#. In Python, even your average terrible programmer can figure out how to do this: Pretty much. I ended up having to determine all of the different sectors, and their corresponding subsectors and put them in their own static lists of ints. So now you can just do C# code:
*edit #2* And if I were to actually spend more time on it (if I actually owned the solution) I'd have a valid system setup to determine the correct page codes instead of just going off of integers. But Doh004 fucked around with this message at 18:23 on May 31, 2012 |
# ? May 31, 2012 18:11 |
|
|
# ? May 17, 2024 02:24 |
|
Apparently neither of you read my second sentence. E: vvv epswing fucked around with this message at 18:31 on May 31, 2012 |
# ? May 31, 2012 18:19 |
|
epswing posted:Apparently neither of you read my second sentence. Sure they did. You said "it's not much of an optimization", and trex pointed out that it might not even be an optimization.
|
# ? May 31, 2012 18:27 |
|
ijustam posted:This code At my last job they couldn't decide between that approach, and "throw each SQL statement into a table, query for it at runtime, and EXECUTE it". I think all veteran programmers know exactly which solution they ended up picking - both.
|
# ? May 31, 2012 18:59 |
|
So I needed to query a list of key/value pairs from the database, and of course it turns out that they're stored as a big ol' string in one column of the relevant table, and looks kind of like this:code:
}*,*{ ]_,_[ If you're not giggling already then you have a much cleaner mind than me and every coworker I showed this to.
|
# ? Jun 1, 2012 00:33 |
|
pokeyman posted:Sure they did. You said "it's not much of an optimization", and trex pointed out that it might not even be an optimization.
|
# ? Jun 1, 2012 05:39 |
|
NiceAaron posted:}*,*{
|
# ? Jun 2, 2012 01:04 |
|
PrBacterio posted:I *think* I'm getting the second one but the first one frankly doesn't really look like anything to me It looks like a lady's torso.
|
# ? Jun 2, 2012 01:11 |
|
I see a high owl.
|
# ? Jun 2, 2012 07:49 |
|
I saw a stoned dwarf in a barrel. vv
|
# ? Jun 2, 2012 07:55 |
|
its an elephant on pcp.
|
# ? Jun 2, 2012 09:02 |
|
A man peeking out with boobies on each side of his face. Lucky guy. It may also be a man with grotesquely large ears. Lucky guy.
|
# ? Jun 2, 2012 10:07 |
|
Not sure just how much of a coding vs business horror this is, but: Ran into a problem at work of a technopolitical nature. Asked for help with it in this post, but the summary is that my code and client code are butting heads and one of them will have to be modified to make everything work. Managed to modify my code to make it fit, but that's not the horror. The horror is that I mentioned this problem to a carpool buddy, and that my only good options here were break client code or modify my code. He suggested that I break the client code, then explain to the client that it was necessary to make my code work. The client, being a rational business owner, will totally understand that you, as the expert they hired, know what you're doing better than they do, that this is the best way to make your code work, and they definitely won't resent you suggesting their site is ugly and badly coded. And then after this meeting where they thank me for breaking their site, we'd all ride off on our unicorns to Neverland, to have tea with the Queen of the Fairies. Hell, I'm a programmer with Asperger's, and I have a better grasp on people than this guy does. Re: The delimiters, I understood the first one fairly quickly to be a curvy lady's torso, but the second one is a bit more puzzling. Man's torso, possibly with a boner?
|
# ? Jun 2, 2012 20:56 |
|
darthbob88 posted:Re: The delimiters, I understood the first one fairly quickly to be a curvy lady's torso, but the second one is a bit more puzzling. Man's torso, possibly with a boner?
|
# ? Jun 2, 2012 22:29 |
|
trex eaterofcadrs posted:Yeah you guys are all talking about serialization, and I've never used it professionally so I was just tossing it out there to see if anyone had experience with it, in a horrible manner of course. They're wonderful. Protobufs I mean. If you're looking to send stuff over a network or store stuff to disk, there's really not much reason to use anything else. And yes I use them at my jerb all the time. Ithaqua posted:I forget if my spirit was too crushed to bother refactoring by that point, but this would've made a lot more sense: ???????
|
# ? Jun 4, 2012 05:06 |
|
beoba posted:They're wonderful. Protobufs I mean. If you're looking to send stuff over a network or store stuff to disk, there's really not much reason to use anything else. And yes I use them at my jerb all the time. Interesting. I'd like to know more, but this seems like a job for the Java thread rather than the coding horrors thread, if they're actually good.
|
# ? Jun 4, 2012 07:16 |
|
Doctor w-rw-rw- posted:Interesting. I'd like to know more, but this seems like a job for the Java thread rather than the coding horrors thread, if they're actually good. They are available in C++ and python too IIRC.
|
# ? Jun 4, 2012 12:58 |
|
beoba posted:??????? !!!!!! The refactoring was to replace the poorly-named, stupidly-implemented method with an extension method. In C#, you can extend a type that you don't have source for (like, in this case, string) by making a static method in a static class, and marking the first parameter with the this keyword. So with the method I defined earlier, you could do: code:
Like if you had ThenTheLastThing(ThenOtherThing(DoThing(foo)));, it's way more readable if you can write it as foo.DoThing().ThenOtherThing().ThenTheLastThing();
|
# ? Jun 4, 2012 16:03 |
|
So can we bitch about lovely teachers here?.. I am currently studying to become a network engineer and have taken an introductory course in C# on the side. The entire course has pretty much turned into a self-study. We have had zero theory and not turned in a single assignment, but merely worked on whatever we wanted during the classes. Now we have never actually seen any of this guys own code until now, when he gave us the code our oral exam is based upon. http://pastebin.com/RYHrAfRb This guy is being paid to teach programming.
|
# ? Jun 4, 2012 18:17 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. He's obviously just showing you what *not* to do....
|
# ? Jun 4, 2012 18:51 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. Wow, that is extremely uneducated C# - it's about what you'd expect if you gave a high school freshman a copy of winforms for dummies and two days.
|
# ? Jun 4, 2012 19:06 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. Get your money back. That's horrific.
|
# ? Jun 4, 2012 19:09 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. Rubbing a hard drive with a magnet would make better C#. Kill him and burn the corpse.
|
# ? Jun 4, 2012 19:19 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. That's atrocious. It would be pretty amusing if you refactored it to remove all of the horrors, but then you'd probably get an F for being a snarky bastard.
|
# ? Jun 4, 2012 19:27 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. holy poo poo man
|
# ? Jun 4, 2012 20:19 |
Looks like PHP written with C# syntax.
|
|
# ? Jun 4, 2012 20:25 |
|
C# code:
|
# ? Jun 4, 2012 20:45 |
|
^^^^Pretty much!Doh004 posted:Get your money back. That's horrific. Being danish I am at least not paying for this, in fact, I get paid for it hieronymus posted:Wow, that is extremely uneducated C# - it's about what you'd expect if you gave a high school freshman a copy of winforms for dummies and two days. Ithaqua posted:That's atrocious. It would be pretty amusing if you refactored it to remove all of the horrors, but then you'd probably get an F for being a snarky bastard. Yeah, it is gonna be hard explaining this code without doing nothing but correcting it.
|
# ? Jun 4, 2012 20:59 |
|
Bohemian Cowabunga posted:Being danish I am at least not paying for this, in fact, I get paid for it Fill in the blanks in his code and look at it as an opportunity to stick a few hobby projects on Github.
|
# ? Jun 4, 2012 21:06 |
|
Bohemian Cowabunga posted:So can we bitch about lovely teachers here?.. Haha, saw the "antal" variable and got reminded of my introductory class to Java. Where the teacher programmed in Swedish! He would literally write: hämtaNamn() and ändraNamn(String namn) instead of get/setName(). During our second year C#-course I had to convince some of my course mates that we should program in English
|
# ? Jun 4, 2012 21:10 |
|
I was just on a user interface course that was previously (the last 10 years or so) been held in Finnish, so of course in the example programs all the variables were in Finnish instead of English. I felt so sorry for the exchange students.
|
# ? Jun 4, 2012 21:44 |
|
You get to learn two languages for the price of one, where's the problem?
|
# ? Jun 4, 2012 21:53 |
|
Munkeymon posted:I'm assuming the bank's data service (you didn't think Mint logged into their web site and scraped it did you?) can't handle the character and, since Mint can't force the bank to fix their poo poo, they basically say "If you want this to work today, you'll have to change your password so we can [also] log in [using the service your bank gives us to work with]" Mint's data provider, Yodlee, absolutely does do screen scraping when there is no API available.
|
# ? Jun 4, 2012 22:03 |
|
Zombywuf posted:You get to learn two languages for the price of one, where's the problem? I went to Finland once - Finnish is completely unintelligible to (this) native English speaker. I didn't think I knew Swedish at all but I was actually pretty thankful that all the road signs were also written in Swedish because I am completely illiterate in Finnish but occasionally, Swedish has a loan word.
|
# ? Jun 4, 2012 22:22 |
|
I don't get it. That's how all my professors' code looks at the university I'm at right now. Turns out the people who teach you how to code don't know how to code themselves.
|
# ? Jun 4, 2012 22:44 |
|
The codebase I took over at my job was previously worked on by a Polish programmer and is littered with Polish comments and code. My favorite discovery was a variable named "zmienna".
|
# ? Jun 4, 2012 22:48 |
Dicky B posted:The codebase I took over at my job was previously worked on by a Polish programmer and is littered with Polish comments and code. So did it use Polish notation? What happens when a Hungarian is taught to program like that?
|
|
# ? Jun 4, 2012 22:59 |
|
nielsm posted:So did it use Polish notation? szNév
|
# ? Jun 4, 2012 23:15 |
|
Doctor w-rw-rw- posted:Interesting. I'd like to know more, but this seems like a job for the Java thread rather than the coding horrors thread, if they're actually good. trex eaterofcadrs posted:They are available in C++ and python too IIRC. Yeah, base protobuf is effectively a specification of the serialization format and .proto file syntax. On top of that are various per-language generators and libraries which handle manipulating that data. Official ones are C++/Java/Python, but there are apparently a bunch of third party implementations for other languages, too. <back to horrors>
|
# ? Jun 4, 2012 23:57 |
|
|
# ? May 17, 2024 02:24 |
|
Novo posted:Mint's data provider, Yodlee, absolutely does do screen scraping when there is no API available. Well, first off http://money.cnn.com/2010/12/02/pf/mint_leaves_yodlee/index.htm Second, if they weren't actually getting the data themselves, that makes it kind of weird that Mint was telling me to pester my credit union to integrate with Mint (and not Yodlee or whatever) back in 2008 or 9.
|
# ? Jun 5, 2012 22:33 |