My TM470 Blog

The Computing and IT Project

Freight Car Routing forModel Railroads



This blog is a blow by blow account of my journey through the project. As WordPress puts the blog back to front – the latest date at the top, which is great if you are following but lousy if you are a new reader – I will put an index here.

InThe Beginning
A Little Bit of History
Getting the System Running
Technical Background
A Quick Look at the Database
Data Flow
So, what does all this do?
Software flow – Menu
Quiet Progress but lots of thinking
Working on the Decision Engine
Decision Engine – Second Phase Scenarios
Back on the Road – 5th June

Week ending 11th June 2017
Week ending 18th June 2017
Week ending 25th June 2017
Week ending 2nd July 2017
Stakeholder Comments
Up to date plan of the SNE
Last Phase – The Android App – Starting 3rd July 2017
Week ending 16th July 2017
Week ending 23rd July 2017 The Big Rebuild
Week ending 30th July 2017
Week ending 5th August 2017
Week ending 12th August 2017
Week ending 19th August – Final software phase
Week ending 26th August 2017 – A bad start to the week
The final run in to the module end

Posted in Uncategorized | Leave a comment

The final run in to the module end

Well, I spent the last available week finishing off the End Of Module Assignment (EMA). I managed to write something about “stakeholders” and referred to the lack of literature. I also did a wrap up of problems.

Finally, an Epilogue covered all that I did after writing the bulk of the report and highlighted the issues that are still outstanding. The  body of the text was 11,784 words with the total coming in at 24,525 (who would have thought it possible?) once I finished it off, by including my JavaScript code and all of the content of this blog from the point where it became my project diary.

I submitted the EMA a couple of days ahead of schedule and then signed it off in my head as well. So that is it. I now have to wait until late November for the result. Quite simply if I get a grade 2, then I will finish my degree with a 2.1 whilst if I get a grade 3 it will be a 2.2. I would like a 2.1 but I can live with either.

I am NOT expecting to fail but one never knows. What happens if I fail? Well, my wife is against me continuing as she thinks that the studying has made my life difficult over the last 18 months or so and she wants me to stop, no matter what. I agree with here as I didn’t really expect it to be as hard as it was, given my knowledge of computing. However, that just shows how good the OU is in getting you up to modern standards. I now know an awful lot more than I did about the “really” modern world, even though I have been working within it quite successfully.

So, if I did fail, what then. Well I currently have a B.Sc. but I wasn’t able to take it as that would have stopped me working for “Honours”. I don’t understand that but that is how it works. So, a failure in TM470 would see me taking the B.Sc. and writing off the last couple of courses.

It will not happen!

I thought that I would finish off this blog by describing the final state of the project:


Now that the final project report is written and settled, I think that it is time to think about the future.

Following the discussion regarding the outstanding issues, time was taken after completion of the bulk of this report to think again about further work on the Decision Engine(DE). As part of this, the automated process of running three daily schedules was completed to find out what happened over a period of time. It was expected that the routing would over allocate cars to tracks with limited space. This was, in fact, the case. However, a bigger problem became apparent which had nothing to do with the efficiency, or otherwise, of the software itself. This was that, over time, more trains were running with zero freight cars. On analysis, this turned out to be because of the seed listing of available cars. As cars placed on site had to stay for minimum periods of time, eventually, too many cars were locked up on site leaving not enough in the staging areas to keep the traffic flowing.

Further investigation showed that this was because of the limited number of cars available. The list of freight cars for my own railroad was worked out against expected traffic flows, before there was a system that I could run. The number of cars listed – 23 excluding cabooses – seemed to be the right number.  However, now, it would seem that more cars on the roster would help keep the flow of traffic across multiple daily schedules. Initial investigations suggest that a 50% increase in cars would create a better flow. On a personal basis, as each freight car costs around £20.00, an investment of £240.00 would be needed. This may have to take place over a period of time. In the meantime, further coding will be needed on the DE to alleviate the over-allocation.

Posted in Uncategorized | Leave a comment

Week ending 26th August 2017 – A bad start to the week

Sunday 20th August 2017

I spent a long day from 10am until 6.30pm trying to sort out the mess that I was making. I came back to coding at 7.30 and realised that it was unrecoverable. I threw away all of the day’s code and went back to close of day Saturday where, at least, the JSON export was coherent. In the process, I lost the HTML formatting of the visual displays but the work there was easy and obvious so it didn’t hurt the plan.

Monday was supposed to be the first day of work on the EMA but that has to go back to Tuesday now.

I cleaned up both coding environments – Smalltalk and JavaScript and packaged up a clean set for Monday morning.

Monday – Tuesday 21st/22nd August 2017

I am very glad that I did what I did. A couple of hours each day and suddenly everything is looking much better.  I think that I now have the JavaScript doing what I need it to do. All I have now is a couple of irritating bugs in the Smalltalk back end, which I should be able to clear “out of hours” as it were – in other words, Must get on with the EMA and find some time in the evenings to sort out the little bugs.

I was on my own Tuesday evening – wife went to stay with her mother – so I got onto the Smalltalk issues. The first thing that I did was to put in some proper logging so that I could see, immediately, when anything came from the Android stuff. I then sorted out all of the little bugs. I have one biggie left, which I will do before the end of the week.

Thursday 24th August 2017

I have now started work on the EMA. I spent the whole two hours today getting into the swing just writing rather than coding. My new MacBookPro works very well on my new  computer stand with me sitting in my orthopaedic armchair so I can get on rapidly.

I spent the afternoon trying to get Cordova to create an Android app. This proved to be a tricky process and I had to go back to a tutorial that I bought when doing TM352 for guidance. That and a youtube video sorted out the issue and I now have the app working on my Lenovo 10″ tablet. This is the intended target for the app so it is good to see it working properly. Only one trouble! Nothing works 😦

I should know by now the pitfalls of self testing. When running under the Chrome emulator, I use a keyboard to enter the username and password. On the tablet, I have to use the touch keyboard. I didn’t notice that the touch keyboard was, automatically, putting the first letter into upper case. This is normal for phone/tablet input but I missed it. Of course, the username on the back end is case sensitive! Once I sorted out that problem – sending asLowercase to the incoming username sorted that one as I didn’t want to keep messing about changing the keyboard to lower case all the time. Here are a couple of examples of the “current train” output.

I had an interesting session on one of the US forums but I will keep that for another day.

Posted in Uncategorized | Leave a comment

Week ending 19th August 2017 – Final software phase


Conductor – person in charge of the train (UK equivalent – Guard).
Dispatcher – person in overall control of train movements over a railroad division
Division – Track between two major yards of a railroad.
Hostler – person that operates a loco within a yard and builds trains as required.

Sunday/Monday 13th/14th August

This was a difficult and frantic period where I “had” to get the car allocation software working. Having cleared all of the hang overs from the data import issue, this period was spent carefully stepping through each of the train types ensuring that car allocations were being made in an appropriate manner for each type. Finally, this was completed and the software was versioned off. There are a few, very minor, issues that I will deal with as an epilogue once the report is complete.

Tuesday 15th August

The day was spent working on the visual interface for the tablet software. I decided that the best way to display each train makeup was to recreate prototype railroad switch lists and train orders. Switch lists given to”conductors” of freight trains and/or the freight yard “hostlers” indicating the make up of each train. Train orders are used by railroad “dispatchers” to authorise trains to use the track between “division points”.

Switch List

Train Order

To do this, it is necessary to know the home railroad of each train. As the test system includes trains from three railroads, it was necessary to add a new data topic to the database – “railroad”. This comprises details of:
Railroad Name
Railroad URL “the railroad logo”
Railroad Initials.

The Smalltalk software is quickly and easily amended to create and utilise a new Riak bucket for the user comprising of list of these railroads. The JavaScript was then updated to display the headers. The mock up looks like this (created in iMac Komposer):

I do not know how to use JavaScript to create tables with merged cells (required for this) so, by using Komposer I was able to list out the HTML code and recreate this in a javaScript method – sorry, function.

