Skip to main content


Showing posts from November, 2012

How to take list of databases in SQL Server

In SQLCMD and Powershell I wanted to take the list of databases. In MySQL “show databases” command was there. But in SQLCMD I was unable to find such a command.--Stored Procedure
EXEC sp_databasesGO --SELECT Statement
SELECT Name FROM master.dbo.sysdatabasesGO
You can use above commands in SSMS (if you are lazy to move your mouse to object explorer) and SQLCMD. Also you can use same thing on PowerShell too.--Stored Procedure
Invoke-SQLCMD "EXEC sp_databases"

--SELECT Statement
Invoke-SQLCMD "SELECT Name FROM master.dbo.sysdatabases"
But in SQLPS you can go to your SQL Server instance’s database and just type “dir”.

I want nice output from Mongo Shell

If you have so many documents in your collection in MongoDB database. Sometimes you may want to retrieve few documents. But if we run find() we cant have nice output. You may need to have nice indentation and line breaks. You may want results in more readable way. Then you can use pretty().Who can read this??If you use pretty() you can take nice output with Mongo Shell.

Classic Cryptography

Secret Messages!!I was always amazed by secret messages and Cryptography is the science applied for this. Modern cryptography has gone to a high standard as it's bonded with mathematics, computer science and electrical engineering. I thought of giving a basic idea about classic cryptography for a change.
There are three methods in classic cryptography.concealed messages (Steganography) - These hidden messages are written in invisible ink,microdots etc. Codes - Here words or phrases are represented by predetermined words,numbers or symbols which were included in code books. Ciphers - I feel this as the most challenging method in classic cryptography. In this context individual letters are disguised using various techniques.Basically this is divided in to 2.
-> Substitution ciphers
->  Transposition ciphers
I'll give a brief idea about these 2 techniques. Substitution ciphers
Here letters in the message can be replaced with numbers,other letters,symbols or combinations of all…