Sunday, November 13, 2011

Testing an HTML page on your local computer

I wanted to test some HTML code I had just written with Microsoft Visual Web Developper 2010 Express, so I saved the page on my local hard drive and opened it with Internet Explorer 9. But I had a surprise: Internet explorer indicated a warning "Internet Explorer restricted this webpage from running scripts or ActiveX controls." (or on my french speaking version "Internet Explorer a restreint l'execution des scripts ou des controles ActiveX sur cette page Web").



This is somewhat annoying to have to disable this restriction each time the page is loaded.

There is a very simple solution to allow Internet Explorer 9 to accept scripts on a local page: in the "Advanced" tab, check the checkbox "Allow Active Content to be run in files on My Computer" (on in my French Internet Explorer "Autoriser l'exĂ©cution du contenu actif dans les fichiers de mon ordinateur")

Sunday, August 21, 2011

Be careful with your directory seperator when using Slverlight

I have observed something weird with the images in Silverlight:

In Visual studio you may specify the path towards an image using slash ("/") or backslash ("\") as separator: both give the correct result.


But if you run the silverlight application only the picture with the slash in the path does appear: the image whose path contains backslashes remains invisible.


May be the engine within visual studio uses Windows service to retrieve files and that service accepts both "/" and "\" as separators while the browser uses the HTTP conventions where the separator is always "/". Anyway for yor Silverlight developments be sure to always use "/" to avoid any problem.

Tuesday, August 9, 2011

Building my own pocket Calculator

I always wanted to make my own pocket calculator (in the 80's this seemed quite an impossible dream). With the currently available components this has become much easier.

I made it using a PIC 16F877, an 2x16 characters LCD display, and a telephone keyboard.

The schematics is quite straightforward

I used ExpressSCH to draw it.

For the programming I used the classic MPLAB 8.30 from microchip with the C compiler from Hi-tech software. This is a free C compiler that makes something I would think as nearly impossible for a C compiler: support the PIC 16 architecture.

The C compiler saved me from the mess of having to perform floating point operations in assembly language.
But to get the right accuracy, I had to set correctly the floating point size to 32bits

In the first time it did not work at all and I had to search to find why. In the end I found that I had incorrectly set the 16F877 chip options: I had forgotten to disable the "Low Voltage Programming". Since the Low Voltage programming interacts with Port B bit 3 which I use for keyboard this was preventing my software from working

by using:

__CONFIG(WDTDIS & HS & UNPROTECT & LVPDIS);

I did solve the problem.

And now my pocket calculator is ready.