How to add an annotation on distinct items?
8 years ago
Solution with added "distinct=True" on annotate. This solution undocumented on django documantations
Example :
packages = Package.objects.annotate(bid_count=Count('items__bids', distinct = True))
Source : stackoverflow.com
This solved my problem sudo apt-key adv --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 Source :http://askubuntu.com/questions/884798/why-mysql-repository-key-suddenly-expired
So, MySQL seemed to be faring just fine during and after the leap second. There were no big problems or catastrophic failures. However, we noticed that MySQL (and Java) servers* had a huge spike in CPU – which was odd, because nothing out of the ordinary was running. We were able to fix the proble...
You must install yugliy with the-gas you specified above sudo npm -g install yuglify. Without this the binary will not be linked to/bin. This is happening because of a misnaming error, if you install from a package manager (npm) your bin may be called nodejs so you just need to symlink it like...
It is there secure yet annoying, to have a password encrypted rsa key. You want to automatically login and/or run remote commands per ssh. No interaction. Here is how you remove the passphrase from you rsa key. Remove passphrase openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_new chown root:root...
Git Delete Last Commit Once in a while late at night when I ran out of coffee, I commit stuff that I shouldn't have. Then I spend the next 10 - 15 minutes googling how to remove the last commit I made. So after third time I wanted to make a record of it so I can refer to it later. If you have comm...