Sunday, August 26, 2012

How to change the graphical resolution supported by Virtualbox

Oracle's virtual machine Virtualbox is a great way to experiment with the new Windows8 but by default the video driver of virtualbox 4.1.20 offers only the following resolutions:
  • 1600x1200
  • 1280x1024
  • 1152x864
  • 1024x768
There is however a trick to enable other resolutions by using the command.

VBoxManage.exe

I wanted to have access to my screen native resolution (1920x1080) as well as the minimum screen resolution used by Windows8 (1366x768)

By using the following commands I was able to add those 2 resolutions

> VBoxManage.exe setextradata "WIN8RTM"  CustomVideoMode1 1920x1080x32
> VBoxManage.exe setextradata "WIN8RTM"  CustomVideoMode2 1366x768x32 

Where WIN8RTM is the name of my virtual machine

NOTE:
  1. The 32 is the color depth (32 = a color depth of 32 bits i.e. 16.7millions of colors)
  2. You must restart the virtual machine to take those settings into account (rebooting the virtual machine is not enough)
  3. Don't overlook the quotes around the virtual machine name! (I lost half an hour searching what was wrong because I had forgotten the quotes

Once the setting is done you can check if it is correct by using the command

> VBoxManage.exe getextradata "WIN8RTM" enumerate              

which produces the following result

Key: CustomVideoMode1, Value: 1920x1080x32                     
Key: CustomVideoMode2, Value: 1366x768x32                      
Key: GUI/Fullscreen, Value: on                                 
Key: GUI/LastCloseAction, Value: powerOff                      
Key: GUI/LastGuestSizeHint, Value: 1024,768                    
Key: GUI/LastNormalWindowPosition, Value: 640,218,1024,819,max 
Key: GUI/MiniToolBarAlignment, Value: bottom                   
Key: GUI/MiniToolBarAutoHide, Value: off                       
Key: GUI/SaveMountedAtRuntime, Value: yes                      
Key: GUI/ShowMiniToolBar, Value: yes                           
Key: GUI/VirtualScreenToHostScreen0, Value: 1                  
                                                                                                                              

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.