Search 

When you create a web page you usually keep in mind how it will rendered on the browser and its usability. Sometime, depending upon the content, you also know that your page might be printed by end user. But you don’t want that the printer version of your page to be same as the screen version. Most of the time you might create a separate printable version of the page. User will click specially open the printable version and take its print or sometime he will directly print your webpage.

Now what are the issues here -

  1. The web page is not printer friendly therefore the content might get distorted while printing it into a A4 size paper.
  2. The print will contain unnecessary links and images while have no use in printable version.
  3. The webpage might have dark background which will lead to wastage of print ink.
  4. Some text might have light colors which may not be visible clear on a black & white printout.
  5. If you create separate printable view then it will involve another user action which sometimes user don’t do.

Visual Studio 2010 has finally released and is available for download. You can download various version from below location -

There lots of improvement in Visual Studio 2010 over past version. Below are some new great features of Visual Studio 2010 -

Better code intellisense

Visual Studio 2010 has better code intellisense support which make it easier for look for methods and functions. You can now easily search for inline keyword, or even use abbreviation to search for properties or methods.

There are lots of small tricks in .net which can be very useful if used wisely. In this post I want to discuss the use of DebuggerBrowsableAttribute. Using this attribute you can control how a member of class will be displayed in debugger windows during debugging. Before that consider small example:

public class Organization
{
    public List<Employee> Employees
    {
        get;
        set;
    }

    public Organization()
    {
        this.Employees = new List<Employee>();
    }
}

 

Like the Object oriented programming the exception handling is also not used while coding in JavaScript. That why in most of cases if there is any problem in one part in a page then surprisingly other part also stops working. In this post we will be discussing the various techniques to handle exceptions in JavaScript.

Using try..catch block

try..catch block in JavaScript is very much similar to the regular C# try..catch block. The suspected code will be put in try block and all exceptions which will occur in the try block will be caught in catch block.

window.onload = function()
{
    try
    {
        var x = 90;
        var value = x / y;
    }
    catch(err)
    {
        document.write(err.name + ": " + err.message + "<br/>");
    }
}
Output:
TypeError: 'y' is undefined

In this post I want to cover some very basic and small extension methods which are very useful for any developer. All below mentioned extension method are not doing any complex operation. Rather they are just performing very simple task which you generally encounter a lots of times in your day today coding.

1. IsNull

This is probably most commonly used expression. A lots of places in out code we check to null references. We usually add the obj == null or obj != null check to do this. Here is the IsNull extension method

public static bool IsNull(this object source)
{
    return source == null;
}

Using the you can avoid the lazy null check. Example:

public void ProcessData(DataSet input)
{
    if (!input.IsNull())
    {
        // business logic here
    }
}

This contest is closed now. There were very few comments; so it was not difficult to choose the winners. Here are the winners

1st Prize - 1000 Standard Size Business Cards - Alex Lyman
2nd Prize - 500 4x6" Postcards - Alin-T

Congrats winner. You will be soon contacted by UPrinting for the preferences.

Here is business card giveaway for the readers of DailyCoding. The prizes are sponsored by the UPrinting.

1st Prize - 1000 Standard Size Business Cards

2nd Prize - 500 4x6" Postcards

You can choose from any of their stocks for these items. The rules are very simple:

  1. Leave a comment (along with your email address) at the end of this post, describing what you would use the free business cards and/or postcards for.
  2. Two winners will be chosen based on most interesting comments.
  3. There is no fix end date of this contest.
  4. Winners in the United States and Canada qualify for free shipping. Shipping fees will apply to winners outside these areas.

Vista had come with new and cool look & feel. If you want to add the Vista Aero style theme to you WPF application running on Window XP then it is very easy trick. You don’t need any third party library or tool to achieve this.

To do this all you need to do is to add following lines of xaml code into the designer of your window right after window tag:

<ResourceDictionary Source="/PresentationFramework.Aero, 
   Version=3.0.0.0, Culture=neutral, 
   PublicKeyToken=31bf3856ad364e35, 
   ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />

If you want to apply this look through out the application then add this to app.xaml under <Application.Resources> section.

Under “Customized Html Controls” section I will discuss about how to create and customized standard html controls. This is first article in this category. This will discuss about how we can create a custom checkbox using CSS and jQuery.

Checkbox Image

For this you need two images, one for checked state of checkbox and another for unchecked state of the checkbox. However, you can also use a single image containing both checked and unchecked state and use CSS trick like I use.

LINQ (Language Integrated Query) is a one of very useful feature of .net 3.5 framework. This allows you to query objects and perform complex operations simply and efficiently. There are lots of trick which can be used with the help of LINQ. In this article I am explaining how can we random sort a List using LINQ

Random Sort

This article explains how you can create callouts using CSS and without using a single image. This will use the CSS thick border technique for creating slant area. Look at the callouts below:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam dignissim tincidunt turpis. Mauris pede. Vestibulum gravida magna id nibh. In nec urna. Sed ut purus. Duis sit amet lacus ornare massa mattis consequat. Donec nec tellus. Nam quis nulla viverra diam faucibus dictum. Nulla facilisi. Donec sit amet dolor at sapien accumsan consectetuer.

This callout is created only using CSS. The arrow shown in the callout is basically a DIV with thick up border and transparent left and right border.

Recently Added

