bluehost

Tuesday, 10 October 2023

React vs Angular; Front-End Web Development

Angular and React are two of the most popular Javascript tools for front-end development.

React
is a Javascript created by Meta. It was first released in May 2013. It is maintained by a community of developers and corporations. React allows large web applications that can change over time without loading it. It's best known for speed, simplicity, and scalability.

Angular is a Typescript framework for single-page applications(SPA). It is led by Angular a team at Google and a community of individuals and corporations. It was released in 2016 by the same team that built Angular JS which was released in 2010.

Key differences between Angular and React.
1. React is a library while Angular is a complete framework. 
2. React uses Javascript while Angular uses Typescript.
3. React is faster and smaller than Angular.
4. React has a lower learning curve than Angular
5. Angular is used by Google, Microsoft,  Forbes, Payapl, and Upwork.
6. React is used by Meta, Netflix, Uber, Airbnb, and The New York Times.


Sunday, 1 October 2023

Creating Analogo Clock Using Python

photo screenshot analogo  clock


import tkinter as tk
import time
import math
 
WIDTH = 400
HEIGHT = 400
 
root = tk.Tk()
root.title("Analog Clock")
canvas = tk.Canvas(root, width=WIDTH, height=HEIGHT, bg="white")
canvas.pack()
 
def update_clock():
    canvas.delete("all")
    now = time.localtime()
    hour = now.tm_hour % 12
    minute = now.tm_min
    second = now.tm_sec
 
    # Draw clock face
    canvas.create_oval(2, 2, WIDTH, HEIGHT, outline="black", width=2)
 
    # Draw hour numbers
    for i in range(12):
        angle = i * math.pi/6 - math.pi/2
        x = WIDTH/2 + 0.7 * WIDTH/2 * math.cos(angle)
        y = HEIGHT/2 + 0.7 * WIDTH/2 * math.sin(angle)
        if i == 0:
            canvas.create_text(x, y-10, text=str(i+12), font=("Helvetica", 12))
        else:
            canvas.create_text(x, y, text=str(i), font=("Helvetica", 12))
 
    # Draw minute lines
    for i in range(60):
        angle = i * math.pi/30 - math.pi/2
        x1 = WIDTH/2 + 0.8 * WIDTH/2 * math.cos(angle)
        y1 = HEIGHT/2 + 0.8 * HEIGHT/2 * math.sin(angle)
        x2 = WIDTH/2 + 0.9 * WIDTH/2 * math.cos(angle)
        y2 = HEIGHT/2 + 0.9 * HEIGHT/2 * math.sin(angle)
        if i % 5 == 0:
            canvas.create_line(x1, y1, x2, y2, fill="black", width=3)
        else:
            canvas.create_line(x1, y1, x2, y2, fill="black", width=1)
 
    # Draw hour hand
    hour_angle = (hour + minute/60) * math.pi/6 - math.pi/2
    hour_x = WIDTH/2 + 0.5 * WIDTH/2 * math.cos(hour_angle)
    hour_y = HEIGHT/2 + 0.5 * HEIGHT/2 * math.sin(hour_angle)
    canvas.create_line(WIDTH/2, HEIGHT/2, hour_x, hour_y, fill="black", width=6)
 
    # Draw minute hand
    minute_angle = (minute + second/60) * math.pi/30 - math.pi/2
    minute_x = WIDTH/2 + 0.7 * WIDTH/2 * math.cos(minute_angle)
    minute_y = HEIGHT/2 + 0.7 * HEIGHT/2 * math.sin(minute_angle)
    canvas.create_line(WIDTH/2, HEIGHT/2, minute_x, minute_y, fill="black", width=4)
 
    # Draw second hand
    second_angle = second * math.pi/30 - math.pi/2
    second_x = WIDTH/2 + 0.6 * WIDTH/2 * math.cos(second_angle)
    second_y = HEIGHT/2 + 0.6 * WIDTH/2 * math.sin(second_angle)
    canvas.create_line(WIDTH/2, HEIGHT/2, second_x, second_y, fill="red", width=2)
 
    canvas.after(1000, update_clock)
 
update_clock()
root.mainloop()

Saturday, 30 September 2023

Creating An Alarm Clock Using Python

 This code uses the datetime module to get the current time and the input() function to get the desired alarm time from the user. The while loop continuously checks if the current time matches the alarm time. If it does, then it raises an alarm by printing “Alarm Raised” and exits the loop. Otherwise, it prints “Alarm Not Raised” and exits the loop.

import datetime

print(datetime.datetime.today().strftime("%H"))
print(datetime.datetime.today().strftime("%M"))

hour = int(input("Enter an hour: 15"))
minute = int(input("Enter a minute:53 "))

while True:
    if hour == int(datetime.datetime.today().strftime("%H")) and minute == int(datetime.datetime.today().strftime("%M")):
        print("Alarm Raised")
        break
    else:
        print("Alarm Not Raised")
        break


Friday, 29 September 2023

Python vs PHP For Web Development

Python and PHP programming languages; anything you need to know.


Python and PHP are both popular programming languages used for web development but they have different characteristics and use cases.

Python is a general-purpose programming language. It's popular for its simplicity, easy to learn, and versatility. 
 
It has many uses from website development,  machine learning, data analysis, and artificial intelligence to scientific computing.

 It's syntax is easy to learn and understand making it a great choice for beginners.

PHP (Hypertext preprocessor)
PHP is a server-side scripting language specifically made for web development.

It is widely used for creating dynamic web pages and web applications.

Comparison
1. Syntax
Python has cream and readable syntax making it good for readability and simplicity.
PHP syntax is similar to C but it's more verbose compared to Python.

2. Web development
Both Python and PHP are used for web development. They have different frameworks and ecosystems.

Python has frameworks like Django and Flask which are powerful tools for web development.
PHP have frameworks like Laravel, and Symfony used for web development.

3.  Community
Python has a larger community of developers who contribute to its growth and development.
PHP has a strong community with many resources available online for learning and troubleshooting.

4. Performance
Python's performance is in scientific computing and data analysis due to its extensive libraries.
PHP is good and optimised for web development tasks making it efficient for handling web requests.
 Finally, the choice between Python and PHP depends on your specific project requirements,  personal preferences, and familiarity with the language. Each language has its strengths and weaknesses. It's good to determine it's community support, availability of resources, performance needs and the nature of the project.


How To Create Your CV Using HTML and CSS

 HTML and CSS can be used to create stunning projects and ideas. Today, we have decided to make our own curriculum vitae (CV) using HTML and CSS.


                                                                          photo CV

First make sure you have already drafted your cv and updated it to match your current career and work experience.

Here is the code for designing the website:

<body>
    <div class="container">
        <div class="header">
            <h1>Your Name</h1>
            <p>Web Development</p>
        </div>
        <div class="contact-info">
            <p>Email:youremail@gmail.com</p>
            <p>Phone:(+000) 4578894</p>
            <p>Website:www.yourwebsite.com</p>
        </div>
        <div class="section">
            <h2>Summary</h2>
            <p>A passionate wed developer with a strong foundation in HTML,CSS,Javascript.<br>
            Experienced in creating professional, responsive, and user-friendly websites.<br>
        Continuously learning to adopt with changing technology.</p>
        </div>

        <div class="section">
            <h2>Skills</h2>
            <ul>
                <li>HTML:5</li>
                <li>CSS</li>
                <li>JavaScript</li>
                <li>Responsive design</li>
                <li>Web Development</li>
            </ul>
        </div>
        <div class="section">
            <h2>Experience</h2>
            <h3>Web developer - Name of company</h3>
            <p>Designed and developed a responsive website for a clied.<br>
            Collaborated with the design team to implement user-friendly interface.</p>
        </div>
        <div class="section">
            <h2>Education</h2>
            <h3>Bachelor of science in Computer Science</h3>
            <p>your University - Graduated 2013</p>
        </div>
    </div>
   
</body>
</html>

Now, we are styling our cv using CSS.

here is the codes:

<style>
        body{
            font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: aliceblue;
            text-align: center;
        }
        .container{
            max-width: 800;
            margin: 0 auto;
            padding: 20px;
            background-color: rgb(216, 228, 224);
            box-shadow: 0 0 10px rgda (0,0,0,0.1);
        }
        h1,h2,h3{
            color: black;
        }
        .header{
            text-align: center;
        }
        .container-info{
            text-align: center;
            margin-top: 20px;
        }
        .section{
            margin-bottom: 30px;
        }
        .section h2{
            font-size: 20px;
            margin-bottom: 10px;
            border-bottom: 1px solid #333;
            padding-bottom: 5px;
        }
        .section p{
            line-height: 1.6;
        }
        .section ul{
            list-style-type: none;
            padding-left: 20px;
        }
    </style>

Wednesday, 27 September 2023

Making Of Multiplication Table ;Python.

Today I want to share with you a short python project. A multiplication table python project. The is one of the shortest projects I have ever created. It contains less than five lines of code, but at the end of the coding, you get one of the best multiplication tables.

Codes.
As you can see, we have used four lines of code. With these four lines, you can adjust the codes inside and produce a better multiplication table of any length.

Inline one, for x in range (0,16) means we want our table to show multiplication of from zero to fifteen .since the counting in python starts from zero, we end up getting a table of from zero to fifteen. The last number is never counted.

If you want to produce a table of up to a higher number, you can replace 16 with any bigger number like 17,18,19,20, etc.

For I in range(0,8) means we want to multiply each number in x with zero to eight.  you can also adjust your table by replacing 8 with any bigger 
After using just four lines of codes, you end up getting an amazing multiplication table like this.
You can use the above codes and see if you can get a better table than this.

WordPress vs Blogger: Key differences



Maybe you are asking yourself why you should have a blog. I'm here to tell you that many people have taken blogging as their full-time employment(career) and they are making very huge money from it.

As for now, there are very many blogging sites where bloggers can create their blogs and get the best services from them, but I'm going to take you through just two; Blogger and WordPress.
Note: In this article, we are only talking about WordPress.org but not WordPress.com. you can also learn about their differences in this blog.

WordPress is a full content management system which means you can create a website using it. WordPress is not entirely free because you have to pay for a hosting plan in any hosting site of your choice. If you are looking for a cheap hosting site, look for Namecheap.com. If you want a better hosting company do it on Bluehost.com.

Blogger is beginner-friendly. It is very easy to create and publish your posts. All you need is to create a user profile using a google account. Then, you need to choose your URL which will have a .blogspot.com added to the end o your URL, for example, johnkey.blogspot.com. You can always change the domain ending by buying a custom domain.

After creating your account, you will get into the blogger dashboard where you can set up your blog, create posts, pages, and many more blog settings.

Pros and cons of WordPress.
1. The platform is beginner-friendly and easy to learn especially if you want to perform simple tasks like blogging.
2. There are many customized options in form of plugins and themes enabling you to design your site the way you want.
3. You are responsible for your site's management and making sure it's very secure.
4. You will need some money to invest when starting up your WordPress account like buying a domain name.

Pros and cons of the blogger.
1. It's very simple and quick to get started with a blogger. It takes very few minutes to create your blog and start running it.
2. Blogger is 100% free because you don't need any hosting plan like buying a domain and hosting it.
3. The platform is very basic because you can't do much with it. Many blog features are highly restricted.
4.Your blogger contents are not fully owned by you although you can export the contents to another site or blog.
.






Saturday, 24 June 2023

Adding a Dark Mode to Your Website: Enhancing User Experience with Ease

photo    courtesy




Introduction:

In the contemporary digital environment, incorporating a dark mode feature into your website can significantly enhance the user experience. Dark mode creates a visually appealing and relaxing browsing environment, lessening eye fatigue and enhancing comprehension. This article delves into the process of incorporating a dark mode into your online presence, providing insights and useful suggestions to ensure the smooth introduction of this desired function.

photo  Google


HTML process of adding dark mode:

<!DOCTYPE html>
<html lang="en" class="light-mode">
<head>
<link rel="stylesheet" type="text/css" href="dark.css">
</head>
<body>
<!-- Page content -->
<span id="dark-mode-icon"></span>

<button id="dark-mode-toggle">Toggle Dark Mode</button>
<script src="dark.js"></script>
</body>
</html>

4. Implementing Dark Mode with CSS:

The CSS techniques used to implement dark mode effectively. Utilize media queries to detect user preferences, or provide a manual toggle option for users to switch between light and dark modes. Walk through the necessary CSS modifications for background colours, text colours, and other relevant elements.

.light-mode {
/* Light mode styles */
Colour: #000;
background-color: #fff;
}
.dark-mode {
/* Dark mode styles */
color: #fff;
background-color: #333;
}
/* Additional styles for elements in dark mode */
.dark-mode h1 {
color: #fff;
}
@media (prefers-color-scheme: dark) {
/* Styles for automatic dark mode */
html:not(.dark-mode) {
color: #fff;
background-color: #333;
}
/* Additional styles for elements in automatic dark mode */
html:not(.dark-mode) h1 {
color: #fff;
}
}
body {
/* Other body styles */
transition: background-color 0.3s ease, color 0.3s ease;
}
#dark-mode-icon {
width: 24px;
height: 24px;
background-image: url('dark.png');
background-size: cover;
/* Add other styling as needed */
}

5. The JavaScript part of dark mode:

document.addEventListener('DOMContentLoaded', () => {
const darkModeToggle = document.getElementById('dark-mode-toggle');
const html = document.querySelector('html');
const localStorageKey = 'darkMode';
// Retrieve user preference from local storage
const isDarkModeEnabled = JSON.parse(localStorage.getItem(localStorageKey));
// Apply the appropriate class based on the user's preference
if (isDarkModeEnabled) {
html.classList.add('dark-mode');
} else {
html.classList.remove('dark-mode');
}
darkModeToggle.addEventListener('click', () => {
// Toggle dark mode class
html.classList.toggle('dark-mode');
// Save user preference to local storage
localStorage.setItem(localStorageKey, html.classList.contains('dark-mode'));
});
});


Conclusion:

By incorporating a dark mode feature into your website, you can significantly enhance the user experience by providing a visually appealing, comfortable, and customizable browsing experience. Follow the steps outlined in this article, adapting them to suit your website's specific requirements. Embrace the benefits of dark mode and empower users with an immersive and enjoyable interface. Implementing dark mode can be a game-changer in providing an exceptional user experience while keeping your website up to date with modern design trends.

Saturday, 10 June 2023

Why You Shoudl Learn Web Development In Python In 2023:15 Compelling Reasons

                                                    photo Canvas


In this post, we are going to explore 13 real-world examples of python in web development, giving examples of well known websites to innovative applications. You will see how python can power diverse and dynamic web projects, and you will learn some tips and tricks along the way.

13 real word examples of python in web development

1    Googleuses python for web crawling, search engine, Gmail, YouTube, and more.

2    Facebook:  

 Which is a big company, uses Python to do things like studying data, making search engines better, and managing their computers.

3    NASA:    NASA (National Aeronautics and Space Administration) which is a state-owned agency of the United
photo Google

 States of America in control of Civil space program using advanced research in aerospace and aeronautics. Python is a computer program that is used for science, processing data, and making things look real.

4    Netflix:    utilizes Python for the majority of its applications, which encompass data analysis, back-end web development, security automation, risk classification, vulnerability analysis, content recommendation analysis, machine learning, and numerous other related tasks.

5    Amazon:    Amazon uses Boto3, a Python-based AWS software development kit, to handle Amazon Elastic Compute Cloud (EC2), Amazon Simple Storage Services (S3), and Amazon DynamoDB.

6    Uber: Python is widely used by Uber for geolocation purposes, mathematical calculations, data management, and creating login functions.

With these, few discussions other big names which use python are;
7    Wikipedia
8    Instagram
9    Pinterest
10    Quora
11    Dropbox
12    Spotify
13    Reddit

Conclusion

Why are they using python?
Why do they utilize Python? Python is a flexible language that possesses great capabilities for various web-related endeavours. This includes constructing websites, creating programs, and offering services, with Python's repository of frameworks, libraries, and tools.

                                                photo courtesy inexturer.com

 It also benefits from having a wide and engaged community that actively aids in its growth and advancements. This article examines 13 examples depicting the practical applications of Python in web development, highlighting different challenges and use cases.

We hope you have learned something new with us and gained some inspiration for your own projects.
Fell free to comment, like, or give feedback. If you have enjoyed this post, don't forget to share with your friends, colleagues. Thanks for reading!


Tuesday, 24 May 2022

How To Make a Smooth Grid Layout Using CSS.

CSS can be used together with HTML to give a good HTML Website and other features. 

CSS is used to style HTML codes and make them attractive.

Without CSS, HTML website together with other programs like apps would be o no attraction at all.
CSS and HTML go hand in hand, and without one , the other would be of no much use.

In this article, I'm going to show you how to create attractive, and smooth user grid using both CSS and HTML.
Below are the codes of HTML register;
<body id="body">
<div id="container" class="container">
<h2>Register here</h2>
<div class="logo" ></div><br><br>

<div class="fields">
<input class="email" type="email" class="email-input" placeholder="Enter Email" ><br>
<input class="username" type="text" class="user-input" placeholder="Enter Username"><br>
<input class="password" type="password" class="pass-input" placeholder="Enter Password"><br>

<input class="password" type="password" class=" pass-input" placeholder="Confirm Password"><br>

<button type="button">Register</button>
</div>

<p>Already have an Account? <span id="login"><a href="index.html" style="color:#fb2525;">Login Here</a></span></p>

</div>


<script>

</script>
</body>
 

  sign in codes;
<body id="body">
<div class="container">
<h2>Login here</h2>
<div class="logo" ></div><br>
<div class="fields">
<input class="username" type="text" class="user-input" placeholder="Enter username"><br>
<input class="password" type="password" class="pass-input" placeholder="Enter password"><br><br>
<button type="button">Login</button>
</div>
<p id="forgot" onclick="Forgot()" >Fogort Password?</p>
<p>Create New Account <span id="register" > <a href="register.html" style="color:#fb2525;"> Here</a></span></p>

</div>


<script>
function Forgot() {
console.log('clicked');
}
</script>
</body>


Below are the codes of CSS;
#body{
margin:0;
padding:0;
background:#cbced1;
background-size: cover;
background-position:center;
font-family: sans-serif;
}
.container{
width: 350px;
height: 450px;
position: absolute;
left: 40%;
top: 2%;
color: #24cea9;
text-align: center;
padding: 60px 35px 35px 35px;
border-radius: 40px;
background: #ecf0f3;
box-shadow: 13px 13px 20px #7e878f,
-13px -13px 20px #e6dede;

}

#container{
width: 350px;
height: 550px;
position: absolute;
left: 40%;
top: 2%;
color: #24cea9;
text-align: center;
padding: 60px 35px 35px 35px;
border-radius: 40px;
background: #ecf0f3;
box-shadow: 13px 13px 20px #7e878f,
-13px -13px 20px #e6dede;
}

.logo{
background: url("bloh.jpg") no-repeat;
width: 70px;
height: 70px;
background-size: 100% 100%;
/* background-color: #fd7213; */
border-radius: 50%;
top: 30%;

margin: auto;
box-shadow: 0px 0px 2px #5f5f5f,
0px 0px 0px 5px #517691,
8px 8px 15px #5f5f5f,
-8px -8px 15px #ffff;
}

.fields{
width: 100%;
padding: 5px 5px 5px 5px;
}
.fields input{
border:none;
outline: none;
background: none;
font-size: 18px;
color: #555;
padding: 20px 40px 20px 35px;
}

.username, .password, .email{
margin-bottom: 10px;
border-radius: 25px;
box-shadow: inset 8px 8px 6px #cbced1,
inset -8px -8px 6px #ffffff;

}


button{
background: #24cea9;
border-radius: 30px;
outline: none;
cursor: pointer;
border: none;
width: 250px;
height: 60px;
font-size:14px;
font-style:normal;
font-weight: bold;
text-align: center;
font-family: 'lato', sans-serif;
color: #fff;
border: none;
box-shadow: inset 3px 3px 4px #49caf6,
inset -3px -3px 3px #ffffff;
/* transition: 0.5s; */
}

button:hover{
background-color: #49caf6;
}
p{
font-size: 14px;

}


You can add more features and make your grind look more attractive.

React vs Angular; Front-End Web Development

Angular and React  are two of the most popular Javascript tools for front-end development. React is a Javascript created by Meta...