JDK 15.0.2, 11.0.10, 8u281, and 7u291 Have Been Released!
The Java SE 15.0.2, 11.0.10, 8u281, and 7u291 update releases are now available. You can download the latest JDK releases from the Java SE Downloads page. OpenJDK 15.0.2 is available on http://jdk.java.net/15/. New Features, Changes, and Notable Bug Fixes For information about the new features, chan...
Receive Automated Email Notification on Website Update
Rate this post
Project Description
This project is a demonstration of a live project on Upwork. We will replicate the entire process using a different URL. We will check for changes in the website after every hour and if there are changes to its content, we will immediately send an automated email to notify that the website has changes in it. This means, whenever the content in the website gets modified it means that there will be changes in it and that is what we capture and then send the notification that there have been changes made to the website.
Here’s a quick look at the original project listed on Upwork –
The project can be roughly divided into two major sections –
Detecting if changes have occurred in the website.
Sending an automated email to notify that there have been changes made to a website.
Step 1: Detecting Changes in the Website
We will be following these steps to detect if there were changes in the website or not –
Read the given URL.
Hash the entire website.
Ensure that you wait for a few seconds and then check the next hash value returned.
If the next hash is different from the previous hash, then that means there have been changes made to the website.
1.1 Import the Necessary Libraries
We will need the help of certain libraries that will aid us in accomplishing our task. Hence, go ahead and import these libraries into your script.
import time
import hashlib
from urllib.request import urlopen, Request
import smtplib
import ssl
from email.message import EmailMessage
1.2 Detect Changes in Website
Once you have imported the necessary libraries, set up the given URL (https://news.ycombinator.com/) to monitor and send a GET request.
Create the hash of the response received using hashlib.sha224(response).hexdigest() and store it in a variable currentHash. This denotes the current hash value.
Now, use an infinite loop to keep checking the hash of the response received from the website and check the difference between the previous hash and the current hash to detect if any change has been made to the website or not. You can use a sleep time delay of 30 seconds or any duration as per the need. In case anything changes you can move on to step 2.
As soon as a change is detected, you can send an automated email to the recipient.
Import the necessary libraries to send the email (already done above).
Set the email sender and receiver.
Set the subject body of the email.
Add SSL
Login and send the email.
Code:
# Sending Email Notification
port = 465 # For SSL
smtp_server = "smtp.gmail.com"
sender_email = "work.demo.test.email@gmail.com" # Enter your address
receiver_email = "shubhamsayon@gmail.com" # Enter receiver address
password = 'xxxxxxx'
subject = 'Website Change Notification'
message = """
Subject: Hi there!
Changes have been applied to Website! """
em = EmailMessage()
em['From'] = sender_email
em['To'] = receiver_email
em['Subject'] = subject
em.set_content(message)
context = ssl.create_default_context() with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(sender_email, password) server.sendmail(sender_email, receiver_email, em.as_string())
Caution: You might get an error while sending the email. In the past, we could connect to Gmail easily using Python just by turning on the “Less secure app access” option. But that option is no longer available. Instead, what we have to do now is turn on 2-step verification and then retrieve a 16-character password provided by Google that can be used to log in to Gmail using Python.
To learn more about this, refer to the following article here.
Putting It All Together
Well! We have actually solved the given problem. All that remains to be done is to join the pieces together. So, here’s how the final code looks:
import time
import hashlib
from urllib.request import urlopen, Request
import smtplib
import ssl
from email.message import EmailMessage url = Request('https://news.ycombinator.com/', headers={'User-Agent': 'Mozilla/5.0'})
response = urlopen(url).read()
currentHash = hashlib.sha224(response).hexdigest()
print("running")
PrevVersion = ""
time.sleep(10)
while True: try: time.sleep(30) response = urlopen(url).read() newHash = hashlib.sha224(response).hexdigest() if newHash == currentHash: continue else: print("something changed") response = urlopen(url).read() currentHash = hashlib.sha224(response).hexdigest() time.sleep(30) # Sending Email Notification port = 465 # For SSL smtp_server = "smtp.gmail.com" sender_email = "work.demo.test.email@gmail.com" # Enter your address receiver_email = "shubhamsayon@gmail.com" # Enter receiver address password = 'xxxxxxxxx' subject = 'Website Change Notification' message = """ Subject: Hi there! Changes have been applied to Website! """ em = EmailMessage() em['From'] = sender_email em['To'] = receiver_email em['Subject'] = subject em.set_content(message) context = ssl.create_default_context() with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(sender_email, password) server.sendmail(sender_email, receiver_email, em.as_string()) continue except Exception as e: print(e)
Conclusion
Sending automated emails can be such a superpower, especially if you have to send daily emails of the same type while working. The added advantage of the technique that we learned in this article is how easily you can notify users about certain changes via emails. Not only did we learn how to send automated emails but we also saw how one could easily detect changes occurring in a website.
I hope this project added some value to your coding journey. Please subscribe and stay tuned for more interesting solutions and discussions in the future. Happy coding!
We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.
Homing magic spells aren't anything new for From Software games, and Elden Ring sports quite a few of them. One of them--Glintstone Stars--ranks among the best for tracking extremely fast targets, even if its FP cost is a bit on the high side. If you'd like to give it a try, read on to find out where you can buy it.
Glintstone Stars explained
Glinstone Stars is a sorcery that requires 12 Intelligence to cast. It creates three magical homing stars that chase down and damage foes. Due to the spell's rapid traveling speed, it makes a solid choice for homing attacks on fast-moving enemies.
Portal with RTX is a free DLC for all Portal owners developed by NVIDIA Lightspeed Studios. Experience the critically acclaimed and award-winning Portal™ reimagined with ray tracing. Every frame of gameplay is upgraded with stunning full ray tracing, new, hand-crafted hi-res physically based textures, and new, enhanced high-poly models evocative of the originals, all in stunning 4K. In Portal with RTX, full ray tracing transforms each level, enabling light to bounce and be affected by the scene’s geometry and materials. Every light is ray-traced and casts shadows, global illumination indirect lighting naturally illuminates and darkens rooms, volumetric ray-traced lighting scatters through fog and smoke, and shadows are pixel perfect. Portal with RTX is compatible with all ray-tracing capable GPUs.
The Advanced Management Console (AMC) 2.20 release has arrived!
AMC 2.20 offers system administrators greater and easier control in managing Java version compatibility and security updates for desktops within their enterprise and for Independent Software Vendors (ISVs) with Java-based applications and solutions. The highlight of this release is the Containerized...
Posted by: xSicKxBot - 12-23-2022, 01:48 AM - Forum: Python
- No Replies
No More Worrying About High Blood Pressure! 8 Simple Tips for Coders
5/5 – (1 vote)
Roughly one in eight people dies because of high blood pressure.
High blood pressure is quite common in my family, so I decided to do some research. This quick tutorial shares what I’ve learned — feel free to read on if you’re interested.
What are the pillars of reducing blood pressure and increasing healthspan?
As coders, we may not always be known for leading a healthy lifestyle, but the fact is that nearly half of adults in the US suffer from high blood pressure. Billions of dollars are spent on pills to alleviate this problem, but what if we emphasize lifestyle changes instead?
I’m a firm believer that lifestyle changes are the key to a healthier future – and this is something I’ve experienced firsthand.
Here are eight major lifestyle changes to live healthier and longer (statistically speaking):
#1 – Exercise regularly
Regular exercise helps to keep your blood pressure in check. Aim for at least 30 minutes of moderate exercise five times a week.
Establishing a successful fitness routine requires dedication and effort, but it can be an incredibly rewarding endeavor!
Setting achievable goals and making an exercise plan that fits into your lifestyle is a great place to start. Incorporating fun into your workouts by adding music or doing a group workout can make them even more enjoyable.
Finding an accountability partner to keep you motivated and making sure to get enough rest are also essential.
Tracking your progress and rewarding yourself for achieving your goals will help keep you motivated, and don’t forget to keep your routine varied – it’s ok to miss a workout or not see results right away. With enough consistency, you will achieve your fitness goals.
#2 – Monitor your salt intake
Eating too much salt can increase your blood pressure. Limit your intake to no more than 2,300 milligrams (mg) of sodium a day.
Limit salt intake to increase health and reduce the risk of heart disease, stroke, and high blood pressure. Read nutrition labels, reduce processed foods, and use herbs and spices instead of salt. Fresh or frozen vegetables and fruits, no extra salt.
#3 – Eat a healthy diet
Eating a diet rich in fruits and vegetables, low-fat dairy products, and whole grains can help to lower your blood pressure.
If you’re ready to take your lifestyle to the next level and make positive changes that last, start by incorporating more nutritious foods into your diet, like fruits and veggies, lean proteins, and whole grains.
Limit processed foods, sugar, salt, and saturated fat, and make sure to drink plenty of water.
Don’t forget to make time for breakfast, get enough rest, manage stress, and eat smaller portions. Be mindful of the food choices you make and don’t forget to get regular exercise!
With these simple changes, you can create a healthier lifestyle and make it stick.
#4 – Reduce stress
Stress can cause your blood pressure to rise. Take time to relax and practice stress-relieving activities such as yoga or meditation.
Finding time for yourself is a great way to reduce stress. Give yourself even a few minutes of rest and relaxation each day to help keep your stress levels under control.
Deep breaths, calming music, and activities you love can all help you feel more relaxed.
Spending time with friends and family and getting enough sleep can also be a great way to destress.
#5 – Limit alcohol consumption
Drinking too much alcohol can increase your blood pressure. The American Heart Association recommends drinking no more than two drinks a day for men and one drink a day for women.
To help ensure you stay in control and enjoy yourself, set a limit for yourself before you start drinking and stick to it.
Have a nutritious meal with healthy fats and proteins before you start drinking, as this will help slow the absorption of alcohol. As you are drinking, alternate your alcoholic beverages with water and avoid drinking games and any situations that may lead to excessive drinking.
Before you go out, plan ahead and make sure you have a designated driver or enough money for a cab so you can get home safely.
And finally, make sure the people you are with are not drinking heavily, as this could also lead to excessive drinking.
I used to drink a lot of alcohol, multiple times per week.
The game-changer for me was to escape from my previous toxic environment where alcohol was ubiquitous. It’s super hard to reduce alcohol consumption if all your friends drink a lot. But it’s easy to do it if your environment is more healthy and positive.
#6 – Lose weight
If you are overweight, losing weight can help to lower your blood pressure.
How to lose weight?
Start by making small changes to your diet and lifestyle.
Eat smaller portions and focus on eating whole, unprocessed foods.
Incorporate more fruits, vegetables, lean proteins, and healthy fats into your diet.
Avoid sugary drinks and processed snacks.
Exercise regularly, even if it’s just a short walk every day.
Try to find an activity you enjoy and make it part of your routine.
Get enough sleep and practice relaxation techniques such as yoga or meditation.
Lastly, stay motivated and track your progress.
For me, the game-changing tip was to keep a food diary and note how my body responds to the changes I was making.
Dedication and consistency can make a lasting impact on your health and weight.
#7 – Quit smoking
Smoking increases your risk of developing high blood pressure. Quitting can help to reduce your risk.
If you want to quit smoking, why not plan it out and take it one step at a time?
Set a quit date and let your loved ones know about your decision. To avoid temptations, stay away from places and situations that might trigger cravings.
To replace your smoking habit, why not try engaging in healthier activities such as exercise, reading, or simply getting some fresh air?
Talk to your doctor to find out what medications, if any, and other resources you can access to help you quit.
Finally, don’t forget to reward yourself for all your hard work and dedication – this will help you stay motivated!
Last but not least, here’s a bonus tip — that’s a bit tougher to implement for many people.
#8 – Bonus – Eat vegan/vegetarian
I found in too many research papers to count that vegans have a significantly reduced risk of high blood pressure. I’m not a (medical) doctor but there’s a lot of scientific evidence.
Here’s an example excerpt from one of the research papers:
“Nevertheless, the investigators found that vegans and lacto-ovo vegetarians had significantly lower systolic and diastolic blood pressure, and significantly lower odds of hypertension (0.37 and 0.57, respectively), when compared to non-vegetarians. Furthermore, the vegan group, as compared to lacto-ovo vegetarians, not only was taking fewer antihypertensive medications but, after adjustment for body mass index, also had lower blood pressure readings.”
Many additional studies show similar results — proving a higher life expectancy and health span of vegetarians.
Eating a plant-based diet is a delicious and nutritious way to keep your body healthy and fuel your mind.
You can fill your plate with various proteins like beans, lentils, nuts, tofu, and seitan and explore cuisines worldwide with vegetarian-friendly dishes.
Also, make sure to include colorful fruits and vegetables, as well as whole grains and fortified non-dairy milk and cereals for essential vitamins and minerals.
Enhance the flavor of your meals with herbs, spices, and sauces and you’ll have a delicious and nutritious plate of food.
What Now?
Unlike pills, implementing these tips doesn’t have negative side effects. But they’re as effective in reducing blood pressure.
They also save money (smoking and excessive eating are expensive!) and boost productivity at work. They lead to higher life satisfaction and a more relaxed lifestyle. And they reduce the risk of dying of other deadly diseases like cancer.
I’m convinced. I aim to implement all these eight tips – especially #4, which is my bottleneck.
I hope you find useful hints for your life in that list! Thanks for reading, my friend.
To grab the game for free: - Go to the store page of LEGO Builder's Journey - LEGO Builder's Journey Store Page https://store.epicgames.com/en-US/p/lego-builders-journey - Click on the GET Button - Verify that the price is zero - Click on the Place Order Button - That's it, the game will be added to you Epic Games Account
We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.
Posted by: xSicKxBot - 12-23-2022, 01:47 AM - Forum: Lounge
- No Replies
James Cameron Is Thinking About Relaunching The Terminator Franchise
The Terminator has been relaunched what feels like T-1000 times. But that's not stopping discussions from happening for another installment, according to director James Cameron. He hasn't helmed an entry since Terminator 2: Judgment Day, though he did produce as well as develop the story for Terminator: Dark Fate.
Speaking on the Smartless podcast (via The Playlist), Cameron conversed about themes and messaging in his movies. "Well, the Avatar films are about the environment; I’m not dealing with AI," he said. "If I were to do another Terminator film and maybe try and to launch that franchise again--which is in discussion, but nothing has been decided--I would make it much more about the AI side of it than bad robots gone crazy."
IXION combines city building, survival elements and exploration, into a thrilling space opera as you explore the stars. Propelled onwards through a perilous journey, you are the Administrator of the Tiqqun space station, charged with finding a new home for humanity.
Keeping the station sound and flying will require a deft hand and strategic thinking, as you are constantly pulled between maintaining hull integrity, bringing in new resources and managing power consumption.
What choices will you make when confronted with impending disaster? What will you discover out there in the dark?