Thursday, 3 January 2013

Minification and Bundling


Minification and Bundling in MVC3


I have been testing ASP.net MVC4 lately and one of the things I really like in it is the built in minification and bundling that it provides. I discovered the other day that there is a nuget package that contains this MVC4 bundling and minification. The problem I ran into with the nuget package is that it uses a different namespace than the actual file in MVC4. The nuget package uses Microsoft.Web.Optimization and MVC4 uses System.Web.Optimization so I was unable to get the nuget package to work properly in my view. Then I thought to myself “I already have the actual file in my MVC4 project”, so I grabbed it from my project and dropped it into the bin folder of my MVC3 project and added a reference to it. What do you know, it works!!
So here is how to use it:
  1. Reference the System.Web.Optimization dll file in your project. I suggest getting it from an MVC4 project or downloading it here.
  2. Open up your global.asax file and add this line to the end of your Application_Start() function.
1)BundleTable.Bundles.EnableDefaultBundles();
Add bundling to your view(s)
@using System.Web.Optimization <link rel="stylesheet" type="text/css" href="@BundleTable.Bundles.ResolveBundleUrl("~/stylesheets/css")" /> <script type="text/javascript" src="@BundleTable.Bundles.ResolveBundleUrl("~/scripts/js")"></script>


The last part of the bundling path is the file type to bundle, so in my examples the paths are actually “/stylesheets” & “/scripts”. This takes all of the css files in the stylesheets folder and combines and minifies them into a single file. It does the same thing with the js files in the scripts folder.
The output will look similar to this:
<link rel="stylesheet" type="text/css" href="/stylesheets/css?v=oI5uNwN5NWmYrn8EXEybCIbINNBbTM_DnIdXDUL5RwE1" />
<script type="text/javascript" src="/scripts/js?v=cuu54Mg4FexvXMQmXibMetb08jdn7cTR1j-MSVxFRPE1"></script>

As you can see, it gives the bundled files a version id so that you can cache the files and when you make a change to one of them, the ID will change so that your browser will download the new changes.
Just as a warning, MVC4 is still in beta so be careful with using this file. The final version of the system.web.optimization will probably be different


Refer from : http://joeyiodice.com/







Convert sql to Linq

Hai

Please go this url
http://www.sqltolinq.com/downloads , and download that convertor your liked versions

and open that.set connection string and click convert button.

Tuesday, 1 January 2013

SQL SERVER – What is – DML, DDL, DCL and TCL – Introduction and Examples


DML

DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database.

Examples: SELECT, UPDATE, INSERT statements

DDL

DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.

Examples: CREATE, ALTER, DROP statements

DCL

DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.

Examples: GRANT, REVOKE statements

TCL

TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.

Examples: COMMIT, ROLLBACK statements

Image Slider using jQuery

I have seen a lot of users requesting for simple jQuery scripts for SlideShows.
I saw a couple of them, but the scripts assumed that the number of image tags has to be fixed beforehand.

Update: There is a updated version of this article at Simple Image SlideShow using jQuery

I thought of making an attempt at a real simple SlideShow script using jQuery.
 Here’s what I came up with 5 lines of jQuery code.
 The images have been added to a ‘images’ folder kept at the root.
The images has been defined in an array which can be retrieved from a server.
 For simplicity sake, I have harcoded the images paths, however the script functionality
can adapt dynamically to the number of images in the array.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Simple Slide Show with jQuery</title>
    <script type='text/javascript'
    src='http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js'>
    </script>
    <script type="text/javascript">
        var imgs = [
        'images/emo.jpg',
        'images/icon068.gif',
        'images/icon260.jpg'];
        var cnt = imgs.length;

        $(function() {
            setInterval(Slider, 3000);
        });

        function Slider() {
        $('#imageSlide').fadeOut("slow", function() {
           $(this).attr('src', imgs[(imgs.length++) % cnt]).fadeIn("slow");
        });
        }
</script>
</head>
<body>
    <img id="imageSlide" alt="" src="" />
</body>
</html>
The code is not perfect but will give you an idea of how to extend
this sample to suit your own requirements. You can see a Live Demo here.


There are many jQuery image gallery plugins:

http://speckyboy.com/2009/06/03/15-amazing-jquery-image-galleryslideshow-plugins-and-tutorials/

Here's an example of using the jQuery Galleria plugin with ASP.NET MVC:

http://aspalliance.com/1864_Aspnet_mvc_image_gallery.all







Forecolor in asp Text Box


TextBox1.ForeColor = Color.Red;
TextBox1.Font.Bold = True;


Or this can be done using a CssClass (recommended):

.highlight
{
  color:red;
  font-weight:bold;
}

codebehind
TextBox1.CssClass = "highlight";
or,Design source
<asp:TextBox id="TextBox1" runat="server" CssClass="highlight"></asp:TextBox>

Or the styles can be added inline:

TextBox1.Attributes["style"] = "color:red; font-weight:bold;";

print one part in form asp.net


No print preview, but this will print only the specified <div> tag:

<form id="Form1" method="post" runat="server">
 <div id="Div1">
  Printable content
 </div>
 <input type="button" value="Print" onclick="JavaScript:printPartOfPage('Div1');">

<script type="text/javascript">
<!--
function printPartOfPage(elementId)
{
 var printContent = document.getElementById(elementId);
 var windowUrl = 'about:blank';
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');

 printWindow.document.write(printContent.innerHTML);
 printWindow.document.close();
 printWindow.focus();
 printWindow.print();
 printWindow.close();
}
// -->
</script>

</form>

Http web request and response

Sample code


try
            {
                HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
// add user-agent header to http request , and all works fine
                myHttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";

                // Sends the HttpWebRequest and waits for the response.
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                // Gets the stream associated with the response.
                if (myHttpWebResponse.StatusCode == HttpStatusCode.OK)
                {
                    Stream receiveStream = myHttpWebResponse.GetResponseStream();
                    Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
                    // Pipes the stream to a higher level stream reader with the required encoding format.
                    StreamReader readStream = new StreamReader(receiveStream, encode);
                    string response = "";
                    Char[] read = new Char[256];
                    // Reads 256 characters at a time.
                    int count = readStream.Read(read, 0, 256);


                    while (count > 0)
                    {
                        // Dumps the 256 characters on a string and displays the string to the console.
                        String str = new String(read, 0, count);
                        response += str;
                        //Console.Write(str);
                        count = readStream.Read(read, 0, 256);
                    }
                    // Releases the resources of the response.
                    myHttpWebResponse.Close();
                    // Releases the resources of the Stream.
                    readStream.Close();
                   
                }
                else
                {
                    return "";
                }

            }
            catch
            {

            }

How to reduce angular CLI build time

 Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...