Software development stuff.

2013-06-29

Starting with Entity Framework

I realise I come late to the party. But I was just playing around at home with some development in MVC4 and wanted to try out entity framework for DB access.
I learned that there are 2 main approaches:

  • Code first
  • Database first
I figured that since I'm just starting and I need to fill control over the data I would go with Database first.
Googling Database First brought me to this 5 mins video that cleared everything up! 

I recommend watching, if you are in a similar situation:


2012-07-27

Visio 2003 Oracle DB reverse engineer, fatal error

I ran into this error while trying to Reverse Engineer an Oracle database with Visio 2003: "Encountered a fatal error during reverse engineer of information from the database!".

I found the solution here and it's as simple as choosing the Visio Driver "Generic OLE DB Provider" initially.

2012-07-19

Link Changesets to Work Items in TFS

Useful information on how to link a changeset to a workitem, after checking in, if for some reason you didn't do it at the check-in time.
See here.

2012-04-10

IE9 scroll jumps to the top when the browser has a scrollbar

Internet Explorer 9 has one very strange behaviour where inner div's with scrollbars can jump up to the top by themselves.

In my case the problem happened when using jquery ui resizable and draggable on DIVs, when using IE9 and the browser has scrollbars (note that the problem only happens when the browser has scroll bars). If the DIV has an inner DIV with height 100% and overflow scroll or auto. When the outer DIV was resized or dragged the scroll of the inner DIV would jump to the top.

After a long investigation (with no google references found at all) I came down to this simple demo of the problem:

I filtered the problem down to changing the absolute position of a div in IE9 with scrollbars on the browser.

The solution: set "position: relative" on the BODY.

<html> <head runat="server"> <title>TEST</title> <script type="text/javascript" src="/Spreadex.Otp.Fins.Web/Scripts/framework/jquery-1.7.2.min.js"></script> </head> <body> <div id="resres" style="width: 1500px; height: 300px; background-color: Red; position: absolute; "> Test Resizable <div style="width: 300px; height: 100%; overflow: scroll" id="testScroll"> AAAAAAAAAAA<br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> BBBBBBBBBB<br /> CCCCCCCC<br /> <br /> </div> </div> <br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /> <button onclick="res1()">res1</button> <button onclick="res2()">res2</button> <script type="text/javascript"> function res2() { //$('#resres').css({ top: 8 }); document.getElementById('resres').style.top = "8px"; } </script> </body> </html>

2012-03-30

Downloading files with Internet Explorer 8 or below, and setting the Cache Control on ASP.NET MVC 3

This one is worth posting since it took some time and lots of googling to figure out.
The web site is ASP.NET MVC3, the browser is IE8 or lower version.

When downloading a file with HTTPS we get the error:
"Internet Explorer cannot download filename from sitename. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."

This is a "feature" on IE: See http://stackoverflow.com/questions/3415370/ie-unable-to-download-from-unable-to-open-this-internet-site-the-request

And the best workaround is to set the "cache-control" header to "private" for these browsers.

The next problem was that setting the cacheability on MVC3 only works if you set it to a value greater than what it is now. So if you set it to NoCache, you can not set it again to Private.
See http://weblogs.asp.net/andrewseven/archive/2005/04/06/SetCacheability.aspx

So, if your website has a generic nocache policy and you want to set a specific request to "private" you need to make sure NoCache is never being set on the same request.

2011-12-06

Google Adwords conversion failing with Ajax

Google adwords conversion script (conversion.js) uses document.write(), which prevents it from working correctly when using dynamic Ajax page loading.
Excelent workaround here:

2011-08-31

Visual Studio Macro: Locate Item in Solution Explorer

This is a great macro that allows you to locate the current file in edition on the Solution Explorer:
Visual Studio Macro: Locate Item in Solution Explorer on Demand « Critical Development: