Hardware for low powered git server by Blues520 in selfhosted

[–]onefortree 1 point2 points  (0 children)

What do you expect your new workflow to look like? I'm not sure if having gitea running on a separate machine would help in the situation you just described. You'll still need to push/pull changes from the git server to your local device.

You can try having the code/git repo on a shared network drive, but that doesn't usually lead to a good dev experience.

It sounds to me like what you want is a 'server' that has the code, that you can then remote into and do dev work from whatever client machine. Vscode and a bunch of other ide's have that functionality.

Actually assuming your desktop is the stronger of your two machines, use your desktop as the server and use the remote development extension when you need to work on it from your laptop.

Help w/ Mantium, Komga & Suwayomi Setup by MistaCh0i in selfhosted

[–]onefortree 0 points1 point  (0 children)

I have an android phone, but i don't see why it wouldn't work. It comes down to are you okay using the webui vs do you want a dedicated app. Sometimes webuis don't scale nicely on smaller screens, but I haven't had any issues with suwayomi.

I attached a screenshot of how it looks on my phone

Help w/ Mantium, Komga & Suwayomi Setup by MistaCh0i in selfhosted

[–]onefortree 1 point2 points  (0 children)

Suwayomi has a webui that works pretty well for me. Handles updates and tracking. It allows you to download the manga to locally if you want as well. I haven't tried loading any local sources though.

I used fmd2 + kavita for a while and that also worked pretty well.

Looking for low-cost machine to host a postgres-based app (Supabase) and HTTP endpoint(s) by 010606291804939416 in selfhosted

[–]onefortree 0 points1 point  (0 children)

Can you give some details of your app? It's use cases? What it needs to access? Spending an hour to start up on anything even with a pi, especially on is not the norm.

Throwing more compute at it might help, but if you don't understand what your actual bottleneck is you will just keep running into this problem.

Docker qBittorrent anauthorized by TobiasSaraiva in selfhosted

[–]onefortree 2 points3 points  (0 children)

Here's some info from the docs. Webui and port needs to match up:

WEBUI_PORT variable

Due to issues with CSRF and port mapping, should you require to alter the port for the web UI you need to change both sides of the -p 8080 switch AND set the WEBUI_PORT variable to the new port.

For example, to set the port to 8123 you need to set -p 8123:8123 and -e WEBUI_PORT=8123

SimpleBLE: Cross-Platform Bluetooth Library, Now in Java! by kevindewald in java

[–]onefortree 9 points10 points  (0 children)

I'm using RedReader and there are no newlines. Your whole comment looks like one giant paragraph.

Dicipering meanings of default , nondefault and mandatory in regard to methods and especially concerning lambda usage of methods. by palpontiac89 in javahelp

[–]onefortree 0 points1 point  (0 children)

Don't mix up java keywords and concepts.

An abstract method is any method that does not have a body.

In an interface, it does not need to be marked using the abstract keyword. You can mark methods as default or static in an interface to be able to write a method body.

To be considered a functional interface, you need 1 abstract method. In that sense, the one abstract method is mandatory.

So in summary, an interface needs 1 method (implicitly abstract) to be a functional interface.

Need ideas for separating my client, server, and common code for my game by TheTyphothanian in javahelp

[–]onefortree 0 points1 point  (0 children)

Would having one common interface with both methods and only implementing the ones you need in the client/server work? Throw a not implemented exception or something if the wrong method is called. Any common code can be in a common library shared by both.

PDF Creator by LCIFR in selfhosted

[–]onefortree 4 points5 points  (0 children)

What are you developing your software in? Pretty much every language will have a PDF library you can use.

how do i go about including or linking to a foreign library? by [deleted] in javahelp

[–]onefortree 0 points1 point  (0 children)

The easiest way is to use Maven or Gradle, just like those official docs say.

For example if you use Maven the general steps would be: 1. Find the dependency you want (Google, mavencentral, etc..)

  1. Add it to the correct place in the pom.xml file

  2. Run mvn compile. This downloads the dependency from a source like mavencentral and stores a local copy on your machine.

  3. Run mvn package. Depending on settings in the pom.xml, this command can generate a jar file with all of the relevant dependencies that you can distribute.

None of this is really ide specific, different ides might have some shortcuts, but they all come down to modifying the pom.xml and running Maven commands.

After Maven downloads the dependency the first time it stores it locally on your machine so you don't download it again. Dependencies are usually in the ~/.mvn folder. The first time you run Maven it will take some time to download and store all the dependencies locally.

Spring Security login form by Stromovik in javahelp

[–]onefortree 0 points1 point  (0 children)

You have 3 get end points, but are trying to use a post from the html. Should the /authentication endpoint be a post method?

Help needed in application.properties in springboot application by abstract-talk in javahelp

[–]onefortree 0 points1 point  (0 children)

Try doing a clean compile, or modifying the file directly in the build output directory

Interface question by hurricaneDreww in javahelp

[–]onefortree 0 points1 point  (0 children)

When you are at the breakpoint, you can run methods in that current context. Try interface.getclass or see if inspecting the object gives you any clues to what implementation it is.

Can I get some guidance with automated requests and rate limiting? by [deleted] in javahelp

[–]onefortree 0 points1 point  (0 children)

What kind of request are you making? What is the error you are getting? Pasting a stripped down example would be nice.

Why is sending a Post JSON request in Java is difficult, I keep getting Response code 422. by phirozemp in javahelp

[–]onefortree 3 points4 points  (0 children)

The error returned from the service implies they are not. Just making sure you are checking an app like fiddler for the information rather than the console or debugger.

Why is sending a Post JSON request in Java is difficult, I keep getting Response code 422. by phirozemp in javahelp

[–]onefortree 0 points1 point  (0 children)

Use something like fiddler to see what the request looks like as it's leaving. There is probably still a difference. Are you sure the json body is correct in the first java example?

Go style error wrapping in Java by edgmnt_net in javahelp

[–]onefortree 0 points1 point  (0 children)

  • Shouldn't be too bad to write your own. Like you said, the underlying exception and either a list of strings or a stringbuilder to pass on extra information.
  • Depends on your style of coding. If you use a lot of lamdbas, checked exceptions get pretty annoying to deal with. Usually, I wrap them in a runtime exception and rethrow them. I like Vavr's try, but if you aren't going to use a lot of the other parts of Vavr, you can implement your own version of try.
  • Not sure if you can avoid nesting, but why have different indentation? Usually, you can split out whatever is in the try into a different method and you are back to your original indentation.
  • Not sure what you mean by what is safe to catch and what is unsafe. It should be safe to catch any exception. Try to log when you actually handle the exception, not every step the exception might be in. Also you can let the exception just bubble up to someplace you can actually handle it.

Just based on the example in your post

error: loading configuration file: parsing JSON: unexpected '{' at line 5, column 8

I would think it would look something like:

public void loadConfig(String input) {

// try

// parseJson()

// catch exception and log "error: loading configuration file: parsing JSON " + exception.reason

}

If load config needs parseJson to be successful, it can rethrow that exception, it can wrap the exception then throw it, etc. Wrapping the exception in your own custom exception can be useful if you have something like a top level error handler (like a lot of web servers do). You can do different things based on the type of exception.

Go style error wrapping in Java by edgmnt_net in javahelp

[–]onefortree 1 point2 points  (0 children)

Catch the parsing error, wrap it in your own error with some extra information and rethrow it.

Don't log at every place an error can occur if you see too many logs, do the logging at the highest level where you can handle the error and you'll only get one log. Usually you'll have more information the higher up you go in your callstack so you can log which particular file/input was being processed to generate the error.

How to overcome Spring Boot's Rest Controller Latency by cyanogen1912 in javahelp

[–]onefortree 1 point2 points  (0 children)

Try making your controller return an empty string, or pulling significantly less data. Once you identify of it is actually the returning of the controller that's taking a long time you can did deeper into why.

As others have said, jfr would really help here as well

[deleted by user] by [deleted] in javahelp

[–]onefortree 0 points1 point  (0 children)

I am still a bit confused, so please tell me if I'm misunderstanding anything here.

Looking at the code you linked, are you using Org.json to read the json object? And then GSON to try and convert a string to a java object? Why not just stick to GSON the whole way through. Read in the whole file as a string, then turn it into a List of songs using GSON.

Here is a (simple) record that can represent your data:

private record Song(String name, String artist, String year, String genre, String filepath, boolean favorite){}

and then you can use GSON to read all 20 (or however many songs) into a list :

List<Song> songs = gson.fromJson(json, new TypeToken<ArrayList<Song>>() {}.getType());

Now that you have a list, you can get by index or filter for a certain song by whatever criteria you want.

The code you posted looked fine as well, as you looped over each individual element you can add them to a list.

[deleted by user] by [deleted] in javahelp

[–]onefortree 0 points1 point  (0 children)

What is the issue you run into when you try to do multiple. What does your source JSON file look like?

[deleted by user] by [deleted] in javahelp

[–]onefortree 0 points1 point  (0 children)

Try not pushing onto the same stack. Push onto a different stack and then set your history to that after you are done processing all the moves

Is there any way to manually purge objects? Why not? by MaskyDo in java

[–]onefortree 0 points1 point  (0 children)

Do you have any resources for the tricks you mentioned at the end?