Posts

Showing posts from September, 2013

How to hide generated javascript file in visual studio code

In this post I am going to show you a cool trick in visual studio code. Let's suppose you are writing typescript code in visual studio code and you want to hide generated javascript code.

Create .vscode folder in your folder and then create settings.json file and paste following code

{ "files.exclude": { "node_modules":true, "**/.git": true, "**/.DS_Store": true, "**/*.js.map": true, "**/*.js": {"when": "$(basename).ts"}     } }

How to read mp3 tag info using c#

Mp3 tag  consists of attaching a fixed block size of 128 bytes at the end of the file in question. This block contains the following tags: A header that identifies the presence of block ID3 and version. Specifically, said header comprises TAG characters.

Title: 30 characters.
Artist: 30 characters.
Album: 30 characters.
Year: 4 characters.
Comment: 30 characters.
Genre (music): a character.

How to encrypt Bitmap image in c#

In this post I will show you how to encrypt bitmap image in c#.The technique is very simple.First we extract header from the image and then encrypt the rest byte data and then combined the header with this encrypted data.


using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace Enc { class Program { staticstring FILENAME = @"D:\ub.bmp"; staticstring ENCFILENAME = @"D:\enc.bmp"; staticvoid Main(string[] args) { //Create instance of DES TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider(); //Generate IV and Key des.GenerateIV(); des.GenerateKey(); //Set Encryption mode des.Mode = CipherMode.ECB; //Read FileStream fileStream = new FileStream(FILENAME, FileMode.Open, FileAccess.Read…