Quantcast
Channel: User blacktide - Stack Overflow
Browsing latest articles
Browse All 44 View Live

Comment by blacktide on Bancommand discord api (JDA5) gives an error

You have a NullPointerException on line 14 in BanCommand.java. Make sure you're not calling a method on a potentially null object (like a missing/optional parameter).

View Article



Comment by blacktide on Use the redis lock

Yes, Redis lock is a good solution to the problem. ShedLock is also commonly used.

View Article

Comment by blacktide on Syntax error: "(" unexpected when running Docker...

This question may be helpful. You might need to add #!/bin/sh as the first line in your start script. Or try running it with bash instead of sh.

View Article

Comment by blacktide on Unit testing c++. How to test private members?

The updated link for the previous comment is here now: Testing Private Code.

View Article

Comment by blacktide on Kotlin -> Java API call is not using the method I...

In Kotlin Array<Int> is a Integer[] under the hood, and IntArray is an int[] (more info here). Not sure if it will help in this case but does changing c to c.toIntArray() on the last line solve...

View Article


Comment by blacktide on Installing JavaFX (with no java knowledge whatsoever)

The Zulu JDK builds have JavaFX built into them, just download the version for your OS.

View Article

Comment by blacktide on How to convert List to

You can use entry.getValue().toString() or String.valueOf(entry.getValue()) instead of (String) entry.getValue().

View Article

Comment by blacktide on Access token and API action

I think your question is unclear, what exactly are you having an issue with? Are you getting a specific error?

View Article


Comment by blacktide on Hitachi Content Platform (HCP) S3 - How to I disable...

Thanks for your comment @Sudhi, this doesn't work either. I've tried deleting versions but it also doesn't work. I actually met with Hitachi on this and what I'm trying to do is not possible. All...

View Article


Comment by blacktide on java.lang.NoClassDefFoundError:...

Can you try adding the docker-java-api dependency to your pom.xml as well and see if that resolves the issue? Just from a quick glance it seems that the docker-java dependency doesn't transitively...

View Article

Comment by blacktide on CORS Spring Boot

