Friday, 30 January 2015

The World Reacts to the Mighty Jingles - #6 Langley, Virginia, USA

We've all wondered, haven't we, what happens when Jingles releases a new Video?... In this new series I aim to help solve that mystery.... This week, I'm led to believe this is inside a building in Langley, Virginia...

Check back each Friday at 18:30 UK time for the next thrilling instalment, where might we find Jingles being Enjoyed?

Thursday, 29 January 2015

C++ Alias rather than Typedef Example

I've been reading through Scott Meyers latest book, and one item I picked up on, which had passed by my eyes before; but I'd not noted, was the use of alias instead of typedef.

I used typedefs a lot in my code, to try and simplify things, well today I've created my first piece of code which would have used a typedef, but which I've used alias "using" statements for:

void ConsolePause(const unsigned int& p_Seconds,
const bool& p_Show = false,
const std::string& p_Legend = "")
if (p_Seconds > 0)
using Time = std::chrono::high_resolution_clock;
using MS = std::chrono::milliseconds;
using FSEC = std::chrono::duration<float>;
using TimePoint = std::chrono::system_clock::time_point;
using MSCount = long long;

TimePoint l_start = Time::now();
bool l_exit = false;
TimePoint l_end = Time::now();
FSEC l_duration = l_end - l_start;
MS l_durationValue = std::chrono::duration_cast<MS>(l_duration);
MSCount l_count = static_cast<MSCount>(std::round((l_durationValue.count() / 1000)));

if (l_count >= p_Seconds)

if (p_Show )
std::setfill(' ');
std::cout << "\r" << l_count;
if (!p_Legend.empty())
std::cout << " " << p_Legend;
while (true);

The code counts down on the console for the set number of seconds.

I like this, I think it's neater than the typedef system, though when I first wrote one instead of "using NAME = TYPE;"  I actually did "using TYPE = NAME;" on sort of autopilot.

Code derived from answer here: 

Wednesday, 28 January 2015

Elite Dangerous - Trading Tools - Client/Server - Progress Pt8

Support this project now at Patreon, or donate directly via PayPal:

The development plan, now that we have reliable data collection, is to start to share the tool; but more importantly to share the data.  I will be publishing clearer details of the XML format being used, however, it is a node only based text format, at present a commodity looks like this:

I plan to wrap this basic format into an outer "Commodities" node, with the date & time included, and make that publically available.

However, I do not plan to generate that whole list - especially as the data set grows - I plan to generate that list maybe weekly at most, as I am going to be driving this for free*.

To recap the current process for capturing the information, you play the game, and run the image processing application, then from within the game client - without tabbing to the image processor, you just press keys - you can send commands to the image processor to capture images of the navigation and commodities screen, to start them capturing the character information with tesseract:

Armed with your local data, you then run the separate windows application - and yes you do have to be able to tab to this application - to perform searches of your collected data store, which looks like this:

If you opt into sharing your data you are helping the project, at the most basic level, providing your data you will help yourself and other players!  So by sharing your local data store it gets uploaded - periodically - to the server.

Once you run the trade analyser, when you've been sharing your data, it will download the latest public list and start to use this, if you are a special supporter, sponsor or donor this is where your live cycling of the data will take place, the trade tool will automatically authenticate with the server, and start to receive the updates from all other players faster than the general list.

Of course, you will be able to write your own tool to access this same data, and be able to call the server to download the current public list of commodities and use that in your tools, other sites and projects are welcome to use this data as we collect it.  However, I do ask that you share, and help this project collect data in return.

I will be generating the special patron, sponsored, active list at least daily, if not hourly, so anyone supporting the project through Patreon, or through a sufficiently high single donation will be given access levels giving them near live, or as I say at least daily updates of the information from the project.

This won't does not affect your local data store, if you collect data live, then it is your data, and you opt into sharing that information.

As the  project matures I also hope to be capturing system connectivity data, this is where other information - such as your ship's current jump range - may be required, so help the server rationalise the data.

The server will also afford a level of checking and sanitisation to the data, so signing up to help the project you will receive a more accurate data set, not only for the commodities names, but the prices as well as the supply & demand.

What do I mean by sanitised data?  Well, the OCR is not perfect, as a side effect of either over-training, or under-training, it makes mistakes.  It also makes mistakes when the background behind your commodity screen changes - this can be because you were using the capturer whilst in the hangar, or whilst just on the surface of the landing pad.  These variations affect the isolation and interpretation being carried out.

Here is a good example:
Clearly the reader got it wrong on at least one pass, and created a new erroneous commodity, or sometimes it just plain gets it wrong:
You can spot these kinds of mistakes in the other screen shots I've already published:

The server however will be able to sanitise this data, that is correct spelling mistakes, or ask the master list (or myself) to confirm what is meant by a new name or a miss-spelled name.  Helping correct this data.

Your local data store will not do this and such mistakes will just sit there, until removed or updated by your sharing your data and receiving the new ratified list of commodities.

As well as mistakes with the name, sometimes it also makes mistakes with the values being read, this can lead to interesting problems.  I did once set off on a 4 system flight loaded with (you know I forget what) but it had a profit of 800,000 credits!!!!  WHAO!

Only when I arrived did I find out I'd made a loss, because I'd bought these things at something like 2,000 units, and the OCR had mixed up the 1877 of the destination with 7811, vasting increasing the profit margin the tools thought I would get.

This problem has been reduced, but again depending on the background at the moment the commodities or captured, of if they are a "good" screenshot or not it can happen that mistakes are made.

By sharing the data however, there will be multiple, perhaps even tens or hundreds of imprints of the same commodity at the same station coming in, the server will be able to average or at least rationalise these values and filter out wildly high values!

This is data sanitation, filtering out the outrageous mistakes we as humans would spot instantly, ornot even make as we can read the screen perfectly well.

Of course, running such servers is going to be costly, and so to share we do ask you help support the project.... Over at patreon you will find our page.

Tuesday, 27 January 2015

BBC - History - Russia - Auschwitz - Remember

The lack of copy and proof reading with the BBC is getting annoying now, I've pointed things out to them, I've blogged about them, but we're down to basic bad copy now, as a journalist I think your first order of merit should be to write coherent text, which can only be scanned one way... The moment your words could be interpreted two ways you've failed in your job of clearly communicating.

Here's an example, from a BBC blog about the 70th Anniversary of the Liberation of Auschwitz...

See it... "Dozens of the Nazi killers at Auschwitz escaped justice after the war"... That can be read two ways... That there are dozens of killers whom were Nazi's who escaped being brought to justice... Or that there are dozens who killed Nazi's who escaped justice...

I know, and I presume most of you know the history, so we know the writer intends to mean that the Nazi's were the killers and they escaped, but history teaching, cultural differences and the sheer number of holocaust deniers might want to read that differently.

I personally knew a British Solider whom was part of the very first units to get to Belsen, I saw the look in his eye as he described what he saw, I do not deny the Holocaust, I hold it up as the biggest crime ever, EVER, committed, a crime which cuts through divides and should unit all people to resolve never to let something like that happen again.

But then I meet kids now who don't know it happened, that don't know who ran the countries, I've heard kids who know the name Hitler, but they associate the name more strongly with caricatures in computer games, they find it hard to realise the dark days Europe went through, the dark days which my grandparents gave their youth to abate.

And we read of parts of the world where there is conflict today, even driven - as the holocaust was - in part or in full by religion, and one has to question what is the point, why fight?

There are extremists from all over, Islamic, Christian, Orthodox, then there are extreme wings of politics, and it all leads back to a lack of context, you can fight and maim and attack today, but should you?... If you and your family, your country, your people had been ravaged by true horror, would you?

In the Ukraine, Russians do not want to remember the Great Patriotic war's beginnings, they did not until recently acknowledge they had murdered Polish officers when they sided with Nazi Germany and invaded Poland, the history is brushed under the carpet.  Just as it is with the cock-eyed Russians running into Ukraine, a whole other sovereign country, and declaring they are fighting to restore their country.

No, no you're not, you've forgotten the horror, and turmoil thrown up nearing a century ago by one World War and then another, you've got no back story, no history, perhaps only propaganda.

And propaganda has been seen to be journalism tainted with a strong bias, so journalism has a lot to answer for, and the least it could do it write coherently on matters of import.

Monday, 26 January 2015

Elite Dangerous - Trading Tools - OCR - Progress Pt7

Help Sponsor me and this project now! Click here for details:

Over the weekend I've been working on the collection of data, so I've been to a few more systems and stations, I've been checking the algorithm for finding the best route, and I've been giving myself some feedback...

The first two things I immediately wanted was the program to remember the last folder used, and also as I captured data, to be able to refresh the loaded information without having to close & open the tool again.  Basic stuff.

So, loading the data looks like this now:

Lets say we've got courier missions from LHS 1914 to FK5 2550, we select the start system, so LHS 1914:

This instantly populates the Stations and total list of commodities in columns 2 and 3 there.  We can select the specific station we're docked in as well:

Reducing the number of commodities, now we could just select Fk5 2550 from the destination system list, just to see what would bring us the most profit in running into that system:

