Category Archives: Uncategorized

Xcode findings

As I start experimenting with Xcode I realise that it is a tricky beast.

Xcode 10.2.1

I realised Xcode 10.2.1 used 100%+ CPU. I fixed that by reinstalling it completely.

Reainstalling Xcode I had managed to mess upp the simulators.
Error: Unable to boot device because it cannot be located on disk
Solution: Run in Terminal: xcrun simctl erase all

Xcode 7.3.1

Xcode 7.3.1 Fails to start on macOS 10.14.5.

A first iOS app with Xcode 10.2.1

Ten years too late I decided to look into iOS development. It is too late, because the Klondyke era of becoming a millionaire on simple apps is probably over. On the other hand Swift has arrived and reached version 5 so it should be a good time to get started.

What I have is

  • Mac OS 10.14.5
  • Xcode 10.2.1
  • iPhone 6s, iOS 12.2 to deploy to
  • iPad 3, iOS 9.3.5 (obsolete by Apple standard)
  • 20 years of programming experience
  • Very limited experience with Swift 5
  • No experience with Xcode, Objective-C or macOS development

I am mostly a backend-programmer, who have to do HTML/CSS/JavaScript as well. Xcode is creepy. I have thought about a few appoaches

  1. Buying a book (but a challenge to find a book with relevant complexity, mix of tutorial/reference, for Xcode 10 / Swift 5)
  2. Apples obsolete tutorial (but I was put off by the fact that it is written for Swift 3)
  3. Just playing around with Xcode (just kidding – that is too scary)
  4. Some online course, like Udemy (but it is not my way)
  5. A simple trumpet tutorial

I went for (5). It was good, because in a few hours it took me all the way from starting Xcode to running something on my iPhone.

Building for the simulator and running works. And I managed to deploy to my iPhone (it is actually quite self explanatory: connect the iPhone, select it as destination in Xcode, and later in the iPhone under settings -> general -> device management you allow the app to run).

The short version is that it all went well! But…

Obsolete iPad 3

I failed to build for my obsolete iPad 3. What happens is that all is fine, and then I come to this screen:

I type my password, and immediately it (building/signing) “Failed with exit code 1”. I can imagine two options right away

  1. I need a real developer license (not Personal Team) to do this
  2. I need an older version of Xcode to build for 9.3
    (and in that case I might need to use older project format, and perhaps not even Swift 5, I don’t know)
  3. I got some indication that with a Personal (free) developer license I can only deploy to a single test device, that would perhaps not include old devices

It actually only builds for Deployment target 12.2, no older versions in the list.

Update: Page 60 of the free Apple Book “App Development With Swift” tells clearly that a free account only supports a single device. So it is clearly a waste of time to ignore that restriction and try to deploy to my iPad.

Xcode

I have spent a few hours with this now. I wrote 4 lines of code. I have ctrl-clicked on things, dragged-and-dropped-things, added properties to things, added resources, opened panels and used shortcuts. If you are used to things like Visual Studio it will probably feel somewhat familiar. But for me, who mostly use Vim, it is very scary.

Update: Xcode turned out to use 100%+ CPU constantly. I completely removed it and reinstalled it, and it seemed to help.

Computer Requirements / Performance

I did these experiments on a MacBook Pro 6,2 (that officially does not support macOS 10.14). It has an SSD drive and 8GB or RAM. Building takes almost 10 seconds, but starting the simulator and loading the app takes almost a minute. The computer clearly gets warm. Neither Xcode nor the simulator consumes much memory (Activity Monitory says about 200Mb each). Obviously, if you run the simulator much in your daily work, a faster CPU is worth it.

I think my 1440×900 display may be the biggest problem if I want to do anything real thought.

Conclusion

I have mixed feelings, it could be worse and better. I clearly need to find a way to be quickly guided through building different types of apps. I think I need a few days being guided through Xcode until both Xcode and the different project artifacts feel somewhat natural.

I have a simple app I want to build for myself, but right now it feels much to intimidating.

I found that Apple has released a free online book (available in their Books application) called App Development with Swift. That seems to be a good option.

Whisky Head to Head

The idea is to drink two different whiskies and make a few comments. I usually do this alone, in the evening, with two small drams, a glas of water and some salty snacks (like crisps).

To me the way I experience a whisky can change from time to time. Not the least, it depends on what I have eaten and drunk before I taste the whisky. I find it very hard to drink one whisky one day, and another the next day, and compare them. I also find it hard to try many whiskies, because my senses quickly change. So two whiskies, head to head, should be the most fair way I can compare and rate whisky.

It is not my intention to rate value-for-money. I will mostly try standard whiskies that are produced and available, and expected to have somewhat consistent quality. I think it is more interesting to find good affordable available whiskies, than to seek the ultimate bottle from a lost distillery. Occasionally I will however try a more unique, rare and expensive bottle, to see how it compares.

Deanston 18 vs Old Pulteney 18: Color very similar, Old Pulteney somewhat darker. On the nose Old Pulteney is more pleasant; sweeter and richer. Deanston is dryer and slightly more chemical. Old Pulteney tastes perfectly balanced with a clear (but not overwhelming) hint of its Spanish oak casks, nice after taste. Deanston also very nicely balanced, with (to my taste) a more dry traditional single malt character. Both are very stable representatives of 18 year old Scotch single malt, but neither is very brave. If I have to choose I prefer the Deanston, I find it more interesting.

Jameson Black Barrel vs White Walker: Jameson has a deep sweet characteristic scent while White Walker is more subtle, a bit chemical to me. Taste impressions are quite the same; White Walker has a quite thin, somewhat sweet taste (perhaps the best I can say is that its not too bad considering its a blend). Jameson tastes caramel, very good, but a bit too much of something. I prefer Jameson, even without considering it is both cheaper an generally available. The reason I tried these two is that I found White Walker ice cold quite nice. I froze another blend (J&B) and it was not at all as good, and not as sweet. So I thought perhaps White Walker had a sweetness like Jameson Black Barrel, but it wasn’t so. I will try Black Barrel frozen some day (since White Walker is limited edition).

