Per Project Settings or How to have different naming styles for my test project

Tags

 

One nitpick that I myself and many have had with ReSharper is not being able to have different naming styles for types based on different projects. In my code I normally name classes using CamelCase

 

image

 

and in my test project I use all_lowercase

 

image

 

Unless you add all_lowercase as a valid naming style, you’ll always end up with those squiggly lines under all your tests. And let’s admit it, it’s not a big deal but it’s annoying. #FirstWorldProblem

 

Say hello to my little layer

With ReSharper 6.1 we introduced the concepts of layers, which open up many new possibilities, including sharing settings on DropBox and or setting company wide standards. What you might not know is that it allows Per Project Settings too! No big deal if you didn’t know, since we currently do not support it via the User Interface so it would be hard to figure it out. However it’s pretty simple to do and I’m going to show you how.

 

Our goal here is to allow all_lowercase settings for classes in our test project (Tests) and not permit the same in other projects (Project). This is the sample project layout we’re going to be working with

 

image

To make this happen, we need to create specific settings for the Tests project and allow the possibility of classes being all_lowercase. That is, the Tests project needs its own DotSettings file.

 

Since there’s no specific button or option to add Per Project settings in the UI, this is where we need to kind of use a workaround. We need to have a Settings file for the project and then edit the options and save it to this file. There are many ways to create this new settings files. We can copy the solution one and rename it, we can export the current settings, we can mount a new layer and have ReSharper create it for us, etc.

We’re going to use this last method. Why? Because since ReSharper mounts it when it creates the file, it will allow us to edit the settings too.

 

 

1. With the Solution open, click on Manage Options under ReSharper

 

2. Under This Computer, click on the Add Layer icon (on the right) and select Create Settings File

 

image

 

 

3. Save the file to the Tests project folder, in our case that would be under SolutionDir\Tests and name it (and here’s the important part) Tests.csproj.DotSettings. That is, it should be named with the ProjectName, followed by csproj or vbproj based on the type of project and with the extension DotSettings.

 

4. Now that we have the settings file mounted, we need to change the required settings, which in our case is to allow classes to have all_lowercase (this obviously works for other settings too). As such, double-click the recently mounted file or right click and click on Edit

 

image

 

5. The Options dialog comes up. We want to edit the naming styles

 

image

 

Modify any other settings you wish at this point and once done, hit Save on the Options dialog.

 

image

 

At this point, we can remove the mounted settings as its not required for it to actually work. We can also leave it in order to easily access the settings for the project in the future. If you do leave it, make sure you uncheck the checkbox so that settings are not applied to the entire solution.

 

[Recommendation: If you decide to leave the settings mounted, mount these under Solution Shared or Solution Personal as opposed to This Computer so that you don’t end up with a long list of different settings files]

 

 

As soon as we hit Save, the new settings automatically are picked up by ReSharper and take effect. We can now see that the naming style no longer appears incorrect under the Tests project

 

image

 

and if we try and use the same style in the actual Project we do get the warning

 

image

 

The UI will come

Once you do this once, you can pretty much copy the same file over to your different projects and rename it to match the project name. In one of the next versions of ReSharper we will provide a more intuitive UI (or should we say we’ll provide an actual UI) for this. For now however, I think this minor hack will make a few people happy!

The tangibility syndrome

Tags

 

I was reading a post by Phil Haack about Recognition Compensation which was somewhat in reference to recent news over MVP renewals. I feel there’s no further comments required on all the rewards and compensations surrounding this and other programs. This post is not about that, but about something he mentioned, something I’ve come across quite often:

 

The other reason folks want an MVP is to have access to the professional tools. Most companies will easily shell out the money for this, but if you’re a hobbyist or open source developer, it’s a lot of money to shell out.

 

First of all, let me make it very clear that this has nothing to do with OSS. Let me also state that at JetBrains we fully support Open Source Development, and we do this in many ways. Some of our tools are fully Open Source, others have OSS Community Editions. We also provide free licenses to OSS projects of pretty much all of our tools, as well as collaborate with the folks at Codebetter to offer free Continuous Integration and Issue Tracking software for all Open Source Projects (in fact, TeamCity and YouTrack are even provided for free for smaller teams). In addition to this, many of us at JetBrains spend quite a bit of our time working on OSS projects.

These are policies that I identify myself with and that’s why I’m very happy to be part of such a great company. Having said that, let’s move on…

Hobbies cost money

This morning I tweeted:image

Collin’s Dictionary defines Hobby as:

image

In our context, it’s an activity pursued in spare time for pleasure or relaxation.

It’s what people do to switch off. It’s what they do to get away from their daily job. It’s what they do to relax. Stamp Collecting, Photography, Painting, Knitting, Astronomy, Playing a Guitar are examples of hobbies.

Many of these hobbies cost money. Some of these are one-time investments, others have ongoing costs. Photography requires a good camera. Painting requires a constant stock-up. Things which would seem like an upfront only investment also turn out not to be. You buy yourself an electric guitar. Once you learn to play it half-decent, you want a better sounding amp. Next you need a few pedals and ultimately want a better guitar.

how is development as a hobby different?

My main hobby (after stumbling with a guitar) is learning new programming languages, frameworks and stepping outside of my comfort zone. It might be sad that I have little interests outside of my profession, but I find it somewhat fortunate because it means that I love what I do so much that if I weren’t doing it, I’d be doing it, if that makes sense.

I’m also fortunate that my hobby contributes to my career. Of course, I don’t get to play my guitar as much as I’d like to, but I do get to learn new ways of doing things that broaden my horizons. As such, I invest in my hobby, be it with books, software tools, hardware and whatever else I need. And I don’t look at it as a ROI because that’s not what a hobby is about. It’s not about how much bang you get for your buck.

Whatever the hobby, be it playing a guitar or collecting stamps, people have little problem with spending money on it. Yet why do we draw the line when it comes to software?

I do this as a hobby, why should I pay?

 

Is it because software is not tangible?

We see this outside of developer and hobbyist circles too. People will spend thousands of euros on a MacBook Pro, but then look for free password keepers instead of paying $70 to buy 1Password. They’ll use free alternatives even if they’re half as good as a paid one. And of course, in countries like Spain, where we’re ranked as second highest in software piracy in Europe, it’s just downloaded off of some torrent site.

We, developers, of all people, the ones that charge money to write or aid in writing end-user software, should be the first to know that the value of software is not measured by how much it weights or what it feels like. If we understand that, why do we suddenly feel that working on something as a hobby doesn’t deserve monetary investment?

Errors: Handle with care

Tags

,

Went to renew my driving license this morning, a process the DGT (Traffic Authority in Spain) has made extremely simple now: you just head over to a private clinic, pay quite a bit more than you actually should and have them deal with the bureaucracy.

It was meant to be a 30 minute process and quite straightforward:

1. Ask for customer’s details
2. Run some medical tests
3. Get a temporary driving authorization until your license arrives in the post

I ended up being there about an hour and not getting it renewed.

The real process went something like this:

1. Was asked for all my details at reception and waited as they were typed in.

2. Taken into examination room. Waited 15 minutes until they could start the computer since the fan was acting up. Thankfully the technician (which was actually a Doctor) came in, kicked the box (literally) and it turned on. As he walked out he said:

“these computers are scared of me…”

3. Asked for my details again. When I questioned why I was being prompted for them  a second time, the answer was somewhat expected:

“This computer has nothing to do with the other one. This one runs the DGT program. The other one runs ours. “

Stupid me!

4. Went through some appropriate tests. Again, this was delayed because the second computer failed to boot.

1st Error handling mistake  – the human

I waited patiently until my details were submitted to the DGT system. Everything seemed fine until I was suddenly asked:

Operator: “Are you sure you haven’t lost any points on your driving license?”

Me: “Em no. In fact I think I now have 14 as opposed to 12”.

Operator: “Hmm, something is very wrong. It’s giving me Undetermined Error 611

Me: “OK, so what does that mean?”

Operator: “There’s a problem with your driving license. I think….”

Me: “You think or you’re sure?”

Operator: “I can’t know exactly. As it stands I can’t process your renewal. You’ll have to leave this with me. If I don’t call you back today then you’ll need to go to DGT and do it yourself. But don’t worry, we won’t charge you anything”

Now you have to admit, that’s awfully kind of them not to charge me for something they haven’t managed to do.

2nd error handling mistake – the stupid developer

Up to now, my customer experience, as a user of this clinic has been somewhat lower than par one could say. I’ve witnessed operator incompetency, lack of care of technical equipment and overall no inspiration of confidence.

This clinic has a ER unit, in-house care, pediatricians and various other specialties. Suffice to say, it does not inspire any confidence in me for me to ever return there, specially when dealing with something serious as health issues. They’ve lost a customer.

The second user experience however comes from the developers that created the system. It was that damn undetermined error 611.

As a developer, when you see “Internal Error”, “Undetermined Error” or “Catastrophic Failure” you pretty much know what the developer was thinking at the time:

“I don’t give a shit about controlling errors in this scenario. Too many things can go wrong for me to control”

Now I am right in assuming that this error code is only valid for the developer. Otherwise he/she is really stupid to display an error message to the user making them either have to memorize error codes or look them up in some manual.

As such, that leaves one of two options: 611 is just the number they use to define what an undetermined error is (i.e. 500 Internal Server Error) or 611 provides them some valuable insight into the error, which then begs the question of why it’s undetermined.

Whatever the case though, this is yet another UX fail. Not only does it not provide any kind of valuable information to the user, but it also, as is in my case, when faced with a somewhat incompetent user, causes a certain level of concern (WTF is wrong with my license? Has it been revoked?).

Handle with care

Time and time again I’ve seen applications fail when it comes to handling errors. Most common excuses given when observing bad error management are, that it’s too complicated to know what’s gone wrong. The irony of this is that much of this complexity is caused by the way we design the system, as opposed to the underlying business rules. The only time error handling is too complex to deal with is when a human decision is required. In these scenarios, we need to also deal with the error, but using a different approach.

Providing error codes or ambiguous messages to a user should never be done. Anything that interacts with a user, a consumer of your application, should use language the user understands, not something they need to look up. That’s what computers are good for: looking up information.

Now, while writing this post, I got a call from the clinic. The undetermined error ended up being a user error. The operator had asked for my nationality and I had said Spanish. She had entered Spain as my place of birth. DGT had Iran on their records. There was a mismatch. The operator failed in using the system. But the system failed her even more by not handling errors correctly.

Much of this would have not taken place if instead of

“Undetermined error 611”

it would have displayed

“There is a mismatch between the place of birth entered and that on record”

Something as simple as this would have saved me and the clinic time, annoyance and money.

So never supply error codes?

When switching to the context of developers, it is fine to provide log details and stack traces. In this context you can provide codes. HTTP does it. It’s useful to automate error handling and machine-to-machine interaction. But in addition to these codes, you still need to provide a valuable message so that a developer can understand where to look, what’s gone wrong.

And if everything does go wrong and there’s no way to handle the situation, consider providing a more re-assuring message to the user, something that doesn’t leave him thinking he’s lost all his points on his driving license:

“It’s OK. You didn’t screw up. We did. We’ll sort it out and get back to you”

Providing Intellisense, Navigation and more for Custom Helpers in ASP.NET MVC

Tags

 

You probably are aware by now that as of ReSharper 5 we added first-class support for ASP.NET MVC. This included among many things, the ability to provide Intellisense, Create from usage and Navigation to built-in methods such as Controller.View or Html.ActionLink:

 

Navigation

Ctrl+Left Mouse Click or F12 will navigate to the corresponding View

 

image 

 

or to the Action and/or Controller

 

image

Intellisense and Create From Usage

Ability to have Intellisense when providing Actions/Controllers

 

image

 

as well as the possibility of creating from usage

image

 

However, what happens when you want to use a custom function, for instance, a better ActionLink or your own View method? Did you know that you can still get all these goodies? All you need to do is use some Annotations.

Using JetBrains.Annotations

ReSharper uses annotations via the form of .NET attributes to figure out what an ASP.NET MVC View, Action or Controller is. As such, all we need to do for our custom method and extensions to leverage this, is tell ReSharper what parameter corresponds to what.

 

Referencing the annotations

To use ReSharper annotations, we have mainly two options (with a third one hopefully coming soon):

1. We can include the library JetBrains.Annotations.dll in our project and reference it.

2. We can copy the annotations and include it as source in our project

[3. We can use nuget install-package JetBrains.Annotations] Coming soon!

 

The first option is pretty simple. The DLL is located in the ReSharper installation bin folder. For the second option, we open up ReSharper | Options and select Code Annotations entry

 

image

 

select the Copy default implementation to clipboard button and paste into an empty file.

 

Annotating custom methods

Once we’ve completed this step, all we need to do is annotate our parameters with the correct attributes. We’re interested in 3 different attributes in particular:

 

  • AspMvcView which indicates the parameter is a View
  • AspMvcAction which indicates the parameter is an Action
  • AspMvcController which indicates the parameter is a Controller

 

Here is the header corresponding to a base controller with a custom method named ExtendedView

 

image

 

and here’s the header for a custom ActionLink

image 

 

(the body of both methods are omitted and are not necessary to demonstrate the functionality)

 

As soon as we do this, ReSharper picks up these methods and offers us the same functionality that is provided for the methods that ship out of the box:

 

image

 

Notice how we still get Navigation (the underlining), Intellisense and Create from usage in our TheOnlyActionLink custom method. Its much the same for the ExtendedView method

 

image

 

That’s all there is to it.

Setting up TeamCity as a native NuGet Server

Tags

,

 

TeamCity 7.0 EAP (Early Access Program) was recently opened and one of the new features is the built-in support for NuGet. I recently blogged about setting up TeamCity to pack and publish NuGet packages via a plug-in and this plug-in is now included by default in TeamCity 7. However, the real new interesting feature is that TeamCity is now a native NuGet repository too!

Native NuGet Server?

Many of those that have been using NuGet, have most likely been using it to consume packages from nuget.org where there are currently over 3800 unique packages, most of which are open source.

image

 

What happens however if for some reason or another you do not want to submit packages to nuget.org? For instance, think that you want to use NuGet to modularize and distribute code inside your own organization, or create libraries for private consumption. In this case, publishing to nuget.org does not make sense. This leaves you with basically two options:

 

  1. Setup your own NuGet repository by downloading and installing the code that nuget.org for instance
  2. Copy nuget packages to a local share and have everyone read off of that

 

Both of these options come with their own share of overhead. With the local share you now require sharing of folders and permissions. Setting up your own NuGet repository also requires managing permissions and whatnot separately. At the end of the day, its another service to manage.

Fortunately, you now have a third option: TeamCity. The same server that builds your projects, runs your tests, packs and publishes your packages can now also serve them. The best part of it is that it is so simple, that I had to take up the rest of this blog with the previous nonsense just to give it some meat.

Enabling TeamCity as a NuGet Server

I am not going to cover how to pack and publish packages in this post. All that is covered in detail in the previous post I wrote, so please read that first if you’re not familiar with the process. Enabling TeamCity as NuGet and making packages available consists of two steps:

 

1. Enable the server to be a NuGet server

 

Go to Administration | Server Configuration | NuGet tab

 

image

Click on the Enable button to enable it. The same screen with then display two different feeds: a public and a private one:

 

image

If by chance the Public Url is not available, you will probably see a message telling you that you need to enable the Guest account in TeamCity, which can be done from the General tab.

 

2. Make your packages be your Artifacts

Since TeamCity itself is going to be a NuGet server, the step to publish a package is no longer required. However, packing the package is. In this step (NuGet Pack Build Type), we can just configure the output for the package to point to some specific folder, for instance packages

 

image

 

We need instruct TeamCity to ouput the results of this folder as artifacts. This is done in the General Settings step of the Build Configuration

 

image

 

and with that, we’re done. Next up is to configure Visual Studio to consume from this feed.

 

Configuring Visual Studio

Although this step is optional, it is recommended to add your repositories to Visual Studio to avoid having to type long URL’s in each time you want to read from a specific package repository. To do this, click on Options | Library Package Manager | Package Manager Settings

 

image

 

We need to add a new NuGet Repository. I’ve called it Local TeamCity  and the URL corresponds to the public URL provided to me by TeamCity in Step 1:

 

image

 

Notice that I have another entry which is Local TeamCity Auth which corresponds to the authenticated version.

Once we have this, we can now easily consume packages from our repository by merely specifying it in the Package Manager Console, either via the Combobox or explicitly in each call:

 

image

 

 

Summary

That’s all there is to it. By merely publishing our packages as artifacts, TeamCity now provides a full-fledged nuget server which opens up great possibilities when it comes to working and managing dependencies between projects. TeamCity is currently in EAP and much of what I’ve described here is in open to improvements. That is why your feedback is very important. Download 7 and start playing with it today. Let us know what you think.

Visual Studio Achievements: Who needs clean code anyway

Tags

,

I stumbled upon Visual Studio Achievements this morning via Maarten. The idea of combining development with game play might be enticing to some and as others have pointed out, could be a way to introduce younger generations to development and potentially get them interested. As such, the idea in itself is not an issue. What is however disturbing is the point system.

