Revista Tecnológica

Posted on 10:40am 12/07/2007 by Bruno Silva in Culture, My Life

Revista Tecnológica

O primeiro número da Revista Tecnológica já está saiu!
Desde quarta-feira (dia 5) nas bancas no Instituto Superior Técnico, e brevemente na Faculdade de Engenharia da Universidade do Porto bem como na Universidade do Algarve.

Trata-se de uma publicação académica de distribuição gratuita.

Este primeiro número contém:

  • uma entrevista com o Professor José Delgado;
  • uma reportagem conduzida pelo colega Microsoft Student Partner Bruno Silva;
  • uma entrevista sobre Empreendedorismo com um dos Directores da empresa Maeil Consultores;
  • uma entrevista com uma developer voluntária no projecto Ubuntu
  • e ainda espaço para divulgação de grupos, organizações e eventos académicos, e espaço para a opinião do leitor.

Podem também conhecer um pequeno trailer do projecto em formato digital disponível em: http://revistatecnologica.wordpress.com/files/2007/12/revista_preview.pdf (5mb)

Esta revista tem o apoio do Núcleo Estudantil de Informática do IST (NEIIST)
Agradecemos também ao patrocinador do primeiro número deste projecto: a Semana Informática (mais conhecida por todos por SINFO)

C-Jump - Never to soon to start programming

Posted on 12:36am 12/07/2007 by Bruno Silva in Curiosities

C-Jump Computer Programming Board Game

I was really amazed when I found this game. Sincerely I have never imagined that there was a board game intended to bring children attention to the programming world. Just forget about Monopoly! Being a geek is fun! :P

In this game rules there are references to If Else and Switch statements and event variables increment. The board is a big block diagram where you move and interpret each instruction in which you fall. Pretty geek, hum?

It is a nice suggestion now that we are so close to Christmas ;)

Messenger Plus! Live and .NET working together

Posted on 8:34pm 11/30/2007 by Bruno Silva in Programming

I and some colleagues are working in a university assignment which involves manipulating Windows Live Messenger messages. Since the official API doesn’t allow us to alter the messages we had to use Messenger Plus! Live. In the other hand the rest of our project was meant to be developed in .NET because we wanted to use web-services and other .NET features that can help us to do a decent project without too much trouble.

I will briefly try to explain to you how you can create a .NET class library and use it in a Messenger Plus! Plugin (which is written in Javascript).

First of all you have to create your class library in Visual Studio 2005.

Visual Studio 2005

Then write down your login into the new Class1.cs file (or Class1.vb, if you prefer programming in that awful language :-P) I have highlighted some elements that you must have. You will notice the declaration of an interface. Honestly, I haven’t tried this code without it, and in the place I learned how to do this they mentioned the need to have it.

using System;

using System.Collections;

using System.Text;

using System.Runtime.InteropServices;

using System.Collections.Generic;

namespace myFirstPlugin{

    public interface PluginInterface{

        string addToLog(string sender,string recipient,string message);

        string getFullLog();

    }

    [ClassInterface(ClassInterfaceType.AutoDual)]

    public class Plugin{

        public class Message{

            string sender;

            string recipient;

            string message;

            public Message(string sender, string recipient, string message){

                this.sender = sender;

                this.recipient = recipient;

                this.message = message;

            }

        }

        private List<Message> _log new List<Message>();

        public string addToLog (string sender, string recipient, string message){

            _log.Add(new Message(sender, recipient, message));

            return sender + recipient + message;

        }

        public string getFullLog(){

            string log = “”;

            foreach (Message msg in _log)

                                  log += msg.sender + “>” + msg.recipient + “: “ + msg.message + “\r\n”;

                            return log;

        }

    }

}

All the extra code will be used to create an ActiveX control, which can be used in Javascript code in a HTML page or in this case in a Messenger Plus! plugin.

You can compile your class just to make sure it is ok, but to use it in your plugin the easy way is to compile it from Visual Studi 2005 Command Prompt. Run it with administrator privileges.

 

Visual Studio 2005 Command Prompt

Change to your Class Library Project directory. You will have to create a Key.

> sn -k sgKey.snk 

Compile your class signing your Assembly with a Strong Name. This way you will avoid some security warnings when you register your Assembly and use your ActiveX control.

> csc /t:library Plugin.cs /keyfile:sgkey.snk

