“The Ultimate tool for modifying Windows.”
Year: 2024
[SAPUI5] Add custom header parameter to all oData queries
Simply go to your Component.js file and add this line to the init
function:
this.getModel().setHeaders({"myCustomParameter": "test"})
In a CAP Backend, you get this parameter from the express req object, which can be accessed via the req.http property:
req.http.req.headers['myCustomParameter']
And here is a nice code snippet, on how to read this header parameter in an ABAP system: https://answers.sap.com/answers/425621/view.html
[Linux Mint] Transmission Remote GUI: download directory path is not absolute
Every few months, I run into this issue when adding a torrent to transgui:
Although there is a 5-year-old closed issue on this bug, which also led to a code adjustment, this bug still seems to exist: https://github.com/transmission-remote-gui/transgui/issues/1270
The user Kethsar has probably already found the right cause and gives some hints on how to solve it. At least it helped me to find a workaround:
- close transgui if it’s running, otherwise your changes will get overwritten again
- nano ~/.config/Transmission\ Remote\ GUI/transgui.ini
- search for the
[AddTorrent.transmission]
section - remove some entries which a related, e.g.
Folder1=/my/path/1
FolHit1=1
FolExt1=
LastDt1=18.02.2024
Folder2=/my/path/2
FolHit2=3
FolExt2=
LastDt2=18.02.2024
...
- save & quit nano
- start trangui again and try to add a torrent again
It seems like the issues occurs, when the [AddTorrent.transmission]
section reaches Folder50
.
[Home Assistant] Mushroom Template card – Badge Icon
Somehow, I’ve only just realized that a badge icon can be used to display another entity status on a template card, even though it’s written in the documentation. I now use it to display the status of presence or motion sensors in the respective rooms.
badge_icon: >-
{{ "mdi:motion-sensor" if states("binary_sensor.0xb4e3f9fffeb689d4_occupancy") == "on" }}
badge_color: >-
{{ "green" if states("binary_sensor.0xb4e3f9fffeb689d4_occupancy") == "on" }}
[ABAP] xsdbool
Somehow I always forget that there is a boolean function in ABAP. That’s why I’m writing this post to hopefully remember it better. 🙂
If you just want to check something for truthiness, you can do it in the following three ways:
IF sy-subrc = 0.
result = abap_true.
ELSE.
result = abap_false.
ENDIF.
result = SWITCH #( sy-subrc WHEN 0 THEN abap_true
ELSE abap_false ).
result = xsdbool( sy-subrc = 0 )
[SAPUI5] Set custom header logo in Launchpad Sandbox
If you are using the Launchpad Sandbox in your CAP project (like it is done here or here) and you want to change the logo in the header bar, simply add this little CSS snippet in the launchpad.html file:
<style>
#shell-header-icon {
content: url("./logo.png");
}
</style>
Of course you could also provide a base64 encoded image:
<style>
#shell-header-icon {
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAGGoAAAVNCAYAAAAIhfswAA...);
}
</style>
[Home Assistant] Nextcloud Backup
So far, I have only made backups of my Home Assistant VM via Proxmox to my TrueNAS server. To also have a remote backup, I stumbled over Nextcloud Backup. For the add-on installation you have to add a repository, but after that the setup is straight forward.
[nodejs] Merge PDFs using pdf-lib
https://github.com/Hopding/pdf-lib
const { PDFDocument } = require('pdf-lib')
// files = [{ fileName: 'test1.pdf, content: arraybuffer },{ fileName: 'test2.pdf, content: arraybuffer }]
mergePdfs: async function (files) {
try {
const mergedPdf = await PDFDocument.create()
for (let file of files) {
const pdf = await PDFDocument.load(file.content)
const copiedPages = await mergedPdf.copyPages(pdf, pdf.getPageIndices())
copiedPages.forEach((page) => mergedPdf.addPage(page))
}
const mergedPdfFile = await mergedPdf.save()
const buffer = Buffer.from(mergedPdfFile)
return await buffer.toString('base64') // return as buffer or base64 encoded file
} catch (err) {
console.error(err.message)
}
}
[Home Assistant] Confirmation dialog
Just noticed that you can add a confirmation dialog on a tab action.
https://www.home-assistant.io/dashboards/actions/
https://www.home-assistant.io/dashboards/actions/#options-for-confirmation
Very helpful to prevent things from being activated by mistake.
type: entity
entity: input_boolean.sleep_status
tap_action:
action: toggle
confirmation:
text: Activate sleep mode?
icon: mdi:sleep
icon_color: indigo