Posts

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, "**/*.js.map": 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

Image
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><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() { …