Tuesday, 28 April 2020

Just tax everyone with a beard

Insightful quotes about beards are nowhere to be seen. I blame it on the hipsters. The quote that came closest was Orson Welles, but it was simply too long (the quote, not the beard):
“I have the terrible feeling that, because I am wearing a white beard and am sitting in the back of the theatre, you expect me to tell you the truth about something. These are the cheap seats, not Mount Sinai.”
Someone else that also had things to say about beards was Peter the Great, who ruled Russia between 1682 and 1725.

When he came to power, Russia's administrative system was antiquated compared to the Western European nations. The state was divided into uyezds, a secondary-level administrative division; it corresponds to county. Each uyezd described groups of several volosts, earlier a term for territory ruled by the knyaz, a principality, but during this time it described the unit of administrative division. Peter looked to the west and saw many great things (in his opinion) and replaced the subdivisions with eight governorates, guberniyas.

His reign wasn't all reform, though. The subjugation of serfs to the will of landowners deepened, and he enforced class divisions, believing that “just as the landowner was to be tied to service, the townsman to his trade or handicraft, so the peasant was tied to the land.” Peasants had to have their master's written permission to leave the estate, and a new tax code expanded the number of taxable workers. The gap between serf and slave was smaller when his reign ended than when it began.

In fact, let's make a small detour called the Great Northern War. The war started in the year 1700, and ended 1721. Peter wants to open Russian trade routes to the West, and combines his forces with Denmark, Saxony and Poland to attack the Swedish hegemony in the North. Charles XII, the Swedish king at the time, subdued the coalition for nearly a decade, but then did the Instant Classic of marching for Moscow (lol).
“This victory has laid the final stone in the foundations of St Petersburg!”
The Battle of Poltava, 1709, marks the turning point of the war, marking the beginning of the Swedish Empire's collapse and the rise of Russia.

I'm not going to linger on the Great Northern War; other people are better at military history, but if you're interested I recommend Peter Englund's book The Battle that Shook Europe.

Alright, so Peter's involved in a lot of war, and we know since before that war is expensive. What's the first solution for everyone, when you have a lot of costs?

Tax everyone. Hard. Well, not everyone. Everyone that can't complain.

So Peter finds himself in a situation where he's running a country on an outdated administrative system and with an aging infrastructure. His first monopolizes some industries: salt (lol), vodka, oak, tar. Then he taxes customs. Partly because he wants Russia to be more Western, partly because money. Bathing, fishing, beekeeping is all taxed (there is one more, that I will touch on later), as well as tax stamps for paper goods.

But, nobody likes being taxed, so people start using loopholes to avoid some of the taxes. Earlier, peasants could skirt some taxes by combining several households into one estate. That won't do. So Peter implements a poll tax, replacing the household tax on cultivated land. Now each peasant pays 70 kopeks, in cash, individually. A much heavier burden than before. Russia's treasure expands sixfold between 1680 and 1724. Peter places heavy tariffs on imports and trade, to protect Russia's interest.

"But what about the beards? You start by talking about beards, and now you're talking about... Reformation in Russia?", I hear you say.

Peter the Great implemented a beard tax. In an utter display of power abuse, he decides that beards are not Western enough. NOBODY should have a beard. He empowers the police to forcibly and publicly shave anyone who doesn't pay the beard tax.

In a classic move I like to call let's play favorites, the tax depended on the status of the bearded person. Anyone in the Imperial Court, the military, or the government was charged 60 rubles annually. Wealthy merchants were charged 100 rubles per year, other merchants and townsfolk were charged 60 rubles. Muscovites were charged 30 rubles per year. Peasants were charged two half-kopeks every time they entered a city.

Those who paid the tax had to carry a "beard token", a copper or silver token with a Russian Eagle on the reverse and the lower part of a face with nose, mouth, whiskers, and beard on the front. (Front meaning "heads", here.)

Several different versions of the token were minted. The common round version was inscribed with the words "money taken" on the front, and the date on the reverse; there was a rhomboid version in 1725 that said "beard tax taken" and the phrase "the beard is a superfluous burden" on the edge.

The tax was lifted 1772. Everything that makes money, I guess.


Friday, 24 April 2020

Any fool can write code that a computer can understand

Good programmers write code that humans can understand.
Martin Fowler

Generators are dope. While I'm working on a tool that will create generators for you, in the meantime I can write a quick guide on how to create your own generator in JavaScript. Bonus: you can also call yourself a programmer when you're done.

Today, I wrote https://place-and-region-generator.netlify.app/. It is, as the URL says, a generator for place and region names. It took me maybe half an hour because it's really quick to write ugly code like I did, and it's also a really simple program. I'm gonna teach you how to write it, too. Instead of place names, let's go with dwarven names. I want to generate dwarven names. How do I go about that?

Step 1: Node & NPX

Since I work as a web dev in my daily life, my computer already has all the dependencies I need to create projects (react projects, in this case). Here's a super short guide to how to get node and NPX on your machine:

We need nodejs. Let's not care so much about what it is,  we can dig into that some other day. Install it (installation varies between different operating systems), and then check that it worked with something like this in the terminal (this is in an ubuntu container):
On a mac, it can look like this:
Great. We're almost half-way. We also need either NPM or Yarn, two package managers that are used for javascript projects. Don't mind the technical details, for now. NPM comes with node, so we'll go with that.
The last part of step 1 is to make sure that npx is installed (it should come with the latest versions of npm):


Step 2: React & Previewing Stuff

The next command we need to run is this: "npx create-react-app dwarven_names"

Where "dwarven_names" is the name of our project/generator. This will create a new React app with the name "dwarven_names". It will create this in a folder named "dwarven_names" like the text says:

Let's do what it says: cd (change directory) into dwarven_names and run "npm start":

And if you now navigate to http://localhost:3000/ you will see your app running. It doesn't look like much, right now:

But hey, you did that! Awesome. Let's rip everything out and create something of our own instead.

Step 3: Creating a basic generator

Now we're touching on actual programming, but I'll try and write it so you can follow along and just replace things with what you, yourself, need. Feel free to reach out to me on discord, I'm Azaz#1947 there, or comment here and I'll help as best I can.

Alright, to edit code it's usually easier to do so in a code editor. But you can edit code in notepad.

Let's open the file "App.js", it's located in the "src" folder inside our "dwarven_names" folder. It looks like this:
Great. We don't need some of this junk, but I'll go through it nonetheless:

The first three lines are dependency imports. We fetch "React" from a package aptly named "react", we fetch a logo (it's the rotating atom thing), and we import some css, too.

After that, on line 5, we declare a function named "App", and inside our function we return some HTML... ish. It's HTML but with some extras. In HTML, you write "class", but you can't do that in JavaScript, so you instead write "className". We'll rip out most of the stuff inside this. Delete until it looks like this:



If you save that and look in the browser, you'll see we've successfully removed some cruft. You's a programmer!

We'll add a title, and create some Dwarf names. In Zonk's generator (which I borrowed for this tutorial), a Dwarven name comes from an appropriately dwarven base, such as "Dragon" or "Stone", combined with a suffix, something dwarven like "arm", "killer" (I guess these are WHFRP dwarves?), "shield" and similar. We'll create two arrays to hold these. An array is basically a list, but the syntax is important. Here's how it looks in JavaScript:



Not terribly difficult to understand. Here's the syntax, in its base form: const arrayName = [value1, value2, value3]

Values can be a lot of things, but we're working with text (or "strings" as the fancy name is).

It doesn't really matter where in the file we place these arrays, but imports should always be at the top, so we'll just tuck them in under that for now.

The second to last thing we need to do (ish) is to get a random item from both arrays onto our page. Here's how that's done:

The [0] part is "give me the item at position 0 from the array named 'base'". Let's see how it looks:
You know what? That looks okay. Now we just need to make it "random" rather than always being the first item in both arrays. The secret is to use a function. Here's how that looks:

And here's how it's used:

I realize now that I forgot to tell you what the {} deal in the code is, on line 14. It's telling React "run this function and insert the value returned from that function here".

And for the "randomElement" function we wrote, what we're doing is we're giving that function an array ("base" or "suffix") and then we're asking it to select a random item from that array and return it to us. It's a very fancy "modern" JavaScript syntax. So when we're using the function, we're saying "give me a value from 'base' and combine it with a value from 'suffix'"

Anyway, we're almost done. We want more than one dwarf name, though, so we'll do that with a fancy loop, like so:

There's a lot going on here. We're declaring a new array ("names") on line 10. On line 11 to 13 we're looping (going through the same code a specific amount of times, here it's 10) over the same piece of code 10 times and saving the result of that code in the new array we created.

