[#VS2012] Setup in Visual Studio 2012? WiX is here!

image

Buenas,

I mentioned already a couple of months ago: we will not have more project setup in Visual Studio 2012 . Luckily the team pushing WiX has decided not to let it die and they are already on version 3.6. In this post you can see the new features that are included, but the best is that it is 100% compatible with VS2012.

Source: http://robmensching.com/blog/posts/2012/9/3/WiX-v3.6-released

Saludos @ La Finca

El Bruno

image image image

[#GADGETS] HowTo: Integrate the USB Email Notifier to display the states of Lync 2013 Beta (III)

image

Buenas,

today close series where I discuss how using C# can check the status of the lights of a USB Email Notifier little more than U$ S 8.00.

First real example which was to build an application showing the alerts for a Server Builds with Team Foundation Server 2012. As once long ago already built something similar with the Lance missiles USB and Team Foundation Server 2008, because today I will do something different.

Some time ago I caught my attention this post by Scott Hanselman , which says it has been aBusyLight on the door of his Office so your family will know if you are in a call, Conference, etc. In addition to feel quite identified with your situation, it struck me that nobody has created a “cheap” solution for this. Well, here is some u $S 20 and with the satisfaction of having done self.

The only thing we need is a notifier light and a couple of USB extensions, for example

The following is to create a WPF application where use of Lync presence controls. In this case I’m using LYNC 2013 BETA, so I had to also download the SDK in Beta mode from here. The good thing about this SDK, is that in addition to the classical object model, we also have a set of WPF controls that allow us to create an application like that we can see the next image in a few minutes:

image

The WPF code

   1: <Window x:Class="ElBruno.LyncLightNotifier.MainWindow"
   2:         xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"
   3:         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   4:         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   5:         Title="El Bruno - LYNC 2013 Light Alert"
   6:         Height="264"
   7:         Width="405">
   8:     <Grid>
   9:         <Grid.RowDefinitions>
  10:             <RowDefinition />
  11:             <RowDefinition />
  12:         </Grid.RowDefinitions>
  13:         <Grid.ColumnDefinitions>
  14:             <ColumnDefinition Width="187*" />
  15:             <ColumnDefinition Width="384*" />
  16:         </Grid.ColumnDefinitions>
  17:         <Grid.Background>
  18:             <ImageBrush ImageSource="Lync.png" />
  19:         </Grid.Background>
  20:         <StackPanel Orientation="Vertical"
  21:                     Margin="10,0,0,10"
  22:                     HorizontalAlignment="Stretch"
  23:                     VerticalAlignment="Center"
  24:                     Height="106"
  25:                     Grid.Column="1"
  26:                     Grid.Row="1">
  27:             <controls:MyPresenceChooser x:Name="myPresence"
  28:                                         HorizontalAlignment="Stretch" />
  29:             <controls:MyStatusArea x:Name="myStatus" />
  30:         </StackPanel>
  31:     </Grid>
  32: </Window>

Now as I have not invested much time in seeing how the SDK, in the first 10 minutes I found an event that indicate me the state change. Therefore, the following code is almost just as damaging to the world of programming such as killing the last Unicorn or making a couple of miles in my car (the last is harmful for Ecology).

   1: using System;
   2: using System.Timers;
   3: using System.Windows;
   4: using System.Windows.Threading;
   5: using ElBruno.LightNotifier;
   6: using Microsoft.Lync.Controls;
   7:  
   8: namespace ElBruno.LyncLightNotifier
   9: {
  10:     public partial class MainWindow
  11:     {
  12:         private readonly Timer _timer = new Timer(1000);
  13:         public MainWindow()
  14:         {
  15:             InitializeComponent();
  16:             Loaded += MainWindowLoaded;
  17:             Unloaded += MainWindowUnloaded;
  18:         }
  19:  
  20:         void MainWindowUnloaded(object sender, RoutedEventArgs e)
  21:         {
  22:             _timer.Elapsed -= TimerElapsed;
  23:             _timer.Stop();
  24:         }
  25:  
  26:         void MainWindowLoaded(object sender, RoutedEventArgs e)
  27:         {
  28:             _timer.Elapsed += TimerElapsed;
  29:             _timer.Enabled = true;
  30:         }
  31:  
  32:         void TimerElapsed(object sender, ElapsedEventArgs e)
  33:         {
  34:             Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(CheckLyncState));
  35:         }
  36:         void CheckLyncState()
  37:         {
  38:             var state = myPresence.AvailabilityState;
  39:             var lightController = new LightController();
  40:             lightController.TurnLight(state == ContactAvailability.DoNotDisturb);
  41:         }
  42:     }
  43: }

Well, the solution is quite simple: a timer every second verifying the LYNC 2013 State and if it is Do Not Disturb, as the notifier light turned on. Lines 32 to 41 will make you happy.

If a picture is worth a thousand words, the next value should be worth 2 or 3 monosyllables

Video: http://youtu.be/Tah42D8Vozw

The full application code can be downloaded from http://sdrv.ms/PkgQ4L .

References:

Saludos @ La Finca

El Bruno

image image image

[#WINDOWS8] HowTo: Obtain the Windows 8 application version number

image

Buenas,

after the greatest hits on how get the version of an Assembly and envelope number How to obtain the version number of a ClickOnce application , today plays a little help to get an application version number of Windows 8 .

   1: string GetVersion()
   2: {
   3:     Package package = Package.Current;
   4:     PackageId packageId = package.Id;
   5:     PackageVersion version = packageId.Version;
   6:     return String.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
   7: }

Saludos @ La Finca

El Bruno

image image image

[#ALM] Check your maturity level in your software development processes

ALM 03

Buenas,

Maybe some do not know, there is a very complete table that allows us to identify the degree of maturity of our Basic, Standard, Advanced and Dynamic software development processes.

This table is available to download from one of the sites in CodePlex ALM Rangers and can be downloaded from here .

image

Well, the table discussed various points such as “Deployment and operations” or “Software Configuration Management”. It is likely that we will have a different maturity level for each of them, but the most important thing is that we will have clear what steps we need to follow in order to level up.

Excellent resource!

Download: http://vsaralmassessment.codeplex.com/downloads/get/488960

Saludos @ Home

El Bruno

image image image

e

[#PERSONAL] Difference between a programmer and a good programmer

image

Buenas,

while I am reading a couple of books very good leave a sentence that I never tire of reading:

The difference between a tolerable programmer and a great programmer is not how many programming languages they know, and it’s not whether they prefer Python or Java. It’s whether they can communicate their ideas. By persuading other people, they get leverage. By writing clear comments and technical specs, they let other programmers understand their code, which means other programmers can use and work with their code instead of rewriting it.Absent this, their code is worthless. By writing clear technical documentation for end users, they allow people to figure out what their code is supposed to do, which is the only way those users can see the value in their code. There’s a lot of wonderful, useful code buried on sourceforge somewhere that nobody uses because it was created by programmers who don’t ‘ can’t write very well (or don’t write at all), and so nobody knows what they’ve done and their brilliant code languishes.

I won’t hire a programmer unless they can write, and write well, en Español. If you can write, wherever you get hired, you’ll soon find that you’re getting asked to write the specifications and that means you’re already leveraging your influence and getting noticed by management.

Joel Spolsky, How To Write Without Writing

Saludos @ Home

El Bruno

image image image

[#VS2012].REG to change the action by default for "Resolve" to "Associate" in Visual Studio 2012

image

Buenas,

some time ago the friend Luis showed us the entry in the windows registry that we must change to change the default action of “Resolve” to “Associate” when we do a CheckIn with Visual Studio 2010 .

I then wrote a post about where you also put a .reg to change this entry. Today update this file to modify the registry to Visual Studio 2012.

It has the following content

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Behavior]
“ResolveAsDefaultCheckinAction” = “False”

and can be downloaded from here: http://sdrv.ms/QFopEN

Saludos @ La Finca

El Bruno

image image image

[#WINDOWS8] HowTo: Launch the console commands with administrator privileges in a manner easy

image

Buenas,

first, explain that this also works in Windows 7. We will is older than the bread trick, but some people do not know. As well, the steps to launch the command prompt with administrator privileges from Windows 8 using only the keyboard are as follows.

1 Access to the search engine for applications. Or the environment of WinRT

2 We begin to write the name of the command console. In my case, with “comma” enough is enough

image

3 Press CTRL+SHIFT+ENTER

4. A new instance of the command prompt opened with administrator privileges

image

5. Ready!

Saludos @ Home

El Bruno

image image image

[#GADGETS] How to control USB Email Notifier with C# (II)

image

Buenas,

after the post where I mentioned How to identify a connected to a computer USB gadget information , today to see how to work with it from a C application #.

From the information in the device

image

First thing we will do will be to define an array of 6 elements bytes to send information to the led (line 1).

Then we define a pair of constants to identify the gadget (lines 7 and 8) and creating a type USBInterface class (see the previous post), we connect to our device.

   1: private readonly byte[] _cmdData = new byte[] { 0, 0, 0, 0, 0, 0 };
   2: private readonly USBInterface _device;
   3: private readonly bool _connected; 
   4:  
   5: public LightController()
   6: {
   7:     const string vendorId = "vid_1294"; 
   8:     const string productId = "pid_1320"; 
   9:     _device = new USBInterface(vendorId, productId);
  10:  
  11:     if (_connected)
  12:     {
  13:         return;
  14:     }
  15:     _device.enableUsbBufferEvent(UsbDeviceEventCacher);
  16:     _connected = true;
  17: }

The following will create a function to turn on or turn off the device Led. On stage is very simple, we change the 2nd element of the array from 0 to 1, and we send with the functionwriteDataSimple() .

   1: public void TurnLight(bool lightOn)
   2: {
   3:     _cmdData[1] = 0;
   4:     if (lightOn)
   5:     {
   6:         _cmdData[1] = 1;
   7:     }
   8:     _device.UsbDevice.writeDataSimple(_cmdData);
   9: }

To turn off do the same, but with the 2nd component equal to 0.

The complete code for the class would look like:

   1: using System;
   2: using System.Diagnostics;
   3: using System.Linq;
   4: using USBHIDDRIVER;
   5:  
   6: namespace ElBruno.LightNotifier
   7: {
   8:     public class LightController
   9:     {
  10:         private readonly byte[] _cmdData = new byte[] { 0, 0, 0, 0, 0, 0 };
  11:         private readonly USBInterface _device;
  12:         private readonly bool _connected; 
  13:  
  14:         public LightController()
  15:         {
  16:             const string vendorId = "vid_1294"; 
  17:             const string productId = "pid_1320"; 
  18:             _device = new USBInterface(vendorId, productId);
  19:  
  20:             if (_connected)
  21:             {
  22:                 return;
  23:             }
  24:             _device.enableUsbBufferEvent(UsbDeviceEventCacher);
  25:             _connected = true;
  26:         }
  27:  
  28:  
  29:         public void TurnLight(bool lightOn)
  30:         {
  31:             _cmdData[1] = 0;
  32:             if (lightOn)
  33:             {
  34:                 _cmdData[1] = 1;
  35:             }
  36:             _device.UsbDevice.writeDataSimple(_cmdData);
  37:         }
  38:  
  39:         private void UsbDeviceEventCacher(object sender, EventArgs e)
  40:         {
  41:             if (USBInterface.usbBuffer.Count <= 0) return;
  42:             const int counter = 0;
  43:             while (USBInterface.usbBuffer[counter] == null)
  44:             {
  45:                 lock (USBInterface.usbBuffer.SyncRoot)
  46:                 {
  47:                     USBInterface.usbBuffer.RemoveAt(0);
  48:                 }
  49:             }
  50:             var currentRecord = (byte[])USBInterface.usbBuffer[0];
  51:             lock (USBInterface.usbBuffer.SyncRoot)
  52:             {
  53:                 USBInterface.usbBuffer.RemoveAt(0);
  54:             }
  55:             if (currentRecord == null) return;
  56:             var msg = currentRecord.Aggregate("current record:", (current, t) => current + t);
  57:             msg += "\r\n";
  58:             Trace.WriteLine(msg);
  59:         }
  60:     }
  61: }

And ready! We have a class that allows you to turn on and off the LEG of our USB gadget in 60 lines.

Tomorrow the source code and the complete example.

Saludos @ La Finca

El Bruno

image image image

[#GADGETS] How to control USB Email Notifier with C# (I)

image

Buenas,

showed yesterday on the talk of robotics at the University such as connecting a USB device and start playing with it to see if we can do something using C#. For the demo used a gadget like this USB Email Notifier (link) which sold over the internet to only us$ s:8, 68 (including shipment costs).

image

This USB HUB comes with a special software that makes the envelope to change color from certain events. For example: check our mailbox and when a new mail arrives because it turns a red led inside the same.

The goal of this post is to show how to create a class C# to turn off the light to our liking. The first thing we need to do is identify the device HID as explained in this post. To do this use theSimpleHIDWrite tool (download from here). With it we can see information relating to all USB devices that we have connected to our computer. For example:

image

Our device is called “DDD Mail Notifier”. If we accede to the information of the device we will see a few important details:

  • Vendor name: “DDD Mail Notifier”
  • Product name: “DDD Mail Notifier”
  • Input Buffer: 9 Bytes
  • Input Buffer: 6 Bytes

image

If we return to the main form, we will see the 6-byte buffer is rendered dynamically with 6 boxes of text in the form. So now we have to see that data are that we need to send to be able to turn on the light.

If we introduce the following information

{00, 00, 00, 00, 00, 00}

and click on the Write button

image

We will see that the LED is still off.

image

If on the other hand to introduce the following information

{01, 00, 00, 00, 00, 00}

and click on the Write button

image

We will see that the red LED illuminates.

image

If you re-enter the following information

{00, 00, 00, 00, 00, 00}

We will see that the LED goes out.

At this point already have made it clear that

  • {00, 00, 00, 00, 00, 00} > = Turn OFF
  • {01, 00, 00, 00, 00, 00} > = Turn ON

In the next post to see how to do the same with C#.

See you later!

Saludos @ Home

El Bruno

image image image

[#EVENT] Materials of the event of #Robotics and #Kinect at the University Carlos III

 

image

Buenas,

 

Here you have links to presentations and source code that uses yesterday in the event of Robotics and Kinect at the University:

http://sdrv.ms/UbUgle

And the video of it can be seen in

http://imagineware.org/Charla-msrobotics-2012.html

Saludos @ Home

El Bruno

image image image