<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Fundamental Provocation &#187; Development</title> <atom:link href="http://www.ajaymatharu.com/category/development/feed/" rel="self" type="application/rss+xml" /><link>http://www.ajaymatharu.com</link> <description>Blog by Ajay Matharu</description> <lastBuildDate>Sun, 06 Nov 2011 15:09:39 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Server Application Unavailable</title><link>http://www.ajaymatharu.com/server-application-unavailable/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=server-application-unavailable</link> <comments>http://www.ajaymatharu.com/server-application-unavailable/#comments</comments> <pubDate>Thu, 22 Apr 2010 04:15:51 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[ASP.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[asp.net 1.1]]></category> <category><![CDATA[asp.net 1.1 server error]]></category> <category><![CDATA[IIS]]></category> <category><![CDATA[server unavailable]]></category> <category><![CDATA[Virtual Directory Error]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=458</guid> <description><![CDATA[Many a time while developing a web application you may come accross &#8220;Server application unavailable&#8221; When you get this error in Windows XP make sure you have given ASPNET user sufficient rights on your physical application folder, it mainly requires read permission. When you get this error in Windows 2003 server you can right click [...]]]></description> <content:encoded><![CDATA[<p>Many a time while developing a web application you may come accross &#8220;Server application unavailable&#8221;</p><p><a href="http://ajaymatharu.files.wordpress.com/2008/11/unavailable2.jpg"><img class="aligncenter size-full wp-image-463" title="unavailable2" src="http://ajaymatharu.files.wordpress.com/2008/11/unavailable2.jpg" alt="unavailable2" width="500" height="284" /></a></p><p>When you get this error in Windows XP make sure you have given ASPNET user sufficient rights on your physical application folder, it mainly requires read permission.</p><p>When you get this error in Windows 2003 server you can right click your virtual directory &#8211; permission &#8211; grant aspnet user sufficient rights there.</p><p>If the above solution doesn&#8217;t work here is another alternative,</p><p>You could try editing the Machine.config (located in<br /> C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFI G\).</p><p>Look for a key userName=&#8221;machine&#8221;. If you set it to &#8220;SYSTEM&#8221;<br /> instead the aspnet_wp.exe runs with a different user (with<br /> higher privileges).</p><p>Hope this helps</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/server-application-unavailable/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Validating html tags in textbox &#8211; Cross site scripting</title><link>http://www.ajaymatharu.com/validating-html-tags-in-textbox-cross-site-scripting/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=validating-html-tags-in-textbox-cross-site-scripting</link> <comments>http://www.ajaymatharu.com/validating-html-tags-in-textbox-cross-site-scripting/#comments</comments> <pubDate>Wed, 17 Mar 2010 22:26:26 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[Cross page scripting issue]]></category> <category><![CDATA[validate HTML]]></category> <category><![CDATA[validate html in textbox]]></category> <category><![CDATA[validate html tags]]></category> <category><![CDATA[validate HTML tags in input]]></category> <category><![CDATA[validate html tags in textbox]]></category> <category><![CDATA[validation]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1169</guid> <description><![CDATA[Following is the code to validate any textbox or input text against html tags. //source and args are required if calling from custom validator in asp.net else its not required function htmlValidation(source,args) { var re = /(]+)>)/gi; if (document.getElementById(’’).value.match(re)) { document.getElementById(’’).value = “”; alert(’Invalid content’); //args.IsValid = false; // you can use this if you [...]]]></description> <content:encoded><![CDATA[<p>Following is the code to validate any textbox or input text against html tags.</p><pre name="code" class="js">
//source and args are required if calling from custom validator in asp.net else its not required
function htmlValidation(source,args)
{
var re = /(<([^>]+)>)/gi;

if (document.getElementById(’<%=TextBox2.ClientID%>’).value.match(re)) {
document.getElementById(’<%=TextBox2.ClientID%>’).value = “”;
alert(’Invalid content’);
//args.IsValid = false; // you can use this if you are calling this from custom validator in asp.net
return false;
}
if (document.getElementById("textboxid").value.match(re)) {
document.getElementById("textboxid").value = “”;
alert(’Invalid content’);
return false;
}
return true;
}
</pre>]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/validating-html-tags-in-textbox-cross-site-scripting/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>SharePoint Error: &#8220;The language-neutral solution package was not found&#8221;</title><link>http://www.ajaymatharu.com/sharepoint-error-the-language-neutral-solution-package-was-not-found/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sharepoint-error-the-language-neutral-solution-package-was-not-found</link> <comments>http://www.ajaymatharu.com/sharepoint-error-the-language-neutral-solution-package-was-not-found/#comments</comments> <pubDate>Fri, 27 Nov 2009 07:52:13 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Sharepoint]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Language Neutral Package]]></category> <category><![CDATA[Sharepoint Error]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1765</guid> <description><![CDATA[Last night while developing an event listener custom list, I ran into this error, SharePoint Error: &#8220;The language-neutral solution package was not found&#8221; The solution to this problem is, Restart your visual studio. And it will be back to normal. Hope this helps]]></description> <content:encoded><![CDATA[<p>Last night while developing an event listener custom list, I ran into this error,</p><blockquote><div> SharePoint Error: &#8220;The language-neutral solution package was not found&#8221;</div></blockquote><p>The solution to this problem is, Restart your visual studio. And it will be back to normal.</p><p>Hope this helps <img src='http://www.ajaymatharu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/sharepoint-error-the-language-neutral-solution-package-was-not-found/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Go &#8211; Google&#8217;s new programming language</title><link>http://www.ajaymatharu.com/go-googles-new-programming-language/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=go-googles-new-programming-language</link> <comments>http://www.ajaymatharu.com/go-googles-new-programming-language/#comments</comments> <pubDate>Thu, 12 Nov 2009 11:10:53 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[Go]]></category> <category><![CDATA[Go Programming]]></category> <category><![CDATA[Go programming language]]></category> <category><![CDATA[Programming]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1824</guid> <description><![CDATA[Google created their own programming language. But is there a need to create a new language? Well here is some details about the Go programming language. Go offers an expressive type system, fast compilation, good performance, and built-in language features that simplify threaded programming and concurrency. The language has been under development for roughly two [...]]]></description> <content:encoded><![CDATA[<p>Google created their own programming language. But is there a need to create a new language?<br /> Well here is some details about the Go programming language.</p><p>Go offers an expressive type system, fast compilation, good performance, and built-in language features that simplify threaded programming and concurrency. The language has been under development for roughly two years. It started out as a 20 percent project—time that Google&#8217;s engineers are given to use as they choose for undirected experimentation—and evolved into a serious full-time undertaking. Google is releasing the source code under the BSD license with the hope that a community will emerge around the new programming language and participate in the effort to make it a compelling choice for software development.</p><p>Go language itself and the current implementation are relatively mature, but it&#8217;s not quite ready for adoption in production environments. The ecosystem around the programming language is still a work in progress. There is no IDE integration, the standard libraries are a bit thin, and there aren&#8217;t a whole lot of real-world code examples yet. Opening up Go to the broader programming community could help to vastly accelerate its advancement in all of those critical areas.</p><p>The native Go compilers, called 6g and 8g (for 64-bit and x86), are designed to be extremely fast. There is also an alternative compiler called Gccgo that is based on the GNU Compiler Collection (GCC). The GCC-based compiler isn&#8217;t as fast but is said to generate more efficient code. I was initially a bit surprised that Google chose not to use the Low-Level Virtual Machine (LLVM) compiler framework—it has a lot of LLVM expertise internally and is using it extensively for their awesome Python optimization effort. Pike says that LLVM was considered during the early stages of the Go project, but its compile-time performance was judged to be inadequate.</p><p>The compiled executables are completely native binaries, so it&#8217;s not like a managed code language where the compiler generates bytecode for a virtual machine. Go does, however, have some runtime components that get embedded in the executables. Actual execution performance is said to be comparable to that of native C.</p><p>Some of Google&#8217;s sample Go code reveals that the syntax is C-like and encourages a conventional imperative programming style. There are functions, &#8220;for&#8221; loops, standard conditional expressions, and many other features that you&#8217;d expect to find in a C-like language, but with a handful of nice twists. For example, there is a shorthand syntax for variable assignment that supports simple type inference. It also has anonymous function syntax that lets you use real closures. There are some Python-like features too, including array slices and a map type with constructor syntax that looks like Python&#8217;s dictionary concept. The following code snippet is an example from Google&#8217;s documentation:</p><pre name="code" type="c++">

    package main

    import (
        "os";
        "flag";  // command line option parser
    )

    var omitNewline = flag.Bool("n", false, "don't print final newline")

    const (
        Space = " ";
        Newline = "\n";
    )

    func main() {
        flag.Parse();   // Scans the arg list and sets up flags
        var s string = "";
        for i := 0; i &lt; flag.NArg(); i++ {
            if i &gt; 0 {
                s += Space
            }
            s += flag.Arg(i)
        }
        if !*omitNewline {
            s += Newline
        }
        os.Stdout.WriteString(s);
    }
