mynethome.de

15. Mai 2023

Convert a LibreOffice (odt) file to AsciiDoc

While the asciidoc documentation has an answer to the question how to convert a Microsoft Word file to AsciiDoc, there is no hint on how to do that for ODT (OpenDocument aka LibreOffice or OpenOffice) files.

Sure, one possibility is to safe it in word format and then use pandoc as sugested in the article linked above.

But I was interested to learn if there is an option without such a step that introtuces also the risk to loosing some document details due to incapablities to the intermedieate format or due to the additinal converter involved.

I found the Open Document Converter for AsciiDoc but that one is meant to produce ODT from Asciidoc.

A direct option to convert can be deducted from the command used in the article linked first, it would be:

pandoc -f odt -t asciidoc Dokument.odt -o Dokument.adoc

Nice. But looking at the result, I had the desire to check if there are better results possible.

Another option that came to my mind and that also avoids Microsoft technology is to use HTML a the intermediate format:

/Applications/LibreOffice.app/Contents/MacOS/soffice --convert-to html document.odt --outdir .

After that, we need to use Pandoc, a generic document converter:

pandoc -f html -t asciidoc document.html -o document.adoc

Big benefit of this step is, that all embedded media was exported and seperately saved. By this, its much easiert to adopt it to the new document.

4. Mai 2023

DynDNS services in 2023

As DynDNS asked me to pay (too much) for their services, I decided to look after an alternative and asked around to learn what is en vouge to use „nowadays“.

The options suggested to me were

I ended up using dynv6 for now, mostly as the setup to use my personal domain was absolutely straight forward and their clean and well documented webUI was very inviting to me! :)

One thing to note: The help page works, but is in regard of the fritzbox update URL not completly uptodate and does not show a HTTPS url. So it´s the following I would suggest to use

https://dynv6.com/api/update?hostname=<domain>&token=<username>&ipv4=<ipaddr>&ipv6=<ip6addr>&ipv6prefix=<ip6lanprefix>

They also have a dynv6 community forum which I didnt need to use yet ;-)

6. September 2022

iOS build: CodeSign failed

In case you ever stumble over error messages like

CodeSign /Users/.../Library/Developer/Xcode/DerivedData/mobileapp-dqzeepmlgrwdlnamvfpcsigcnoil/Build/Intermediates.noindex/ArchiveIntermediates/mobileapp/InstallationBuildProductsLocation/Applications/mobileapp.app/Frameworks/TNSWidgets.framework (in target 'mobileapp' from project 'mobileapp')

   CodeSign /Users/.../Library/Developer/Xcode/DerivedData/mobileapp-dqzeepmlgrwdlnamvfpcsigcnoil/Build/Intermediates.noindex/ArchiveIntermediates/mobileapp/InstallationBuildProductsLocation/Applications/mobileapp.app/Frameworks/TKLiveSync.framework (in target 'mobileapp' from project 'mobileapp')

   CodeSign /Users/.../Library/Developer/Xcode/DerivedData/mobileapp-dqzeepmlgrwdlnamvfpcsigcnoil/Build/Intermediates.noindex/ArchiveIntermediates/mobileapp/InstallationBuildProductsLocation/Applications/mobileapp.app/Frameworks/TNSSideDrawer.framework (in target 'mobileapp' from project 'mobileapp')</p>

when building an iOS app with fastlane (in this case, implemented with NativeScript), try to manually unlock the keychain in your build:

security unlock-keychain -p $CERT_KEYCHAIN_PASSWORD

In my case, that helped in the end – manually installing WWDR certificates and other hints I found did not.

18. Juli 2022

Tastenkürzel zum Button-Tausch auf der Ergo K860

Kurznotiz an/für mich selbst:

Die Tastenkombinationen Fn-O und Fn-P vertauschen auf dem Logitech Ergo K860 die „opt | start“ und die „cmd | alt“ Taste.

Falls es sich mal wieder zurücksetzt und cmd+tab einfach kein Wechsel zwischen Programmen mehr erlaubt….

Auch praktisch „cycle through windows“ – auf einer deutschen Tastatur ändere ich den Shortcuts aber immer auf cmd + < ;-)

