badcode

What do you think when a Boolean "if" has three resulting code paths?

(Background: from a previous job, a co-worker and I would end up discussing the bug pile during lunch. We began to develop a topic called "bug of the week". I doubt I have material for 52 posts a year, but here's the first one...) Reported by: QA tester was reading HTML/JS code to write a functional test of a web form, and saw: if (fo...

What is the worst function in PHP?

There are a number of functions that have bugs / weird interfaces / security issues etc. which do you think is worst? ...

How to migrate ugly and undocumented VB6 Code to .NET

I know that there are already Questions about VB6 migration, but the code base of my project brings some new questions here. I have to say the Code quality, structure and architecture is just a nightmare. There are 2 Big Projects: Nr.1 with 40 Forms, 40 Modules and a few class files, this EXE is kind of a "base system". Nr.2 with 80 For...

Instruments says I have 12 memory leaks in this, how do I get rid of them?

I am honestly not able to figure out when to releas these objects, Please help + (DrawData*) load { DrawData *newDrawData = [[DrawData alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *doc...

Bad Code example

i am sure all of us must have written some bad code at some point in their life. I am a kind of guy who would love to learn from other people mistakes. So can you give some examples of bad code you have written and the way you corrected it. ...

How can I write classes that don't rely on "global" variables?

When I took my first programming course in university, we were taught that global variables were evil & should be avoided at all cost (since you can quickly develop confusing and unmaintainable code). The following year, we were taught object oriented programming, and how to create modular code using classes. I find that whenever I wor...

Bad Situation importing/exporting img files - mysql database

I inherited a poorly created mysql database and now I need to migrate data to a new server. Long story short, I need to keep it stored this way and I use phpmyadmin. Know of any tools to help the migration of this 1.2GB mysql table? Hope I don't get slaughtered for this post... ...