</pre><p>One of the distinguishing characteristics of Go is its unusual type system. It eschews some typical object-oriented programming concepts such as inheritance. You can define struct types and then create methods for operating on them. You can also define interfaces, much like you can in Java. In Go, however, you don&#8217;t manually specify which interface a class implements. Pike explained to me that the interface mechanism gives developers some of the flexibility of duck-typing, but it goes further by providing the advantages of compile-time checking.</p><p>Parallelism is emphasized in Go&#8217;s design. The language introduces the concept of &#8220;goroutines&#8221; which are executed concurrently. Any function can be executed as a goroutine by prefixing the function call with the &#8220;go&#8221; keyword. The language provides a &#8220;channel&#8221; mechanism that can be used to safely pass data in and out of goroutines.</p><p>For more details, check out the project&#8217;s <a href="http://golang.org/">official website</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/go-googles-new-programming-language/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Export grid values in excel</title><link>http://www.ajaymatharu.com/export-grid-values-in-excel/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=export-grid-values-in-excel</link> <comments>http://www.ajaymatharu.com/export-grid-values-in-excel/#comments</comments> <pubDate>Wed, 07 Oct 2009 07:19:02 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[ASP.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[C#]]></category> <category><![CDATA[C#.Net]]></category> <category><![CDATA[Code]]></category> <category><![CDATA[Datatable]]></category> <category><![CDATA[Export]]></category> <category><![CDATA[export records to excel]]></category> <category><![CDATA[gridview]]></category> <category><![CDATA[gridview to excel]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1179</guid> <description><![CDATA[Following code helps you to import grid values to excel, //Import System.IO in your application for StreamWriter Object //note: excel_file represents the complete physical address of excel file eg C:/myexcel.xls public void export_datagridview_to_excel(DataGridView dgv, string excel_file) { int cols; //open file StreamWriter wr = new StreamWriter(excel_file); //determine the number of columns and write columns to [...]]]></description> <content:encoded><![CDATA[<p>Following code helps you to import grid values to excel,</p><pre class="c-sharp" name="code">
//Import System.IO in your application for StreamWriter Object