Glenmorangie 10 vs Storm: Both rather pale color, and light fruity on the nose. The Storm may actually have a slightly richer aroma. Glenmorangie tastes excellent in its light simplicity, although some bitterness remains. Storm is heavier, more flavour, less fruity, a bit chemical and more bitterness: I lack a defined character. After a while, I clearly prefer Glenmorangie, despite it is lighter (usually a more heavy whisky wins head to head, is my experience). Later, Glenmorange remains flawless in its simplicity, while there is something unpleasant about Storm.

Makers Mark vs Motörhead: Unsurprisingly they are both nice dark amber in color, very similar. Makers Mark has a much sweeter (raisin, vanilla) aroma while Motörhead is much more subtle. Same is true for the taste; Makers Mark has a fine Bourbon flavour also after drinking the drier and lighter Motörhead. They are both good. For those who like Bourbon Makers Mark is clearly the winner. Motörhead is still a good oakflavoured whisky, perhaps too sweet and Bourbon-like to those who don’t like that. Considering price, or not, I must say Makers Mark is the better whisk(e)y. Although, there are situations when I could prefer Motörhead.

Caol Ila 12 vs Kilchoman Machir Bay: As I expected quite similar color and aroma. Kilchoman slightly paler. On the nose they are clearly different, but I have a hard time putting words on it. Caol Ila is heavier, more oily. Starting tasting Kilchoman is like a sparkling firework in the mouth, very good. Caol Ila is, even when it comes to flavour heavier, more oily and more smooth. Sometimes I love heavily peated whisky and sometimes I think it is too much. This time I like them both. Ultimately, Caol Ila comes out slightly better for being richer and more smooth, but it is very close.

Ranking

I will based on my notes above try to rank all the whiskys from best to worst. I will update this as I try more.

  1. Deanston 18
  2. Old Pulteney 18
  3. Glenmorangie 10
  4. Makers Mark
  5. Motörhead
  6. Jameson Black Barren
  7. Johnny Walker White Walker
  8. Storm

Heavily Peated

  1. Caol Ila 12
  2. Kilchoman Machir Bay

Simple Mobile First Design

If you build a web site today you need to think about the experience on mobiles, tablets and desktops with different screen sizes. This is not very easy. In this article I have applications (SPAs) in mind rather than sites/pages.

If you are a real, ambitious, skilled designer with a significant budget, there is nothing stopping you from doing it right. Responsive design is dead, because most often you have no choice, so it is just design.

However, you may not have that budget, skill, time and ambition, but you still need to think about vastly different screen sizes. Or perhaps you just need to build a simple native-app-like website.

Two separate implementations

In many cases I would argue that it makes sense to simply make a separate site for mobile and desktop. There are many arguments but I will give one: use cases are often very different. A desktop app is often opened, kept open for a long time, and much data may be presented and analysed on screen, in memory. A mobile app is often opened shortly, to accomplish a single task, and then closed. This means that you probably want to manage state, data and workflow very differently as well.

Bootstrap (or similar)

There are frameworks (like Bootstrap) and technologies like Flexbox to allow you to build a responsive app. Before using those, I think you should ask yourself a question.

How do you want to take advantage of more screen space?

Think of regular desktop applications (Word, Photoshop, Visual Studio) or your operating system: when you have more screen available you can have more stuff next to each other. You can have more windows and more panels at the same time. Mostly. Also, but less so, small things get larger (when they benefit from it). It helps to be able to see an entire A4 page when you work with Word. But when you have an Excel sheet with 4 used columns, those don’t use your entire screen just because they can.

Bootstrap tends to create larger space between elements, and larger elements where it is not needed (dropdown <select>, input fields). I say tends to, because if you are good and very careful, you can probably do a better job than I can. But it is not automatic and it is not trivial, to make it good

What I mean is that if my calendar/table looks gorgeous when it is 400px wide, what good does it make to make it larger if the screen gets larger? So I think a better approach to responsiveness is to say that my calendar/table takes 400px. If I have more space available, I can show something else as well.

Mobile Screen Sizes

To complicate things further, mobile phones have different screen sizes, different screen resolutions, and then there are hi-resolution screens that have different virtual and physical resolutions.

So you have your table that looks good on a “standard” mobile with 320px width. What do you want to do if the user has a better/larger screen?

  1. make it look exactly the same (just better/larger)?
  2. reactively change the way your app looks and works?

If you are opting for (2), I need to wonder why, really?

I argue that if you pick (1) you can make development, testing, documentation and support easier. And your users will have a more consistent experience. At the expense that those with a large mobile may not get the most out of it when using your app.

I propose a simple Mobile First Responsive design

What I propose is not for everyone and everywhere. It may suck for your product and project. That is fine, there are different needs.

I propose a Mobile First (Semi-)Responsive design:

  1. Pick a width (320px is fine).
  2. Design all parts, all pages, all controllers of your app for that width.
  3. On mobile, set the viewport to your width for consistent behaviour on all mobiles.
  4. Optionally, on desktop (and possibly tablets), allow pages to open next to each other rather than on top of (and hiding) each other to make some use of more screen when available.

Seems crazy? Please check out my Proof of Concept and decide for yourself! It is only a PoC. It is not a framework, not a working app, not demonstrating Vue best practices, and it is not very pretty. Under Settings (click ?) you can check/change between Desktop, Tablet and Mobile mode (there is a crude auto-discover mechanism in place but it is not perfect). You can obviously try it with “Responsive Design Mode” in your browser and that should work quite fine (except some elements don’t render correctly).

Implementation Details

First, I set (despite this is not normally a recommended thing to do):

<meta id="viewport" name="viewport" content="width=320">

Later I use JavaScript to change this to 640 on a tablet, to allow two columns. Desktops should ignore it.

Second, I use a header div fixed at the top, a footer div fixed at the bottom, and the rest of the page has corresponding margins (top/bottom).

.app_headers {
   position: fixed;
   top: 0;
   left: 0;
 }
 .app_header {
   float: left;
   height: 30px;
   width: 320px;
 }
 .app_footers {
   position: fixed;
   bottom: 0;
   left: 0;
 }
 .app_footer {
   float: left;
   height: 14px;
   width: 320px;
 }
 .app_pages {
   clear: both;
 }
 .app_page {
   margin-top: 30px;
   margin-bottom: 12px;
   width: 320px;
   float: left;
 }

In mobile mode I just add one app_header, app_footer and app_page (div with class). But for Tablets and Desktops I can add more of them (equally many) as the user navigates deeper into the app. It is basically:

<div class="app_headers">
  <div class="app_header">
    Content of first header (to the left)
  </div>
  <div class="app_header">
    Content of second header (to the right)
  </div>
</div>
<div class="app_pages">
  <div class="app_page">
    Content of first page (to the left)
  </div>
  <div class="app_page">
    Content of second page (to the right)
  </div>
</div>
<div class="app_footers">
  <div class="app_footer">
    Content of first footer (to the left)
  </div>
  <div class="app_footer">
    Content of second footer (to the right)
  </div>
</div>

I use little JavaScript to not add too many pages side-by-side should the display/window not be large enough.

It is a good idea to reset margins, paddings and borders to 0 on common items.

I also found that you need a font size of 16px on iPhone, otherwise the Apple mobile Safari browser will immediately zoom when user edits <input> and <select>.

Most effort when I wrote my Proof of Concept was

  1. Getting the HTML/CSS right and as simple as possible (I am simply not good enough with HTML/CSS to just get it right)
  2. Implementing a “router” that supports this behaviour

Being able to scroll the different pages separately would be possible, a bit more complicated, and perhaps not so desirable.

Conclusions

Exploiting the viewport you can build a web app that works fine on different mobiles, and where the issue with different screen sizes and screen resolution is quite much out of your way.

The site will truly be mobile-first, but with the side-by-side-strategy presented, your users can take advantage of larger screens on non-mobiles as well.

This way, you can build a responsive app, with quite little need for testing on different devices as the app grows. You just need to keep 320px in mind, and have a clear idea about navigating your site.

First look at Swift

Apple invented the Swift programming language to make application programming for iOS and macOS a better experience. If you are new to all this (as I am), I guess there are three approaches (depending on your background):

  1. Learn with the Swift Playground App for iOS
  2. Find a book/guide/tutorial to build actual iOS apps (learning Swift along the way)
  3. Use tools that you are used to, solving problems you are familiar with, using Swift (a programmers’ approach)

I decided to just write some Swift code. There is a cool web page called Rosettacode.org with implementations of different “problems” in different languages. I started looking at Swift code there to see if I could learn anything, and decided I could to better. (Admittedly, that is quite arrogant: I have never written a line of Swift code before, and now contribute Swift code)

I started looking at the problem Caesar Encryption and solved it for Swift. The full code comes below (in case someone changes it on Rosettacode)

I have a C/C#/Java/JavaScript background. This is what I find most notable about Swift.

Backward declaration of variables, arguments and function return types. Type comes after the name (with colon in between).

Named parameters to function, unless you prepend an _ to the name.

Closures can be written (quite just) like in JavaScript. (see charRotateWithKey in the caesar function)

Wrapping/optional: a normal variable, after it is declared must have a valid value. The language ensures this for you. Look at the first line in the function charRotate below: the ! means that if the parameter c does not have an ascii value the program will terminate right there. Look at the line starting with guard in main. The language guarantees that key is a valid integer after the guard, otherwise the function (program) must exit. I am far from an expert on this, find a better source! But you can’t do what you do in C/C#/Java/JavaScript – just hope it goes well, and if it does not catch an exception or deal with it afterwards.

ARC rather than garbage collection or explicit memory management. This matters not in my program, but it is worth mentioning. I first thought Swift and Rust were very similar and that it is more or less an incident that they are different languages, but I don’t really think so anymore.

The swift command can be used not only to compile a source file. It can be used to set up a swift project (directory), run tests, run the REPL (read-eval-print-loop) and more things. This seems quite nice, but I will write no more of it here.

My program below demonstrates type conversions, command arguments, usage of map and closures, string and ascii low level operations and output.

I think Swift is a quite fine language that I would be happy to use. I notice that the language has evolved quite much over the few years it has exited. So when you find things on the web or stackoverflow, you might not find current best practices.

func usage(_ e:String) {
   print("error: \(e)")
   print("./caeser -e 19 a-secret-string")
   print("./caeser -d 19 tskxvjxlskljafz")
 }
  
 func charIsValid(_ c:Character) -> Bool {
   return c.isASCII && ( c.isLowercase || 45 == c.asciiValue ) // '-' = 45
 }
  
 func charRotate(_ c:Character, _ by:Int) -> Character {
   var cv:UInt8! = c.asciiValue
   if 45 == cv { cv = 96 }  // if '-', set it to 'a'-1
   cv += UInt8(by)
   if 122 < cv { cv -= 27 } // if larget than 'z', reduce by 27
   if 96 == cv { cv = 45 }  // restore '-'
   return Character(UnicodeScalar(cv))
 }
  
 func caesar(_ enc:Bool, _ key:Int, _ word:String) -> String {
   let r = enc ? key : 27 - key
   func charRotateWithKey(_ c:Character) -> Character {
     return charRotate(c,r)
   }
   return String(word.map(charRotateWithKey))
 }
  
 func main() {
   var encrypt = true
  
   if 4 != CommandLine.arguments.count {
     return usage("caesar expects exactly three arguments")
   }
  
   switch ( CommandLine.arguments[1] ) {
   case "-e":
     encrypt = true
   case "-d":
     encrypt = false
   default:
     return usage("first argument must be -e (encrypt) or -d (decrypt)")
   }
  
   guard let key = Int(CommandLine.arguments[2]) else {
     return usage("second argument not a number (must be in range 0-26)")
   }
  
   if key < 0 || 26 < key {
     return usage("second argument not in range 0-26")
   }
  
   if !CommandLine.arguments[3].allSatisfy(charIsValid) {
     return usage("third argument must only be lowercase ascii characters, or -")
   }
  
   let ans = caesar(encrypt,key,CommandLine.arguments[3])
   print("\(ans)")
 }
  
 func test() {
   if ( Character("a") != charRotate(Character("a"),0) ) {
     print("Test Fail 1")
   }
   if ( Character("-") != charRotate(Character("-"),0) ) {
     print("Test Fail 2")
   }
   if ( Character("-") != charRotate(Character("z"),1) ) {
     print("Test Fail 3")
   }
   if ( Character("z") != charRotate(Character("-"),26)) {
     print("Test Fail 4")
   }
   if ( "ihgmkzma" != caesar(true,8,"a-zecret") ) {
     print("Test Fail 5")
   }
   if ( "a-zecret" != caesar(false,8,"ihgmkzma") ) {
     print("Test Fail 6")
   }
 }
  
 test()
 main()

