vankuik.nl

Latest weblog entries

2019-12-08 Linux VPS with TeamViewer

In 2017, I blogged about setting up a Linux VPS at Vultr, then installing TeamViewer. This is an admittedly uncommon thing to do; most Linux servers are administrated over SSH. However for remoting into a desktop usage, I find TeamViewer extremely user friendly on the client side. The client itself is excellent, includes copy/paste, file transfer, chat, and a host of features. And it works on multiple platforms.

Today I tried once more to set up a VPS at Vultr.com, with a Fedora 31 desktop and TeamViewer. Unfortunately, I can no longer get it working; TeamViewer installs fine but the client hangs upon connecting. I hope to update once I get it working.

Updated instructions for CentOS 8 are as follows. Note this fails for unknown reasons, see below.

Log in as root. First install the desktop, enable GUI to start after reboot, and download and install TeamViewer:

 # dnf groupinstall workstation
 # systemctl set-default graphical.target
 # wget "https://download.teamviewer.com/download/teamviewer.i686.rpm"
 # yum -y install ./teamviewer.i686.rpm

Edit the file /etc/gdm/custom.conf and remove the hash sign # before the line "WaylandEnable=false" so GDM uses X.org.

Add swapspace:

 # fallocate -l 1G /swapfile1
 # chmod 600 /swapfile1
 # mkswap /swapfile1
 # swapon /swapfile1

Add the following line to /etc/fstab:

 /swapfile1   swap    swap    sw  0   0

Add a user for yourself:

 # useradd -m -U mynewusername
 # passwd mynewusername

Add this new user to the sudo'ers file and reboot:

 # visudo
 # reboot

When done, reboot and log in at the Vultr website, because there, you can use your browser to access the graphical console. From there you can log into Gnome. It's important that you do this correctly; first click on the username. Now the password prompt appears. Next to the Sign In button, a settings icon appears. Click this icon, and make sure one of the options with "X11 display server" is selected! Continue to log in and you'll see the desktop. From here, you can start and configure TeamViewer.

Or at least, you should be able to. TeamViewer can be started, however the GUI never actually is displayed.

2019-09-16 Objective-C project without storyboard in Xcode 11

Create a new project and open the ViewController.h. Optionally add the following lines to viewDidLoad:

    self.view.backgroundColor = [UIColor greenColor];
    self.title = @"My first viewcontroller";

Then open the SceneDelegate.m file and add the following lines to the scene:willConnectToSession:connectOptions function:

    ViewController *vc = [ViewController new];
    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
    
    UIWindow *window = [UIWindow new];
    [window setWindowScene:(UIWindowScene *)scene];
    window.rootViewController = nc;
    self.window = window;
    [window makeKeyAndVisible];

Run the project. You should now be able to see a green viewcontroller.

You can delete the Main.storyboard file, then go to the project, click on the target, and in the General tab, clear the "Main Interface" textfield. Then open the Info.plist, click open Application Scene Manifest, Scene Configuration, Application Session Role, Default Configuration, then click the minus button next to Storyboard Name.

2019-08-01 border is deprecated Use a RoundedRectangle shape

Moving from Xcode 11 beta 4 to beta 5, you may get a warning when you have borders in your code:

    Text("In publishing and graphic design, lorem ipsum is a placeholder text.")
        .border(Color.green, width: 2, cornerRadius: 16)

The warning is:

    'border(_:width:cornerRadius:)' is deprecated: Use a RoundedRectangle shape.

Here's a copy-paste solution to the above warning:

    Text("In publishing and graphic design, lorem ipsum is a placeholder text.")
        .background(RoundedRectangle(cornerRadius: 16).strokeBorder(Color.green, lineWidth: 2))

2019-07-15 Generic parameter subject could not be inferred

In a condensed form, I had the following SwiftUI code:

    struct Input {
        var someString = "OH HAI"
    }
    struct ContentView : View {
        @State private var input = Input()
        
        var body: some View {
            TextField("Enter string", text: $input.someString)
                .textFieldStyle(.roundedBorder)
                .padding()
        }
    }

Then I changed someString to a computed property:

    struct Input {
        var someString: String {
            return "OH HAI"
        }
    }

This results in the following error: "Generic parameter 'Subject' could not be inferred". It took me ten minutes to realize what was the problem: I forgot to add a setter.

2019-04-23 ISO date on macOS

To print the current date in ISO 8601 format on macOS:

  $ date +%Y-%m-%dT%H:%M:%S
  2019-04-23T14:44:46

To print it with the timezone information, append %z.

  $ date +%Y-%m-%dT%H:%M:%S%z
  2019-04-23T14:44:42+0200

Note that in the last case, you're missing the colon in the timezone bit. To correct this, we'll need to do some bash wizardry:

  $ zone=$(date +%z);datetime=$(date +%Y-%m-%dT%H:%M:%S); echo $datetime${zone:0:3}:${zone:3:2}
  2019-04-23T14:44:42+02:00

More...

Weblog Archive

Weblog entries 2017

Weblog entries 2016

Weblog entries 2015

Weblog entries 2014

Weblog entries 2013

Weblog entries 2012

Weblog entries 2011

Weblog entries 2010

Weblog entries 2009

Weblog entries 2008

Weblog entries 2007

Weblog entries 2006

Weblog entries 2005

Weblog entries 2004

All weblog entries

Articles

Articles, chronologically (latest first). This is pretty old stuff.

Scribblings

Not yet finished. Maybe will never be finished. Maybe they'll get deleted. Who knows?

Programming:

System administration:

Others:

Files: