@OP:
Typically, nobody listens to the guy that brings the bad news. Have you asked yourself why this manager wants you to "review" their code?
@OP:
Typically, nobody listens to the guy that brings the bad news. Have you asked yourself why this manager wants you to "review" their code?
I thought I had a go at Visual Studio C++ express. So I installed. Which, basically, went just fine. The fact that the second patch is larger than the original installation file is kinda odd, but when installing SP1, I get an windows update error.
From what I gather, something is wrong in "my" dot net installations somewhere, so I had to clean that up. With a nice tool called ".net framework setup cleanup utility".
Didn't appear to do much, so I opened it's log. Bottom lines read:
[07/09/12,11:50:44] Launching process 'C:\Windows\system32\msiexec.exe /x {8E34682C-8118-31F1-BC4C-98CD9675E1C2} /qn' now
[07/09/12,11:50:44] Process successfully launched. Waiting 900 seconds for it to complete.
900 seconds... time enough to write this. What a bunch of fucktards.
@Speakerphone Dude said:
@El_Heffe said:What the heck is "award winning" software?
Awards are a proven method to evaluate the value of an application.
Except when in front of congress.
@Lorne Kates said:
@JimLahey said:
upPanelWell, there's TRWTF right there: asp.net's update panel.
update panel, well, well, I thought it was the upper panel.
@TGV said:
int nr_i_cb_m;What? You're building intercontinental ballistic missiles, and you write code like this? Armageddon is at hand! The Mayas were right!!
"It works!"
So last week I stumbled upon this:
(Anonymized even tho the actual names are still largely abbreviations...)
typedef struct { int nr_p_m; some_struct_type *P; int nr_s_m; some_struct_type *S; int nr_t_m; some_struct_type *T; int nr_x_m; some_struct_type *X; int nr_x_s_m; some_struct_type *X_S; int nr_x_x_m; some_struct_type *X_X; int nr_x_y_m; some_struct_type *X_Y; int nr_x_xs_m; some_struct_type *X_XS; int nr_x_ys_m; some_struct_type *X_YS; int nr_s_x_m; some_struct_type *S_X; int nr_s_y_m; some_struct_type *S_Y; int nr_s_xs_m; some_struct_type *S_XS; int nr_s_ys_m; some_struct_type *S_YS; int nr_v_x_m; some_struct_type *V_X; int nr_v_y_m; some_struct_type *V_Y; int nr_o_m; some_struct_type *O; int nr_o_s_m; some_struct_type *O_S; int nr_t_t_m; some_struct_type *TT; int nr_tc_t_m; some_struct_type *TC; int nr_th_t_m; some_struct_type *TH; int nr_a_t_m; some_other_struct_type *A; int nr_a_a_t_m; some_other_struct_type *A_A_T; int nr_i_u_m; some_struct_type *I_U; int nr_i_v_m; some_struct_type *I_V; int nr_i_cb_m; some_struct_type *I_CB; int nr_p_m; some_struct_type *PM; int nr_i_u_d_m; some_struct_type *I_U_D; int nr_i_v_d_m; some_struct_type *I_V_D; int nr_i_x_d_m; some_struct_type *I_X_D; int nr_i_y_d_m; some_struct_type *I_Y_D; } R_R_L;
At any time, at most two of the pointers (arrays) are not null (filled). Am lucky that they didn't write if else if else .... but simply if if if if .... doh
@snoofle said:
My boss received one of those have-all-team-members-write-down-3-strengths-and-3-weaknesses-and-discuss memos. One of the dimmer-but-thinks-he's-funny offshore guys on the team writes - via email - to my boss:
weaknesses
1. Pointless corporate procedures make me want to grab an assault rifle and seek out the nearest clock tower
I see the sarcastic humor, but to put that in writing?
Depends on who the person is.
In any case, it made my day. lmao.
@rstinejr said:
I work with a way senior developer, friend of my boss, who is always saying things like "Perforce isn't working" or "Java is returning the wrong time value" or "MySQL has locked the table"; when he's especially egregious I put the headphones on and crank up music to keep from strangling him.
@rstinejr said:
In the OP, the commented-out line of memcpy() that presumably is what "does not work" is scary. "is_it_present + block_size" is the address just past block_size. Not necessarily wrong, but it could be.
But the craziness is &false. Most likely the preprocessor turns it into something like &(0) -- I'm surprised it compiled.
Am working on a rather old software component that needs to be ported to another platform. Looking for issues, I stumbled upon this
/*(void) memcpy( is_it_present + block_size, &false, sizeof(bool));*/ /* memcpy does not work, so we set the value of the XXX to false, manually*/ is_it_present[3]=FALSE;
Too bad for me that most of the time memcpy does work...
@morbiuswilters said:
@boomzilla said:I'm sure there are legitimate entrapment issues to deal with whenever this happens, but I haven't heard anything substantive in that respect on any cases so far.Yeah, but these cases aren't entrapment--not even close. Entrapment would be the FBI finding a disgruntled Muslim (because, come on) and saying "Hey, you know what you should do? Blow some people up." and then persuading him (because, come on) to break the law. The idea for illegal action must come from law enforcement AND law enforcement must convince the criminal to break the law AND the criminal must not have been liable to break the law on his own.
Ignorance is bliss.
@C-Octothorpe said:
Cock-punch the belligerent ass-wipe.
Can I ask, what was your response to him when he told you this? I would have asked him if he actually spent 30 minutes (or however long he had the file checked out for) doing nothing other than deleting helpful comments.
It can be done much faster, but they can be re-added much faster too.
@snoofle said:
Forgive me, but I think that if you're going to do something, you should do it right. What about all the other possible types that you could use?
Well, if something isn't needed, better do it damn right..
@serguey123 said:
@Weps said:Not sure if it still is this way, but doesn't Foreach give you the elements in a 'random' order?
When was it random? The foreach returns the elements according to how the enumerator is implemented. So unless you change the collection between foreachs, it won't change.
Should not have used the word "random".What I meant was that ForEach does not necessarily go through the elements in the same order as a For - loop. That's why (see op) some guys don't like "foreach", I assume.
Not sure if it still is this way, but doesn't Foreach give you the elements in a 'random' order?
@pkmnfrk said:
@Weps said:@pkmnfrk said:Uh huh...? And...? We're waiting for the second half of this amusing tale!
Enlighten me. (referring to your hint).
Depending on what you mean by "image processing", the maths would likely be slower than the GC. If you're just cropping them, then maybe not.
So what's the hint here? Be faster than the GC?
@TheCPUWizard said:
@Weps said:So, I guess, there is no one here who finds it abnormal that a GC blocks your application, on all threads. And in 'our' case, that was for SECONDS.... Yes, we have a few tera bytes of data to process.
And I guess, there is no one here that finds it abnormal that you can actually have out of memory exceptions caused by a "full" GC.
None of these issues are solved, just 'prevented'. More CPU power, more cores, more memory and a few more calls to the GC to clean up (which afaik it still only does when it wants to).
Neither of those two issues would have occured without a GC, or maybe with the java variant (I got no clue at to how the java gc works). And I assume they changed or fixed stuff in the umptieth dot net patch. I don't know. But I do know that if it was that good, I would not need anything to know about it.
I have worked with large systems, but never where there are "a few tera bytes of data" in memory (which is all the CG cares about) [the biggest server I have access to has 512GB]...
With any memory management (automatic or hand coded), there will be time taken. So even if the specific issues you saw did not happen, it is likely that something else would have. So it is not a choice between "problem" and "perfection", but rathere a choice between problem domains.
I have worked with real-time procssing of images where there is a large amount of data being processed continually. Even here it is extremely rare to have "Full" garbage collections (GEN 2), perhaps one every 2-3 days; and then they run with about 250mS to 600mS of "all threads blocked". Given that Windows is not a RTOS, there are plenty of other "normal" system conditions where application threads may not execute for even longer periods, so it has not be a determining factor.
Based on systems I have worked on where issues such as you are reporting have occured, I have found a few common design/implementation flaws:
* Not selecting the "right" GC engine.
* Keeping objects around longer than necessary (triggering promotions). Even on a small machine (i-5 2.4Ghz 8GB), .NET has no problem with upwards of 5 million allocations (that distinct calls to "new", not a byte count) per second without noticable performance differential.
* Not properly handling "large objects" [over 80KB for a single monolith].
Well, we use 'm and 'free' 'm. Ain't much more to it.
And of course, there will always be time taken by a MM, tho, I'ld rather have that time taken directly when an instance is no longer referenced than further up the road (when whatever makes the GC do its thing).
@blakeyrat said:
@Weps said:@pkmnfrk said:Uh huh...? And...? We're waiting for the second half of this amusing tale!
Enlighten me. (referring to your hint).
YOU SET UP A STORY AND NEVER FINISHED IT!
Look, so we have 20,000 images, 10 minutes, the GC decides when to free memory, and it can suspend threads to do so. That's a great set-up, now where's the FREAKING STORY!?
If you don't provide one, I'll just assume it concludes, "and so the program ran fine with like 3 minutes to spare, man I'm an idiot why did I think the GC was bad I'm so stupid."
Gosh, my fault thinking I was dealing with Sherlocks over here.
So, I guess, there is no one here who finds it abnormal that a GC blocks your application, on all threads. And in 'our' case, that was for SECONDS.... Yes, we have a few tera bytes of data to process.
And I guess, there is no one here that finds it abnormal that you can actually have out of memory exceptions caused by a "full" GC.
None of these issues are solved, just 'prevented'. More CPU power, more cores, more memory and a few more calls to the GC to clean up (which afaik it still only does when it wants to).
Neither of those two issues would have occured without a GC, or maybe with the java variant (I got no clue at to how the java gc works). And I assume they changed or fixed stuff in the umptieth dot net patch. I don't know. But I do know that if it was that good, I would not need anything to know about it.
@pkmnfrk said:
Uh huh...? And...? We're waiting for the second half of this amusing tale!
Enlighten me. (referring to your hint).
@boomzilla said:
@Weps said:Except, the dotnet GC isn't ok, it is not a solved problem. It actually causes problems.Do you have a reference about the sorts of problems it causes? Or even something resembling a detail?
Imagine a time critical image processing application, that should not be the limiting factor for the hardware. And it should process, say, 20.000 images in 10 minutes.
Now add a GC that itself will determine when to free memory. And, when it does, it will block threads.
@blakeyrat said:
If you're that one guy who needs to know it, fine. But don't pretend its useful general knowledge for programmers, because the entire point of garbage collection and the CLR is to shield the programmer from having to think about any of this shit at all, ever. So stop thinking about it and build some software.
So true. Except, the dotnet GC isn't ok, it is not a solved problem. It actually causes problems. And knowing how it works. well, in my experience, that didn't help much.
Even more depressing is that you live in a country where it is needed to have 'this end up' printed on straws......
@toon said:
@SandGroper said:On any given day I have to suppress urges to post here after I pull changes from a particular colleague (I actually think I could have a chance at out doing snoofle). This WTF along with about 5 others (in 2 days) have finally got me. I recently asked this guy to stop polling the server for updates because the API exposes events if something changes.
This is how he did that.
while (true)
{
Connect();
try
{
if (IsConnected)
{
// the same polling stuff from before
// Added registration to events}
}
catch
{
IsConnected = false;
}
while (IsConnected) // These two lines are new
Thread.Sleep(1000);
Thread.Sleep(1000);
}Being a complete know-nothing on threading: do those two new lines do what I think they do, i.e. nothing whatsoever, every second, ad infinitum?
It waits until it disconnects, just to reconnect again, and poll again.
@Cassidy said:
Those links are quite interesting - many use "should", "ideally" - implying that they are suggestions and aspirations rather than cold rules. Does anyone here have such rules/guidance in their organisation's coding policies? (I've not heard of it meself)
I'ld rather have suggestions in a coding guide than idiotic "must" rules.
@zelmak said:
@Weps said:
Ah no you didn't. Wasn't referring to you, but to the code. Having a class that holds a boolean value (or two lol) and then providing a function that answers "are you a boolean value?"....Unless "isbooleanvalue" is meant to do something else. And in that case it's a wtf too ;)
Yeah, that would be one of the mental replacements:
public boolean isFlagSet() { return flagSet; }Sorry for the confusion.
See, isFlagset is also a wtf ;)
@zelmak said:
@Weps said:
This is indeed one big collection of wtf's. Don't even know where to start....
@zelmak said:
public boolean isBooleanValue() { return booleanValue; }
isBooleanValue??? WTF?
More unit tests are needed. More black box testing, more white box testing, more management, more integration testing, more more more. I'm pretty sure that will solve all -our- IT problems, and if not, more testing! yay.[/cynism]
Well, of course I anonymized it from the original variable name ... but other than that, its all there ... getter/setter 'bean patterns' ... mentally replace booleanvalue/booleanValue with flagSet and I guess it is more understandable.
Perhaps I over anonymized ...
Ah no you didn't. Wasn't referring to you, but to the code. Having a class that holds a boolean value (or two lol) and then providing a function that answers "are you a boolean value?"....
Unless "isbooleanvalue" is meant to do something else. And in that case it's a wtf too ;)
This is indeed one big collection of wtf's. Don't even know where to start....
@zelmak said:
public boolean isBooleanValue() {
return booleanValue;
}
isBooleanValue??? WTF?
More unit tests are needed. More black box testing, more white box testing, more management, more integration testing, more more more. I'm pretty sure that will solve all -our- IT problems, and if not, more testing! yay.[/cynism]
@Thuktun said:
Are there side effects induced by fieldHasChanged?
That doesn't really matter for the if block being executed always, now does it?
@boomzilla said:
@Weps said:See inconsistency. Why not also add "<database_name><table_name>FIELD_<field_type>" in front too? Baffles me.How do you know that the database/schema name will always be the same? To beat this stupid horse some more, why not add the DB vendor? Your company name? Or go bigger and include the galaxy name?
Like most standards, it's more important to pick one way and stick to it than which one you pick. But if you name your primary keys like TABLE_ID, then you'll be rightfully mocked.
Don't ask me, it's not my horse. Good questions nonetheless ;)
@Cassidy said:
@Severity One said:@zelmak said:
(why is it important to have a table with a
specific name and then explicity name the ID field
<TABLE_NAME>ID?)I personally find it makes foreign keys easier: fields with the same value have the same name. And what, exactly, is the problem of putting the table name, or something similar, before 'ID'?
It isn't a problem, it's just unnecessary.
See inconsistency. Why not also add "<database_name><table_name>FIELD<field_type>" in front too? Baffles me.
@TheCPUWizard said:
@zelmak said:
"We don't know what will break if we remove it."Although the following applies more to "application code" than database, it is still appropriate...
Step 1: Run a full test suite with "coverage" enabled
Step 2: If the item is not exercised by a test, then delete it.
I have never seen a "full" test suite. You?
@zelmak said:
(why is it important to have a table with a specific name and then explicity name the ID field <TABLE_NAME>_ID?)
That's something that really annoys me too. A table users, with fields user_id, user_name, user_address, user_age and so on. I guess some people are just inconsistent as hell and this is one way of trying to deal with it.
@blakeyrat said:
... having worked on this project for nearly 5 years I must be missing something real obvious!!!
Maybe you'ld have noticed it if you hadn't spent your time constantly in the debugger.
@DaveK said:
@snoofle said:
Time for [b]them[/b] to suffer a strategic "accident".Someones' laptop would give all sorts of errors while booting if they previously shut it down.
The recommendation? Don't shut it down. We don't need to order a new one (they don't replace motherboards here) until it won't boot at all.
Wait a minute. A person who directly supports our users is having obvious motherboard issues and machine lockups and can't get the machine fixed or replaced until it completely dies? The purchase order alone takes two weeks. And oh BTW, we're not on conditioned power here; there's no UPS.
@JoeCool said:
if ((strString.isEmpty()) || (strString == null))
Even without the warning this is a wtf...
@Cassidy said:
@DaveK said:@Weps said:
No, it's the 'don't know what this code does' attitude that costs the industry much, but apparently it's so normal to be a fuck up and spend time constantly in the debugger that it is even seen as being professional. Hilarious.You should know what your code is supposed to do.And you should also verify that it does.
Testing can take care of 99% of that automatically for you, but it's always good to take a look under the bonnet and watch your code actually running. I often do it the first couple of times through when I've added a big or tricky new chunk of code that's running for the first time.
Mmm.. I missed the "constantly" bit - and I won't disagree with the concept that 20% kicking out low-quality code then 80% on the debugger to identify and iron out quirks is unprofessional (if that's Weps' original point).
It was. Is.
@Cassidy said:
I've met several coders that are arrogant and blinkered to even entertain the notion that their code could be flawed, a kinda "debuggers are for pussies" and "it doesn't need testing - it WORKS!" culture... I probably tarnished Weps' professionals with the same brush. My bad on that front.
No harm done. Tho, I have to admit that I do have a tendency to say that my code works, but that should be understood quite differently.
@Cassidy said:
@Weps said:@blakeyrat said:How is any "professional" developer not using a debugger constantly?
because most of the time those professional developers KNOW what their code is intended to do.
FTFY. If code worked and behaved in exactly the way the developer intended, we wouldn't need testers. And it's precisely this "I know what my code does" attitude that costs the S/W industry dear.
No, it's the 'don't know what this code does' attitude that costs the industry much, but apparently it's so normal to be a fuck up and spend time [b]constantly[/b] in the debugger that it is even seen as being professional. Hilarious.
@blakeyrat said:
@Weps said:@blakeyrat said:How is any "professional" developer not using a debugger constantly?
because most of the time those professional developers KNOW what their code does.
Hahahaha, oh wait, you were serious? Let me laugh even harder: HAHAHA
Have fun at it, tomorrow another day watching the debugger. O wait...you're lacking one. lol.
@dhromed said:
This reminds me of the Parking Information System we built some time ago.
gosh, you work for the same company I do....
@blakeyrat said:
How is any "professional" developer not using a debugger constantly?
because most of the time those professional developers KNOW what their code does.
Just think of all the possibilities.... a site could send you a notification (in your browser woohoo) just after it, for instance, sent you an e-mail.
my o my, what is the world coming to.
@blakeyrat said:
Also turns out: Safari runs it fine, so whatever the bug it only happens in iOS devices. So no, using Safari to debug is not useful. If you were about to suggest that. It pissed me off, so here's the post.
Are you using js to open another window?
@blakeyrat said:
@Weps said:@Cassidy said:I've got to ask why someone spends so long in the same job/role and never progresses...A friend of mine had a nice viewpoint too: people usually get promoted once they are assumed to fit their role; as a result, people are usually in roles they are not fit for.... so: 1) your friend takes credit for coming up with the Peter Principle? and 2) you're such an idiot you didn't instantly recognize the Peter Principle?
That is a depressing anecdote in two ways.
You're not the first one that thinks I'm an idiot, so I guess, that makes you an idiot too.
@Cassidy said:
I've got to ask why someone spends so long in the same job/role and never progresses...
A friend of mine had a nice viewpoint too: people usually get promoted once they are assumed to fit their role; as a result, people are usually in roles they are not fit for.
@Arancaytar said:
(!isset($j) ? $j = 7 : $j)I'm torn between laughing and being impressed by the innovation. :P
A wtf in itself.
Some button, right in front of me, to stab someone over the internet once I click it.
@DanceMaster said:
@Weps said:Management interferes with how you should solve something?That's how it works with my company.
I don't know enough, but I already feel sorry for you.
Management interferes with how you should solve something? Or what do you mean by management? Architects? Project leads?