<table style="text-align: left; width: 100%;" border="1" 
cellspacing="2" frame="box" rules="none">
<td colspan="3" rowspan="1"
style="vertical-align: top; text-align: center;">Sunset and North
Eastern Railroad</td>
<td colspan="1" rowspan="3" style="vertical-align: top;"><img
style="width: 166px; height: 62px;" alt=""
<td style="vertical-align: top;">Train: SNE1</td>
<td colspan="2" rowspan="1" style="vertical-align: top;">Date:
15th August 2017</td>
<td style="vertical-align: top;">Engine: SNE1441</td>
<td style="vertical-align: top;">Type: EMD f7a</td>
<td style="vertical-align: top;"> DCC ID: 1441</td>

The JavaScript (with data hard coded) looks like this:

function switchListHeader(switchData) {

var swText = "";

swText = "<table style=\"text-align: left; width: 100%;\" border=\"1\" cellpadding=\"2\" cellspacing=\"2\" frame=\"box\" rules=\"none\">";
 swText = swText + "<tbody><tr><td colspan=\"3\" rowspan=\"1\" style=\"vertical-align: top; text-align: center;\">Sunset and North Eastern Railroad</td>";
 swText = swText + "<td colspan=\"1\" rowspan=\"3\" style=\"vertical-align: top;\"><img style=\"width: 166px;\" alt=\"\" src=\"\"></td>";
 swText = swText + "</tr><tr><td style=\"vertical-align: top;\">Train: SNE1</td><td colspan=\"2\" rowspan=\"1\" style=\"vertical-align: top;\">Date:15th August 2017</td></tr>";
 swText = swText + "<tr><td style=\"vertical-align: top;\">Engine: SNE1441</td><td style=\"vertical-align: top;\">Type: EMD f7a</td><td style=\"vertical-align: top;\"> DCC ID: 1441</td></tr>";
 swText = swText + "</tbody></table>";
 return swText;

(The above panel scrolls so that you can see all of the code in line). swText is the HTML to display the above switch list. Not nice but functional.  The hard coded data is highlighted. I now need use the railroad data to make a list of objects that can be fed into this function. That is my task when I get back to this on Thursday.

Thursday 17th August – Saturday 19th August

The time went in a blur. I felt as though I was on a home run. However, as is the way with software, it all came back to bite me. Firstly, I had an issue when versioning off some of the new Smalltalk code. Rather than explore what the problem was, I thought that I had solved it quickly when in fact I had thrown the version away. I have been using the Envy code repository built into VisualAge Smalltalk ever since 1994 so I ought to know what I am doing. Anyway, when I came back to it on Thursday there was absolute chaos and nothing worked as it should. I must be getting old because, instead of investigating, I started to make a few (HA!) changes before I realised that something crucial was missing. Having was ted most of the day, Found out in time and was able to recover the missing code. One of the nice things about Envy is that every single change is recorded so you can go back a step at a time, even down to individual method code. Finally, close to late evening, I got it all back and sorted. Saturday was even worse as I was having trouble with differences in structures of list of cars between various train types. I did classic mistake and started changing the code against what I was seeing rather than examining the changes over all the types. As a consequence, as I changed the second train type, I messed up the first, and so on! Spoiler alert! – This didn’t get any better on Sunday .

Posted in Uncategorized | Leave a comment

Week ending 12th August

Monday 7th August 2017

Finished off the formatting of the “next train” data so that it is a simple parsing exercise in the JavaScript. My lack of expertise is showing here as I have to go very carefully to ensure that I get things right. Also, I am having some difficulty working out how the Chrome  debugger works when editing code. It seems to have some esoteric rules and I haven’t yet grasped them all. I am tending to fall back on the old “edit – run – try in Chrome” loop that isn’t at all productive but ensures that changes get disemminated through the working stuff. It seems that Chrome doesn’t like you changing function names, nor does it like to changing some variable names. As an example, if I write myArray.split(“;”) and then change it to myFirstArray.split(“;”), it will complain that myArray.split isn’t a function! Anyway, I finally got everything tidy and I can now show the details of the next train. My next step is to have an option to instruct the backend to move all of the constituent parts of the train onto the new destinations and increment the train number. This will be tomorrow’s task.

Tuesday 8th August 2017

Today was, hopefully, the last day of actual new development on the tablet app. The “Update a train” function now works and it is possible to cycle through the whole timetable of trains correctly. The formatting took some time as I had to work on both the back end and the front end. The front end works by calling a “hidden” GET. Normally, a GET should not be used to update data but I had a lot of difficulty getting POST to work from javaScript. In fact, I had the same problem in the EMA for Tm352. As I am getting close to the cut off for development, I made a decision to use a GET. However, the get is fired by a button so the normal argument about GET calls updating data doesn’t apply. The concern is usually about exposed GETs being fired by crawlers, etc. but this GET, as I say, is never exposed so it will be fine.

All I have left to do now is to tidy up the presentation, which I am going to leave until I have made a good start on the 10,000 word EMA. That is the priority now. On Thursday, I will start outlining it and analysing what I can use from the TMAs.

Thursday 10th August 2017

I realised, when thinking about the back end code, that I hadn’t resolved one thing that I meant to do some time ago. After the last train on the list of “Trains” has been run and updated, the code changes the current train number back to 1 so that the list can be run again. What I had missed doing was incrementing the ‘time on site” for each freight car. It is assumed that the list of trains represents one day so once that list is completed, a new day will start, hence the cars on site will need to have their status updated. This is needed because the logic that assesses whether a car can be included in a train depends on the “time on site” number associated with that car. This is now fixed and once the train list is completed, each car will get that increment. When they are relocated, that number is put back to zero once again, ready for the next move. The number is ignored if cars are in a staging spur or in a yard as they are then regarded either as “fair game” because they are off site or as empty and ready for re-allocation.

My task for the next week or so is trying to understand the relationship between HTML and JavaScript for purely display purposes. I need to get the index.html page to refer back to the JS file for logo and railroad name ids, which are only found out from the login. So far, I have not had much luck in getting the inline scripts to function. I have one week to sort this and then I must get on with the EMA.

My tutor wants me to use a couple of his contacts as tester. Initially, I said yes but I have had to reconsider. I have lost a lot of time due to the overrun of TM352, my arthritis and hospital treatment so I really don’t have the time now to start interacting with new references and responding to requests for explanations or ideas when I have 10,000 words to write and neither of the proposed testers have knowledge of the  project domain. I hope that this won’t affect my marks but I will need to discuss it in my EMA.

Friday 11th August/Saturday 12th August 2017

Getting back onto the actual routing software, I had bit of an issue. I wanted to go back to a clean startup and found that the Excel files that I use for this were not the final version. I had a rebuild of my main iMac recently and my backups, whilst there, wouldn’t come back fully so I was in a bit of a muddle regarding the coherence of the data. I had to spend some time, not only correcting the files, but also changing the import software to add some extra features required for the routing.

This all resulted in time beings spent on, what might be called, unproductive work. Having sorted out the issue, I then started on the main project for the weekend, which was to get the actual routing software developed. I am running out of programming time so I have had to make some compromises with the routing software. I have, for this iteration, simplified some of the decision making processes. Yet again, my arthritis and other issues have interjected themselves with me having to cope with both pain and tiredness. However, I managed to put in a couple of 8 hour days which has got me a good way forward.

The coming week has three targets:

  1. Complete the routing software so that all types of trains can be created and routed.
  2. To incorporate any changes into the tablet software.
  3. To tidy up the visual interface for the tablet.

Once these tasks are completed, and I need to put 9n the hours to ensure that they are, then I can get going on the EMA.

Posted in Uncategorized | Leave a comment

Week ending 5th August

Sunday 30th July

Didn’t get very far today – my arthritis is causing me some problems.

Monday 31st July

Today was a big review of the JSON being sent to the app. My software likes the format, JSONLint (which is a JSON checker) likes my formatting but the JavaScript throws it out. I have done a lot of checking and have changed the JSON format just for the app. At least the JS isn’t complaining any more but I only get one line of data from my JS formatting for the table. I have run out of time today so I will sort this little issue tomorrow.

Tuesday 1st August

I spent much of my time trying to find out why the JavaScript JSON parser was only returning the last line of my data. In the end, with time flying away, I decided that I have to get the basic functionality working. To this end, I rewrote the Smalltalk back end so that it returns a formatted string of the data for each of the ‘Trains, “Tracks, ‘Routes’ and ‘Towns’. Once I did this, I was able to parse out the wanted stuff and, as the allocated two hours came to an end, saw the four data pages be shown and formatted correctly. There are some small reworks to take place but nothing major – except that I am not sure how to do these in JavaScript.

I have spent a lot of time recently with JavaScript but I find it quite frustrating. I am used to working within a dynamic IDE structure. In Smalltalk it is possible to change the code in a running program but in JavaScript I have to keep killing the process and restarting at every minor change (unless there is something in there that I am missing). However, I am managing to code and get something running, which I would not have believed 6 months ago! Next session, I will have a go at getting the “Next Train” functions to work.

***Note from Friday – I experimented and found out that I can dynamically rewrite the JavaScript inside Chrome. I didn’t know this. Now, I can make changes on the fly which is much more like my Smalltalk environment. I tried to change the HTML, but it won’t let that happen – no surprises there, of course.

Wednesday 2nd August

Working to day instead of Thursday (shopping to do!). I have now sorted out the extraneous characters coming through from the database and all of the displays now look close to the final version. They need someTLC but that will have to wait until I have finished all the other code as this TLC isn’t vital. I have been trying to get the custom railroad logo to come up on the display pages but I can’t get the JavaScript connection to work for code inline to HTML. Again, this will now have to wait until I have got the rest of the code working.

Carried on later and got the Smalltalk backend to supply the “next train”. I am having some fun getting the JavaScript formatting to work on this. It is a bit of a puzzle as the code really shouldn’t be an different from that used to display the other data. Back to work on this on Saturday afternoon for a few hours.

Saturday 5th August

Working on the Next Train display but having some trouble parsing out the Json. Time is passing so, again, it has been expedient to reformat the returning string into a simpler format. I ran out of time to complete this so I have out the completion off until Monday (I am out all day Sunday).

Posted in Uncategorized | Leave a comment

Week ending 29th July

Sunday 23rd July

Had to put up a curtain rail yesterday afternoon so, courtesy of my arthritis, I am struggling to concentrate this morning. Never mind. I intend to investigate to see what it can do for me over the next few days whilst I program just the tablet interface.

Monday 24th July

Managed two sessions today in an effort to catch up with the time I lost last week. Firstly, just to mention it, I have not had my TMA 03 back yet so I have no feedback on my current progress. I have complained to the Student support.

I spent some time messing about with logos etc. but went down a blind alley so decided that I could do without for the time being. I am now using jQuery to put the horizontal buttons in correctly. There was some extra code needed in the back end as, currently, the only option for data from the server was for client specific data. The back end can now deliver specific data types such as locos, cars, etc.

I finished the day with the “View Data” page showing the correct heading and the JavaScript holding the requisite JSON data set. Target for tomorrow is to put these data sets into tables on the mobile screen.

Screen Shot 2017-07-25 at 10.43.31

Tuesday 25th July

I spent the whole two hours trying to figure out how to create a table in Javascript so that I can build the list of items selected using the buttons in Monday’s effort. There is an awful lot of information out there but, somehow, it never seems to answer my queries so I end up experimenting instead. The problem is simply stated. I have a list of items that I want to put into a table. I need a table so that I can get each column nicely aligned. There is plenty of help out there to show how to build a table from a list of know items but I want to insert data objects into the table. Fours has been spent on this and I still can’t see how to do to. I will take the problem up again on Thursday.

Thursday 27th July

I spent a fruitless day trying to get these static data lists to work the way that I want them too. My experience in JavaScript is very limited – enough to get through TM352 – but not enough for what I am doing now. However, I have the time and the inbuilt software knowledge to batter my way through this. It is a case of not knowing all of the inbuilt functions and remembering to put curly braces around things. I am getting close – but no cigar as the Americans say.

Friday 28th July

Got there. Spent another hour battering down the door and finally sorted it all out. I now have static data displays working on Android for the parts that move – freight cars, coaches and cabooses.

Screen Shot 2017-07-28 at 17.34.20

I can stop now and feel as though I have hit a little milestone. Next stop is to sort out the Loco display – just a slight tweak. After that I have to get the rest of the data displays going – town, routes, trains etc. This is going to be a bit more difficult as Chrome is throwing up an exception when reading the JSON for these items. It seems that there might be a “dodgy” character in there which my software accepts but JavaScript doesn’t. I have to be out on Saturday (hence why I am working of Friday evening) so I will pick up on this for an all day session on Sunday.

I have also had my TMA03 back. I got 66% which isn’t brilliant but ~I fell down in one section – LO4/LO6/LO7. These are the areas where I am supposed to get others involved in the project to comment and offer suggestions. Plus, it seems that I must quote lots of sources of information to back up my project. As I am stuck for answers to these issues I am going to pen an email to my tutor listing the issues as I see them and ask for his assistance in how to deal with them. This isn’t my normal way as I am normally trying to be totally self reliant but he keeps on about this and I can’t see a way forward so I do need his help.

Saturday 29th July

Sorted out the Loco display and then had a look at the JSON problem. It turned out to be an easy fix. It seems that the JSON data records for the non-railroad stuff – trains, routes, etc.  had a line of “””””””””” appended before the final curly brace. A very short piece of Smalltalk cleared that up.

| last aCopy |
last := self at: self size. "Get the last curly brace"
aCopy := self copyFrom: 1 to: ( self size -1). "Make a copy and drop that char"
aCopy := aCopy trimEndQuotes. "Removes all " chars from the end of a string"
^ aCopy, '"', last asString. "Insert a needed " and replace the curly brace"

The JSONs were now accepted by JavaScript and some sort of display was presented. Next step (Monday) is to format these data items. This will complete this part of the project.


Posted in Uncategorized | Leave a comment

Week ending 23rd July – The big rebuild

Monday 17th – Tuesday 18th July 2017

The big iMac is back and running but needs lots of file movements and program installs. Was pondering how to resolve my irritations regarding the setup at “Pennington Towers” when I started to install Cordova. I was following the instructions in TM352, which I had working prior to the big rebuild. However, I couldn’t get it to work and the Mac configuration was getting messier and messier.
Aside – one of the joys of having a computer software company with a US contract means that there is generally some money lying around in it – with more to come each year for the next three years!
Monday morning saw me at John Lewis buying a nice shiny (well, slate grey) MacBook Pro – 15″ screen, 16GB and a 256SSD. This lets me work in the living room once Tm470 is over (I will still do lots of programming, especially now as I know how to do a phone app). It also gives me a nice clean environment to create a programming work station – Smalltalk and Cordova – that should be great to work at.

Unfortunately, this has meant that nothing has been done on the project for nearly a week and I am unlikely to get going before Thursday.  Luckily, I am allocating 2 hours a day for 5 days a week so I can find a few more hours and thus I should be back on track by Sunday!

Saturday 22nd July 2017

Well, I am back and running again. The iMac is back as a home machine whilst I have configured the MacBookPro to be my work computer. It now has Parallels installed with a new copy of Windows 10. I have installed a fresh Smalltalk 8.6.3 and loaded in all of my historic code – almost everything that I have written in the language since coming across to VAST back “then”.  It has a working copy of Seaside and the 470Router software loaded (although I haven’t installed the ini file yet so it doesn’t work). This doesn’t matter as the real one is up and running on its exposed URL. I have also, following the instructions on the Udemy video course, installed Android Studio and now have Cordova working properly. I have also installed the Chrome extension for CORS – (otherwise Google won’t go out to remote sites for data). So, I am now sitting here bringing everything up to date. The plan for today is to get a table into the post-login page. This table will hold the buttons for the various data functions and enable them to be in a decent shape.

Posted in Uncategorized | Leave a comment

Week ending 16th July – Android/REST interface

Sunday 9th July 2017

I was so busy working on the Android app to get data from the web server, I completely forgot to check out my own project plan where it clearly states that I should be working on the Tablet REST interface. I was looking at all the data I was getting from the GET request and pondering how I would parse it out when I remembered. If I write an Android interface then I will not have to do much of the parsing. So this is today’s plan – write the simple interface to obtain the client data from the login information.

OK, I have set up a nice little URL that just delivers JSON data (apart from the usual HTML headers etc. unfortunately).

localhost:8080/WSAndroidUser?demo returns the following:

{“railroadName”: “Sunset &amp; North Eastern RR”,”railroadLogoURL”: “;,”username”: “demo”,”password”: “5F4DCC3B5AA765D61D8327DEB882CF99″,”currentTTPositionString”: “6”,”maxTTPositionString”: “0”}

whilst localhost:8080/WSAndroidUser?demo:routes delivers a JSON listing all of the routes  set up for user “demo”.  “routes” can be replaced by any of the other data types. Exactly what I was trying for.

Monday 10th July 2017

Back to working on the JavaScript. However, it would be nice of the Seaside server only sent the JSON rather than a pseudo-HTML page with all the headers, etc. I have posted a question to the Seaside support group to see if anyone knows how to do this. Somewhere inside Seaside there is some code that makes the basic page. I need to subclass that and clear out all the extraneous text. Whilst waiting to see if anyone has any idea, I shall continue without the knowledge and parse out the JSON directly.

As I only know the javascript that they taught in TM352, I have to keep looking things up but I finally got a JSON parse out of the data coming back. problems were getting rid of the &quot and the ; that HTML seems to insert into these things. I now have a fully defined object that is a JSON – so that means that all of the individual items in the above example are now held in the following fashion:

Tomorrow, I will try and get this data to show on the next page.

Tuesday 11th July 2017

Success. I have managed to get the login process finished. The aim was to make the branding of the app to change from 470Router to your own railroad after login.

Here is the before:          and here is the after:

Next step, on Thursday, is to put up the main menu – buttons to display all of the data and a button to call up the next train.

This plan of setting daily goals is working really well.  Also, as there is no version control, I am also testing at every code change. This involves using Ctrl-C to stop the running app; execute the terminal build command; tell Chrome to accept a localhost request (I have to have a special app built into Chrome for that); start the debugger; etc. and then the app will run. It’s a bit of a pain and more complex than I am used to but it does mean that I always have an app that works (or is one code change away). Regularly, I am saving back to Dropbox so everything is quite safe.

I have given up with my request to the Seaside group for help. This group seems to be a bunch of academics that delight in complicating everything up. If I had two weeks to spare, I could follow up on their various suggestions. As it is, it works so I will stay as I am. I agree that, if there was a variety of data sources, my parsing may not be sufficient, or even work. However, the data formats are completely under my control so the parsing that I am doing is guaranteed to be successful.

Thursday 13th July 2017

I have spent today creating and including image buttons for the various items of data that can be displayed. I have taken images of my own railroad and (with the help of Photoshop and Illustrator) created images of “nearly” the correct proportions. I have included these images in a <div> and in a <form> so that they can be removed or displayed as required and I have tied them into a JavaScript function that I have written that will display the various items of data dependent upon the name parameter sent to it from the various buttons. This all works fine, thanks to reference to the JavaScript code i wrote for my TM352 EMA.

Next step is to get the buttons to align in rows of three (I will probably use a table for this). To do that, I will also have to do a bit of resizing to get them all the same shape. This will happen on Saturday – British Grand Prix providing!

Saturday 15th July 2017

Well, the week ended in a bit of a crisis. I stupidly installed a beta of the new iMac OS – High Sierra – only to find that it was “dog” slow and doing some strange things. As I have Time Machine installed and have back ups going back months, this was to be easily solved by recovering back to a good “Sierra” day. I tried this three times but, each time, the install froze 3/4 of the way through. I decided to use the recovery option to install new system only to find that the new system it would install was the beta of High Sierra. Done like a kipper! Eventually, on Monday morning, I found I had a good install of that and started recovering files from theTime Machine backup – yes I could pull folders and files out but not a whole day. I made a big decision at that point. I was getting fed up with being closeted in the hobby room all of the time whilst my wife was busy doing jigsaws in the living room. I was also fed up with having my personal iMac configured for coding. See next week’s posts for more.

Posted in Uncategorized | Leave a comment

Last Phase – The Android App – Starting 3rd July 2017

Monday – 3rd July 2017. First things first.I need to get the environment built. I have a Cordova installation on my Mac from TM352 so I will be using that. I have used Cordova to build a 470Router project. I have also signed up for a “Projects in Phonegap” course which is a video course that shows how to build apps using lots of available add-ons. (PhoneGap is now Cordova).

My first task is to lay out my thoughts of the pages on paper before getting tied up in the code. Getting some good progress on the log in page. I have now arranged a backup of the code on Dropbox.

Finishing at 15.43. I have some drawn outlines. I have amended the index.html to display as I want the first page to look and am now trying to attach a JavaScript click to the login button. That is for another day.

Tuesday – 4th July 2017. Spent today playing around with text entry boxes. I just wanted to have, say, “User Name” aligned alongside the entry box on the same line. Nope, I couldn’t do it without an understanding of jQuery that is way beyond me. I went back to mu Udemy course and found out how to use a nice text box that has the prompt built in. Next step is to use the button to access the user info via REST. That is for Thursday (I have  Wednesdays off when working to a normal timetable).

Thursday – 6th July 2017. Struggled a bit with getting the JavaScript app to work. Finally, I got the } brackets in the right place and, at the end of a hard two hours, I got an alert from JavaScript showing that it had got hold of the userName and password from the login. That was enough for me. Saturday, I will access the database and get a logo, etc. I need to find out how to parse JSON, though.

