Mar 10, 2009

Automating Skype through COM

Wow.. finally a technical post again :)

Those of you who knows me knows that I am a firm believer of component technologies.

Personally I really appreciate Microsoft's COM technology; ok, it does has it drawbacks (as everything in life) but when used correctly it proved to be a very powerful way to support software automation and extensibility. Let me briefly explain what those funny words means for those who don't know yet.

Basically, software automation is the process of a software controlling another one. For instance, if you have Microsoft Office installed it's possible to write a program (even a JavaScript script) that creates a Word Document through automation, i.e, your program may "control" word (and Excel, Power Point, etc). This kind of flexibility can be very helpful in some scenarios.

By extensibility I mean ways of extending a given application. A good example is Windows Explorer; it's possible to add new items to a context menu (in the same way 7-Zip and many other applications do) simply by implementing an specific COM interface (and registering your component of course).

These are just 2 examples of what's possible; of course other softwares also support some level of automation (for instance Adobe Acrobat).

In this post I just want to talk (again, briefly) about Skype and how it's possible to extend it through COM (Skype also supports automation through Java, XXX, etc).

First let me just explain that the possibilities are infinite; what you may want to do with automation is not my business :); all I can say is that if you think a little bit you'll be able to find some nice use for skype automation.

For instance (as I said in my last posts) I use Skype heavily on my work to communicate with other team's members. At least once per week we do a Skype meeting in order to decide what we're going to do in that week; to manage these tasks we have a "queue" of tasks in our Jira installation.

One annoyance during this meeting is that once someone decide he wants to take a specific task the process involves at least 2 steps: to announce in the chat meeting and going to the browser to update Jira.

Since it's possible to automate Skype I wrote (to be more precise I am debugging it right now) a "plug-in" that simply keeps listening all chat messages and react accordingly for specific patterns; for instance if I want to take a task (let's say TSK-1) I may just type:

$jira assign TSK-1 myself

This way I announce to the team and update Jira at once :) (I don't need to go to the browser anymore)

The plugin is "smart" enough (through configuration) to figure out who I am ("myself") and to go to Jira (through a WebService) and update the specific issue (task).

And this is only a basic example about what can be done (the sky is the limit :).

For more information about Skype automation visit
https://developer.skype.com/.

If you want to take a look into this plugin, just grab the code at: git@github.com:adrianoc/binboo.git or browse the code online at https://github.com/adrianoc/binboo (just keep in mind that there're lots of assumptions/dependencies to our Jira installation but I guess one can learn a lot about how to integrate to either Jira or Skype). 


See you.

Adriano

Jan 21, 2009

WIX Tips

Hi.

Since I have been playing a lot with MSI installers latelly and I'd like to share two tips with those authoring Windows Installers with WIX:
  • You can get a lot of information by running your installation package through msiexec:

    msiexec /i CustomAction.msi /lvx log.txt

    The command above just runs CustomAction.msi logging everything including the kitchen sink :)

  • You can use 7Zip to open msi files (and ofcourse, extract content from it)
Happing programming ;)

Adriano 

Jan 7, 2009

First impressions of Windows 7

Hi,

As a computer addicted I decided to download Windows 7 Beta 1 (32 bits) and give it a try (if you are interested, just search for "Windows 7 Beta1" in your favorite search engine and I am sure you'll find your way :)

In this post I want to present my first impressions about it. Please, note that I am not an expert in this subject and also that this is just my opinion based on my perception without any pretension regarding "data" accuracy.



I need to admit that I am impressed about it. My first impression is that it is way faster than Vista when running on the same machine; at least it is pretty responsive. Bellow you can find a list of items that caught  my attention and won my respect (at least for now):



  • Fast Installation: ~ 20 min for a full install.

  • Few prompts during installation.

  • No problems with device drivers at all (Video, audio, keyboard, etc)
    • Some devices already have preliminary versions for Windows 7
      I guess that this is more a result of not introducing deeper changes to the driver model (Vista introduced really deep changes there).

  • There are some compatible antivirus already.

  • Looks really fast on a relatively old hardware

  • I really liked the UI changes (even being minor changes).
     
  • Just a few UAC prompts
    • Using it for some time I have seem UAC prompts only for software installation.

  • IE 8 is not as fast as I'd like it to be. (But I've already installed firefox)
 Bellow you can see a screen shot.


