gotchas

What is the VB.NET select case statement logic with case OR-ing

When writing some vb code I tripped and I'm still left wondering why. I was ORing the case expectation yet a value lieing within this range didn't warrant a match; why not? Example Code: Select Case 2 Case 0 ''// Some logic Case 1 ''// Some other logic Case 2 Or 3 Console....

Windows Forms: SelectionChanged event for TextBox class

How do I get notified of a selection change in a text box in .NET 2.0? I was unable to find a SelectionChanged event or an OnSelectionChanged method. What is the best workaround for this (without having to PInvoke, of course)? ...

Surprises Moving from C++ to C#

I am a C++ programmer moving into C#. I worked with the language for a month now and understand many concepts. What are some surprises i may get while moving from C++ to C#? i was warned about destructors not being executed as i intended. Recently i tried to do something with generics that would use T as the base class. That didnt work....

What are the pitfalls of a Java noob?

I've gone through a few Java questions on SO. And I must say the content here is pretty well written and the Java guys on SO can really pump out the answers. But what I always found was Java answers for Java people. Which is great on its own, but I'm a Java noob. So I don't really care for the workings of "Joint union in type parameter ...

Gotcha's/surprises in C# .net 3.5

A good acquaintance and past coworker called me up out of the blue and offered me a contract I really can't ignore. He's convinced I'll do fine with and pick up c# in no time ( past experience in -> c/c++ / PHP / Python / Lua ). This question is in line with my two others: PHP landmines in general Python 2.x gotcha’s and landmines ...

.NET Serialization Problem with Referencing a Static Field

I'm using SerializableAttribute to write an object jack to disk. The object has a member department which references a static field accounts of another class Department. On deserializing, I find that the member department of the deserialized object no longer points to the same object as the static field accounts but now points to another...

.NET Resource Leak Gotchas

There are several ways that developers can get caught out by unintentional resource leaks in .NET. I thought it would be useful to gather them in one place. Please add yours with one answer per item, so the best get voted up :) ...

tsql string concat with select and order by does not work with function in order by clause?

Consider the following tsql... create function dbo.wtfunc(@s varchar(50)) returns varchar(10) begin return left(@s, 2); end GO select t.* into #test from ( select 'blah' as s union select 'foo' union select 'bar' ) t select * from #test; declare @s varchar(100); set @s = ''; select @s = @s + s from #test order by s; selec...

What is the most dangerous feature in Java?

Which feature of the Java-language is the source of the most misunderstandings and bugs in your experience? The scope of this question is about the language, not the class-library. ...

Best practices when using oracle DB and .NET

What are the best practices or pit falls that we need to be aware of when using Microsoft Oracle provider in a web service centric .NET application? ...

gotchas where Numpy differs from straight python ?

Folks, is there a collection of gotchas where Numpy differs from python, points that have puzzled and cost time ? "The horror of that moment I shall never never forget !" "You will, though," the Queen said, "if you don't make a memorandum of it." For example, NaNs are always trouble, anywhere. If you can explain this without...

Learning Scala.

What was your methodology to learn Scala? (exercises? small project? library? manual?) What surprises have you encountered when you have been learning Scala? Both subjectively positive and negative. Please state also what is your background i.e. primary language of your choice. Edit: Please try to state your experience, not opinions. ...

What's the biggest R-gotcha you've run across?

Is there a certain R-gotcha that had you really surprised one day? I think we'd all gain from sharing these. Here's mine: in list indexing, my.list[[1]] is not my.list[1]. Learned this in the early days of R. ...

Gotchas in JDK 6

Are there any gotchas in JDK 6 which did not exist in earlier versions? I am interested in finding out some surprising changes like the following one in the way Timestamp.valueOf() works. Timestamp.valueOf(), when provided with a timestamp which contains a date or a month with a single digit. eg. 2009-9-20, 2009-9-3, 2009-12-4 etc., beh...

What git gotchas have you been caught by?

The worst one I've been caught by was with git submodules. I had a submodule for a project on github. The project was unmaintained, and I wanted to submit patches, but couldn't, so I forked. Now the submodule was pointing at the original library, and I needed it to point at the fork instead. So I deleted the old submodule and replace...

Corner Cases, Unexpected and Unusual Matlab

Over the years, reading others code, I encountered and collected some examples of MATLAB syntax which can be at first unusual and counterintuitive. Please, feel free to comment or complement this list. I verified it with r2006a. set([], 'Background:Color','red') MATLAB is very forgiving sometimes. In this case, setting properties to...

Is Collections.copy broken (in OpenJDK 6)?

Sometimes I seem to be quite inefficient. When I was nearly finished typing this, I managed to find the appropriate bug report at Sun. I then thought well, might as well post it, having the screenshot and all. Answer follows. I know, "SELECT isn't broken", and it's always my fault. But here, I really don't get why it should be. My code ...

What are the Gotchas and Issues I should be aware of with SFML?

I've been using SDL for a while to prototype small things and to learn more about graphics programming. Then I saw SFML and wanted to give it a try, saw that it was more object oriented and fixed some issues I felt SDL had. But since I know little about the library itself, what are it's main flaws and other issues that I should be awar...

Common Gotchas when using TransactionScope and MS DTC

I am just starting to work with using TransactionScope, 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. Some context on how I am going to...

Gotchas with SQL Server Full-Text Search

I want to compile a list of gotchas when using SQL Server full-text search in all versions. For instance, Here's a SQL Server Full-Text gotcha: SQL Server 2008 R2 has a new feature called Data-Tier Applications - which is a way to package a database schema meant to be deployed elsewhere. Certain objects like Full-Text Ca...