22/12/2023
[Google Sheets] Import data from Yahoo Finance
09/11/2023
[Windows 11] Default show more options explorer right click menu (old UI behavior)
One change with Windows 11 is that the right click menu in Explorer was replaced with some condensed version where the old behavior is hidden behind a "Show more options" entry. This makes some actions slower to find and quite annoying, for example 7-zip or Notepad++
To revert it to the nicer old UI you can delete the value of this registry key (for example via regedit):
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InProcServer32
Key (Default)(its old value should be C:\Windows\System32\Windows.UI.FileExplorer.dll, just remove it)
You then need to restart explorer process or logout and login again or reboot the computer for this change to be applied.
06/11/2023
[Tampermonkey] Disable Bing Chat search integrations
When using Bing search there are multiple places that integrate the Chat functionality with the ChatGPT AI. Some of these integrations are annoying and can be easily disabled by installing the Tampermonkey browser extension then adding a couple scripts to modify the displayed webpage and its behavior.
// ==UserScript==
// @name Disable Bing Search Engine Scroll
// @namespace your-namespace
// @description Disables scrolling on the Bing search engine page to prevent accidental scrolling into the Bing chat feature.
// @match https://www.bing.com/*
// @version 1
// @grant none
// ==/UserScript==
window.addEventListener("wheel", e=>{
if(e.target.className.includes("cib-serp-main")) e.stopPropagation();
});
- Disable sidebar Chat autosearch functionality when disaplying search results:
// ==UserScript==
// @name Disable Bing Chat autosearch
// @namespace your-namespace
// @description Disables the Bing Chat autosearch functionality on the right side of results when doing a search.
// @match https://www.bing.com/*
// @version 1
// @grant none
// ==/UserScript==
const element = document.getElementById("sydwrap_wrapper");
element.remove();
const element1 = document.getElementById("b_sydTigerCont");
element1.remove();
23/09/2023
[Kodi] 5.1 audio output
30/08/2023
[Spring] Synchronized methods and separate transactions
methodB() calls syncMethod() then calls somethingElse()
- methodA opens Transaction A enters syncMethod
- methodB opens Transaction B waits on syncMethod
- methodA exits syncMethod, starts executing somethingElse
- methodB enters syncMethod while methodA completes somethingElse and commits Transaction A
- methodB exits syncMethod, starts executing somethingElse
- methodB completes somethingElse and commits Transaction B
09/08/2023
[Spring] Execute method in separate transaction
We can easily work around this issue by creating a new class that will execute a given method in a new transaction:
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.function.Supplier;
/**
* Since spring ignores transaction settings for methods within the same class, we need a separate service
* to run isolated transactions which can be called from anywhere simply by supplying the method to execute
*/
@Service
public class TransactionHandlerService {
/**
* Runs the given method in a the same transaction as the caller
*
* @param supplier the method to execute
* @param <T>
* @return the result of the invoked method
*/
@Transactional(propagation = Propagation.REQUIRED)
public <T> T runInSameTransaction(Supplier<T> supplier) {
return supplier.get();
}
/**
* Runs the given method in a separate transaction
*
* @param supplier the method to execute
* @param <T>
* @return the result of the invoked method
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
public <T> T runInNewTransaction(Supplier<T> supplier) {
return supplier.get();
}
}
Then ensure the callers are annotated as @Transactional and simply pass the method to execute as input to our, for example:
transactionHandlerService.runInNewTransaction(() -> myMethod(someInput));