Did you try to run a Deno web server code but came across an error that read: “error: Uncaught PermissionDenied: network access to “127.0.0.1:8000”, run again with the –allow-net flag” ?

If yes, then do not worry. Because you are not alone? Even I got excited to run a Deno example web server code but encountered the same error message.

So what is the solution here? How do we go about fixing this?

Well luckily, a solution to this problem is quite easy. Because here is what is happening!

Error: Uncaught PermissionDenied: network access to “127.0.0.1:8000” – How To Fix It?

So here is the thing. Deno has security features built into it. So when you try to run a piece of Deno code that uses network, it needs to be run with network permission. Otherwise, you get the above error message!

That is all that is happening here. So we tried to run an example Deno web server application that looked like this:

So as you can see from the above Deno code, we are making use of a server module called serve. But this sever code is not on our local computer. So we have imported it from a github repository:

"https://deno.land/std@0.50.0/http/server.ts"

But after downloading it, when we tried to run the code using the command:

deno run server.ts

this is what is happening:

It triggered the serve module to run at port 8000.

However, there is a problem here. So as you see, we have just run the server.ts file as is. That is, we did not issue any explicit permission attached to it. So what happens in that case is that the Deno code tried to run without any extra permissions.

But by default, Deno code does not have permission to access network stuff. So, it just threw the above error!

Solution

So what is the solution then? Well, we just need to give network access to this program and it should start working! Right? So what is the command to do that? Here it is:

deno run --allow-net server.ts

So we just attached extra permission before running this Deno code. This will allow our program to use the port 8000 for accessing the server from a browser.

So when we run the above command, we get the output:

http://localhost:8000/

And when we access the above url, we can see that the server has rendered the text ‘Hello World’ to the browser.

So that is it! That is all we had to do to fix this Deno network program. Hope it was clear and easy for you!

If you still have any questions, do let me know in the comment section below!

In this article, we see how to fix the error : “pytesseract.pytesseract.tesseractnotfounderror: tesseract is not installed or it’s not in your path“.

So are you trying to use the Tesseract tool to do OCR using Python? But some how end up with this error? If yes, then this article will help you in fixing this error.

But before I explain you on how to fix it, here is what we will do. Let me explain you about what is happening here in the first place. Alright? Because if you know what is happening, you will be able to fix similar errors in future as well.

It is not just sufficient to know how to fix a problem. But to know why it happened in the first place. Right? So we will do just that.

What Does The Error Mean?

So let us take a look at the error once again, shall we? Here is what the error looks like:

pytesseract.pytesseract.tesseractnotfounderror: tesseract is not installed or it's not in your path

Does that error message makes any sense to you? No? Actually it does. But only if you know more about how Python’s PyTesseract library.

You see, PyTesseract library is a Python wrapper that makes use of the Tessseract application installed on your computer. So for the PyTesseract library to work, it needs to hook in to the Tesseract app first. But to do that, it needs to know where to find it. Right?

So how does the PyTesseract library know where to find it? Well that is where the OS PATH variables come into picture.

The Python library looks for an OS PATH variable called tesseract. So it is in this variable does it expect to find the path to the Tesseract app.

But when the library cannot find this PATH variable, or the Tesseract app, it will throw the error:

pytesseract.pytesseract.tesseractnotfounderror: tesseract is not installed or it's not in your path

So now that you know the root cause, what is the solution?

How To Fix pytesseract.pytesseract.tesseractnotfounderror?

To fix this problem, you have to follow these few simple steps:

Make sure that Tesseract application is installed.

Make sure that the OS PATH variable tesseract is set to point to the above application file.

So if you are on Windows, the tesseract PATH variable will have a value something like this: C:\Program Files (x86)\Tesseract-OCR\tesseract.exe. To find this out, type the below command:

echo $tesseract

But if you are on Mac or Linux (eg: Ubuntu), it will look like this: /usr/local/bin/tesseract. To find this out, type the below command:

echo $tesseract

So that is it! That is how you fix the tesseractnotfounderror error on your Python program.

Hope this helps. Do let me know if you have any questions and I will be happy to answer. See you in the next article. Cheers!

So this is a programming quiz question where we need to find what value in a loop can be either a positive or a negative number.

The quiz question goes like this:

A __ value in a loop can be either a positive or a negative number?

To answer this question, we need to think a little bit about how a programming loop works.

Loop Example

So to do that, let us take an example of a for loop. Now, the syntax of a for loop looks something like this:

for (i=0; i < 10; i++) {
//do something
}

So if we look at the above for loop, we can see that it has one variable i. But it is being used in 3 different places, right?

But why?

So for a for loop to execute, we need to have 3 things to it. First, we need an initial value from which the loop begins. In this case, it is done by the code: i = 0;

Next, we need to set a condition. So as long as this condition is true, we will loop. So in this case, we have it set as i < 10. Which means that this loop will run as long as the value of i is less than 10.

But the final part of the for loop is where we change the value of the variable i. So we have it set to i++. But what does it mean?

It means that we want the loop the increase the value of i after every loop is run.

So in all, we this is what we are asking the code to do. We want you to run for as long as the value of i is less than 10. And we start the loop with an initial value of i=0 and let it run until it becomes equal to 10. But as soon as i reaches 10, we want the loop to end!

So if we look at the for loop, it is something like this:

We want it to run as long as a condition is true. And that condition here is set as i to be less than 10. So as long as this condition is met, this code will loop.

Answer

So this begs us the question then. What are these type of values called? They are called “step” values.

So to answer our question:

A step value in a loop can be either a positive or a negative number?

So you as a web developer want to have your user be able to add a variable to the URL of his post. But you do not know how to do that? Well do not worry. Because in this tutorial, we will teach you how to do just that!

Now this article is going to get a bit more technical. So I want you guys to be with me all the way through the article, alright? Great! Then it is about time for us to start. Let us go!

Add a variable to URL of Ajax – The Problem

So what is the problem we are looking at over here? Well, it is actually quite simple. We want to be able to add a variable value to the url parameter of the Ajax call.

So we are talking about a piece of code that looks something like this:

let var myQuery = "What Is My IP?";
$.ajax({url: "https://google.com/search?q=" + myQuery, method: 'POST', contentType: false, cache: false, processData: false,
success: function(result){
$("#div1").html(result);
}});

So, as you can see from the above code, we are trying to pass in the search query “What Is My IP?” by trying to Add a variable to URL.

And in this case, we have our query stored in a Javascript variable myQuery. So by adding this variable to our Ajax url parameter, we should be able to issue a POST request to Google.

But this is all well and good, but what is the use of this? Why are we even using Ajax call for doing this in the first place? Since we could have just used simple Javascript for a URL query, right?

So to answer this question, we need to know what an Ajax call does.

So we can use simple Javascript code to make an url call. But the problem with that is, the call will be blocking. So our Javascript code will not continue to run until we get back a response from the server.

But on the other hand, using Ajax ensures us that we can make asynchronous requests for the web query. So thereby, our remaining Javascript code will continue to run while we are waiting for the ajax url code’s response.

And by using a Javascript variable like “myQuery” above, we can allow users to add a variable to url to our Jquery ajax request.

Conclusion

So there you have it. It is quite simple to add in a variable to Ajax calls. And I hope that this article helped you learning how to do it.

But if have any more queries about it, do let me know in the comments below. Because I will be more than happy to help you out!

Want to learn about Typescript? Take a look at this article

So with that, I will end this article. See you guys until next time. Cheers!

In this article, we will learn how to do type conversion in Typescript. So are you working on Typescript and now want to convert a value from string to number? Or want to convert a number to string in Typescript? Well, then read through this article to learn how to do that!

So here is the thing. You have a Typescript value stored in a variable and you want to use that. But the thing is that, you can not use it as is. Why? Because this number is stored as a string type. But you want to use it as a number. So how can we do that?

That is when the Typescript type conversion comes to your rescue! Using the Typescript type conversion, you can turn that variable’s value from a string to a number!

Sounds great! Right? But then how do we do that in our code? To learn that, take a look at the example code given below:

Example Of Type Conversion from a String to Number

let myStringOfNum: string = "10";
let myNumber: number = Number(myStringOfNum);
console.log(typeof myStringOfNum);
console.log(typeof myNumber);

So if you look at the above code, we have a variable called myStringOfNum that holds a string that reads “10”. But we want that string to be used as a number. So what do we do for that? We use Type Conversions!

So in Line 2, we declared another variable called myNumber. But this time, this variable is of type number. What we do next is that we will take the value of the vairable myStringOfNum and convert its type to Number. We do that by using the typecast Number(). The resulting value is then assigned to our variable myNumber.

So in that case, our console output will look like this:

string
number

Example Of Type Conversion from a Number to String

In a similar way, we can convert a number to string in Typescript. So when we take a look at this code:

let myNumber: number = 10
let myString: string = String(number)
console.log(typeof myNumber);
console.log(typeof myString);

What do you think how to output will look like? I think your guess will be:

number
string

Summary

So in summary, we can convert a number to string or a string to number using Typescript’s Type conversion feature. I guess it could not have been any more simpler than this. What do you guys think? It is, Right?

Here is a list of Math Worksheets in Printable format. Since they are free, you can download these maths worksheets and print it out. So now you can use them to test your kids on their math skills.

But before we show you these printable math worksheets, let me tell you how to make use of it. Sound good? Great! Then let us start on that!

Who can use these printable Math Worksheets?

So before we look into the worksheets, we need to first know who can make use of it. After all, looking at a math worksheet that is not meant for you is a time waste. Isn’t it? So we need to first be clear on who can use it.

You see, we are going to give you many of these worksheets for you to download. So, there is no one answer for this question.

Because, each of these worksheets test your math skills at different levels. So then, how will you know which is the one for you?

Well, that is a good question! So that is why we will be giving different set of worksheets for different grade of students.

So in other words, we will give you these math worksheets divided into different groups. Where each group is useful for different student grades.

Wait a second! But what does that mean?

Well it means that we have printable math worksheets for class 2, 3, 4, 5 all the way up to grade 9! Sounds good, then. Right? ðŸ˜‰

Alright then. If that made sense to you. Let us start to look at each of these maths worksheets. Shall we?

Printable Math Worksheet For 2nd Grade

So we will start with a math worksheet that we have made for a 2nd grade student. Here is how it looks like:

So here is our first math worksheet for 2nd grade kids. How do you think of it? Did you like it? Well, I know that it is quite simple. But that is part of the reason why it is best math worksheet for 2nd grade kids.

Why this math worksheet for a 2nd grade kid

Because, all they have to do is add two numbers in the given worksheet and enter their answers. Now that is something that a 2nd grade kid can do, right?

So you see, the idea here is to give you a maths worksheet that you can download and hand it over to your kid. But your kid should also find it easy to answer. Because you cant over burden them at the early stages. Right?

So this was our first math worksheet we had for you. You can download then for free and give a printed version of this worksheet to your kid.

In the next set of articles, we will give you some more math worksheets for other grade students. But that is for later date. So if you like this worksheet, do share it with your friends and colleagues.

We want every student out there to be good at math. But to do that, we need to first give them a good basic foundation. So this set of math worksheets are designed to do just that.

By using these worksheets, your students should get comfortable with math. And not see it as something to avoid! So if we are able to reach there, we can say we have hit the right nail!

Rewrite each expression without absolute value bars: a. âˆ£1 âˆ’ âˆš2âˆ£ b. âˆ£Ï€ âˆ’ 3âˆ£ c. âˆ£xâˆ£/x

So this is a problem we have taken from the book Precalculus Essentials5th Edition written by Robert F. Blitzer.

Are you not able to find it in the book? Well do not worry! Just go to the Pre-requisites chapter P part of the book and look for problem Check Point 6. It is in page 10 of the book.

So with that said, let us now try to solve this problem. But how do we do that?

The answer is to break down the problem into smaller parts. To do that, let us re-read the problem statement once again.

Rewrite each expression without absolute value bars:

So what is it asking us to do? It is asking us to find the value of each of the expressions, right? But there is a condition to be met. It wants us to find the value without using the absolute value bars.

So what does it mean?

It means that we need to get rid of the absolute value represented by the | | symbol. But how do we do that? To know more about it, let us first learn what an absolute value is. Alright?

What is an Absolute value?

When we try to solve any expression, we get an output value, right? But here is the thing. This output value can be either positive or negative. Still not clear? Well then, take a look at this example:

y = x + 3

Now, in the above expression, the value of y can be both positive or negative, right?

So if the value of x is 6, we get y = 9. But on the other hand, if x = -4, we get y = -1.

So as you can see from above, the final value of y can be positive or negative. It depends on the value of x.

Are you clear up to this point? Great!

So what do we do in case of an absolute value? Well if we want to find the absolute value of y, we will drop the sign symbol. So in that case, when x=-4, y=1!

So we represent absolute value of this equation using the formula:

y = | x + 3 |

So whenever you see the symbol | |, it means we are taking the absolute value of it where we drop the -ve sign.

In other words, you can also say that an absolute value is always +ve.

So now that we have learnt what an absolute value is, let us answer our actual question.

Rewrite each expression without absolute value bars

So let us start solving this question one by one. Let us take a look at the first problem:

a. âˆ£1 âˆ’ âˆš2âˆ£

a. âˆ£1 âˆ’ âˆš2âˆ£

So let us first break down the problem first. To begin with, we will drop the absolute value bars.

So the problem simply becomes: 1 âˆ’ âˆš2

