Richebony's Posts
Nairaland Forum › Richebony's Profile › Richebony's Posts
sweetguy10:lol do u know i am just seeing this shit now, anyways heres my take if it would help anyone facing a similar problem . I think using @Embbeded just injects fields parameters to a parent class creating columns on the fly. using @Transient may help @Entity public class Person{ @Id private Integer id; // native fields @Transient public Contact contact // getters and setters } |
Deicide:OK..best of luck to you. |
Deicide:Have they matched you with a partner? Correct me if I am wrong, but I heard these guys hardly allocate jobs. They just put your account on a permanent waitlist even after passing their assessments |
namikaze:Thanks a lot man !! function commonElements(first, second) { const res = []; const map = {}; for (let element of first) { map[element] = (map[element] || 0) + 1; } for (element of second) { if (map[element]) { res.push(element); map[element]--; } } return res } Hope u don't mind my asking, but how many languages do you actually know because I have seen your code in golang, I once confused you with another handle ( decide ) |
Please can anyone come up with an optimized solution for solving this PS? Design an algorithm to find all the common elements in two sorted lists of numbers. For example, for the lists 2, 5, 5, 5 and 2, 2, 3, 5, 5, 7, the output should be 2, 5, 5. Time complexity should be 0(n) or better NB : am terrible with algos so any contribution would be highly appreciated namikaze truthcoder qtguru tensazangetsu20 |
Deicide:Hope u don't mind my asking, but how many programming languages do u actually know.,because I have seen u write in several languages |
Deicide:Depends on the use case, yea maybe for services that involve lots of extensive computation, but nodejs single-threaded non-blocking approach makes it somewhat more performant than the traditional REST spring-boot [Springweb running on an embedded tomcat ] except you want to integrate other spring projects like SpringWebflux or SpringBatch. |
qtguru:Damn you are really humble .... ![]() |
This is what I call Improvement Great work man |
Was your password field in your model class set this way? password: { type: String, select: false, }, setting a select attribute as false prevents passwords from being returned in the JSON response object so I think your password isn't returned from the query. You can try replacing that line with const existingUser = await User.findOne({ email }).select('+password'); or better still place a line break there and run on debug mode to monitor the returned values |
tensazangetsu20:Her profile ..do some research and look her up on LinkedIn and twitter and I mentioned that these should be old projects (I think the preceding text from her post was few years ago ) |
tensazangetsu20: .... there isn't so much to it though ... It has more to do with experience, also skills but mainly experience and she meets that from what I can see. I might be wrong though |
TheManOfTheYear:Obviously she is a senior ..if you check her handle you would see she isn't new to the game ..these are probably old projects |
TheManOfTheYear:Obviously she is a senior ..if you check her handle you would see she isn't new to the game ..this are probably old projects |
It's obviously a syntactic error...paste the statement here so we can debug. .can't remember the last time I used native queries sef. .except short ones though ..most ORM/ODM abstracts them |
When you get to the tomcat homepage did you try to login with the credentials you specified on the config file .. (the xml) ..That's where you are suppose to deploy your app .before that you also have to set your application context path and run maven complete cycle (mvn install) to get the latest patch .upload your war file in the specified form then make sure the status of your app is running in the list of deployed apps Like I stated earlier try this on your local machine then mirror it on your remote |
sweetguy10:No, custom credentials for your apache tomcat server |
sweetguy10:Firstly it should be a war file and you must tell your spring boot starter file that your want to package the application as a Web application Archive public class ApplicationName extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(ApplicationName.class); } public static void main(String[] args) { SpringApplication.run(ApplicationName.class, args); } } I think you should stage it in your local environment first before you deploy it on your remote machine, the steps are quite the same extracting files on the /domain/web apps folder isn't the right approach from what I know, I think tomcat has an administrator(GUI) interface where you deploy your apps, To create a new user you must change the configuration settings in the conf/tomcat-users.xml and supply your credentials <tomcat-users xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0"> <user username="your-username" password="your-password" roles="manager-gui" /> <tomcat-users> restart the server You can easily log in with your credentials then deploy your app. Repeat the same process on your remote server |
Are u using a cloud solution provider or a shared hosting platform . I think AWS offers a 1-year free tier you can use a Linux instance(EC2) for staging and provision it for your application, or rather go with GCP and put a cap on your expenditure. |
qtguru. .men love your dairy ..You are such an inspiration |
Looks great man !!!!!� |
No local one though ..just on reddit and fb ...do I know anyone I can join |
You can add a method level prefilter to allow only managers to access the method When you return the currently logged in user get the branch Id of that manager Query the db for all users where the branch id is equal to the returned branch id and the role is marketer Since you have a onetomany bidirectional relationship between the marketers and their customer you can return a list of all customers for each marketer returned and append it to a main list that would be returned as a json object |
I think the issue should be in your JWTAuthorizationFilter Class (if you have any ).because on every request the Authentication object should be set by extracting the relevant details from the generated token Something like this jwt = jwt.replace(SecurityConstants.TOKEN_PREFIX, "" ;SecretKey key = Keys.hmacShaKeyFor(SecurityConstants.JWT_KEY.getBytes(StandardCharsets.UTF_8)); Claims claims = Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(jwt).getBody(); String username = String.valueOf(claims.get("username" );String authorities = (String) claims.get("authorities" ;Authentication auth = new UsernamePasswordAuthenticationToken(username, null, AuthorityUtils.commaSeparatedStringToAuthorityList(authorities)); SecurityContextHolder.getContext().setAuthentication(auth); ...and I don't see any filters added to your HttpSecurity configure method in your WebSecurity class There should be something like this http.addFilterAfter(new AuthoritiesLoggingAfterFilter(), BasicAuthenticationFilter.class) .addFilterBefore(new JWTTokenValidatorFilter(), BasicAuthenticationFilter.class) One of the issues with JWT authentication is that there different implementations, a beauty, and a curse. I can give u the one that works for me. It's long and you have to do some major refactoring And for the naming issue, i don't really get it but the difference between userName and username is that hibernate would map requests with userName to the column named "user_name", while username will be mapped to "username" And please change your antMachers to mvcMatchers..They are less opinionated |
That's why I asked if you were able to log in and the tokens were sent to the headers, if so, please send your Authentication(Token generation) and Authorization filter implementations and also your UserRoles class. If your codes are similar to the attached, then the issue should be from there. Your roles should also implement the GrantedAuthority interface that's the only way you can pass it directly to the returned User class in the UserDetailsServiceImpl.
|
You said you used jwt for your authentication. .can you log in ?..please show me the response it gives when you log in Because the authentication object cannot return null if that path is protected and you have been duly authenticated For that service layer issue ..try querying using the repoObject ..and see the result |
sweetguy10:Ok, I see. If you used spring security for your authentication, authentication.geName() should return the username of the currently logged in user, username here is the username you use for authentication, You can confirm this by logging out the response or placing a breakpoint there if it returns the username of currently logged in user then that step is correct. What I did next was a query to return the User Object using the username as a search parameter. I even see that "customer" is a property in your user class so you can as well just return it (user.getCustomer() will return the customers of the logged-in user which should be a marketer (to ensure this you can use prefilters to make sure only marketers have access to that method , though this is optional )) |
Ok Maybe you can try the attached code
|
I think you should paste the rest endpoint where you make the API call .. To get the current user you can leverage on the Authentication object passed as a paramter on the handler and invoke the getPrincipal () method ...When you get the currently logged in user ,create a custom implementation on the repo .or better still you can use @Prefilter and filter based on the currently logged in user on the handler |
The stack trace shows that your JDK and SDK are non existent or not installed properly |
Maskyy:I think this should be the correct function const range = ( start, stop) => Array.from( { length: ( stop - start ) + 1 }, ( _, i ) => start + i ); console.log(range(3,50)); |
The case was compromised from the onset due to lack of substantial evidence .so am not surprised by the ruling .but if we look at it from another perspective no one is looking at the moral implications of it ,he still has pastor cocantentated to his name ..From the comments I read here ..I have only one conclusion Christianity has become a fucking joke ![]() |
I would just snap the question and get it as text and put it on chatgpt. Seriously I don't know why they ask those questions that doesn't really test how competent someone is as an Engineer.
;