Wednesday, April 7, 2010

New <%: %> Code Syntax in ASP.NET 4.0

HTML Encoding

Cross-site script injection (XSS) and HTML encoding attacks are two of the most common security issues that plague web-sites and applications. They occur when hackers find a way to inject client-side script or HTML markup into web-pages that are then viewed by other visitors to a site.

This can be used to both vandalize a site, as well as enable hackers to run client-script code that steals cookie data and/or exploits a user’s identity on a site to do bad things.

One way to help mitigate against cross-site scripting attacks is to make sure that rendered output is HTML encoded within a page. This helps ensures that any content that might have been input/modified by an end-user cannot be output back onto a page containing tags like <script> or <img> elements.

How to HTML Encode Content Today

ASP.NET applications (especially those using ASP.NET MVC) often rely on using code-nugget expressions to render output. Developers today often use the Server.HtmlEncode() or HttpUtility.Encode() helper methods within these expressions to HTML encode the output before it is rendered. This can be done using code like below:

<div class="someclass">
<%= Server.HtmlEncode(Model.Content) %>
</div>

While this works fine, there are two downsides of it:

  • It is a little verbose
  • Developers often forget to call the Server.HtmlEncode method – and there is no easy way to verify its usage across an app

New Code Nugget Syntax

With ASP.NET 4 we are introducing a new code expression syntax () that renders output like blocks do – but which also automatically HTML encodes it before doing so.

This eliminates the need to explicitly HTML encode content like we did in the example above. Instead, you can just write the more concise code below to accomplish the exact same thing:

<div class="someclass">
<%: Model.Content %>
</div>

We chose the syntax so that it would be easy to quickly replace existing instances of code blocks. It also enables you to easily search your code-base for elements to find and verify any cases where you are not using HTML encoding within your application to ensure that you have the correct behavior.

Happy Coding!!!

Thanks : Scottgu.

Free ebook - Essential SQL on SQL Server 2008

Dr. Sikha Bagui, Dr. Richard Earp, "Essential SQL on SQL Server 2008"

This book, written for readers who have little or no previous experience with databases, SQL, or SQL Server, provides a very systematic approach to learning SQL (Structured Query Language) using SQL Server.

Each chapter is written in a step-by-step manner and has examples that can be run using SQL Server. Using the sample tables and data provided, the reader of this book will be able to do all the examples to experience hands-on SQL programming in SQL Server. The text also presents a series of exercises at the end of the chapters to help readers gain proficiency with SQL.

With this book you will learn: Beginning SQL commands how to retrieve and manipulate data using the simple SELECT statement. How to customize SQL Server 2008 s settings and about SQL Server 2008 s functions. How to create, alter, populate and delete tables. About joins, a common database mechanism for combining tables.

Query development, the use of views and other derived structures. Simple set operations. About aggregate functions. How to write subqueries and correlated subqueries. How to create and use indexes and constraints. Transaction processing.



Product Details

  • Paperback: 300 pages
  • Jones and Bartlett Publishers, Inc
  • Language: English
  • ISBN-10: 076378138X

Free Download Links :

1. Hotfile Link
http://hotfile.com/.../076378138X.EBW.zip.html

2. Rapidshare Link
http://rapidshare.com/.../076378138X.EBW.zip.html

3. Mediafire Link
http://www.mediafire.com/?mlwz3unylg3

If you like this post, please add your comments and 'A thanks' would be nice.

Thanks : ebookw.net

Tuesday, April 6, 2010

Free ebook - Essential C# 4.0, 3rd Edition

Essential C# 4.0, 3rd Edition

Essential C# 4.0 is a well-organized,“no-fluff” guide to all versions of C# for programmers at all levels of C# experience. This fully updated edition shows how to make the most of C# 4.0’s new features and programming patterns to write code that is simple, yet powerful.

This edition contains two new chapters on parallel programming, multi­threading, and concurrency, as well as extensive coverage of new C# 4.0 features: dynamic typing, variance, optional/named parameters, and many other new topics.

Mark Michaelis covers the C# language in depth, illustrating key constructs with succinct, downloadable code examples. Graphical “mind maps” at the beginning of each chapter show what material is covered and how individual topics interrelate.

Topics intended for beginners and advanced readers are clearly marked, and the book includes indexes of C# versions (2.0, 3.0, and 4.0), which make it easy for readers to reference topics specific to a given release of C#.


Product Details

  • Paperback: 984 pages
  • Addison-Wesley Professional; 3 edition (March 20, 2010)
  • Language: English
  • ISBN-10: 0321694694
  • ISBN-13: 978-0321694690

Free Download Links :

1. Hotfile Link
http://hotfile.com/.../Addison.Wesley.Essential.CSharp.4.0.Feb.2010.rar.html

2. Depositfiles Link
http://depositfiles.com/../qpw02z5ro

3. SharingMatrix Link
http://sharingmatrix.com/file/3164843

4. Megaupload Link
http://www.megaupload.com/?d=GLA2ONHW

5. Ifile Link
http://ifile.it/dl

If you like this post, please add your comments and 'A thanks' would be nice.

Free ebook - Numerical Methods, Algorithms and Tools in C#

Numerical Methods, Algorithms and Tools in C#

The book focuses on standard numerical methods, novel object-oriented techniques, and the latest Microsoft .NET programming environment. It covers complex number functions, data sorting and searching algorithms, bit manipulation, interpolation methods, numerical manipulation of linear algebraic equations, and numerical methods for calculating approximate solutions of non-linear equations.

The author discusses alternative ways to obtain computer-generated pseudo-random numbers and real random numbers generated by naturally occurring physical phenomena.

He also describes various methods for approximating integrals and special functions, routines for performing statistical analyses of data, and least squares and numerical curve fitting methods for analyzing experimental data, along with numerical methods for solving ordinary and partial differential equations.

The final chapter offers optimization methods for the minimization or maximization of functions.

Exploiting the useful features of C#, this book shows how to write efficient, mathematically intense object-oriented computer programs. The vast array of practical examples presented can be easily customized and implemented to solve complex engineering and scientific problems typically found in real-world computer applications.



Product Details

  • Paperback: 600 pages
  • Numerical Methods, Algorithms and Tools in C# (October 10, 2009)
  • CRC Press
  • Language: English
  • ISBN-10: 0849374790

Free Download Links :

1. SharingMatrix Link
http://sharingmatrix.com/.../0849374790.rar

2. Rapidshare Link
http://rapidshare.com/files/369658409/0849374790.rar

3. File2box Link
http://www.file2box.net/xui1dg28qqku

4. Uploading Link
http://uploading.com/.../0849374790.rar/


If you like this post, please add your comments and 'A thanks' would be nice.

Free ebook - Effective C# : 50 Specific Ways to Improve Your C#

Effective C#: 50 Specific Ways to Improve Your C#, 3nd Edition