But we know that the value of âˆš2 = 1.4142

So what will be the value for (1 – 1.4142) ?

Yes, 1 – 1.4142 = -0.4142

So as you can see, we have a negative valued result. So the final answer will be:

Answer: 1 âˆ’ âˆš2 = -0.4142

In similar ways, we can now rewrite each expression without absolute value bars as shown below:

b. Rewrite each expression for âˆ£Ï€ âˆ’ 3âˆ£

So the expression here is

âˆ£Ï€ âˆ’ 3âˆ£

which without absolute value becomes equal to:

Ï€ âˆ’ 3

Now we know the value of Ï€ = 3.1415

So the resulting answer will be:

Answer: 3.1415 – 3 = 0.1415

c. âˆ£xâˆ£/x

So now coming to the final question, the answer is straight forward:

Ansswer: x/x = 1

Looking to solve an Engineering problem? Check this out!

In this article, we will take a look at the BMI calculator for men. So, using this calculator, you will be able to check your Body Mass Index. But it wont stop just at that. Because this BMI tool will also tell you if you are over weight, under weight or at the normal weight.

BMI Calculator for Men

Calculate your BMI by entering your body weight and body height in the fields given below:

Enter Your Weight (in Kg): Enter Your Height(in cm):

So how is knowing your Body Mass Index value going to help you? Well, it is quite simple. You see, the BMI tool gives out BMI value for your body. So using this BMI value, you can check if you are at the right body weight for your age and height.

Now if you are in the normal BMI range, then all is well and good. But in case you are not, then it will tell you if you are under the normal body weight or over the normal weight.

So knowing if you are under weight or over weight will help you in figuring out what you should eat.

Wait what? How is that?

Yes, you read that right. Because if your BMI is not in the normal weight range, then you need to change your eating habits. Or in other words, you need to change your diet.

But why? Well, it is because if you are under weight, you will need to eat more food that is rich in calories. But on the other hand if you are under weight, you need to eat food with fewer calories.

That makes sense right? So that is why we will use the BMI Calculator for Men to find out what you should be doing about what you eat.

But before we go ahead using the BMI calculator for men, we should first know what is it, right? So we will start from there!

What Is Body Mass Index (BMI)?

Body Mass Index or BMI is a value that we get by dividing our body weight by the square of our body height. So in other words, we can calculate BMI using the formula:

BMI = (Body Weight in kg) / (Body Height in meters)Â²

So what doe this equation of BMI index mean? What is it doing logically?

What does a BMI calculate?

So as you can see above, we are using two values of our body to calculate our BMI. We take the body weight in Kilograms and divide it by the square of our body height given in meters.

So what does that mean? What do you think we are calculating here?

Logical Explanation Of BMI Calculator For Men

Well, in simple terms, we are just trying to see how much of a body mass we have per square meter, isn’t it. So in a way, we are trying to calculate the mass occupied by our body in a given square meter area!

It is as simple as that!

How Is BMI Calculator For Men Useful?

So now that we know how to calculate the BMI for men, we need to ask the next question. How is BMI going to be useful for us?

So here is thing. If you are a healthy man, you will be physically fit. Which in turn means that your physical appearance will also be good, right. So what tells us that? Well, for the most cases it is going to be your height and weight.

Makes sense, right?

Well think about it. If you are physically active, you will be burning most of the calories that you eat in any given day. Right? Which means that your body will have less body fat stored and well built muscles as you do more activities. Right?

So in that case, there will be a specific body weight for your body height which will be considered ideal. Correct? So that is exactly what BMI for men is giving us!

Bod Mass Index Range

BMI Range

Now that we what a BMI is,it is time to learn about the BMI range. So we calculated the BMI value. That is all well and good. But what does the value even mean? How will we know if we are over weight, healthy weigh tor under weight?

That is exactly when the BMI range comes into picture. The easiest way for us to understand it is to take a look at it below:

BMI Range Table

BMI Range

Weight Status Category

Below 18.5

Underweight

18.5 to 24.9

Healthy Weight

25 to 29.9

Overweight

30 or above

Obese

So as you can see from the above BMI Range table, we are underweight if our BMI turns out to be below 18.5

But if our BMI calculator outputs a value between 18.5 to 24.9, then we are at our healthy weight!

On the other hand, if our BMI is between 25 to 29.9, we are considered overweight.

But if our BMI is more than 30, we are considered as obese.

Pretty handy way to find it out then. Yeah? ðŸ˜‰

So what ever value we get, at the end of the day, we will get to know if we are healthy or not. Now that is all that really matters, eh?

