Skip to main content

Posts

Showing posts from May, 2022

Different way to calculate prime number in c++

Three different ways to calculate the prime number in c++=> In this blog, we will see how to calculate given number is prime or not in o(N) time.  here we will see three different methods to check whether the given number is prime or not. Method 1=>  Run loop from 2 to n-1  we will run a loop from 2 to n-1 and if the number is divided by any number from 2 to n-1 we will return false that number is not a prime number otherwise we will return true. Time complexity => O(N) Method 2=> Run loop from 2 to n/2  we will run a loop from 2 to n/2 and if the number is divided by any number from 2 to n/2 we will return false that number is not a prime number otherwise we will return true. Time complexity => O(N/2) => O(N). This program will be faster than method 1 Method 3=>  Run a loop from 2 to root  √n   we will run a loop from 2 to  √n  and if the number is divided by any number from 2 to  √n   we will return false...

Reverse a number in c++ || C++ Program to Reverse a Number

 Reverse a number in c++ || C++ Program to Reverse a Number->    Write a program to reverse the digits of an integer. Input : num = 12345 Output: 54321 Input : num = 876 Output: 678 Algorithm: Input: num (1) Initialize rev_num = 0 (2) Loop while num > 0 (a) Multiply rev_num by 10 and add remainder of num divide by 10 to rev_num rev_num = rev_num*10 + num%10; (b) Divide num by 10 (3) Return rev_num

How to embed google form in your website ?

 How to embed Google form in your website ? Google Forms is a survey administration software included as part of the free, web-based Google Docs Editors suite offered by Google. The service also includes Google Docs, Google Sheets, Google Slides, Google Drawings, Google Sites, and Google Keep. Google Forms is only available as a web application. With Google Forms,  you can create and analyze surveys right in your mobile or web browser —no special software required. You get instant results as they come in. And, you can summarize survey results at a glance with charts and graphs. The benefit of using google form on your website - If your website is a static website and you don't want any server cost for your website you can use google form it will save your money and it is easy to implement as well. How to embed Google form in your website step by step- Go to Forms and open your form. Click Send. Next to Send via, click Embed  . Click the HTML and click ...

What are promises in JavaScript ?

 What are promises in JavaScript ? Promises  are used to handle asynchronous operations in JavaScript. They are easy to manage when dealing with multiple asynchronous operations where callbacks can create callback hell leading to unmanageable code.  A  Promise  is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action's eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a  promise  to supply the value at some point in the future. A  Promise  is in one of these states: pending : initial state, neither fulfilled nor rejected. fulfilled : meaning that the operation was completed successfully. rejected : meaning that the operation failed.  Why do we need Promises? JavaScript is a single-threaded language  because whi...

How to create rotating Image animation in css ? How to create 360 degree rotating Image animation in css ?

 How to create rotating Image animation in CSS ? How to create 360-degree rotating Image animation in CSS ? What are CSS Animations? An animation lets an element gradually change from one style to another. You can change as many CSS properties you want, as many times as you want. To use CSS animation, you must first specify some keyframes for the animation. Keyframes hold what styles the element will have at certain times. Solution- We will add the CSS command to the element we wish to rotate in this example. You can adjust the  2s  to slow or speed up the rotation duration and rotate to 360 degrees in animation.

Logback can't write in console ? logback.xml solution.

Problem :  I am using Logback in my spring boot application.  The problem is logback do not print my logger messages in 'eclipse' console ? Solution ;- just reread the logback config doku. Actually, those two should inherit both appenders from root. So, what you can try is to not specify any appender-ref on those and see what happens. If no output is written to the file then, neither - then there is something pretty strange. I'd expect that behavior if the additivity flag was set to false. But the default is appender accumulation <logger name= "package.web" level= "INFO" > <appender-ref ref= "FILE" /> </logger> You need to add the console appender. <appender name= "STDOUT" class= "ch.qos.logback.core.ConsoleAppender" > <!-- By default , encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder --> <encoder> <pattern...