Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

Buffer Managers, production code and alternative implementations

AddThis Social Bookmark Button
We are porting RavenDB to Linux, and as such, we run into a lot of… interesting issues. Today we run into a really annoying one. We make use of the BufferManager class inside RavenDB to reduce memory allocations. On the .Net side of things, everything works just fine, and we never really had any issues with it. On the Mono side of things, we started getting all sort of weird errors. From ArgumentOutOfRangeException to NullReferenceException to just plain weird stuff. That was the time to dig in and look into what is going on. On the .NET side
of things, BufferManager implementation is based on a selection criteria between large (more than 85Kb) and small buffers. For large buffers, there is a single large pool that is shared among all the users of the pool. For small buffers, the BufferManager uses a pool per active thread as well as a global pool, etc. In fact, looking at the code we see that it is really nice, and a lot of effort has been made to harden it and make it work nicely for many scenarios. The Mono implementation, on the other hand, decides to blithely discard...(Read whole news on source site)

PowerShell script to get the SharePoint version

AddThis Social Bookmark Button

To get which version of SharePoint is installed on the server, you can use the Version property on the SPFarm object. The function below will return the version number or a 0 based on whether SharePoint is installed on the machine or not.

FunctionGet-SharePointVersion
{

      #Add the snapin if not present
      if((Get-PSSnapin|? {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
    {
        Add-PSSnapinMicrosoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    }

      #Get the snapin after adding it
      $snapin= Get-PSSnapin |?{$_.Name -eq "Microsoft.SharePoint.PowerShell"}
      if($snapin-eq $null)
      {
            0
      }
      else
      {
            $snapin.Version.Major
      }
}
/>
To test the scripts I’ve used the FluentShellUnit project and have my test cases as
[TestClass]
[DeploymentItem(@"Modules\SharePoint.psm1", "Modules")]
public class SharePointTests
{
    [TestMethod]
    [TestCategory("SharePointDSCAdministration Module")]
    public voidGetSharePointVersion_should_return_versionnumber_based_on_sharepointinstallation_status()
    {
        varactual = PsFactory.Create(HostState.Core)
            .Load(@"Modules\SharePoint.psm1")
            .Execute("Get-SharePointVersion")
            .FirstResultItemAs();
        Assert.IsTrue(actual == 0 || actual == 14 || actual ==15);
    }
} ...(Read whole news on source site)

PowerShell - Read, Write and Access Registry

AddThis Social Bookmark Button

The registry provider made it easy to work with the registry on a local machine or a remote server to load the registry as a PSDrive and work on it. By default, the Registry provider creates two registry drives HKCU and HKLM. If you want to load other drives, you need to use the New-PSDrive cmdlet to achieve this. This simplifies accessing data in the registry using PowerShell, you can now access the registry as if it were a file system and use the same cmdlets as working with files and directories like Get-Item, Set-Item etc.
We'll make use of
this feature to add/ retrieve values from the registry. I've created some functions to check whether a value exists, get the value and set a value in a registry path, name combination.

FunctionTest-RegistryValue
{
    [CmdletBinding()]
    param
      (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [String]$Path,
       
        [Parameter(Mandatory = $true)]
        [ValidateNotNullOrEmpty()]
        [String]$Name
    )
    if(Test-Path $Path)
    {
        $key= Get-Item -LiteralPath $Path

Java vs C# – Part 1

AddThis Social Bookmark Button
Disclaimer: long post!IntroductionWhile some of my friends and colleagues seem to think that I don’t like Java and that I am some sort of Microsoft/.NET zealot, that is actually not true! I do like Java, and I worked with it for several years.There are several articles out there on the differences and similarities between C# and Java, but none actually satisfied me. In this new series of posts, I will try to explain these similarities and differences, as extensively and accurately as I can. I don’t want to start a religious war, but I won’t refrain
from emitting judgments on what I think is best in each. I will try to cover as much as I can, but I won’t drill into APIs, instead will focus on each language’s intrinsic characteristics.This first post will focus on high-level constructs, what I call structure: namespaces and types. I will be covering Java 8 and C# 4, the latest (as of February 2015) versions of these languages.SimilaritiesBoth languages (Java and C#) are case-sensitive, strictly object oriented, offering classes, enumerations and interfaces, single inheritance model and all of the types live in namespaces/packages. Also, all support attributes/annotations, methods...(Read whole news on source site)

Manipulating HTML Tables – Part 2 (Adding Rows)

AddThis Social Bookmark Button
In my last blog post, I showed how to add a hard-coded row to a table using jQuery and JavaScript. Now, let’s make this a little more dynamic by gathering input from our user and adding that data to our table. The HTML In addition to the table shown in my last blog post, you now are adding three input fields for the user to input the data to add to the table. The user will input a first name, last name and email address (Figure 1) which will then be added to the table. Again, I am using bootstrap, but is
not a requirement. Figure 1: Add rows to a table using user input
 

Add Row to Table

 ...(Read whole news on source site)

Microsoft Band SDK Preview Released

AddThis Social Bookmark Button
The Microsoft Band SDK Preview gives developers access to the sensors available on the Band, the ability to create tiles on the Band and send notifications to these tiles for their applications. Microsoft released it’s first SDK preview for developers. Using the SDK you will now be able to build app for iPhone, Android and Windows Phone integrating Microsoft Band features. To know more about the SDK preview and downloadable links, read more.   Microsoft released Microsoft Band SDK Preview for developers. Now using this SDK, you can create 3rd party applications which can access Microsoft Band specific
sensors, create tiles on the device and send notifications to those tiles. You will now have access to most of the things which you can access and extend the experience of your application in your customers wrist. If you are interested on this, you can download the SDK from the below links and start building your apps targeting iPhone, Android and Windows Phone. DownloadAre you excited to build something new for Microsoft Band? You need the SDK first. Below are the different links available for different platform to grab the SDK and other resources.Microsoft Band SDK Preview for...(Read whole news on source site)

Output Caching in ASP.NET 5 (vNext)

AddThis Social Bookmark Button
          Introduction:                    Yesterday, Visual Studio 2015 CTP 6 has been released which include tooling and new templates for ASP.NET 5 (vNext) beta 3. You can find updates and improvments about ASP.NET 5 in this release at here. In ASP.NET 5 beta 3, the support for output caching has been added. In this article, I will show you how to use output cache in ASP.NET 5.           Description:                       Assuming that you are running Visual Studio 2015 CTP 6 (you can also get that from
Azure VM) or later and you have created an ASP.NET 5 web application. You can add ResponseCacheAttribute(an action filter) on your action or class to make your action method response cacheable. For example,   [ResponseCache(Duration = 100)] public IActionResult Index() { return Content(DateTime.Now.ToString()); }                       The above ResponseCacheAttribute will make the response cache on client-side for...(Read whole news on source site)

Lesser-Known NHibernate Features: Versioning and Optimistic Concurrency

AddThis Social Bookmark Button
NHibernate supports the notion of entity version. An entity version is the value of some entity property that is mapped as versioned. There are several strategies for versioning: A numeric counter; The current (UTC) timestamp; The current database timestamp; The system elapsed ticks (DateTime.Ticks);
A database-specific row version (ROWVERSION in SQL Server, ORA_ROWSCN in Oracle, etc).
We map a version property as this:
color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"> public class VersionedEntity { public int Id { get; protected...(Read whole news on source site)

Home