C# has matured over the past decade: It’s now a rich language with generics, functional programming concepts, and support for both static and dynamic typing. This palette of techniques provides great tools for many different idioms, but there are also many ways to make mistakes.

In Effective C#, Second Edition, respected .NET expert Bill Wagner identifies fifty ways you can leverage the full power of the C# 4.0 language to express your designs concisely and clearly.

Effective C#, Second Edition, follows a clear format that makes it indispensable to hundreds of thousands of developers: clear, practical explanations, expert tips, and plenty of realistic code examples.

Drawing on his unsurpassed C# experience, Wagner addresses everything from types to resource management to dynamic typing to multicore support in the C# language and the .NET framework.

Along the way, he shows how to avoid common pitfalls in the C# language and the .NET environment. You’ll learn how to.


Product Details

  • Paperback: 352 pages
  • Addison-Wesley Professional; 2 edition (March 15, 2010)
  • Language: English
  • ISBN-10: 0321658701
  • ISBN-13: 978-0321658708

Free Download Links :

1. Hotfile Link
http://hotfile.com/...CSharp.Covers.CSharp.4.0.Feb.2010.rar.html

2. Rapidshare Link
http://rapidshare.com/.../0321245660.rar


If you like this post, please add your comments and 'A thanks' would be nice.

Free ebook - LINQ to Objects Using C# 4.0

LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ

Your Complete Example-Rich Guide to Using and Extending LINQ to Objects and PLINQ

Using LINQ to Objects, .NET developers can write queries over object collections with the same deep functionality that was once available only with SQL and relational databases. Now, for the first time, developers have a comprehensive and authoritative guide to applying LINQ to Objects in real-world software.

Microsoft MVP Troy Magennis introduces state-of-the-art techniques for working with in-memory collections more elegantly and efficiently—and writing code that is exceptionally powerful, robust, and flexible.

Drawing on his unsurpassed experience coding software using LINQ and hosting the popular HookedOnLINQ.com site, Magennis presents timely, realistic solutions to a wide spectrum of development challenges, such as combining data from multiple sources, and achieving optimal performance with extremely large sets of data. Y

ou’ll begin with brief quick-starts that walk you through LINQ to Objects’ key features and query syntax. Next, you’ll drill down to detailed techniques for applying and extending these features with C# 4.0 and C# 3.0—including code examples that reflect the realities of production development.



Product Details

  • Paperback: 336 pages
  • Addison-Wesley Professional; 1 Pap/Pas edition (March 12, 2010)
  • Language: English
  • ISBN-10: 0321637003
  • ISBN-13: 978-0321637000

Free Download Links :

1.Hotfile Link
http://hotfile.com/.../Addison.Wesley.LINQ.to.Objects.Using.CSharp.4.0.Feb.2010.rar.html

2. Depositfiles Link
http://depositfiles.com/files/m0v20e8mj

3. SharingMatrix Link
http://sharingmatrix.com/file/3166117

If you like this post, please add your comments and 'A thanks' would be nice.

Free ebook - Pro ODP.NET for Oracle Database 11g


This book is a comprehensive and easy-to-understand guide for using the Oracle Data Provider (ODP) version 11g on the .NET Framework. It also outlines the core GoF (Gang of Four) design patterns and coding techniques employed to build and deploy high-impact mission-critical applications using advanced Oracle database features through the ODP.NET provider.

The book details the features of the ODP.NET provider in two main sections: “Basic,” covering the basics and mechanisms for data access via ODP.NET; and “Advanced,’ covering advanced Oracle features such as globalization, savepoints, distributed transactions and how to call them via ODP.NET, advanced queueing (AQ), and promotable transactions. It takes you from the ground up through different implementation scenarios via a rich collection of both VB.NET and C# code samples.

It outlines database security and performance optimization tricks and techniques on ODP.NET that conform to best practices and adaptable design. Different GoF design patterns are highlighted for different types of ODP.NET usage scenarios with consideration of performance and security.

It provides a comprehensive guide to the synergistic integration of Oracle and Microsoft technologies such as the upcoming Oracle Developer Tools for Visual Studio (11.1.0.7.10). It also details how programmers can make use of ODT to streamline the creation of robust ODP.NET applications from within the Visual Studio environment.


Product Details

  • Paperback: 300 pages
  • Publisher: Apress; 1 edition (April 19, 2010)
  • Language: English
  • ISBN-10: 1430228202
  • ISBN-13: 978-1430228202

Free Download Links :

1.Hotfile Link
http://hotfile.com/...Apress.Pro.ODP.NET.for.Oracle.Database.11g.Apr.2010.rar.html

2. Rapidshare Link
http://rapidshare.com/.../1430228202_ProODP.rar

3. Uploading Link
http://uploading.com/.../1430228202_ProODP.rar/

4. Megaupload Link
http://www.megaupload.com/?d=MSMVW4AL

If you like this post, please add your comments and 'A thanks' would be nice.

Thursday, April 1, 2010

Free ebook - Microsoft Visual C# 2010 Step by Step


This book assumes that you are a developer who wants to learn the fundamentals of programming with C# by using Visual Studio 2010 and the .NET Framework version 4.0. In this book, you will learn the features of the C# language, and then use them to build applications running on the Microsoft Windows operating system.

By the time you complete this book, you will have a thorough understanding of C# and will have used it to build Windows Presentation Foundation applications, access Microsoft SQL Server databases by using ADO. NET and LINQ, build responsive and scalable applications by using the TPL, and create REST and SOAP Web services by using WCF.


Product Details

  • Paperback: 784 pages
  • Publisher: Microsoft Press; 1 edition (March 24, 2010)
  • Language: English
  • ISBN-10: 0735626707
  • ISBN-13: 978-0735626706

Free Download Links :

1. Hotfile Link
http://hotfile.com/....CSharp.2010.Step.by.Step.Mar.2010.rar.html

2. Save.Am Link
http://save.am/files/4nc6tlru/Visual.CSharp.2010.Step.by.Step.rar.html

3. Hotfile Link
http://depositfiles.com/en/files/bj33gi32c

4. Uploading Link
http://uploading.com/files/f82cd8c1/Visual.CSharp.2010.Step.by.Step.rar/

5. SharingMatrix Link
http://sharingmatrix.com/.../Visual.CSharp.2010.Step.by.Step.rar


If you like this post, please add your comments and 'A thanks' would be nice.

Thanks : Google.com

Tuesday, March 23, 2010

Free ebook - Testing ASP.NET Web Applications


As Microsoft's key Web technology for creating dynamic, data-driven Web sites and Web applications, ASP.NET is incredibly popular. This is the first book to combine several testing topics and make them specific to ASP.NET. The author duo of Microsoft MVPs covers both the test-driven development approach and the specifics of automated user interface testing; performance, load, and stress testing; accessibility testing; and security testing.


This definitive guide walks you through the many testing pitfalls you might experience when developing ASP.NET applications. The authors explain the fundamental concepts of testing and demystify all the correct actions you need to consider and the tools that are available so that you may successfully text your application.

Author duo of Microsoft MVPs offer a unique resource: a combination of several testing topics and making them specific to ASP.NET, Microsoft's key Web technology for creating dynamic, data-driven Web sites and applications Guides you through the many testing pitfalls you may experience when developing ASP.NET applications

Reviews the fundamental concepts of testing and walks you through the various tools and techniques available and for successfully testing an application

Free Download Links :

Hotfile Link
http://hotfile.com/..._TestingASP.rar.html

Rapidshare Link
http://rapidshare.com/..._TestingASP.rar

Depositfiles Link
http://depositfiles.com/en/files/ay7tcqhbu

Uploading Link
http://uploading.com/..._TestingASP.rar/

IFile.It Link
http://ifile.it/dl

If you like this post, please add your comments and 'A thanks' would be nice.

Monday, March 22, 2010

Free ebook - ASP.NET 3.5 Website Programming: Problem – Design – Solution

The ASP.NET 2.0 version of this book was the first to introduce experienced ASP.NET 2.0 programmers to building a web application with a layered approach. Now updated for ASP.NET 3.5 and the Entity Framework, this unique book takes good website design beyond page–by–page coding by emphasizing n–tier ASP.NET web application architectural design.

Each chapter addresses a problem or business need and then discusses the necessary pieces of the puzzle you′ll use to solve that problem. In addition, a professional–level website framework is at the ready, from which you can build real websites, extend the code, and implement specific ASP.NET code.



Product Details

  • Uses the popular Problem;Design;Solution format to help readers, especially those who know how to code specific ASP.NET features, learn to "put it all together" into a complete Web application

  • Emphasizes n-tier ASP.NET Web application architectural design, something intermediate and advanced ASP.NET developers need and can't find anywhere else

  • Current edition is the most popular and discussed book in the p2p.wrox.com reader discussion forums

  • Covers registration and membership system, user-selectable themes, content management systems, polls, mailing lists, forums, e-commerce stores, shopping carts, order management with real-time credit-card processing, localization, and other site features

  • Developers also learn to handle master pages, themes, profiles, Web parts, server-side UI controls, compilation, deployment, instrumentation, error handling and logging, data access with ADO.NET and LINQ, ASP.NET AJAX, and much more

Free Download Links :

Hotfile Link
http://hotfile.com/...Website.Programming.Oct.2009.rar.html

Uploading Link
http://uploading.com/.../A5PNET35WbsiteProg.rar/

Rapidshare Link
http://rapidshare.com/files/365543520/0470187581_3.5A.rar

If you like this post, please add your comments and 'A thanks' would be nice.

Source : Google.com

Saturday, March 20, 2010

Free ebook - Visual C# 2010 Recipes: A Problem-Solution Approach

Visual C# 2010 Recipes: A Problem-Solution Approach

When you are facing a Visual C# 2010 problem, this book likely contains a recipe that provides you with the solution–or at least points you in the right direction. Even if you are simply looking to broaden your knowledge of the .NET Framework class library, then Visual C# 2010 Recipes is the perfect resource to assist you.

This is a fully up-to-date reference for .NET 4.0 programmers. All code samples come as stand-alone Visual Studio 2010 solutions for your convenience.



What you’ll learn

  • Clear, concise answers to myriad problems that occur during day-to-day C# 2010 development

  • How to write code according to Microsoft’s best practice guidelines

  • Answers to questions covering everything from workflow to XML processing

Who is this book for?

While there are few developers who do not stand to learn something from this book’s concise, solution-oriented format, it is primarily aimed at emerging software professionals taking their first steps into the IT marketplace.

These newly qualified and relatively inexperienced developers will gain the most from the book’s comprehensive content and fast-access design, which is aimed at helping them cope with the problems and pitfalls that regularly occur when learning a new technology.

Free Download Links :

Hotfile Link
http://hotfile.com/...A.Problem.Solution.Approach.Mar.2010.rar.html

Depositfiles Link
http://depositfiles.com/.../dko57ro5t

Rapidshare Link
http://rapidshare.com/...A_Problem_Solution_Approach_1430225254.rar

Uploading Link
http://uploading.com/...A.Problem.Solution.Approach.rar

IFile.It Link
http://ifile.it/dl

If you like this post, please add your comments and 'A thanks' would be nice.

Source : Google.com

Thursday, March 18, 2010

Free ebook - WPF with C# 2010 and .NET 4

Windows Presentation Foundation (WPF) is included with the Windows operating system and provides a programming model for building applications that provide a clear separation between the UI and business logic. Written by a leading expert on Microsoft graphics programming, this richly illustrated book provides an introduction to WPF development and explains fundamental WPF concepts.

Packed with helpful examples, this reference progresses through a range of topics that gradually increase in their complexity. You’ll quickly start building applications while you learn how to use both Expression Blend and Visual Studio to build UIs. In addition, the book addresses the needs of programmer who write the code behind the UI and shows you how operations can be performed using both XAML and C#.



Free Download Links :

Depositfiles Link
http://depositfiles.com/.../3vnshgh83

Rapidshare Link
http://rapidshare.com/.../WPF.Programmers.Reference.rar

SharingMatrix Link
http://sharingmatrix.com/.../WPF.Programmers.Reference.rar

Uploading Link
http://uploading.com/.../WPF.Programmers.Reference.rar/

Megaupload Link
http://www.megaupload.com/?d=S9HU5CXJ

Hotfile Link
http://hotfile.com/.../WPF.Programmers.Reference.rar.html

If you like this post, please add your comments and 'A thanks' would be nice.

Thanks : Google.com

Monday, March 15, 2010

Free ebook - Even Faster Web Sites

Performance is critical to the success of any web site, and yet today's web applications push browsers to their limits with increasing amounts of rich content and heavy use of Ajax.

In this book, Steve Souders, web performance evangelist at Google and former Chief Performance Yahoo!, provides valuable techniques to help you optimize your site's performance.

Souders' previous book, the bestselling High Performance Web Sites, shocked the web development world by revealing that 80% of the time it takes for a web page to load is on the client side.

In Even Faster Web Sites, Souders and eight expert contributors provide best practices and pragmatic advice for improving your site's performance in three critical categories:


  • javascript - Get advice for understanding Ajax performance, writing efficient javascript, creating responsive applications, loading scripts without blocking other components, and more.

  • Network-Learn to share resources across multiple domains, reduce image size without loss of quality, and use chunked encoding to render pages faster.

  • Browser-Discover alternatives to iframes, how to simplify CSS selectors, and other techniques.

Speed is essential for today's rich media web sites and Web 2.0 applications. With this book, you'll learn how to shave precious seconds off your sites' load times and make them respond even faster.

