Windows 10 SDK update

Next year should be a great year for .NET. One of the prominent features is iOS to Windows bridge that will most likely get released by next year. WinObjc lets you write Windows applications using Objective C and it also allows migration of existing iOS applications over to Windows. Apple has also made Swift open source so you never know it might also end up becoming available on Windows.

https://blogs.windows.com/buildingapps/2015/12/03/whats-new-for-developers-in-the-windows-10-sdk-build-10586-update/?wt.mc_id=DX_47478&MC=IoT&MC=DevOps&MC=MSAzure&MC=IE&MC=JavaScript

Evaluation developer virtual machines can be downloaded here: evaluation developer virtual machines (VM) on Windows Dev Center

No Comments

Integrating Visual Studio with JIRA Software

JIRA Software is a web-based agile project management solution. It offers great support for integrating with various development tools. If you don’t want to use the web interface for managing issues then you can use the plugins and connect to JIRA via development tool. In this post we will see how to integrate Visual Studio with JIRA Software.

1. In Visual Studio access extensions and updates

image

Search for VSJira and install VSJira

Screenshot_2015-12-21__3_37_PM

 

Configure VSJira

Screenshot_2015-12-21__3_40_PM

image

Enter server url, username and password.

image

 

Create a new issue

image

Screenshot_2015-12-21__3_58_PM

…and you are good to go!

, ,

No Comments

JSON support in SQL Server 2016

SQL Server 2016 is around the corner. XML has been supported since SQL Server 2008. In SQL Server 2016 although JSON is not natively available as a data type, but, there are boat-load of functions and keywords that lets you utilize JSON data.

 

Data Type

Data type wise, JSON is represented by NVARCHAR data type. Main reason is people have been storing JSON data for quite some time now and migration will be a lot easier if data types aren’t required to be changed.

 

Querying a relational table and returning result in JSON format

If you want to query some existing table and return result in JSON format then you can use similar syntax that’s used for returning data in XML format.

SELECT col1, col2 FROM table FOR JSON [AUTO | PATH];

If you use AUTO switch, it will use default behavior for returning column names and arrays.

For having more control over names and arrays you can use PATH switch

So, essentially you are converting data to JSON format at database layer rather than at service layer.

 

Querying JSON data and returning result in a relational table format

If you already have JSON string and you want to convert it to a relational table then OPENJSON can be used, just like OPENROWSET can be used for querying a CSV / Excel file.

Let’s assume we have employees variable that contains collection of employees.

Let’s say we have employees data stored in a variable (or some table’s column) like this:

DECLARE @employees nvarchar(100)

SET @employees ={ ‘employees’:[

 {‘EmployeeId’:1,EmployeeName’:’Bob’},

 {‘EmployeeId’:2,EmployeeName’:’Alice’}

]}

 

The following query will let us query JSON data as a relational table:

 

SELECT EmployeeId, EmployeeName

FROM OPENJSON (@employees, ‘$.employees’)

WITH

(

  EmployeeId int,

  EmployeeName varchar(20)

) AS EmployeesArray

 

Other JSON related built-in functions

ISJSON(json_data)

It’s a useful function for validating JSON.

JSON_VALUE(json_data, path)

This function returns a scalar value (some specific column/property’s value) from JSON data.

e.g.

JSON_VALUE(@employees, ‘$[0].EmployeeId’) returns employee id of first record.

JSON_VALUE(@employee, ‘$.employeeId’) returns employee id of the record ASSUMING that @employee is a single record / object and not an array.

Indexing on JSON data

Since there’s no new data type for JSON data, so you can use regular indexes for your JSON based columns.

,

2 Comments

Changes in SharePoint 2016 installation and deployment

SharePoint 2016 is around the corner. There are some installation and deployment changes. You can read up on the details here: http://blogs.technet.com/b/wbaer/archive/2015/05/12/what-s-new-in-sharepoint-server-2016-installation-and-deployment.aspx

, , ,

No Comments

First major Windows 10 Update is now available

First major Windows 10 update is now available. It makes Windows 10 faster and more secure than ever. You can read details here: http://blogs.windows.com/windowsexperience/2015/11/12/first-major-update-for-windows-10-available-today/?OCID=WIP_r_Body_Blog_LatestPC

,

No Comments

How do I reduce CSS/HTML/JavaScript footprint in Visual Studio?

Creating SPAs, AJAX enabled apps definitely speeds up web applications. If you want to take performance to next level then you can reduce the CSS/HTML/JavaScript footprint. The smaller files web browser has to download the faster performance will be. If you are using Visual Studio then you can download VS Web Essentials for free. After installation just go to any web project where you have CSS/HTML/JavaScript files. Here’s a sample project:

image

Right click the files and use Minify File. It will generate minified version of these files, provided there’s no syntax error.

image

Just make sure you reference .min version of js and css files.

Magnification happens on the fly. On day to day basis you will still modify regular .css/.html/.js but you will reference and deploy minified version of these files.

In case if you want to stop minifying a file just right click it and select Remove from bundling… option.

When it comes to web site performance size does matter. Good things come in small packages.

No Comments

How can I speed up Visual Studio 2015 IDE?

After jumping from Visual Studio 2013 to Visual Studio 2015 you might have experienced a big difference in time it takes for the 2015 IDE to open up. If you use DiskMon it will tell you it’s trying to load a bunch of folders / files in various locations. After deleting files from following folders there’s a night and day difference in load times:

C:\Users\<user_profile>\AppData\Local\Microsoft\WebSiteCache

C:\Users\s<user_profile>\AppData\Local\Temp\Temporary ASP.NET Files\vs

C:\Users\<user_profile>\AppData\Local\Temp\Temporary ASP.NET Files\root

 

Also, perform these steps to further speeding up the IDE perform following steps:

1. Tools > Options

2. In Environment > General configure checkboxes as shown in following snapshot

image

No more long coffee breaks while waiting for the IDE to load.

Happy and Fast coding

No Comments

The Simplest Possible Streaming MapReduce Script

With Hadoop Streaming API you can use any scripting language — Perl, Ruby, Python, etc. — as long as they understand STDIN / SDTOUT channels (they all do directly or via an I/O library). The corresponding runtimes of these languages must be present on all data nodes in your cluster to process the input data in parallel.
Read the rest of this entry »

No Comments

Demystifying ViewBag in ASP.NET MVC

In ASP.NET MVC you must have encountered ViewData and ViewBag. ViewData is the older implementation where as ViewBag is newer strict tpe checking based implementation. We can add items to ViewBag dynamically like this:

ViewBag.ProductId = 1;

ViewBag.ProductTitle = "Windows 10";

Even though we haven’t declared these properties before but yet we are able to declare them and assign values dynamically. How does it let us do that? To demystify it we have to understand ‘var’, ‘dynamic’ and ‘ExpandoObject’. So, let’s get started.

var

C# allows us to implicitly declare variables by using ‘var’ keyword. E.g.

int a=0; //explicitly declared variable

var b =0; //implicitly declared variable

We can also use ‘var’ keyword to create anonmous types / objects. E.g.

var bob = new { EmployeeId = 1, EmployeeName = "Bob", Department = "Sales" };

Even though we don’t have an Employee class we are still able to create Employee based objects by using Anonymous Type concept. If you write the above line in Visual Studio and hover mouse over ‘var’ keyword it will tell you that it’s an Anonymous Type. We can pass anonymous types to other. Anonymous objects can be passed to functions as parameters by using dynamic data type. E.g.

dynamic

void DisplayEmployeeDetails(dynamic employee)

{

string message = string.Format("EmployeeId:{0}, EmployeeName:{1}, Department:{2}", employee.EmployeeId, employee.EmployeeName, employee.Department);

}

DisplayEmployeeDetails(bob);

This is a very powerful concept since it lets us create dynamic objects on the fly and we can accept these in any function dynamically.

ExpandoObject

We can take this concept to next level by using another .NET Framework object called ExpandoObject which lets us create properties dynamically. E.g.

dynamic mixedBagObject = new ExpandoObject();

mixedBagObject.PlayerId = 1;

mixedBagObject.PlayerName = "Crosby";

mixedBagObject.CustomerId = 1;

mixedBagObject.CustomerDOB = new DateTime(1,1,1970);

mixedBagObject.ProductId = 1;

mixedBagObject.ProductTitle = "Windows 10";

Even though we have declared any class we are still able to create properties and assign them values on the fly.

So, ViewBag is actually a dynamic ExpandoObject.

No Comments

Must have plugins / utilities for Visual Studio 2015

 

Visual Studio is a great IDE that comes with plenty of productivity  features OOB e.g. code snippets, page inspector etc. In this post I am going to list some must have plugins / utilities that every developer should use to further enhance productivity.

1. Web Essentials for Visual Studio

If you don’t have it already then go and get it right now then read rest of the post. It’s free. http://vswebessentials.com/

It comes with various shortcuts for writing code (C#, JavaScript, CSS …).

 

2. Bundler & Minifier

If you do web development then you must be maintaining several .js / .css files. Bundler & Minifier reduces the footprint of such files which improves performance.

https://visualstudiogallery.msdn.microsoft.com/9ec27da7-e24b-4d56-8064-fd7e88ac1c40

 

3. Web Compiler

If you are using LESS for for writing css files and CoffeeScript for writing JavaScript then you should use web compiler.

https://visualstudiogallery.msdn.microsoft.com/3b329021-cd7a-4a01-86fc-714c2d05bb6c

 

4. Reflector / dotPeek / ILSpy

Useful for reverse engineering .exe and .dll files to look at the source code. It can convert MSIL to C# / VB.NET and other languages. Be careful, if you can look at someone else’s code then they can do the same to yours too. That’s where you should use the next utility…

5. Dotfuscator / Crypto Obfuscator

It obfuscates the code. Think of it as a paper shredder machine. No it doesn’t erase the code but it does make it so confusing that it gives person a bad headache when trying to understand the code.

6. Resharper / CodeRush

I am personally a bigger fan of Resharper. Other folks prefer CodeRush. It’s not free but it’s a must have plugin. It’s useful for refactoring code.

 

7. IDE – Visual Studio 2015 / Visual Studio Code / SharpDevelop

Well IDE is not a tool but you need a tool that comes with IDE. Visual Studio is definitely the best choice. There’s no excuse to not have Visual Studio now especially since there’s a free Community Edition which is more full featured than Express edition. If you want to use it on Mac or Linux then you can go for Visual Studio Code

8. LINQPad

If you like LINQ then LINQPad can be very handy.

 

9. XMLPad

This is to XML what LINQPad is to LINQ

 

10. Linqer

A very nice utility for converting T-SQL to LINQ.

There are several more plugins / utilities but that’s for some other day.

No Comments