Roel van Lisdonk on June 19th, 2013

The demo at http://demos.kendoui.com/web/grid/editing-custom.html shows how to create a custom editor function. We can use this function to show a password field as editor in a Kendo grid.

function passwordEditor(container, options)
{
    $('<input type="password" required data-bind="value:' + options.field + '"/>').appendTo(container);
};

In the column that should be used as password, use:

$("#grid").kendoGrid({
    dataSource: dataSource,
    pageable: true,
    height: 430,
    toolbar: ["create"],
    columns: [
        { field: "ProductName", title: "Product Name" },
        { field: "Category", title: "Category", width: "160px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },
        { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "120px" },
        { field: "UserPassword", title: "Password", editor: passwordEditor, template: "#=UserPassword#" },
        { command: "destroy", title: " ", width: "90px" }],
    editable: true
});

An example would be:

 

image

Tags:

Roel van Lisdonk on June 18th, 2013

If you want to add a class to a kendo grid column, use the columns.attributes:

 

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [ {
    field: "name",
    title: "Name",
    attributes: {
      "class": "table-cell",
      style: "text-align: right; font-size: 14px"
    }
  } ],
  dataSource: [ { name: "Jane Doe" }, { name: "John Doe" }]
});
</script>

 

http://docs.kendoui.com/api/web/grid

Tags: ,

If you want to create deployment zip packages for any Microsoft Visual Studio project type (like, Web Site, Web Service, Windows Service, Console Application etc. then just follow the steps below:

 

In this example I will be zipping all content files and *.dll files found in the "bin" folder of an ASP .NET MVC 4 Web Application, but the same will work for other project types. This example will be using the MSBuild Community Zip Task and at this point will work for  .NET projects <= 4.5.

 

Create a new ASP .NET MVC 4 Web Application

In Microsoft Visual Studio 2012, choose:

File > New > Project…

image

Choose Internet Application

image

 

Add the nuget package"MSBuild Community Tasks"

Click click the solution in the Solution Explorer and choose "Manage NuGet Packages for Solution…"

image

Choose MSBuildTasks

image

 

 

Edit MSBuild.Community.Tasks.targets

Edit the MSBuild.Community.Tasks.targets file, so it will use the MSBuild.Community.Tasks.dll found in the .build folder created by the NuGet package.

image

 

Change:

<MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>

To

<MSBuildCommunityTasksLib>MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>

Result

image

 

 

Edit the *.csproj file

Unload project (right click project > Unload Project)

image

 

Edit *.csproj file

image

Scroll to the bottom of the file and

change:

<!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target> -->

 

To:

  <!-- Start Zip target -->
  <ItemGroup>
    <!-- 
      Add all *.dll files found in the root of the "bin" folder as content files.
      - Add as content files so the @(Content) will include all content files and all output files. 
      - The ".\" before the "bin" folder name in the Include, results in a zip package containing the bin folder.
      - If you do not want to include the "bin" folder itself but only the files, use "bin\*.dll".
      - If you want to include subfolders use ".\bin\**\*.dll"
    -->
    <Content Include=".\bin\*.dll" />
  </ItemGroup>
  <!-- 
    A relative path will start from the *.csproj file location, 
    so to get to the MSBuild.Community.Tasks.Targets file, we must add "..\.build\".
  -->
  <Import Project="..\.build\MSBuild.Community.Tasks.Targets" />
  <!-- 
    The afterbuild target will only be executed, when the project is build in "Release" mode.
  -->
  <Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
    <PropertyGroup>
      <ReleasePath>bin</ReleasePath>
    </PropertyGroup>
    <Zip Files="@(Content)" WorkingDirectory="$(ReleasePath)" ZipFileName="output\$(AssemblyName).zip" ZipLevel="9" />
  </Target>
  <!-- End Zip target -->

 

Reload project

image

 

Build project project in "Release" configuration

image

 

An output folder should be created containing the MVC1Application.zip.

image

 

Zip file:

image

Extracted

image

Tags:

In my case the error "Unable to open Transact-SQL file in custom editor", was caused by the fact, that I installed BIDS voor Microsoft Visual Studio 2012, but not the SSDT tools.

After installing the SSDT tools, the error was resolved: http://msdn.microsoft.com/en-us/data/hh297027. This Microsoft download sites, works best on Internet Explorer. I had some problems with Chrome.

 

 

clip_image002

Tags: ,

If you want to create a zip file in C# with the OOB BCL, in C# you can use the following code:

 

public void CreateZipFile()
{
    string zipPath = @"C:\Test.zip";
    string entryName = "Readme.txt";
    string content = "Hello world!";
    using (var zipToOpen = new System.IO.FileStream(zipPath, System.IO.FileMode.CreateNew))
    {
        using (var archive = new System.IO.Compression.ZipArchive(zipToOpen, System.IO.Compression.ZipArchiveMode.Create))
        {
            System.IO.Compression.ZipArchiveEntry readmeEntry = archive.CreateEntry(entryName);
            using (var writer = new System.IO.StreamWriter(readmeEntry.Open()))
            {
                writer.Write(content);
            }
        }
    }
}

Tags:

 

To always run Microsoft Visual Studio 2012 as an Administrator on Windows 8

  • In Windows 8, you have to right-click C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

image

  • Select "Troubleshoot compatibility".

image

  • select "Troubleshoot program"
  • check "The program requires additional permissions"
  • click "Next", click "Test the program…"
  • wait for the program to launch
  • click "Next"
  • select "Yes, save these settings for this program"
  • click "Close"

Tags:

Roel van Lisdonk on June 11th, 2013

A very nice post for all Microsoft Visual Studio 2012 / TFS users, that want to get started with GitHub:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=879

Tags: ,

Microsoft SQL Server up until version 2012, is build on the presumption that the data will be stored on hard disks and the price of this storage is high not even considering the price of memory, so trade offs are made to make SQL Server 2012 run on this kind of hardware, but what if we forget this and look at modern hardware, with SSD’s, "cheap" storage and memory, how would SQL Server then be build….? Meet Microsoft SQL Server Hekaton:

 

Some of the key features that I found interesting:

MVCC = multiversion concurrency control

Readers don’t block writers, because of multiple version of data will be stored, but only one will be the last.

 

In-memory

Just by changing a property on a table, you can transform this data structure to an in-memory data structure, without the need of changing any of your existing code.

 

Optimized for SSD (Bw-tree)

"We had an ‘aha’ moment," Lomet recalls, "when we realized that a single table that maps page identifiers to page locations would enable both latch-free page updating and log-structured page storage on flash memory. The other highlight, of course, was when we got back performance results that were stunningly good."

 

More info at

http://research.microsoft.com/en-us/news/features/hekaton-122012.aspx

Tags:

If you want to use the PhoneGap Build service, you must remove the phonegap.js (cordova.js) from your source files, because PhoneGap requires a different phonegap.js JavaScript file for each platform and using an incompatible phonegap.js will result in errors when running your application.

 

For this I use the .gitignore file (https://help.github.com/articles/ignoring-files), so the phonegap.js is never pushed to the GitHub repository, but it can be used during development on the localmachine.

Tags:

  • Open a xml file in Microsoft Visual Studio 2012.
  • Press F4 (properties windows will open)

image

  • Click on Schemas

image

  • Browse to the xsd you want to use
  • After clicking OK, the xml file will show errors:

image

  • IntelliSense can be used to correct the errors.

image

 

Correct result

image

Tags: ,