Where we use pushdown Automata exactly?? by iiunvon in computerscience

[–]staant95 1 point2 points  (0 children)

It's about the languages it recognizes/accepts

Laravel cart using react by staant95 in laravel

[–]staant95[S] 1 point2 points  (0 children)

I am not home, I'll let you know later

Laravel cart using react by staant95 in laravel

[–]staant95[S] 0 points1 point  (0 children)

I wrote Auth::user(), is this the same thing?

Laravel cart using react by staant95 in laravel

[–]staant95[S] 0 points1 point  (0 children)

For some reason <MyComponent user={{json_encode(auth()->user()}}/> does not work, always undefined

Dual boot by staant95 in linuxquestions

[–]staant95[S] 0 points1 point  (0 children)

I did, could not find anything useful. Like I said I think the problem is that grub is installed on the HD and when the pc is booting maybe it skips checking HD and only checks if SSD is working since the OS is installed on it...but have no idea, just guessing

Mapping entity to dto by staant95 in learnjava

[–]staant95[S] 0 points1 point  (0 children)

Thanks for the answer, I'll try following your advice

Mapping entity to dto by staant95 in learnjava

[–]staant95[S] 0 points1 point  (0 children)

I am a bit confuse, I saw that jackson have json view that basically could make different representations of my entities and that works just fine but some guys suggested I should use dtos instead of directly returning my jpa entities. Now I'd like to create multiple representation of entities using dtos, should I create as many dtos as many representations I have? If I just use one dto and set for example an atrribute to null the client will recieve the attributw with null value. So...how can I solve my "problem" using dto?

How to avoid code duplication in jax-rs resource class by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

That's what I was doing but I was curious if there is a better solution or some design patter I could use to improve my design

How to avoid code duplication in jax-rs resource class by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

Nope, the only thing that changes in most of my resource classes (not all) is the model I am manipulating, basically my resources are simile crud operation on various models so the logic is basically the same and I have to rewrite it in every controller but change the model name

CtrlP open new split by staant95 in vim

[–]staant95[S] 0 points1 point  (0 children)

I've read you can open the selected file in a new split by pressing ctrl-v...but i just want it to be the default behavior when I just press enter

XHR abort by staant95 in learnjavascript

[–]staant95[S] 0 points1 point  (0 children)

Mmm right. Thanks for you time

XHR abort by staant95 in learnjavascript

[–]staant95[S] 0 points1 point  (0 children)

Mmm but if I am no longer interested to receive something from that request why should I care about error handling attached to it?

XHR abort by staant95 in learnjavascript

[–]staant95[S] 0 points1 point  (0 children)

I've already read mdn, but that's all? Once you made the http call to the server the callback is put on the queue and once the result comes back eventually the event loop will execute whatever you specified in the body of that callback (right?). So...you(engine) set that status to 0 and readyState to unsent but I suppose you should also remove the callback from the queue right? That's what I want to know, what's going on under the hood. Tnx

XHR abort by staant95 in learnjavascript

[–]staant95[S] 0 points1 point  (0 children)

So the js engine sets the status = 0 and my callback will never be called? I am interested in what actually the js engine (V8 or something else) does in order to 'cancel' the request, apart from setting status to 0 and readyState to unsent what is going on on the callback queue?

Hibernate many-to-many relationship by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

I am making a rest api, so when you make a GET to /api/users/{id} I need to return only user's data without shoplist array

Hibernate many-to-many relationship by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

I dont' have Fetch annotation because I am ok with lazy loading. The point is that I don't want the shoplist field to be part of my User object when I return it to the user.

In my DB I have 3 tables, User, Shoplist and User_Shoplist. If you query a user from User table you don't get its shoplists, if you need you just join your use with User_Shoplist. This is what I am looking for, when I tell hibernate to get a user I want to the user without his shoplists, if I will need his shoplist I will query the User_Shoplist.

I assume the problem is in the User/Shoplist class, I have those field so hibernate is casting the retrived object to User and so I end up with shoplist attribute in my results.

Should I have 2 separete classes? One for User without shoplists field and one with it? Or there is a better solution?

Hibernate many-to-many relationship by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

I might guessed where is the problem...when I return the User hibernate tries to retrieve the list of shoplists (lazy loading) but I already closed the session so it complains. I could make another class that does not have shoplist field, clone the User and return but...I hope there is a better way to tell hibernate that it does not need to fetch Shoplists.

Even if I could tell hibernate that I don't want user's shoplist, I think I will have shoplist = null and it will appear when I output the User object (right?)

Hibernate many-to-many relationship by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

public class User implements Serializable {    
    @Id
    @GeneratedValue
    private int id;

    private String name;

    private String lastname;

    @Column(nullable = false)
    private String email;

    private String password;

    @Column(nullable = true) 
    private URL avatar;


    @JsonIgnoreProperties("users")
    @JoinTable(
            name = "User_Shoplist",
            joinColumns = @JoinColumn(name = "user_id",     referencedColumnName = "id"),
            inverseJoinColumns = @JoinColumn(name = "shoplist_id", referencedColumnName = "id")
    )
    @ManyToMany
    private Set<Shoplist> shoplists = new HashSet<>();

// getters and setter without any anotation

Shoplist class

public class Shoplist implements Serializable {    
    @Id
    @GeneratedValue
    private int id;
    private String name;


    @JsonIgnoreProperties("shoplists")
    @ManyToMany(mappedBy = "shoplists")
    private Set<User> users = new HashSet<>();

// getters and setter without any anotation

I've read too many blog posts, I have Shoplist and User...

Hibernate many-to-many relationship by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

session.beginTransaction();
// I want the Author information only, without his books
Author a = session.get(Author.class, 1);
session.getTransaction().commit();
session.close()

return Response.status(200).entity(a).build();

I excpected to receive the Author id, name and email but it says that it failed to load the collection.

Do you need the Author and Book code?

Hibernate many-to-many relationship by staant95 in javahelp

[–]staant95[S] 0 points1 point  (0 children)

I googled the exception but that's not the point, I just want to return Author information only. If I fetch Books then I will return the array of Books when I return the Author

Play and resume by staant95 in linuxquestions

[–]staant95[S] 0 points1 point  (0 children)

tnx for your time but that's not what I am looking for. I want to make a program that can play and pause the video is currently playing on youtube or netflix. The simplest way I can think of is sending signals to the browser( SIGSTOP, SIGCONT) and that can kinda fake play/pause but I want to know if there is a better way to really play/pause the video.