Skip to content

Feed aggregator

Indexes in SQL Server

C-Sharpcorner - Latest Articles - 21 hours 24 min ago
In this article you will learn about indexes of SQL Server.
Categories: Communities

OWIN and Katana Interfaces of ASP.Net

C-Sharpcorner - Latest Articles - 21 hours 24 min ago
In this article, I will share what I have my learned about what O.W.I.N. and Katana are and will try to get into some basic details that are some important concept to be learned.
Categories: Communities

Builder Design Pattern From Intent to Implementation

C-Sharpcorner - Latest Articles - 21 hours 24 min ago
This article explains the Builder Design Pattern, its intent and practical implementation with a real-world scenario.
Categories: Communities

The Characteristics of a Successful SPA Session Slide Deck and Demos

Gil Fink on .Net - Sat, 03/28/2015 - 11:34

The Characteristics of a Successful SPA Session Slide Deck and DemosLast week I had the pleasure of delivering a session called “The Characteristics of a Successful SPA” in DevWeek 2015 conference. In the session I covered the following:

  • The Road to Single Page Applications
    What is a SPA?
    SPA Building Blocks
    Characteristics of a Successful SPA

I want to thank all the attendees who came to hear my talk. I hope that you had great time.
As promised, the slide deck and demos are online.

Enjoy!

Categories: Blogs

Code Maps in Visual Studio

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
This article will help you in code debugging and understanding of complex code using Code Maps.
Categories: Communities

Handle Unmanaged Resources

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
This article explains how to handle unmanaged resources in a program.
Categories: Communities

Overriding SaveChanges in Entity Framework

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
In this article you will learn how to override SaveChanges in Entity Framework.
Categories: Communities

What Code Reuse is and Why We Use It

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
In this article you will learn the basics of Object Oriented Programming (OOP) languages.
Categories: Communities

Passing DataTable to StoredProcedure as Parameter in C#

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
This article describes how to pass a DataTable to a Stored Procedure as a parameter using ADO.NET in C#.
Categories: Communities

Table Value Parameter in ASP.Net Using SQL Server

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
This article shows how to pass a collection of records to a database for processing. In SQL Server 2008 we make a custom data type TABLE to pass a collection of rows to a Stored Procedure.
Categories: Communities

Binding GridViewModel in ASP.Net 4.5

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
In this article you will learn how to use GridViewModel Binding in ASP.NET 4.5.
Categories: Communities

Automatic Table Generation in Any Database by NHibernate ORM and CodeDom

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
This article describes how to allow users to build a database automatically from an application via two technologies, code generation (CodeDOM) and NHibernate (Fluent) that let us make a backend regardless of the type of database and without involving complicated concepts.
Categories: Communities

Generate File Plan Report in SharePoint 2013 and Office 365

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
In this article we will see how to generate a File Plan Report in SharePoint 2013 and Office 365.
Categories: Communities

Generating WebFonts Using (TTF) in Website Development

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
This article shows how web fonts are generated and how they are used.
Categories: Communities

The Nokia Maps on Windows Phone 8: Part 4

C-Sharpcorner - Latest Articles - Sat, 03/28/2015 - 08:00
In this fourth and final article we will see an introduction to the Route and RouteLeg classes and so on.
Categories: Communities

Download all your NuGet Package Licenses

you've been HAACKED - Phil Haack - Sat, 03/28/2015 - 01:00

The other day I was discussing the open source dependencies we had in a project with a lawyer. Forgetting my IANAL (I am not a lawyer) status, I made some bold statement regarding our legal obligations, or lack thereof, with respect to the licenses.

I can just see her rolling her eyes and thinking to herself, "ORLY?" She patiently and kindly asked if I could produce a list of all the licenses in the project.

Groan! This means I need to look at every package in the solution and then either open the package and look for the license URL in the metadata, or I need to search for each package and find the license on NuGet.org.

If only the original creators of NuGet exposed the package metadata in a structured manner. If only they had the foresight to provide that information in a scriptable fashion.

Then it dawned on me. Hey! I'm one of those people! And that's exactly what we did! I bet I could programmatically access this information. So I immediately opened up the Package Manager Console in Visual Studio and cranked out a PowerShell script...HA HA HA! Just kidding. I, being the lazy ass I am, turned to Google and hoped someone else figured it out before me.

I didn't find an exact solution, but I found a really good start. This StackOverflow answer by Matt Ward shows how to download every license for a single package. I then found this post by Ed Courtenay to list every package in a solution. I combined the two together and tweaked them a bit (such as filtering out null project names) and ended up with this one liner you can paste into your Package Manager Console. Note that you'll want to change the path to something that makes sense on your machine.

@(Get-Project -All |  ? {$_.ProjectName} | % { Get-Package -ProjectName $_.ProjectName }) | Sort -Unique | % { Try { (New-Object System.Net.WebClient).DownloadFile($_.LicenseUrl, 'c:\dev\licenses\' + $_.Id + ".txt") } Catch [system.exception] { Write-Host "Could not download license for $_.Id" } }

Be sure to double check that the list is correct by comparing it to the list of package folders in your packages directory. This isn't the complete list for my project because we also reference submodules, but it's a really great start!

I have high hopes that some PowerShell guru will come along and improve it even more. But it works on my machine!

Categories: Blogs

Blog Dead? Nope! Just taking a break (and if you need a Cool Thing fix, check these out...)

As if you haven't noticed, I'm on something of a blogging sabbatical. I'm still scanning my 2.5K+ feeds daily and sourcing stories for other areas (see below), but I've kind of run out of blogging want too. No, it's not dead and yes, I'll be back, but for now am just taking a little break...

Still need a Greg/Cool Thing fix? Then you should check out these blogs and casts that I'm  sourcing stories for or helping produce... :)

So yeah, all that and a full time day job (and a science fiction reading addiction), I think you can see why my blogging has been lacking recently. :)

Categories: Blogs

Code Coverage Metrics in Regulated Industries

NCover - Code Coverage for .NET Developers - Fri, 03/27/2015 - 17:35
Code Coverage Metrics in Regulated Industries

code_coverage_regulated_industryIn a previous post, Code Coverage In The Medical Device Software Industry, we discussed the role a governing organization such as the U.S. Food and Drug Administration plays in providing guidance for software development companies in the medical device software industry. Specifically, we reviewed the implications of software validation and code coverage and the prevalence of software defects when changes were made after the initial introduction of the software product. We also discussed how those defects, and the costs and risks associated with them, can be reduced through a well-structured code coverage and software validation process.

Key Code Coverage Metrics

In this post, we will review section 5.2.5 of the General Principles of Software Validation as issued by the FDA and the specific metrics that can be used to ensure compliance.  This is not a full or exhaustive list, but rather a summary of three key coverage metrics presented by the FDA, how the FDA defines them, and how they can be analyzed when using NCover to collect code coverage on your .NET applications.

Statement Coverage (Sequence Point Coverage)

Statement Coverage – This criteria requires sufficient test cases for each program statement to be executed at least once; however, its achievement is insufficient to provide confidence in a software product’s behavior.

regulated_sequence_point_coverageIn NCover, Statement Coverage can be tracked for .NET applications with Sequence Point Coverage.  Sequence Point Coverage is a base code coverage metric that tracks each sequence point of code and calculates the percentage of sequence points covered during the testing of the application.  Although it does not take into consideration multiple branches or conditions, it is a particularly useful metric for tracking down specific portions of code that may be impacting overall coverage.

Decision (Branch) Coverage

Decision (Branch) Coverage – This criteria requires sufficient test cases for each program decision or branch to be executed so that each possible outcome occurs at least once. It is considered to be a minimum level of coverage for most software products, but decision coverage alone is insufficient for high-integrity applications.

regulated_branch_coverageThe definition of Decision Coverage correlates with NCover’s Branch Coverage. Branch Coverage measures the fraction of independent code segments that were executed. Independent code segments are sections of code that have no branches into or out of them. Each independent code segment is a section of code that you would expect to execute in its entirety every time it is run. Branch coverage is one of several key metrics for determining how well the code base for a .NET application has been tested.

Condition Coverage

Condition Coverage – This criteria requires sufficient test cases for each condition in a program decision to take on all possible outcomes at least once. It differs from branch coverage only when multiple conditions must be evaluated to reach a decision.

regulated_condition_coverageCondition Coverage is another standard code coverage metric that was first added to NCover in Version 5. NCover added Condition Coverage to highlight scenarios when sets of branches can be followed, but not through all the possible conditions that lead to that branch. This is most helpful when a method is executed under coverage by multiple tests. These tests together may cover the entire method from a branch coverage perspective, but still not meet all conditions.

The post Code Coverage Metrics in Regulated Industries appeared first on NCover.

Categories: Companies

Timeouts, TCP and streaming operations

Ayende @ Rahien - Fri, 03/27/2015 - 11:00

We got a bug report in the RavenDB mailing list that was interesting to figure out.  The code in question was:

foreach(var product in GetAllProducts(session)) // GetAllProducts is implemented using streaming
{
  ++i;
  if (i > 1000)
  {
    i = 0;
    Thread.Sleep(1000);
  }
}
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

This code would cause a timeout error to occur after a while. The question is why? We can assume that this code is running in a console application, and it can take as long as it wants to process things.

And the server is not impacted from what the client is doing, so why do we have a timeout error here? The quick answer is that we are filling in the buffers.

GetAllProducts is using the RavenDB streaming API, which push the results of the query to the client as soon as we have anything. That lets us parallelize work on both server and client, and avoid having to hold everything in memory.

However, if the client isn’t processing things fast enough, we run into an interesting problem. The server is sending the data to the client over TCP. The client machine will get the results, buffer them and send them to the client. The client will read them from the TCP buffers, then do some work (in this case, just sleeping). Because the rate in which the client is processing items is much smaller than the rate in which we are sending them, the TCP buffers become full.

At this point, the client machine is going to start dropping TCP packets. It doesn’t have any more room to put the data in, and the server will send it again, anyway. And that is what the server is doing, assuming that we have a packet loss over the network. However, that will only hold up for a while, because if the client isn’t going to recover quickly, the server will decide that it is down, and close the TCP connection.

At this point, there isn’t any more data from the server, so the client will catch up with the buffered data, and then wait for the server to send more data. That isn’t going to happen, because the server already consider the connection lost. And eventually the client will time out with an error.

A streaming operation require us to process the results quickly enough to not jam the network.

RavenDB also have the notion of subscriptions. With those, we require explicit client confirmation from the client to send the next batch, so a a slow client isn’t going to cause issues.

Categories: Blogs

How to Get the Subsets From an Array That Are Equal to Input Value

C-Sharpcorner - Latest Articles - Fri, 03/27/2015 - 08:00
This article provides a sample program showing how to get the subsets from an array that are equal to an input value.
Categories: Communities