Adobe CS4 and macOS 10.14 Mojave

How about using an old unsupported CS application on current macOS?

Today I had a reason to try it out. The short version is that it seems to work with Photoshop and Illustrator, but not with Indesign.

Background

Adobe used to sell “perpetual licenses” with their Creative Suite software. Years ago they stopped doing that and changed to a subscription model with Creative Cloud. People with perpetual licenses could still use them, but support in mac OS is getting more troublesome with every upgrade. A perpetual license could be used on two computers, and there was an activation/deactivation feature.

My Case

I have a friend who use CS4 on two older Macs running unspported version of macOS. My friend now got a brand new MacMini (with macOS 10.14 Mojave) and ideally we wanted to deactivate CS4 on the old MacMini, and activate it on the new. That was obviously a gamble.

Activation Servers Down

It appears the Adobe Activation servers are down. Deactivation on the old MacMini was not possible. Thus proper Activation should also not be possible.

Trying an old workaround

There used to be an old workaround (clearly used for software piracy) described here. We tried installing CS4 on Mojave and that worked fine. We then did the hack in the article, and that worked too. It seems Photoshop and Illustrator worked correctly, but Indesign did not. Indesign ran into a perhaps well known problem about “empty toolbox”. Also, when choosing “New”, an empty dialog window opens. This can perhaps be fixed, but we did not bother.

Restoring CS4 using Time Machine gave the same result for practical purposes: Photoshop worked but Indesign appeared broken and could not even be started.

CS5, CS6

Obviously, I can’t say anything definite about CS5 and CS6. I guess the workaround does not work. And I believe after reading some forums that the activation servers are down as well.

Conclusion

You may be able to install and use CS4 Illustrator and Photoshop on macOS 10.14 Mojave. Rumours indicate that it will not work at all in 10.15 when 32-bit support is finally dropped from macOS.

Micro service separation

Lets say we have a simple service that we can start:

$ ls
my-service my-data
$ ./my-service -d my-data -p 8080

As we interact with the service over HTTP on 8080 it stores data in the my-data folder. This may seem simplified but it is basically how any network (web, file, directory, database and so on) service works.

Micro Services

Lets say you have 4 different such services responsible for different things (like html/UI, storage, log and authentication) and they work together: well you basically have a Micro Service architecture.

All your different services can have a binary and a data folder. They can all exist in the same folder. You can start, stop and update them independently. If a service is “heavy” you can can run several instances of it. The services need to know about each other and listen to different ports, but that is just a matter of configuration and it can be automated.

Separation of micro services

While the simple approach above works (and it works surprisingly well), you may run into issues such as:

  1. you want to be sure two services can’t mess with each others data
  2. a service may be heavy and should run on separate hardware
  3. the services have common dependencies but it must be possible to update them separately (dll hell)
  4. the services may not even run on the same operating systems
  5. two services may use some resource that would cause a conflict if they shared it (say both use the same windows registry keys)
  6. different teams may be responsible for different services, and they shall neither be able to mess with each other, or blame each other

Clearly, running all services on the same computer, as the same user, in the same folder is not good enough in these scenarios. What options do we have?

Separate Hardware

Traditionally, especially in the Windows world, each service got its on computer (I refer to custom application services, clearly Windows itself comes with multiple standard services running).

In Windows, you typically install something with an install Wizard. It updates and stores stuff in different places in the system (Registry, Windows folder, Program Files and perhaps more). Multiple services may not coexist completely safely. So each get a Windows server that you backup entirely in case of disaster. This is expensive, wasteful and complicated.

Virtual Machines

VMWare was founded in 1998 and VMWare workstation was released in 1999. It changed everything, especially on Windows. Instead of having multiple computers you could have one physical computer running multiple virtual computers. Such a virtual computer “thought” it was a real computer. It needed special device drivers for the virtual hardware it ran on.

This is great. But you end up duplicating megabytes, perhaps gigabytes of system files. Installation and configuration of a computer is not trivial. Even if you automate it there are many details that need to get right. And a virtual computer may need to swap/page, and does so to what it thinks is a physical drive, but it is just a file on the host computer.

Just different users

You may run your different services in the home directories of different users. In theory that could work in Windows, but it is a quite unlikely setup.

In *NIX it would mostly work fine. You can have multiple terminals and log in as multiple users at the same time. If you are root you can easily write scripts to become any user you like, and execute whatever you want in their home directory.

Also, in *NIX most software can actually be built, installed and run in a regular user home directory. Often you just build and install as the regular user:

$ ./configure --prefix=/home/service01
$ make
$ make install

Basically, *NIX is already Micro Service-ready.

Chroot

For some purposes, running in a home directory may not be optimal. Instead, you may want to run the application in an environment where everything it needs, and nothing else, is in / (the root). There is a command called chroot that allows you to do this.

But chroot is not perfect. First it is not entirely safe (there are ways to break out of it). Second, you need to populate /bin, /lib, /etc with everything you need, and that may not be obvious. And you will only run the service in the chroot – the administrator or devops team need to access the computer normally, and they are not restricted to or don’t just see the chroot.

Containers

While all the above methods can be made to work for a microservice architecture, much effort has been made to come up with something even better, especially for deploying applications to the cloud: containers.

Containers and the tools around them focus much on development, deployment and automation. They are made for DevOps. It is cheap to configure, create, run and discard containers.

Application containers (Docker) are quite similar to a chroot, but they exist on Windows too. It is about putting everything an appliation needs, and nothing else, into the container so you can easily move, reconfigure it, duplicate it, and so on without touching your operating system itself. The issue of having exactly the right OS version, with the right patches, and the right versions of the right dependencies installed is much simplified when you can create a stable container that you can run on any machine capable of running containers.