Conclusion

So there you have it. This is why you need to use the BMI calculator for men app given above to check your BMI. But if you still have any thing to ask, do let us know in the comment section below. We will be more than happy to answer you!

So with that said, we will end this article over here. Hope you were able to check your BMI value and learnt to take the right action from now on.

If you want to stay healthy, make sure you keep your body weight under control. If you need some more ideas about it, do read this blog for more. Hope you have a great healthy life ahead! Cheers guys!

A 600-W TV receiver is turned on for 4 h with nobody watching it. If electricity costs 10 cents/kWh, how much money is wasted?

So this is a problem that we have taken from the book Fundamentals Of Electrical Circuits By Alexander. But if you want to take a look at the problem yourself, then go to Chapter 1 question 1.39 of the book.

Since this is a problem we have taken from the Chapter 1 – Basic Concepts, it should be easy. But is that right? Well, let us see as we try to solve it, shall we?

So how do we go about solving this problem?

Well as we always do, we will first break the problem into small parts. By doing that, we will be in a better position to understand the problem in the first place. Right?

So, here is our breakdown of the problem.

The Problem Breakdown

So let us read out the problem once again, line by line. Alright?

Now the first line of the question reads – “A 600-W TV receiver is turned on for 4 h with nobody watching it.”

So what do we learn from that? It means that we have a TV which consumes electricity at 600 Watts Per Hour or 600 Watt/Hr. But we can also write this as 0.6 Kilo Watts Per Hour or 0.6KW/Hr, right? So that means:

P = 0.6 KW/Hour

Ok! So with that being clear, we will move on to our next part of the question which reads – “If electricity costs 10 cents/kWh, how much money is wasted?”

From this sentence, we now know that the cost of 1 KW of Power consumption for every hour is 10 cents.

Electricity Price = 10c/KW

So the question after that then becomes quite simple, isn’t it? It is just asking us to find out what will be the electricity bill for running that A 600-W TV receiver for 4 hours.

A 600-W TV receiver Electricity Cost In 4 Hours?

So solving this now becomes a simple equation:

Total Bill = Power Consumed By TV in 4 hours * Elec. Price

So then what is the total Power consumed by the TV in 4 hours? It is simple right? If the TV consumes 0.6KW in 1 hour, then the amount of Power it consumes in 4 hours is:

Power consumed in 4 hours = 0.6KW * 4 = 2.4KW

So it is now clear right? The TV has consumed 2.4KW in 4 hours. So then what will be the electricity price for this much of power?

Which one of the following is not a social networking website? (a) Twitter (b)Facebook (c)My Space (d)Hotmailâ€‹

So in this article we will try to find out which one of those websites are not a social networking site.

But before we do that, we first need to understand what a social media website is. Right? So let us start from that point.

What Is A Social Media Website?

So there are many ways to answer this question. One is to explain it using take a text book definition of it which says:

Any website that allows people to create & share content to allow them for social networking.

But the problem is, it is not so clear in what it really means. Correct? So we can’t just go by it. Then what can we do about it? Well, let me explain you in a much simpler way. Alright? So here is my way of explaining it.

Any website using which we can create content & post it for the world to see while having a way to talk to others in real time is a social networking website.

What is not a social networking website?

It is not a social networking website if you cannot make your own post public and talk to them at the same time.

Does that make sense?

Answer With Explanation

Well then with that in our mind, let us look at each of the options given in the question. Alright? Here we go!

Twitter – Is this a social networking website? So answer the questions asked above to find out. (i) Can you post on Twitter? Answer: Yes. (ii) Can you talk to others in real time? Answer: Yes. So as you can see, the answers for both the questions is Yes. So that means it is indeed a social networking website!

Facebook – Is this a social networking website? So answer the questions asked above to find out. (i) Can you post publicly on Facebook? Answer: Yes. (ii) Can you talk to others in real time? Answer: Yes. So then this too should a social network!

Myspace – Again, ask the same questions. (i) Can you post publicly on Myspace? Answer: Yes. (ii) Can you talk to others in real time? Answer: Yes. So that means it is indeed a social networking website!

Hotmail – (i) Can you post publicly on Myspace? Answer: No. (ii) Can you talk to others in real time? Answer: Yes. So as you can see here, we cannot post publicly on Hotmail. Which means it is not one!

So from this analysis, we can see that theanswer we should be picking up amount the given choices is (d)Hotmail.

What we can learn from here is that if we try to break down the problem into smaller parts, it is easier to answer. Correct? So as you can see, we went through each of the options in the question and tried to answer them. It is only then that we were able to answer it. Right?