//note: excel_file represents the complete physical address of excel file eg  C:/myexcel.xls
public  void export_datagridview_to_excel(DataGridView dgv, string excel_file)
{
int cols;
//open file
StreamWriter wr = new StreamWriter(excel_file);

//determine the number of columns and write columns to file
cols = dgv.Columns.Count;
for (int i = 0; i &lt; cols; i++)
{
wr.Write(dgv.Columns[i].Name.ToString().ToUpper() + “\t”);
}

wr.WriteLine();

//write rows to excel file
for (int i = 0; i &lt; (dgv.Rows.Count - 1); i++)
{
for (int j = 0; j &lt; cols; j++)
{
if (dgv.RowsIdea.Cells[j].Value != null)
wr.Write(dgv.Rows[i].Cells[j].Value + “\t”);
else
{
wr.Write(”\t”);
}
}

wr.WriteLine();
}

//close file
wr.Close();
}</pre>]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/export-grid-values-in-excel/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Google developers produce new programming language</title><link>http://www.ajaymatharu.com/google-developers-produce-new-programming-language/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-developers-produce-new-programming-language</link> <comments>http://www.ajaymatharu.com/google-developers-produce-new-programming-language/#comments</comments> <pubDate>Mon, 28 Sep 2009 07:58:12 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[Developers]]></category> <category><![CDATA[Java]]></category> <category><![CDATA[JVM]]></category> <category><![CDATA[Language]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Programming Language]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1699</guid> <description><![CDATA[A new programming language that runs on the Java Virtual Machine is available thanks to a couple of Google&#8217;s developers.  Called Noop (pronounce it like an abbreviated version of &#8220;no operation&#8221;), the developers claim that it combines the finest aspects of other languages and attempts to guide users towards accepted best practices. Other parts of [...]]]></description> <content:encoded><![CDATA[<p>A new programming language that runs on the Java Virtual Machine is available thanks to a couple of Google&#8217;s developers.  Called Noop (pronounce it like an abbreviated version of &#8220;no operation&#8221;), the developers claim that it combines the finest aspects of other languages and attempts to guide users towards accepted best practices.</p><p>Other parts of the new <a href="http://code.google.com/p/noop/">Noop homepage</a> (which is hosted by Google Code) explain that Noop &#8220;in source form looks similar to Java.  The goal is to build dependency injection and testability into the language from the beginning, rather than rely on third-party libraries as all other languages do.&#8221;</p><p>Then, &#8220;Immutability and minimal variable scope are encouraged by making final/const behavior the default and providing easy access to a functional style.  Testability is encouraged by providing Dependency Injection at the language level and a compact constructor injection syntax.&#8221;</p><div class="wp-caption aligncenter" style="width: 660px"><img title="Google NOOP" src="http://ajaymatharu.wordpress.com/files/2009/09/noop.png" alt="Google NOOP" width="650" height="300" /><p class="wp-caption-text">Google NOOP</p></div><p>The Noop website is pretty well built out if you&#8217;d like more information.  Google&#8217;s developers provided all sorts of details about the current state of things and where Noop may go, as well as a place or two in which folks can give feedback.</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/google-developers-produce-new-programming-language/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>TSQL Cast Vs Convert</title><link>http://www.ajaymatharu.com/tsql-cast-vs-convert/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tsql-cast-vs-convert</link> <comments>http://www.ajaymatharu.com/tsql-cast-vs-convert/#comments</comments> <pubDate>Thu, 10 Sep 2009 05:02:43 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[SQL]]></category> <category><![CDATA[Cast]]></category> <category><![CDATA[Convert]]></category> <category><![CDATA[Convert Vs Cast]]></category> <category><![CDATA[TSQL]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=663</guid> <description><![CDATA[SQL Server programmers can choose between two functions in SQL Server 7 and 2000 for converting expressions from one type to another. In many cases there will be a need within a stored procedure or other routine to convert data from, say, a datetime type to a varchar type; CONVERT and CAST are used for [...]]]></description> <content:encoded><![CDATA[<p><span class="a3">SQL Server programmers can choose between two functions in SQL Server 7 and 2000 for converting expressions from one type to another. In many cases there will be a need within a stored procedure or other routine to convert data from, say, a <strong>datetime</strong> type to a <strong>varchar</strong> type; <strong>CONVERT</strong> and <strong>CAST</strong> are used for such things.</p><p>Because SQL Server provides both functions, there may be some confusion about which is best to use and under what circumstances. <strong>CONVERT</strong> is specific to SQL Server, and allows for a greater breadth of flexibility when converting between date and time values, fractional numbers, and monetary signifiers.</p><p><strong>CAST</strong> is the more ANSI-standard of the two functions, meaning that while it&#8217;s more portable (i.e., a function that uses <strong>CAST</strong> can be used in other database applications more or less as-is), it&#8217;s also less powerful. <strong>CAST</strong> is also required when converting between <strong>decimal</strong> and <strong>numeric</strong> values to preserve the number of decimal places in the original expression.  For those reasons, it&#8217;s best to use <strong>CAST</strong> first, unless there is some specific thing that only <strong>CONVERT</strong> can provide in the work you&#8217;re doing.</p><p><strong>CAST</strong> and <strong>CONVERT</strong> can also be used in conjunction with each other to achieve certain effects.  For instance, a typical way to produce a <strong>char</strong> variable with the current date would be to use:</p><pre>SELECT CONVERT(CHAR(10), CURRENT_TIMESTAMP, 102)</pre><p>(The <strong>102</strong> indicates that the ANSI date format, <em>yy.mm.dd</em>, is to be used.)</p><p>However, if you wanted to cast this variable explicitly as a <strong>datetime</strong> or <strong>smalldatetime</strong> value for compatibility in a specific database column, you could use:</p><pre>SELECT CAST(CONVERT(CHAR(10),CURRENT_TIMESTAMP,102) AS DATETIME</pre><p>This would return the value <em>yy.mm.dd</em> 00:00:00 (i.e., 12:00AM as the timestamp; the time information from <strong>CURRENT_TIMESTAMP</strong> would be discarded).</p><p></span></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/tsql-cast-vs-convert/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Insert multiple records with single Insert statement in SQL</title><link>http://www.ajaymatharu.com/insert-multiple-records-with-single-insert-statement-in-sql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=insert-multiple-records-with-single-insert-statement-in-sql</link> <comments>http://www.ajaymatharu.com/insert-multiple-records-with-single-insert-statement-in-sql/#comments</comments> <pubDate>Tue, 08 Sep 2009 04:31:26 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[SQL]]></category> <category><![CDATA[Insert]]></category> <category><![CDATA[Microsoft SQL]]></category> <category><![CDATA[Multiple Inserts]]></category> <category><![CDATA[Multiple Records]]></category> <category><![CDATA[Query]]></category> <category><![CDATA[Select]]></category> <category><![CDATA[SQL Insert]]></category> <category><![CDATA[SQL Query]]></category> <category><![CDATA[TSQL Query]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1175</guid> <description><![CDATA[This is the traditional method for inserting multiple values in a table. USE YourDBName GO INSERT INTO MyTableName (FirstCol, SecondCol) VALUES (‘First’,1); INSERT INTO MyTableName (FirstCol, SecondCol) VALUES (‘Second’,2); INSERT INTO MyTableName (FirstCol, SecondCol) VALUES (‘Third’,3); INSERT INTO MyTableName (FirstCol, SecondCol) VALUES (‘Fourth’,4); INSERT INTO MyTableName (FirstCol, SecondCol) VALUES (‘Fifth’,5); GO However this cannot be [...]]]></description> <content:encoded><![CDATA[<p>This is the traditional method for inserting multiple values in a table.</p><pre name="code" class="sql">
USE YourDBName
GO
INSERT INTO MyTableName (FirstCol, SecondCol)
VALUES (‘First’,1);
INSERT INTO MyTableName (FirstCol, SecondCol)
VALUES (‘Second’,2);
INSERT INTO MyTableName (FirstCol, SecondCol)
VALUES (‘Third’,3);
INSERT INTO MyTableName (FirstCol, SecondCol)
VALUES (‘Fourth’,4);
INSERT INTO MyTableName (FirstCol, SecondCol)
VALUES (‘Fifth’,5);
GO
</pre><p>However this cannot be used if you want to insert multiple values into the table via your code because in this case you&#8217;ll have to write the code to insert the value in the DB in a for loop which is not at all feasible.</p><p>So you can write the code to generate the insert statement like,</p><pre name="code" class="sql">
USE YourDB
GO
INSERT INTO MyTableName (FirstCol, SecondCol)
SELECT ‘First’ ,1
UNION ALL
SELECT ‘Second’ ,2
UNION ALL
SELECT ‘Third’ ,3
UNION ALL
SELECT ‘Fourth’ ,4
UNION ALL
SELECT ‘Fifth’ ,5
GO
</pre><p>The above code inserts multiple values into DB with a single SQL insert query. This is the best means to use in your code as you&#8217;ll just have to create this query in your for loop and the query will run only once.</p><p>Also you can use the following query syntax for multiple inserts in SQL 2008</p><pre name="code" class="sql">
USE YourDB
GO
INSERT INTO MyTableName (FirstCol, SecondCol)
VALUES (‘First’,1),
(‘Second‘,2),
(‘Third‘,3),
(‘Fourth‘,4),
(‘Fifth‘,5)
</pre><p>Please let me know if you have any better ideas than this one.<br /> Njoy coding!!!</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/insert-multiple-records-with-single-insert-statement-in-sql/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Error catching in Global.asax</title><link>http://www.ajaymatharu.com/error-catching-in-global-asax/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=error-catching-in-global-asax</link> <comments>http://www.ajaymatharu.com/error-catching-in-global-asax/#comments</comments> <pubDate>Mon, 07 Sep 2009 03:53:22 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[ASP.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[code snippet]]></category> <category><![CDATA[custom error]]></category> <category><![CDATA[Dot Net]]></category> <category><![CDATA[error handling]]></category> <category><![CDATA[global.asax]]></category> <category><![CDATA[httpcontext]]></category> <category><![CDATA[visual studio.net]]></category> <category><![CDATA[web.config]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1635</guid> <description><![CDATA[The following code snippet will help you to catch an error in the global.asax file, Turn off the custom error mode in web.config file first, &#60;customErrors mode="Off"&#62; And add this code in your global.asax file to catch the error, void Application_Error(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; if (context.Error != null) { Exception [...]]]></description> <content:encoded><![CDATA[<p>The following code snippet will help you to catch an error in the global.asax file,</p><p>Turn off the custom error mode in web.config file first,</p><pre name="code" class="xml">&lt;customErrors mode="Off"&gt;</pre><p>And add this code in your global.asax file to catch the error,</p><pre name="code" class="c#">void Application_Error(object sender, EventArgs e)
 {
 HttpContext context = ((HttpApplication)sender).Context;
 if (context.Error != null)
 {
 Exception ex = context.Error;
 string msg = string.Empty;

 while (ex != null)
 {
 if (!string.IsNullOrEmpty(ex.Message))
 msg += ex.ToString() + "&lt;br /&gt;&lt;br /&gt;";
 ex = ex.InnerException;
 }
 context.Response.Clear();
 context.Response.Write(msg);
 context.Response.End();
 }
 } </pre><p>Hope this helps <img src='http://www.ajaymatharu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/error-catching-in-global-asax/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Using CS and VB code files together in App_Code</title><link>http://www.ajaymatharu.com/using-cs-and-vb-code-files-together-in-app_code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-cs-and-vb-code-files-together-in-app_code</link> <comments>http://www.ajaymatharu.com/using-cs-and-vb-code-files-together-in-app_code/#comments</comments> <pubDate>Sun, 06 Sep 2009 05:48:06 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[App_Code]]></category> <category><![CDATA[C-Sharp]]></category> <category><![CDATA[code lt]]></category> <category><![CDATA[compilation]]></category> <category><![CDATA[config]]></category> <category><![CDATA[CS]]></category> <category><![CDATA[CS & VB]]></category> <category><![CDATA[different languages]]></category> <category><![CDATA[Different Languages in project]]></category> <category><![CDATA[Multi-Language]]></category> <category><![CDATA[Multiple coding Language]]></category> <category><![CDATA[VB]]></category> <category><![CDATA[vb code]]></category> <category><![CDATA[vb files]]></category> <category><![CDATA[vbcode]]></category> <category><![CDATA[web.config]]></category><guid isPermaLink="false">http://www.ajaymatharu.com/?p=1465</guid> <description><![CDATA[Many a times you require to use both C-Sharp (C#) and Visual Basic (VB) code class files in the same project. If you just place your both the code files in your App_Code directly this is the error you&#8217;ll see, &#8220;The files &#8216;/BlogEngine.Web/App_Code/VBCode/Class1.vb&#8217; and &#8216;/BlogEngine.Web/App_Code/CSCode/Extensions/BreakPost.cs&#8217; use a different language, which is not allowed since they [...]]]></description> <content:encoded><![CDATA[<p>Many a times you require to use both C-Sharp (C#) and Visual Basic (VB) code class files in the same project.</p><p>If you just place your both the code files in your App_Code directly this is the error you&#8217;ll see,</p><p>&#8220;The files &#8216;/BlogEngine.Web/App_Code/VBCode/Class1.vb&#8217; and &#8216;/BlogEngine.Web/App_Code/CSCode/Extensions/BreakPost.cs&#8217; use a different language, which is not allowed since they need to be compiled together.&#8221;</p><p>But you can get this done, here is a very simple way you can try that out,</p><p>1) First make two folders in App_code with foldernames as<br /> - CSCode<br /> - VBCode</p><p>2) Modify the Web.config with following code:</p><pre name="code" class="xml">&lt;compilation debug="false"&gt;
 &lt;codeSubDirectories&gt;
 &lt;add directoryName="VBCode" /&gt;
 &lt;add directoryName="CSCode" /&gt;
 &lt;/codeSubDirectories&gt;
&lt;/compilation&gt;</pre>]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/using-cs-and-vb-code-files-together-in-app_code/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