image

If you look carefully at the entries, you find that not only do some of them promote bad practices which lead to horrendous maintenance nightmares like the Region Manager

image

but a few of them are even geared more around selling higher end versions of the tool.

image

Were are the points for writing a Unit Test? Or keeping the number of lines in a method low?

As many of us have learnt ourselves through our mistakes, and are somehow trying to guide others in finding better ways to develop and write cleaner code, we are suddenly confronted with something that entices developers in the opposite direction. To those companies who waste millions having to maintain bad code or rewrite systems, this is not a game.

As it stands currently, that leaderboard should probably be renamed to “Hall of Shame”.

If this a joke, or the achievements points are not real, it would be a great opportunity for MS to really think through how they go about promoting this and what really does constitute a point.

ReSharper Settings in 6.1

Tags

,

This post is about ReSharper 6.1. For features in 6.0, please see previous posts introducing ReSharper 6:

 

EAP Warning: This post is based on ReSharper 6.1 Early Access Program and some things such as screenshots and minor details might vary from the time this has been written to the time of release.

 

This is a first in a series of posts about some of the new options available in terms of settings with ReSharper 6.1.

 

One of ReSharper’s pain points has always been settings, specially when it comes to managing them across projects and/or teams. With ReSharper 6.0 we started to make changes to build in support for a new way to manage settings, but unfortunately due to time constraints, we could not get it done in time for the 6.0 release. It has however made it into the 6.1.

Unified Settings Storage

An important change is that all settings have been unified into a single storage mechanism. This means that when you load or save settings, they apply to everything, from code style to templates, patterns and naming conventions. This should make it easier than before where different things were stored in different places.

 

Settings for every scenario

Everyone has their own style and methodology of working. Some like to name their properties in a certain way, others don’t like to be explicit about their privates. Some use underscores, others don’t. Some like the var suggestions. Others despise it. We are all different.

When it comes to working together, we have to make compromises and settle in a series of settings and ways in which to work. One day, hopefully, we won’t have this limitation and it will be transparent to us, but until then we need to find a way to not only cope with it but define it.

This scenario is very apparent when working on a team, but even as a solo developer, we can still require different settings based on different factors. We can be working on private projects that follow our own standards or be part of an open source team that follows the standards for the OSS project.

 

We hope with ReSharper’s new settings we can try and accommodate different scenarios. Let’s cover a few of the simpler ones.

 

Single developer and same settings for all solutions

If you are a solo developer or like to have the same settings across every single solution, then you won’t notice much difference in how you save your settings. You access the settings using the regular ReSharper | Options dialog and once done you press the Save button

image

 

These are also known as ReSharper Global Settings and are stored in

%AppData%\JetBrains\ReSharper\vAny\GlobalSettingsStorage.DotSettings

making them easily accessible for backup and restore as well as persistence during upgrades.

 

Different private settings on different solutions

Sometimes we’d like to have different settings based on different solutions, even if we are not necessarily sharing these settings with a team. We’ve made this scenario quite simple too. Once again we open up the ReSharper | Options dialog and make the required changes. This time however, instead of clicking on the Save button, we click on Save To and select  %SolutionName% Solution  – Private where %SolutionName% varies based on the active solution

image

 

This will create a file called %SolutionName%.SLN.DotSettings.user in the solution folder (in our case ConsoleApplication2.SLN.DotSettings.user) which holds the settings for this particular project. It is important to note that this file should not be checked in to source control as each user would have their own specific settings and thus one would override the other. We recommend that this file be added to the list of files to ignore by the VCS (i.e. add to .gitignore).

 

Shared team settings

The next step is to have a series of settings shared across the team. As you can guess from the previous screenshot, this is merely just choosing the next option down when saving settings:

 

image

 

which will create a a %SolutionName%.SLN.DotSettings file in the solution folder. This file should be checked in to source control.

 

These cover some of the simple scenarios when it comes to settings. However, sometimes it is not that simple. Often we want to have the best of both worlds. For instance, we might like to have team settings and tweak them a little bit to our own use. That’s where ReSharper’s smart settings come in.

Combining Settings: Layers

Settings in ReSharper are like onions, they have layers, and these layers, combined with what we call internally “smart savings”, provide more flexibility when it comes to tweaking settings.

Say for instance we are using some shared settings from a team settings file checked in with the project, yet there are certain settings we’d like to change privately that only affects us. How would we do this?

Quite simple. We modify the settings we want tweaked and then save it as Solution Private. ReSharper realizes that there are different values for a setting and the layering kicks in which one layer override another one. The actual order of the layering is:

 

image

Private Settings currently override Solution Shared, which in turn override Global settings. As such, by tweaking the settings to our individual needs (only those required), we can override specific team settings.

[Note: Some have mentioned that this wouldn’t enforce team settings. True, it does not, and we believe in discipline versus constraint.]

Managing Options

You might have noticed that in the ReSharper menu, as well as the Options dialog there is a new entry / button labeled “Manage Options” and “Manage…” respectively. These provide access to managing the different settings layers easily as well as importing/exporting and resetting.

image

 

When clicking on them, we’re displayed the following dialog:

image

 

The dialog box lists all the different layers currently available. Out of the box, ReSharper ships with the three we’ve already discussed: Global, Private and Shared with Team. Each of these are appropriately placed in the correct Group, which also happens to be three. From this dialog box we can edit each of these as well as import and export settings.

 

To edit specific settings, we merely select the one we’re interested in and click on the Edit… button on the top-left corner. This opens up the regular Options dialog box for us, with a minor difference. It now displays the name of the layer we are editing:

 

image

 

This difference is also apparent in that the Save To Button is no longer present, as when clicking Save we will automatically save the layer we are editing. When we edit the settings, only those of that specific layer are updated. Everything else stays intact.

Summary

The new ReSharper settings is hopefully designed in a way which allows to not only ease the pain of sharing settings, but provide for a variety of options and maximum flexibility. In the next parts we’ll cover how to add additional layers (including storing settings on Dropbox for instance), re-order, as well as importing and exporting of old and new settings.

Como en España no se vive en ninguna parte

Esas ganas de vivir, unido a la pasión que nos caracteriza, las ganas de marcha y el buen tiempo. ¿Cómo vamos a negar que mejor que en España no se vive en ninguna parte?

Pocos diran que en otro país se vive mejor. Menos los que viven aquí,  y mucho menos los que jamás han vivido en otros países. Crisis y corrupción hay en todas partes. Porque entonces dejar el buen tiempo para ir a otro país, ¿para enfrentarse a más de lo mismo, pero encima con lluvia?

¿Qué es vivir mejor?

Hay un refrán muy conocido que dice que en el resto del mundo se vive para trabajar, mientras que aquí en España, trabajamos para vivir.

Si vivir mejor es tener menos estrés, es pasar más tiempo haciendo lo que nos apetece, bien sea pasar tiempo con los nuestros o dedicarnos a nuestros hobbies, es poder llegar a fin de mes  y pagar nuestras deudas, y en general no tener tantas preocupaciones, entonces viendo el panorama en España, vamos por mal camino.

Según estudios realizados, somos entre los europeos que más trabajan; sí, estamos más tiempo en la oficina. Y no creo que sea porque estemos aún tomando la siesta o cogiendo tres horas para la comida. Encima, parece ser que somos los menos productivos.

Los sueldos en España son de los más bajos en Europa, por lo menos en comparación con países equiparables. Viendo el escenario, creo que es aceptable decir además que tenemos pocas opciones de encontrar mejores trabajos, siendo el paro básicamente el más alto de Europa.

Obviamente todo esto contribuyo a un poder adquisitivo más bajo, a mayor estrés para pagar deudas y en consecuencia a peor calidad de vida.

Y el futuro no es muy alentador.

Aquellos maravillosos años

La última vez que hubo un cambio de gobierno, fue con la salida del PSOE y 13 años de Felipe Gonzalez, para dar paso a Aznar. Fue la época del inicio del boom, ese boom inmobiliario que situó a España como referente mundial del crecimiento.

En esos tiempos, yo estaba acabando la carrera de informática. El futuro profesional que me esperaba era entrar en el Parque Tecnológico cobrando 300 Euros al mes como becario o entrar en la construcción, cobrando 2.000 Euros como albañil. Yo opté por programador. Otros no.
Muchos optaron por dejar su vocación, sus aspiraciones y cambiar de sector. Peor aún hubo quienes dejaron el colegio y los estudios para ser peones.

Sin embargo, todo marchaba bien. Esos mismos compraron casas, coches, segundas casas, bueno…para que voy a contar, si es bien sabido lo que pasó.

