Friday, October 18, 2013

This version of Visual Studio requires Internet Explorer 10 which is currently not installed on your computer. Please install Internet Explorer 10 and then retry installing Visual Studio

I don’t really understand why VS2013 requires me to install Internet Explorer (no matter the version).

This is not the way to go, unless all the UI is HTML based and they didn’t do it cross browser …

 

Mezer_10-18_13-23-49

Thursday, October 10, 2013

WEBAPI and Attribute Routing (prior to ASP.NET 4.5)

I am using WEBAPI v1 and I had to create few more routes in my API  for user controller (on top the default 4 CRUD)

after added one more method (that gets 1 parameters) and put attribute route for it [POST(“api/Users/WhoAmI”)] I saw that when trying to POST to “..API/Users” I get exception “Multiple actions were found that match the request”

 

My problem was that since I didn’t set static route to the original method (Postuser), than the default WEBAPI method to match an action (System.Web.Http.Controllers.ApiControllerActionSelector –> SelectAction) is called and it iterating on all methods on the controller class finding several methods with one parameter and throws the exception

 

My solution was to set the STATIC route on the original method [POST(“api/Users”)] and this fixed the problem

Friday, October 04, 2013

he data connection uses Windows Authentication and user credentials could not be delegated. The following connections failed to refresh: PowerPivot Data

Started using Sharepoint 2013 after several years which I didn’t touch this product. M$ did an amazing job, and I consider this one of the easier application to integrate with.

One thing that I liked is the office 365 (web version of Office).

When I try to refresh data using the web version I got a nasty error “the data connection uses Windows Authentication and user credentials could not be delegated. The following connections failed to refresh: PowerPivot Data” although my connection was clearly using SQL authentication in the query string

While searching for answer I found this article but sadly it is not related, since as said I am using SQL authentication.

I decided to review the connection and found a new option for “Excel services: Authentication Settings”

Mezer_10-04_08-56-11

And when opening I saw that the default was use the authenticated user account (which I don’t need)

Mezer_10-04_08-56-27

The solution in my case, was to switch to “None” and all is good Smile

Tuesday, October 30, 2012

Entity Framework, Inheritance, eager loading of association

Consider the following three objects:

Person:

string Name

Developer : Person

List<Skill> Skills

Skill:

Name

ID

I thought that in this simple inheritance I would be able to eagerly load the associated Skills of the developers  if any in the list, by doing the following:

var people = (FROM p in Db.people.include((dev as Developer) => dev.Skills) select p).ToList();

Or Maybe just using string based ‘include(“Skills”) ‘

But this simply doesn’t work, in term of no support for such syntax or failure in runtime (not finding skills)

The only method I found to resolve this is to:

var developers = (FROM p in Db.people.OfType<Developer>().include(dev =>dev.Skills) select p).ToList();

var people = (FROM p in Db.people WHERE !(p is Developer) select p).ToList();

var result = people.union(developers);

very ugly since I need to exclude the special entries but working.

 

This case was raised long time ago and was rejected by M$…. here

Thursday, October 18, 2012

Quick Web APP infrastructure called Meteor

Just got an email from a friend about a “new” infrastructure to write web apps quickly called Meteor.

From the screen cast and short examples I have seen this look like a real promising infrastructure that can really grow, while I do have lots of concerns related to security it seems that they did something and provided some mechanism for it – still I am sure lots of work has to be done

One of the things I really liked is that the entire page is actually listening to the server side, even when you deploy a new version it will automatically be update on the client side (magic).

…. wow ….

Tuesday, October 16, 2012

Sending emails–not as easy as you think

I am just doing the last few lines of code for my new site (To be released very soon), part of every site is the ability to send emails to your customers.

I will start with 1 important line – “The communication with your customers is the key for success and as such you need to ensure that you have the right infrastructure”

You might want to use your native SMTP on your ISP/Host, and have write fancy code that will manage delivery, OOO operations, Unsubscribe, Report on delivery, track clicks, bounces and the list can continue

But before you do that remember the first syntax and understand that to write such infrastructure you need deep understanding and tons of line of code and time, which no one has.

Another alternative is to integrate into online infrastructure (using SMTP, Rest api, etc) and get all the above features for small price between 10$ – 80$ for small business depend on usages.

I decided to use SendGrid because it was free for my usages, but there are other companies like MailChimp, etc

 

While writing the small piece of code that just send the messages using SendGrid SMTP, I face few road blocks:

  1. My email went to the SPAM folder
  2. When I finally got the email it was badly formatted without style sheet

You really need to read some articles that talk about how NOT to go to the SPAM folder before you write emails and as for the styling I found out that there are many constrains for HTML in emails

Luckily there is a good site called PreMailer that enables you to convert HTML page or text into a well formed email with inline stylesheet as needed and it will also alert you on risky in your current stylesheet

After all the above the key was to TEST-TEST-And TEST again, which is pretty weird when you think about it, since you see the output but you can never know what will happen

Monday, July 02, 2012

Code works on regular console but fails on StackOverFlow in IIS (0xc00000fd)

I have an entity framework project that simply failed all the time when running under IIS 32bit app while its always working when compiled into a console app.

The first exception is 0xc00000fd - take from the event viewer:

Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc00000fd
Fault offset: 0x0cc902b7
Faulting process id: 0x2038
Faulting application start time: 0x01cd58d87d82114e
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: unknown
Report Id: c3cbfc5a-c4cb-11e1-bbef-001c422bca8f

 

I used ADPLUS and used a preconfigured config file:

<ADPlus Version='2'>
    <Settings>
        <Runmode> Crash </Runmode>
    </Settings>

    <!-- defining and configuring exceptions -->
    <Exceptions>
        <!-- First we redefine all exceptions -->
        <AllExceptions>
            <Actions1>Log</Actions1>
            <Actions2>MiniDump;Log;EventLog</Actions2>
        </AllExceptions>

        <NewException Code="0xe053534f" Name="Unknown_Exception">
            <Actions1>FullDump;Log;EventLog</Actions1>
            <Actions2>FullDump;Log;EventLog</Actions2>
        </NewException>
        <NewException Code="0xc00000fd" Name="Unknown_Exception2">
            <Actions1>FullDump;Log;EventLog</Actions1>
            <Actions2>FullDump;Log;EventLog</Actions2>
        </NewException>       
    </Exceptions>
</ADPlus>

 

This automatically create full dump on the occurrence of the exception

After reviewing the issue in windbg I finally understood that the root cause is because the Stack Size limit in 32bit app pool in iis is 256kb while in regular console its much higher (here)

I am not going to update the default stack size for w3wp using editbin

I will adjust my code to be better suited for “small stack” environment.