Random snippets of all sorts of code, mixed with a selection of help and advice.
CrudRepository List<T> query of parent entity T with OneToMany child entity returns a lazy list of parent entities
28 December 2025 @ 7:00 am
Can someone explain to me the following behavior I'm seeing. I have the following simple setup.
@Entity
public class Contract {
@Id
private Long id;
...
@OneToMany(mappedBy="contract", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Transaction> transactions = new ArrayList<>();
}
@Entity
public class Transaction {
...
@JoinColumn(name = "CS_TRX_CONT_ID", nullable = false)
@ManyToOne(fetch = FetchType.LAZY)
private Contract contract;
...
}
At some point in my code I want to get a List<Contract> without transactions to read some other properties of the contracts and not touch the transactions list in any shape or form.
However, whatever query I write in the CrudRepository class that returns a List<Contract> in the Hibernate logs I see it being executed BUT when starting to iterate through the elements
Best Java SDK for building a voice-based IVR over SIP (capture audio, DTMF, playback, stream)
28 December 2025 @ 6:52 am
Iām planning to develop a voice-based IVR application in Java that will interact with callers via a SIP endpoint. The core requirements are:
Answer incoming SIP calls
Retrieve caller information (e.g., caller ID)
Receive audio from the caller (as a stream)
Detect and process DTMF tones
Play audio back to the caller (as a stream)
Send DTMF tones when needed
Properly disconnect the call
I am looking for a Java-based SDK/library that can help me build this without too much complexity.
So far I found MizuTech Java VOIP Library, which seems powerful but appears quite complex due to the large number of features.
Does anyone have better recommendations for a Java SIP/IVR SDK that fits these requirements?
Any resources, examples, or
Work with 2 different character sets in mySQL
28 December 2025 @ 6:40 am
people of SO,
mysql> SELECT t.table_catalog AS catalog, t.table_schema, t.table_name, "" AS owner, CASE WHEN t.engine = 'InnoDB' THEN (SELECT st.table_id FROM information_schema.INNODB_TABLES st WHERE CONCAT(t.table_schema,'/', t.table_name) = st.name) ELSE (SELECT 0) END AS id FROM information_schema.tables t;
+---------+--------------------+------------------------------------------------------+-------+------+
| catalog | TABLE_SCHEMA | TABLE_NAME | owner | id |
+---------+--------------------+------------------------------------------------------+-------+------+
| def | draft | abcatcol | | 1093 |
| def | draft | abcatedt | | 1094 |
| def | draft | abcatfmt | | 1095 |
| def | draft | abca
HighCharts update series crazy slowly
28 December 2025 @ 6:35 am
I need to plot wellbores at a horizon map and at a vertical section.
I have no problems with the maps, but vertical sections may have different directional angles, so I have to project my wellbore's profile to them and it takes a number of minutes for a hundred points.
I use three variables for each wellbore's trajectory point: easting, northing and vertical depth.
For the map all is very simple: easting is X and northingis Y:
var act_plan = [];
some cycle
for(...)
{
act_plan.push({x: upperX, y: upperY, name: "Inc=" + Inc + ", Azi=" + AzimAccepted + " @ " + MD});
}
...
if(act_plan.length > 0)
{
planChart.addSeries(
{
id: "act_plan",
color: "black",
Not able to validate the error tooltip as it does not show in DOM
28 December 2025 @ 3:07 am
I am using Playwright to automate a website: https://demo.automationtesting.in/Register.html
Without filling anything, click on Submit. An error tooltip will show up. I would like capture and validate the text. Please help.
The problem I am facing is that this error tooltip does not show up in DOM.


Python nested comprehension: is possible return an attribute of function?
27 December 2025 @ 10:43 pm
Mainly pseudocode: return function(item) if function(item) != item[index]
(I'm using Flask with session)
With this function above,
updated, (accelerated reworking following Tim Roberts suggestion):
db = SQL("sqlite:///images.db")
def chkAdmin(adm):
print("debug chkAdmin", adm)
if adm[0] is None:
return redirect(url_for("login"))
username= getUsername(adm[0])
path = adm[1]
oldpath = path
if db.execute("SELECT username FROM users WHERE id = ?", 1):
if username == "admin":
if path == "/profile":
path = "/admin_p"
if path == "/register":
print("adminPage")
path = "/admin"
print(f"debug: Admin on 1 OK! ({oldpath} {path}) \n adm: {adm}, {username}, {path}")
return path
Is it possible to change wrapping mode for an opened fragment of a very big file (at least in the read-only mode)?
27 December 2025 @ 6:24 am
I have a very big text file (its size is larger than the size of the available RAM), so I specify a particular fragment to open, using Tools > Customize... > File > From(default) | To(default). The size of the opened fragment is ~1GB, which is ~2ā3 times less than the available RAM.
But then all Wrap options are unavailable (disabled): the only way to read the fragment of the file is in No Wrap mode, which makes reading practically impossible because the file contains long lines of text. Scrolling in the horizontal and vertical directions to read the text is very annoying to me: I really need the Wrap by Characters option to work.
(The size of the opened fragment does not matter, be it 1GB or 1MB: changing wrapping mode is unavailable anyway.)
I thought that activating the Edit > Read Only option could help, but no: it has no effect.
So I am interested whether it is po
pyttsx3 skips first few letters
26 December 2025 @ 10:16 pm
When my Python voice chatbot talks, the first few letters get skipped. It sounds like the audio buffer isn't ready when playback starts.
import pyttsx3
engine = pyttsx3.init()
def speak(text):
engine.say(text)
engine.runAndWait()
speak("hello there, this is a test sentence.")
speak("second test sentence to check playback.")
It skips the beginning, like "...lo there" instead of "hello there".
I've:
Tried adding engine.say("") before the first utterance.
Tried sleep after init().
Tried switching voices (Zira, David, and Hazel).
Tried padding text with spaces or dummy words.
Made sure every say() is followed by runAndWait().
How do I stop pyttsx3 from clipping the start of speech? Can I force the engine to fully warm up before speaking or hook into an event so playback only
Ant <script> task failing with GraalJS after migrating to Java 17
26 December 2025 @ 11:25 am
I am currently using Apache Ant 1.10.12 and migrating my Java application to Java 17. I have the following jars in my classpath:
js-scriptengine-22.3.1
graal-sdk-22.3.1
icu4j-71.1
js-22.3.1
regex-22.3.1
js-scriptengine-22.3.1
truffle-api-22.3.1
js-launcher-22.3.1
However, when running my Ant build, I get the following error:
javax.script.ScriptException: JavaScript implementation not found!
at com.oracle.truffle.js.scriptengine.PlaceholderScriptEngine.error(PlaceholderScriptEngine.java:150)
at com.oracle.truffle.js.scriptengine.PlaceholderScriptEngine.eval(PlaceholderScriptEngine.java:124)
at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262)
at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:154)
at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:86)
at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
at org.apache.tools.ant.Unkno
Mapstruct inherit 'uses'
22 December 2025 @ 11:19 pm
Given the following classes:
public abstract class MyAbstractB {
private B b;
}
public abstract class MyAbstractBDto {
private BDto bDto;
}
public class ItemWithB extends MyAbstractB {
private C c;
}
public class ItemWithBDto extends MyAbstractBDto {
private CDto cDto
}
And the following mappers:
@Mapper
public abstract class BMapper {
@Autowired Converter converter;
public abstract BDto map(B b);
@AfterMapping
public void convert(B src, @MappingTarget BDto dest) {
converter.convert(src,dest);
}
}
@Mapper(uses = BMapper.class)
public abstract class MyAbstractMapper {
}
@Mapper(uses = MyAbstractMapper.class)
public abstract class ItemWithBMapper {
BDto map(B b);
}
I was expecting ItemWithBMapperImpl to look something like:
@Component
public class ItemWithBMapperImpl extends ItemWithBMapper {
@Autowired BMapper bMapper;
@Override
public ItemWithBDto map(ItemW