La burbuja explotó y dejó paso al escenario actual, un escenario desolador, donde no solamente hay paro sino hay años perdidos, años donde se desaprovechó la oportunidad de crecer profesionalmente, de mejorar en las vocaciones, de aprender. Se tiró toda una oportunidad por la borda. Se fue al dinero fácil. El que no se hizo albañil, se hice vendedor de inmobiliaria.

Hay quienes culpan al PSOE de todos los males. Hay otros que culpan al Partido Popular de permitir todos esos males. Claro que en esa época de la bonanza, ¿quien se iba a oponer al libre mercado?. Lo importante sin embargo, es tener a alguien a quien culpar menos a uno mismo.

¿El cambio llegará?

En las próximas elecciones lo más probable es que haya un cambio de gobierno. Y muchos tienen puestos sus esperanzas en ese cambio, creo que incluso más que los americanos lo tenían puestos en Obama. Hay quienes creen que con un nuevo cambio de gobierno, empezará otra bonanza. Pero no será así. Lamentablemente el cambio no va llegar con el gobierno. Esta vez no.

El cambio llegará cuando nos despertemos y nos demos cuenta de los errores que hemos cometido y de los que seguimos cometiendo, es decir, darnos cuenta que no hemos aprendido de nuestros males.

El cambio llegará cuando nos acordemos de cómo nos quejábamos cuando éramos simples trabajadores cobrando 600 euros mensuales y ahora como empresarios estamos pagando a nuestros trabajadores 600 euros mensuales.

El cambio llegará cuando nos demos cuenta de lo importante que es invertir en el continuo aprendizaje, en cultura.

El cambio llegará cuando entendamos lo que es un trato a cliente, lo que es el buen servicio.

El cambio llegará cuando aceptamos que pueda haber mejor vida de la que nosotros conocemos.

Pero sobre todo, el cambio llegará cuando no nos conformemos.

Hasta entonces, seguiremos diciendo que como en España no se vive en ninguna parte. Y puede ser cierto, pero será porque por el camino se nos ha olvidado lo que es vivir.

Streamlining Issue Management with GitHub and YouTrack

Tags

,

The Typical Developer Workflow

image

* Thanks to @gregyoung for enriching me with whatthecommit.com

In general, as developers we hate uninteresting tasks such as managing issues, so the less time and effort we spend in tracking bugs and features the better. The worse case scenario is the one outlined in the previous workflow, i.e. work on a bug, comment the fix in source control and then separately manage the issue in an issue tracker. Ideally, we’d like to only have to indicate what we’ve worked on and how it’s related to a check-in once! And fortunately with YouTrack, we can. However, YouTrack goes one step further. It actually allows us to control issues from our source control. Let’s see how this plays out when it comes to using GitHub.

 

In essence we have two options when it comes to integration GitHub:

  • Directly via GitHub Service Hooks.
  • Use TeamCity as the gateway, which in itself offers other advantages (opening it up to other VCS’s too).

 

We’ll cover each of these in detail.

YouTrack and GitHub Service Hooks

Earlier this year, GitHub provided official support for YouTrack hooks, allowing for tight integration between the two systems. This makes it extremely easy to set up YouTrack for issue management.

Assuming we have a project already set up on YouTrack and GitHub:

1.  Click on the project in GitHub and select Admin

2. Select the Service Hooks from the left-hand side menu

image

3. At the very bottom of the list of Service Hooks, select YouTrack

image

4. Enter the following information in the form provided

image

A few things to note here:

  • Base Url is the url of your YouTrack server, which is independent of the actual project.
  • Committers is the group in YouTrack that has permission to commit to source code for the particular.
  • Username should be a user on YouTrack with Server Admin rights [In an upcoming release this will change to only require Project Admin rights].

 

5. Switching over to the YouTrack side, the only thing required is the to create the Committers group and add the correct users to it. This step isn’t required but it’s good practice to limit the users that can update an issue to those associated with the project.

6. A last important step (which is performed once only)  is to make sure the REST interface is activated on YouTrack (via the Administration Settings)

image

Putting it to work – Hello YouTrack Commands

Now that we have the two systems linked up, how do we actually get this to work? If you’re not familiar with YouTrack, you might not know about an amazing feature it has called commands.

When most people look at YouTrack, all the see is just another web application with links to click on. However, the true power of YouTrack is in it’s support for commands, which is basically a way of sending it different pieces of text that it understands. This is normally done using the Invoke Command window (Alt+Ctrl+J…yes YouTrack is VERY keyboard friendly):