Saturday – 8th July 2017. Another struggle. This time with:

“No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.”

It seems that Google Chrome won’t allow access out of the localhost if the page has come from a local file. I spent about an hour trying to sort this out – trying different browsers -executing code in the terminal that was supposed to launch Chrome without this restriction. Finally, I found an extension to Chrome which has sorted the problem. Yet again, web sites like were worse than useless because, although they were (supposedly) explaining and giving solutions, these answers were opaque at the best of times and generally so full of jargon as to be unusable, certainly for the likes of me.

Anyway, I got it sorted and now I can extract the menu page from the web server within the Android app. I only need this to a) confirm the user name and b) to extract the user’s railroad name and the railroad logo url. Doing this is the task for tomorrow. Once that is done, I can construct a menu that will give access to all of the data (minimal views) and to process trains.

Posted in Uncategorized | Leave a comment

Up to date plan of the SNE – Project Target Railroad

The project is using the above model railroad to test the logic, etc. The industries in place on this plan and defined in the database are as follows:

Industry Name Type Location Car Types
Boston1 Staging Boston allFreight
Hartford1 Staging Hartford allFreight
Classification Yard Sunset allFreight
A.N. Other Industry Webster allFreight
Blums Lumber Industry Webster flatcar;gondola
Greene’s Feeds Industry Webster boxcar
Creamery Industry Sunset reefer;boxcar
Freight House Industry Sunset allFreight
O.H. Wright Industry Sunset boxcar;reefer;stock
Sunset Gen. Manf. Industry Sunset boxcar
Freight House Industry Webster allFreight
Loco Oil Industry Sunset tank
Burgess Manf/ Industry Webster boxcar
E.C. Fuels and Oils Industry Webster tank;hopper
N.E. Ice Industry Sunset reefer


Posted in Uncategorized | Leave a comment