Some times we need to get the number of documents with a distinct/unique value. An example use case is in the classic blog example. Get the number of authors with at least one post. Get the number of distinct tags/categories You can use the following commands to get the answers for the above questions db.posts.distinct(‘author’).length
A complete guide to Integrating MongoDB with Elastic Search
After almost two weeks and several re-installs and fresh installs, I finally got to integrate mongodb and elastic search. Here is a step by step procedure on how to integrate them. If you follow this procedure carefully, it will prevent errors like Exception: java.lang.NoSuchMethodError: com.mongodb.Mongo.fsyncAndLock() { “error” : “IndexMissingException[[testmongo] missing]”, “status” : 404 } Follow
Error whil creating super user in django1.4 on MAC
I got the following error while trying to create a super user from shell for django1.4. File “/Library/Python/2.7/site-packages/django/contrib/auth/management/__init__.py”, line 85, in get_system_username return getpass.getuser().decode(locale.getdefaultlocale()[1]) TypeError: decode() argument 1 must be string, not None This problem was rectified by running this command in terminal before adding the user export LANG=”en_US.UTF-8″ I’m guessing this character encoding
How to start stop apache on MAC OSX
start Apache apachectl start Stop Apache apachectl stop Restart Apache apachectl restart If the above commands don’t work, try these /etc/init.d/httpd start /etc/init.d/httpd stop /etc/init.d/httpd restart You can also start the web server from the system preferences. Open system preferences, go to sharing and then enable web sharing
Where is httpd.conf file in Mac OSX Lion
On mac httpd.conf file is located in the directory /etc/apache2/. You can access it through terminal if you want to navigate to it through finder, on finder toolbar goto go->go to folder and type in /etc/apache2
Make command not found in Mac OSX
If you get a -bash: make: command not found error while trying to compile from source, you have to install xcode and then in xcode goto preferences->downloads and install xcode developer tools Download Xcode I’m not sure if you can install command lines without xcode. I can not test as I already have Xcode on
When mobile browsers don’t respect CSS3 media queries
If mobile browsers are not respecting your media queries and showing desktop instead of mobile site, add this meta tag before linking the style sheet. <meta name=”viewport” content=”width=device-width”>
(Untitled)
A thing is not high if one can reach it; it is not great if one can reason about it; it is not deep if one can see the bottom of it. -Fountain Head
Trying cakePHP, lets see how it goes.
My growing list of direct AD sales was becoming hard to manage, dealing with direct AD sales was taking more time than it should actually take. It’s not streamlined. I lost AD revenue several times because I was too lazy to mail the advertisers about the renewal of their adspace. I always wanted to automate
Subtracting two dimensional arrays in PHP
In the development a WordPress plugin I had to subtract two dimensional arrays. I tried array_diff() function, unfortunately it doesn’t seem to work for two dimensional arrays. Even if it worked, it wasn’t exactly the functionality I wanted. Be warned, this isn’t exactly a alternate for array_diff(). For difference of two dimensional arrays you may