[# RESHARPER] HowTo: Convert string + string in string.format()

image47dd1de4

Hi,

After 12 hours of Visual Studio from last Tuesday, I grabbed me a virus that almost killed me. But little by little I will remove the earrings, we start by some emails.

Good, I was the other day watching with my coworkers 12 hours of Visual Studio, and part of seem very interesting items that you enseñasteis, we are left with the question of how to make a “trick” that we found to be quite useful in day to day… how to convert a string of the type “Hello” + < variable > + “que tal” in the string.Format(“hola_{0}_que_tal”,<variable>) automatically. We see you do it in the talk, but we do not know how, hehe.

Therefore, that becomes so well live and also much better in the code is thanks to ReSharper. To show an example, I have a console application with the following code:

   1: using System;

   2: namespace ConsoleApplication2

   3: {

   4:     class Program

   5:     {

   6:         static void Main(string[] args)

   7:         {

   8:             const string Name = @"Valentino";

   9:             var msg = "Hola mi nombre es " + Name;

  10:             Console.WriteLine(msg);

  11:         }

  12:     }

  13: }

 

If we are positioned on line 9, we see that ReSharper offers us the possibility of using format string for concatenation of strings.

image

After selecting this option, we have no more a sum of strings

 
 

But this is not all, the second option offered to us by ReSharper is also interesting, “Compute constant value”. In the same R # identifies that we are working with a constant and offers us the possibility of using the same value instead of working with a chain. The end result would be as follows:

   1: using System;

   2: namespace ConsoleApplication2

   3: {

   4:     class Program

   5:     {

   6:         static void Main(string[] args)

   7:         {

   8:             const string Name = @"Valentino";

   9:             var msg = string.Format("Hola mi nombre es {0}", Name);

  10:             Console.WriteLine(msg);

  11:         }

  12:     }

  13: }

   1: using System;

   2: namespace ConsoleApplication2

   3: {

   4:     class Program

   5:     {

   6:         static void Main(string[] args)

   7:         {

   8:             const string Name = @"Valentino";

   9:             var msg = "Hola mi nombre es Valentino";

  10:             Console.WriteLine(msg);

  11:         }

  12:     }

  13: }

Obviously, if we change the value of the constant we are more fried than the Chicago Bulls without Derrick Rose, but that topic for another post.

Greetings @ Home

El Bruno

Advertisements

[# TFS2010] HowTo: Change the Source Control association in a project

image47dd1de4

Hi,

I will point out a scenario that is pretty casual and gives errors on more than one occasion. Occurs usually when you copy a project associated with the SC in a Team Foundation Server to another server and the client for Visual Studio 2010 makes a mess with the binding of that project. The solution is quite simple:

  1. The project must be part of a solution properly associated with a TFS Source Control Server
  2. In the IDE to open the "File > > Source Control > > Change Source Control" option
  3. Select the project with problems and press the "Unbind" option
  4. Confirm the changes, with the option "Ignore All"
  5. In the Solution Explorer pane, select the project.
  6. Display the contextual menu and select the option "Add selected projects to Source Control"
  7. Donate!

7 steps that save you an afternoon of trouble, especially if "you break one of the Builds"

Greetings @ La Finca

El Bruno

[# TFS2010] Team Project Manager, one click to manage all!

image47dd1de4

Good,

as to my you get each both administer one or more servers Team Foundation Server 2010, with their corresponding Team Project Collections but also their endless Team Projects, surely this tool you rejoice the day: Team Project Manager. It is a tool where unified common tasks such as in the administration of Team Foundation Server:

  • Management of the definitions of Builds. The best is the ability to perform bulk updates on the definitions of Builds. Very useful when changing the Drop Folder common to several Builds.
  • Management of Build Process Templates
  • Management of security groups. It is essential at the global level.
  • etc.

The documentation is fairly complete and if you want to see the capabilities, this linkhttp://teamprojectmanager.codeplex.com/documentation?referringTitle=Home help.

Greetings @ Home

The Bruno

Project HomePage: http://teamprojectmanager.codeplex.com/

[# ALM] Using numbers to show why Pair Programming is a good practice

Hi,

After the excellent Coding Dojo with the help of Luis Ruiz Pavón we did with the guys from MadridDotNet, because I was pending to explain mathematical because it is useful to make a practice of Pair Programming in development teams. Pair Programming or programming pair defines a scenario where program is basically a two. Here’s the definition from Wikipedia:

Pair programming (or Pair Programming in English) requires two Software engineers to participate in a combined effort of developing a job site. Each Member performs an action that the other is not currently doing: while one encodes units tests the other thinks in the class that will satisfy the test, for example.

The person is doing coding is given the name of controller while the person who is leading is called the browser. It often suggests that two partners at least every half hour change roles or after becomes a unit test.

This practice is quite useful, has many detractors because usually people think that the world of development 4 hands produce more than 2. When in reality 2 heads produce much more than a single. But well, if once you’ve found with a "head" condemn this philosophy of work, this exercise can help you to demonstrate because a practice of Pair Programming is really useful.

Ideal scenario

Suppose we have a team of 6 people consisting of 2 programmers seniors and juniors 4 programmers. In an ideal scenario of working, we can assume that a senior programmer on a daily basis pays an amount of 2 units of work (UT), while a Junior programmer pays 1 UT. If we have a 5 day standard work week because at the end of the week we will have 40 UTs. The following table shows these numbers to make them clearer

Team Día 1 Día 2 Día 3 Día 4 Día 5 Total
SrP 2 2 2 2 2 10
JrP 1 1 1 1 1 5
JrP 1 1 1 1 1 5
SrP 2 2 2 2 2 10
JrP 1 1 1 1 1 5
JrP 1 1 1 1 1 5
            40

 

Real scenario

But of course, if you actually do software development and are aware of what does your team know that day maybe a Sr Programmer can give 100% and generate their 2 UT, but the next few days will have to help the Junior Programmers to close his work. Often this means that their personal performance will drop to the floor and will be devoted to work by 2 or 3 to be able to take work forward. Being generous with the cast of UTs, this scenario could look like the following table.

Team Día 1 Día 2 Día 3 Día 4 Día 5 Total
SrP 2         2
JrP   1   1 1 3
JrP     1   1 2
SrP 2         2
JrP   1   1 1 3
JrP     1   1 2
            14

 

Before moving to the next stage, and that you’ve read here, ask you because it is so frequent that developers gather together among themselves to discuss a topic in particular or to show portions of code. You’ll see that many times are doing programming in pairs without even knowing it.

Scenario with pair programming

Finally let’s see what would happen if we put together a SrP and a JrP; and we let the 3rd pair of JrP will rotate with previous. Since being very amarrete with the UTs, input we already have almost 150% more than in the real scene. And of course, assuming that the JrP can not pay more with the passage of time. The following table shows this example:

Team Día 1 Día 2 Día 3 Día 4 Día 5 Total
SrP           0
JrP 1,5 1,5 1,5 1,5 1,5 7,5
JrP           0
SrP 1,5 1,5 1,5 1,5 1,5 7,5
JrP           0
JrP 1 1 1 1 1 5
            20

 

Well, here you have an example completely unrealistic about how Pair Programming can help us improve the performance of our teams. Obviously that I post here is a real study nor true, since that software development is affected by many other variables; but perhaps if you together with a blunt head you can start to do recognize that you working in the stage 2 and then explain the scenario 3 is better.

Done the friki stuff ot the week … Risa

Update: I’ll put a bit of context to explain why this entry and why do not you should take seriously, is simply an exercise to demonstrate that YOU CANT put down to simple numbers the work of a team. Pair Programming is a practice that has many advantages, if you want to know because your friend google or his friend Bing, can help you. But I will recommend The Agile Samurai, a book mandatory for these days. In this particular case I have destroyed all good project management practices to reach a number that is valid for the post, for example

  • It is impossible to measure the working capacity of a person in "work units", everyone knows that the work of a developer is measured on the basis of the number of lines of code that writes per day. If you don’t know how to do it, this post can help you identify who works and who not.
  • Pair Programming is not based on join a Senior Programmer and a Junior programmer, is a little more complicated. I personally recommend make couples on the basis of the years of each person. Is scientifically demonstrated that when the sum of the years of a couple is an exact multiple of 3 or 7, performance increases in a 18%
  • Pair Programming allows us to save hardware costs. No need 2 computers, we can reduce IT costs by half. Another thing that I recommend to save costs and space to work with programming in pairs, is not have 2 chairs, but a single chair and a person hung in Mission impossible. This also helps if it hangs with a slight inclination downward, will get more blood to your head and you can write more lines of code to the day

 

Greetings @ Home

El Bruno

Sources: http://es.wikipedia.org/wiki/Programaci%C3%B3n_en_pareja

[# Event] 12 hours of Visual Studio (maybe you can with all of this!!)

image47dd1de4

Hi,

while I bite nails to tell nothing of the SDK Kinect before February 1st and did not mount any online event to tell the news, I will take advantage of the large solar storm that is happening at this very moment to promote this event in which I will participate in a few days.

12 Hours of Visual Studio

Because the title says you it all. We are going to open an instance of Visual Studio 2010 and the other Visual Studio 11 to the 0900 AM and until the 0900 PM not frenaremos. On the road you will see cracks as Luis Fraile, Iván González, Rodrigo Corral, Eduard Tomás, Alberto Díaz, David Álvarez, Jose l. Teruel, Alberto Fraj, Pedro j. Molina, Jose Bustos, Marino Posadas, etc., and obviously the undersigned Risa. We’ll see topics as diverse as Silverlight, ASP..NET, Ajax, JQuery, TDD, Kinect, Coded UI Tests, SharePoint, ASP.NET MVC, Windows Phone, testing performance, etc.

I also have to thank the guys at Microsoft Spain by giving me this opportunity and also take into account to open the meeting. It is a detallazo put first to those who are half as well as I do, so that the bar is quietly. Furthermore as there is more than 20 sessions, and surely we have a delay average 5 minutes per session, the poor secure Rodrigo Corral that begins the last session the next day Lengua fuera

That Yes at 11: 40 connect me the Kinect, I’m going to take the Robot, a pair of cats and will ride a fat fat…

Do we meet virtually, because I have commented that the event is 100% format webcast not? Or you thought you were going to throw 12 hours in front of this bunch of people live?

Greetings @ Home

The Bruno

Registration: https://msevents.microsoft.com/CUI/EventDetail.aspx?culture=en-US & EventID = 1032502854 & amp % 3bCulture = es-ES

[# KINECT] HowTo: Soften the detection of movements in the skeleton

image

Hi,

While we await the final SDK for developers with Kinectleave in a few days, we still have to adjust quite a bit to make the SDK will allow us to make robust applications. One of these “debts” Kinect has with us is the ability to remove the “tembleque / tremor” have at each point of the skeleton when working with the same point to point or Joint to Joint. If you run the application that shows both skeletons in a Canvas of WPF, you’ll see that it works pretty well.

Now, if we modify it with a bit of the code base of this post, to add 2 worlds in each hand (I have ‘ s got the whole world in his hands!) in will see something similar to the following image. While I have not well adjusted the size of the form so that the worlds coincide 100% with each hand, when you run the application you can see that it is a flickering or tembleque a little weird when examines the detail of the skeleton.

image

As well to solve this problem to our hands comes a fabulous property of the SDK called TransformSmooth. While there is lots of documentation in this respect, using this property we can define a series of buffers for deviations that will be processed during the analysis of the skeleton. Thus if we add the following lines before subscribe to the event of detection of skeletons, we can work in a smooth way.

   1: Kinect.SkeletonEngine.TransformSmooth = true;

   2: var parameters = new TransformSmoothParameters

   3:     {

   4:         Smoothing = 0.75f, 

   5:         Correction = 0.1f, 

   6:         Prediction = 0.0f, 

   7:         JitterRadius = 0.05f, 

   8:         MaxDeviationRadius = 0.08f

   9:     };

  10: Kinect.SkeletonEngine.SmoothParameters = parameters;

  11: Kinect.SkeletonFrameReady += KinectSkeletonFrameReady;

 

Now, to see that values have to apply to each property, it is best to go testing them to see that format is better suited to our application. In this post, is described a bit to represent each property and values by default of the same.


Parameter Description Default Value Comments
Smoothing Specifies the amount of smoothing. 0.5 Higher values correspond to more smoothing and a value of 0 causes the raw data to be returned. Increasing smoothing tends to increase latency. Values must be in the range [0, 1.0].
Correction Specifies the amount of correction. 0.5 Lower values are slower to correct towards the raw data and appear smoother, while higher values correct toward the raw data more quickly. Values must be in the range [0, 1.0].
Prediction Specifies the number of predicted frames. 0.5  
Jitter Radius Specifies the jitter-reduction radius, in meters. 0.05 The default value of 0.05 represents 5cm. Any jitter beyond the radius is clamped to the radius.
Maximum Deviation Radius Specifies the maximum radius that filter positions can deviate from raw data, in meters. 0.04 Filtered values that would exceed the radius from the raw data are clamped at this distance, in the direction of the filtered value.


And as always if you want to download the ´código of this post you can do from here

https://skydrive.live.com/redir.aspx?cid=bef06dffdb192125 & SPL = BEF06DFFDB192125! 3798 & parid = BEF06DFFDB192125! 1932

Greetings @ Home

El Bruno

Sources:

http://Channel9.msdn.com/series/KinectSDKQuickstarts/skeletal-tracking-fundamentals

http://cm-bloggers.blogspot.com/2011/07/kinect-SDK-smoothing-skeleton-data.html

[# VS2010] HowTo: Debug an AddIn for OneNote

image47dd1de4

Good,

I cannot begin to explain the reason for the creation of an AddIn for OneNote. If any known theory of bad luck, because you can see that OneNote is the only element of the suite of Microsoft Office 2010 that does not have a template for the creation of AddIns in Visual Studio 2010. I had to throw the bad memories with IDTExtensibility2, a bit of diving by the registry in order to create an AddIn. That, once created the AddIn for OneNote in Windows8 is very cool, but… I found the head against the wall when I tried to debug it.

It turns out that if well on the list of Windows processes, there is active a process that has all the earmarks of being of OneNote called ONENOTE.EXE; so this process no is hostea the notes in OneNote. As an AddIn is a COM, it is not running in the context of the exe file in OneNote, but not executed within a DLLHOST (bad memories by God!)

image

But hey, attaching the appropriate dllhost process already can debug our AddIns for OneNote.

For this I have to thank Daniel escape for his pursuit of a few years ago > >http://blogs.msdn.com/b/descapa/archive/2007/05/01/debugging-a-onenote-toolbar-addin-c.aspx

Greetings @ the estate

The Bruno

Reference: http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.aspx

Thanks To http://blogs.msdn.com/b/descapa/archive/2007/05/01/debugging-a-onenote-toolbar-addin-c.aspx

[OPINION] Visual Studio Achievements, some scary achievements !

image47dd1de4

Good,

in my previous post I mentioned the launch of Visual Studio Achievements, an interesting plugin that brings the concept of achievements or points to the world of development. Now, if we analyze the achievements that have been put into Channel 9, because we see that there is a Division in 6 categories for types of achievements. There is one in particular has achievements of zero points, but that scary just find someone possessing them. For example

image

Do we really want to teach the ruling goto to those people who do not know?. But well, I understand that this is an example of a bad practice and only serves as a reference. For example, the person who holds more achievements at this time (http://channel9.msdn.com/niners/DotNetNuzzi/achievements/visualstudio) has this achievement and I wonder:

Will have achieved the achievement to have points in this programme or really use the GOTO statement?

Both scenarios are equally dangerous. Other achievements that frightened include

Finally, Hadi Hariri is responsible for end to finish the poor implementation of the programme in this post (http://hadihariri.com/2011/11/25/visual-studio-achievements-who-needs-clean-code-anyway/ )).

I think that the idea is very good, that is carried forward a little bit of promotion tools that complement Visual Studio 2010, such as FxCop and profiling tools. But as says Hadi, could not have taken the opportunity and think of achievements that actually promote a development based on good practices and clean.

Greetings @ Home

The Bruno

Download: http://visualstudiogallery.msdn.microsoft.com/bc7a433b-b594-48d4-bba2-a2f24774d02f

References: http://hadihariri.com/2011/11/25/visual-studio-achievements-who-needs-clean-code-anyway/

[# VS2010] Visual Studio Achievements, achievements for each developer

image47dd1de4

Good,

These days I have not had time to write, nor to try many new things. But the idea of Visual Studio Achievements it caught my attention (although when seen the achievements I am stick!). But we are going to those who come on, this extension install you a plugin in the IDE of Visual Studio that is responsible for analyzing developments that you’re doing and gives you achievements based on them.

Once authenticated against Channel9, we can see how it can be integrated within the IDE.

image

Only now is a matter of leaving to do his work in analyzing behind and begin to count the achievements that we added,

image

I after playing with the tool a couple of minutes I found several unlocked achievements (some of which I am not particularly proud) Guiño)

image

As well, the idea seems great, he format too, although somewhat improve the accomplishments that are being promoted.That goes to the next post.

Greetings @ Home

The Bruno

Home: http://channel9.msdn.com/achievements/visualstudio

Download: http://visualstudiogallery.msdn.microsoft.com/bc7a433b-b594-48d4-bba2-a2f24774d02f

[# PERSONAL] Tomorrow elbruno.com will be down (you know why!)

Good,

today I turn write Kinect, ALM, Team Foundation, etc.

I just put this post to do my mini bit low giving a blog that surely that doesn’t read anyone for a whole day.

Tomorrow elbruno.com will be given low and stating that I prefer always > share to censor Enfadado

image

Greetings @ Home

El Bruno

Image Source: http://www.zazzle.com/angry_code_monkey_tshirt-235123079804333018