Well, that's it for now.


Adriano

Storing PowerShell objects into a Db4o database

Hi,
First of all, Happy New Year :)
If you use both PowerShell and Db4o you maybe interested in this post.
Best
Adriano

Nov 21, 2008

Benefits of working from home - Part IX- Infrastructure

In this post I described how using my computer in my home office was the first time that I'm getting a direct return on my investment.

In this post I'll take a look in the other side of the coin: the investment in infrastructure.

When my home computer used to be only that, i.e, my home computer, I had no hard requirements to keep it up to date. I could simply update it each 5 years or more if I wanted to; also, my internet connection need not to be very fast; the same applies for my desk; it could be very ordinary as I didn't spent a lot of time in my computer.

Of course, being a computer/programmer addicted as I am, shortened my computer's update cycle for something between 2 ~ 3 years, and 


internet connection, you know: you never get enough bandwidth ;)

By the other hand, using my computer to work pushes it to its limits... and of course, each minute I spend looking at the hour glass represents a minute less with my family (or my Wii :) so I want to wait the lesser amount of time possible in front of it.

Just to put some numbers, the first time I run db4o build on my machine it took more or less 1 hour to run to completion (mostly running tests). I just couldn't believe that. My machine was not a top one but it was not so old/slow either. After a lot of tweaking I managed to get the build running in 15 minutes but that required some $$$ (nowadays, even with a new machine tests take 20 ~ 25 minutes to run due to lots of new tests).

Also, I never considered (or had the requirement to) run 2 VMs, 2 Visual Studio (one in one VM and another in the host OS), Eclipse and some other apps at the same time. So now, 2Gb of memory doesn't look that much anymore.

Another important aspect that will have great impact on your productivity/health is the
overall quality of your office furniture: remember when you used to complain about your boss not willing to spend a few extra dollars on a good chair for you? I certainly remember myself complaining with mine :( Of course you don't need to go out and get the best chair in the world, but make sure you'll not get a "not so good" one only to save a few extra bucks either (If you are going to spend more than 4 hours seated I do recommend you to get a very good one - for instance, this one).

Well, that's not the end yet; telecommuting meant also that I became my own IT department ;). Not that I have any problem fixing my computer, installing software or whatsoever; the really big point is that all these maintenance work takes time (and time is money) and also that the burden to keep everything working is on me (to be fair, I'd rather be the one in charge for this task than to let someone else doing it
anyway).

Last, but not least, consider having "hardware" backup; I mean, what are you going to do if next morning when you turn your computer on it don't actually turns on? Of course you do have backups of your important data (don't you?), but what about your hardware? How long it will take to be fixed? Are you willing to spend time on fixing it? Or do you have another computer that can be used so you can continue to work while someone else fixes it for you.

In the end of the day, you'll need to put some money on your office / infrastructure, so don't forget to take this into account.

That's it.

Bear with me ! We are approaching the end :)

See you

Adriano

Nov 17, 2008

Changes in Db4o configuration.....

Hi,

If you take a look in our svn repository you'll see that lots of changes were applied to configuration code (starting with version 7.7). Take it easy, we kept the "old" configuration interface in place; we just deprecated it, so update your code to use the new interfaces if you have the chance ;)

In this post I'd like to discuss some of these changes.

New, specific, factory classes


Do you remember Db4oFactory OpenFile(), OpenServer() and OpenClient() methods? We decided to move them to more specific factory classes:
  • Db4oClientServer
  • Db4oEmbedded
This way the boilerplate code used to open an embedded database changed from:

IObjectContainer db = Db4oFactory.OpenFile("MyData.odb");

