Railworks Work
Other Sims Work
Work In Progress Blog
Copyright statement
LinkedIn profile logo

Tag: Programming

  • PPQG (for Trainz) – minor update

    PPQG (for Trainz) – minor update

    … Passenger Point Queue Generator, the program that took my site offline once.


    Its not often you hear a site taken offline for a program that well, does what its not supposed to. I spent quite a while developing PPQG (Passenger Point Queue Generator – for Trainz) and it’s suppose to help with randomising and creating queues for rolling stock for passenger trains. I might enhance this to include freight queues as well, as some of my projects also have freight queues (parcels) included. Not unusual for Railbuses.

    I wrote this about 8 years ago in Visual BASIC 6, yes, really, on the train to and from work and it took quite a while. Across several computers and never finished. The reason why I never considered it finished, is because I left a module unfinished and never went back to it. Yes, I use it a lot, I’ve offered it out with its source code on this site which was fine for a number of years, until suddenly, my site got shut down because of it – because it contained malware. Got it back online, hosted it on Google Drive and it looks like its been deleted again. I have scanned it and some sites saying its clean, some are saying it has malware.

    It looks like this, doesn’t actually do any file handling and its only 40KB long. I hope it’s bugless but it can probably be buggy accidently. (If you do find some, let me know please).



    So used VirusTotal and it says 3 out of 71 providers consider it to have a virus which isn’t bad news, it just means that there is a way and style of my code writing matches a pattern in a Trojan or Virus. After all, all virus scanners look for is patterns in the code, if it matches that pattern, its a false positive. This could also be related to the VB6 libraries and embedded code to identify it as a VB6 programs but without asking a question to why, I will probably never find an answer. Nor would they tell me how their virus scanners work, because of intellectual property and secrecies that could be used to beat the virus scanner. So with that in mind, I started thinking about completely re-writing from scratch, this time, I used Visual Studio Community edition and the skills I already learnt.

    The thing I find is that to understand the language as VB.net is vastly different than VB6 (the language structure is different and its more Object Orientated and its compiled rather than interpreted. I could develop it in C++ which isn’t beyond my capabilities, or C# or Java, just all 3 take a lot longer for me as I rarely program in those languages. When I go over to Linux, I might look at that, but then I may end up using GAMBAS anyway.

    ARRGHH - PPQG virus results.



    So, I started off like this on an old laptop that I was going to get rid of and ended up in use on my desk. (Dell Latitude E6430 ATG).

    PPQG in Visual Studio Community Edition

    To get the randomisation to work took…. ages! But I worked it out with little help from the internet, which shows that I understand the basic language structure. When I started programming, I had high expectations of myself, thinking an experience programmer would understand off by heart all the required libraries. C++ is a strictly typed language and my god, it can be hell to work with. (Actually, in the office, that is a point, I wonder if the other 2 capable programmers understand C++?) until one of my tutors at the time pointed out that there is 25,000 libraries from memory, approximately! Yeah, I can’t memorise 25,000 libraries and what they do, that would be nearly impossible. Its bad enough understanding union rules for train crew or understanding the limits what you can do on the infrastructure. I know the other 2 understand VB, but Visual BASIC for Applications (which I avoid due to its flexibility). One has a basic understanding of VBA and had to explain to them how the VBA IDE (integrated Development Environment) window, like debugging features – inserting break points and the intermediate window, which is VERY powerful and you can understand how the program is working. But the code? That’s something else. The other understands VBA to a deeper level than me. (Oh one understands I believe Python that I find it difficult to get on with and understands Blender, whereas I tried Blender and struggled.) I like structured rather than spaghetti code, so all my loops and decisions are always indented to which one I am applying my code to (good programming practise) and I was always taught “Do not use GOTO statements”, its not quite true, but yeah, avoid them. Your code is messy! I always use modules; they allow reuse and small code. Goto statements? Don’t. How to get into a mess quickly and have zero usability of code.

    On Err GoTo Hell.

    You may not understand that! Anyway, I think I topped out for PPQG VB6 at less than 500 lines of code. I’m waiting to find out how this one is doing, but you will need Windows 10/11 at least as I’m building it for .Net Version 8. I prefer 3.5 as it doesn’t need 8.0 or even 10. No doubt I’ll talk about more of its development over time.

    Russ the Roofer - does it leak? No it doesn't!
    Russ the roofer – does it leak? No it doesn’t!

    In other news

    You may of noticed I’ve done some changes to the site too, small ones on some pages. I finally found the problem with my templates, so I’ve locked the sidebar, footer and header which resolved most issues on most templates and there is a search bar now. I’ve also put some files up, I had a separate page that just directly linked to a Google Drive as I wanted a publicly accessible drive for all the stuff that I’ve not put onto a page, but that didn’t, so I went the manual way. I’ve got some sources to put up and yes, you can download them and do what you like with them. There will be more in the future. That came from my WIP server and if you are after something that isn’t on my site, just drop me an email, the contact me page should work now and I’ll send it over. I also plan to add some sort of feedback to the side bar, so I’ll see how that goes – more importantly, time. Considering I’m feeling like “Bob the builder” at the moment. “Can I fix it? No I f***ing can’t!”
    As well as – going around the country on the coldest week on record!


    Ticketless scroat

    Lets just say a Northern guard had a bit of a shock when I hid under a hood and a scarf covering my face, then presented them with my Southern ITSO card, my Staff ITSO card, my PRIV card and my PRIV rate ticket. – it was blowing a gale at -2°C. I had a good laugh, just the Class 150 I was on, (between Ribblehead and Salford Cresent) went from nice and toasty, to the time we got to Blackburn – (or was it Bolton?), it was bloody freezing.


    Yes, that is an Class 805 Evero, yes, that is Ribblehead, Yorkshrie. Unfortunately, I’m not friends with Class 800s now, one took me and a lot of passengers prisoner at Carlisle by refusing to release the doors on 5 out of 10 coaches, with loads of alarms going off in the cab as the train refuses to co-operate with the door release buttons. Considering I was a full fare paying passenger in that I actually brought an advance single on a Disabled Railcard.





    EDIT much later (next day in fact!):

    A partially wasted Sunday with little to do, I was able to get it working. Well, I say wasted, I did manage to rearrange my desk so it was more usable for my height. But, after a lot of head scratching and finding out why variables weren’t parsing, I managed to fix it:


    Only 4 or 5 hours to get back into it and produced something useful. VB6 skills are still relevant. (And I didn’t resort of Xojo – another BASIC IDE!) – hopefully, it’s easy to read. I can add a crap ton of comments if you REALLY want.

    (And yes, I’m that “old school” that I try to follow the Visual BASIC coding standards)

Accessibility Toolbar