free hit counter
September, 2009 - Pietro Brambati Blog - Site Home - MSDN Blogs

Pietro Brambati Blog

Developer's stories

September, 2009

  • Pietro Brambati Blog

    Visual Studio: il documentario

    • 1 Comments

    Interessante documentario sulle origini e sul futuro di Visual Studio su Channel 9, passando tramite Windows, ricordate la versione 1.01 ?

    Nella prima parte si parla di MS-DOS, OS/2, Windows, Microsoft Visual Basic, Visual Basic 2.0, Visual Basic 3.0, Microsoft Visual C++, Visual Interdev, FoxPro, Visual Studio 97, ASP.NET e la community che si creò attorno a Visual Studio.

     

    Get Microsoft Silverlight

    Nella seconda parte si parte da Java, le versioni Express di Visual Studio…

    Get Microsoft Silverlight

    just for Geek :-)

  • Pietro Brambati Blog

    Having fun with Windows 7 Sensor API and XNA Game Studio

    • 6 Comments

    One of the coolest features in Windows 7 are the new Sensor (and Location) APIs. The API are native, but you can use them from .NET Framework if you download the Windows API Code Pack 1.0.

    If you would like to test the Sensor API you can do even without a real hardware sensor, in fact in the Windows 7 SDK you can find (both x86 and x64) a Virtual Light Sensor (you can check from this link how to install the Virtual Light Sensor), a simple app that simulate an Ambient Sensor, that, after installed, you can see from Windows 7 sensor’s panel. In the following image you see the app running.

    image 

    1) Buy a sensor

    But if you would like to test a real-hardware sensor, you can buy this one from Freescale. You can see the front and back side in picture taken from my phone:

    mobile 008 mobile 009

    The Freescale’s board has the following sensors:

    • Ambient light sensor
    • 3D accelerometer
    • Dual touch strips

    2) Update the firmware

    To use it with Windows 7 you have to download the Windows 7 Sensor Development Kit from here and update the firmware first, following the readme file. To update the firmware you have first to mount a driver on your system. Tips: to do that, following the instructions, you have to touch the E4 button BEFORE the led display stop says “Press E4 to enter bootloader.”.

    In the following picture I’ve highlighted the led display and the touch E4 Button.. so press the touch button quickly.

    image

    3) Test the sensor with Windows 7

    If you would like to test the 3 sensor on board you can launch the test application (SensorDevKitDiagnosticApp.exe) in the tools\Diagnostic\Binaries Tool directory of the Win 7 Sensor Development kit:

    image

    Ok , now I’ve tested the sensor, but how to have MORE fun ?

    4) Installing XNA Game Studio 3.0

    On codeplex you can download some classes that you can use to extend one of the starter kit that comes with XNA Game Studio … all  in .NET. Because not all the code is implemented , l’ll show you how to minimally do that to drive the car with the accelerometer, of course just for fun and to show how you can use .NET to interact with Windows 7 Sensor API.

    1. Install Microsoft XNA Game Studio 3.0 (62 MB)
    2. Install Microsoft XNA Racing Game Starter Kit (127 MB)
    3. Download Windows 7 Sensor XNA Racing Game (inside you’ll find two classes and a dll).

    Now you can create a simple racing Game Project from Visual Studio 2008:

    image

    After that you have to follow the instruction on the sample from codeplex

    • add the Windows7.SensorAndLocation.dll that contains the wrapper that expose the native API to the .NET world.
    • copy in the Shaders folder, PreScreenSkyCubeMapping.cs (\RacingGame\Shaders\ PreScreenSkyCubeMapping.cs. This file is used to change the light in the sky based on the sensor input
    • In the GameLogic folder, replace Input.cs (\RacingGame\GameLogic\Input.cs) : this file contains all the code used to get the input from different device: mouse, keyboard and with the accelerometer. You can look the Initialize method that initialize the sensor and expose the acceleration in the X and Y axis, as show in the code:

    image

    The code exposes tree properties:

    image

    The first is used to see if an accelerometer is connected and the other two are used to return the real value from the accelerometer. From my test I’ve seen value from –1 o 1.

    Now you have the value returned from accelerometer but how to use in the gaming app ? You first have to initialize the sensor to make the app aware of it, than we have to control the acceleration, deceleration of the car, the left/right turn.

    • go to Graphics\BaseGame.cs in the end of the BaseGame constructor and call the Input.Initialize() that as show before initialize the Accelerometer3D sensor.
    • go to GameLogic\CarPhysics.cs in the Update method you can control the X Axis, for example, value to make the car turn left and right:

    image

    I’ve tried some experiment to correct the sensibility and you can change the 3.0f value to do it yourself.

    To make the car accelerate and go straight or backward  I added this code in the same method:

    image

    Ok probably if you are a XNA Game developer you’ll find a smarter approach to do that, but ok this is another story :-)

    You can download my sample classes from here.

    5) Have fun with Windows 7 Sensor API !

    Now, you can press F5 and play the game with you sensor!

    mobile 011

    6) More on Sensor API.. 

    If you would like to know more about the sensor and location API in Windows 7 and see the video that inspired me to have some fun: watch here.

  • Pietro Brambati Blog

    Windows Cache Extension 1.0 for PHP - beta

    • 2 Comments

    Il team di IIS ha rilasciato la versione beta di un acceleratore per PHP  Windows Cache Extension 1.0 for PHP.  Questo componente può essere utilizzato su Windows (XP SP3, Windows Server 2003, Vista SP1, Windows 7, Windows Server 2008 e R2) senza bisogno di ricompilare l’applicazione.

    A cosa serve ?

    Questa estensione include 3 tipi di cache che possono essere abilitate in modo indipendente una dall’altra:

    • PHP opcode cache: questa cache usa una memoria condivisa e contiene il bytecode originato dalla compilazione degli script PHP. Può quindi essere riutilizato in richieste successivie per aumentare le performance dell’applicazione che la usa.
    • File cache: questa cache permette di utilizzare memoria condivisa per contenere file di script PHP. In caso ad esempio vengano utilizzati da una share di rete, questo livello di cache consente di avere ulteriori benefici per le performance.
    • Relative file path cache: Quando vengono usati path relativi, l’engine PHP deve convertirli in path assoluti per il loro utilizzo. Questo livello di cache mantiene una cache del mapping relativo-assoluto, riducendo il costo di conversione.

    Installazione

    Potete scaricare l’estensione PHP direttamente dai seguenti link, per PHP 5.2 e PHP 5.3

    Windows Cache Extension 1.0 for PHP 5.2 – Beta

    Windows Cache Extension 1.0 for PHP 5.3 – Beta

    Oppure usando il Web Platform Installer 2.0,  il tool con cui potete installare tutte le componenti per far funzionare PHP in modo performante ed affidabile su Windows con Internet Information Server (IIS):

    clip_image002

    image

    E lanciando un phpinfo():

    image

    Link utili

Page 1 of 1 (3 items)