Monthly Archives: January 2014

TSQL: NOT IN doesn’t work

If you encounter a weird scenario when query

SELECT Something FROM Table1 WHERE SomethingElse IN (SELECT Lookup FROM Table2)

work perfectly, but the opposite query

SELECT Something FROM Table1 WHERE SomethingElse NOT IN (SELECT Lookup FROM Table2)

doesn’t return any results – and you know for a fact that there’re results – check values returned by the subquery. Chances are there’re NULLs among those values. If that’s the case – NOT IN won’t return any results.

As a quick workaround you can add IS NOT NULL condition to the subquery:

SELECT Something FROM Table1
WHERE SomethingElse NOT IN (SELECT Lookup FROM Table2 WHERE Lookup IS NOT NULL)

and this should do the trick.

Credit: This Stack Overflow answer.

How to make “scrollIntoView” apply to IFRAME only

Let’s say you have a really long HTML page with scrollbars, for the sake of argument something like this:

...more content...
<div id="xB">bbbb</div>
...much more content...

And somewhere, perhaps on pageload, you want to make sure that highlighted element is visible to the user, so to scroll it into view you execute


And it works fine and well – the needed element is automatically displayed on top of the page. But what if this page is in an IFRAME and the parent page has a large scrollable content of it’s own:
Continue reading →

Have you tried DotNet Fiddle?

You might be familiar with JS fiddle – an awesome tool that allows you to interactively test and share your JavaScript code along with gazillion of libraries and CSS classes.

You may even know non less awesome SQL Fiddle using which you can build custom schemas, tables, views and run and share your SQL queries in various RDBMS.

But have you heard about .NET Fiddle? This is a great interactive compiler, using IDE familiar to other fiddlers users it allows you to run and share your .NET code in both C# and VB.NET.

From the developers of .NET Fiddle:

We are a group of .NET developers who are sick and tired of starting Visual Studio, creating a new project and running it, just to test simple code or try out samples from other developers.

Give it try!