Database

More..
Step by Step Guide to Add a SQL Job in SQL Server 2005

by Daily Coder on Jul 10, 2008
Describes Step by Step process of adding a sql job in SQL Server 2005
9 Comment(s)

Generate New Guid (uniqueidentifier) in SQL Server

by Daily Coder on Jun 19, 2008
About how to generate a random unique identifier in using sql query in SQL server
8 Comment(s)

Add parameterized queries in MySql (OleDb)

by Daily Coder on May 18, 2008
Explains how to add parameters in odbc queries
2 Comment(s)

Design

More..
Create Printer Friendly Web Page Using Media Attribute

by Daily Coder on Aug 4, 2010
How can we optimize a web page for printer without creating new page
1 Comment(s)

Add Vista Look to your WPF Control on Windows XP

by Daily Coder on Jan 27, 2009
Explains how to convert a XP looking UI into Vista look using WPF running under Window XP
1 Comment(s)

Customized Html Controls: Creating Custom Checkbox

by Daily Coder on Dec 17, 2008
Discuss about creating custom html checkbox under customized html controls.
8 Comment(s)

Purely CSS Callouts

by Daily Coder on Oct 16, 2008
Simple trick for creating callouts just using CSS and without images
16 Comment(s)

Top 7 Tip for Optimizing CSS

by Daily Coder on Oct 6, 2008
About Optimizing techniques of CSS
11 Comment(s)

General

More..
Top 5 new features of Visual Studio 2010 and .NET 4

by Daily Coder on Apr 14, 2010
Discusses the new features of Visual Studio 2010 and .NET 4
0 Comment(s)

Using DebuggerBrowsable Attribute for a better view in debugger window

by Daily Coder on Jan 23, 2010
Describe how we can DebuggerBrowsable attribute for customizing the debugger window view.
1 Comment(s)

Top 5 Small but Must have Extension Methods

by Daily Coder on May 28, 2009
Covering a few very basic and use extension methods
5 Comment(s)

Random Sort a List Using LINQ

by Daily Coder on Nov 21, 2008
How to random Sort a List by using simple LINQ technique
5 Comment(s)

Maintaining Dirty and New state of objects

by Daily Coder on Aug 26, 2008
Explains how to manage Dirty, Clean, New and Old state of business objects in you application
5 Comment(s)

Others

More..
Business Cards and Postcards Giveaway : Comment and Win

by Daily Coder on Mar 26, 2009
Win free business cards and postcards. All you need to win is just comment
3 Comment(s)

MIME content-types with file extension

by Daily Coder on Jul 15, 2008
List of MIME content-types and their file extension
0 Comment(s)

Links - Jun 02, 2008

by Daily Coder on Jun 2, 2008
Some good links about web site design and development
0 Comment(s)

Scripting

More..
JavaScript Exception Handling Techniques

by Daily Coder on Aug 4, 2009
Various techniques of JavaScript exception handling are dicussed here
7 Comment(s)

Animated Progress Bar without Images

by Daily Coder on Sep 3, 2008
How to create a cool looking animated progress bar without using any images using javascript, css and html
6 Comment(s)

Object Oriented Programming with JavaScript : Timer Class

by Daily Coder on Aug 13, 2008
How to do object oriented programming with JavaScript by taking simple example to a timer class.
2 Comment(s)

Variadic Functions in JavaScript

by Daily Coder on Jun 26, 2008
Create and use function with indefinite number of parameters in javascript
2 Comment(s)

Using RegEx(Regular Expressions) in JavaScript

by Daily Coder on May 28, 2008
using javascript to create and verify user's input by using regular expression at client side
2 Comment(s)

Web

More..
How not to cache a page output in ASP.NET

by Daily Coder on Jul 31, 2008
Explains how not to cache pages in asp.net to avoid them stored at client side
7 Comment(s)

The Script tag runat="server" Problem Solution Using ResolveUrl

by Daily Coder on Jul 21, 2008
Solution to the script tag runat="server" problem
14 Comment(s)

How to force a file to download in ASP.NET

by Daily Coder on Jun 16, 2008
This article is about how we can force the user to dowload a particlar file or file type by adding the content-disposition header
3 Comment(s)

Implementing Cookieless Session (ASP.NET)

by Daily Coder on May 27, 2008
Explains how to implement cookieless authentication in asp.net by settings in web.config
1 Comment(s)

Create RSS feed programatically from data in C#

by Daily Coder on May 24, 2008
This article will explain how can you to create you own utility to generate rss feed from yous data programatically
10 Comment(s)

Windows

More..
Using Microsoft Agent in Windows .Net Application

by Daily Coder on Jun 4, 2008
How to use and animate MS in .NET Applications
3 Comment(s)

Using Invoke to access object in a windows forms/controls thread

by Daily Coder on May 26, 2008
How to use Invoke to handle cross thread calls to windows forms or controls
1 Comment(s)

How to crawl a web page/file in a .net application

by Daily Coder on May 23, 2008
Explains how we can crawl a web page or file using a virtual path and store the response locally
4 Comment(s)

How to get current assembly version

by Daily Coder on May 21, 2008
Extracting the version of currently executing assembly
1 Comment(s)

More..

Contact

For any help or queries contact me sa@dailycoding.com
© Copyright 2008 Daily Coding • All rights reserved