Free Download Links :
1 . Uploading Link
http://uploading.com/.../Even_Faster_Web_Sites.7z/

2 . DepositFile Link
http://depositfiles.com/.../6qdlq067d

3 . Rapidshare Link
http://rapidshare.com/.../Even_Faster_Web_Sites.7z
Source : www.heroturko.org

If you like this post, please add your comments and 'A thanks' would be nice.

Monday, March 8, 2010

NUnit Test vs MsTest

What are the differences between the two most popular UNIT testing frameworks in the .NET world: the open source NUnit and the commercial MsTest.

Here’s a short list of what i remember instantly:

  • Nunit contains a [TestCase] attribute that allows implementing parametrized tests. this does not exist in msTest

  • MsTest's ExpectedException attribute has a bug where the expected message is never really asserted even if it's wrong - the test will pass.

  • Nunit has an Assert.Throws API to allow testing an exception on a specific line of code instead of the whole method (you can easily implement this one yourself though)

  • Nunit contains a fluent version of Assert api (as already mentioned - Assert.That..)

  • Nunit is much faster

  • NUnit can run tests in 32 and 64 bit (MSTest only runs them in 32 bit IIRC)

  • NUnit allows abstract classes to be test fixtures (so you can inherit test fixtures). MsTest does not.

  • NUnit allows non public classes to be test fixtures (as of the latest version)

  • NUnit was created SOLELY for the idea of unit testing. MsTest was created for Testing - and also a bit of unit testing.

  • NUnit contains PNunit (running prallel tests with Nunit). MsTest only adds this ability in vs 2010

given all these – MsTest has much better abilities for integration based testing (all these are things Nunit doesn’t even want to have):

  • Ability to do data-driven tests from a db data source

  • Ability to do performance testing

  • Ability to determine the order of tests (ordered tests)

  • Ability to easily setup and teardown and generate database data

  • Great integration with team system reporting for LOADS of statistics

having said all these:

if you’re working with team system, I’d use MsTest. the integration with other team system tools and reporting is just beyond compare and the reporting alone helps alot to find recurring breaking tests, code churn vs. new tests and others.

Happy coding!

Source : ISerializable.com

Saturday, February 27, 2010

Free ebook - Beginning Visual Basic 2010

What better way to get started with Visual Basic than with this essential Wrox beginner’s guide?

Beginning Microsoft Visual Basic 2010 not only shows you how to write Windows applications, Web applications with ASP.NET, and Windows mobile and embedded CE apps with Visual Basic 2010, but you’ll also get a thorough grounding in the basic nuts-and-bolts of writing good code.A focused, step-by-step approach to Visual Basic for new programmers.

You’ll be exposed to the very latest VB tools and techniques with coverage of both the Visual Studio 2010 and .NET 4 releases. Plus, the book walks you step-by-step through tasks, as you gradually master this exciting new release of Microsoft’s popular and important programming language.


  • Microsoft’s Visual Basic is a frequent first language for new programmers; this clear, focused book walks you through the basics and gets you quickly productive in Visual Basic

  • Features in-depth coverage of the Visual Studio 2010 and .NET 4 releases, so you’ll be learning the very latest VB tools and techniques

  • Discusses flow control, data structure, Windows applications, dialog boxes, menus, error handing and debugging, and objects and object oriented techniques

  • Covers class libraries, Windows Forms, graphics programming, accessing databases, Web programming with ASP.NET and Visual Basic, data access, SQL Server, ADO.NET, and XML

Free Download Links
1. Hotfile Link
http://hotfile.com/.../Visual.Basic.2010.rar.html

2. Uploading Link
http://uploading.com/files/get/25267b23/

Source : downarchive.com

If you like this post, please add your comments and 'A thanks' would be nice.

Monday, February 22, 2010

Free ebook - SAMS C# 4.0 How-To

Need fast, robust, efficient code solutions for Microsoft C# 4.0? This book delivers exactly what you’re looking for. You’ll find more than 200 solutions, best-practice techniques, and tested code samples for everything from classes to exceptions, networking to XML, LINQ to Silverlight.

Completely up-to-date, this book fully reflects major language enhancements introduced with the new C# 4.0 and .NET 4.0. When time is of the essence, turn here first: Get answers you can trust and code you can use, right now!

Beginning with the language essentials and moving on to solving common problems using the .NET Framework, C# 4.0 How-To addresses a wide range of general programming problems and algorithms.

Along the way is clear, concise coverage of a broad spectrum of C# techniques that will help developers of all levels become more proficient with C# and the most popular .NET tools.


Product Details
  • Paperback: 672 pages
  • Publisher: Sams; 1 edition (March 19, 2010)
  • Language: English
  • ISBN-10: 0672330636
  • ISBN-13: 978-0672330636

Free Download Links :

1. Hotfile Link
http://hotfile.com/.../Sams.CSharp.4.0.How.To.Feb.2010.rar.html

If you like this post, please add your comments and 'A thanks' would be nice.

Saturday, February 13, 2010

Free ebook - CLR via C# 3rd Edition

Dig deep and master the intricacies of the common language runtime (CLR) and the .NET Framework 4.0. Written by a highly regarded programming expert and consultant to the Microsoft(R) .NET team, this guide is ideal for developers building any kind of application-including Microsoft(R) ASP.NET, Windows(R) Forms, Microsoft(R) SQL Server(R), Web services, and console applications.

You’ll get hands-on instruction and extensive C# code samples to help you tackle the tough topics and develop high-performance applications.


Product Details

  • Paperback: 896 pages
  • Publisher: Microsoft Press; 3 edition (February 15, 2010)
  • Language: English
  • ISBN-10: 0735627045
  • ISBN-13: 978-0735627048

Free Download Links :

1. Megaupload Link
http://www.megaupload.com/?d=JS3CUIUS


2. Rapidshare Link
http://rapidshare.com/...Csharp.3rd.Edition.Feb.2010.rar


3. Hotfile Link
http://hotfile.com/...Csharp.3rd.Edition.Feb.2010.rar.html


If you like this post, please add your comments and 'A thanks' would be nice.

Thursday, February 11, 2010

.NET 4 String Function to Check for Empty Strings

Question is...
How to Check an Empty Strings or not in ASP.NET 4.0?

How many times have you written code similar to this?

string firstName = FirstName.Text.Trim();

if (!string.IsNullOrEmpty(firstName))
{
// do something
}

// or

