Posted on 9:43am 12/28/2007 by Bruno Silva in
Funny

Encontrei este site enquanto navegava sem destino na web. Uma bela caricatura do que o pessoal do marketing faz: promover produtos ou serviços (e é verdade que algumas vezes são QUASE nada).
Este site é todo sobre um software de 4Kb que não faz nada. É só um ficheiro vazio
Dá para rir um bocado.

In the last few days I’ve been working with theVirtual Earth API in my spare time. I made a demo application of Virtual Earth. In this demo I used a Windows Forms application to wrap a Virtual Earth (VE) map (which is loaded in a HTML page into a WebBrowser control).
In that HTML page I added some Javascript functions that wrap the VE API in some functions which I call via the WebBrowser control. This way I can manipulate the map in Windows Forms. I’ve added support to my XBox 360 GamePad Component. You can use your game pad to pan and zoom in/out in the 2D map. You can also switch between map styles (road,aerial, hybrid, bird’s eye). This is still a developer’s toy, since you need XNA Game Studio 2.0 installed to be able to run this application. Oh, and you also need .NET Framework 3.0.
I was surprised when I found out that the beta 3D view in VE natively supports the XBox 360 controller.
The least but the last feature I added was support for Microsoft Speech. I added a welcome message, and if you say the name of a country (in English) the map moves into that country (or to be more specific, to the country name that the application understood…). I’ve achieved this by loading a XML file, which I found over the web, that contains the name of many countries (not sure if contains them all). After loading this file the code is pretty similar to my previous post about Microsoft Speech.
That’s all! I’ll be pleased to answer some doubts and hear suggestions about this demo.

I’ve been wanting to try out System.Speech namespace (present in 3.0 and 3.5 .NET Framework) but unfortunately until this weekend I was stuck with a Portuguese version of Windows Vista which prevented me from using Speech features.
Today I finally tried it out and I was stunned! It couldn’t be simpler (at least for a simple example
). I’ll explain in a few lines of code how to use two main features: Speech Synthesis and Speech Recognition.
Speech Synthesis
using System.Speech.Synthesis;
To make your computer to say something is as simple as 2 lines of code can be:
synthesizer = new SpeechSynthesizer();
synthesizer.Speak("Hello World");
This piece of code has one disadvantage: it locks your program until “Hello World” is said. You can achieve the same goal without this problem by using a asynchronous approach.
// Shut up any speaking going on
if (synthesizer.State == SynthesizerState.Speaking)
synthesizer.SpeakAsyncCancel(
synthesizer.GetCurrentlySpokenPrompt());
// Say text (Async to prevent blocking)
if (synthesizer.State == SynthesizerState.Ready)
synthesizer.SpeakAsync("Hello World");
Speech Recognition
using System.Speech.Recognition;
Speech recognition requires a setup with more code, but as simples as synthesis.
sre = new SpeechRecognitionEngine();
/// Recognize from default Microphone
sre.SetInputToDefaultAudioDevice();
/// Grammar with the words you want to recognize
GrammarBuilder grammarBuilder = new GrammarBuilder();
grammarBuilder.Append(
new Choices("start", "stop", "pause", "restart", "go back"));
Grammar customGrammar = new Grammar(grammarBuilder);
sre.UnloadAllGrammars();
sre.LoadGrammar(customGrammar);
/// Handler to be run in each recognition
sre.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>
(sre_SpeechRecognized);
/// Do not stop recognizing
sre.RecognizeAsync(RecognizeMode.Multiple);
You have to program a handler which will be used to handle the recognized text in the way that most pleases you.
void sre_SpeechRecognized(object sender,
SpeechRecognizedEventArgs e){
/// Store recognized text
txbDebug.Text += e.Result.Text + "\r\n";
}
You can download my first Speech application to see it working 

This Christmas a friend gave me a Xbox wired controller. I don’t have a Xbox 360, but I wanted to try XNA development and use the controller to develop some different user-interfaces on windows-based applications. This weekend I managed to put the first pieces to work
Based on XNA framework which has support for Xbox 360 controller I built an component that you can drag and drop into your windows forms application. You can assign each control instance to a different controller (up to 4) and set the interval between hardware changes checking (the default is 100 miliseconds). This component raises events when the controller status changes. It has a general onChange event, and an event for each button, trigger and stick status change. It has also a method to control the controller vibration.
This component is not a big deal. When it is instantiated, the component creates a new thread which waits for a period of time before returning into the main thread. When it returns it checks for controller changes using the Microsoft.Xna.Framework.Input.GamePad class. This check is made by comparing the current GamePadState with the previous one. For each change it is raised an event to which you can subscribe in your windows application. I tried to use it in a WPF application. It worked, but I had to create the component in code. It didn’t appear in the toolbox.
You can download the component source code and an example here. I added some comments into the code, but I think that it is pretty simple to understand even to people with little experience with C#. Any question/suggestion feel free to comment!
I’ve tried it in a virtual machine in order to find out the software requirements. I had to install XNA Game Studio 2.0 to put it to work… The XNA redistributable wasn’t enough. If someone can tell me how to distribute my examples with minimum software requirements I’ll be glad to hear from you
This is also a great change for you to try Visual Studio 2008, since the solution in the zip package has to be opened in VS2008. If you don’t have access to this software, or you’re having trouble migrating the code into a VS2005 environment just tell me, and I will help you out.
As soon as I develop some applications using Xbox controller I’ll publish them here in my blog.

MS Press has just released an e-book on Visual Studio 2008 technologies and are giving it away for free. The e-book includes excerpts from three recent book releases and provides a wealth of information and insights from top experts:
You can see the first chapter of these books for free. When you register, you’ll be able to download a lot more content of those books, packaged as an e-book.
Posted on 11:42am 12/19/2007 by Bruno Silva in
Funny

In this website you can see different perspectives over a software project in a cartoon. It shows a tree (representing the project) in different point of views such as customer, developer, software tester, marketing team. Well, just take a look at it. It’s delicious. You can even build your cartoon to show the world how you feel about the projects you’re working in.
http://www.projectcartoon.com