Showing posts from October, 2009

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, "**/*": true, "**/*.js": {"when": "$(basename).ts"}     } }

How to prevent users from running more than one instance of our program.

By using Mutex object you can prevent users from running more than one instance of the application. Check out this code snippet using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace SingleInstacle { publicclass Program { staticvoid Main(string[] args) { bool createdNew = false; Mutex mutex = new Mutex(true, "SingleInstance", out createdNew); if (createdNew) { Console.WriteLine("Hello world"); } else { Console.WriteLine("You can only run a single instance of this app!"); } Console.ReadLine(); } } }

Microsoft Ajax Client Template

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title>Ajax Client Side Template</title><scriptsrc="Scripts/MicrosoftAjax.debug.js"type="text/javascript"></script> <script src="Scripts/MicrosoftAjaxTemplates.debug.js" type="text/javascript"></script> <script src="Scripts/MicrosoftAjaxAdoNet.debug.js" type="text/javascript"></script> <style type="text/css"> .sys-template { display: none; } </style> <script type="text/javascript"> function LoadData() { …