if (someParam == null || string.IsNullOrEmpty(someParam.Trim())
throw new ArgumentException("Empty string", "someParam");

// do something

A nice little time-saver for those guard functions is now included in .NET 4 - the IsNullOrWhiteSpace function

if (!string.IsNullOrWhiteSpace(FirstName.Text))
{
// do something
}

IsNullOrWhiteSpace checks for null, empty or whitespace characters.

Sure, it’s a little thing, but it’s nice to have it in there, especially considering we get all sorts of nice new little things, and the client framework install is still smaller than it was in .NET 3.5

Wednesday, February 10, 2010

Free ebook - Accelerated C# 2010

C# 2010 offers powerful new features, and this book is the fastest path to mastering them - and the rest of C# - for both experienced C# programmers moving to C# 2010 and programmers moving to C# from another object-oriented language.

Many books introduce C#, but very few also explain how to use it optimally with the .NET Common Language Runtime (CLR).

This book teaches both core C# language concepts and how to wisely employ C# idioms and object-oriented design patterns to exploit the power of C# and the CLR.

Product Details
  • Paperback: 450 pages
  • Publisher: Apress; 1 edition (February 1, 2010)
  • Language: English
  • ISBN-10: 1430225378
  • ISBN-13: 978-1430225379

Free Download Links :

1. Hotfile Link
http://hotfile.com/.../Apress.Accelerated.CSharp.2010.Jan.2010.rar.html

2. Depositfiles Link
http://depositfiles.com/en/files/z5irsz0vc

3. Turbobit Link
http://www.turbobit.net/qwwwwn1cr5bu.html

4. Mediafire Link
http://www.mediafire.com/?zdimymencjz

5.Megaupload Link
http://www.megaupload.com/?d=DSBGXTDC

6. Rapidshare Link
http://rapidshare.com/files/337300455/BR-1663-ACs10.rar

If you like this post, please add your comments and 'A thanks' would be nice.

Convert a DataTable to a List<> using C#

Question is...
Convert a DataTable to a List<> using C#

To convert a DataTable to a List<> in .NET 2.0.

Here’s the code to do so:


// Assuming there is a DataTable called dt
List<DataRow> drlist = new List<DataRow>();

foreach (DataRow row in dt.Rows)
{
drlist.Add((DataRow)row);
}

Please note that this is just a prototype and may not cover all scenarios.

Note: I have not tested this but in .NET 3.5, you should be able to do this:

List<DataRow> drlist = dt.AsEnumerable().ToList();

Simplest way to Programmatically ShutDown or Restart your System using C#

Question is...
Simplest way to Programmatically ShutDown or Restart your System using C#

One of the ways to ShutDown or Restart your system is to use WMI (Windows Management Interface). However it does require you to write a few lines of code.

I have found that the simplest way to ShutDown or Restart your computer is to use the Process class in the System.Diagnostics namespace. Here’s an example:


private void btnShutDown_Click(object sender, EventArgs e)
{
Process.Start("shutdown", "-s -f -t 0");
}

private void btnRestart_Click(object sender, EventArgs e)
{
Process.Start("shutdown", "-r -f -t 0");
}

Convert a String Array to a Decimal Array using C#

Question is...
Convert a String Array to a Decimal Array using C#

The Array.ConvertAll() method is a very useful method to convert an array of one type to an array of another type.

Here’s how to use ConvertAll() to convert a String[] to Decimal[]


static void Main(string[] args)
{
string[] strArray = new string[] { "1164", "2213" };

decimal d;
decimal[] d1;

// Check if string can be converted to decimal equivalent
if (strArray.All(number => Decimal.TryParse(number, out d)))
{
d1 = Array.ConvertAll<string, decimal>(strArray, Convert.ToDecimal);
}
}

The first step is to use Enumerable.All(TSource) to determine whether all the elements in a sequence satisfy a condition, in our case, if all the elements of the array can be converted to its decimal equivalent.

Once this can be done, we use ConvertAll() to convert an array of string to an array of decimal.

Convert LowerCase and UpperCase to TitleCase in C#

Question is...
Convert LowerCase and UpperCase to TitleCase in C#

The String class has the ToLower() and the ToUpper() methods to convert a string to lowercase and uppercase respectively.

However when it comes to converting the string to TitleCase, the ToTitleCase() method of the TextInfo class comes very handy. Let me demonstrate this with an example:


class Program
{
static void Main(string[] args)
{
string strLow = "lower case";
string strT = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strLow);
Console.WriteLine("Lower Case to Title Case: " + strT);

string strCap = "UPPER CASE";
strT = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strCap.ToLower());
Console.WriteLine("Upper Case to Title Case: " + strT);
Console.ReadLine();
}
}

Make sure you import the System.Globalization namespace. As you can observe, we are using the CurrentCulture.TextInfo property to retrieve an instance of the TextInfo class based on the current culture.

Note:
As mentioned on the site, "this method does not currently provide proper casing to convert a word that is entirely uppercase, such as an acronym". This is the reason why we first convert strCap to lower case and then supply the lowercase string to ToTitleCase() in the following manner:

CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strCap.ToLower());

Convert Enum to List<> using C#

Question is...
Convert Enum to List<> using C#

A user recently asked me how to convert an Enum to a List<>.

Here's the code to do so:

class Program
{
enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri };

static void Main(string[] args)
{
Array arr = Enum.GetValues(typeof(Days));
List<string> lstDays = new List<string>(arr.Length);

for (int i = 0; i < arr.Length; i++)
{
lstDays.Add(arr.GetValue(i).ToString());
}
}
}

Find Out the Image Type without Checking its Extension using C#

Question is...
Find Out the Image Type without Checking its Extension using C#

My colleague called up with a query. His application accepted images to be uploaded to a central server. Later the application processed the images and separated them according to the Image Type. They determined the image type by checking the extension of the image uploaded –- a very common practice of detecting the image type.

The issue here was that some images which were actually gif’s were renamed as jpeg's and then uploaded, which led to faulty image processing. The requirement was to determine the correct image type in the simplest possible way even if the extension was renamed.

Here’s what I suggested:


try
{
Image imgUp = Image.FromFile(Server.MapPath("~/images/abc.jpg"));

if (imgUp.RawFormat.Equals(ImageFormat.Jpeg))
Response.Write("JPEG");

else if (imgUp.RawFormat.Equals(ImageFormat.Gif))
Response.Write("GIF");
}
catch (Exception ex)
{
}

Tuesday, February 9, 2010

How to calculate the CPU Usage Programmatically using C#

Question is...
How to calculate the CPU Usage Programmatically using C#

The PerformanceCounter class represents a WindowsNT performance counter component. To read from a performance counter, we first create an instance of the PerformanceCounter class supplying the CategoryName, CounterName, and InstanceName as parameters to the constructor and then call the NextValue() method to take a performance counter reading.

Import the namespaces System.Diagnostics and System.Threading.


static PerformanceCounter cpuUsage;
public static void Main(string[] args)
{
cpuUsage =
new PerformanceCounter("Processor", "% Processor Time", "_Total");

Console.WriteLine(cpuUsage.NextValue() + " %");
Thread.Sleep(1000);

Console.WriteLine(cpuUsage.NextValue() + " %");
Console.Read();
}