image

We start typing text and YouTrack offers us completion and tries to figure out what we’re trying to do. It’s smart enough that it doesn’t need us to spell things out, i.e. instead of having to type “state: fixed assignee: hhariri”, we can just type “fixed hhariri” and it figures out the rest:

image

It even remembers recent commands we’ve applied to offer the same combinations to us on the next input.

Now if we take this concept of commands and combine that with the usually useless commit messages we can actually come up with something useful! We can use the commit messages to send YouTrack commands (in fact, with YouTrackSharp I’ve started implementing PowerShell commandlets to allow console support for YouTrack too). As such, from our console our Git GUI we can do the following:

image

What we’ve done here is provide a command as commit message. We’ve identified the issue we’re going to apply the command to (issue Id prefixed with #) and followed it by the command Fixed.

Once we do this and push it to GitHub, the Service Hooks in GitHub will now supply this information to YouTrack, which in turn parses the command and applies it to the issue:

image

Notice a few things here:

  • The issue’s history has been updated with the date/time it was resolved along with a comment saying it was emitted via commit by hhariri.
  • The issue has been actually marked as Fixed.
  • The Username is clickable. It has correctly identified the username that checked in and mapped that to the YouTrack user. How does it do know that? Simple. It’s based on the email address. That’s why it’s important to have the correct email address associated with both account.

Multiple Issues

YouTrack also supports multiple issues being updated via the commit message. In order to do this via the commit message, each issue should be on it’s own line (i.e. when using the console, don’t provide the –m option with the commit and have Git prompt you with an editor to input comments).

Also it is important to note that the commit messages are not limited to just the “Fixed” command, but other commands can also be added such as tagging an issue, etc. (comments currently is not supported).

Integrating GitHub (or any VCS) with YouTrack via TeamCity

The second option for integration between YouTrack and GitHub is using TeamCity as the gateway. The advantage to this mechanism (apart from using TeamCity!) is that it now opens the door to more VCS options, including Subersion, Perforce, Git, Hg and all VCS’s that TeamCity supports.

The steps to integrate YouTrack and TeamCity are pretty straightforward:

1. Click on YouTrack Administration and select TeamCity Integration

image

2. Select to Enable TeamCity Integration and click on the Add TeamCity Server link

image

Enter the information as described in the dialog box and click Save.

3. Once the server is set up, we now need to define the mappings between TeamCity and YouTrack projects. For that, we click on the define mapping link:

image

We need to define pretty much all the values in the dialog box (which are self-descriptive).

In addition to the minimum required settings, we can also define restrictions on which groups have access to viewing issues via the Permissions tab, as well define a default command to be set on issues affected by failed builds:

image

4. In order to get the User Mapping, YouTrack like before uses the Email address. As such, we need to make sure that our VCS is configured to map to email. This is done on the TeamCity side under My Settings and Tools which is located under the Username menu [Note we have now switched to TeamCity]:

image

We edit the corresponding settings and set the Git roots to use email:

image

5. That’s all that is needed in order to get VCS commands working via TeamCity acting as gateway. This will now provide us information and output like the following in YouTrack when sending a fixed command via a commit message:

image

With this, a new Tab appears on YouTrack named TeamCity which contains information about the commit being made along with a link to the username.

We could in essence stop right here. The next step however is to go full force and get some of the added benefits of integrating TeamCity and YouTrack, this time from TeamCity’s side.

6. Under TeamCity Adminsitration click on Server Configuration and then on the Issue Tracker tab

image

7. We now need to create a new connection by clicking on Create New Connection, and entering the following information:

image

Once we test the connection we can click Create and we’re done. From this point on, we can click on Changes and have drill-down information on issues, link directly to them, etc.

Summary

As we can see, there are two ways to integrate YouTrack and TeamCity. The former requires a little bit less of a setup but is restricted to GitHub (currently). The latter gives us the full benefit of having a tight integration between TeamCity and YouTrack and opens up the door to using any VCS that TeamCity supports.

Most importantly however, the purpose of all this is to streamline the process, making issue management simple, non-intrusive and easy to work with.

 

[Note: If you’re an OSS project lead, note that TeamCity and YouTrack Integration are already setup on Codebetter.com. Ping me if you need help setting up your project details to take advantage of what’s been explained here].

Follow

Get every new post delivered to your Inbox.