System containers (LXC) are quite similar to a virtual machine. But while a virtual machine emulates hardware and runs a complete kernel, a system container just emulates a kernel (that may require some contemplation). It has all the advantages of a Linux virtual machine on Linux, but less of the costs.

Conclusion and Summary

Containers are popular, and for good reasons. But they are also a bit hyped. In the end of they day, you have your service code, and when you run it, it (perhaps) works on local data. That is it. You can separate, scale, isolate, secure, manage, deploy, monitor and automate this on different levels:

  1. Run your services in different folders (most light weight)
  2. Run your services as different users
  3. Run your services in chroots
  4. Create appliation containers for your services
  5. Create system containers for your services
  6. Create virtual machines for your services
  7. Get physical machines for your services (most heavy weight)

You can clearly mix and match strategies (you may very well need to).

And the price of a Raspberry Pi is so low, that even #7 can be very cheap for many purposes.

Doublethink 2019

Doublethink is: the acceptance of contrary opinions or beliefs at the same time, especially as a result of political indoctrination

As I listen to politicians and influencers in 2019 there are very many contradictory things that they seem to believe, and that I am expected to also believe.

I publish the list below not to have a discussion about every single item. Perhaps you agree about some and think I got others wrong (which is of course possible). I publish this list to show that it is common that politicians and other influencers hold and express contradictory opinions at the same time, and that we are supposed to accept and follow this.

I am convinced that each and every one of us should ideally hold zero contradictory beliefs at any given time. So even if you only agree about some of my items, we should be able to agree that we have a systemic problem with doublethink.

Much of this doublethink happens in the name of Political Correctness. Welcome to 1984.

We are supposed to believe…

that Nazism is worse than Communism despite the number of dead tell a very different story

that taxation is useful to restrict things like tobacco, alcohol and emissions, but not causing any harm to real businesses and employment

that they care about reducing CO2-emissions, despite they don’t want any nuclear power

that nuclear power is very dangerous, despite coal cause more deaths monthly on the planet than nuclear accidents ever caused

that the unequal distribution of power and money under capitalism will disappear when even more power is centralized with politicians to control not only government, but also companies under socialism

that Israel is a terrible apartheid state, despite there is a significant minority of arabs and muslims in Israel, enjoying a good living standard and having more democracy and human rights than arabs and muslims anywhere else in the middle east

that they stand up against all racism – nazism most of all, except when it comes to antisemitism among people from the middle east

that the hijab (or variants of same purpose) is a symbol of womens freedom when many women in and from the middle east tell a very different story

that the white European man brought slavery and slave trade to the world, when the arab slave trade had been going on for 1000 years (both from Africa and Europe) and the market and infrastructure was already there in Africa when Europeans for a few hundred years did slave trade (a horrible thing)

that capitalism is the worst threat to the environment, when the atrocities when it comes to destroying the environment in the Soviet Union are unprecedented

that Europeans brought all cruelty and misery to the american continent, despite human sacrifice and very authoritarian societies were massively widespread among the natives before the continent was discovered (the Europeans also did horrible things)

that socialism is in strong opposition to nazism, when clearly nazism is a form of socialism, and Marx coined the term “the jewish question” himself

that the left is against hatred and violence, when their own rhetoric against capitalists, white men and other opponents is very aggressive

that all criminals deserve another chance and can be good citizens and humans, despite the fact that psychopathy exists there is no known working treatment

that anti-fascism is a democratic mindset, however the Berlin Wall was stated to be an anti-fascist measurement and it had very little to do with fascism and everything to do with oppressing people in a socialist state

that capitalism is bad to people, despite it is practically unheard of people leaving free market nations for socialist nations, while millions of people have fled socialism

that Islam is a religion like others, and a religion of peace, despite it has been at war with itself, at war with its own people, at war with its women, and at war with its neighbors since the days of Mohammed

that the free market is to blame for lack of housing, when the housing market is one of the few markets that are heavily regulated, and while most free markets show no lack of options for relatively poor people: cheap clothes, food, fast food, entertainment, air travel, furniture are provided by global brands like HM, MacDonalds, Lidl, Netflix, Ryanair and IKEA (how about letting those companies work with lack of housing?)

that ISIS is not representative of Islam despite they just follow the footsteps of Mohammed which is clearly a virtue in Islam

that Islamism is a separate thing from Islam, despite the Koran considers the law, Sharia, central to the life of a muslim, and despite Erdogan has said that the separation of Islam and Islamism is an ugly western construction

that Islam is not a threat to freedom, democracy and human rights, despite there are virtually no muslim majority countries that are free, democratic and respect human rights

that Mohammed is a respectable prophet, despite he was one of the most cruel humans in history

that the environmentalists care about science when it comes to human caused climate change, but when it comes to GMO and studies finding disadvantages with organic farming they ignore scientific results

that later muslim aggressions have been a reasonable response to the crusades, when the crusades are minor isolated events compared to the many centuries of war, imperialism and slavery that muslims had brought upon the Middle East, Europe and Africa before the crusades

that women are structurally and systematically oppressed by men in the west, despite women live 5 years longer, spend less than 20% time in prison, commit far fewer suicides, experience far few workplace accidents, and generally have better mental health and more friends than men do

that feminists care about women who have a hard time, despite they don’t listen at all to what prostitutes say or want

that very few women go into tech jobs because of discrimination and sexist attitudes, despite women a century ago were restricted from most careers and (very impressively) managed to make it into medicine, teaching, law, economics, politics, and so on (feminists today are implying that tech men are worse than other men which is speculative, and also injury-on-insult since women tend to reject nerds in the first place)

that democratic socialism has anything to do with democracy, despite all socialist states have ended up seriously authoritarian, many of them with the word democratic in their names

that the west, USA and modern Europe, are the only evil empires, despite the history of the world is the history of empires (chineese, persian, roman, muslim, aztec, ottoman, russian, and so on) that conquered nations and enslaved people.

that we are very certain about the catastrophic effects of climate change, despite previous threats: peek oil, HIV, the ozone layer, nuclear power, nuclear weapons, world wars, new ice age, turned out to be exaggerated (in fact humans have always thought they live just before the end of time)

that men and women are practically the same, when the biological differences (both physical, psychological, and when it comes to abilities and talents) are clearly significant (and this is also proven scientifically in numerous studies)

that equality of outcome is desirable, when the way to achieve it necessarily is very authoritarian and restrictive to individual freedom and choice

that anxiety of climate change is a virtue, while anxiety of terrorism and criminality is a sin

that nationalism is inherently evil, despite no welfare state has ever existed beyond the scope of a nation

that women are for all purposes equal to men, except when they do horrible things like joining ISIS, then they are to be understood as passive victims and they can play the woman-card

that the anti-racist left are anti racist at all, when they often hold and spread very antisemitic attitudes and support antisemitic (muslim) organisations

that feminism is about fighting the patriarchy, when it is mostly indifferent to outright oppression of women in/from non-western cultures

that feminists have valid reasons to embrace people like Linda Sarsour (an advocate of Sharia in USA), when they reject people like Ayaan Hirsi Ali (an ex-muslim standing up for human rights)

that political correctness is more important (when it comes to respect of minorities and other cultures) than the words of Martin Luther King: History will have to record that the greatest tragedy of this period of social transition was not the strident clamor of the bad people, but the appalling silence of the good people.

that cows, chicken and pigs will be happily liberated by vegetarians, when the animals will instead be practically extinguished

that christianity and islam are mostly the same, despite christianity have been reformed on several occasions and christians mostly accept and respect different interpretations of their religion, while Islam is inherently resilient to reformation, has failed to reform but rather tend to fall back into fundamentalism, and muslims mostly don’t accept the interpretation of other muslims.

that socialism is a fine idea, which it perhaps was just like Thalidomide (Neurosedyn in Swedish), but after seeing the catastrophic effects of applying it, it is nothing less than heartless, cruel and evil to make another attempt (but socialism has, unlike capitalism, science and most other activities, absolutely no feedback loop so it is applied over and over again with the same horrible result – only the propaganda is refined)

intolerant extremists to the right (fascists and nationalists) are considered an absolute evil and threat and they must not even be talked to, but the returning murderers and rapists of ISIS are supposed to be respectfully integrated (getting more support than any other refugee or ISIS victim could dream of)

that the idea of socialism, which ultimately is to reward those who do wrong and punish those who do right, can ever lead to a good society despite any workplace, relationship, raising of children or keeping pets would fail horribly following the same inferior idea (I dare you to start encouraging bad behavior and punishing good behavior with people or pets around you)

that the problem is that some people are very rich, when in fact poverty globally is being effectively pushed back (except mostly in a few unfortunate authoritarian and/or socialist countries); caring about improving the situation for the poor is emphatic, caring about taking from the rich is only jealousy (and shows ignorance of basic economics)

that gender theory and political correctness are good things, when they are just the racial biology and racial hygiene of our time (the purpose is to classify and group people based on origin and physical attributes, and then to create a conforming population for the utopia, not to respect human rights or diversity)

that women have absolute right to their own bodies (abortion now legal up to day of birth in some places), unless they want to make profit on sex or sexuality

that there is anything reasonable about transgender women competing with other women in elite sports, despite the obvious fact that they have a massive unfair advantage

that gender is a social construction, although we are born with a sexual orientation

that Che Guevara is a fighter of freedom and equality for the left, when he was a homophopic, rasist, chauvinistic murderer

that while abortion is an absolute right (my body my choice), surrogacy is unacceptable

that criticism of Islam is Islamophobic, while criticism of Israel is not antisemitic

In Sweden, we are supposed to believe…

that it will reduce emissions to build high speed railroads to the north to replace a few daily flights (emissions from construction will exceed flights for foreseeable future)

that criminality can not be reduced by longer prison sentences, despite criminals answer that they did not even recognize they got a punishment at all for their crime

that there is evidence longer prison sentences don’t work to reduce crime, when it has never been tried in modern time in Sweden (references are usually to studies from the US where already draconian prison sentences were made even longer, which obviously says very little about what happens if criminals start being punished at all, or from a very low level)

that socialism made Sweden rich, when in fact the foundation of wealth in Sweden was built before the second world war by a low-tax, laissez-faire economy (that later came to slow down as taxes rises under socialism)

that socialism brought social security to the working class in Sweden, despite the workers organized it themselves as private insurances (that the socialist government later nationalized and took credit for)

that we have world class healthcare, despite people who have been living abroad are often shocked with Swedish health care

that they care about the well-being of animals, when they want wolves to hunt freely causing massive cruelty to wild and domestic animals wherever they come

that they care about vulnerable people, when they are mostly unwilling to protect ordinary people – even abused women – from criminals with a long record of offences

that the left (Swedish V) is inherently against racism, when they were the only party who did not oppose Hitler at the time Nazi Germany conquered Norway and Denmark.

that the left (Swedish V) is democratic and against imperialism, when they were the only party not support the Polish Solidarity movement at the time

that restricting access to weapons to honest citizens and hunters even more will make the country any safer, despite these legal weapons are virtually unheard of in crime cases (except rare self defense cases)

that they care about ethnic diversity and indigenous people, when Sweden blatantly ignores UN Declaration of the Rights of Indigenous People when it comes to the samis.

About Venezuela, we are supposed to believe…

that USA is to blame for the catastrophe in Venezuela, despite Russia and China has much more dealings with the socialist regime

that it is about USA wanting the oil, when USA is rather self sustained

that Russia has some moral ground when they object to interfering in the internal affairs of other nations, like Venezuela, given their recent history in Georgia, Ukraine and Chechnya, and a longer tradition of occupying neighbour states

that they care about potential climate refugees in a distant futures, despite they don’t give a shit about refugees of socialistic Venezuela

that the crimes the socialist regime in Venezuela commit against human rights and its own population (censorship, torture, oppression, socialistic market regulation and currency regulations resulting in lack of everything, blocking humanitarian aid, ignoring the constitution, establishing collectivos to harass and brutalize people, and so on) are somehow reasonable given a narrative that USA is working against the chavism and socialist movement

that the socialist regime had inherently good intentions towards its own population when it ran welfare programs in the past, despite the same regime now is completely indifferent to the suffering of its own people, even rejecting international emergency humanitarian aid (the regime only cares about its loyal supporters, everyone else who don’t support the socialistic cause can suffer)

