This is driving me crazy.
I have this one php file on a test server at work which does not work.. I kept deleting stuff from it till it became
<?
print 'Hello';
?>
it outputs
Hello
if I create a new file and copy / paste the same script to it it works!
Why does this one file give me the strange characters all the time?
...
When I am working with ASP.NET, I find that there are always unexpected things I run into that take forever to debug. I figure that having a consolidated list of these would be great for those "weird error" circumstances, plus to expand our knowledge of oddness in the platform.
So: answer with one of your "Gotcha"s!
I'll start:
Under A...
Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like so: *__myPrivateMethod()*. How, then, can one explain this
>>> class MyClass:
... def myPublicMethod(self):
... print 'public method'
... def __myPrivateMethod(self):
... ...
I'd like to hear some of the more pernicious 'gotchas' that exist out there. Any language, system, or library is fine.
...
I'm trying to use mysqldump to dump a schema, and it mostly works but I ran into one curiosity: the -p or --password option seems like it is doing something other than setting the password (as the man page and --help output say it should).
Specifically, it looks like it's doing what is indicated here: http://snippets.dzone.com/posts/sho...
You know the ones that make you go WTH and are easily spotted by a coworker just passing by?
Please keep it one gotcha per answer to simplify voting.
...
The question on Hidden features of Perl yielded at least one response that could be regarded as either a feature or a mis-feature. It seemed logical to follow up with this question: what are common non-obvious mistakes in Perl? Things that seem like they ought to work, but don't.
I won't give guidelines as to how to structure answers,...
In the same spirit of other platforms, it seemed logical to follow up with this question: What are common non-obvious mistakes in Java? Things that seem like they ought to work, but don't.
I won't give guidelines as to how to structure answers, or what's "too easy" to be considered a gotcha, since that's what the voting is for.
See als...
This question is similar to this one, but focused on C# and .NET.
I was recently working with a DateTime object, and wrote something like this:
DateTime dt = DateTime.Now;
dt.AddDays(1);
return dt; // still today's date! WTF?
The intellisense documentation for AddDays says it adds a day to the date, which it doesn't - it actually r...
What are some C++ related idioms, misconceptions, and gotchas that you've learnt from experience?
An example:
class A
{
public:
char s[1024];
char *p;
A::A()
{
p = s;
}
void changeS() const
{
p[0] = 'a';
}
};
Even know changeS is a const member function, it is changing the value of the object. So a cons...
What are some things that got you when setting up a Commerce Server eStore?
...
I have recently learned the Ruby programming language, and all in all it is a good language. But I was quite surprised to see that it was not as simple as I had expected. More precisely, the "rule of least-surprise" did not seem very respected to me (of course this is quite subjective). For example:
x = true and false
puts x # displ...
There is a similar question about Ruby in general but I am soon to be starting out using Ruby on Rails to develop a website or two.
What are the common pitfalls/gotchas that are specific to Rails.
...
We're migrating MySQL to PostgreSQL. I can easily audit the schema and the SQL statements used throughout the (REALbasic) program. Most of the SQL is composed by building string variables.
I already know about needing to replace our use of SELECT LAST_INSERT_ID() with a SERIAL column with UNIQUE constraint.
What, if any, differences b...
I've been working in Silverlight recently and I've slowly been discovering that as simple as it can be to develop, there are one or two annoying gotchas that lurk in the shadows.
Considering how difficult some of these have been to track down for me, I thought it might be useful to list them here on SO for others to benefit from. I'm su...
I have been finding myself using the Chain of Responsibility pattern often (3 times is often for me) in my current project and I'm wondering if I have become a little over-enthusiastic about the solution. Specifically, I have been using the Apache Commons chain project. So, far I have been quite impressed by how it has simplified a numbe...
What surprises have other people found with writing PHP web applications? There's the well known and to be fixed issue with compile time class inheritance but I know of a couple others and wanted to try and build a list of the top gotcha's of the language.
Note:
I've held several positions as a Sr. PHP5 developer so PHP work pays my ...
The purpose of my question is to strengthen my knowledge base with Python and get a better picture of it, which includes knowing its faults and surprises. To keep things specific, I'm only interested in the CPython interpreter.
I'm looking for something similar to what learned from my PHP landmines
question where some of the answers we...
I am myself a subversion user, and overall very happy with it. However, there are times that I need to work on code stored on a CVS repository that is beyond my control (ie, some open source projects). I've heard lots of horror stories of why CVS is really flawed, but nothing very concrete and would like to avoid getting trapped on such ...
I have an interest in particularly odd yet relevant questions to root out guys who claim to have several years in a particular programming language.
Since I know C best, I'll start with one of my favorites:
Is it possible (other than branching into the twilight zone) for a function to return more often than it is called?
You guys shou...