This next step must be done in every computer where you install your plugin. In VS Command Prompt the executable is in PATH. In other computers, you can find it in \Windows\Microsoft.NET\Framework\v2.0.XXXXX\.

> regasm Plugin.dll /tlb:PluginNet.dll /codebase

(after this command you won’t be able to delete Plugin.dll. You must unregister the Assembly using: regasm /unregister Plugin.dll)

Ok. The .Net part is done! Now let’s do some Javascript.

When you reach this step you must install Messenger Plus! Live. Then create a new plugin like shown in the picture.

Messenger Plus! Live

In the script window you can create an object of your class and use it as you want! In the middle of the code I have some comments that can help you to understand myFirstPlugin.

var myPlugin; //store object during chat session

var lastSent; //just a trick to prevent an outbound message from being seen as an inbound message. Kind of a Messenger Plus! bug…

function OnEvent_ChatWndCreated(ChatWnd){

    //new chat window -> new plugin object

    myPlugin= new ActiveXObject(“MyFirstPlugin.Plugin”);

}

function OnEvent_ChatWndDestroyed(ChatWnd){

    //in the end print out the log

    Debug.Trace(myPlugin.getFullLog());

}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){

    //messageKind == 1 is a user message. Other values means nudges, winks, etc.

    if(MessageKind==1 && lastSent!=Message){

        //get your buddy e-mail. Assumes that you’re not in a group chat

        var e = new Enumerator(ChatWnd.Contacts);

        var email;

        for(; !e.atEnd(); e.moveNext()) {

            var Contact = e.item();

            email= Contact.Email;

        }

        //log you message into the plugin

        myPlugin.addToLog(Messenger.MyEmail,email,Message);

        return Message;

    }else{

        lastSent=“”;

        return Message;

    }

}

//Same stuff as above

function OnEvent_ChatWndSendMessage(ChatWnd,Message){

    var e = new Enumerator(ChatWnd.Contacts);

    var email;

    for(; !e.atEnd(); e.moveNext()) {

        var Contact = e.item();

        email= Contact.Email;

    }

    myPlugin.addToLog(email,Messenger.MyEmail,Message);

    lastSent=Message;

    return Message;

}

In the end enable your plugin and pray that it works :)

Silverlight 2.0

Posted on 8:20pm 11/29/2007 by Bruno Silva in Microsoft, Programming, Silverlight

Dado o vasto conjunto de novas funcionalidades ao até agora chamado Silverlight 1.1, ainda em Alpha Stage, a Microsoft decidiu que não fazia sentido chamar versão 1.1 a um produto completamente diferente da versão 1.0. Portanto o que até agora era chamado Silverlight 1.1 passará a ser referido como Silverlight 2.0. A grande diferença nesta versão é que ao invés de Javascript é utilizado .NET como base para a programação do comportamento das aplicações.

Algumas funcionalidades referidas foram

WPF UI Framework: O Silverlight vai comportar uma maior fatia dos componentes do WPF. Vai também permitir databinding, e incluir suporte para templates e skinning.

Rich Controls: Como seria de esperar vão estar disponíveis mais controlos para simplificar a contrução das aplicações. Neste momento basicamente temos caixas de texto e reprodutores de multimédia. Esperam-se controlos como Datagrids, ProgressBar, TabControl, Checkbox, Radiobutton, etc.

Rich Networking Support: Suporte para comunicações em REST, POX, RSS, e WebServices. Vai ser também permitido o “Cross domain network access”. Ou seja, uma aplicação Silverlight pode beber recursos em domínios que não sejam o local.

Rich Base Class Library Support: Collections, IO, generics, threading, globalization, XML, local storage, etc. Como já se sabia o LINQ será suportado.

MSN SOM SISTEMA - Música com andamento

Posted on 9:25am 11/27/2007 by Bruno Silva in Events, Microsoft

MSN Som Sistema MSN Som Sistema

Como forma de divulgação do novo portal MSN em Português, em parceria com a Mega FM e a Sic Radical, a Microsoft está a promover um evento amanhã. Evento… ok não sei se é a melhor designação. Basicamente vão haver 3 autocarros pelas ruas de Lisboa com música ao vivo no seu interior. Vão ser oferecidos vários prémios. Vejam detalhes no site da Mega FM (http://www.mega.fm/LdestaqueSel.asp?id=1257).

© Bruno Silva | Powered by Wordpress