16. September 2021

Datumsberechnung mit Wolfram-Alpha

Vor einigen Jahren gab es einen „riesen Hype“ über Wolfram-Alpha und ob es die nächste Stufe des Web einläutet nach der Such-Revolution durch Google.

Das ist nicht passiert, aber ich freue mich immer wieder, das es „noch da“ ist und besser auf wichtige Fragen antworten kann als Google – zum Beispiel: Welches Datum haben wir 116 Tage nach dem 30. August 2021 ?

https://www.wolframalpha.com/input/?i=30.08.2021+plus+116+Tage

Es ist der 24. Dezember. Denkt dran, Weihnachtsgeschenke zu besorgen! ;-)

15. September 2021

PDF bearbeiten

Immer wieder werde ich gefragt, womit man „am besten“ PDF bearbeiten kann.

Während „am besten“ natürlich nicht pauschal zu beantworten ist, da es immer auf den Kontext ankommt, ist oft PDF24 eine gute Option, daher hier ein Hinweis auf die sehr nützliche kosten- und werbefreie, nicht-cloudbasierte Toolbox:

https://www.pdf24.org/

Viel Spass :-)

13. September 2021

„Mal eben kurz“

Es gibt diese Moment, in denen ich diese IT-Welt wirklich nicht mag. Denn „mal eben kurz eine Frage beantworten“ wächst sich schnell aus zu:

  1. Frage zu einem Problem in einem Programm bekommen (hier: Libre-Office)
  2. Ich will Antwort möglichst exakt geben, also starte ich Libre Office
  3. Stelle fest, das LibreOffice nicht mit LanguagePack installiert ist, also beschliesse ich kurz auf die letzte Version zu aktualisieren und das Lang-Pack zu installieren
  4. Libre-Office Seite Öffnen und Downloads durchführen
  5. Installation der Office-Suite
  6. Start der Instatllation des Language-Pack
  7. Language-Pack Installer kann die LibreOffice Version nicht finden. Manuelle Auswahl bringt die im Screenshot gezeigte Fehlermeldung.
  8. Doppeltes überprüfen und erneutes de-installieren und installieren von LO.
  9. Erneuter Versuch, das Language Pack zu installieren.
  10. „Das Problem solle ich melden.“ – Herausfinden, das es dafür die Plattform https://ask.libreoffice.org/ gibt.
  11. Im deutschen Userforum gibt es bereits einen Eintrag, den ich ergänzen will.
  12. Erstellen eines Benutzeraccount, da ich meinen alten nicht reaktivieren kann.
  13. Ergänzung zum Beitrag schreiben.

Soweit, sogut. Und mit meinem Ansinnen bin ich noch nicht weiter – ich kann die Frage noch nicht beantworten. Also zu guter Letzt die vorherige Version von LO installieren, das Laguage-Pack für diese Version herunterladen und installieren. Um dann festzustellen, das diese Versionen das Problem auch haben. Es liegt also nicht an der Version, sondern evtl am Installer?

Die Schritt-Für-Schritt Anleitung muss also damit leben, das es eine kleine Unschärfe dank der unterschiedlichen Sprache in der Benutzeroberfläche gibt.

Für die ganz Interessierten: Die Frage war „wie bekomme ich es beim Libre-Office einegstellt, daß ich bei Tabellen die Gitternetzlinien mitgedruckt bekomme“.
Die Antwort ist: „Menü ‘Format’ > Punkt ‘Seitenvorlage’ > Reiter ‘Tabelle’ > Abschnitt ‘Drucken’ > Checkbox ‚Gitter'“


Das sind die Momente, die mich daran erinnern, warum ich lieber Software Systeme baue anstatt Support zu machen. Support mache ich eigentlich gerne, weil ich gerne anderen Menschen helfe – am liebsten mache ich jedoch Support für Systeme an deren Entstehung ich beteiligt war.

10. Juni 2021

Upgrade to NativeScript 8

ℹ New version of NativeScript CLI is available (8.0.2), run 'npm i -g nativescript' to update.

