Skip to main content


Showing posts from December, 2016

Setup a Virtual Host on WAMP

Setup a Virtual Host on WAMP Running several name-based web sites on a single IP address. Step 1: Add Code in file C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf uncomment the LoadModule vhost_alias_module modules/ uncomment the Include conf/extra/httpd-vhosts.conf Step 2: Add VirtualHost code in file C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf # Ensure that Apache listens on port 80 Listen 80 <VirtualHost *:80>     ServerAdmin     DocumentRoot "C:/wamp/www/wordpress"     ServerName techsudhir.local ServerAlias www.techsudhir.local     ErrorLog "logs/techsudhir.local-error.log"     CustomLog "logs/techsudhir.local-access.log" common <Directory "/"> Deny from all Allow from </Directory> </VirtualHost> Save All Step 3: Add Code in file C:\Windows\System32\drivers\etc\hosts  techsudhir.local Save All R

Database manipulation in MongoDB

Database manipulation in MongoDB Basic database queries for MongoDB The remove() Method Syntax: >db.COLLECTION_NAME.remove(DELLETION_CRITTERIA) Example: >db.Employee.remove({'title':'MongoDB Overview'}); Remove Only One Syntax: >db.COLLECTION_NAME.remove(DELETION_CRITERIA,1) And/OR Condition >db.Employee.find({$and:[{"by":"Sudhir"},{"title": "Testing MongoDB Database"}]}) >db.Employee.find({$or:[{"by":"Sudhir"},{"title": "Testing MongoDB Database"}]}) Using AND and OR Together >db.mycol.find({"likes": {$gt:10}, $or: [{"by": "Sudhir"},{"title": "Testing MongoDB Database"}]}) The save() method replaces the existing document with the new document passed in the save() method. Syntax: >{_id:ObjectId(),NEW_DATA}) Example: > { "_id" : Objec

JSON and JSONP in Javascripit

JSON and JSONP in Javascripit JSON is a subset of the object literal notation of JavaScript. JSON in JavaScript Example: var myJSONObject = {"Address": [ {"city": "Azamgarh", "state": "Uttar Pradesh", "country": "INDIA"}, {"city": "Lucknow", "state": "Delhi", "country": "USA"}, {"city": "Noida", "state": "Goa", "country": "UK"} ] }; Code Explaination: Here bindings is an object. It contains array of 3 object. Members can be retrieved using dot or subscript operators. Example : myJSONObject.bindings[0].method JSON Objects JSON objects are written inside curly braces Example : var name = {"firstName":"John", "lastName":"Doe"} JSON Arrays JSON arrays are written inside square brackets. Example : var employeeList = "emplo