I am having a hard time understanding why the following query is not working?  select id,sold_dealer_id from myi_corporate where sold_dealer_id != 36;  When I do the following I am getting the result  select id,sold_dealer_id from myi_corporate where sold_dealer_id = 36;  However for != I am not getting the opposite results.   I am returning to psql after a long time after using MongoDB and might have forgotten the basics. Any suggestion is much appreciated
Inspired by a StackOverflow question ().  Is there a DBMS that actually supports the = NULL syntax?
Math-like chaining of the comparison operator - as in, "if ( (5<j<=1) )" Consider this question on .  I put out a 200 bounty on the question, but did not get an answer from anyone other than myself that worked.    In fact, my answer is also the highest up-voted on it at this point.  I know that allowing OP's to retract a bounty can be a slippery slope; in fact I think that once the bounty is put up it should stay up.  But why not allow the OP to answer their own questions with a bounty and reward it to them if they receive the same up-votes as others?  Yes, I am fully aware that bounties are a risk.  People will use them for numerous reasons such as trying to draw extra attention to their issues.  However, in my specific question, the only valid answer is the one that I gave.  Had it been anyone else's question, I would have received the bounty, but since it was my own I did not. LINQ's Distinct() on a particular property Object-oriented shell for *nix If I have an IEnumerable like:  string[] items = new string[] { "a", "b", "c", "d" };   I would like to loop thru all the pairs of consecutive items (sliding window of size 2). Which would be   ("a","b"), ("b", "c"), ("c", "d")   My solution was is this       public static IEnumerable&lt;Pair&lt;T, T&gt;&gt; Pairs(IEnumerable&lt;T&gt; enumerable) {         IEnumerator&lt;T&gt; e = enumerable.GetEnumerator(); e.MoveNext();         T current = e.Current;         while ( e.MoveNext() ) {             T next = e.Current;             yield return new Pair&lt;T, T&gt;(current, next);             current = next;         }     }   // used like this :  foreach (Pair&lt;String,String&gt; pair in IterTools&lt;String&gt;.Pairs(items)) {     System.Out.PrintLine("{0}, {1}", pair.First, pair.Second)  }   When I wrote this code, I wondered if there are already functions in the .NET framework that do the same thing and do it not just for pairs but for any size tuples.  IMHO there should be a nice way to do this kind of sliding window operations.  I use C# 2.0 and I can imagine that with C# 3.0 (w/ LINQ) there are more (and nicer) ways to do this, but I'm primarily interested in C# 2.0 solutions. Though, I will also appreciate C# 3.0 solutions. $\mathbb{Q}^{\times}$ is the group of rational number without $0$ under multiplication, and $\mathbb{Z}^{n}$ is the free abelian group of rank $n$. Show that $\mathbb{Q}^{\times}$ not isomorphic to $\mathbb{Z}^{n}$. I tried to assume that there is an isomorphism and to get a contradiction.. didn't succeed Possible Duplicate:          On Windows I am able to switch between keyboard layouts by pressing Alt+Shift. Is there a similar keyboard shortcut in Ubuntu? Is sun revolving around certain mass in space with reference to some other galaxy? Every Function in a Finite Field is a Polynomial Function From a bank of past master's exams I am going through:     Let $F$ be a finite field. Show that any function from $F$ to $F$ is a polynomial function.   I know that finite fields are fields of $p$ elements for $p$ prime [EDIT: It's actually $p^n$ for $p$ prime; see comment below]. Since I have $p$ choices for the $p$ elements to map to, then I have $p^p$ distinct functions. I think every function can be written in the form $f(x) = a_{p-1}x^{p-1} + \dots + a_0x^0$. For then given the values $f(0), f(1), \ldots f(p-1)$, I can solve for the coefficents by the linear system of equations  $$ a_0 + \sum_{i=1}^{p-1} n^i a_i = f(n).$$  This then gives me a $p-1 \times p-1$ square matrix over the field $\mathbb{F}_p$:  $$\left( \begin{array}{ccccc} 1&amp; 0 &amp; 0 &amp; \ldots &amp; 0 \\ 1&amp; 1 &amp; 1 &amp; \dots &amp; 1 \\ 1&amp; 2 &amp; 4 &amp; \dots &amp; 2^{p-1} \\ \vdots &amp; \vdots &amp; \vdots &amp; &amp; \vdots \\ 1 &amp; p-1 &amp; (p-1)^2 &amp; \dots &amp; (p-1)^{p-1} \end{array} \right) \left( \begin{array}{c} a_0 \\ a_1 \\ a_2 \\ \vdots \\ a_{p-1} \end{array}\right)  = \left( \begin{array}{c} f(0) \\ f(1) \\ f(2) \\ \vdots \\ f(p-1) \end{array} \right)$$  If I can show this matrix is invertible, then I can always find the $a_i$. But I am a bit stumped on how to show this (partially because I don't think I've ever done linear algebra in a vector space over a finite field). It does not seem easy to show linear independence, or nonzero determinant, or full row rank.    Alternatively (I just thought of this), can I show this is true by arguing that the map between the two sets (the set of polynomials of degree $p-1$; and the set of functions $F \to F$) is injective, and that it must be a bijection because the sets have the same cardinality $p^p$? A random variable that induces a $\sigma$-algebra the same as the one in the sample space Send Email notification if task is not completed 7 days prior to the due date Removing files with strange names Possible Duplicate:          Somehow I ended up with a file named "-r".  How do I remove it?  rm -r doesn't work.  I tried 'rm -i `ls -a`' to step through the file names, but it didn't prompt me to delete this one.  Edit A very hacky approach was to use python's os.unlink function.  That worked, but I'm curious to hear other ways. the slash (/) after a directory name on shell commands I have a little question here.  If I have two files, say filea and fileb, mv filea fileb would   delete fileb rename filea to fileb   Then if I have two directories, say dira and dirb, mv dira dirb would   move dira into dirb (it will become dirb/dira)   Noting that in both cases there are no notice or message, then this is pretty inconsistent to me. I think mv dira dirb should just overwrite dirb with the contents of dira (or merge the two directories under a directory named dirb).  I remember reading somewhere that a directory name with a slash (like dira/) is treated like a directory, and name with no slash (like dira) is treated like a file (to certain extents, of course). Anyway now I want to make the shell (zsh and possibly bash) respect my notation of a directory by using a slash. Is there a terminal option which enable me to enforce that?  To clarify, here is my desired behaviour:   mv dira dirb results in dirb being overwritten with the contents of dira mv dira dirb/ results in dira being moved into dirb (in dirb/dira)   Has anyone thought the same way as me? Or am I just weird? Plot construction for a velocity vs position graph. Interpolation for phase-diagram construction? Disable automatic driver update for only one device in Windows 10 Is there a way we can disable automatic driver update for a specific device in Windows 10? The updated driver for that device (Intel Management Engine Interface 11.x in particular) causes problems on some laptops during. The version 9.x works perfect.  I don't want to disable automatic driver installation for all devices. Why does the jquery change event not trigger when I set the value of a select using val()? Make font size bigger than max limit of 1296 pt in Adobe Illustrator (2015)? For some reason and for many years there's a limit for font size in Illustrator. It is 1296 points max, so you can't go bigger without converting type to outlines first. Converting to outlines means you will not be able to edit type parameters and text it-self. Don't know how about you, but this makes me sad in non-destructive editing era.  What's your workaround? Why does `Position` by default return a list of lists of positions instead of a simple list of positions? Java ReentrantReadWriteLocks - how to safely acquire write lock? I am using in my code at the moment a  to synchronize access over a tree-like structure.  This structure is large, and read by many threads at once with occasional modifications to small parts of it - so it seems to fit the read-write idiom well.  I understand that with this particular class, one cannot elevate a read lock to a write lock, so as per the Javadocs one must release the read lock before obtaining the write lock.  I've used this pattern successfully in non-reentrant contexts before.  What I'm finding however is that I cannot reliably acquire the write lock without blocking forever.  Since the read lock is reentrant and I am actually using it as such, the simple code  lock.getReadLock().unlock(); lock.getWriteLock().lock()  can block if I have acquired the readlock reentrantly.  Each call to unlock just reduces the hold count, and the lock is only actually released when the hold count hits zero.    EDIT to clarify this, as I don't think I explained it too well initially - I am aware that there is no built-in lock escalation in this class, and that I have to simply release the read lock and obtain the write lock.  My problem is/was that regardless of what other threads are doing, calling getReadLock().unlock() may not actually release this thread's hold on the lock if it acquired it reentrantly, in which case the call to getWriteLock().lock() will block forever as this thread still has a hold on the read lock and thus blocks itself.  For example, this code snippet will never reach the println statement, even when run singlethreaded with no other threads accessing the lock:  final ReadWriteLock lock = new ReentrantReadWriteLock(); lock.getReadLock().lock();  // In real code we would go call other methods that end up calling back and // thus locking again lock.getReadLock().lock();  // Now we do some stuff and realise we need to write so try to escalate the // lock as per the Javadocs and the above description lock.getReadLock().unlock(); // Does not actually release the lock lock.getWriteLock().lock();  // Blocks as some thread (this one!) holds read lock  System.out.println("Will never get here");   So I ask, is there a nice idiom to handle this situation?  Specifically, when a thread that holds a read lock (possibly reentrantly) discovers that it needs to do some writing, and thus wants to "suspend" its own read lock in order to pick up the write lock (blocking as required on other threads to release their holds on the read lock), and then "pick up" its hold on the read lock in the same state afterwards?  Since this ReadWriteLock implementation was specifically designed to be reentrant, surely there is some sensible way to elevate a read lock to a write lock when the locks may be acquired reentrantly?  This is the critical part that means the naive approach does not work. Alien studying human race for mental capacity and ESP