|
Mikey-San posted:meh Thanks defmacro fucked around with this message at 15:42 on Apr 8, 2008 |
# ? Apr 8, 2008 15:40 |
|
|
# ? May 19, 2024 15:19 |
|
nebby posted:For what it's worth, the "IsNullOrEmpty" phrase is pretty cumbersome, I much prefer Ruby's "blank?" which implies it is either null or empty (this applies to both arrays and strings.) Just a note, blank? is an extension provided by one of the Active* libraries that rails uses. There isn't a blank? in vanilla ruby. For strings and standard containers you can use nil? and empty? in conjunction. I think this is what blank? does behind the scenes, anyway.
|
# ? Apr 8, 2008 19:07 |
|
brae posted:Just a note, blank? is an extension provided by one of the Active* libraries that rails uses. There isn't a blank? in vanilla ruby. For strings and standard containers you can use nil? and empty? in conjunction. I think this is what blank? does behind the scenes, anyway. http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/core_ext/blank.rb It's simple enough to just toss into whatever project you need to use it in.
|
# ? Apr 8, 2008 20:22 |
|
dustgun posted:http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/core_ext/blank.rb Hell, just including all of ActiveSupport is a pretty decent idea. There's a lot of good stuff in there.
|
# ? Apr 8, 2008 21:02 |
|
code:
The same system includes an ACL implementation based on hidden text in table cells that is read/written with javascript and big honking dynamically written javascript arrays containing all the users and their group memberships and .
|
# ? Apr 9, 2008 03:08 |
|
GT_Onizuka posted:
No no, it wasn't in response to anyone. I posted something, realized I spoke too quickly and the post was bad, and removed it. That's all. I would've just deleted the post if I could've.
|
# ? Apr 9, 2008 06:48 |
|
Mikey-San posted:No no, it wasn't in response to anyone. I posted something, realized I spoke too quickly and the post was bad, and removed it. That's all. I would've just deleted the post if I could've. No problem, I just like being mean . To contribute, I recently found this and almost spit out my drink laughing. code:
|
# ? Apr 9, 2008 13:27 |
|
The best/worst one I've seen isphp:<? if(false){ 50+ lines of code that aren't used any more } ?>
|
# ? Apr 9, 2008 17:43 |
|
bt_escm posted:The best/worst one I've seen is In the project I just finished, there's thousands of lines that are either #if 0'd out or #ifdef JOHNSMITH, where John Smith is a programmer who hasn't worked here in 2 years.
|
# ? Apr 9, 2008 21:12 |
|
It pisses me off that people don't audit their poo poo and stuff like this comes up. 90% of all the bugs I've had to deal with regarding inherited/maintained code is lack of auditing. Code that makes me cry is code without an audit history/trail.
|
# ? Apr 9, 2008 22:12 |
|
Triple Tech posted:Code that makes me cry is code without an audit history/trail. I dunno man, I'd start buying kleenex in bulk if I were you.
|
# ? Apr 9, 2008 23:13 |
|
poo poo, if I can get a few people to sleepily stare at my code for a few seconds during a code review, that's a good day.
|
# ? Apr 9, 2008 23:40 |
|
yaoi prophet posted:poo poo, if I can get a few people to sleepily stare at my code for a few seconds during a code review, that's a good day.
|
# ? Apr 10, 2008 03:39 |
|
Randomosity posted:Holy poo poo. If that was me doing that I would stab myself in the face. No joke. Why would anyone even think of doing that instead of using a for loop?
|
# ? Apr 10, 2008 08:45 |
|
I found this gem on a project we inherited:code:
code:
|
# ? Apr 10, 2008 11:32 |
|
I think either some spacing or avoiding the ternary operation altogether would make the "after" code in that example a lot easier to read, JingleBells. I realise that readability wasn't the "horror" in the original, though.
|
# ? Apr 10, 2008 14:20 |
|
zootm posted:I think either some spacing or avoiding the ternary operation altogether would make the "after" code in that example a lot easier to read, JingleBells. code:
|
# ? Apr 10, 2008 14:32 |
|
TSDK posted:It would also help in terms of performance, because then you're not doing two lookups: It's C#, and you're probably right about performance. As for readability yes, that's generally not one of my fortes
|
# ? Apr 10, 2008 14:43 |
|
code:
|
# ? Apr 10, 2008 21:31 |
|
FrantzX posted:
Gotta love that "== true".
|
# ? Apr 10, 2008 22:17 |
|
Gotta protect against FILE_NOT_FOUND!
|
# ? Apr 10, 2008 22:53 |
|
Victor posted:Gotta protect against FILE_NOT_FOUND!
|
# ? Apr 10, 2008 23:23 |
|
So we use middleware to pass serialized objects around a network of machines. All code is c++. We have to interface with other people's code over this middleware. They define the objects that get sent back and forth over the middleware. Here's a "snippet" (not really, but to give you an idea of the horror) of their headers:code:
...
|
# ? Apr 10, 2008 23:58 |
|
Another one I found today. Apparently the programmer did not know that the TListBox in C++ Builder has an ItemIndex property, which, oddly enough, will tell you what item is selected!code:
|
# ? Apr 11, 2008 05:17 |
|
Most pointless overuse of "enterprise" technology I've ever seen, a CORBA interface that consists of exactly one function that takes exactly one inout parameter (an XML string) and returns nothing:code:
code:
(This wasn't some stupid little internal project either, this was a public SMS-submission interface belonging to a major mobile network. But hey, CORBA is enterprise technology, and XML is enterprise technology, so XML-over-CORBA must be twice as enterprisey, right?) Standish fucked around with this message at 14:44 on Apr 11, 2008 |
# ? Apr 11, 2008 14:41 |
|
Lexical Unit posted:So we use middleware to pass serialized objects around a network of machines. All code is c++. We have to interface with other people's code over this middleware. Not really middleware then, just a communications system. Most normal message orientated middleware systems use a platform agnostic messaging format, like XDR name, value pairs, or modern behemoths like XML.
|
# ? Apr 11, 2008 14:45 |
|
Ok, but, the software is called "middleware." And, conceptually, it stands between two computers. Also, the messaging is platform agnostic. What you put in is what you get out, no matter what platform you're on. So if a 64 bit machine puts in a 20 bit object, a 32 bit machine will receive a 20 bit object, even if the source for that object compiles to a 16 bit object under 32 bit compilation. Hence the horror.
|
# ? Apr 11, 2008 14:54 |
|
Lexical Unit posted:Hence the horror. I see a float too, float's even though IEEE specified are not standard across platforms. AIX/PowerPC has great issues with this. Technically that middleware is tied to the sending system. TIBCO Rendezvous works across multiple platforms and has an agnostic message format, together with broken IEEE floating points. I'm amazed at the number of clients who expect it to translate even character encoding automagically between hosts. MrMoo fucked around with this message at 16:24 on Apr 11, 2008 |
# ? Apr 11, 2008 16:08 |
|
Lexical Unit posted:Also, little vs big endianness comes into play as the endianness of the serialized object doesn't necessarily have to match the endianness of either the sending or receiving machines. Whenever I have to deal with endian issues I leave a trail of tears! ... One time I was freaking out because I saw a little endian - my friend said don't worry - it must have been the LSB! ... Taking account of endianness always fills me with reservations. ... ... Thanks! I'll be here all week! Please remember to tip your waitresses!
|
# ? Apr 11, 2008 16:14 |
|
the worst thing about endianness for me is that an old coworker insisted on calling it byte sex every opportunity he got, which drove me up the wall.
|
# ? Apr 11, 2008 16:18 |
|
fansipans posted:... ... Are you making fun of me? It was a pause for dramatic effect! MrMoo posted:Technically that middleware is tied to the sending system.
|
# ? Apr 11, 2008 17:07 |
|
Project Euler Problem 22 posted:Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order names.txt posted:"MARY","PATRICIA","LINDA","BARBARA","MARIA","SUSAN","MARGARET","DOROTHY","LISA","NANCY",..."ALONSO" code:
|
# ? Apr 12, 2008 04:49 |
|
Scaevolus posted:On principle, using eval is always wrong. In practice, it usually is too.
|
# ? Apr 12, 2008 04:56 |
|
The code I'm working on right now is mostly okay, but I just found functions called "getOnlyFileOrDirectoryNameNoPath" and "getOnlyPathNoFileOrDirectoryName".
|
# ? Apr 12, 2008 06:32 |
|
JoeNotCharles posted:The code I'm working on right now is mostly okay, but I just found functions called "getOnlyFileOrDirectoryNameNoPath" and "getOnlyPathNoFileOrDirectoryName". So long as there's nothing like this: code:
|
# ? Apr 12, 2008 09:09 |
|
my two favorite coding horrors from this weekcode:
code:
The only thing the username is ever used for is to look up data in the database
|
# ? Apr 12, 2008 15:54 |
|
Lankiveil posted:So long as there's nothing like this: Um, well, more like: code:
Oh, also, this project's most common coding style puts spaces around everything: code:
|
# ? Apr 12, 2008 17:48 |
|
I tend to use func( args ) and keyword ( args ), but void Class :: Method ( args ) is just silly.
|
# ? Apr 12, 2008 19:18 |
|
No space before the comma? Clearly this person doesn't know how to properly use white space.
|
# ? Apr 12, 2008 19:47 |
|
|
# ? May 19, 2024 15:19 |
|
You should suggest more vertical whitespace. An extra line break for every line or it's not readable
|
# ? Apr 12, 2008 20:18 |