The answer here is then given in the top right box, that result will stay there now until we change system or destination system, we can get the same search just without the station select from the second column also, but then the search would start from all stations in the source system on the left.

This search alone wasn't enough however, because I needed to be able to quickly find a supply of certain commodities, hence the new controls in the right bottom.

Lets say we want to find Beryllium for a specific mission goal, we can select that commodity by name from the drop down:

The results are the source of Beryllium from the database in best price (for purchase) order.  Obviously, if you've selected a commodity you've never seen before then you get no reply, unfortunately in the current context there is no distance, or connectivity in the database, so we don't know if these items are close or not, that is still a player decision*.

The other feature added there is the "Demand For" search, this simply lists those commodities in the database which are wanted somewhere, the results are given in best price (for sale) order, this allows you to quickly marry up any profit (if any) there maybe to be had, I find it most useful if the upper algorithm driven box comes up with an illegal selection.

* However, I do envisage changing the data collection so as data is captured from system to system we have a basic web of where it connected to where by input, this basic webbing could then be used to add "how many jumps" a commodity is from the selected source or destination systems.  However, to add all this functionality I need your help!

Story Time - The A3000 Break-in (My Story of Computing at pre-GCSE Level)

Yes, I'm going to tell a story again, this one pertains to my early teens, when at School I really discovered coding computers.  I went to a state Comprehensive, not a bad one, but not a fabulous one, named for the council estate I grew up on it was nothing special.  But in 1990 it was one of the first schools to start shedding it's older BBC Micro's for Acorn Archimedes Computers.

These caught my attention as just a couple of years earlier I had my Atari ST, my brother and I picked the ST because our cousin had one, and he got all the pirated games available, so we had that and loved it, but until after college I never really programmed it, the Archimedes at school however, they had a programming language built in... they had BBC Basic, just as the Micro's before had.

I also knew they were this "RISC" thing, which was big news in the 90's it was going to revolutionise computing, by making things easier and simpler to code.  "Reduced Instruction Set" after all, sounded simpler!

However, when it came time to pick my GCSE options I took one look at the IT (now called Information Communication Technology - ICT) syllabus and thought it a load of crap.  Who wanted to learn about Ceefax, or weather, or news broadcasts, I wanted to sit at the computer and pick through it's electrons.

So, I avoided ICT and IT, and went onto other things, as the years went on however, they moved two of the science rooms from old labs on the third floor down into another block, and in the vacant rooms they had nice power strung around the walls and they installed a suite of new Archimedes 3000 computers, with 2MB of RAM!...

I remember being entranced by these machines, they had the same form factor as my ST, but I only had 512K of RAM, with 2MB of RAM and a built in OS which was much more full featured than GEM was, I got to grips with these things quickly.  Not that I ever ever had a simple lesson with them... Oh no, because, I used to sneak in there.

I would actively bunk off of Physics and go into this often empty computer suite, I soon found built into the machine a RAM disk, so I could put 512K of ram aside as a disk!... And the speed of that was phenomenal!  Ensuring I had a script to write my files back to my disk, and then another script on another disk to load the RAM disk and copy the files in, I had a basic "boot & sync" mechanism such as many USB sticks come with today, but this was in 1991, on 2MB of RAM using 3.5" 720K DS DD Floppy disks!

Pretty soon I had a whole troop of school friends who would bunk off to the computer lab with me, Daniel, Nicola, Tracey, even the most buttoned down hard working lad in our shared physics class Gurpal bunked off to the Computer Lab with us.

I also used my ST at home for reports, especially doing Integrated Humanities, so I would be given permission from that teacher, to go write up my report on the Computers, it was only a text file so it worked a treat copying the data on and off the disk, even if it was formatted for my ST, the ST, IBM PC and Acorn machines could all read one another's disks... Unlike those poor Amiga Schmucks who had to jump through hoops to get their machines to change the disk idents and headers (yes, yes this was a dig - Atari Forever, Amiga Never - hehe).

Anyhew, leading this rag tag bunch, and exploring the inner workings of these Acorn A3000's one day I was found, in the supposedly locked room, by a teacher, I think his name was Atherton, he was a strange one, but what strikes me now is the manner of his reaction, he asked what I was doing, he saw the pages of code, he saw my sync program as I desperately tried to move the RAM disk back into the safe storage of the floppy, because he had his finger on the master trip switch - the teachers, if they caught you playing a game, or messing around had a tactic; and on machines without hard-drives this was perfectly sound; of hitting the master trip to isolate the power to the bench ring supplying the computers, everyones machine went dead and they had you bang to rights with a game disk in the machine.

This teacher however had the nous to see this wasn't a game, but he was only ICT syllabus trained, he had no idea what I was doing, or the power of the machines on these desks, he thought of them as a teaching aid, not a gateway to the future I now have as a programmer.

I explained I was coding, and I just said "I have a machine at home", and this is where the strangeness began, he assumed I meant an A3000 or similar, which were expensive back then, my Atari was not cheap, but it was already nearing five years old, the A3000 was brand new on the market, and cost nearly £800 each.  He'd not found me playing, it looked like work, he didn't know what code looked like.  Quite a damning statement for a school with him as the lead of IT subjects, with this fancy new computer suite, in the dawning of the 90's where the digital age and computers were fast on the ascendancy.

But he really had no clue, his punishment... yes, there I said it, rather than ask, or encourage me, or see what I was up to and realise I knew more about the computers than he did, he decided not to encourage, or help - which tells you a lot about that teacher - he decided I'd done wrong, being in the computer lab without permission.  So his punishment was... Well it was weird.

I don't think he believed I had one of those machines at home, so to challenge me, he locked the lab - stopping me getting into them - and he took me to his office, where he handed me a copy of Lemmings, yes the compute game... And a pack of 10 blank disks... He made me sign for the disks... And he said "Copy that disk onto all those disks"...

Yes, copyright theft via pirating was to be my punishment... I didn't know what he wanted the copies for, there was no internet, so no e-bay, so I guess he couldn't sell the copies... Maybe he had a class to show a game to, ironic considering the stance the school took for having games on machines etc.

So, off I went, I got home and spent a good hour copying these disks, it took ages on a 512K ST, you had to read the first half of the disk into RAM, then write it out, then read the second half in, and write it out, it was one of those tedious tasks, and I'm pretty sure even today my muscle memory is enough to let me swap disks onto the side slot mounted drive of the ST or Acorn machines at speed.

Anyway, with five disks done, we had to go out training that evening, so in the morning I had only half the task done and this bizarre punishment still at hand... My solution was easy, there were two ways into the computer lab at school, the first was through the door, the second was via an English classroom, into the store cupboard at the back, and then on my hands and knees through the floor level vent, this led into the store room in the computer lab, if it's door was unlocked I could get back in...

It would be risky, but I entered the English classroom before the first bell, and moved a pile of books out from under a table to expose the vent, unscrewed it and moved it aside, then found two T ring binder clips and hooked them through the vent, climbed through and pulled the vent back into place from the other side.

Dusting myself down it was pitch black, so I moved slowly with my feet trying to find the door and not hit anything, finding the handle I turned and it opened, thank god!  Because to go back out now would look very dodgy, as the English classroom had resumed.

I quickly fired on the power and brought the nearest five machines up, and started then making copies of the copies I already had.  It was an agonizing two or more minutes to copy the files into RAM, but the machines had RAM enough to hold the whole disk, so I just had to do one mass swap and press Space to continue.

Writing the files back out was even slower, and made more noise, suddenly I heard a key rattle in the door, someone was coming in... I ducked back into the store cupboard, as a teacher came in, a women, she spread out a group of first years to each machine, except the five which were on, thank goodness...

I decided to play it casual, I rattled a few things and emerged from the cupboard, "Morning Miss"... And I just got on with my machines, she didn't even ask why I was there, as I collected up my five disks, and she never queried why I was in the room with a locked door.  I don't think she had the nous.

Anyway, I had my booty, the ten copies, plus the original, and I went off to hand them into the bloke before break - which was his deadline - I knocked on his door and handed them over, he had a class so could not really talk to me, but he did ask - "Did that take long?", "yes Sir", "Let that be a lesson to you"...

You know, to this day, I'm not sure what lesson he was trying to teach, I look back on using 3.5" floppies with a nostalgia, and I look back on that day the sheer balls I had to get away with using the lab, now locked, and their attitude, it stank... They should have encouraged me, I'd have been somewhere other than I was, my skills and fluency with a computer were delays reaching my education by at least three years, I didn't learn anything more than BASIC and the prompting shell script languages until I learned my first 3rd Generation High Level Language (PASCAL) at college.

By then the internet revolution was burning it's way through the stock markets, but I always think, I could have been writing tools I use and wrote five years later that little bit earlier, I could have had an easier time at college and university by earning cash from the tools I had, or even giving them away to make a name or addition for my CV.

Friday, 23 January 2015

The World Reacts to the Mighty Jingles - #5 Space The Final Frontier

We've all wondered, haven't we, what happens when Jingles releases a new Video?... In this new series I aim to help solve that mystery.... This week, the Final Frontier

Check back each Friday at 18:30 UK time for the next thrilling instalment, where might we find Jingles being Enjoyed?