Latest weblog entries

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(, 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(, 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)

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

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

  $ date +%Y-%m-%dT%H:%M:%S%z

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}

2018-12-29 Firefox extensions I can not live without

My current list of Firefox extensions on my Mac is as follows:

  • Dark Reader
  • Disable WebRTC
  • I don't care about cookies
  • uBlock Origin

And finally to fit things in perfectly, put this bit in your userChrome.css to move the tabbar close button to the left:

    .tabbrowser-tab:not([pinned]) .tab-close-button {
        -moz-box-ordinal-group: 0 !important;
        -moz-margin-start:-4px !important;
        -moz-margin-end:4px !important;

You could use the Shadowfox style for a darker user interface. And furthermore, if you run your OS in dark mode, then Firefox will follow this reasonably well. However as of 2019-09-02 there are still things left to be desired; upon opening a new tab, it sometimes flashes white. To fix this:

  • Go to "about: config" and set browser.display.background_color to #000000
  • Add the following lines to your userChrome.css file:
  #browser vbox#appcontent tabbrowser, #content, #tabbrowser-tabpanels, 
  browser[type=content-primary],browser[type=content] > html {
      background: #1D1B19 !important

Note that userChrome.css might soon be ignored and you'll need to enable it manually.



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, chronologically (latest first). This is pretty old stuff.


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


System administration: