Move YouTrack to another Server

Whilst in the midst of moving over to another server, one of the challenges facing us was to move our TeamCity and YouTrack instances over as well.

TeamCity couldn’t really have been easier!  The database can easily be backed up and restored through the GUI and worked first time.

YouTrack however is a completely different story!!!!!  Whilst you can easily backup the database, there is no GUI for restoring the backup!  Quite why JetBrains have to this day omitted this functionality from such a great product is completely mystifying!  However, they are resources in their documentation on how to restore a database…….but they don’t work!!!  I won’t go into the details why, but will point to you to the webpage that helped me identify and fix the problem.

Restoring YouTrack Backups

In essence though the process to restore a backup should be (changes from the JetBrains documentation are in bold)….

  1. Logout of YouTrack
  2. Stop the YouTrack service
  3. Remove the existing 00000000000.xd file from your YouTrack database directory (your file name maybe slightly different)
  4. Copy over your backup *.xd files into the database location – mine were called (00000010g00.xd, 00000010o00.xd, 00000011000.xd)
  5. Copy over your blob directory into the existing blob directory
  6. Leave all the other files in place and untouched
  7. Restart the YouTrack service
  8. Login under the root account
  9. You should now see your restored issues

Thanks JetBrains for creating some fantastic products, but please fix your documentation and please supply a GUI to restore a backup just like you have for TeamCity.

Biggest thanks of all though go to Jammer for solving it 🙂

System.ServiceModel.FaultException in IIS

Had a very strange error the other day when migrating a project from using the Visual Studio IIS Express to the local IIS.

The project was a WebAPI that interfaced down to a Microsoft Dynamics CRM 2015 instance on the same box and had been working well within the Visual Studio environment.  However, as soon as the project was deployed to the local IIS instance the connection to the CRM was failing with a rather obscure System.ServiceModel.FaultException.  Unfortunately, there was little else in the exception details to go on and an initial Google search yielded little help aswell.

After many different tests to try and isolate the issue I finally found the reason for the failure which was the authentication was failing.  Again, after a few more tests I still couldn’t get the authentication to work, but eventually came across one guys answer to a similar problem on Stack Exchange (http://stackoverflow.com/questions/5981167/error-message-the-request-for-security-token-could-not-be-satisfied-be).  Scroll down to the first answer (Sixto) and he mentions that you need to change the AppPool identity!  Voila!  The default Identity setting is ApplicationPoolIdentity which is great if you are simply reading and running the code in ASP.NET pages, however this won’t allow access to databases etc… and you need to change the identity to a user that has been granted access to whatever resource your webpage is trying to gain access too.

Here is a page with some more details on the different web servers Visual Studio can use along with the advantages and disadvantages of each.

https://msdn.microsoft.com/en-us/library/58wxa9w5%28v=vs.120%29.aspx?f=255&MSPPError=-2147217396#iisexpressdisadvantages

 

 

 

Asset Editor

In a previous post, we mentioned one of the many challenges we faced when implementing this product for the client.  At this stage the product is under trial to prove the concept for management in order to progress to the next stage of roll-out.

The next stage of the product would be to essentially clean up, fine-tune and hopefully re-engineer the product to better suit it to the environment that it will ultimately live in.  At the start of the project, the client didn’t have some necessary things in place for connecting to ArcGIS, so a different method was used to implement the mapping and linear referencing system.  Unfortunately this older system required WinForms to be used when we would have preferred to implement in WPF as the tablets that were to be used were using Windows 8.1 (comparison: old but still valid).

As is the case with many initial projects that are under time constraints as well as technology constraints, we reflect on the past work as we progress and see ways of improving.  Given all of the initial technological hurdles have been resolved and the product works, the re-work of the application will result in a more robust and cleaner application for the client.  Thankfully with our application architecture, we built it using an MVP pattern, so the majority of the business logic code is separated from the view therefore making the transition to a WPF application will be so much easier.

ArcGIS API for Javascript and CEF

With our latest project (Asset Editor) we came up with a number of challenges to overcome in order to deliver a successful application.  Probably the biggest challenge was the integration of a live map using the client’s ArcGIS.

Normally the implementation of a view of ArcGIS in Chrome or IE is simple given the excellent API supplied by Esri, however we needed to have this view within an application rather than a web browser.  In the past we used Microsoft’s WebBrowser control, but given the restrictions in place on the client’s device and the restrictions on the API for ArcGIS, we needed to look at another solution.  To achieve this we looked at CEF and CefSharp which can be used without installation and comes with a fantastic  set of DevTools amongst other benefits (speed etc…).  Implementation of CEF wasn’t necessarily straight forward, but after creating some test apps to prove that the concept would work, we were able to create the same framework that we would normally have created using the old WebBrowser control.  The support for Javascript integration is great and really easy to implement and allowed us to nicely integrate the control into our code and provide the necessary couplings between web browser, ArcGIS and the back end.

AssetEditor2

 

Corridor Tracker

During some work on a new project for a client we needed to be able to define boundaries for physical map areas (e.g. rail corridors).  Given that the project was for rail vehicles, there was only certain areas on the map where the vehicle could enter and exit these boundaries.

We used Google Earth to define these boundaries using polygons that covered the boundary positions for both entry and exit (separate ones for each).  The polygons were structured in Google Earth to provide a simple hierarchy that would provide extra information where needed (e.g. corridor name, owner, operator etc…).  The polygons were then exported to the usual KML file.  Given that the KML file is a standard and the format is in XML we then simply imported the file into our project to generate data type classes that could read in the file.  Understanding of course that a change to the KML specification and therefore a potential change to the format would break the import!!!  This particular case would be handled externally to these generated classes.

With all of this in place we were able to easily provide the client with a configurable definition of their rail corridors that could be read in and subsequently viewed in the applications Google Maps window and processed according to the vehicles current position.

GitHub, YouTrack and TeamCity

After using Subversion, TeamCity and Trac for some time, I decided that it was time to investigate whats new in the work of source control, automated builds, support for agile etc…  After previous work with TeamCity, I was excited to see that JetBrains had come up with their own issue management system called YouTrack that comes complete with all the bell and whistles, Agile, TeamCity integration, backing up, ability of handle multiple repository types… and the list goes on.  I have to say that this is an excellent product and smashes all of the competition out of the water (in my humble opinion).

Following from this it was also time to move to a more future proof source control.  I’ve been using Subversion for some time now and yes it hasn’t missed a beat, but I’ve always found to awkward to setup, maintain, backup etc…  With this in mind I finally moved over to GitHub and it’s been great.  Easy import of the Subversion repositories, easy integration into Visual Studio and the stand-alone GitHub windows app if you need.  Support in both TeamCity and YouTrack is just the icing on the cake 🙂

AGMS Controller

We’ve been working on the AGMS Controller for some time now with the QueenslandRail contract and lots of good stuff has gone into it.  However, we recently added station and timetable reporting (On-Time-Running) which has been an interesting piece of work.

Both AGMS systems run on the North Coast line and Mount Isa line in Queensland and given the vast distances of the journeys (> 1000km) the train journeys run over night.  We needed to come up with a system that would first track the vehicles through configured locations (stations) and actively determine what timetable the vehicle was running too.  This would be relatively easy if we just consider the existing vehicles and their simple timetables, but we wanted to make the system capable of handling the suburban system if required (as QueenslandRail have a pretty basic method of determining On-Time-Running….and potentially fudgable!!!!!).

The resultant system needed to handle the following circumstances:

  • running through the night and into the next day;
  • tracking late trains to the correct timetable, as the suburban timetables run every 15 minutes on some lines;
  • handling missing a station (bad GPS, loss of power etc…);
  • handle trains that don’t complete the expected run (break-down, turn-back);

The timetable matching algorithm was based on a number of parameters that scored each timetable as each station was reached.  If any one timetable matched a number of criteria (score over 50% being one), then it was determined to be the correct timetable and emailed out an End of Run Report (see the screenshot below)

AGMS2TimetableThe system primarily used our configurable StateEngine library to implement 2 continuously running process.  The first was one process to take incoming GPS data, match it to configured stations and fire events to inform subscribers that a station had been reached.  The second process subscribed to the station event and used this information to compile and score all of the configured timetables within the system, with the ultimate goal of firing a timetable complete event.

Subversion, TeamCity and Trac

A while back aftermoving house, I thought it time to revisit our source control and Continuous Integration setup. We had been using CSV, CruiseControl and Bugzilla for the best part of about 10 years without any major issues, but we guessed you can’t improve yourselves if you don’t try new things, so here we are!

After much searching we plumped for the combination of Subversion, Jet Brains’ TeamCity and The Trac Project. First off the installation of each was quite a breeze compared to when we did this 10 years ago. Yes things have moved on, improved, Google etc… but it was nice for installations to go without a hitch. Having said that a few sites did help along the way.

For installing and setting up Subversion, we found this site extremely useful. Also, for any out there new to Subversion or indeed source control, this site here is a good resource

TeamCity (continuous integration), well there isn’t too much to say other than simple! We’ve been using ReSharper since about 2004 and have always loved it and once again Jet Brains have delivered.

Trac is a wiki and issue tracking system and as with the others, this was simple to setup and use.

Administrator User missing from Logon Screen

Just a quick one here!

A project that I am working on in Australia has numerous computers that auto-logon and I needed to logon as Administrator to sort some stuff out.

Now, these computers were all running XP but there isn’t an option to select the Administrator user at Logon!

Easy… just press Ctrl and Alt then press Del twice. Up pops the normal Windows logon screen where you simply change the user to Administrator 🙂

Database diagram support objects cannot be installed

Have you every received this message when you try to access Database Diagrams for SQL Server?

If so, there is a simple fix. You need to change to ownership of the database to a valid user on the computer that you are using like so:

EXEC sp_dbcmptlevel ‘<database-name>’, ’90’
go
ALTER AUTHORIZATION ON DATABASE::<database-name> TO “<valid-domain-and-user>”
go
use <database-name>
go
EXECUTE AS USER = N’dbo’ REVERT
go

Replace the text <database-name> with the name of the database that you can’t access the database diagrams for and also replace the text <valid-domain-and-user> with a valid entry such as: RUSS-LAPTOP\Russ.

This worked a treat for me and hopefully it will for you too. If it doesn’t then you can also try the following to check the compatibility level and the db owner

1. Right Click on your database, choose Properties
2. Goto the Options Page
3. In the Dropdown at right labeled “Compatibility Level” choose “SQL Server 2005(90)”
4. Goto the Files Page
5. Enter “sa” in the owner textbox
6. Press OK and retry