Note:
Observe that we are calling NextValues() twice and after a delay of 1 second. This is because performance counters need two samples to perform the calculation and the counter value is updated once per second, hence the 1 second delay between the two calls.

Count Words and Characters in a String using C#

Question is...
Count Words and Characters in a String using C#

A user recently asked me a question on how to use Regular Expressions to count words and characters in a string. Here’s how:

First add a reference to System.Text.RegularExpressions

Here the strOriginal is your string.

// Count words
MatchCollection wordColl =
Regex.Matches(strOriginal, @"[\S]+");

Console.WriteLine(wordColl.Count.ToString());

// Count characters. White space is treated as a character
MatchCollection charColl = Regex.Matches(strOriginal, @".");
Console.WriteLine(charColl.Count.ToString());

Find Information about your Network Cards using C#

Find Information about your Network Cards using C#

Here’s a small snippet of code of how to find out which network cards are enabled and able to transmit data on your machine. Here’s the code.

Add a reference to System.Net.NetworkInformation


var nics = NetworkInterface.GetAllNetworkInterfaces()
.Where(o => o.OperationalStatus == OperationalStatus.Up);

foreach (var item in nics)
{
Response.Write(item.Description + "<br />");
Response.Write(item.Name + "<br />");
Response.Write(item.Speed + "<br />");
Response.Write(item.NetworkInterfaceType + "<br /><br />");
}

Hiding a File using C#

Hiding a File using C#

The FileInfo class is very useful class that contains methods for the creation, copying, deletion, moving, and opening of files. Here’s how to hide a file using C#.


class Program
{
static void Main(string[] args)
{
try
{
string filePath = @"D:\Network.txt";
FileInfo f = new FileInfo(filePath);
f.Attributes = FileAttributes.Hidden;
Console.WriteLine("File Hidden");
}
catch (Exception ex)
{
// handle ex
}
}
}

Retrieve a List of the Services Running on your Computer using C#

Retrieve a List of the Services Running on your Computer using C#

The ServiceController class can be used to retrieve a list of the services running on your computer. The GetServices() can be used to do so. Here’s an example to list the services that are running on your machine

Add a reference to System.ServiceProcess.

Then write the following code:


using System;
using System.ServiceProcess;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
ServiceController[] sController =
ServiceController.GetServices();
foreach (ServiceController sc in sController)
{
if (sc.Status.ToString() == "Running")
{
Console.WriteLine(sc.ServiceName);
}
}
Console.ReadLine();
}
catch (Exception ex)
{
// handle ex
}
}
}
}

Optional parameters and named parameters in C# 4.0

Optional parameters and named parameters in C# 4.0

Imagine you have two List. Two new features to C# 4.0 are optional parameters and named parameters.

Optional parameters have been a part of VB.Net but it's now possible to do this in C#. Instead of using overload methods, you can do this in C#:

private string SomeMethod(string givenName,
string surname = "Kannan",
int age = 10)
{
return givenName + " " + surname;
}

The second and third parameters, surname & age, both have default values. The only parameter required is givenName. To call this method you can either write this:

string name = null;
name = SomeMethod("Arjun");

That will return Arjun Kannan. You can also do this:

string name = null;
name = SomeMethod("FName", "LName");

The value returned is FName LName. But what if you didn't want to specify a surname but you did want to pass the age? You can do this by using named parameters:

string name = null;
name = SomeMethod("Rangoli", age: 20);

These are nice additions to the language.

List the Drives on your Computer using C#

List the Drives on your Computer using C#?

Imagine you have two List. If you want to create a program to provide information about your Computer Drive, then use the System.IO.DriveInfo class.

The DriveInfo class can be used to determine the drives available on your computer, drive capacity, free space, type of drives etc. as shown below:


// Add namespace System.IO;

DriveInfo[] myDrives = DriveInfo.GetDrives();

foreach (DriveInfo di in myDrives)
{
Console.WriteLine(di.Name);
if (di.IsReady)
{
Console.WriteLine(di.TotalSize);
Console.WriteLine(di.DriveFormat);

Console.WriteLine(di.AvailableFreeSpace);
Console.WriteLine(di.TotalFreeSpace);

Console.WriteLine(di.DriveType);
Console.WriteLine(di.VolumeLabel);
}
}

Compare Two List of Strings in C#

Compare Two List of Strings in C#?

Imagine you have two List. You want to quickly compare them to see if all the elements match each other. Here's how to do so:

List<string> strList1 = new List<string>
{
"Jack", "And", "Jill", "Went", "Up", "The", "Hill"
};

List<string> strList2 = new List<string>
{
"Jack", "And", "Jill", "Went", "Down", "The", "Hill"
};

bool result = strList1.SequenceEqual(strList2);

How to check if a TCP port is blocked using C#

How to check if a TCP port is blocked using C#?

In order to check if a TCP port is blocked, use the System.Net and System.Net.Sockets classes as shown below:

protected void Button1_Click(object sender, EventArgs e)
{
string host = "localhost";
int port = 6900;
IPAddress addr = (IPAddress)Dns.GetHostAddresses(host)[0];
try
{
TcpListener tcpList = new TcpListener(addr, port);
tcpList.Start();
}
catch (SocketException sx)
{
// Catch exception here if port is blocked
}
}

Convert Domain Name to IP Address

How to convert Domain Name to IP Address in C#?

The answer is quiet simple. Just use the System.Net.Dns class

using System.Net;

protected void Page_Load(object sender, EventArgs e)
{
foreach (IPAddress address in Dns.GetHostAddresses("www.youraddress.com"))
{
Response.Write(address.ToString());
}
}

Multiple Inheritance in C#

C# supports single inheritance, however they do support multiple 'interface' inheritance:

Here's a sample demonstrating the same:


//Single Inheritance

public class A
{
public A() { }
}

public class B : A
{
public B() { }
}


//Multiple Interface Inheritance

interface IComparable
{
int CompareTo(object obj);
}

interface ISomethingElse
{
int EqualTo();
}


public class Z : IComparable, ISomethingElse
{
public int CompareTo(object obj)
{
// implementation code goes here
}


public int EqualTo()
{
// implementation code goes here
}
}

When I would need to create an interface when designing my application ?

Question ...
When I would need to create an interface when designing my application ?

Short Answer...
When you want to abstract out what is required from how that requirement is met.

Full Answer...

The somewhat longer answer is to start with some of the premises of writing Clean Code:

  • Each method should be very short and do just one thing

  • Each class should have one easily articulated area of responsibility

  • Classes should know what other classes do but not how.

Let's look at how that might play out with an small example...

You might start off by refactoring into a Note class and a FileManager class like this:

using System.IO;
using System;