FYI for others: for the addMapping call, you have to use /** to enable CORS for all endpoints. Using * or ** won't work.

View Article

Comment by blacktide on Git commit editor

The Git editor uses Vim by default. You can check this answer for details on how to exit Vim (press the i key to insert text) and this answer for changing the editor.

View Article

Answer by blacktide for How to set project.version by passing version...

I've found this to be the easiest and cleanest way, without requiring a gradle.properties file or changing the version variable name.In build.gradle:// Note - there is intentionally no equals sign...

View Article


In Vim, how can I delete everything between quotes including the quotes?

For example, in the following:Testing "deleting" within quotesWith the cursor inside of deleting, how can I delete the text within the quotes and include the quotes, leaving:Testing within quotes

View Article

Answer by blacktide for In Vim, how can I delete everything between quotes...

You can use the following sequence to delete everything including the quotes:da"Keep in mind this only works on a single line, and will remove any trailing spaces after the last quote.As pointed out by...

View Article


Answer by blacktide for Spring Boot - Running one specific background job per...

What I need is to deploy separate parts of application (like 1 queue listener only) per pod in the cloud yet keep the monolith code architecture.I agree with @jacky-neo's answer in terms of the...

View Article

Image may be NSFW.
Clik here to view.

Answer by blacktide for Kubernetes deployment error with Java/Micronaut:...

Your Dockerfile is exposing port 8002 (EXPOSE 8002), but your app is started on port 8080.Additionally, your Kubernetes configuration is pointing to port 80 of your pod.You should set it so that all...

View Article


Answer by blacktide for Schedule CronJob for last day of the month using...

You can use the date command to control whether or not to execute another script or command:# Tested using GNU coreutils date 8.30/bin/sh -c "[ $(date -d +1day +%d) -eq 1 ] && echo 'It is the...

View Article

Answer by blacktide for Best practices for storing passwords when using...

You should use environment variables in your application.properties file for this:spring.datasource.username=${SPRING_DATASOURCE_USERNAME}spring.datasource.password=${SPRING_DATASOURCE_PASSWORD}Or with...

View Article

Answer by blacktide for How To Pass Two @RequestBody from Postman (springboot)

You can define your request body as an array like the following:public ResponseEntity<String> enroll(@RequestBody Course[] courses) { // use courses array here}

View Article

Answer by blacktide for Change all letters except space from a string using Java

You can use the \\S regex:String s = "Sonra görüşürüz";String replaced = s.replaceAll("\\S", "-");System.out.println(replaced); // outputs ----- ---------

View Article


Answer by blacktide for Java - Cannot get loop to recognize newly generated...

As your code currently stands, you're only parsing the user's input the first time. Inside the loop you're reading the user's input again, but you're not updating the words variable based on the new...

View Article


Answer by blacktide for AlgoExpert Question, Tournament Winner, Not passing...

You should use containsKey on your Hashtable instead of contains on this line:if (!tableTeamNameAndPoints.contains(winningTeamName)) {When you use contains, you're checking if the Hashtable contains a...

View Article

Answer by blacktide for Kubernetes - create secret with a label using cli in...

There isn't an option in the kubectl create secret command to add a label.You will need to run a second command to add the label:kubectl label secret my-secret -n myns "foo=bar"But you could...

View Article

Answer by blacktide for How do I switch between contexts in K9s when the...

You can switch to another context by typing :ctx <context-name>. For example:# Switch to the PROD context:ctx PROD# Switch to the NONPROD context:ctx NONPRODA full list of commands and...

View Article


Answer by blacktide for Using Java's Timer to wait for a period of time...

The reason why it seems to be looping infinitely, is because the myIterator.next() call doesn't happen until the TimerTask is executed, so myIterator.hasNext() is not updating on each loop iteration....

View Article

Answer by blacktide for Preventing text in rt tags (furigana) from being...

You can achieve this with CSS by using the user-select property. You can try it below:rt { -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select:...

View Article

Answer by blacktide for Error with Lombok's @Builder with generic typed field

To resolve the compilation error, you should define the generic when calling the builder() method like so:OperationResult<String> result = OperationResult.<String>builder() .data("Test")...

View Article

Answer by blacktide for How to write Pipeline to discard old builds?

If you're using the Jenkins Job DSL to create a job or pipelineJob, you can use any of the following formats to add the discard builds configuration to your job:Option 1This option modifies the XML...

View Article



Answer by blacktide for Find elements by multiple class names in Selenium Java

Only one class name can be used with the By.className(String) method. From the JavaDoc:Find elements based on the value of the "class" attribute. Only one class name should be used. If an element has...

View Article

Answer by blacktide for Convert a single-threaded calculation to...

You can use the Executors.newFixedThreadPool(int) method to get an ExecutorService to submit tasks to.Each task that you submit to the thread pool will return a Future, which you can maintain a list of...

View Article

Answer by blacktide for Why Junit fails to perform dependency injection in test?

Your final code block is correct and is the standard practice, you don't need a constructor in this test class for the Calculator instance.For the test class you should define the fields and initialize...

View Article

Image may be NSFW.
Clik here to view.

Answer by blacktide for JMH Unable to find the resource: /META-INF/BenchmarkList

If anyone is using Gradle, add the jmh-gradle-plugin to your plugins block:plugins { id 'java' id 'me.champeau.jmh' version '0.6.8'}Then add all of the following in your dependencies block (check the...

View Article


Answer by blacktide for Kotlin -> Java API call is not using the method I...

In Kotlin Array<Int> is a Integer[] under the hood, and IntArray is an int[] (see here).To resolve the issue, you can change c to c.toIntArray() on the last line:targetJdbcTemplate.update(sql, p,...

View Article

Answer by blacktide for Unit testing c++. How to test private members?

Another solution that doesn't require you to add any gtest headers or macros to your production code could be to mark the private members as protected and create a derived class used in your tests with...

View Article

Image may be NSFW.
Clik here to view.

Answer by blacktide for picocli: show help if no parameter given

You can also do this with CommandSpec, as shown in the Git example in the picocli-examples repository. Just add spec.commandLine().usage(System.err) to the call()/run() method of your top-level...

View Article


Answer by blacktide for How to delete a file after sending it in a web app?

Here's a simple way using StreamingResponseBody from your controller method:File file = getFile();return ResponseEntity.ok() .headers(headers) .contentLength(length)...

View Article


Answer by blacktide for java.lang.NoClassDefFoundError:...

It seems that the docker-java-api dependency is not included with the docker-java dependency.If you add this dependency to your pom.xml it should resolve the...

View Article

Hitachi Content Platform (HCP) S3 - How to I disable or delete previous...

I am (unfortunately) using Hitachi Content Platform for S3 object storage, and I need to sync around 400 images to a bucket every 2 minutes. The filenames are always the same, and the sync "updates"...

View Article

Answer by blacktide for Adding a Java element that's a subclass of a list,...

If generic enums were possible in Java, then this would be a simple solution, but unfortunately that is not possible. Here is an option that may suit your needs.Create a generic interface that contains...

View Article

Answer by blacktide for How to safely verify a file contains valid Python...

I believe the issue is with the Python 3.12 grammar in the grammars-v4 repository. I used your code as a base, and was able to get it working properly using the grammars in the...

View Article


Answer by blacktide for How to subscribe redis key space event with spring

By default, the key expiry listener is disabled when initializing the application. You can enable it by adding the following to either your main application class or your RedisConfig...

View Article
Browsing latest articles
Browse All 44 View Live




Latest Images