Apr
17
2012

Coffeescript functions

Functions are defined in Coffeescript using an arrow by optional list of parameters in parentheses as follows Coffeescript hello = -> alert “mahesh” hello() Compiled Javascript var hello; hello = function() { return alert(“mahesh”); }; hello();

Apr
5
2012

SQL Server XML output with CDATA

SQL FOR XML EXPLICIT gives the greater degree of control and you can also specify CDATA as follows. Query declare @student table (id int, name varchar(20)) insert into @student values (1, ‘mahesh&test’) insert into @student values (2, ‘hareesh&test’) select 1 AS Tag, NULL AS Parent, id as [student!1!id], name as [student!1!name!cdata] from @student for xml explicit, ROOT(‘root’) Output

Apr
5
2012

Reload your Node application automatically

Normally when you develop a node application, you’ll need to restart your application each time you make a change.Nodemon will reload your application each time it changes Install Nodeman Run your application with Nodeman

Apr
3
2012

Hello Application using Node and Express

In this example, I’m using Express to generate an Hello application for us. Express Express is a light-weight web development framework. Express provides several great features such as an intuitive view system, robust routing, MVC and much more. Express Installation Install the Express module using Node Package Manager. Code var express = require(‘express’), app = express.createServer(); app.get(‘/’, function(req, res){ res.send(‘Hello’); }); app.listen(3000); Run the application

Mar
28
2012

Javascript reference in HTML5

The type attribute is unnecessary in HTML5 documents for Javascript reference. Previous <script src=”js/scripts.js” type=”text/javascript”></script> HTML5 <script src=”js/scripts.js” ></script>

Mar
23
2012

Creating your first application using Silverlight

Its time to create your first application using Silverlight. Build a Simple Application 1. Open the start menu and launch Visual Studio 2010 2. Select New Project from the file menu 3. Select the Silverlight Project template. Enter the name HelloApplication as follows 5. New Silverlight application dialog box will appear for Host options and Silverlight Version selection 6. Drag One Label and Button control to MainPage.xaml file and set the proper Name and Content [...]

Mar
23
2012

Group Data using LINQ to Entities and Entity Framework

LINQ to Entities allows you to group data by using either query syntax or query methods. In C# you can use the group .. by clause as follows var result = from e in context.Employees group e by e.Designation; The grouped column automatically mapped to key property. You can iterate the grouped data as follows Iterating over the grouped data foreach (var key in result) { Console.WriteLine(key.Key); foreach (var item in key) { Console.WriteLine(item.EmployeeName); } [...]

Mar
23
2012

Create rounded corners with CSS3

In CSS3, creating rounded corners can be as simple using border-radius property as follows. <style type=”text/css”> .box { width : 200px; background-color: #BBB; padding: 10px 10px 10px 10px; } </style> </head> <body> <div class=”box roundIt”> sample content here </div> No extra markup, no images, no JavaScript required for this

Feb
6
2012

Serving static files using Varnish

Using reverse proxy or web accelerator (Varnish, Squid) you can cache your assets locally and reduce the number of hits on Web Server / CDN. Varnish is a high performance HTTP accelerator. Please visit official site (varnish site) for more information. Using Varnish, we can load the static contents from CDN using simple .vcl configuration file as follows. backend myCDN { set backend.host = “cdn.mysite.com”; set backend.port = “80″; } sub vcl_recv { if (req.url [...]

Jan
15
2012

Strongly Typed Data Controls in ASP.net 4.5

Upcoming version of ASP.net Web Forms introduces number of improvements to data binding. One of the interesting feature is strongly typed data controls. Following example demonstrate the data binding using Strongly type. Specify the strongly type using ModelType property <ul> <asp:Repeater runat=”server” id=”student” ModelType=”WebApplication.Student”> <li> Student Name : <%# Item.StudentName %> </li> </asp:Repeater> </ul>

Pages:12345»