Fix Internet Explorer prompts to save JSON response when uploading files

When you upload a file using AJAX and then reply using a JSON response, Internet Explorer decides to interpret the response as something to download to disk or open. In essence, it interjects in between the Ajax post response and turns the response into a standard IE file download.

To resolve this I looked at the HTTP headers from two posts made by IE. The first is the post with a file:

POST http://localhost:9999/customer/ HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Content-Type: multipart/form-data; boundary=---------------------------7de3581a151560
.......removed irrelevant lines.......

The response to this looks like this:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
.......removed irrelevant lines.......

{"customerId":1003}

And then the second without a file, using a standard Ajax post:

POST http://localhost:9999/customer/edit/1003 HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/x-www-form-urlencoded
.......removed irrelevant lines.......

With the resulting response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
.......removed irrelevant lines.......

{"Success":true}

In order to fix the problem I needed to change the content type of the response. Internet Explorer isn’t accepting application/json, and that is what ASP.NET MVC is sending back by default. A quick fix is to override the JsonResult in the base controller:

protected new JsonResult Json(object data)
{
 if (this.Request.AcceptTypes == null)
 {
 return base.Json(data);
 }

return this.Request.AcceptTypes
    .Any(x => x.Equals("application/json", StringComparison.OrdinalIgnoreCase)) ?
       base.Json(data) : base.Json(data, "text/plain");
}

We now get text/plain back for browsers (IE) that aren’t ready to accept application/json. Problem solved.

Are iPads bad for young children?

It is hard to find an expert who thinks that monitored and considered tablet use is harmful. Even Richard Graham, the doctor who was reported to have treated the four-year-old patient for iPad addiction, does not think tablets are bad for children. Graham, lead consultant for technology addiction at the Capio Nightingale hospital in London, says that that “case”, so eagerly taken up by the tabloids, comprised a single informal phone call with a parent, in which he gave advice. There was no followup treatment. He doesn’t believe that “addiction” is a suitable word to use of such young children.

The difficulty for parents is that the dangers of tablet use for children – if dangers exist – are as yet unidentified. Research is in its infancy. We know little about what is going on in a child’s head while they are using a tablet. “Really not very much at all at this point,” says Kaufman (his BabyLab plans to publish research in the spring). This is partly because it is hard to measure brain activity in someone who is moving, and partly because metal cannot be taken into an MRI scanner. Until we know more, parents can only follow their own parenting instincts. “There is a school of thought that tablet use is rewiring children’s brains, so to speak, to make it difficult for them to attend to slower-paced information,” says Kaufman. Then he adds: “But every thought we have rewires the brain in some way.”

Tablets are designed to mirror the world we know. They appear to operate intuitively, mimetically, responding to, reflecting and re-presenting the user’s touch. Might the way tablets translate our sense of touch create a particularly intense relationship between user and technology?

Rosie Flewitt, of the Institute of Education at the University of London, has published research on how iPads can support literacy in nursery, early primary and special education. She has just submitted a study, looking at tablet use in the light of recent research into mirror neurons, to an Australian journal for peer approval. As part of her research she observed tablet use in a special school, where the children were writing stories and producing book covers on an iPad. “It was a form of mastery for those individuals that hadn’t previously been accessible to them without a lot of help from other people,” she says. “But beyond that there was something about the activities that captivated all the children intensely and motivated them to carry on. We have been trying to puzzle out why. That sent us on a journey finding out about mirror neurons … It may be that what you see on the screen is partially powerful because of the way mirror neurons work.”

via Are iPads and tablets bad for young children? | Society | The Guardian.

Rhys A.

When you realize youre in a hole, stop digging

At first it may be hard to stop digging, but it is the very first step. Every inch you dig now is another inch you have to climb out.

Don’t give up. Believe in yourself. You can climb out of this hole. And if you give it your all, you will climb out faster than you dug it.

via “When you realize youre in a hole, stop digging,” a Maxim written by Jerzy J. Gangi.

A quick and dirty way to validate new features

Ideas and feature requests are great, but they’re assumptions until you validate them. Validate by running small experiments.

I was able to determine that 20% of users wanted this feature before spending much time on it and was able to create a list of 300 emails of users that wanted to be notified when this feature was released.

By validating with a small experiment you can develop a feature with the confidence that you’re not wasting your time and effort.

via Lean product development: How to validate a feature idea in 5 minutes, by @leemunroe.

Lee has a great way to validate new ideas or features in your app. A little bit of JavaScript with Mixpanel and you’ve got idea validation in a flash.

Revolutionizing measurement with a smartphone-connected laser distance meter

“We build precise, sensitive devices for smartphones,” Eichenwald said. “The product that we’re working on right now is the worlds’ smartest laser distance meter. It’s directed to two big groups right now, so we’ve made one app that’s directed at do-it-yourselfers and consumers (a floor plan app), and for our B2B customers we’re doing a price quote app so that electricians or heating guys for instance can walk into a building, enter the price-per-feet of their systems and quickly generate a quote.”

via Senic Wants To Revolutionize Measurement, Starting With A Smartphone-Connected Laser Distance Meter | TechCrunch.

As someone who works with companies that have a desperate need to quickly size up rooms, Senic appears to be a great step forward in this market space.

http://www.youtube.com/watch?v=hejk4EDz8vA

José Pedro Costa

Your Google location history on a map

Are you worried about the privacy of your location history leaking from your mobile / cell phone or wifi usage. Does it bother you that Google can track where you are and when you were there? Do you want to know what Google has stored about you?

A lesser known feature of Google’s know-everything-about-you is the location history tool. Not only can you filter by date ranges, but it also tracks your total distance traveled.

My location history is switched off. I find it rather intrusive. I also have the feature switched off on my Google Nexus 4, even though it degrades the Google Now feature quite significantly. The NSA ruined this kind of innovative feature if you ask me.

Via: https://maps.google.com/locationhistory/b/0

Photo credit: these birds are watching by José Pedro Costa

Ben Powell is Microsoft .NET developer providing innovative solutions to common business to business integration problems. He has worked on projects for companies such as Dell Computer Corp, Visteon, British Gas, BP Amoco and Aviva Plc. He originates from Wales and now lives in Germany. He finds it odd to speak about himself in the third person.