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>

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...