2018-08-29

Stargate address numbering P3X-421

One of the nice things about taking the odd walk (to try and get more healthy / lose weight) is I get 20 minutes to ponder something totally random - like how are the Stargate address numbers worked out?

This is a matter of some debate. Basically, the show references gate addresses by a code, e.g. P3X-421, rather than by the gate symbols which would be tricky (though we later find they do have names / sounds that can be strung together to make words of a sort). An address is actually 6 (non repeating) gate symbols from a set of 38.

[Someone commented as a linguist that the idea of the gate symbols having sounds that make up the names of planets was crazy as no way the location in space and the name would happen to line up. They missed an obvious point that the people naming the planet may have been the Alterans and they named the planet using the sounds from the planet's gate address. But that is beside the point]

Anyway, back to these gate numbers. The Milky Way gates are almost all P something. This suggests that maybe the letter is not part of the address (P=Planet), but even the odd exception (M=Moon) does not quite fit, and a B and K have also been used. With no doubt deliberate irony the Pegasus gates start M.

This leaves 5 alphanumeric characters to define a gate address. Even if you take all letters and numbers (36 combinations), 36^5 is only 60,466,176, but there are 1,987,690,320 possible 6 figure addresses (38*37*36*35*34*33). So it cannot be a simple mapping to the gate address.

Except, and this is where the pondering whilst walking around the block comes in, let's pretend we accept the original description for how a gate address works.


The way it is described is that the 38 symbols (apart from point of origin) are constellations as viewed from Earth (which they are, you can work out which they are even), and that they represent points in space. You need 6 so as to make three lines which intersect at the destination, and then to "plot a course" you need a 7th (point of origin).

OK, here are a few of the issues:-
  • A constellation is not a point in space, the "stars" that make it up are at different distances and some may even be very distant galaxies.
  • Even if these symbols represented a point in space, the chances of ever making three lines that intersect exactly out of 38 arbitrary points is, well, slim at best. The chance that such an intersection is actually where you want to go (hits a planet, or even a solar system) is even slimmer. It is just not a way to address points in space
  • Obviously, even if using points in space as a reference, you can make a target using just one line and one point. Even so, the possible points are nowhere near enough to address a planet or solar system in the galaxy from 38 control points.
  • The fact you used reference points means that actually the expansion of the galaxy is likely to ensure gate addresses do stay the same, yet apparently they stop working after a while.
  • You obviously do not need a point of origin - the origin is "here". If you did, then how come it does not also take 6 symbols to define it. Also, does that mean by dialling a different symbol as the 7th you create a wormhole from some distant gate to some other gate in the galaxy?
OK, let's forget all of that, it is a film, let's pretend it makes sense, and that is how gate addresses work.

Well, that may solve the gate numbering issue. Each line is a pair of symbols, but clearly it does not matter which way around they are as they make the same line. So that reduces the combinations by 8 (2 for each of the three lines). Also, the order of the 3 lines does not matter, so that reduces the combinations by 6.

So instead of 1,987,690,320 gate addresses, we have only 41,410,215. This is smaller than 36^5. In fact it can be covered by 34^5 which is nice, as I would leave out "I" and "O" to avoid confusion with "1" and "0".

So yes, in theory, the Pxxxxx could be a full gate address using just the 5 letters and numbers. And the "P" could indicate type of destination somehow.

Of course, what the actual mapping is, is a different matter. It is very likely they are just random.

As an aside, why can't film makers employ a geek for a few days whilst making the screenplay. I would be trivially cheap for them, but things like this could be made to a proper scheme of some sort and have some consistency. They could have avoided the whole "points in space" crap and maybe gone for just "it's like a telephone number" which would have been way easier to explain and not tied their hands as much. Even if they just pinned down the made up rules and made up physics at the start they could avoid making inconsistent story lines later. Oh well.

2018-08-28

Alteran digits

I am making progress on the new Alteran deck(s) design as per previous blog post. I am making some progress that someone on twitter says they may have a contact at MGM. We can only hope.

So first off, I have a pretty good set of glyphs. They are from wikimedia, and to be credited on the box.


They are the orientation that matches the placement on the gate, which is not quite the same as the cards Dr Weir deals, which is a shame. I plan to do a bit more research (watching SG-1 episodes) to check these...

Now, the other sticking point is Alteran characters. There are a lot of fonts out there for this, really, I am amazed.

It is 100% clear that normal Alteran letters are a simple 3x4 block structure. No problem. Takes me back to the block graphics on a TRS-80 and even teletext graphics (both 2x3). Those were the days.


However the digits are another matter. They have a bit that sticks down in the middle. One font, and a web site, claims that the bottom row of blocks has half height left and right, like this.


This creates an odd shape for the "0" as the bottom does not match the top as a box. However, it fits the overall size nicely.

However, this does not fit the control stations in Atlantis. They are clearly 3x4 with a bit below.


These are odd, the second panel (as I noticed when first watching this) is back to front. However, this is clearly a 3x4 with an extra half pixel below the bottom middle. The "0" looks way neater. I assume the back to front digits was a production error.

Stargate Universe makes this even easier to see, with a countdown clock.


Here we see the 3x4 grid and what looks like a whole pixel below rather than half of one (making 3x5 grid) but not 100% clear to be honest from that picture, sorry. They have colon and dot which is nice and confirms the "baseline" for the font so the pip on the bottom of the digits is definitely below the baseline.

So I have decided to make my Alteran characters for playing cards use a 3x4.5 grid with the extra half pixel below much like an accent, a Cedilla if you will, only half a pixel high.

As I said before, a 16 card per suit deck, 64 total (100 in octal) makes sense, and I have it all designed now.


I have even designed the box, and we are ready to go once MGM confirm licensing.

So, watch this space! Or give me a contact at MGM...

BTW, the back is just the Stargate unless I have better ideas. Suggestions welcome.

2018-08-27

Stargate Alteran playing cards

As I mentioned, I recreated a classic scene from an episode of Atlantis involving playing cards, but I have been thinking these could sell. Another good one for the Amazon experiment maybe.

Licensing

Sadly, the first step is confirming if I need any sort of licence from MGM. It is complex as I am not using their media directly, no stills or clips, but I am using creative commons wikimedia glyphs and Alteran characters. If I don't mention "Stargate" on the product it may not even need a licence. I would rather hear that from MGM than take a chance though. Emails to MGM's licensing people are ignored, and I have tried tweeting as well. If anyone has a contact at MGM, let me know.

My main goal here is that I think these would be fun as a Stargate fan. Indeed, if selling at cost (i.e. not profit making) is one aspect of not needing a licence, I would be happy with that to be honest.

The cards I made for my amusement were a simple 52 card deck, plus 8 "jokers" that are the glyphs for dialling Atlantis from Earth. With Alteran characters for the indices.



Now, if I was to make these as a deck to sell I have some ideas, and I thought I would discuss them on my blog and see what people say. How many of my readers are Stargate fans?

Alteran indices

The main thing that is obvious is the indices (corner digits/letters) are in an Alteran font. This is quite easy to read, especially the digits. But does raise one question...

There are single characters for A, 2, 3, 4, 5, 6, 7, 8, 9, J, Q, and K, but what of 10? Normally the 10 has a single line for the 1 and a narrow 0 making it overall the same width as other characters. That does not work in Alteran.

So what I do is an Alteran "T" character for "Ten". I also tried "10", and a half width digits "10", but neither looked good. One other possible value is "X" from Roman numerals which makes some sense as Alteran is meant to be the basis for Latin. However, see comments on extended decks below.

Extended deck

At some point in their history we know the Alterans used base 8 rather than base 10 for numbering. I am not sure if they went 8 to 10 or 10 to 8 but the current character set has digits 0-9 for base 10.

But it makes some sense that powers of two would prevail, and so I thought a deck with 16 cards per suite, making 64 cards total (or 100 in base 8) would be a nice touch.

So the idea is to add three more cards per suit, a "0", a "1", and an "11". Having a "1" makes "A" definitively the card after the King. The idea is to use the Alteran characters "0", "1", and "E" for eleven. This is perhaps a good reason to use "T" for "Ten" not "X" as we would need "XI" for eleven if we did that.

Of course you can always remove the extra cards and play a "normal" game.

The jokers

The original inspiration was the scene with cards from Atlantis where the cards dealt by Dr Elizabeth Weir are the dialling code for Atlantis from Earth (well, nearly, but that is likely a simple continuity error).

So the 8 jokers that are gate glyphs is quite neat, but why stop there. Why not all 39 glyphs?

So I am thinking a double pack of cards in one box...

Pack1: 52 card standard deck (with Alteran indices)
Pack2: 52 card which are 39 glyphs, plus point of origin for Antarctica, and 12 extra cards ("0", "1", and "11" in each deck).

It would make a nice double pack, a specialist set of playing cards. I do wonder what games you can make from the glyphs - but I am sure that would be possible.

Back

I did have a Stargate on the back but could I do better/different? The Atlantis expedition logo? What?

What do you think?

Should I keep it simple, 52 cards and 8 glyphs, or go for 2x52 card decks with all 39+1 glyphs and extended deck?

It all depends on MGM not needing a licence though. Anyone with a clue how to contact them, let me know.

When licensing is sorted, I could have these on Amazon in a couple of weeks!

P.S. I have found some good glyphs and placed on cards in correct orientation as on gate. Sadly not quite the same orientation as on Dr Weir's cards, so slight dilemma as to whether to turn some around.


P.P.S. I have the test pack now:-

Amazon and VAT look, err, fun

Obviously, selling things through Amazon, we have to make our accounts work. Normally we would invoice and charge and ship, but with Amazon FBA, all of that is done by them. With us shipping, we still have the issue that Amazon have charged the customer so we are just shipping.

Thankfully Amazon allow various reports, and there appear to be two.

One report for orders we have to fulfil or have fulfilled.
One report for orders Amazon fulfil.

Not the same format!

Both are tab separated files, but one has headers like sku, product-name, quantity-purchased and one has basically the same fields with headers SKUTitleDispatched Quantity. It was not too hard to handle that, but rather silly.

VAT inclusive/exclusive.

We have several orders and most list the item-price (e.g. 6.00 for a pack of cards) and the item-tax as 0.00. However, on the report fulfilled by us, one person was listed as item-price 6.00 and item-tax 1.00. I.e. the item-price is inc VAT. I can only assume they are a VAT/business customer.

However, on the fulfilled by amazon, we have some items listed 6.00 Item Price and 0.00 Item Tax as above, but some listed Item Price 5.00 and Item Tax 1.00. I.e. the Item Price is VAT exclusive when there is VAT.

The same logic seems to apply to Delivery and Gift Wrap values.

Just to add to the fun, when purchasing two items, the *ITEM* price is in fact the total price, not the per item price.

I'd like to thank our customers for providing such a fun range of possibilities so I could work out what was happening.

Amazon fees

It looks a lot like the fees Amazon charge have no VAT invoices. This is a tad confusing. It seems they don't charge VAT as long as we have provided a VAT number, which fits with how EU works now, but I was under the impression a formal tax invoice stating that was still needed. Also, as the services I am buying are in the UK, I am a tad at a loss as to why there is not VAT as normal even if they are not a UK company. I am not having a lot of luck working it out. I may ask HMRC to explain it. Facebook seem much the same, no sign of a VAT invoice from them if you advertise on Facebook. At the end of the day if they charge VAT we reclaim it from HMRC and they pay it to HMRC so it is academic - apart from when it is not clear if the price quoted has VAT or not.

However, if so, the control pages are especially annoying - well, infact, plain wrong. For example a pack of cards sold at £6.00.


It says £6.00, with two Amazon fees of 90p and 80p and then says net proceeds excluding VAT of £4.30. I had assumed it was in fact £4.30 inc VAT, i.e. the £6.00, 90p, and 80p were all VAT inclusive figures, but it does state £4.30 exclusive of VAT!

However, the sale price of £6.00 means we pay VAT of £1.00, and it seems the 90p and 80p have no VAT to reclaim, so actually the net proceeds are £3.30 excluding VAT and not as stated £4.30.

As it happens, at these quantities, the cards cost more than £3.30+VAT. I thought I was covering costs, and now I realise I am not quite. One reason these are somewhat of an experiment in selling via Amazon - get it all sorted and understood with small value items like this.

The main thing is we have imported the data to create the VAT invoices on our systems for the sales and ensure we are paying HMRC the right VAT due.

It gets worse!

I checked it all added up, which is fine, but then I realised that there was something amiss. One of the figures on the statement is "Other (shipping & gift wrap credits)" with a value of £8.49, but on only one item has someone paid postage and they had paid £4.49, so where was the extra £4.00 from?

What was especially odd is the totals added up - the total sales figure, plus this £8.49, added to the total invoices I had imported. I went through checking there was no gift wrap or other shipping charges. There was not.

So juggling with what added up - if I total the Item Price and item-price from the two reports I do get the same total as they show on the statement. Good, so where is my £4.00? Well, it is the three orders that had a separate Item Tax not included in the Item Price column (four packs of cards in total).

WTF? That means they are including the VAT charged, but only where separately itemised, in the "Other (shipping & gift wrap credits)" figure on their statement.

I think my accountant will have a nervous breakdown after seeing this.

P.S. They do provide an "invoice" for the advertising charges only, which says "(includes applicable VAT)" on it, and says "This is not a VAT invoice" and does not say what VAT rate, country, or amount has been charged. FFS

P.P.S. Amazon actually sent invoices! And have out VAT number and state £0.00 VAT!

2018-08-26

Drawing GS-1 barcodes

Having seen GS-1 trying to charge to make barcodes, and how simple it is, I thought I would look more in to the specifications to make sure any barcodes we use are spot on.

I am quite surprised with the GS-1 documentation (here) on the matter. It is 455 pages long, and not only covers the detailed format of the barcodes, but different types of code (QR, Datamatrix, ITF, Code128) and placement on the products and all sorts. It goes in to massive amounts of detail!

I had written some basic 1D and 2D barcode generation libraries some time ago (As I said, I did a postscript EAN/UPC codes decades ago, and was printing my first barcodes on dot matrix printers when in school, something like 35 years ago).

I decided to check these and add some extra layers, e.g. tools to make an exactly correct GS-1 EAN/UPC/GTIN barcode covering EAN-8, UPC-E, UPC-A, EAN-13 and GTIN-14 as well as 2 and 5 digit add-on codes.

The basic coding is pretty simple, as I have said. Like most 1D barcodes the coding is done with multiples of a "unit" size. Systems that use thin and thick bars only often have non integer sizes, e.g. 2.5:1 ratios (ITF, Code39), and allow from say 2:1 to 3:1. However codes that use multiple sizes like EAN and UPC will usually use exact multiples of the unit size. EAN/UPC use 1, 2, 3, or 4 width bars or spaces. Obviously when printing you may have to slightly adjust artwork to allow for printer bleed which makes the black bars appear wider than they are, but the ideal final output has the exact multiples of the unit width.

That aspect was simple. However, there are other aspects to get it right such as the required quiet zone (white area at start and end) and the height of the bars, and text/digits shown, and so on. In practice the height does not matter much for scanning, other than the range of angles you can scan (which has some relevance for things like laser scanning at checkouts).

So, let's start - this is the basic EAN-13 code :-


As you can see, the GS-1 specification goes in to a lot of detail. This is based on a 0.33mm unit size, and all of the horizontal measurements are exact number of units (as you might expect). So, for example, the 3.63mm leading quiet zone is 11 units, and the trailing quiet zone of 2.31mm is 7 units. Simple.

Sadly the heights are not whole units, but they are specified. So I can make a barcode of those exact dimensions in SVG nicely.



Similarly the UPC-A code is well defined :-


As you can see, subtly different. Two of the digits are outside. The use of digits and symbols on left and right is probably to emphasis the need for quiet zones, as I am sure UPC used to have all 12 digits under the bars much like EAN-13 codes do. (FYI the extra initial digit in EAN-13 is encoded in the orientation of the first 6 digit's bars so does not take more space than 12 digit UPC).

As you will see, the quiet zones are different, being 9 units each side, but the overall size is the same at 37.29mm by 25.93mm. The UPC-A does define how much the guard bars go down in to the digits though, which is handy.

So, once again, I can make a perfect UPC-A barcode



So, I was quite pleased with myself and decided to code the 2 and 5 digit add on codes. These are used for periodicals, magazines, newspapers so the publication does not need a separate main barcode for each issue. Again, the coding is simple, but the dimensions are fun...

Lets look at a 5 digit add on with an EAN-13 code :-


This creates slight concern for me in two areas. Firstly the 1.65mm final quiet zone is 5 units, smaller than a digit takes (7 units) yet the ">" looks like it has plenty of space between it and the 8. Now, GS-1 don't seem to define the font, and I am using an OCR-B font (which you may not see in my examples) with a ">" that is slightly wider than shown. But if you look at the image above the 1.65mm shown is the same as the 2.31mm to 3.96mm quiet zone. Clearly a misleading image. I decided I would go for 7 units not 5 as the drawing clearly does not reflect the dimensions shown.



The other issue is the height. The side bars at 21.90mm, and from the above you can see the guard bars are 24.50mm leaving only 2.6mm at the top. Normally there is 3.08mm for the digits, so this is tight, yet it seems to be shown with more of a gap between the bars and the digits than those at the bottom. My example does not make the bars a full 21.90mm but instead allows just enough space for the digits.

However, it gets worse, this is the UPC-A with 2 digit add on:-


In this case the side bars do not go all the way to the bottom of the guard bars. This make sense else they clash with the final digit on the right of the main bar code. However, and this is where GS-1 clearly have something of cock up, the side bars are also 21.90mm high!

Given the height of the main bars over the digits is 22.85mm this leaves 0.95mm for the digits at the top, which is clearly not sensible and very much not as shown.

So I have just made mine sensible, allowing space for digits. If it was not obvious that the specification was clearly flawed I would follow it, indeed for the EAN-13 I initially did smaller digits, but when I got to UPC-A I realised it was impossible to follow the specification.



So, 455 pages, and still mistakes on some of the most basic aspects. Shame.

P.S. I would stress that whilst these are two minor deviations from the standard (where it is clearly a broken standard), they are not deviations in the actual scanned barcode itself, so not anything that impacts reading the barcode correctly.

2018-08-25

E=mc²

One of the iconic equations in science, E=mc², but it seems a tad convenient to me.

Essentially, as c is a constant, it is just E=qm where q is a constant. I.e. Energy and mass have an conversion factor that is simply a constant number.

But if we did not measure any of the units of energy, mass, distance or time in the exact units we do (and most of those are totally arbitrary units) it would be a different constant, and not exactly c²

So why is the equation so conveniently E=mc² and not E=qmc² or E=qm ?

And yes, I got an A in physics O'level, but it was a long time ago...

2018-08-24

Amazon a tad disappointing

As you know I have been trying Amazon.

The first thing we tried for FBA (Fulfilled by Amazon) was quickly included in their inventory and listed for sale. I was impressed!

It took a few days for initial orders to go, but they were pretty good overall.

The second lot they have delayed and delayed - 2 days delay accepting the delivery by UPS and well over 2 days later they still list as "in transit" and not available to buy.

I can understand that things take time, but at least be accurate. They know (as the UPS tracking confirms) they have the 50 packs of cards at the fulfilment depot, and have had for over 2 days, but they misleadingly list it as "in-transit" still.

At the very least record what is where and manage expectations, please.

Very poor service.

So I have listed the latest A&A cards for fulfilment by the office. At this point I think we will be quicker! Once Amazon work out they actually have stock, they can start shipping instead.


P.S. for some reason I cannot even list these as advertising on Amazon, WTF?

P.P.S. And WTF Hobbies › Trading Cards & Accessories? They are standard playing cards plus a bit, like every other pack of "Standard" playing cards with jokers and double back and so on.

Well over a week, but on a Sunday they finally have the A&A cards listed for fulfil by Amazon.

QR abuse...

I'm known for QR code stuff, and my library, but I have done some abuse of them for fun - I did round pixels  rather than rectangular, f...