namespace Interfaces
{
class Program
{
static void Main( string[] args )
{
var np = new NotePad();
np.NotePadMainMethod();
}
}

class NotePad
{
private string text = "Hello world";

public void NotePadMainMethod()
{
Console.WriteLine( "Here I would interact with you and offer you
a writing surface"
);
Console.WriteLine( "Then when you push the right button,
I ask FileManager to "
);
Console.WriteLine("print the file..." );

var fm = new FileManager();
fm.Print(text);
}
}

class FileManager
{
public void Print(string text)
{
Console.WriteLine( "I'm pretending to backup the old version of the file and then " );
Console.WriteLine( " print the text you sent me " );
Console.WriteLine( " printing {0}" , text );
var writer = new StreamWriter( @"c:\temp\HelloWorld.txt", true );
writer.WriteLine( text );
writer.Close();
}
}
}

This console program is stripped of all error checking and all three classes are in one file to keep things simple. The idea is that the NotePad class interacts with the user, obtains a string to print, and then sends it to the FileManager whose job is to see if the file exists, if so make a backup, and then write the user’s text to the file (presumably we’d open a file save dialog rather than just assuming the user wants to write to c:\temp\HelloWorld.txt).

Adding A Second Writer

After creating the above, you realize that there will be times that you will want to write to, e.g., Twitter. You could put in a branching statement:

using System.IO;
using System;

namespace Interfaces
{
class Program
{
static void Main( string[] args )
{
new NotePad().NotePadMainMethod();
}
}

class NotePad
{
private string text = "Hello world";

public void NotePadMainMethod()
{
var dest = "Twitter";
switch ( dest )
{
case "File":
var fm = new FileManager();
fm.Print( text );
break;
case "Twitter":
var tm = new TwitterManager();
tm.Tweet( text );
break;
}
}
}


class FileManager
{
public void Print(string text)
{
// write to file
}
}

class TwitterManager
{
public void Tweet( string text )
{
// write to twitter
}
}
}


Adding An Interface

This begins to get ugly, and more important, the NotePad class is now entirely dependent on both the FileManager class and the TwitterManager class. It is cleaner, easier to maintain, and far easier to test, if we remove those dependencies.

The first step in doing so is to have the NotePad not know which class will take care of writing the message; all it needs to know is that some class that knows how to "Write" will do the work. We accomplish this by creating an interface, Writer that has a Write method.

interface Writer
{
void Write(string whatToWrite);
}

We then have the FileManager and TwitterManager classes implement this interface:

class FileManager : Writer
{
public void Write( string text )
{
// write to a file
}
}

class TwitterManager : Writer
{
public void Write( string text )
{
// write to Twitter stream
}
}

At this point, we return to the NotePad and it can instantiate the class it wants as a Writer:

public void NotePadMainMethod()
{
var w = new TwitterManager();
w.Write( text );
}

That is step 1 in decoupling the NotePad from the other classes; now all it knows is that it has a Writer, which can be one or the other of the streams (or any other class that implements that method) but we’re hard coding which implementing class to use (in this case TwitterManager) in the NotePad class… not great.

Dependency Injection

Dependency Injection is one of those terms you really want to work into your conversation at every conference you attend. It marks you as a cutting edge, in the know kind of geek.

Here’s how it works. You don't want to hard-code the dependency into NotePad because that makes for code that is hard to maintain and hard to test.

What you can do, instead, is “inject” the dependency at run time. You can inject in a number of ways, the most common of which are:

  • Constructor injection

  • Property injection

  • Parameter injection

  • Using a Factory

  • Using an Inversion of Control (IoC) container

(Yes, IoC container may be even cooler than dependency injection. More on IoC below, but not much more)

1. Constructor injection just says that we’ll let the Notepad know which type of writer it is going to use when we create the class:

class NotePad
{
private string text = "Hello world";
private Writer w;
public NotePad( Writer w )
{
this.w = w;
}

public void NotePadMainMethod()
{
w.Write( text );
}
}

Notice that we pass in an instance of Writer, stash it away in a member variable and then NotePadMainMethod just uses it. The actual instance is not created in NotePad, it is created in whomever instantiates the NotePad and “injected” into NotePad through the constructor.

2. Property Injection works the same way, but instead of passing in the writer through the constructor, you set a property,

public Writer MyWriter { get; set; }

public void NotePadMainMethod()
{
MyWriter.Write( text );
}

Now whoever instantiates MyWriter just sets the property and NotePad can take it from there.

3. Parameter Injection, as you can, by now imagine, eschews having a member variable, and just passes the type of writer into the method as a parameter

public void NotePadMainMethod(Writer w)
{
w.Write( text );
}


4 & 5. Factory Pattern and IoC Containers
Please refer in online.

Source : Blog Silverlight.net

Monday, February 8, 2010

Free ebook - VS 2010 and .NET Framework 4 Training Kit

Visual Studio 2010 and .NET Framework 4 Training Kit - January 2010 Release.

The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including:

  • C# 4.0
  • Visual Basic 10
  • F#
  • Parallel Extensions
  • Windows Communication Foundation
  • Windows Workflow
  • Windows Presentation Foundation
  • ASP.NET 4
  • Windows 7
  • Entity Framework
  • ADO.NET Data Services
  • Managed Extensibility Framework
  • Visual Studio Team System

This version of the Training Kit works with Visual Studio 2010 Beta 2 and .NET Framework 4 Beta 2.

VS 2010 and .NET Framework 4 Training Kit -
Download here

If you like this post, please add your comments or 'A thanks' would be nice.

Free ebook - Introducing .NET 4.0 With Visual Studio 2010

Microsoft is introducing the vast series of changes to the approach which the .NET Framework operates.

Introducing .NET 4.0: with Visual Studio 2010 is written to yield we with only which roadmap. It serves as the no-nonsense authority which will assistance gifted .NET developers assimilate the stroke of the brand brand brand brand brand brand new horizon as well as the compared technologies.

This book will keep we updated upon the changes as well as assistance we to seize brand brand brand brand brand brand new opportunities quietly as well as quickly.

What you’ll learn

  • Get an general outlook as well as short story of any brand brand brand brand brand brand new or becoming different record which puts it in to context

  • Familiarize yourself with pass concepts as well as opportunities by rarely permitted tutorials

  • Understand how to perform usual tasks in brand brand brand brand brand brand new record areas such as pLINQ

  • Gain consultant opening tips

  • See examples of real-world applications of any record to assistance we sense how the record can be put to work

Free Download Links

1. Rapidshare Link
http://rapidshare.com/files/347019808/00KB01_R15.rar

2. Megaupload Link
http://www.megaupload.com/?d=VOE3O9QK

3. Hotfile Link
http://hotfile.com/dl/27369956/0a5f089/143022455X.rar.html

4. Uploading Link
http://uploading.com/files/am82379d/143022455X.rar/

If you like this post, please add your comments or 'A thanks' would be nice.

Friday, January 29, 2010

