Random snippets of all sorts of code, mixed with a selection of help and advice.
How to set table column width to django admin list_display?
11 December 2025 @ 11:05 am
I want column foo (TextField 2500 chars) to have a width of 30% in admin view.
Yet whatever I try, the columns widths remain equal (50% / 50%).
td.foo {width: 30%;} has no effect at all.
admin.py:
class FooAdmin(ModelAdmin):
list_display = ['foo', 'bar'] # foo column width should be 30%
class Media:
css = {'all': ('css/custom.css', )}
custom.css:
table {
table-layout: fixed;
}
td.field-foo {
width: 30%;
}
Working minimal html example of desired result:
<!DOCTYPE html>
<html>
<head>
<style>
table {
table-layout: fixed;
}
td.foo {
width: 30%;
}
</style>
</head>
<body>
<table border="1">
<tr>
<td class="fo
Does std::to_chars ever really disambiguate using round_to_nearest?
11 December 2025 @ 11:01 am
[charconv.to.chars] says the following:
The functions that take a floating-point value but not a precision parameter ensure that the string representation consists of the smallest number of characters such that there is at least one digit before the radix point (if present) and parsing the representation using the corresponding from_chars function recovers value exactly.
If there are several such representations, the representation with the smallest difference from the floating-point argument value is chosen, resolving any remaining ties using rounding according to round_to_nearest ([round.style]).
I don't understand when the very last disambiguation (using round_to_nearest) would actually happen.
Presumably, this breaks an exact tie when the last nonzero digit in in a number is 5, and that digit is not necessary t
Next.js yt iframe background video not autoplaying on IOS
11 December 2025 @ 10:58 am
<iframe
onLoad={() => setVideoLoaded(true)}
className={`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[100vw] h-[56.25vw] min-h-[100vh] min-w-[177.77vh] transition-opacity duration-1000 ${
videoLoaded ? "opacity-100" : "opacity-0"
}`}
src="https://www.youtube.com/embed/Jbvts0kdCo0?autoplay=1&mute=1&loop=1&playlist=Jbvts0kdCo0&controls=0&showinfo=0&rel=0&modestbranding=1&iv_load_policy=3&disablekb=1"
allow="autoplay; encrypted-media"
referrerPolicy="strict-origin-when-cross-origin"
/>
i am posting to find the solution of this problem , **
Problem** :
i have used this iframe to fit in the header and make this video work as background auto playing video , this is working fine on desktop and andriod but not working on IOS , why is this happening , on ios the vi
Create a event in shared caelndar using asp.net c#
11 December 2025 @ 10:53 am
I need help in creating an event in shared calendar using asp.net c#.
using Microsoft.Office.Interop.Outlook, I can create event in my calendar but don't know how to add event in shared calendar.
Can someone please guide ?
Axon cs-2400 handscanner / exchange for -
11 December 2025 @ 10:53 am
so i have a barcode scanner that scans as followed 25b123456/1 now i need it to say 25b123456-1. Is there a way to fix this? I cant understand the manuel. (Ls1900 series product reference guide)
Spring Batch 6: jobOperator.startNextInstance() throws UnexpectedJobExecutionException
11 December 2025 @ 10:49 am
I’m using Spring Batch 6 and trying to run a job on a scheduler.
The job is configured with a RunIdIncrementer, and I’m triggering the execution using jobOperator.startNextInstance().
Here is the simplified setup
@Scheduled(cron = "0 */1 * * * *")
fun runDeleteSuspendedJob() {
jobOperator.startNextInstance(deleteSuspendedJob())
}
@Bean
fun deleteSuspendedJob(): Job =
JobBuilder("deleteSuspendedJob", jobRepository)
.incrementer(RunIdIncrementer())
.start(deleteSuspendedStep())
.build()
@Bean
fun deleteSuspendedStep(): Step =
StepBuilder("deleteSuspendedStep", jobRepository)
.tasklet(DeleteSuspendedTasklet(jdbcTemplate), transactionManager)
.build()
According to the documentation, startNextInstance(jobName) should launch a new JobInstance by incrementing the run.id parameter when a RunIdIncrementer is registered.
Spring Boot: Adding a new HandlerInterceptor causes many existing tests to fail — how to fix or isolate it?
11 December 2025 @ 10:46 am
I have a large Spring Boot application with an extensive test suite (unit tests + controller tests).
After introducing a new HandlerInterceptor, many of my previously passing tests suddenly started failing. Most of these tests were not written with interceptors in mind, and now the interceptor’s logic is being executed for almost every request inside the tests.
I'm looking for guidance on how to fix or isolate the interceptor for tests, and what the recommended approach is:
Should I disable the interceptor in certain tests?
Should I mock the service the interceptor depends on?
Should I update every test to account for the interceptor?
Is there a way to automatically exclude it in MockMvc/WebMvcTest setups?
Below is a simplified example of the configuration and interceptor. (Names changed.)
@Configuration
@RequiredArgsConstructor
public class DemoPath
Graph 504 GatewayTimeout leading to CommandConcurrencyLimitReached Error
11 December 2025 @ 10:39 am
we have an application that is processing incoming emails. Every now and then we are getting timeouts from Graph. However we are not retrieving lots of data.
An example of one call where we get a timeout is:
var folder = await client.Users[targetMailbox].MailFolders[targetFolder].GetAsync(options =>
{
options.QueryParameters.Select = new[] { "id" };
});
Where the targetFolder is the wellknown name "inbox".
Another is where we are searching for an email which matches an internetMessageId:
var messages = await client.Users[mailbox].Messages.GetAsync(options =>
{
options.QueryParameters.Select = new[] { "id" };
options.QueryParameters.Filter = $"internetMessageId eq '{internetMessageId}'";
});
We aren't setting any limit, so should be using the limit of 100, but we would expect in the general case it would only be 1 result (but could be more).
W
Best way to make reusable linq statements, which can be included as part of a where, select and even order by clause
11 December 2025 @ 10:26 am
Imagine the following classes (much simplified version of the real use case):
public class Driver
{
public Int32 Id {get;set;}
public String Name {get;set;}
public String Country {get;set;}
public IEnumerable<Drive> Drives {get;set;}
public DateTime? FirstDriveDate => this.Drives.FirstOrDefault().Min();
public DateTime? LastDriveDate => this.Drives.FirstOrDefault().Max();
}
public class Drive
{
public Int32 Id {get;set;}
public DateTime Date {get;set;}
public Int32 Distance {get;set;}
}
In my application the 'FirstDriveDate' and 'LastDriveDate' properties play an important role, and are often visualised in the UI. But I also need them a lot in LINQ queries. In WHERE clauses, in ORDER BY clauses, and in SELECT clauses. Right now whenever I have a query that needs to use these 'properties' I just rewrite the exact linq part in the bigger query. But if in the future the 'definition' of how 'FirstDriveDat
Avoiding templates when working with different std::vectors
11 December 2025 @ 10:05 am
I have the following problem.
- There is a class A and B where B derives from A.
- There is a third class C which needs to hold a std::vector<A> or std::vector<B>
- I want the data to be as a block in memory so using a std::vector<A*> is not an option
- Class C also needs to be stored in a vector (mixed A and B types)
What is the best way to solve this? What I thought of so far:
Option1: define class C as a template with a common base object D for both versions and then store pointers to D object in std::vector<D*> which I want to avoid since it messes up a lot of code and I would need to cast the D object to C object everywhere in the code
Option2: define both std::vector<A> and std::vector<B> in C and just leave one of them empty. Then use pointer arithmetic to e.g. loop over the objects.
I'm not really happy with both of the solutions. Is there maybe another better approach I haven't thought o