Random snippets of all sorts of code, mixed with a selection of help and advice.
Setting manual major break and label when data is plotted by minor break, discrete scale
7 April 2026 @ 6:22 pm
I have a data set that is 2 observations of 71 samples but the samples have different origins. i would like to have major breaks for each origin with corresponding label, but have hit a wall. I have looked at several examples here on SO but found none that answers the same question where I can reproduce the code. I have tried:
Using scale_x_discrete to set minor_breaks (did not work, got error unused argument).
Using scale_x_continuous (did not work, as data is discreet any form of usage results in x-axis disappearing no matter what function or vector I feed it).
Convert discreet/continuous by using levels and/or factors from this example Changing x-axis tick labels ggplot2 not working, making axis disappear, scale_x_discrete
No dice.
Here is my code:
pH
Spring Security JWT user becoming null
7 April 2026 @ 6:22 pm
I'm implementing authentication using Spring Security with JWT.
My login and register endpoints were working correctly before adding JWT. However, after implementing JWT and adding the security filter, I started getting the following error when trying to log in:
java.lang.NullPointerException: Cannot invoke "org.springframework.security.core.userdetails.UserDetails.getAuthorities()" because "user" is null
at br.com.gustavo.numa.infra.security.SecurityFilter.doFilterInternal(SecurityFilter.java:33) ~[classes/:na]
My question
Why is user becoming null after validating the JWT token?
Code
Below is my implementation:
SecurityConfiguration
@Configuration
@EnableWebSecurity
public class SecurityConfiguration {
@Autowired
SecurityFilter securityFilter;
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http
New Relic Java recordMetric not showing custom metric data
7 April 2026 @ 6:20 pm
I'm working with the New Relic Java agent and trying to record a simple custom metric using recordMetric.
My use case is very straightforward: I want to track something like "transactions per second" or any simple integer-based metric.
Here is a simplified version of what I'm doing:
public String simpleFunction() {
Random ran = new Random();
NewRelic.recordMetric("Custom/TestData/RequestsPerSecond", ran.nextInt(10, 100));
return "Hi";
}
This function represents my actual implementation, just simplified.
The issue is that this does not seem to work — I don't see any custom metric data in New Relic at all.
Important context:
The New Relic agent is correctly configured.
Data is being sent successfully using other APIs:
recordCustomEvent
Class template argument deduction with braces around one of scalar initializers
7 April 2026 @ 6:04 pm
I have an aggregate class template with two element array inside:
template<typename T>
struct A { T t[2]; };
and I would like to initialize an object of this class using class template argument deduction (CTAD) from the type of the second element, so the first argument is braced-init-list having no type:
constexpr A a{ { {1}, 2.5 } };
static_assert( a.t[0] == 1. && a.t[1] == 2.5 );
It indeed works in GCC, Clang and EDG, however the last two print the corresponding warnings
warning: braces around scalar initializer [-Wbraced-scalar-init]
warning: extra braces are nonstandard
Clearly, removing the braces around 1 (as warnings suggest) fails the compilation everywhere.
And only MSVC rejects the program with the error:
Is it okay to poll every second?
7 April 2026 @ 6:01 pm
This is a function I call to fetch the order status for every order placed through a broker api. There are times when the order is filled instantly so I get the order status immediately but there are times when the order is placed but to be confirmed takes around 15-20 seconds. It might happen that it takes more time than that but in the function shown below, if it takes that much time, the retries limit would get exceeded and then I am unable to update the order status for the user. How should I handle this?
I have considered a few options but have queries in all of them.
Using timeout instead of max retries: Thought about using a fixed amount of time say 90 sec after which I would move on but this poses the same problem. Would not be able to update the status for user
Using exponential backoff with something like a e^(attempt/3) : this is the one I thought about using since it offers fast checks for first few
Status error 1010 - 'Internal app sharing' - Google play store
7 April 2026 @ 5:45 pm
I'm getting the status error code 1010 when installing an application from the google play store shared from 'Internal App Sharing' and Google play console.
Can somebody please give me an idea or suggestion why it could be happening?
Google play store shows this message on screen instead:
"Can't download *** Try again, and if it still doesn't work, see common ways to fix the problem"
I've been searching for days and still don't know how to solve this.
- It's developed in MAUI android.
- I can discard that the problem is coming from the APK and AAB as I prepared a new simplyfied empty project with the same package name and still get the problem.
- I have tried with both APK and AAB.
- I've tried the usual, rebooting, clearing the google play store app cache.
- The error happens on all devices.


how to center all the items except the ones in the last row?
7 April 2026 @ 5:24 pm
I have a little problem is css. When I'm trying to center wraped elements and I'm using justify-content: center; I got smth like on picture (what I don't want). I want to have effect from the picture, but I don't know how bc for example when I'm using justify-content: flex-start; elements are not centered.


What should I do?
7 April 2026 @ 5:15 pm
"Hi, I just finished Class 12 and am at a crossroads. I’m highly self-disciplined—I’ve already completed Andrew Ng’s AI courses and am now building apps at the intersection of AI and Web Dev. I’m considering the BITS Pilani Online BSc in CS via Coursera because I prefer the efficiency of online learning. Given the current tech landscape, how do recruiters view this specific degree for internships? Is the 'self-taught + online degree' route risky for someone aiming for high-end dev roles?"
Delay in control and involuntary clamping of Wheels Collider
7 April 2026 @ 4:56 pm
I was making a small scene for a project at the institute. I tried to implement the gears, but I couldn't. I rolled everything back as much as I could, but now the car is behaving strangely. If you press the gas, it will accelerate even if you've already released it. There's also a noticeable delay before braking or starting.
The most interesting thing is that the car drives automatically by holding down the gas button for about as long as I hold down the button.
public class Car : MonoBehaviour
{
[SerializeField] private WheelCollider[] _frontWheels;
[SerializeField] private WheelCollider[] _rearWheels;
[SerializeField] private TextMeshProUGUI textt;
[SerializeField] private float _maxMotorFroce = 1000;
[SerializeField] private float _maxSteeringAngle = 30;
[SerializeField] private float _brakeForce;
[SerializeField] private float _RRbrakeForce;
[SerializeField] private float silaTormoz;
[SerializeField] private float silaR
What does this comment in the PHPMyAdmin source code mean?
7 April 2026 @ 4:12 pm
I have been researching security related topics and I looked at the source code of phpMyAdmin to see how things are done in a well-established application.
I checked out the code in the "PATH\phpMyAdmin-5.2.2-all-languages\libraries\classes\Session.php" file which reads:
/**
* Token which is used for authenticating access queries.
* (we use "space PMA_token space" to prevent overwriting)
*/
if (! empty($_SESSION[' PMA_token '])) {
return;
}
When is it correct/necessary to use SPACE in the names of array keys?
What kind of overwriting could the developer have in mind when they wrote this comment? Was this done from the security point of view? When should I do that in my code?