This is the message you see when you run a ns command at this time when you local installation is outdated.

So, lets see what it means to upgrade an app from running with NativeScript 7.2.1 to the recent 8.0.2.

Of course, there has been an interesting announcement blogpost that contains a short how-to-upgrade section and emphasises many great improvements that motivate for an upgrade. One of them is the great performance boot with webpack 5, another the ios-debug library.

Basically, doing an upgrade boils down to

npm i -g nativescript

ns migrate

Webpack 5 polyfill config missing

After ns migrate, the first attempt to run the app on iOS fails with a couple of error messages:


WARNING in ./node_modules/crypto-js/core.js 43:22-39
Module not found: Error: Can't resolve 'crypto' in '/Users/markus/src/mobile-app/node_modules/crypto-js'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
    - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "crypto": false }
 @ ./node_modules/crypto-js/index.js 4:37-54
 @ ./src/app/services/PublicKeyService.ts 3:0-38 57:21-36 57:51-67
 @ ./src/app/app.module.ts 51:0-67 83:8-24 200:20-36
 @ ./src/main.ts 9:0-45 57:46-55

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/nativescript-zip/zip-worker-ios.js (./node_modules/@nativescript/webpack/dist/loaders/nativescript-worker-loader/index.js!./node_modules/nativescript-zip/zip-worker-ios.js) 62:13-35
Module not found: Error: Can't resolve 'file-system' in '/Users/markus/src/mobile-app/node_modules/nativescript-zip'
 @ ./node_modules/nativescript-zip/zip.ios.js 18:35-89 63:35-89
 @ ./src/app/config/FileTraceWriter.ts 3:0-39 39:14-21
 @ ./src/main.ts 7:0-63 12:24-51

ERROR in ./node_modules/nativescript-fingerprint-auth/fingerprint-auth.ios.js 3:14-53
Module not found: Error: Can't resolve 'tns-core-modules/utils/utils' in '/Users/markus/src/mobile-app/node_modules/nativescript-fingerprint-auth'
 @ ./src/app/services/FingerprintService.ts 3:0-64 8:35-50
 @ ./src/app/app.module.ts 48:0-71 79:8-26 196:20-38
 @ ./src/main.ts 9:0-45 57:46-55

ERROR in ./node_modules/nativescript-secure-storage/secure-storage.common.js 3:26-74
Module not found: Error: Can't resolve 'tns-core-modules/application-settings' in '/Users/markus/src/mobile-app/node_modules/nativescript-secure-storage'
 @ ./node_modules/nativescript-secure-storage/secure-storage.ios.js 3:30-64
 @ ./src/app/services/SecureStorageService.ts 2:0-60 19:33-46
 @ ./src/app/app.module.ts 56:0-75 86:8-28 203:20-40
 @ ./src/main.ts 9:0-45 57:46-55

ERROR in ./node_modules/nativescript-zip/zip.ios.js 3:9-48
Module not found: Error: Can't resolve 'tns-core-modules/file-system' in '/Users/markus/src/mobile-app/node_modules/nativescript-zip'
 @ ./src/app/config/FileTraceWriter.ts 3:0-39 39:14-21
 @ ./src/main.ts 7:0-63 12:24-51

The nativescript-zip error can be fixed by replacing it with the more recently updated @nativescript/zip, but as the API has changed, we need to adjust a little bit of our code.

Also, update packages: @nativescript/fingerprint-auth and @nativescript/secure-storage

In order to fix the error shown at top regarding webpack 5 and polyfills, I need to extend the webpack.config.js to look like this:

const webpack = require("@nativescript/webpack");

module.exports = (env) => {
    webpack.init(env);

    webpack.mergeWebpack({ resolve: {
                                fallback: {
                                    "crypto": require.resolve("crypto-browserify"),
                                    "stream": require.resolve("stream-browserify") 
                                }
                            }
                        })

    return webpack.resolveConfig();
};

And install the two ..-browserify packages named in the config.

SCSS processing problems

After having this solved, I get some error regarding the CSS:

JS: Style: Css styling failed: Error: undefined:2:51: Parse error: Identifier is expected
JS:     1 |var[_ngcontent-c106]   resource[_ngcontent-c106];
JS:     2 | (()[_ngcontent-c106]   =[_ngcontent-c106] >  { // webpackBootstrap
JS: ---------------------------------------------------------^
JS:     3 |     var __webpack_modules__ = ({
JS:     4 |
JS: INFO: SplashScreen constructor
JS: Style: Css styling failed: Error: undefined:2:49: Parse error: Identifier is expected
JS:     1 |var[_ngcontent-c84]   resource[_ngcontent-c84];
JS:     2 | (()[_ngcontent-c84]   =[_ngcontent-c84] >  { // webpackBootstrap
JS: -------------------------------------------------------^
JS:     3 |     var __webpack_modules__ = ({
JS:     4 |
JS: INFO: User does not have PIN code configured, redirect to registration screen
JS: Style: Css styling failed: Error: undefined:2:51: Parse error: Identifier is expected
JS:     1 |var[_ngcontent-c104]   resource[_ngcontent-c104];
JS:     2 | (()[_ngcontent-c104]   =[_ngcontent-c104] >  { // webpackBootstrap
JS: ---------------------------------------------------------^
JS:     3 |     var __webpack_modules__ = ({
JS:     4 |
JS: Style: Css styling failed: Error: undefined:2:49: Parse error: Identifier is expected
JS:     1 |var[_ngcontent-c87]   resource[_ngcontent-c87];
JS:     2 | (()[_ngcontent-c87]   =[_ngcontent-c87] >  { // webpackBootstrap
JS: -------------------------------------------------------^
JS:     3 |     var __webpack_modules__ = ({
JS:     4 |
JS: DEBUG: RegistrationComponent initialized
JS: Error: Could not load CSS from app.css: Error: require's first parameter should be string

Looking at my scss files, I find a lot of imports starting with a ~. With the migration to Webpack 5, this is not required anymore, so we remove all the tildes:

@import "~@nativescript/theme/core";
@import "~@nativescript/theme/default";
@import '~@nativescript/theme/scss/variables';
@import '~@nativescript/theme/scss/variables/blue';

becomes

@import "@nativescript/theme/core";
@import "@nativescript/theme/default";
@import '@nativescript/theme/scss/variables';
@import '@nativescript/theme/scss/variables/blue';

But unfortunately, this does not solve my problem here.

To solve this, it turns out I have to do two things:

  1. follow a hint I got from rigor789 (kudos! :-) ) on the NativeScript slack community that „styleurls must reference files that end with .component.css or .component.scss“ – so I renamed all of them. This limitation is being worked on ATM and should be gone in short time (thus chances are good that this hint will not be relevant to you when reading this ;-) ).
  2. remove the devDependency to node-sass in my package.json as it was outdated and seemed to confuse the whole SCSS processing.

Startup Issue in iOS

Also, while investigating the CSS problem, the apps seems to build fine, but it doesn’t start up on iOS. Using the „Konsole“ app to access the device logs, I get this error:

Process exited: <FBApplicationProcess: 0x131e7a640; mobileapp (de.customer.application); pid: -1> -> <FBApplicationProcessExitContext: 0x2807e0180; exitReason: (none); terminationReason: (none)> {
    stateAtExit = <FBProcessState: 0x2809d82a0; pid: 1936; taskState: Running; visibility: Unknown>;
    terminationRequest = <FBSProcessTerminationRequest: 0x28117f340; label: "watchdog provision violated"; exceptionCode: "Watchdog Violation (0x8BADF00D)"; reportType: CrashLog; explanation: "process-launch watchdog transgression: de.customer.application exhausted real (wall clock) time allowance of 20.00 seconds">;
    watchdogContext = <FBProcessWatchdogEventContext: 0x2807f0390; event: process-launch>;
}

So, the app takes way too long to start up and gets stopped by iOS after 20s.

This turns out to be a side effect of the SCSS issue above – with that solved, the app also starts on iOS as expected.

Refresh / Repaint after navigate()

With NativeScript 8 and Angular 11, we see some view that do not update as expected and thus, e.g. just showing a blank view without text, icons and labels, as shown here:

Along with that, I can find an error in the log telling me CONSOLE WARN: Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?. After a short search I stumble upon the issue 2308 in nativescript-angular that seems to document whats going on and provides a workaround using ngZone.run() which works for me.

Upgrade Show on Youtube

While writing this, I realize that Alexander Ziskind and Nathan Walker (both part of the core NativeScript community, and at least Nathan if not both, part of the NativeScript TSC) did a Live-Stream doing a migration from NativeScript 6 to NativeScript 8:

On updated plugins…

As many plugins have been move during the transition to NativeScript 7 and 8, it´s confusing now that many are around under two names, e.g. nativescript-example and @nativescript/example. Also, with this transition, it’s not always clear where an release originates from, as Changelogs and Releasenotes are often not maintained. So look around, check for the scoped plugin names and see if there is an updated version of a plugin in quiestion. Help by providing pull requests to README.md files and other resources to clarify :-).

Angular 12

Finally, Angular 12 is available for NativeScript and the upgrade worked just like a charm for our app – go ahead :)

Have fun with mobile development leveraging your web dev skills :D

2. Juni 2021

Upgrading Plugins for NativeScript 7 and following

In my previous blogpost, I wrote about updating an app from NativeScript 6.5 to 8, taking 7 as the necessary step in between. The app is basically working but major functionality is missing as it crashes as soon it tries to execute functions from an internally maintained plugin.

Must read when upgrading plugins: https://blog.nativescript.org/nativescript-7-for-plugin-authors/

That post offers a 6-step procedure to convert a plugin which I will follow.

Basic steps for migration are the same as for the app: Remove deep imports from core, fix references.d.ts file, etc

Step 3 about @NativeClass decorator needs some more attention as we have implemented quite a lot of the iOS part of the plugin directly in TypeScript.

As with the move to Angular 10, some Angular specific consideration have to be made for plugins as described in that blogpost. But as we did not choose to implement such in our plugin, I´m fine here and do not need to take care of specifics.

To migrate the sample apps, I need to take basically the same steps as I did for the main application.

After I have the demo-apps migrated and get to the point to test the plugin using these, I run into a problem on iOS:

Our iOS specific code (TypeScript using ObjC interfaces) contains static methods and calls to them, e.g. a class

@NativeClass()
export ViewControllerWrapper extends UIViewController {

(...)
    public static initWithOptionsAndStrategy(options: LogicOptions, logicStrategy: LogicStrategy): ViewControllerWrapper {
            (...)

            return wrapper;
        }
(...)
}

and a call to that initializer method:

const view = ViewControllerWrapper.initWithOptionsAndStrategy(...);

The error I get during runtime (build is fine) is CONSOLE LOG: Error: rejected Cannot read property 'initWithOptionsAndStrategy' of undefined. That means that the javascript resulting from the transpilation does not have a valid referenece to my static method.

Also, I get this warning during build

WARNING in /Users/markus/src/plugin/src/ios/ViewControllerWrapper.ts 269:55-91
"export 'ViewControllerWrapper' was not found in './ViewControllerWrapper'
 @ /Users/markus/src/plugin/src/SomeAction.ts
 @ ./app.ts

The solution to this is described in the best-practices articles for @NativeClass in the NativeScript docs. I need to seperate the export from the class declaration as the @NativeClass decorator changes the JS syntax and thus breaks the export.

So, instead of

@NativeClass()
export class CustomClass extends NSObject {}

we need to do

@NativeClass()
class CustomClass extends NSObject {}

export { CustomClass }

On testing my plugin in the app (build & package a tgz locally and reference it from the app´s package.json with file:/path/to/plugin.tgz instead of the version number), I got errors sayint Uncaught ReferenceError: NativeClass is not defined.

Which appeared like an packaging error to me, so I had to revise the webpack.config and ths tsconfig.

It turned out that my tsconfig.json was actually missing the following that takes care for the NativeClass items:

"plugins": [
      {
        "transform": "@nativescript/webpack/transformers/ns-transform-native-classes",
        "type": "raw"
      }
    ],

Finally, I stumbled over a "declaration: false"setting in the plugin´s tsconfig.json – with this set, the generated code in the packaged plugin will not be useable to the app as typescript will not find the expected code to import classes. It has to be set to true.

And with this, the migration of the custom plugins is complete and we have our app migrated to NS 7. 🎉

26. April 2021

Upgrade to NativeScript 7 (prepare for 8)

As NativeScript 8 has been released, I think it might come in handy to document the steps taken to upgrade an app based on NativeScript 6.5 to the recent NativeScript 8.

Before diving into the upgrade, it´s worth to have a look at the node ersion used: It should be at least Node 12. I recommend to use a NVM and have a .nvmrc file in each project folder so you have a defined environment to work with.

It turns out that the „migrate“ command of NativeScript 8 does appearently not behave the same as that of NativeScript 7, we should not do a jump from 6.5 to 8 but instead a step-by-step migration, meaning first migrating to 7 and from there to 8.

Thus, the scope of this article will be to migrate the app to NativeScript 7, going up to 8 will be a fllo-up post. To tackle this, our first input are the upgrade notes from the release-blogpost for NativeScript 7.

That includes:

  • Install the last version of NativeScript 7: npm i -g nativescript@7.2.1
  • run tns migrate

Which runs just fine in our case. Good thing to see it creates a .migration_backup folder for files it changes or deletes, so we do not solely rely in our version control.

So, lets try to run the converted project with a tns run android.

Turns out, the migratedid not automatically convert the platform dependencies, so I had to make sure, these are set with the correct version in devDependencies:

    "@nativescript/android": "7.0.1",
    "@nativescript/ios": "7.2.0",

And after another try running tns run android, I get the following error:

ERROR in The target entry-point "listview-directives" has missing dependencies:
 - nativescript-angular/element-registry
 - nativescript-angular/renderer
 - ./../
 - tns-core-modules/platform
 - tns-core-modules/ui/layouts/layout-base
 - tns-core-modules/data/observable-array
 - tns-core-modules/ui/core/view
 - tns-core-modules/data/observable
 - tns-core-modules/color
 - tns-core-modules/ui/layouts/stack-layout

This reveals that some part of the app if not fully migrated as using „tns-core-modules“ has been deprecated and should be replaced with tns-core-modules.

As I cannot find any in my code base, I check the dependencies and find that there is an updated version of „nativescript-ui-listview“ available; „9.1.0“.

I also need to upgrade the nativescript-localize plugin as the version I was using is not compatible to the changes introduced with NativeScript 7. After some investigation, it turns out that the plugin has moved around a bit and it now community-maintained and available as @nativescript/localize (github, npmjs). Version 5.0.4 seems to be working fine for me.

This help, and now I get complains:

references.d.ts:1:22 - error TS6053: File '/Users/me/src/mobile-app/node_modules/@nativescript/core/tns-core-modules.d.ts' not found.

1 /// <reference path="./node_modules/@nativescript/core/tns-core-modules.d.ts" />
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
references.d.ts:2:22 - error TS6053: File '/Users/me/src/mobile-app/node_modules/tns-platform-declarations/ios.d.ts' not found.

2 /// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
references.d.ts:3:22 - error TS6053: File '/Users/me/src/mobile-app/node_modules/tns-platform-declarations/android.d.ts' not found.

3 /// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So I need to udate the references.d.ts file of my project to contain the following as mentioned in the migration blogpost from above.

/// <reference path="./node_modules/@nativescript/types/index.d.ts" />

Now, some „deep import“ references need to get fixed as described in NativeScript 7 import reference, such as:

import * as trace from "@nativescript/core/trace";

to import { Trace } from "@nativescript/core";

or

import * as application from "@nativescript/core/application";

to import { Application, Trace } from "@nativescript/core";

After fixing a lot of those, the app starts up.

It is fully usable up to the point where internally created plugins are used. These have not yet been migrated and will be tackled next.

Stay tuned :)

mynethome.de wird erstellt mit WordPress
Beiträge (RSS) und Kommentare (RSS)

(c) 2005 - 2023 Markus Schlichting - Mastodon