tag:blogger.com,1999:blog-34693542870904593052024-03-09T00:14:59.440+05:30java source codejava code, struts ,eclipse ide, jsp, servlets, SOAP, java swing, awt, swt, gwt, struts 2 framework, spring, JNI, JNDI, jdbc examples,Hibernate, data science, machine learning, artificial intelligence, consumerfed, IT Section, spring boot, angular js, restKonzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.comBlogger449125tag:blogger.com,1999:blog-3469354287090459305.post-27831130907140373312023-01-19T13:17:00.003+05:302023-01-19T13:17:49.433+05:30The story of i<div>I was born and living with my parents till age of 3, after my sister's birth, my father and mother got separated and years later got divorced and i started living in my mother's house. Even i had a father, i didnt get what a child should get.</div><div> Childhood was good and happy. Uncles were loving and caring. But later situation starts changing, my grandfather used to beat my mother most of the days, he didn't allow her to do her tailor works from home. I started working in std booth at the age of 12 payment 300 per month, from then onwards i worked in many places including internet cafe, shops till my master degree. During my master degree most of the days i was not having enough money to have my food. I started working on first it firm for a salary of 3000 per month for 1 year ( during recession) and a job was needed for me. I jumbed from x to y companies during my first 3 years, but no significant increase in my salary. I joined in a government firm and worked there for 4 years, salary 8000. ( An mca graduate with 7 yrs experience). I have to provide complete financial support for my sister by availing loan same year my great supporter grandmother died on the same day my mother got discharged from hospital. Hard days. Financial assistance for sisters pregnancy . During these days i was earning only 8000.Hard days with empty pocket. Resigned my government job. Went to dubai, searched for job after a month, recieved a job in software company which lasted only for 1.5 years. During this time i lost my own house to my uncle then we were forced to go to a rental home. Both kerala flood effected my rental home. I lost my job in Dubai and 2 month was horrible. Returned to india after 3 months joined in x company, during covid again i lost job. Did some freelance work with friends during these days since i need to pay rent atleast. After some months joined in y company. I settled all loans before entering my life with aswathi, my focus on buying a home didnt alter. Many loses in 2022 including cancellation of my marriage in dec then depression . After a great struggle now i am able to buy my dream home by my own in my home town for 50 lakhs in dec 2022.</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0tag:blogger.com,1999:blog-3469354287090459305.post-69460585140039802802022-10-07T03:00:00.012+05:302022-10-07T03:00:00.185+05:30[Solution for ] No main manifest attribute, in jar Maven and SpringBoot | SpringBoot no main manifest attribute (maven)<h2 style="text-align: left;"><b><span style="font-size: large;">SpringBoot no main manifest attribute (maven)</span></b></h2><div><br /></div><div><br /></div><div><br /></div><div><div><br /></div><div><span style="font-size: large;"><br /></span></div><div><span style="font-size: large;"><i>Add the plugin to the pom.xml:</i></span></div><div><br /></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: medium;"><plugin></span></div><div><span style="font-size: medium;"> <groupId>org.springframework.boot</groupId></span></div><div><span style="font-size: medium;"> <artifactId>spring-boot-maven-plugin</artifactId></span></div><div><span style="font-size: medium;"> <configuration> </span></div><div><span style="font-size: medium;"> <mainClass>com.bijusapp.stockmarket.TickerApplication</mainClass></span></div><div><span style="font-size: medium;"> </configuration></span></div><div><span style="font-size: medium;"> <executions></span></div><div><span style="font-size: medium;"> <execution></span></div><div><span style="font-size: medium;"> <goals></span></div><div><span style="font-size: medium;"> <goal>repackage</goal></span></div><div><span style="font-size: medium;"> </goals></span></div><div><span style="font-size: medium;"> </execution></span></div><div><span style="font-size: medium;"> </executions></span></div><div><span style="font-size: medium;"></plugin></span></div></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: medium;"><br /></span></div><div><span style="font-size: x-small;">Tags : No main manifest attribute, in jar Maven and SpringBoot, Unable to execute jar- file no main manifest attribute,[Fixed] no main manifest attribute, Maven "No main manifest attribute", How to fix "no main manifest attribute" error , Importance of Main Manifest Attribute in a Self-Executing JAR,It is easy to resolve this error in the Spring Boot project</span></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Perambra, Kerala 673525, India11.5639505 75.756449199999992-16.746283336178845 40.600199199999992 39.874184336178843 110.91269919999999tag:blogger.com,1999:blog-3469354287090459305.post-76301844314643816472022-09-07T07:30:00.004+05:302022-09-07T07:30:00.195+05:30nested exception is org.springframework.core.io.buffer.DataBufferLimitException | Exceeded limit on max bytes to buffer : 262144 | org.springframework.web.reactive.function.client.WebClientResponseExceptionHi, While trying to implement a NSE Ticker for stockmarket analysis we encountered the below error<div><br /></div><div><div>reactor.core.Exceptions$ErrorCallbackNotImplemented: org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from GET https://www.bijusapp/query?f=DAILY&symbol=adhani&apikey=bijusapp; nested exception is org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144</div><div>Caused by: org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from GET https://www.bijusapp/query?f=DAILY&symbol=adhani&apikey=bijusapp; nested exception is org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144</div></div><div><br /></div><div><br /></div><h3 style="text-align: left;">Solution</h3><div><br /></div><div>spring.codec.max-in-memory-size=50MB in application properties</div><div><br /></div><div><br /></div><div>Or</div><div><br /></div><div><br /></div><div><div>/**</div><div> * </div><div> */</div><div><br /></div><div><br /></div><div>import org.springframework.context.annotation.Configuration;</div><div>import org.springframework.http.codec.ServerCodecConfigurer;</div><div>import org.springframework.web.reactive.config.EnableWebFlux;</div><div>import org.springframework.web.reactive.config.WebFluxConfigurer;</div><div><br /></div><div>/**</div><div> * @author bijusapp</div><div> *</div><div> */</div><div>@Configuration</div><div>@EnableWebFlux</div><div>public class WebFluxConfig implements WebFluxConfigurer {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>@Override</div><div><span style="white-space: pre;"> </span>public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {</div><div><span style="white-space: pre;"> </span>configurer.defaultCodecs().maxInMemorySize(16 * 1024 * 1024);</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div></div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Perambra, Kerala 673525, India11.5639505 75.756449199999992-16.746283336178845 40.600199199999992 39.874184336178843 110.91269919999999tag:blogger.com,1999:blog-3469354287090459305.post-78518359542337910502022-08-21T13:02:00.011+05:302022-08-25T20:17:40.442+05:30When to buy :: When to sell :: When to exit :: Swing trade | stock market explained<span style="font-family: georgia; font-size: x-large;">Hi Team</span><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">Here we explain the some best steps you can consider before start trading on any stock for short term. Our strategy is to get maxmimum profit (around 20 percentage) in a month with same capital.</span></div><div><span style="font-family: georgia; font-size: large;"><br /></span></div><div><ul style="text-align: left;"><li><span style="font-family: georgia; font-size: x-large;">How to pick up a stock</span></li><li><span style="font-family: georgia; font-size: x-large;">What strategies we are following</span></li><li><span style="font-family: georgia; font-size: x-large;">What all paramaters you need to analyse</span></li><li><span style="font-family: georgia; font-size: x-large;">How to analyse the graph pattern</span></li><li><span style="font-family: georgia; font-size: x-large;">When to buy , When to sell or when to exit</span></li><li><span style="font-family: georgia; font-size: x-large;">With an example (Motherson sumi wiring india ltd)</span></li></ul><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia;"><h3 style="font-family: "Times New Roman"; font-size: x-large;"><span style="font-family: georgia; font-size: x-large;">Best stock with returns huge profit</span></h3><div><span style="font-size: x-large;"><br /></span></div><div><span style="font-size: x-large;">Best swing stock which may returns 10 percentage in 3 weeks, visit our <a href="https://javabelazy.blogspot.com/p/stocks.html" target="_blank">stock list</a></span></div><div style="font-size: x-large;"><span style="font-family: georgia; font-size: x-large;"><br /></span></div></span></div></div><h3 style="text-align: left;"><span style="font-family: georgia; font-size: x-large;">H</span><span style="font-family: georgia; font-size: x-large;">ow to pick up a stock</span></h3><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">Consider breakout stocks, from any stock market websites like</span></div><div><a href="https://chartink.com/screener/breakout-list-for-tomorrow" style="font-family: georgia; font-size: x-large;" target="_blank">chartlink</a><span style="font-family: georgia; font-size: x-large;"> Or from telegram discussion group </span></div><div><a href="https://t.me/nseticker" style="font-family: georgia; font-size: x-large;">https://t.me/nseticker</a></div><div><br /></div><div><span style="font-family: georgia; font-size: xx-large;">From <a href="https://www.tickertape.in/" target="_blank">Tickertape</a> , Go to stock screener ( tools of the trade) apply the following filters</span></div><div><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheZ9t_K-MjWLGie5YQTNHpjYs5f9byA2gGzD70f8iEaTHxrh3L8TKcMlPTDYdJKQQFZuEXOqnUAvGLKSfiKzkgWoToVyDgyHSX9Voc6h_O2uF_q-XlqNiKQevIBlQrPu_gS5A5tcCUkXWnaVoKUK8VBzV0Y1MsZKk13vBophSjBjL-MURshw00R9Zi/s415/How_to_select_swing_stock.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="415" data-original-width="292" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheZ9t_K-MjWLGie5YQTNHpjYs5f9byA2gGzD70f8iEaTHxrh3L8TKcMlPTDYdJKQQFZuEXOqnUAvGLKSfiKzkgWoToVyDgyHSX9Voc6h_O2uF_q-XlqNiKQevIBlQrPu_gS5A5tcCUkXWnaVoKUK8VBzV0Y1MsZKk13vBophSjBjL-MURshw00R9Zi/w450-h640/How_to_select_swing_stock.JPG" width="450" /></a></div><br /><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><br /></div><div><br /></div><div><h3><span style="font-family: georgia; font-size: x-large;">What strategies we are following</span></h3><h2 style="text-align: left;"><br /></h2></div><div><span style="font-family: georgia; font-size: x-large;">If you are planning to invest 1 Lakh rupees in swing trade, invest 10000 each in 10 trade. For swing trade we expect a return in 1 to 15 trade days, if any trade reached stop loss, you have 9 other stocks that achieved targets, again you can use the same capital for new swing trades.</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">For example</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">if 10 out of 5 Trade achieved target of 10 percentage in one week, you will get 5000 profit, and same capital ie 50000 can be invested in another 5 trades.</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">if 10 out of 3 Trade achieved target of 10 percentage in second week, you will book a profit of 3000 in coming week, again newly invested 5 trades may also book profit.</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">if 10 out of 2 reached stop loss in third week, you will have a small loss, even though monthly you can book a huge profit ( average more than 10 percentage with same capital of 1 Lakh)</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><h3 style="text-align: left;"><span style="font-family: georgia; font-size: x-large;">What all paramaters you need to analyse</span></h3><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><ul style="text-align: left;"><li><span style="font-family: georgia; font-size: x-large;">Current news on that particular stock</span></li><li><span style="font-size: x-large;"><span style="font-family: georgia;">Know about the organisation, their subsidaries, their products etc. About tab in screener will help you for this </span><a href="https://www.screener.in/" style="font-family: georgia;">https://www.screener.in/</a></span></li></ul></div><ul><li><span style="font-family: georgia; font-size: x-large;">Average brocker target from <a href="https://trendlyne.com/equity/856676/MSUMI/motherson-sumi-wiring-india-ltd/" target="_blank">tredlyne</a></span></li><li><span style="font-family: georgia; font-size: x-large;">Forecast & Rating in <a href="https://www.tickertape.in/stocks/motherson-sumi-wiring-india-MSU?checklist=basic" target="_blank">tickertape</a> (Buy siginal)</span></li><li><span style="font-family: georgia; font-size: x-large;">Strength, weekness and opportunity from </span><a href="https://trendlyne.com/equity/856676/MSUMI/motherson-sumi-wiring-india-ltd/" style="font-family: georgia; font-size: xx-large;" target="_blank">tredlyne</a></li><li><span style="font-family: georgia; font-size: x-large;">Check the durability score, buyers volume etc</span></li></ul><div><br /></div><h3 style="text-align: left;"><span style="font-family: georgia; font-size: x-large;">How to analyse the graph pattern</span></h3><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">Usually we go with cup & handle pattern Or morning star pattern. For morning star pattern we need to analyse the stock for 3 days</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">Example MSUMI (june 16 2022)</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkqMeBdzFhPAm59DwiG6SoXfwfxnoCzjYry7ByN7Dpe-O_YVP9mMpNF5_9NsTC29MyZXh1DKhAFqTYAn8cPn88aHN5Q4rLNyfBhLZPs6W-6K_QYu1IK5fyghWVS9YQAPP4_x5da5FSZFxutQUiFFqo5BtZCEL8bqUQ7uc8DePq_nh_i5kb36NFXDmd/s990/MSUMI_MORINIG_STAR.JPG" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="440" data-original-width="990" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkqMeBdzFhPAm59DwiG6SoXfwfxnoCzjYry7ByN7Dpe-O_YVP9mMpNF5_9NsTC29MyZXh1DKhAFqTYAn8cPn88aHN5Q4rLNyfBhLZPs6W-6K_QYu1IK5fyghWVS9YQAPP4_x5da5FSZFxutQUiFFqo5BtZCEL8bqUQ7uc8DePq_nh_i5kb36NFXDmd/w400-h178/MSUMI_MORINIG_STAR.JPG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">MSUMI morning star candle pattern formed on jun 16 2022</td></tr></tbody></table><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjdZmHqw_Dt6BqDFb3scjEnTLNC4Hv4QqWtg2dQZLUrWi00iP74serr--Syfrxn-YfNkAe7ycyB0Zhq9qFA7C5-or3Q7d56oM73FDR8svdXZOQCZT2y0aPaWcGiXmZ_9Z3jKejG1C5QBT3fMMMNnYdm_Jmtnq2kQbBety_7A-AjTJqqSG1J1wqvfqxY" style="margin-left: auto; margin-right: auto;"><img alt="" data-original-height="411" data-original-width="712" height="231" src="https://blogger.googleusercontent.com/img/a/AVvXsEjdZmHqw_Dt6BqDFb3scjEnTLNC4Hv4QqWtg2dQZLUrWi00iP74serr--Syfrxn-YfNkAe7ycyB0Zhq9qFA7C5-or3Q7d56oM73FDR8svdXZOQCZT2y0aPaWcGiXmZ_9Z3jKejG1C5QBT3fMMMNnYdm_Jmtnq2kQbBety_7A-AjTJqqSG1J1wqvfqxY=w400-h231" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">MSUMI news on june 16 2022 </td></tr></tbody></table><br /><br /></div><br /><h3 style="text-align: left;"><span style="font-family: georgia; font-size: x-large;">When to buy , When to sell or when to exit</span></h3></div><div><span style="font-family: georgia; font-size: x-large;">You can see where we set up our target and stop loss</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">For MSUMI, after trend reversal on jun 16 2022, the stock price increased from 64.00 to 78.00, able to book a profit of 22 percentage. </span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">In additon to candle graph pattern, we added MACD indicators, RSI (Relative strenght index ) & Volume graph.</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">We check whether there is a MACD cross over, RSI value is between 30 & 70, and a high volume of buyers in volume graph</span></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKHt2AdrVDzc3S2_ioajzajI2VjptOzVyCvpQInhG_DBeedT-B8W5l6Zz6oSql14fvXwM7lku3jt1fy5n579z7WdTnzVLwneFK6BVwaf_FOL8d3qJI95rcDyVEtCM2-YtN65OL9GjCFW6Jwdf_LGIVLslCK5lAC6ZN390Mwk82hCXjcSCFVzTwsmAK/s1363/MSUMI_GRAPH.JPG" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="766" data-original-width="1363" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKHt2AdrVDzc3S2_ioajzajI2VjptOzVyCvpQInhG_DBeedT-B8W5l6Zz6oSql14fvXwM7lku3jt1fy5n579z7WdTnzVLwneFK6BVwaf_FOL8d3qJI95rcDyVEtCM2-YtN65OL9GjCFW6Jwdf_LGIVLslCK5lAC6ZN390Mwk82hCXjcSCFVzTwsmAK/w640-h360/MSUMI_GRAPH.JPG" width="640" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Target and stop loss</td></tr></tbody></table><br /><div><br /></div><div><span style="font-family: georgia; font-size: x-large;"><br /></span></div><div><span style="font-family: georgia; font-size: x-large;">If you want to open a account in <a href="https://zerodha.com/?c=HWU079&s=CONSOLE" target="_blank">zeroda</a> or <a href="https://link.upstox.com/x3xCGcwMb6GGhKgc9" target="_blank">upstock</a>, use the <a href="https://zerodha.com/?c=HWU079&s=CONSOLE" target="_blank">link</a></span></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><span style="font-family: georgia; font-size: xx-large;">Thanks for reading our blog</span></div><div><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://www.youtube.com/channel/UCqfmCnrDNw9QAzpa5pxtAOg" style="margin-left: auto; margin-right: auto;" target="_blank"><img border="0" data-original-height="1400" data-original-width="2100" height="130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk8Ehrk4CC63Pf1Q5B4fW-0qJ21-rfdYq2mDNBML2thB6BRx5E2IbZG4AFgaYo0Z_VlwHuz947b-r3w8nnC9_Ck86frWUIKXx4wvHI-0126ruQbuuZQT56GDJ2pq5JR4xu5ka--3GlNfjs83bCCg_G-VhjmpgGhm3Ug1yYdSKxCZsHWVeQ2Lrcdz2t/w196-h130/nse_ticker.jpg" width="196" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">subscribe our youtube channel for daily updates</td></tr></tbody></table><br /><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><span style="font-family: georgia; font-size: xx-large;"><br /></span></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div><div style="text-align: justify;"><span style="font-family: courier; font-size: x-small;"> DISCLAIMER</span></div><div style="text-align: justify;"><span style="font-family: courier; font-size: x-small;">I AM NOT A SEBI REGISTERED ADIVISER.</span><span style="font-family: courier; font-size: small;">ALL MY VIDEOS, POST ARE RECOMMENDATIONS ARE ONLY FOR EDUCATIONAL AND MOTIVATIONAL PURPOSE.PLEASE DONT TAKE RISK ON YOUR HARD EARN MONEY ON THE BASIS OF MY RECOMMENDATION AND VIDEOS.MUST TAKE ADVICE FROM YOUR FINANCIAL ADVISER BEFORE PUTTING REAL MONEY INTO STOCK MARKET.</span></div></div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0India20.593684 78.96288-7.7165498361788458 43.80663 48.903917836178849 114.11913tag:blogger.com,1999:blog-3469354287090459305.post-53101618990920712692022-08-07T04:30:00.000+05:302022-08-07T04:30:00.184+05:30Given two non negative integers A and B, returns the number of bits set to 1 in java 8 | interview question<div>/**</div><div> * Write a function that given two non negative integers A and B, returns the number of bits set to 1 in the binary representation of the number A * B</div><div> */</div><div>package com.learning.leetcode;</div><div><br /></div><div>/**</div><div> * @author Biju perambra blogger</div><div> * IHRD CAS kozhikode</div><div> */</div><div>public class SolutionBijuApp {</div><div><br /></div><div><span style="white-space: pre;"> </span>public int solution(int A, int B) {</div><div><span style="white-space: pre;"> </span>int count = 0;</div><div><span style="white-space: pre;"> </span>int product = Math.multiplyExact(A, B);</div><div><span style="white-space: pre;"> </span>while (product > 0) {</div><div><span style="white-space: pre;"> </span>int value = product % 2;</div><div><span style="white-space: pre;"> </span>product = product / 2;</div><div><span style="white-space: pre;"> </span>if (value == 1)</div><div><span style="white-space: pre;"> </span>count++;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>return count;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><br /></div><div><span style="white-space: pre;"> </span>/**</div><div><span style="white-space: pre;"> </span> * @param args</div><div><span style="white-space: pre;"> </span> */</div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div><br /></div><div><span style="white-space: pre;"> </span>System.out.println(new SolutionBijuApp().solution(3, 7));</div><div><br /></div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div><br /></div><div><br /></div><div>BijuApp on stockmarket</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Mankave, Kozhikode, Kerala, India11.2404392 75.8156257-17.069794636178845 40.6593757 39.55067303617885 110.9718757tag:blogger.com,1999:blog-3469354287090459305.post-6020980328600922522022-07-28T05:00:00.022+05:302022-07-28T05:00:00.194+05:30How to find the count of employees in each department using java 8 streams and collection | interview questions MAANG<div>/**</div><div> * </div><div> */</div><div>package com.learning.stockmarket;</div><div><br /></div><div>import java.nio.charset.Charset;</div><div>import java.util.ArrayList;</div><div>import java.util.List;</div><div>import java.util.Map;</div><div>import java.util.Random;</div><div>import java.util.stream.Collectors;</div><div><br /></div><div>/**</div><div> * @author vishnu prasad blog</div><div> *</div><div> */</div><div>public class MainClass {</div><div><br /></div><div><span style="white-space: pre;"> </span>/**</div><div><span style="white-space: pre;"> </span> * @param args</div><div><span style="white-space: pre;"> </span> */</div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div><span style="white-space: pre;"> </span>List<Employee> empList = addEmployee();</div><div><span style="white-space: pre;"> </span>Map<Integer, Long> result = empList.stream().collect(Collectors.groupingBy(Employee:: getDeptId, Collectors.counting()));</div><div><span style="white-space: pre;"> </span>System.out.println(result);</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>private static List<Employee> addEmployee() {</div><div><span style="white-space: pre;"> </span>List<Employee> list = new ArrayList<>();</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>int id = 1;</div><div><span style="white-space: pre;"> </span></div><div><br /></div><div><span style="white-space: pre;"> </span>for (int i = 0; i < 100; i++) {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>byte[] array = new byte[7]; </div><div><span style="white-space: pre;"> </span> new Random().nextBytes(array);</div><div><span style="white-space: pre;"> </span> String name = new String(array, Charset.forName("UTF-8"));</div><div><span style="white-space: pre;"> </span> </div><div><span style="white-space: pre;"> </span> int dept = new Random().nextInt(6);</div><div><br /></div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>Employee employee = new Employee(id, name, dept);</div><div><span style="white-space: pre;"> </span>id = id++;</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>list.add(employee);</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>return list;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div><br /></div><h3 style="text-align: left;">Employee</h3><div><br /></div><div><div>/**</div><div> * </div><div> */</div><div>package com.learning.stockmarket;</div><div><br /></div><div>/**</div><div> * @author vishnu prasad blog</div><div><br /></div><div> * Kozhikode</div><div> */</div><div>public class Employee {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>private int id;</div><div><span style="white-space: pre;"> </span>private String name;</div><div><span style="white-space: pre;"> </span>private int deptId;</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public Employee(int id, String name, int deptId) {</div><div><span style="white-space: pre;"> </span>this.id = id;</div><div><span style="white-space: pre;"> </span>this.name = name;</div><div><span style="white-space: pre;"> </span>this.deptId = deptId;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public int getId() {</div><div><span style="white-space: pre;"> </span>return id;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>public void setId(int id) {</div><div><span style="white-space: pre;"> </span>this.id = id;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>public String getName() {</div><div><span style="white-space: pre;"> </span>return name;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>public void setName(String name) {</div><div><span style="white-space: pre;"> </span>this.name = name;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>public int getDeptId() {</div><div><span style="white-space: pre;"> </span>return deptId;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>public void setDeptId(int deptId) {</div><div><span style="white-space: pre;"> </span>this.deptId = deptId;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span></div><div><br /></div><div><br /></div><div>}</div></div><div><br /></div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Vaikom, Kerala, India9.7216446 76.3926668-18.588589236178848 41.2364168 38.031878436178843 111.5489168tag:blogger.com,1999:blog-3469354287090459305.post-39049172910783634372022-07-21T06:00:00.006+05:302022-07-21T06:00:00.211+05:30org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException<h3 style="text-align: left;">Problem</h3><div>org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException</div><div><br /></div><div>This issue happens due to version mismatch between swaggerfox and spring boot framework.</div><h3 style="text-align: left;"><br />Solution</h3><div><br /></div><div><br /></div><div><br /></div><div><div>/**</div><div> * @author aswathi sajeevan</div><div> *</div><div> */</div><div>@Configuration</div><div>@EnableSwagger2</div><div>public class SwaggerConfig {</div><div><br /></div><div><span style="white-space: pre;"> </span>@Bean</div><div><span style="white-space: pre;"> </span>public Docket api() {</div><div><span style="white-space: pre;"> </span>return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())</div><div><span style="white-space: pre;"> </span>.paths(PathSelectors.any()).build();</div><div><span style="white-space: pre;"> </span>}</div><div>}</div></div><div><br /></div><div><br /></div><h3 style="text-align: left;">Pom.xml</h3><div><br /></div><div><br /></div><div><div><span style="white-space: pre;"> </span><!-- swagger --></div><div><br /></div><div><span style="white-space: pre;"> </span><dependency></div><div><span style="white-space: pre;"> </span><groupId>io.springfox</groupId></div><div><span style="white-space: pre;"> </span><artifactId>springfox-boot-starter</artifactId></div><div><span style="white-space: pre;"> </span><version>3.0.0</version></div><div><span style="white-space: pre;"> </span></dependency></div><div><span style="white-space: pre;"> </span><dependency></div><div><span style="white-space: pre;"> </span><groupId>io.springfox</groupId></div><div><span style="white-space: pre;"> </span><artifactId>springfox-swagger-ui</artifactId></div><div><span style="white-space: pre;"> </span><version>3.0.0</version></div><div><span style="white-space: pre;"> </span></dependency></div></div><div><br /></div><div><br /></div><h3 style="text-align: left;">Spring boot version</h3><div><br /></div><div><br /></div><div><div><span style="white-space: pre;"> </span><parent></div><div><span style="white-space: pre;"> </span><groupId>org.springframework.boot</groupId></div><div><span style="white-space: pre;"> </span><artifactId>spring-boot-starter-parent</artifactId></div><div><span style="white-space: pre;"> </span><version>2.7.2-SNAPSHOT</version></div><div><span style="white-space: pre;"> </span><relativePath /> <!-- lookup parent from repository --></div><div><span style="white-space: pre;"> </span></parent></div></div><h3 style="text-align: left;"><br /><br />Swagger url</h3><div><br /></div><div>http://localhost:9090/swagger-ui/index.html</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Kadalundi, Kerala, India11.1360492 75.8272482-17.174184636178843 40.6709982 39.446283036178848 110.9834982tag:blogger.com,1999:blog-3469354287090459305.post-23406093203617064382022-07-14T08:30:00.009+05:302022-07-14T08:30:00.194+05:30How to create a textile billing and inventory system using google spreadsheet and google app sheetHi <div><br /></div><div><br /></div><div>We have created a textile inventory and billing system for Nijeeshma tailoring athanikkal kozhikode using google app sheet and google spreadsheet. Any one can develop this application with a day or two. No coding required</div><div><br /></div><div><br /></div><div>Please visit our git url</div><div><br /></div><div><a href="https://github.com/cheetah0203/nijeeshmatailoringApp/wiki">https://github.com/cheetah0203/nijeeshmatailoringApp/wiki</a></div><div><br /></div><div>Video</div><div><br /></div><div><a href="https://www.youtube.com/watch?v=faBraLnBHkM">https://www.youtube.com/watch?v=faBraLnBHkM</a></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Athanikkal, Kerala, India11.1358496 75.8519429-21.505122271808098 40.6956929 43.7768214718081 111.0081929tag:blogger.com,1999:blog-3469354287090459305.post-53937985765687473352022-07-07T07:00:00.022+05:302022-07-07T07:00:00.182+05:30How to use observable pattern to notify stock market breakouts entry stoploss<div><br /></div><div>Created a stock market application by implementing observable pattern.</div><div>In observable pattern the subsribers will be notified when ever there is any event occured in publishers object. In our example stock is the publisher ( Observables) and we kept a list of subscribers list in NotificationManager class.</div><div><br /></div><div><br /></div><div><br /></div><h3 style="text-align: left;">Stock.java</h3><div><br /></div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>import java.io.File;</div><div>/**</div><div> * Stock class</div><div> * Act as Observable or publisher</div><div> * </div><div> * Where ever a change happens in Stock object (publisher), it will notifies the subscribers</div><div> * </div><div> * two methods stoploss() & entry() corresponds to file opening and saving events</div><div> * </div><div> *</div><div> * </div><div> * </div><div> * @author smithesh k k</div><div> *</div><div> */</div><div>public class Stock {</div><div><br /></div><div><span style="white-space: pre;"> </span>private Breakout breakout;</div><div><span style="white-space: pre;"> </span>public NotificationManager events;</div><div><br /></div><div><span style="white-space: pre;"> </span>public Stock() {</div><div><span style="white-space: pre;"> </span>this.events = new NotificationManager(); </div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>public void stoploss(String nseTicker) {</div><div><span style="white-space: pre;"> </span>if (!nseTicker.isEmpty()) {</div><div><span style="white-space: pre;"> </span>this.breakout = new Breakout(nseTicker);</div><div><span style="white-space: pre;"> </span>events.notify(Alerts.STOPLOSS.toString(), breakout);</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>public void entry(String nseTicker) {</div><div><span style="white-space: pre;"> </span>if (!nseTicker.isEmpty()) {</div><div><span style="white-space: pre;"> </span>this.breakout = new Breakout(nseTicker);</div><div><span style="white-space: pre;"> </span>events.notify(Alerts.ENTRY.toString(), breakout);</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div><br /></div><h3 style="text-align: left;">NotificationManager.java</h3><div><br /></div><div>/**</div><div> * </div><div> */</div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>import java.util.ArrayList;</div><div>import java.util.HashMap;</div><div>import java.util.List;</div><div>import java.util.Map;</div><div><br /></div><div>/**</div><div> * NotificationManager</div><div> * </div><div> * keeps the subscriber list ( watchlist), through NotificationManager you can subscribe or unsusbscribe for an event</div><div> * </div><div> * notify() helps to notify the subscribers/observer's</div><div> * </div><div> * </div><div> * @author bijuvas</div><div> *</div><div> */</div><div>public class NotificationManager {</div><div><br /></div><div><span style="white-space: pre;"> </span>private Map<String, List<EventListener>> watchlist;</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public NotificationManager() {</div><div><span style="white-space: pre;"> </span>this.watchlist = new HashMap<>();</div><div><span style="white-space: pre;"> </span>addEvents();</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public void notify(String eventType, Breakout file) {</div><div><span style="white-space: pre;"> </span>List<EventListener> users = watchlist.get(eventType);</div><div><span style="white-space: pre;"> </span>users.forEach(user -> {</div><div><span style="white-space: pre;"> </span>user.update(eventType, file);</div><div><span style="white-space: pre;"> </span>});</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public void subscribe(String eventType, EventListener listener) {</div><div><span style="white-space: pre;"> </span>List<EventListener> users = watchlist.get(eventType);</div><div><span style="white-space: pre;"> </span>users.add(listener);</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public void unsubscribe(String eventType, EventListener listener) {</div><div><span style="white-space: pre;"> </span>List<EventListener> users = watchlist.get(eventType);</div><div><span style="white-space: pre;"> </span>users.remove(listener);</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>public void addEvents() {</div><div><span style="white-space: pre;"> </span>final Alerts[] alerts = Alerts.values();</div><div><span style="white-space: pre;"> </span>for (Alerts event : alerts) {</div><div> this.watchlist.put(event.toString(), new ArrayList<>());</div><div> }</div><div><span style="white-space: pre;"> </span>}</div><div>}</div><div><br /></div><h3 style="text-align: left;">EventListener.java</h3><div><br /></div><div>/**</div><div> * </div><div> */</div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>/**</div><div> * EventListener</div><div> * </div><div> * update()</div><div> * </div><div> * @author sreekumar</div><div> *</div><div> */</div><div>public interface EventListener {</div><div><span style="white-space: pre;"> </span>public void update(String eventType, Breakout breakout);</div><div>}</div><div><br /></div><div><br /></div><h3 style="text-align: left;">EmailNotificationListener.java</h3><div><br /></div><div>/**</div><div> * </div><div> */</div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>/**</div><div> * EmailNotificationListener</div><div> * </div><div> * @author perambra kozhikode</div><div> *</div><div> */</div><div>public class EmailNotificationListener implements EventListener {</div><div><span style="white-space: pre;"> </span>private String email;</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public EmailNotificationListener(String email) {</div><div><span style="white-space: pre;"> </span>this.email = email;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>@Override</div><div><span style="white-space: pre;"> </span>public void update(String eventType, Breakout breakout) {</div><div><span style="white-space: pre;"> </span>System.out.println(" email send to "+email +" for "+eventType);</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div><br /></div><div><br /></div><h3 style="text-align: left;">MainClass.java</h3><div><br /></div><div>/**</div><div> * </div><div> */</div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>/**</div><div> * @author valiyakode</div><div> *</div><div> */</div><div>public class MainClass {</div><div><br /></div><div><span style="white-space: pre;"> </span>/**</div><div><span style="white-space: pre;"> </span> * @param args</div><div><span style="white-space: pre;"> </span> */</div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div><span style="white-space: pre;"> </span>Stock editor = new Stock();</div><div><span style="white-space: pre;"> </span>NotificationManager event = editor.events;</div><div><span style="white-space: pre;"> </span>event.subscribe(Alerts.STOPLOSS.toString(), new EmailNotificationListener("test@gmail.com"));</div><div><span style="white-space: pre;"> </span>editor.stoploss("SGX");</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div><br /></div><div><br /></div><h3 style="text-align: left;">Breakout.java</h3><div><br /></div><div>/**</div><div> * </div><div> */</div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>/**</div><div> * @author Zamorins Guruvayoorappan college</div><div> *</div><div> */</div><div>public class Breakout{ //implements Strategies{</div><div><br /></div><div><span style="white-space: pre;"> </span>public Breakout(String nseTicker) {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>} </div><div><br /></div><div>}</div><div><br /></div><div><br /></div><h3 style="text-align: left;">Alerts.java</h3><div><br /></div><div>/**</div><div> * </div><div> */</div><div>package com.learning.designpattern.observer;</div><div><br /></div><div>/**</div><div> * @author lijesh</div><div> *</div><div> */</div><div>public enum Alerts {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>TARGET1, ENTRY, TARGET2, STOPLOSS;</div><div><br /></div><div>}</div><div><br /></div><div><br /></div><h3 style="text-align: left;">Full source code</h3><div><br /></div><div>Git url</div><div><a href="https://github.com/javabelazy/dailypreparation/tree/interview">https://github.com/javabelazy/dailypreparation/tree/interview</a></div><div> </div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Perambra, Kerala 673525, India11.5639505 75.756449199999992-16.746283336178845 40.600199199999992 39.874184336178843 110.91269919999999tag:blogger.com,1999:blog-3469354287090459305.post-60071863379330832192022-06-27T16:20:00.000+05:302022-06-27T16:20:01.385+05:30Sources must not be empty | java.lang.IllegalArgumentException | Spring boot application<b>Issue reported</b><div><br /></div><div><div><br /></div><div>2022-06-27 16:13:04.789 INFO 6348 --- [ main] o.s.boot.SpringApplication : Starting SpringApplication v2.6.0 using Java 11.0.7 on apple-pc with PID 6348 (E:\Aswathi\maven_repo\org\springframework\boot\spring-boot\2.6.0\spring-boot-2.6.0.jar started by aswathi in E:\Aswathi\repo\stockmaster\nyseticker)</div><div>2022-06-27 16:13:04.793 INFO 6348 --- [ main] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default</div><div>2022-06-27 16:13:04.828 ERROR 6348 --- [ main] o.s.boot.SpringApplication : Application run failed</div><div><br /></div><div>java.lang.IllegalArgumentException: Sources must not be empty</div><div><span style="white-space: pre;"> </span>at org.springframework.util.Assert.notEmpty(Assert.java:470) ~[spring-core-5.3.13.jar:5.3.13]</div><div><span style="white-space: pre;"> </span>at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:403) ~[spring-boot-2.6.0.jar:2.6.0]</div><div><span style="white-space: pre;"> </span>at org.springframework.boot.SpringApplication.run(SpringApplication.java:301) ~[spring-boot-2.6.0.jar:2.6.0]</div><div><span style="white-space: pre;"> </span>at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.0.jar:2.6.0]</div><div><span style="white-space: pre;"> </span>at org.springframework.boot.SpringApplication.main(SpringApplication.java:1317) ~[spring-boot-2.6.0.jar:2.6.0]</div></div><div><br /></div><div><b>Solution</b></div><div><br /></div><div>Go to class where you have your @SpringBootApplication and right click -> run as java application.</div><div><br /></div><div><br /></div><div><div><br /></div><div> . ____ _ __ _ _</div><div> /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \</div><div>( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \</div><div> \\/ ___)| |_)| | | | | || (_| | ) ) ) )</div><div> ' |____| .__|_| |_|_| |_\__, | / / / /</div><div> =========|_|==============|___/=/_/_/_/</div><div> :: Spring Boot :: (v2.6.0)</div><div><br /></div><div>2022-06-27 16:19:32.454 INFO 3160 --- [ main] c.p.nyseticker.NysetickerApplication : Starting NysetickerApplication using Java 11.0.7 on apple-pc with PID 3160 (E:\Aswathi\repo\stockmaster\nyseticker\target\classes started by apple in E:\Aswathi\repo\stockmaster\nyseticker)</div><div>2022-06-27 16:19:32.460 INFO 3160 --- [ main] c.p.nyseticker.NysetickerApplication : No active profile set, falling back to default profiles: default</div><div>2022-06-27 16:19:34.141 INFO 3160 --- [ main] c.p.nyseticker.NysetickerApplication : Started NysetickerApplication in 2.955 seconds (JVM running for 4.258)</div></div><div><br /></div><div><br /></div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Kadalundi, Kerala, India11.1360492 75.8272482-17.174184636178843 40.6709982 39.446283036178848 110.9834982tag:blogger.com,1999:blog-3469354287090459305.post-70126902396192804322022-06-21T05:00:00.004+05:302022-06-21T05:00:00.188+05:30How to use function interface in your application | simple example for lamba expression | Interview questions<div><b>Created a simple functional Interface</b></div><div><br /></div><div>/**</div><div> * @author Stock market swing trad</div><div> *</div><div> */</div><div>@functionInterface</div><div>public interface InitialStatus {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public String set();</div><div><br /></div><div>}</div><div><br /></div><div><br /></div><div><b>Implementing the function Interface</b></div><div><br /></div><div><br /></div><div><div> InitialValue soldCountInitialValue = () -> Long.valueOf(0);</div><div> InitialValue quantityInitialValue = () -> Long.valueOf(0);</div><div> InitialValue taxInitialValue = () -> Long.valueOf(5);</div><div> InitialValue ratingInitialValue = () -> Long.valueOf(1);</div><div> InitialValue ratingInitialCount = () -> Long.valueOf(1);</div></div><div><br /></div><div><br /></div><div><b>Using the variables</b></div><div><br /></div><div>itemObj.setSoldCount(soldCountInitialValue.set());</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0India20.593684 78.96288-7.7165498361788458 43.80663 48.903917836178849 114.11913tag:blogger.com,1999:blog-3469354287090459305.post-68682321631363320312022-05-14T23:00:00.001+05:302022-05-14T23:00:09.946+05:30Stock trading application source code | java code | how to get stock value of share through java code | yahoo finance<div>/**</div><div> * </div><div> */</div><div>package com.proximotech.nyseticker.service;</div><div><br /></div><div>import java.io.IOException;</div><div>import java.math.BigDecimal;</div><div><br /></div><div>import org.springframework.stereotype.Service;</div><div><br /></div><div>import com.proximotech.nyseticker.model.StockWrapper;</div><div><br /></div><div>/**</div><div> * @author apple</div><div> *</div><div> */</div><div>@Service</div><div>public class StockService {</div><div><br /></div><div><span style="white-space: pre;"> </span>public StockWrapper findStock(final String ticker) {</div><div><span style="white-space: pre;"> </span>try {</div><div><span style="white-space: pre;"> </span>return new StockWrapper(yahoofinance.YahooFinance.get(ticker));</div><div><span style="white-space: pre;"> </span>} catch (IOException e) {</div><div><span style="white-space: pre;"> </span>e.printStackTrace();</div><div><span style="white-space: pre;"> </span>} catch (Exception e) {</div><div><span style="white-space: pre;"> </span>e.printStackTrace();</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>return null;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>public BigDecimal findPrice(final StockWrapper stock) throws IOException {</div><div><span style="white-space: pre;"> </span>return stock.getStock().getQuote(true).getPrice();</div><div><span style="white-space: pre;"> </span>}</div><div>}</div><div><br /></div><div><br /></div><div>Download application from git</div><div><br /></div><div>https://javabelazy.blogspot.com/p/office.html</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0tag:blogger.com,1999:blog-3469354287090459305.post-18092700826513641192022-05-07T00:00:00.005+05:302022-05-07T00:00:00.227+05:30its never too late to try to achieve your dream | Motivational story<div><span style="font-family: times; font-size: medium;">its never too late to try to achieve your dream!</span></div><div><span style="font-family: times; font-size: medium;">its never too late to learn some thing new!</span></div><div><span style="font-family: times; font-size: medium;">its never too late to experience something beautiful!</span></div><div><span style="font-family: times; font-size: medium;">its never too late to keep on trying, no matter how may times you fail.</span></div><div><span style="font-family: times; font-size: medium;">its never too late...</span></div><div><span style="font-family: times; font-size: medium;"><br /></span></div><div><span style="font-family: times; font-size: medium;">There was a man, born a long time ago, </span></div><div><span style="font-family: times; font-size: medium;">Bought up in a simple middle class family,</span></div><div><span style="font-family: times; font-size: medium;">his father was a long family man and use to work in his farm.</span></div><div><span style="font-family: times; font-size: medium;">Lost his father when he was 5 years old,</span></div><div><span style="font-family: times; font-size: medium;">he was too young to realize what had happened.</span></div><div><span style="font-family: times; font-size: medium;">At the age of seven he learned to cook, to feed his younger siblings and his mom away working.</span></div><div><span style="font-family: times; font-size: medium;">At the age of ten he began working as a helper in the farmland and then took up job painting horse carriages,</span></div><div><span style="font-family: times; font-size: medium;">At the age of thirty he established a ferry boat company the ferry was an instant success, and the venture failure.</span></div><div><span style="font-family: times; font-size: medium;">Lost many jobs than finally started running a service station that got failed after six years of works.</span></div><div><span style="font-family: times; font-size: medium;">Many business failed, Almost bankrupt.</span></div><div><span style="font-family: times; font-size: medium;">Decided to sell his recipe to various restaurant,</span></div><div><span style="font-family: times; font-size: medium;">Rejected for 1009 times</span></div><div><span style="font-family: times; font-size: medium;">At age of 65 he tasted sucess as KFC</span></div><div><span style="font-family: times; font-size: medium;">Founder of Kentucky Fried Chicken.</span></div><div><span style="font-family: times; font-size: medium;">He is colonel sanders</span></div><div><br /></div><div>Dont give up keep going on..</div><div><br /></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGbzORFllWOFDeNqp5gYpEDAJl3DhvlvLCjmYtTLpvrBWhqaGgigaYXGm6cyp4HiEUbSPD5kqLQpQ1yz5_mqjEpbcGs7ODtHJp8_0bMgizI7Vb-ZfiPS3LhDGDe9F5N0rB6BoR36M9c2oZRQebsvIBFPJ8TUfcINHPBkurdkoZRCRjxb_wF8iyhK-c/s277/best%20motivational%20story.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="182" data-original-width="277" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGbzORFllWOFDeNqp5gYpEDAJl3DhvlvLCjmYtTLpvrBWhqaGgigaYXGm6cyp4HiEUbSPD5kqLQpQ1yz5_mqjEpbcGs7ODtHJp8_0bMgizI7Vb-ZfiPS3LhDGDe9F5N0rB6BoR36M9c2oZRQebsvIBFPJ8TUfcINHPBkurdkoZRCRjxb_wF8iyhK-c/s1600/best%20motivational%20story.jpg" width="277" /></a></div><br /><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0tag:blogger.com,1999:blog-3469354287090459305.post-57356869543372100882022-04-28T00:00:00.004+05:302022-04-28T00:00:00.186+05:30Making entire row and column of matrix to zero if one element is zero | alternative approach<div><br /></div><div><span style="font-size: large;"><b>Given a matrix if an element in the matrix is 0 then you will have to set its entire column and row to 0 and then return the matrix.</b></span></div><div><span style="font-size: large;"> </span></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS6lnoXBEpPunkKc4cF8Dz4wayZzCb2dYCM8HSaJV9AziKvdy3LiBodvDh1G6gEq_npkBYXeve_lokoytbQKkF2UlzlWCgJ9-Dxn4xbdF_-Nl8RI0bAGbUremIiC5EPSXUcVTPiEMqOjC4B-0c83C7nwFdJEIlYTPccnBtdup4vfSvO4rHc6Gk3R2d/s426/matrix_row_column_to_zero.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="216" data-original-width="426" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS6lnoXBEpPunkKc4cF8Dz4wayZzCb2dYCM8HSaJV9AziKvdy3LiBodvDh1G6gEq_npkBYXeve_lokoytbQKkF2UlzlWCgJ9-Dxn4xbdF_-Nl8RI0bAGbUremIiC5EPSXUcVTPiEMqOjC4B-0c83C7nwFdJEIlYTPccnBtdup4vfSvO4rHc6Gk3R2d/s320/matrix_row_column_to_zero.JPG" width="320" /></a></div><br /><span style="font-size: large;"><br /></span></div><div><span style="font-size: large;"><br /></span></div><div><span style="font-size: large;"><div>/**</div><div> * Given a matrix if an element in the matrix is 0 then you will have to set its entire column and row to 0 and then return the matrix.</div><div> */</div><div>package com.striver.sde.practice;</div><div><br /></div><div>import java.util.ArrayList;</div><div>import java.util.List;</div><div><br /></div><div>/**</div><div> * @author apple</div><div> *</div><div> */</div><div>public class MatrixZero {</div><div><br /></div><div><span style="white-space: pre;"> </span>/**</div><div><span style="white-space: pre;"> </span> * @param args</div><div><span style="white-space: pre;"> </span> */</div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div><br /></div><div><span style="white-space: pre;"> </span>int[][] input = { { 1, 1, 1 }, { 1, 0, 1 }, { 1, 1, 1 } };</div><div><br /></div><div><span style="white-space: pre;"> </span>MatrixZero m = new MatrixZero();</div><div>//<span style="white-space: pre;"> </span>m.findSolution(input);</div><div><span style="white-space: pre;"> </span>m.findSolution2(input);</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>private void findSolution2(int[][] input) {</div><div><span style="white-space: pre;"> </span>int len = input.length;</div><div><br /></div><div><span style="white-space: pre;"> </span>List rows = new ArrayList<>();</div><div><span style="white-space: pre;"> </span>List cols = new ArrayList<>();</div><div><br /></div><div><span style="white-space: pre;"> </span>for (int row = 0; row < len; row++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>for (int col = 0; col < len; col++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>if (input[row][col] == 0) {</div><div><span style="white-space: pre;"> </span>rows.add(row);</div><div><span style="white-space: pre;"> </span>cols.add(col);</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>for (int row = 0; row < len; row++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>for (int col = 0; col < len; col++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>if(rows.contains(row)) {</div><div><span style="white-space: pre;"> </span>input[row][col] =0;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>if(cols.contains(col)) {</div><div><span style="white-space: pre;"> </span>input[row][col] =0;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>System.out.println(input);</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>private void findSolution(int[][] input) {</div><div><br /></div><div><span style="white-space: pre;"> </span>int[][] output = input.clone();</div><div><br /></div><div><span style="white-space: pre;"> </span>int len = input.length;</div><div><br /></div><div><span style="white-space: pre;"> </span>for (int row = 0; row < len; row++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>for (int col = 0; col < len; col++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>if (input[row][col] == 0) {</div><div><br /></div><div><span style="white-space: pre;"> </span>modifyMatrix(row, col, output, len);</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>private void modifyMatrix(int row, int col, int[][] output, int len) {</div><div><br /></div><div><span style="white-space: pre;"> </span>if (row == 0) {</div><div><span style="white-space: pre;"> </span>int r = row;</div><div><span style="white-space: pre;"> </span>while (r < len) {</div><div><span style="white-space: pre;"> </span>output[r][col] = 0;</div><div><span style="white-space: pre;"> </span>r = r + 1;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>} else if (row == len) {</div><div><span style="white-space: pre;"> </span>int r = row;</div><div><span style="white-space: pre;"> </span>while (r >= 0) {</div><div><span style="white-space: pre;"> </span>output[r][col] = 0;</div><div><span style="white-space: pre;"> </span>r = r - 1;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>} else {</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div><br /></div></span></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Kuttiady, Kerala, India11.6543212 75.7535455-16.655912636178847 40.5972955 39.964555036178844 110.9097955tag:blogger.com,1999:blog-3469354287090459305.post-43715165535238724292022-04-21T06:00:00.040+05:302022-08-26T21:59:20.957+05:30Stock market trading | morning star candle stick pattern explained | How to set up an entry point | best to buy<div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFKU_iI1afLquvxVvplvTty2VIre5HphmvS4a46U0DjVHa_o2W33eLNMIpxNFnikoHtiOr8rDg53zvqh6lGDukhvSLW-eCSSLwuhFsY2gLPyWt-eMBMYGLJPlsHu5pYD5jHTRPfuf8r-Z4-3Ita66dmyIE5eIasqt1P1rDoNEggE056fxgI_d7hf7e/s913/morning_star_sbi_last3month.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="497" data-original-width="913" height="348" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFKU_iI1afLquvxVvplvTty2VIre5HphmvS4a46U0DjVHa_o2W33eLNMIpxNFnikoHtiOr8rDg53zvqh6lGDukhvSLW-eCSSLwuhFsY2gLPyWt-eMBMYGLJPlsHu5pYD5jHTRPfuf8r-Z4-3Ita66dmyIE5eIasqt1P1rDoNEggE056fxgI_d7hf7e/w640-h348/morning_star_sbi_last3month.JPG" width="640" /></a></div><br /><div><br /></div><h3>Sample graph : Morning star candle stick pattern explained</h3><h3><div style="font-size: medium; font-weight: 400;">we have taken last 3 month stock trading of SBI, in the yellow color we marked morning start candle stick pattern.</div><div style="font-size: medium; font-weight: 400;"><br /></div></h3><h3 style="text-align: left;">What is morning star candle stick pattern ?</h3><div><br /></div><div>Its a 3 candle stick pattern (Multiple candle stick pattern) which denotes 3 successive days.</div><div><br /></div><div>for example apr 21 2022, apr 22 2022, apr 23 2022 in each candle.</div><div><br /></div><div>Its a trend reversal pattern.</div><div><br /></div><div><br /></div><h3 style="text-align: left;">How and where to check morning star candle stick pattern?</h3><div><br /></div><div>Check whether the morning star candle stick pattern is formed after a downtrend.</div><div><br /></div><div>In morning star candle pattern</div><div><br /></div><div>1. The first candle will a bearish one</div><div><br /></div><div>2. The second candle will be either a doji or spinning top, here the color may be green or red</div><div><br /></div><div>if its green then its a good indicator to buy</div><div><br /></div><div>The second candle should be a gap down opening, ie the opening value should be lesser than first candle closing value.</div><div><br /></div><div>3. The third one must be a bulish candle and opening should be gap up opening.</div><div><br /></div><div><br /></div><h3 style="text-align: left;">What morning star candle stick says?</h3><div><br /></div><div>Its a entry point for short term or long term.</div><div><br /></div><div><br /></div><h3 style="text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiW1BhBrwW_0xuSx1YNVI0-cqbecShpVK-obyxdN1PUVugBrVKtbQvAv7REnINT3WnAjh5r_T5Cr504NkJpvjPeDJFISLdJ8eJr3hCcYnQ7TwoPu7R_wH3motGnrtToQsCSXC-vj84INNlBAcI5O62d4rJBoP0hQvYQzgHKJF0-1bKR_YrWayFNRvCp" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="182" data-original-width="727" height="160" src="https://blogger.googleusercontent.com/img/a/AVvXsEiW1BhBrwW_0xuSx1YNVI0-cqbecShpVK-obyxdN1PUVugBrVKtbQvAv7REnINT3WnAjh5r_T5Cr504NkJpvjPeDJFISLdJ8eJr3hCcYnQ7TwoPu7R_wH3motGnrtToQsCSXC-vj84INNlBAcI5O62d4rJBoP0hQvYQzgHKJF0-1bKR_YrWayFNRvCp=w640-h160" width="640" /></a></div><br /><br /></h3><div><br /></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Mumbai, Maharashtra, India19.0759837 72.8776559-22.531007465569477 2.5651559000000077 60.682974865569477 143.19015589999998tag:blogger.com,1999:blog-3469354287090459305.post-62804982046253899732022-03-07T14:14:00.009+05:302022-07-03T15:48:54.292+05:30Stock market trading | candle stick pattern explained | How to set up an entry point | break out | buy or sell decision<h3 style="text-align: left;">Descending Triangle Pattern </h3><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeDdiiJ1yAfTsUG__RTi-SAkqZYeAZEbt2wyUiMkxboh9hwR0IwkAwxznVoSStZVng-ACzcbW_GA1q4wo_bCbnBaqU1-evmQV0AEeezK6e6WPHUTE538EYG7MECEApbo4fgQ-XwgyF4JeqRFs4iBLts9zjSNI4ZXhqjeK3C10yUu5cCKb3Gju0ztYX/s431/descending_chart_pattern.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="324" data-original-width="431" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeDdiiJ1yAfTsUG__RTi-SAkqZYeAZEbt2wyUiMkxboh9hwR0IwkAwxznVoSStZVng-ACzcbW_GA1q4wo_bCbnBaqU1-evmQV0AEeezK6e6WPHUTE538EYG7MECEApbo4fgQ-XwgyF4JeqRFs4iBLts9zjSNI4ZXhqjeK3C10yUu5cCKb3Gju0ztYX/s320/descending_chart_pattern.PNG" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy3VIQy5D6kw4nLsFpCDOZh3ky3y86zacozzTLd5c7TdofC_MAFCLjtM7zTsZSOTd01kehfxR4wQV2nHQNaIeHicaIaU8sHT52sbQRobIFmKhmv9aRHbkW7apL1JyfJkTLQib_Xm_oSUYW-f7SzSWkEQIaed6lSItdTJ4S_el8g1unhvAg_WqRA9-A/s1057/descending_chart_pattern_ex.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="607" data-original-width="1057" height="184" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy3VIQy5D6kw4nLsFpCDOZh3ky3y86zacozzTLd5c7TdofC_MAFCLjtM7zTsZSOTd01kehfxR4wQV2nHQNaIeHicaIaU8sHT52sbQRobIFmKhmv9aRHbkW7apL1JyfJkTLQib_Xm_oSUYW-f7SzSWkEQIaed6lSItdTJ4S_el8g1unhvAg_WqRA9-A/s320/descending_chart_pattern_ex.PNG" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: left;">Represents stock consolidation, prior downtread before triangle formation.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Result : either be berish or bullish, but mostly berish.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Entry : breakout with maximum volume trying to break triangle pattern.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Target : maximum width of triangle price range.</div><div><br /></div>Stop loss : <br /><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Mumbai, Maharashtra, India19.0759837 72.8776559-9.2342501361788472 37.721405899999993 47.386217536178847 108.0339059tag:blogger.com,1999:blog-3469354287090459305.post-45313158794969918722021-12-21T01:12:00.007+05:302021-12-21T01:12:00.209+05:30Find missing number in a sequence Minimum complexity | n Log n<div>/**</div><div> * Find missing number in a sequence Minimum complexity (n Log n)</div><div> * </div><div> * input : {1,2,3,5}</div><div> * output : 4</div><div> */</div><div>package com.codecreeks.solutions;</div><div><br /></div><div>import java.util.Arrays;</div><div><br /></div><div>/**</div><div> * @author Consumerfed Information Technology Section</div><div> *</div><div> */</div><div>public class MissingNumberArray {</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>private static int loopCount = 0;</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div><span style="white-space: pre;"> </span>long startTime = System.currentTimeMillis();</div><div><span style="white-space: pre;"> </span>int[] a = {1,2,3,4,6,7,8,9,10,11,12};</div><div><span style="white-space: pre;"> </span>int len = a.length;</div><div><span style="white-space: pre;"> </span>MissingNumberArray m = new MissingNumberArray();</div><div><span style="white-space: pre;"> </span>int value = 0;</div><div><span style="white-space: pre;"> </span>if(a[len-1]!=len) {</div><div><span style="white-space: pre;"> </span>value = m.findMissingNumber(a, 0, len);<span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>System.out.println(" The Missing number in the array :"+Arrays.toString(a)+" is "+value);</div><div><span style="white-space: pre;"> </span>}else {</div><div><span style="white-space: pre;"> </span>loopCount++;</div><div><span style="white-space: pre;"> </span>System.out.println(" There is no missing number in the given array "+Arrays.toString(a));</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>System.out.println(" For "+len+" size array it tooks "+loopCount+" search to find the answer ");</div><div><span style="white-space: pre;"> </span>System.out.println(" Complexity :"+len*Math.log(len));</div><div><span style="white-space: pre;"> </span>System.out.println(" Time Taken : "+(System.currentTimeMillis() - startTime)+" ms");</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>private int findMissingNumber(int[] array, int startPstn, int endPstn) {</div><div><span style="white-space: pre;"> </span>loopCount++;</div><div><span style="white-space: pre;"> </span>int arraySize = endPstn - startPstn;</div><div><span style="white-space: pre;"> </span>int position = startPstn + arraySize / 2;</div><div><span style="white-space: pre;"> </span>if(arraySize==0) {</div><div><span style="white-space: pre;"> </span>return position +1;</div><div><span style="white-space: pre;"> </span>}else if (arraySize == 1) {</div><div><span style="white-space: pre;"> </span>return array[position] + 1;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>else if (array[position] != position + 1) {</div><div><span style="white-space: pre;"> </span>return findMissingNumber(array, startPstn, position);</div><div><span style="white-space: pre;"> </span>} else {</div><div><span style="white-space: pre;"> </span>return findMissingNumber(array, position + 1, endPstn);</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div>}</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Karnataka 571214, India12.2991176 75.678650699999992-62.868050894735092 -64.946349300000008 87.4662860947351 -143.6963493tag:blogger.com,1999:blog-3469354287090459305.post-6511179761708156362021-12-14T01:01:00.003+05:302021-12-14T01:01:00.189+05:30Squaring and Sorting an input array contains negative and positive number | complexity<div>/**</div><div> * Squaring and Sorting an input array contains negative and positive number</div><div> * </div><div> * Complexity O(2n)</div><div> * </div><div> */</div><div>package consumerfed;</div><div><br /></div><div>import java.util.Arrays;</div><div><br /></div><div>/**</div><div> * @author konzerntech</div><div> *</div><div> */</div><div>public class SquareAndSort {</div><div><br /></div><div><span style="white-space: pre;"> </span>/**</div><div><span style="white-space: pre;"> </span> * @param args</div><div><span style="white-space: pre;"> </span> */</div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div><span style="white-space: pre;"> </span>// TODO Auto-generated method stub</div><div><br /></div><div><span style="white-space: pre;"> </span>int[] input = { -10, -8, -3, -1, 4, 6, 8 };</div><div><span style="white-space: pre;"> </span>int len = input.length;</div><div><span style="white-space: pre;"> </span>int[] output = new int[len];</div><div><br /></div><div><span style="white-space: pre;"> </span>int[] a = new int[len];</div><div><span style="white-space: pre;"> </span>int[] b = new int[len];</div><div><br /></div><div><span style="white-space: pre;"> </span>int aLen = 0;</div><div><span style="white-space: pre;"> </span>int bLen = 0;</div><div><br /></div><div><span style="white-space: pre;"> </span>for (int i = 0; i < len; i++) {</div><div><span style="white-space: pre;"> </span>int value = input[i];</div><div><span style="white-space: pre;"> </span>int square = value * value;</div><div><span style="white-space: pre;"> </span>if (value < 0) {</div><div><span style="white-space: pre;"> </span>a[aLen] = square;</div><div><span style="white-space: pre;"> </span>aLen++;</div><div><span style="white-space: pre;"> </span>} else {</div><div><span style="white-space: pre;"> </span>b[bLen] = square;</div><div><span style="white-space: pre;"> </span>bLen++;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>int aPtr = aLen-1;</div><div><span style="white-space: pre;"> </span>int bPtr = 0;</div><div><br /></div><div><br /></div><div><span style="white-space: pre;"> </span>for (int i = 0; i < len; i++) {</div><div><br /></div><div><span style="white-space: pre;"> </span>if (bPtr > (bLen - 1)) {</div><div><span style="white-space: pre;"> </span>while (aPtr >= 0) {</div><div><span style="white-space: pre;"> </span>output[i] = a[aPtr];</div><div><span style="white-space: pre;"> </span>i++;</div><div><span style="white-space: pre;"> </span>aPtr--;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>break;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>if (aPtr < 0) {</div><div><span style="white-space: pre;"> </span>while (bPtr < bLen) {</div><div><span style="white-space: pre;"> </span>output[i] = b[bPtr];</div><div><span style="white-space: pre;"> </span>i++;</div><div><span style="white-space: pre;"> </span>bPtr++;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>break;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>if (b[bPtr] < a[aPtr]) {</div><div><span style="white-space: pre;"> </span>output[i] = b[bPtr];</div><div><span style="white-space: pre;"> </span>bPtr++;</div><div><span style="white-space: pre;"> </span>} else {</div><div><span style="white-space: pre;"> </span>output[i] = a[aPtr];</div><div><span style="white-space: pre;"> </span>aPtr--;</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>System.out.println("Input : "+Arrays.toString(input));</div><div><span style="white-space: pre;"> </span>System.out.println("Output : "+Arrays.toString(output));</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Thazhekad, Kerala, India10.3312073 76.2739795-17.979026536178843 41.117729499999996 38.641441136178848 111.4302295tag:blogger.com,1999:blog-3469354287090459305.post-47823158548611689512021-12-07T01:54:00.004+05:302021-12-07T01:54:00.207+05:30An application help to know buy or sell stock in stockmasterHi Team<div><br /></div><div><br /></div><div>We are planning to develop an application where any user who doesnt know about stock master can buy or sell stocks</div><div><br /></div><div>The application is developed in java spring boot</div><div><br /></div><div>Git url</div><div><br /></div><div><br /></div><div>Thanks @sanoop kakkoor for his #support</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0tag:blogger.com,1999:blog-3469354287090459305.post-44492447577191475862021-11-28T11:06:00.006+05:302021-11-28T11:06:00.197+05:30English to malayalam translation java code Hi Team<div><br /></div><div>English to Malayalam translation java code is available in GitHub</div><div><br /></div><div><br /></div><div>The translation is not 100% accurate , but the logic remains the same.you can modify the code accordingly, you can even raise the bug in the git itself. The translation will not take any time, performance is high, developed using plain java code.</div><div><br /></div><div><br /></div><div>https://github.com/consumerfed</div><div><br /></div><div>Please comment and revisit the blog</div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Thazhekad, Kerala, India10.3312073 76.2739795-32.444747044188141 5.96147950000001 53.107161644188146 146.5864795tag:blogger.com,1999:blog-3469354287090459305.post-19800360228205851562021-11-14T00:00:00.005+05:302021-11-14T00:00:00.196+05:30Wipro interview question - how to move the said value to one end of an array<div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-3P83I3Mr__g/YY6nYwBqf2I/AAAAAAAABkU/qgR6U6p2jkMFQJTM5LYaM7Cro1PGvn9qgCLcBGAsYHQ/image.png" style="margin-left: 1em; margin-right: 1em;"><img data-original-height="230" data-original-width="360" height="408" src="https://lh3.googleusercontent.com/-3P83I3Mr__g/YY6nYwBqf2I/AAAAAAAABkU/qgR6U6p2jkMFQJTM5LYaM7Cro1PGvn9qgCLcBGAsYHQ/w640-h408/image.png" width="640" /></a></div><br /><div><br /></div><div><div>package com.interviewquestions.wipro;</div><div>import java.util.ArrayList;</div><div>import java.util.Arrays;</div><div>import java.util.List;</div><div>/**</div><div> * </div><div> * @author nao jinguji</div><div> *</div><div> */</div><div>public class Wipro {</div><div><br /></div><div><span style="white-space: pre;"> </span>public static void main(String[] args) {</div><div>//<span style="white-space: pre;"> </span>List<Integer> input = List.of(2,1,2,2,2,3,4,2);</div><div>//<span style="white-space: pre;"> </span>List<Integer> input = Arrays.asList(arr);</div><div>//<span style="white-space: pre;"> </span>int toMove = 2;</div><div><span style="white-space: pre;"> </span>/*</div><div><span style="white-space: pre;"> </span>List<Integer> output = new ArrayList(input.size());</div><div><span style="white-space: pre;"> </span>for(int i :input) {</div><div><span style="white-space: pre;"> </span>if(i!=toMove) {</div><div><span style="white-space: pre;"> </span>output.add(i);</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>int len = input.size() -output.size();</div><div><span style="white-space: pre;"> </span>for(int i =0; i<len; i++ ) {</div><div><span style="white-space: pre;"> </span>output.add(toMove);</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>System.out.println(output);</div><div><span style="white-space: pre;"> </span>System.out.println("------------"); */</div><div><span style="white-space: pre;"> </span></div><div><span style="white-space: pre;"> </span>int[] input = {2,1,2,2,2,3,4,2};</div><div><span style="white-space: pre;"> </span>int toMove = 2;</div><div><span style="white-space: pre;"> </span>int ptr = 0;</div><div><span style="white-space: pre;"> </span>for(int i =0; i<input.length; i++ ) {</div><div><span style="white-space: pre;"> </span>int value = input[i];</div><div><span style="white-space: pre;"> </span>if(value!=toMove) {</div><div><span style="white-space: pre;"> </span>input[ptr] = value;</div><div><span style="white-space: pre;"> </span>input[i] = toMove;</div><div><span style="white-space: pre;"> </span>ptr++;</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>for(int i =0; i<input.length; i++ ) {</div><div><span style="white-space: pre;"> </span>System.out.print(input[i]);</div><div><span style="white-space: pre;"> </span>}</div><div><span style="white-space: pre;"> </span>}</div><div><br /></div><div>}</div></div><div><br /></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Ernakulam, Kerala, India9.9816358 76.2998842-18.328598036178846 41.143634199999994 38.291869636178845 111.4561342tag:blogger.com,1999:blog-3469354287090459305.post-36311349922951104012021-09-21T18:35:00.033+05:302021-09-21T18:35:00.211+05:30Firebase | Firestore | Firestore junit test | deep stubbing mockitoThis is a sample code how to perform deep stubbing mockito on firestore<div>you need to mock all the </div><div><br /><div><br /></div><div><div>public class FirestoreClientTest{</div><div><br /></div><div>@Mock</div><div>Firestore firestore;</div><div><br /></div><div>@Mock</div><div>DocumentReference documentReference;</div><div><br /></div><div>@Mock</div><div>CollectionReference collectionReference;</div><div><br /></div><div>@Mock</div><div>ApiFuture apiFuture;</div><div><br /></div><div>@Mock</div><div>QuerySnapshot querySnapshot;</div><div><br /></div><div>@Test</div><div>public void test(){</div><div>when(firestore.collection(any(String.class)).thenReturn(collectionReference);</div><div>when(collectionReference.document(any(String.class)).thenReturn(documentReference);</div><div>when(documentReference.get()).thenReturn(apiFuture);</div><div>when(apiFuture.get()).thenReturn(querySnapshot);</div><div><br /></div><div>UserInfo userInfo = firestore.getUserDetails();</div><div><br /></div><div>//Assert statements</div><div>}</div><div><br /></div><div>}</div></div></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Thrissur, Kerala, India10.5276416 76.2144349-17.782592236178843 41.0581849 38.837875436178848 111.3706849tag:blogger.com,1999:blog-3469354287090459305.post-42698115754301601262021-09-14T23:49:00.036+05:302021-09-14T23:49:00.186+05:30Google Firebase Firestore Spring boot Integration sample code1. Create a new Cloud Firestore database in your GCP project<div><br /></div><div>2. If you are authenticated in the Cloud SDK, your credentials will be automatically found by the Spring Boot Starter for Google Cloud Firestore.</div><div><br /></div><div><b>3. Pom dependency</b></div><div><br /></div><div><div><!-- https://mvnrepository.com/artifact/com.google.cloud/spring-cloud-gcp-starter --></div><div><dependency></div><div> <groupId>com.google.cloud</groupId></div><div> <artifactId>spring-cloud-gcp-starter</artifactId></div><div> <version>2.0.4</version></div><div></dependency></div></div><div><br /></div><div><div><!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-firestore --></div><div><dependency></div><div> <groupId>com.google.cloud</groupId></div><div> <artifactId>google-cloud-firestore</artifactId></div><div> <version>3.0.1</version></div><div></dependency></div></div><div><br /></div><div><br /></div><div><br /></div><div><b>4. Repository (writing data)</b></div><div><br /></div><div><div>@Autowired</div><div>Firestore firestore;</div><div><br /></div><div><span style="white-space: pre;"> </span>User data = new User("javabelazy",</div><div><span style="white-space: pre;"> </span>Arrays.asList(</div><div><span style="white-space: pre;"> </span>new Phone(12345, PhoneType.CELL),</div><div><span style="white-space: pre;"> </span>new Phone(54321, PhoneType.WORK)));</div><div><br /></div><div><span style="white-space: pre;"> </span>WriteResult writeResult = this.firestore.document("users/id").set(data).get();</div></div><div><br /></div><div><b>5. Application.properties</b></div><div><b><br /></b></div><div>spring.cloud.gcp.firestore.project-id =abcdefg</div><div><b><br /></b></div><div><b>6. Git URL</b></div><div><br /></div><div><a href="https://github.com/javabelazy/FlightBooking">https://github.com/javabelazy/FlightBooking</a></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0tag:blogger.com,1999:blog-3469354287090459305.post-3494995602152153272021-09-07T22:29:00.003+05:302021-09-07T22:29:00.227+05:30find word between two strings using regular expression in java<a href="https://github.com/javabelazy/ProgramingSkills/blob/bd3ad6517b7ae61803918da279b96712d2329b73/src/com/steffi/ideas/FindingSubstring.java">https://github.com/javabelazy/ProgramingSkills/blob/bd3ad6517b7ae61803918da279b96712d2329b73/src/com/steffi/ideas/FindingSubstring.java</a><div><br /></div><div><br /></div><div><br /></div><div><div><span style="font-size: medium;">Pattern p = Pattern.compile("(ID):\\s*(\\w+)");</span></div><div><span style="font-size: medium;">Matcher m = p.matcher(input);</span></div></div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0Innamincka SA 5731, Australia-27.7462176 140.7385808-42.333216198825831 123.1604558 -13.159219001174172 158.3167058tag:blogger.com,1999:blog-3469354287090459305.post-55712929681151051622021-08-28T01:00:00.041+05:302021-08-28T01:00:00.204+05:30Work inside a software firmHi friends<div><br /></div><div>I would like to share few things through this post, I have been worked in many software firms from product based company to service based company. Small firms to large firm, even MNC's. I feel like some small firms are good to work. </div><div><br /></div><div>As a contract employee in an MNC, Some manager behaves to us like we are slaves. They know our aim is to get a permanent job in that firm they will use this as opportunity and keep adding works to us. We were in such a situation we want to ask a small time break in public holidays as well.</div><div><br /></div><div>This covid situation has changed the way the work environment, most employees under the surverlience camera of managers, micromanagement or mental stress what ever we can call, some point these might me the reason for the most of the disease the employees are suffering now, they even intentially forget this work from home is due the pandemic situation, the HR team will keep silent.</div><div><br /></div><div>I saw peoples crying due to their sudden termination, I read newspaper posting news of IT peoples suicides. Some people simply quit this profession.</div><div><br /></div><div>In the coming post I will mention the company name as well as the managers.</div><div class="blogger-post-footer">http://javabelazy.blogspot.in/</div>Konzernitehttp://www.blogger.com/profile/02513263707704576485noreply@blogger.com0