that things are mostly fine in Venezuela despite UNHCR tells that more than 3 million people have fled the country in a few years (3 million people had left GDR before the Berlin Wall was built to prevent it)

ArchLinux on RPi with USD Harddrive

I have found that one of the weakest parts of a Raspberry Pi server or workstation is the SD card: it is slow and it will break sooner rather than later. There may be industrial SD cards or better SD cards, but a good old USB hard drive is just better.

With RPi v3 it shall be possible to boot straight off a USB drive! That sounded great so I got a brand new RPi v3 B+, a USB hard drive, and I installed ArchLinux on the hard drive, just as if it was a memory card. Fail. That did not work (with ArchLinux, Raspbian may be another story).

But there are levels of pain:

  1. All SD-card
  2. SD-card, but /home on USB harddrive
  3. USB harddrive, but /boot on SD-card
  4. All USB harddrive

I decided to try #3.

It turns out that when the RPi boots it runs u-boot (its like the BIOS of RPi, and many other embedded devices). At one point u-boot reads boot.scr (from the first VFAT partition of the SD card). It had the lines:

part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"

I figured that I could do this instead:

# part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=/dev/sda2 rw rootwait smsc95xx.macaddr="${usbethaddr}"

However, boot.scr has a checksum so you cant just edit it. But it tells you what to do: run ./mkscr. But it is dependent on mkimage, so the procedure is:

  1. Install uboot tools
    1. ARCH: pacman -S uboot-tools
    2. Ubuntu/Debian: apt-get install u-boot-tools
  2. Edit boot.txt (not boot.scr) to your liking
  3. Run: ./mkscr

Now only /boot is on SD-card. That is quite ok with me. There is very little I/O to boot so the SD-card should survive. If I want to I can make a regular simple backup by simple file copy of /boot to a zip-file or something, and just restore that zip-file to any SD-card.

There seems to be no need to edit anything else (like fstab).

Well, the bad thing is it did not work out 100% as I hoped. The good thing is that this should work with any RPi, not just the RPi v3 that supports USB boot.

Best Train Simulator 2019

I have some personal enthusiasm for trains, and last years part of that has been playing Train Simulator on PC. That is the game that used to be called Railworks and that currently is named Train Simulator 2019. While I have spent much time with it I also have mixed feelings.

In 2019 there are two alternatives to TS2019 that I have tested and that I will write about: Train Sim World and Trainz Railroad Simulator 2019.

My experience with Dovetail Train Simulator (2019)

I got Train Simulator because I wanted to try to drive trains. The game has developed over the years but there are some annoyances.

The game has some quirks and bugs. The physics, engines, wagons, signals, AI and scenario conditions sometimes don’t work in a way you would expect.

The game is also rather unforgiving. One little mistake can ruin a scenario so you can’t even continue. If that was passing a red light, ok. But sometimes I am just a little late, a little early, I connected or disconnected the wrong wagon, I went into the wrong siding or something like that.

The combination of bugs and being unforgiving is rather frustrating. When there is a little inperfection in the game I can perhaps accept the lack of good simulation experience, but if it ruins the scenario completely, it is worse.

The game has a competitive aspect (it is a game) where you drive scenarios and get scores. This is particularly unforgiving. Decouple a wagon and for some reason (bug?) I get “operational error”, being penalised with -750 points (1000 is max), and I have no choice but aborting the scenario. Also, speeding is penalised heavily. This is annoying for two reasons: first the time table is often ridiculously tight, second it is not uncommon that maximum allowed speed changes unexpectedly.

You can read about the outdated graphics of TS2019 and that is true, but it does not ruin my experience. You can read about all the expensive DLC, but that is your choice (I bought some, but most everything on sales). What I find more annoying is that I buy a nice piece of DLC and it comes with very few scenarios. That is where the (Steam) workshop comes in and there are quite many scenarios (of varying quality) do download.

I found that creating scenarios was often more fun than driving myself and I have contributed some 44 scenarios on Steam Workshop. If driving is quirky, creating scenarios is kind of black magic (the problem is I need to test it, and when it fails after 40 minutes, I need to guess whats wrong and drive again for 40 minutes until I know if it works – a horrible development and debugging experience).

It seems to me it would be very possible to deliver a better Train Simulator game!

On Realism

It is easy to talk about realism. But is it really what we want. My experience…

  • Some routes allow for long eventless sessions. That is the realistic truth about driving a train, but how entertaining is it?
  • A real challenge when driving a train is breaking and planning your breaking. The weight and length of the train matters, as long as other factors. In the real world a train engineer makes calculations about breaking distances. They are not going to be driving a new train, with unknown weight, on a new track on a tight time schedule. Yet in a train simulator this is what we do, because we want (much) variation (it is a somewhat boring game anyways).
  • A real engineer knows the line well, and has special physical documentation about the line available. And he has studied this before. You don’t do that in a train simulator.
  • A real engineer spends much time checking things like breaks and wheels. And there is much waiting.
  • You can have a realistic “regulator”, that you can operate in the locomotive cab. That will look realistic in one way. But a real engineer would not point and look at it with a mouse, he just happens to have his hand there in the first place. User-friendly, where man-machine becomes one, is good simulation to me.
  • Real(istic) timetables are good, but not when it is almost impossible to arrive on time in the simulator.

My point is that I don’t want a realistic simulator. I want a simulator that gives me the feeling I am driving a train. And I want the time I spend with my computer to be more eventful, entertaining and challenging that the average work hour of a train engineer. And also somewhat more forgiving and I want support with things that are easier in the real world.

Train Sim World

Train Sim World is produced by the same company (Dovetail) as Train Simulator 2019. It appears they thought of it as a replacement for Train Simulator 2019, but it also appears that for now the games exist side by side. It is not clear that Train Sim World will ever replace, or even survive, Train Simulator 2019.

The good:

  • It looks (the graphics) better than the alternatives.
  • It may be the most “polished” option (also available for Playstation and Xbox, which gives you a hint).
  • If you get a “package” at discounted price on Steam (EUR25 for 4 routes) it is quite good value.

The bad:

  • It does not look that good; it is still computer graphics with obvious artifacts and problems. Also, the sound is not too convincing and the surroundings are pretty dead.
  • Walking around (in the scenarios) does not appeal to me, and it is not well made enough to add to the realism of the game.
  • Menus are a bit messy.
  • Quite limited number of scenarios, but plenty of “services”, but I think that contributes to (even) less events, action and storytelling.
  • The routes seem small, and very little action or room outside the mainline (like very linear).
  • Occational glitches like “what do I do now”, “what happens next” or “how do I do that”? (driving a service, I was done, told to get off, the train drove away by itself with no visible driver or no comments, and then nothing… had to just quit).
  • It lacks something. Like its not a bit dirty, noisy and rough… but just too smooth and clean.
  • So far, no possibility for user generated content. It is promised, and it will be based on Unreal, so it seems to be very technically demanding. I myself would prefer to be able to make scenarios with a story easily, without changing anything about the route or the other assets at all.
  • Unreal (which is to thank for the better graphics) seems to be a more complex (expensive) development environment, and perhaps this will limit in the future the availability or routes and assets, and make the price high (pure speculation).

I did give Train Sim World a first try, wrote a very negative review, refunded it, but after a few weeks I gave it a new try, and now I have a more balanced opinion about it.

Trainz Railroad Simulator 2019

Years ago I obviously did research and opted for Train Simulator rather than Trainz. Now that I was a bit disappointed with Train Simulator and rather disappointed with Train Sim World I felt I had to give Trainz 2019 a try.

My expectations based on marketing and what I read was:

  • Better graphics than Train Simulator, but perhaps not as good as Train Sim World.
  • More creator-, community- and sharing oriented (which appealed to my preference to making scenarios).
  • It’s a railroad simulator, rather than a train driver simulator.

I must say right away that I am quite disappointed. I ended up paying EUR 70 for Trainz, and EUR 25 for Train Sim World, and that does not reflect the value of what I got.

Download Station

Trainz comes with “its own Steam Workshop, Download Station”. This is the worst part of it. Hundreds of assests, organised alphabetically, with virtually no filtering and no community/feedback/rating function. Unless I completely missed something, this is shit. My use case is that I want to see if someone created a nice 30 min session for one of the premium routes that came with my purchase (and that has no extra dependencies). Trainz seems to live in the world where people download zip-files from ftp-servers and spend the effort of maintaining their virtual asset library like the stock portfolio. I am tempted to make a few sessions myself, and sharing them here, on my blog, but why?

Graphics

There is something idyllic, picturesque, beautiful and friendly about Trainz that is missing in Train Simulator and Train Sim World. There are gorgeous screenshots from Trainz out there. But when it comes to actual game performance on my actual computer (a NUC Hades Canyon) Trainz is the worst. I have been spending not so little time optimizing my graphics settings (and there are many settings to play with).

Quality

To my disappointment the routes come with quite few sessions. The beatiful route from Edinburg to Aberdeen (perhaps just to Dundee) has two sessions: a passenger service with the same Deltic locomotive going both ways. These two scenarios both take 1h30min each to drive. And the one I did try did not work in CAB (realistic) drive mode, because for some reason the Deltic can not pull those wagons with any speed whatsoever. Isn’t it reasonable to expect when a new EUR 70 release is made after 7 years, that the sessions are tested at least once, and working?

Then there was another beautiful session on the Cornish mainline where a 2MT steam locomotive pulls ~25 freight wagons and it just can’t make it up the grades. I asked in the forum and I had managed to get further than most people, but the suggestion was to just try another locomotive (edit the session). Why release a session with the wrong locomotive in the first place?

If driving steam locomotives in realistic mode can be a challenge in Train Simulator (often a frustrating one), in Trainz it feels… not realistic. Perhaps I need more practice, but it is very… unsmooth.

Other things

There is no support for a Gamepad (although I found a little software called AntiMicro) which works decently well for my purposes.

I really miss the look-out-throw-the-side-window camera view.

I appreciate that I can see the status of the next signal in the HUD.

When I have completed a session it does not remember (marked as completed) so I made my own list

A good thing about Trainz is that it is more forgiving than Train Simulator. I ran out of boiler pressure, but then I could switch to simple driving mode and at least complete the session.

I get the feeling that for people who already own and love the old Trainz this is an upgrade. But for a new player it is a rough experience.

Conclusion and recommendation

Unfortunately I think none of the games I have written about live up to the expections you should allow yourself to have in 2019. And I am not aware of a better game in the genre.

Clearly this genre appeals to enthusiasts who want to make their own assets and modify the game, and clearly Train Simulator and Trainz are based on old technology that have not aged too well (and people are reluctant to abandon their assets). Train Sim World, being based on Unreal, has not been able to deliver a workshop- or sharing-experience at all, yet.

If you are curious about how it is to drive a train, get Train Sim World (and an Xbox controller if you get it on PC, I know nothing about the Playstation/Xbox experience). Sit comfortably, turn up the volume, have some coffee (or whatever you drink) and do your best to enjoy the experience. Spend time with the tutorials and dont get too frustrated if you get stuck.

If you want to have your own digital train layout, and play with it (dispatch and control multiple trains), get Trainz, and make sure to have a powerful enough computer.

If you think that Steam workshop is a nice idea where you can share scenarios (and other assets) and communicate with other people about them get Train Simulator 2019. Cost/price aside, there are very many routes (and extra locomotives) available for Train Simulator 2019.

Train Simulator 2019 now supports 64-bit mode. Technically its not… hot… but it is being improved. Train Sim World looks better, but it is not that much better. Honestly, folks who make a living reviewing computer games say: “TS2019 looks so old, but TSW is built on Unreal like all the other cool games, much better.” But for your total train simulation experience, the difference is… marginal.

I would not be too surprised if the Train Sim World Editor never happens. If it is released I would not be surprised if it is too complex and a critical portion of contributors and enthusiasts never switch. The advice to enthusiasts to “Download the UE4 Editor from Epic and start learning”, I am sceptical about it. I doubt I will contribute scenarios if I have to get into a real 3D studio to place some trains and make some timetables/rules.

I would hope that Trainz gets a real workshop experience where you can easily share assets in a social way and where you don’t need to worry too much about dependencies. And I would hope that Trainz manages to polish their game, test it properly, and provide a solid graphics experience.