Free ebook - C# 4.0 in a Nutshell: The Definitive Reference

When we have questions about how to make make use of of C# 4.0 or the .NET CLR, this rarely acclaimed bestseller has precisely the answers we need.

Uniquely orderly around concepts as well as make make use of of cases, this fourth book includes in-depth coverage of brand new C# topics such as together programming, formula contracts, energetic programming, security, as well as COM interoperability.

You'll additionally find updated report upon LINQ, together with examples which work with both LINQ to SQL as well as Entity Framework. This book has all the necessary sum to keep we upon lane with C# 4.0.

  • Get up to speed upon C# denunciation basics, together with syntax, types, as well as variables

  • Explore modernized topics such as vulnerable formula as well as preprocessor directives

  • Learn C# 4.0 facilities such as energetic binding, sort parameter variance, as well as discretionary as well as declared parameters

  • Work with .NET 4’s abounding set of facilities for together programming, formula contracts, as well as the formula confidence model

  • Learn .NET topics, together with XML, collections, I/O as well as networking, mental recall management, reflection, attributes, security, as well as local interoperability

Free Download Links :

1. Hotfile Link
http://hotfile.com/...Jan.2010.rar.html

2. Megauload Link
http://www.megaupload.com/?d=2FXF6QEU

3. Rapidshare Link
http://rapidshare.com/.../00KB06_R07.rar

'A Thanks' would be nice.

Sunday, January 24, 2010

10 Things to Consider Before You Send the Next Email

10 Things to Consider Before You Send the Next Email

Email is the primary mode of communication between Internet users. You use email to network with other bloggers, to grow your online business, to convert potential prospects into clients and so on. The micro blogging sites like Twitter, Facebook may have changed the way we share information but when it comes in communicating with web users, email is probably the simplest and universally accepted option.

Having said that, it's obvious that you should pay attention to all those emails you send everyday. Here are a few tips for maintaining proper email etiquette:

1. Use a meaningful subject.

Just as a meaningful title makes a reader read a blog post, a meaningful subject of your email sets it apart from the crowd. A meaningful subject saves time as the recipient can grasp your idea quickly.

For example: If you want to post a guest article at Dailyblogtips and want to contact Daniel, use the subject line as "Guest article" rather than "Hello Daniel".

2. Skip the introductory paragraphs, jump directly to the point

When you are writing an email, keep the purpose in focus. Do not make the email longer by adding unnecessary introductions or links. The person whom you are writing the email may have dozens of emails to read and if you make the email long and boring, he will rather skip reading it.

Thus, avoid the boring intros and jump directly to your point. It saves time at both ends.

3. Use saved templates for answering commonly asked questions

If you get frequent emails where readers ask you the same questions, spend some time writing a template and save it in your drafts folder. Whenever you get a similar message to which you have replied before, just paste the template into the email message.

4. Add a human touch. Make it personal

I just said using templates to answer commonly asked questions. But do not overkill by making everything automated. There are some emails that will need your personal attention. So spend some time on them and try to provide some value. Not only you will get respect from the receiver, it also adds an impression that you care about your prospects.

5. Never write in capital case

WRITING AN EMAIL IN CAPITAL CASE makes it difficult to read and the receiver will get annoyed for sure. Hence, do not write an email in capital letters or else your message might end up in the trash folder.

6. Stick to the proper message thread

Including the earlier conversations in your reply is a good habit. The receiver might not remember the subject and the progress of each and every conversation. Hence an email without a thread will surely frustrate the receiver and he will have to spend some time searching for earlier threads of the conversation.

Gmail automatically includes the threads in your "reply" messages. Whenever you are replying to an email conversation always click "reply" instead of composing a new email message.

7. Read the email before you send it

Before you hit the send button, read what you have just typed. There may be spelling and grammatical mistakes which might have slipped through. Try to read the email from the receivers angle and see if it delivers the same meaning which you are trying to convey.

8. Don’t use abbreviations, slang and emoticons

Business emails should be formal as they reflect the posture of your organization or company. If you lower the weight of your business email by adding lots of abbreviations and smilies (e.g., LOL and :) - smiles ), chances are there that your clients won’t take you seriously.

9. Be careful with formatting

Do not try to decorate your email message with lots of colors and formatted stuff. If you unnecessarily highlight text, the email can appear to be spammy. As a general rule, use black color on a white background.

10. Use short and simple sentences

Email’s should be simple to read and should convey the meaning as quick as possible. Never think that if your writing is Shakespearean, the recipient will take interest in reading it. Keep the sentences short and simple and never write an email when you are angry – it reflects.

Do you take care of all of the above mentioned emailing habits ? Let us know through the comments section.

Hope this will be useful.

Source : DailyBlogTips

Friday, January 22, 2010

Checkbox Validation using jQuery?

How to validate the checkbox using Jquery?

In the HTML form have multiple chekcbox in same using html array element. That time we will use three types of checkbox validation for checked or not.

Multiple checkbox validation has three types.
  • Checkbox validation using Id
  • Checkbox validation using name
  • Checkbox validation using div tag
Let we see via examples:

Take the below html/aspx code likes ...

<form>
<div id="checkboxId">
<input type="checkbox" name="chkBox[]" id="chkBox[]">
<input type="checkbox" name="chkBox[]" id="chkBox[]">
<input type="checkbox" name="chkBox[]" id="chkBox[]">
</div>

<input type="button" name="Btnaction"
value="submit" onclick="return validateId();">
</form>
</div>

// Calling jquery file.
<script language="javascript" src="jquery.js" type="text/javascript"></script>

1. Checkbox validation using Id

<script language="javascript">
function validateId()
{
var selector_checked = $("input[@id=chkBox]:checked").length;
alert(selector_checked);
if (selector_checked == 0)
{
return false;
}
else if (selector_checked == 0)
{
return false;
}
else
{
return true;
}
}
</script>

2. Checkbox validation using Name

Replace the function name from 'validateId' to 'validateName' in the above html/aspx code.

function validateName()
{
var selector_checked = $("input[@name=chkBox]:checked").length;
alert(selector_checked);
if (selector_checked == 0)
{
return false;
}
else if (selector_checked == 0)
{
return false;
}
else
{
return true;
}
}

3. Checkbox validation using Div tag

Replace the function name from 'validateName' to 'validateDiv' in the above html/aspx code.

function validateDiv()
{
if($("#checkboxId input[type='checkbox']:checked").length > 0)
{
return true;
}
}

4. Single checkbox validation.

<div>
<input type="checkbox" name="chkBox[]" id="chkTCAgree" />Agree terms and condition
text here<br />
<input type="button" name="Btnaction" value="submit" onclick="return validateTC();" />
</div>

function validateTC() {
var agree = $('#chkTCAgree').attr('checked');
if (!agree) {
alert("please accept the terms and conditions");
return false;
}
}

Enjoy the technology!