Search This Blog

Monday, February 29, 2016

TFS integration

Since a couple of months I work with Team Foundation Server and I must say it really surprised me. At first I thought it would be an okish source control, and a sub par bug tracking tool (I was testing the express edition). Honestly the express edition is really bad compared to the full one.

We since installed the full version and here surprise, the bug tracking is good, the build server is actually useful (with the tests being run when I commit or on schedule), and there is so many useful features that it would really need a full article on it. Maybe later on I will do it.

For me TFS was also important to integrate with our own software such that in case of issues the software would automatically create a bug report. However people have the bad habit to reload multiple times the page even if it doesn't work ( Funny quote from Einstien ) and of course we end up having tons of duplicated bugs.

After a bit of playing and further researches I found it's possible to query the bugs and then just modify the existing one:

public static int AddBug(string title, string message)
{
    lock (lockObject)
    {
        Uri collectionUri = new Uri("http://tfs.psi.ch/tfs/DefaultCollection");
 
        var creds = new TfsClientCredentials(new SimpleWebTokenCredential("PSICH\\" + System.Configuration.ConfigurationManager.AppSettings["alfrescoUser"], System.Configuration.ConfigurationManager.AppSettings["alfrescoPassword"]));
        var tfs = new TfsTeamProjectCollection(collectionUri);
        // Get the work item store
        WorkItemStore wis = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
        Project tp = wis.Projects["Inventory"];
 
        WorkItemType wit = tp.WorkItemTypes["Bug"];
 
        var titleWithoutDate = title.Split(new string[] { " - " }, StringSplitOptions.None)[0];
 
        var existingWit = wis.Query("SELECT * FROM WorkItems WHERE [System.State] = 'New' AND [System.Title] CONTAINS '" + titleWithoutDate + "'").OfType<WorkItem>().FirstOrDefault();
        if (existingWit != null)
        {
            try
            {
                existingWit = wit.Store.GetWorkItem(existingWit.Id);
                existingWit.Fields["Repro Steps"].Value += "<br>-------------------------------------------<br>Reproduced again on " + DateTime.Now.ToString(System.Configuration.ConfigurationManager.AppSettings["ShortDate"]);
                existingWit.Save();
            }
            catch
            {
            }
            return existingWit.Id;
        }
 
        WorkItem wi = new WorkItem(wit);
        wi.Title = title;
        wi.Fields["Repro Steps"].Value = message;
        wi.State = "New";
        wi.Save();
        return wi.Id;
    }
}
So now it will search for a bug on the same URL and don't report twice the bug.

And the (ex-)student is.... out of the game

The guy which should work with me came today to discuss, and I had an hard time to explain why working on a mobile version of the soft was a bad idea, but after 1 hour of discussion I said, OK fine, let's see how you handle this small tests... and guess what? He failed! He's not able to fix a double loop.  Therefore for me he's out, no way has access to the code and the rights to publish the soft.

We shall see how it goes when we will discuss it with the bosses but now I have all what I need to refuse the "help".

LESS css

Technology evolves but some times standards don't evolve fast enough and then people find "work around" to add the missing pieces to some standard while keeping the standard as is.

What am I talking about yet? Well in this case I'm talking about LESS or SASS. Those are 2 CSS compiler which add missing features to CSS. For example, ever wondered why you can't define a color once in your CSS file and then re-use it multiple times? Why is that missing? Well the 2 allows to do that. Ever wondered why you can't include files in your CSS? Again the 2 can do that.

At the end, what you cannot do with CSS and should be able had been mostly added to those compilers which at the end produce valid CSS files. The advantage is that the standard doesn't need to be modified, existing browsers will work out of the box with the new features and yet we do have support for those missing features. The drawback is that you need an additional step => compiling your CSS. A little price for how much it adds.

In my case it has even the bonus that I could let the user choose the color scheme of his/her dream and the CSS will be updated accordingly.

For me the main features of those compilers are:

  • Variables
  • File includes
  • Mixins
  • Nesting
Personally I prefer LESS to SASS as LESS sticks more to CSS than SASS, but that's mostly a question of taste. Both offer basically the same features.

In any case I would strongly suggest any web developer to at least have a look to them and ideally jump on one of the 2.

Sunday, February 28, 2016

Azure Hosting

Azure Hosting... If you are not in the .NET world then either you don't have a clue what it is or you may think, yet another useless product from Microsoft.

Actually I'm surprised by the platform Microsoft created here. Sure you could see it as a "hosting" platform like there is many around, from the incredible Amazon AWS to Google, or the traditional VPS / Shared hosts you may find around. I have to admit I never used AWS or Google (or not so far), and with the hosting companies I tend to have a mixed feeling. From cheap and crappy offering to expensive one which at the end could end up badly after somebody tries to DDoS your site.

I tested many hosting and all come with their pro / cons.

Azure is for far another beast for me. First of all their portal is one of the most complex to start using. I never saw such interface and never had to click so many panels to do what I wanted, but after you took grip over it you start to understand why it's like that. Basically you can do all from there, from a simple free (yes really free) shared host to a full featured cloud VPS or cluster.

If you go for the payed services it will of course not be so cheap and you could find better options for less money but you will hardly have all the features offered like they offer it.

Some examples:
- Want to create a couple of web servers around the world? You can create as many hosts on nearly all around the globe at your choice.
- Want to see the events generated by your soft? Yes there is a panel for it.
- Want to create your own SQL server with backup and even replication? Yes you can as well.

Overall I find the experience quite incredible, even if takes a bit of time and efforts to understand it. After that you can develop your soft on your Visual Studio and press "publish" and have it running on your Azure host. Personally that's all I currently need for my hobby project.

Tile Maker

Started to work on a new hobby project, which I would for the moment don't explain fully as it could end up being a pure vaporware.

To test technologies, learn and possibly open the door to multiple hosting solution later on I thought why not test ASP.NET 5 which should open let us host the project even on Linux.

So far my first impression with ASP.NET 5 is not positive, and I would not recommend it for production soft. But maybe I'm just too used by previous ASP.NET versions to really enjoy the changes.

Beside fighting with ASP.NET which I somehow managed to make what I had in mind, I started to create the first module for my project, a tile maker. I made previously a tile maker for my Ludiculus project which was written fully in JS. This new project uses instead Typescript for the GUI (which here I can say it's really a step forward over JS).

The design of the new tile maker is a lot more structured than the previous one, and already contains more complex features like a Gaussian blur, or a mask / merge function.


My goal is to be able to have a good tile editor for the next step of the project. I'm unsure how good I will be able to be, and quite certainly it will never replace a Photoshop but it may serve its purpose of being something usable for those which don't have any tool.

By the way, the tiles in this screenshot have all been generated via code.

Stress for Monday

Let's start with what stress me currently. I work as full time developer / project leader in a research gov company, and this job has me made develop a web based software which keeps information about hardware components used to build up the different accelerators of the company.

This software started as a relatively simple "excel" to web port which allowed people to start working and keeping the information available to all, yet the software is a lot more complex with around 350 people using it.

Last September a student in computer science came in and said he will work on "optimizing" my soft, yet without first asking if there was any need. Optimizing for him include improving the user experience not just memory / speed. He started to discuss with the users without involving me at all, and asked them what they wanted as improvements. He came then in and started to list me all the changes that I would need to do. Oddly timing as I was already working on a rewrite of the soft, and guess what, most of what he asked was already in plan. Some of the requests he gave me could not even be implemented as one was the contrary of another... Nice planing.

Anyhow, beside that, he started to write a user manual again without talking to me, and once he nearly finished the poor guy had to rewrite it as I just deployed the new soft which basically changed the way to work. Next time plan and discuss first!

Last week I received an email that he want to create a mobile / tablet GUI for my soft, again without first discussing it and then I received an email from him to discuss with me as I "host" the soft.

Overall such impertinence is at the edge of what I can stand, and I doubt it will end up well.

You see that some times you spend a lot of time doing "politics" and not coding, and this kind of tasks are actually even more tiring.