Fabien Dupuit

Ranch Hand
+ Follow
since Jan 01, 2022
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
15
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Fabien Dupuit

Hello, i have a question regarding genericity. I don't understand why the compiler can use inference to give a type. But it doesn't work for instanciation.

With inference, i'm not obligated to complet the '<>' from the instanciation of 'a'. From the context, it will find out that <T> parameter from the class is a String so 'a' is therefor a String.
But why can't it do the code below if he know that 'T' is of String type ?


Thanks
3 months ago
Hello, i'm having issue with strict CSP. Lot's of thing are new to me, my first day using csp.  

I'm working with htaccess and php.  

My code bellow :  

(htaccess)  


(php/html)  


 
The issue :  


Reason :  
It had inline style and CSP policy don't want it.  

But i'm using a nonce (checked the returned value with var dump) and it still doesn't work.
It is working for the recaptcha and not for all.js ...

I have been using this :  
https://csplite.com/csp220/
(I know there is a better solution but  i don't know/think i can use it on the server yet. And i don't know how to use replace() in htaccess either to delete the @).
Hello, I'm not sure if I'm in the right section of the site. Please let me know if that's the case.

I would like to provide a way for people to book appointments based on availability for a future project using java spring. The user would have access to an interactive calendar from which they could select a time slot that suits them. The professional would need to upload their availability so that it is visible to visitors.

I imagine an interactive calendar that would display existing data (appointments, available slots, appointment type, etc.). The professional would be able to add, modify, or delete data. Depending on these interactions, the relevant parties should be notified.

Now, I would like some ideas on how to implement what I want to achieve. Are there any free solutions that I can implement? If I had to start from scratch, what could I use?

Thank you in advance for your feedback.

I hope this helps!
1 year ago
Ok, everything is fine for now I mostly used what i found there :  
https://www.codeburps.com/post/aws-s3-spring-boot-integration

1 year ago
Hi, it works for now. I followed an other example there : https://github.com/Java-Techie-jt/s3-file-storage-example/blob/main/src/main/java/com/javatechie/s3/service/StorageService.java
The putObject was not well put.

I have an other question before going deeper. What i want to do is hosting images in amazon s3 before using their urls to use it in an html "src".
I think it is possible, if the objects are public, to do that.
1 year ago
Hello,
i wanted to use amazon S3 region to host some files.
But i'm having an issue and i don't know how to resolve it.
I don't know anything about amazon S3 service and i tried to make it works with my java spring boot code.
So far i'm mostly using this web page for help :
https://www.codeburps.com/post/aws-s3-spring-boot-integration  

I have a key, access key, a bucket with the same region as my account and my code. But i'm having an error.


While i'm in the west 3, it say i'm in the usa ... Just to try it out, when i change everything to use a bucket in the usa, it say "access denied" which is most likely due to the region being wrong...

I already talked a bit about my project in previous posts so far. Everything work on heroku except the file upload (which is normal).  
At first, i was think of just asking for an image URL directly but i found the subject of hosting files interesting.
1 year ago

Stephan van Hulst wrote:Spring Data JPA does no such thing.

It appears you have added Spring Data REST to your application. Why did you do this, if you don't want to make REST resources out of your data entities?



You're right. I removed it from gradle, made a few change and now i don't need this line of code on my daos anymore
1 year ago
Little update. It seems that adding "@RepositoryRestResource(exported = false)" on my DAO classes solve the problem.
Apparently, Spring Data JPA create end point automatically.
1 year ago
I will try to find out what is causing it.
1 year ago

Tim Holloway wrote:There is absolutely no way for us to tell. It's possible that you have another server running at port 8080 and you're actually talking to that server, not the one you think you're talking to, since only one application can listen to a port on a given host.

Alternatively there's logic in your webapp that you're not aware of that processes those URLs. And I note that you are working from the root context, so for a Tomcat server, that would be whatever is in TOMCAT_HOME/webapps/ROOT, which by default contains the Tomcat webapp administration webapp.



Hello, i think it may be java spring magic ... I only have my webapp at 8080 port (tomcat).
I think it may go away as soon as it will go live.
1 year ago
Hello, i found out something strange with my application. I have different classes like "Article", "Category" or "Blogger" for example.
When i type an url like :
http://localhost:8080/categories/4
http://localhost:8080/articles/7
http://localhost:8080/bloggers

It works while it shouldn't.

I have json informations on my page. It is strange because i normaly don't have json and rest in my application. And the worst is it give out private informations.  
Where does it come from ?
1 year ago

Himai Minh wrote:Fabien,
What was the problem? How did you fix your issue? Thank you in advanced.



Hello, it was very simple to fix :

I was calling the toDTO at one point and that why i got the error. I just added the code below to make it works :


And i think, using "LEFT JOIN' in the @Query helped too :

1 year ago

Tim Holloway wrote:


because the return value of "com.bzhcreationweb.blog.article_modif.model.Article_modif.getCategory()" is null



It's OK that the foreign key of the category is null, but that just causes getCategory() to return a null object. You can't call getId() on a null object!

As a side note, keys of actual objects should not be null, as sooner or later either the DBMS itself or the ORM is likely to get annoyed. If it matters, make a "dummy" object with an "impossible" key ID value.



Hello, i have a conversion from Article_modif to a dto class that i didn't check propely. The problem was during the conversion. Now it works fine.
Using a dummy is a better option, will do this next time
1 year ago

Bear Bibeault wrote:



Hello, the issue is with id_category which can be null. id_article is never null an should not be as it refer to the original article.
1 year ago
Hello, i would appreciate some help. I have a class named "article_modif" which handle articles modification. A user modify an article and it goes next to a list for approval.
If it is accepted then the modification are applicated to the article.
If something is "null" in the "article_modif" then it means that the user didn't modify this value. And this rule apply to the category which is a foreign key that can be null (everything except id_article which is the link to the original article).
(Maybe it is not the best thing to do but it should do the trick ...)
In my database, it look like this :



Along the way, i use this JPA JPQL method :  


The class is like this :


But if my FK category end up null, which mean i kept the category the same as the original article, i get this error message when i call 'findAllByOrderByDate':  

Cannot invoke "com.bzhcreationweb.blog.category.model.Category.getId()" because the return value of "com.bzhcreationweb.blog.article_modif.model.Article_modif.getCategory()" is null



It is not happy that the fk key is empty ... I tried to apply "LEFT JOIN" / "LEFT JOIN FETCH" in a @Query. But it doesn't work as i'm certainly missing something there.
I could rewrite my code and not use a FK key but i would prefere not. Normaly LEFT JOIN should retrieve values even if the fk is null.

I'm not very good with data base. I tried these without success (with fetch or not) :



What should i write if i want to make my idea work (retrieving everything even if the fk key have a null value).
It work like i want only if the FK category is not null.

Thanks for the help
1 year ago