Monday, September 21, 2015

Unable to add WCF Service to MVC web application

Yesterday I can across a issue where i wasn't able to add the WCF service in solution to the WEB application in the same  solution. I searched and snooped for a day couldn't find the problem as i didnt see any error message of any sort, even tried adding to a console application that worked but still no success with the web app.
A day later i checked the error list and saw some error showing unable to generate the service reference codes.

Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Could not load file or assembly 'Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='ICoreService'] WebRole\Service References\ServiceReference1\Reference.svcmap 1 1 WebRole

I googled it and found a very simple answer.
Check this link to know about the solution

Here when you  add the service click the Advanced... button in the bottom left corner of the Add Service Reference window. On the Service Reference Settings screen that appears, in the Data Type section, under the Reuse Types in referenced assemblies: check-box, select the Reuse types in specified reference assemblies radio button then check ONLY the assemblies that contain types used by the service. Here try avoiding the OWIN related assemblies and check all others if you are not sure what all to add.

Monday, September 14, 2015

D3 js join / update not working as expected

If there are rendering issues with the update pattern i.e regarding the location of the new items in the data array then try out this pattern.

var text = svg.selectAll("text").data([]);

text.exit().remove();

text = text.data(data);

text.enter().append("text")
.attr("class", "enter")
.attr("x", function(d, i) { return i * 32; })
.attr("dy", ".35em");.

text.text(function(d) { return d; });

Here i have initially passed a empty array to remove all the point and then add the new one, i have faced some issues while we pass very little data may be array of length One to update the text. Where in my case i had an nested array with data that was being passed.
eg: [ [N,1,20], [N,1,25]]  Here 20,25 denotes the data part. The update array was also of same length with data slightly different as [ [N,1,29], [N,1,22]]

Thursday, September 10, 2015

D3 js the join pattern some intro.

This article is for some one who is trying get the update patter work in d3 js. I tried out the link http://bl.ocks.org/mbostock/3808218 which show some basic update patter. The same code works, but unfortunately when implementing similar case the result wasn't the same, After looking in to the code i realized that certain type of manipulation on d3 might not work as expected.

My initial code was something like this.

var text = svg.selectAll("text").data(data);
text.enter().append("text")
.attr("class", "enter")
.attr("x", function(d, i) { return i * 32; })
.attr("dy", ".35em")
.text(function(d) { return d; });

text.exit().remove();

Notice in the above code i have combined the setters for attributes and the final text assigning in the same line. This code doen't seem to work for some reason. So i change back to the orignal set.

var text = svg.selectAll("text").data(data);
text.enter().append("text")
.attr("class", "enter")
.attr("x", function(d, i) { return i * 32; })
.attr("dy", ".35em");

text.text(function(d) { return d; });

text.exit().remove();

And now it works. So if you are working with some similar scenarios try grouping different set of operation if the Update patter doesn't work for you.

Wednesday, September 2, 2015

D3 dashboards some useful links

Some useful links for dashboards using HTML5 and D3 js,
http://codepen.io/stefanjudis/pen/jawGn
http://codepen.io/stefanjudis/pen/gkHwJ

Source : google.com

For those who have murdered the code and live with it.

This blog is dedicated to those who thinks they are coders and to those who have murdered their code and are living with it.

Let us introduce our self's, we are bunch of hope to be coders, of which some are good though, that have done incredible bad thing to get our ass saved at the last moment. In due process have done some incredibly bad code snippets to keep everything up and running, fingers crossed.

Here in our blog we shall introduce to some code that we have done in past that we are not ashamed of to those who are willing to use it with out any warranties.