Browsed by
Author: Kenneth Holter

Camel testing: bean, ref or beanType must be provided

Camel testing: bean, ref or beanType must be provided

I recently got this error in Camel during unit testing: In case others come across the same issue, I thought I’d do a quick write-up on what the solution in my specific scenario was. Consider these production code extracts: The unit test: When running the unit test, I got the error referenced in the title: To get the test to work, just a very small adjustment to the production code was required: I’m running Camel 3.18.1.

Resolving “Error [ERR_REQUIRE_ESM]: require() of ES Module” in NextJS

Resolving “Error [ERR_REQUIRE_ESM]: require() of ES Module” in NextJS

In my BlitzJS project (which in turn utilizes NextJS), I ran into this error: Error: require() of ES Module /home/me/project/node_modules/three/examples/jsm/controls/DragControls.js from /home/me/project/node_modules/3d-force-graph/dist/3d-force-graph.common.js not supported. Instead change the require of DragControls.js in /home/me/project/node_modules/3d-force-graph/dist/3d-force-graph.common.js to a dynamic import() which is available in all CommonJS modules. The code causing the error was this: A quick refactor (for refernece including some additional code) resolved the issue:

Converting .msg to PDF using Python on Windows

Converting .msg to PDF using Python on Windows

I recently needed to convert a bunch of .msg files to PDF. I didn’t want to install any additional 3rd party software other than the Python libraries I needed. As the code would run on Windows servers, I though I’d utilize the excellen win32com Python package, and use only native Windows applications for performing the actual converting. I didn’t find a way to convert .msg to PDF in one, so I solved it by first using Outlook to convert the…

Read More Read More

Running Flask CLI and API

Running Flask CLI and API

Note to self: Here’s a super simple starting point for setting up a Flask application that supports both API and CLI interaction. To run it, run this command: To “map” the CLI to a custom app name, add a setup.py file with contents like this: Restart the Flask app. Now, uses can interact with the CLI like this:

Plotly without Dash

Plotly without Dash

While Plotly’s Dash looks like a great project for getting data visualization dashboards up and running quickly, it may not always be the best option, especially for dashboards that over time evolve into complex apps. So I’ve been looking into harnessing the power of Plotly’s excellent graphing tools, while running technologies that can grow with the app. This post will be somewhat of a note-to-self, to keep track of the viable options for utilizing Plotly on standard technology stacks. Flask…

Read More Read More

React breadcrumbs

React breadcrumbs

I recently needed a simple breadcrumbs implementation in a React app, and thought I’d use https://github.com/NiklasMencke/nextjs-breadcrumbs‘s source code as a starting point for my own implementation. I thought I’d share the source code here in case anyone might benefit from it,. But first, at little context. In the app’s URL, we might see something like this: http://<url>/stores/3/products/58. Note that the numbers are database ID’s for the stores and products. For my breadcrumbs, I wanted the names instead if database ID’s,…

Read More Read More

Sharepoint: List ‘Site Pages’ does not exist at site

Sharepoint: List ‘Site Pages’ does not exist at site

I recently got this error from Sharepoint Online, when trying to fetch a site’s list using https://pnp.github.io/pnpjs/: The code resulting in the error was this: After spending (too much) time troubleshooting this, it turned out to be a language settings mismatch: The site I was connect to was set up with Norwegian as the default language, which means that the list isn’t called “Site Pages” but rather “Områdesider”. So apparently, when fetching lists from sites you must account for site’s…

Read More Read More

Sharepoint Online: Custom web part that display news only from followed sites

Sharepoint Online: Custom web part that display news only from followed sites

At work we rolling out our new Intranet based on Sharepoint Online. While the news web part shipped with the platform works pretty well, we found that we had some requirements that combined didn’t make is a good fit: All news should be available to logged in user News are aggregated from intranet related sites the users follow Users can not opt out from receiving news from their own department With these requirements in mind, we decided to implement our…

Read More Read More