Image for post
Image for post

Pino is a wonderful and fast logging API for Node.js and the Browser API.

One thing you should get used to is the first getting strange order for your logging statements. My first attempts looks like these rows.

logger.info('token NOT in cache, check with oauth server', token)

Because coming from console.log it was the natural way of creating log entries, but the output creates only lines with the text, not with the content of the token, what was intended.

Checking the API leads me to

logger.info(token, 'token NOT in cache, check with oauth server')

but now it always gives me…


or why JavaScript is still an awesome language.

Today I had the maybe strange idea to create a function that debugs a function given as a parameter.

debug (callback) {
return (...parameters) => {
// eslint-disable-next-line standard/no-callback-literal
const result = callback(...parameters)
console.log(callback.name, parameters, result)
return result
}
},

So as you can see debug creates a wrapper function for the given function to wrap each call of the given function. With this you can see in your console what is going on. So if we want to get an idea what the next function is doing

this.toggleLocation(parseFloat(place.lat), parseFloat(place.lng))

we surround…


or how to implement an autocomplete with VueJS + VuetifyJS

Image for post
Image for post

Today I want to share me recent learnings on implementing an autocomplete with VuetifyJS using the fetch API.

Therefore I added this tag to my page

<v-combobox
v-model.trim="selectedPlace"
:items="foundPlaces"
:loading="isPlacesLoading"
:search-input.sync="searchPlace"
hide-no-data
hide-selected
label="Ort"
clearable
:rules="nameRules"
/>

that should render like this


or almost never add Options +Indexes to your .htaccess file

Image for post
Image for post

Yesterday I had the bad idea to create a quick frontend solution for a backend problem: Accessing all available files in a folder on the server.

Accessing files on the client machine is nowadays no problem any more, but my attempt was to get access to files lying on the server without coding or a service that has to be implemented.

I remembered the possibility to allow the directory listing for configured folders. To achieve this you simply have to add a .htaccess file into each folder, allowing this.

.htaccess:


or how to write less and simpler code using the new features of ECMAScript 2020

Image for post
Image for post

My task for today is to get data from nested structures like this


or a simple example to use functional programming in JavaScript

Image for post
Image for post

Today I wanted to paste my JSON into a Spreadsheet like Excel, but that was a mess. It could not get along with it and hence it is no fun to do this by hand, I implemented a small tool to do this for me.

The input was this test.json — almost, I have created an object of it:

{ 'id': '10.1234/vvsyzs72ws.4', 'type': 'dois', 'attributes': { 'doi': '10.1234/vvsyzs72ws.4', 'identifiers': [], 'creators': [ { 'name': 'Staging, UnaElsStaging', 'nameType': 'Personal', 'givenName': 'UnaElsStaging', 'familyName': 'Staging', 'affiliation': [], 'nameIdentifiers': [ { 'schemeUri': 'https://orcid.org', 'nameIdentifier'…

Image for post
Image for post

XML is not my favorite data exchange format, but sometimes you have no choice. So if it comes to the question how to handle those data in JavaScript, I first want to use an existing npm module that flies around in the www. But on second sight I found a even simpler solution, that does not need anything, except the browser who is already there.

The browser has a parser build in, who can also parse given XML data. Let’s try to use it.

The first step towards my content goes through a request I have done with fetch.

const…

Image for post
Image for post

I recently had the requirement to render XML in my page so the first attempt was to simply add a div containing it — by the way I am using VueJS for this.

<div>
{{ this.rawXml }}
</div>

The result was not so impressive, because it was rendered in one long line.

Dirk Ecker (decker)

Developer since the 80'th, working at Forschungszentrum Jülich (http://www.fz-juelich.de) …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store