array.push() adds an item to an array. randomElement(base) + randomElement(suffix) combines the result of the two randomElements into one (not all languages can do it like this, but JavaScript can).

the "names.map()" thing is just a shorthand way of saying "modify each element in the array like this". Here we're modifying them to create HTML paragraph tags. map() returns a new array, so we're not chaning the names array on line 10.

The "key" part is because React needs to know something unique about every item in the array, otherwise it complains a lot. Basically.

And here's how the results look:

There'll be a lot of repetition here because we only have three names of each kind to select from. More names = more combinations.

We've successfully created a generator. Right now you can use it on your own computer, which is pretty nifty, but we can also host it online for others to use. The last thing we need (can) to do in this step is clean up some junk that we don't need.

We don't want logo.svg, so remove that. Our CSS file can also be trimmed down to this:

the rest of the stuff in it is basically just "I want to create a rotating logo", and we don't have that.

Don't worry too much about the code; at the end of this guide I will show you all the files. We're basically done with it already.

Step 4: Version Control

Oh no, that sounds hard!

It is... kind of. I'm sorry to say, but this will be the hardest step to explain. Create-react-app, that we used to start our project with, has given us a .gitignore file, which is good because then we don't have to worry about that. Version control is basically like save points, but it's graphs and you can do lots of cool shit with it. I will not teach you anything about that. I will point out how we get this project onto our VC platform of choice.

I should probably have mentioned: YOU NEED TO INSTALL GIT ON YOUR MACHINE FOR ALL THIS TO WORK. It's not terribly hard, here's a guide: https://www.atlassian.com/git/tutorials/install-git

We have a few choices. Github is, ostensibly, the largest, most well-known of the platforms. Sign-up is easy (it is for most of these guys tbh). BUT they host ICE and so they can get fucked. Pick whatever. I picked GitLab, but the process is similar for all the platforms (you can also use Bitbucket, but stick with one of these three: Github, GitLab, Bitbucket, it will make it easier in the next step).

Create a new project on your platform of choice:

Note that I'm leaving the "Initialize repository with a README" checkbox unchecked.

Gitlab gives us instructions on how to proceed.

All that stuff is terminal-based. There are visual git clients available. I will not use one, but you can probably google for it. GitKraken is popular, and Fork is also a good one (if you're on Mac). Anyway, we'll follow the "Git global setup" first, then we want to do "Push an existing folder" because our project is already existing

If we follow the GitLab guide, everything should work just fine. (I sidestepped it a bit because I have several git accounts. If you want to specify a git account for a specific git repository, just omit the --global flag and the changes are local.) Here's the last few lines for me:
A whole lot of gibberish. It might make more sense to you later unless you already know git but then why are you reading this?

And this is how it looks like on Gitlab:

We are so nearly there. Lemme just hit on one point real quick: "git add ." means "stage everything that's changed in the folders you're tracking". "git commit" means "save all changes you have staged under this commit message" (it will prompt you for a message, or you can do "git commit -m 'your message here'" instead). If you end up in vim, the command to exit is "hit escape a few times, then :, then type q! and enter" and the command to exit and save is "hit escape a few times, then :, then wq and enter". That is, the command to start writing commands is :

For more on git, I recommend googling for guides. It's powerful and amazing.

Step 5: Get this thing online so help me

Let's get this app (you can use this word now, you're a PROGRAMMER) online! We'll use Netlify, because it's the easiest option. You can use your newly created Gitlab account to sign up on Netlify, so that's neat but they also offer the regular Google, Facebook, etc, etc. Once signed up, read their small guide/flash cards then hit that "New site from Git" button. Under "Continuous Deployment" ("CD" for us cool kids in the biz) select your poison of choice (GitLab for me). We need to authorize Netlify to access our GitLab resources, so I just hit okay because I'm wild like that. Find your newly created repository, and select it:
So the cool thing is, now that I've selected my "dwarven_name_generator" repo, Netlify is smart enough to know what tools I've used to create my application with. I cheated and used yarn, so I'm sorry about that but it will say "npm run build" instead of "yarn build" on this screen if you used npm:

All those settings look okay, so I just hit "deploy site" and I'm basically done. Because look at that, it's already deploying. I've got a new URL for my project; it's always randomized to start with, but poke around in the Netlify settings and you can change it to something else if you want to. I'm cool with the "modest-heisenberg-a2c78d" URL, because I figure I'm not going to push this application very much.
 
After a while, it switches from "Site deploy in progress" to "Last published at" and a link to our cool, new app. And here it is, in all its glory: https://modest-heisenberg-a2c78d.netlify.app/

Alright. Not too hard, right? YOU DID THAT. Well, I DID THAT but you could also do that if you follow along!

And the best part about Netlify is that if you ever update your master branch in git and push those changes to your remote repository (Gitlab, for me),  Netlify will spot those changes and deploy them automatically.

And that's pretty neat.

Step 6: ???


Step 7: Profit

Now that we know just how easy it is to make a generator, I hope you can see that it wouldn't be terribly hard to create a more advanced generator. It's basically just "pick a random option from this array, then a random option from this array, and then from this" and so on. It is easy. You'll run into problems -- you can google the answers, because the more you do this, the more you learn the "language" of programming, which in turn makes it easier to google for more answers.

Step 8: Collaboration

Oh, also, I made the Dwarven Name Generator public on GitLab: https://gitlab.com/cassie_/dwarven_name_generator -- so you can create pull requests that add code or names or suffixes or just whatever to it if you want to. But you'll have to read up on that yourself because this is getting very long. You can also inspect all the code for the project over there, so that's also neat. Especially Zonk should probably create a pull request because it's basically their idea, just chopped into a very small piece.

And if you have any questions, just hit me up either here or in Discord. Now go forth, my friends, and create! I expect great things from you!

Tuesday, 21 April 2020

The noblest of foods, the finest condiment of all

So sayeth Plutarch.

Today, we'll talk about salt. A lot of this is taken from Maguelonne Toussaint-Samat's book, A History of Food, which will feature heavily in other articles too -- it is, after all, a kind of bible. I recommend it.

I once tasked myself with writing an article about salt, or specifically the salt trade in medieval France. True to form, I started at the beginning -- the formation of salt deposits (did you know that there's a thick layer of salt beneath the mediterranean sea?) and the rise of Rome.

I'll try not to do that this time. We do need a basic understanding of how salt was manufactured, however, so, in short:

The history of salt precedes the history of mankind. We find salt in the sea, and in salt deposits. Occasionally, we find it in plants. Animals have salt in their blood. Salt occurs everywhere. Overwhelmingly, we've acquired salt from two primary sources, though: sea salt, and terrestrial salt (rock salt or brine springs). A distinction has to be made before we progress further: a salt-pan is an installation to collect the salt in seawater, and salt-works is the equivalent for collecting terrestrial salt.

To collect sea salt, you need the proper climate and terrain: a warm sea, plenty of sun, and constant winds. Collecting sea salt is limited to the Mediterranean coasts, the Atlantic coast between Britanny and Ghana, the China Sea's shores, and Madagascar. There are a number of coastal areas in the southern US and Central and South America, too, but they have no impact on France's salt trade.

In Europe, there are salt deposits in eastern France, northern Germany (Lüneburg), the Austrian Alps, and the Carpathians. In Africa, you find it in the subsoil or the surface soil of the Sahara; in Ethiopia and Katanga. China has good salt deposits too.

You can also derive salt from vegetal ash, green plants, or wood (or seaweed, obviously); salt derived from vegetable sources is more potassium than sodium chloride. Halophilus plants such as Coltsfoot, for instance, absorbs sodium from the soil, rather than potassium. The Gauls evaporated saltwater over wood fires, as reported by Pliny, a method that would be replicated later.

The technique of boiling brackish waters was employed by people in Scandinavia, Great Britain, and Ireland until it was cheaper to trade for salt than manufacturing their own. This didn't happen until the end of the Middle Ages, though (I will write about medieval trade later because that is a wonderful thing that not enough people talk about).

The Celts worked the Hallstatt mines 1000 BC; the archeological finds are well-preserved, showing evidence of trade across Europe and the Middle East.

Salt was only used in food, and as a preservative, until the discovery of chlorine in the late 18th century. Soda (natron), previously manufactured by burning halophilus vegetation, could also be manufactured with regular salt in 1791.
Tell me, would it be possible to live without salt pork? [1]
Emperor Claudius, asking the senate. The senate declared that life would be deprived of one of its greatest delights, were there no salt pork.

And now we, finally, touch on the rise of Rome. The Via Salaria, the salt road, existed before Rome. Salt merchants came up to the Etrurian plains from the marshes of Ostia, they stopped at the banks of the Tiber, at a staging post that would later become the Eternal City, to exchange salt for the local population's products. Where there is trade, eventually there is a market.

Romans liked their food salty; meat, fish, and vegetables were salted. Cheese was also salted, more than it is today, and so was bread. For bread, salt acts not only as a rising agent, but also to preserve it longer. I will speak on bread stamps (a Roman invention) at a later date, and I love bread stamps. Not only bread, beer, and wine also had salt added.

The Greeks considered salt a divine gift; and royalty was, also, a divine gift. As monarchies succeeded the Roman empire, salt became the king's prerogative. The first royal document we have concerning the legislation of salt is from the Lombard king Liutprand, issued in 715 BC. It regulates dealings in salt and imposes two taxes: one to be paid by the seller, and one by their customers.

And thus, by way of the Roman empire, we arrive at where we wanted to be: Medieval France. Well, soon.

Salt pans and salt-works on the great feudal estates, both of secular lords and of the Church, made up a large part of their revenues. Monasteries not only ran the rural economy, but they also managed the salt-making operations and distributions over a long period of time. The abbeys and monasteries provided most of the salt supplies of Europe; they bought or produced large quantities, distributed it locally, and sent it elsewhere to sell it.

This would all end by the 13th century.

Between the twelfth and the 13th centuries, the abbeys began to lose their monopolies of the food supply. In the Middle Ages, monasteries and the great dioceses of Arles, Marseilles, Agde, Bèziers, and Maguelonne ceded their rights to the salt-works to the local barons, who in turn became domini salis, salt lords.

The Baron of Fos acquired the salt-marshes of Fos, Saint-Mitre, and Istres. The Vicomte des Baux took control of Martigues. The free towns of Arles, Toulon, and Hyères became owners of salt-works. The entire area was subject to the Comte de Provence, a vassal not of the King of France but the Emperor.

Charles of Anjou, who acquired Provence as appanage by marrying the daughter of Raimond Béranger, needed money (a reoccurring theme) to win control of Naples. Frederik Barbarossa gave him his blessing, and Charles bought the whole of his vassals' salt production, at a price fixed by himself so that he could sell it again at a profit. He made a fortune. By the 14th century, the salt from Provence would have competition from the salt of the kingdom of France.

Philippe IV, the Fair, realized that a monopoly system like the counts of Provence had, was exactly what he, too, needed. He, too, was also short on money. Enter the gabelle.

The gabelle, deriving from gabella, from Arabic qabala, "tribute", was the solution to any monetary issues. Levied arbitrarily, the peasants suffered the most from it, for they got the grande gabelle. They not only paid more for their salt, but they had to buy it in fixed quantities. Obviously, the clergy, nobles, and other important citizens were exempt; they were franc-salé, free of the salt tax. The gabelle was one of the chief causes of the French Rebellion but would survive until 1945, albeit in a diminished form.
Louis X, le Hutin (the Headstrong), set up a corps of royal officers to replace the salt merchants who had found the answer to the salt tax in innumerable forged and fraudulent documents. In 1331 Philippe VI went further and set up salt warehouses, each with its own local area of jurisdiction and the right to fix the official quota that had to be bought. The price of salt was subject to the decree of the king and his delegates, and rose according to the sovereign's needs, which meant all the time. Accordingly when a ransom had to be paid for Jean le Bon, held prisoner in England during the Hundred Years' War, the tax rose to six deniers. From being set at 8 sous under Charles V and 12 under Louis XI, it rose to 21 livres per muid (274 litres) in the time of François I and his italian wars, since he too had to pay a ransom. [2]

Henri II sold exemptions from the tax for immediate cash, and the expense was passed on to the provinces concerned: Poitou, Aunis, Saintonge, Angoumois, Périgord, and Limousin. The Béarn paid nothing in tax since it had too many salt springs. Brittany escaped payment until 1675.

Thus, the tax varied between provinces, and even between towns within a province. Such differences create opportunities for contraband; faux sauniers, dealers in "clandestine salt", dealt in false salt. The real salt belonged to the king. In an effort to prevent contraband, the gabelle collectors' numbers grew, and in the 17th century, there were 25,000. If the tax didn't bring in enough money, the salt duty, that is, the required minimum amount to buy (at one point, 3.6kg), was raised. No matter how much salt you actually needed, the duty was what you purchased. This increased fraud. Ordinary people were (obviously) forbidden to sell any salt surplus. To make matters even worse, the judicial system was encouraged to enforce the tax -- the magistrates' salaries were calculated on the provincial yield of the tax itself, and informers snitches got a third of the value of the crime reported.

Crime grew. In 1780, according to Necker's Traité de l'administration des finances de la France, there were 3,700 seizures of salt, 2,300 men were arrested on the roads; 1,800 women, and 6,000 children. 1,100 horses and 50 carts were confiscated. 2,000 were given prison sentences, 300 were sent to the galleys for life.

The people of France, always up for a good rebellion, did so. Frequently. Protests did no good, and every attempt at an uprising provoked ferocious massacres. Rioting in Reims, Dijon, and Rouen in the 15th century, savagely put down. In 1548, civil war broke out in Guyenne, the royal troops were unable to cope with the 40,000 peasants gathered around Cognac and Châteneuf. Routing the soldiers, the peasants seized Saintes and looted it. The entire countryside between Poitiers and Blaye was laid waste. Next, the people of Bordeaux rose. Tristan de Monneins, the head of the administration, was cut to pieces and salted like a pig. The Constable de Montmorency was sent to suppress the rebellion; he set up gallows all over Guyennne. He marched into Bordeaux, disarmed the people, and confiscated all the church bells (I don't know why). Then, he fined the city 200,000 livres, suspended its parlement for a year, and forced 125 of the more prominent citizens to dig up the remains of Monneins with their bare hands, after which he hanged them (the people, not the hands.. but I suppose the hands hung, too). In 1549, Bordeaux was exempted from the tax, after paying an "indemnity" of 450,000 livres.

The "Peasant's Code", drawn up by the parishes of Brittany, stated that "It is forbidden, on pain of passing under the yoke, to entertain the gabelle or its children, or to furnish them with food or any other commodity. On the contrary, it is right to shoot at the gabelle as you would shoot a mad dog." Paris sent 6,000 men against Concameau, Douarnenez, and Audierne. The country was laid waste, and those who were not hanged found themselves rowing the Sun King's galleys.

The gabelle was abolished in 1790, but Napoleon imposed a tax of two centimes a kilo on it in 1804 (guess the war!), which was maintained until 1945.

I would like to stress that the gabelle was not an exclusively French phenomenon. China and India profited more from their salt taxes than their gold mines, according to Pliny. All states have applied taxation of some kind to salt. England forced the American colonists to use only taxed European salt. The abuse of the gabelle is, though, maybe the worst of its kind.

[1] Alexander Dumas, Dictionary of Cuisine
[2] Maguelonne Toussaint-Samat, A history of Food

Let's Go: setting up KataGo's Human-like network

TL;DR: It's all about them command-line arguments. Here's a short guide: Install Sabaki Download the latest release of KataGo  and e...