Richebony's Posts
Nairaland Forum › Richebony's Profile › Richebony's Posts
Great work!!! |
Their servers have been down for over a month now ...so what are they even saying |
stankelz:So you paid the $100 fee? Because I haven't been able to access a free upload. If you did ..Kudos |
This is really nice .Hope u dont mind my asking , whats the name of the course ? |
InteliJ:Nice one bro ...I really wish u all the best |
From the stack trace your error seems to be coming from the productService class and the updateProduct method, seems you are trying to unbox a Double to its primitive value when it is apparently null ... What is the code snippet in line 86 of your ProductService? Apparently, you can make a null check before that line if(weight!=null) { //Perform business logic } |
InteliJ:yea, iits not supposed to act like that, that's why I asked what the class of the exception being thrown is , if it's an IllegalStateException then the error must have been thrown from the service layer and propagated to the controller class |
What is the class of the exception being thrown And besides why dont you place all those request params asides the id inside the request body wrapped around a dto |
BurnerMan:So what you are saying is that you want a customOAuth2 service you would need to add these properties spring.security.oauth2.client.provider.google.authorization-uri= spring.security.oauth2.client.provider.google.token-uri = spring.security.oauth2.client.provider.google.user-info-uri= spring.security.oauth2.client.provider.google.user-name-attribute= email add this dependency <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-jose</artifactId> </dependency> create a customOauth2UserService import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @Service @RequiredArgsConstructor public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> { @Value("${spring.security.oauth2.client.provider.google.user-info-uri}" ![]() private String userInfoUri; private final RestTemplate restTemplate; @Override public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException { String accessToken = userRequest.getAccessToken().getTokenValue(); GoogleUserInfo userInfo = restTemplate.getForObject(userInfoUri, GoogleUserInfo.class, accessToken); if (userInfo == null) { throw new UsernameNotFoundException("User not found" ;} Map<String, Object> attributes = new HashMap<>(); attributes.put("email", userInfo.getEmail()); attributes.put("name", userInfo.getName()); return new DefaultOAuth2User( Collections.singleton(new OAuth2UserAuthority(attributes)), attributes, "email" ;} } create your customAuth2Provider @Component @RequiredArgsConstructor public class CustomOAuth2AuthenticationProvider implements AuthenticationProvider { private final CustomOAuth2UserService customOAuth2UserService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { OAuth2User oauth2User = (OAuth2User) authentication.getPrincipal(); UserDetails userDetails = customOAuth2UserService.loadUser(oauth2User.getRequest()); return new UsernamePasswordAuthenticationToken( userDetails, null, userDetails.getAuthorities()); } @Override public boolean supports(Class<?> authentication) { return OAuth2UserAuthenticationToken.class.isAssignableFrom(authentication); } } @Configuration @RequiredArgsConstructor public class SecurityConfig { private final CustomOAuth2AuthenticationProvider customOAuth2AuthenticationProvider; @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { return httpSecurity.authorizeHttpRequests(auth -> auth.requestMatchers("/" .permitAll().anyRequest().authenticated()) .oauth2Login((oauth2Login) -> oauth2Login .userInfoEndpoint((userInfo) -> userInfo.userService(customOAuth2UserService)) // this is authoInjected with the provider // you can also configure the login uri/page here ) .formLogin(Customizer.withDefaults()) .build(); } } PS : The code might not work ,didnt test it ...i am actually wondering why you chose this approach,you can run test cases on the service layer ,if that works, then extra configuration tweaking might fix it |
InteliJ:Lol, you are not alone in this, I also had this issue, especially with the introduction of Spring Security 6, it made most of my prior knowledge deprecated, I would recommend Dan Vega's Spring Security course on YouTube, he works with the Spring team and gets most of his resources directly from the docs .So just search for his channel on YouTube [Dan Vega]..if you have any questions u can holla |
you need this dependency in your maven pom dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-oauth2-client</artifactId> </dependency> in your applications.properties add these #GOOGLE OAUTH # You need additional settings to configure your OAUTH service ..just check youtube spring.security.oauth2.client.registration.google.client-id= your-client-id spring.security.oauth2.client.registration.google.client-secret=your-secret in your SecurityConfig class @Configuration public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { return httpSecurity.authorizeHttpRequests(auth -> auth.requestMatchers("/" .permitAll().anyRequest().authenticated()) .oauth2Login(Customizer.withDefaults()) .formLogin(Customizer.withDefaults()) // u can replace this with httpBasic and configure the URL .build(); } } |
most don't give two bleeps though ,esp if you are working as an IC |
I think what sets reactive libraries like quarkus, vert.x, and webflux apart, is the fact that they are nonblocking [asynchronous]. Spring boot applications use an embedded Tomcat server which spins a new thread from your thread pool on each concurrent request [Thread per request model ], The number of threads that can be spawned is finite and when they are all in a busy state, any further request would be blocked pending the completion of the other threads, creating idle time, introducing latency, memory overhead. if you are familiar with the nodejs runtime, reactive libraries employ the same approach, I think webflux and vert.x uses Netty [i don't really know about the internal workings]. |
omor! people dey talk oh |
chukwuebuka65:I think I explained in the preceding text, the setTimeout function is asynchronous and isn't a native js function, and your callback function is invoked on a different execution context because its the libuv [c++] APIs that nodejs delegates the timer function to. So your try-catch block isn't bound to your callback function because it exists in a different execution context |
I think set timeout() is asynchronous and registers an event that is handled by the libuv . Place another try-catch inside your setTimeout async block |
The learning curve is pretty steep and it would take you years to master if you aren't patient enough I would suggest you learn alternative languages like Golang or probably C# which are also quite performant, if you are, start with Java SE, [Basic language syntax, core packages like [utils, lang, streams], generics, the collection framework, lambda expressions, reflections, and annotations, file handling[io/Nio] , exception handling, multithreading, and concurrency], then just have basic understanding of the web container [ web servlets and web servers] and the MVC architecture, Object Mappers like Jackson would come in handy when developing web services, running unit tests using JUnit and Mockito, build tools such as maven or gradle, JDBC to create the persistent layer (this would be abstracted by other libraries such has Hibernate and SpringJDBC when you study further , but the rudiments are still handy ),then you can enter the world of Spring and dive into spring projects ..which can also be overwhelming, alternatively u can decide to focus on reactive services like Micronaut or Vertx |
If you understand basic Java and understand the concept of web servlets and MVC architecture, then try java techie's channel on youtube, if you want a more in-depth understanding buy Spring Framework guru courses [John Thompson] on Udemy. But the most beginner-friendly course for me is chad darby's Spring Boot course on Udemy |
Deicide:Wow this is really nice ,can you share the source code |
Thermodynamics:If you were able to build that app u listed from scratch, Baba na to fake experience oh .. use what u did in your mini projects and freelance gigs as job description, just state that you were employed as a contractor |
Thermodynamics:Thanks i have sent u a reply |
Thermodynamics:can u share u github profile |
Thermodynamics:Ah .....that's strange oh ...can u share ur github link ..and like my oga asked ..do u code Springboot? |
Purvan:That's the second funniest thing I see in tech communities after PHP is dead, I think you probably are still using JDK 1.7, Java has evolved and would keep evolving to a more programmer-friendly language |
You didn't specify what the error is being thrown, if it established a connection , or if the client and server have the same origin if the latter is the case Allow CORS ws.on('headers', (headers, request) => { headers.push('Access-Control-Allow-Origin: *'); headers.push('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept'); }); To check if your websocket is even connected on Bootstrap if (ws.readyState === ws.OPEN) { console.log('WebSocket is open '); } else { console.log('WebSocket is closed'); } PS : if you aren't limited by tech specifications I would suggest using Sockets.io ...it offers a lot of abstraction over cross-cutting concerns that might come up when your application scales |
I think u should be the one reaching out though |
With your skill level, getting a job shouldn't really be a problem for you, at least getting invites . Your portfolio actually has more detail than your actual LinkedIn profile which is totally wrong, Your LinkedIn profile should have as much information as your CV does, also under your projects you should share a screenshot of your mobile applications that would give recruiters an insight on your competence, Also update your readme files on your GitHub repos, recruiters sometimes spend more time on your repos than even your portfolio especially those with some technical expertise. I wish you good luck |
I have been playing around with nestjs microservices and I encountered an issue when using containerized services. Standalone nestjs applications are usually configured with a file watcher on dev mode( i think it uses ts-node under the hood ). The issue I am facing is that, despite my local environment clearly being mounted to the container( i ssh into the containers so i actually see changes being reflected) , the watcher refuses the restart the service on file changes.I tried to update the[b] watch [/b]attribute of ts-config.json in the root application to true, and also passed CHOKIDAR_USEPOLLING=true as a global env variable in my docker-compose file for the service, all to no avail.I think the issue lies with the WSL in Windows OS(i use docker for Windows).If anyone has a workaround on this please kindly direct me. Because I had to improvise by restarting each container anytime I make any file changes ..which is fucking frustrating |
People wey never even chop belle full dey shout Nice one ...lmao ![]() |
Nice job bro ... I see lots of improvements and you have also added Nest to your skillset .Hope u are currently engaged now ..Wish you the best , I admire your resilience |
Don't Panic by Coldplay |
tosinhtml:how many people are truthful about their exprience/ position . Once you have gained some competency level and built some apps in a new tech and also have vast provable experience in other tech you can easily migrate . My friend has been moving from one field to another , there was even an RN job he got [remote], he actually started learning the library on the job(though he already knew react).They just wanna see that you have worked for a reputable company and have some knowledge in the required tech |