to:

IObjectContainer db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), "MyData.odb");

As an additional benefit now we use the same class in both platforms (Java/.Net) (Remember, we used to have Db4o.openXXXX() for Java and  Db4oFactory.OpenXXX()for .Net).


Configuration interface split in File / Network / Common

We are applying Interface Segregation principle to configuration, so, now related configuration options are close together in specific interfaces.

For instance, all embedded related configuration lives in IEmbeddedConfiguration. But we didn't stopped there. We went a step further and broke common functionality in more coarse grained interfaces. For instance, there are configurations that do apply to both embedded and client server modes. So we introduced the concept of Configuration Providers which sole purpose is to help to aggregate configuration into specific interfaces, so it's easier (at least in our opinion :) to identify which configuration applies to each db4o mode and also make it more clear which aspect of db4o are being affected by that configuration.For instance:

IEmbeddedConfig config = Db4oEnbedded.NewConfiguration();
config.File.ReadOnly = true;

In this sample there's no space for doubts that ReadOnly configuration relates to a file system aspect of an embedded database.

That said, we basically partitioned configuration into four categories:
  • Embedded
  • Server
  • Client
  • Common

No more "default" configuration;

Suppose your application, at some point, requires a Db4o database with an activation depth configured to the highest possible value (in most scenarios this is not recommended) so you use some code like this:

IConfiguration globalConfig = Db4oFactory.Configure();
globalConfig.ActivationDepth(Int32.MaxValue);

using(IObjectContainer db = Db4oFactory.OpenFile("test.yap"))
{
/* Use the database */
}

So far, so good. Now, in a completely different point in your application you need to open another Db4o database and so you just type:

using(IObjectContainer anotherDb = Db4oFactory.OpenFile("test1.yap"))
{
/* Use the database */
}

This new database ends up configured to fully activate objects! Even knowing that you should avoid configuring activation depth this way (you did your homework, right?) it's possible to do it by accident.

The problem is that it is relatively easy to mess with configuration.

That's the reason that now, all OpenXXXX() methods (in the new factories) requires a configuration to be passed through!

We are considering reintroducing the original signature methods but with different semantics; instead of return a clone of the global configuration we can return a fresh configuration object populated with default values so developers can be sure about what configuration they get!

To wrap up the session on configuration I'd like to present a short "cheat sheet":

Emdedded Old
Db4oFactory.OpenFile("dbfile");
New
Db4oEmbedded.OpenFile(
   Db4oEmbedded.NewConfiguration(),
   "dbfile");
S
e
r
v
e
r
Old
Db4oFactory.OpenServer("dbfile", port);
New
Db4oClientServer.OpenServer(
 Db4oClientServer.NewServerConfiguration(),
 "dbfile",
 port);
C
l
i
e
n
t
Old
Db4oFactory.OpenClient(
       "dbfile", 
        port, 
        "user", 
        "pwd");
New
Db4oClientServer.OpenClient(
 Db4oClientServer.NewClientConfiguration(), 
        "dbfile", 
        port, 
        "user",
        "pwd")

ExceptionsOnNotStorable is turned on by default

That's (IMHO) really nice. I don't like to just pretend that classes are storable on Db4o and let customers struggling trying to figure out why their applications doesn't work when we could follow fail fast principles and let they know that one or more classes may have problems as it is.


Use of properties in .Net

That's mean more natural code style for .Net developers :). Now, instead of saying:

config.OutStream(Console.Out);

you will write:

config.OutStream = Console.Out;

We are aware that there other places where using properties instead of methods (or even using a different approach) would make more sense (on .Net of course) but we just don't have the time to improve them now. But you may be sure we'll do our best to keep improving both .Net/Java developers experience.


That's it!

See you.

Nov 5, 2008

Are you a C# developer?

If so, you should go and grab a copy (for free) of CodeRush Xpress for Visual Studio!

(I already own a copy of another addin, but I'll give it a try anyway :)

Adriano