<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sam on Medium]]></title>
        <description><![CDATA[Stories by Sam on Medium]]></description>
        <link>https://medium.com/@yosami14?source=rss-46ae8106fc1b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SdDABhFWLJGJoKAA</url>
            <title>Stories by Sam on Medium</title>
            <link>https://medium.com/@yosami14?source=rss-46ae8106fc1b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 02:26:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yosami14/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Web Scraping Tutorial: Extracting News Data from a Website using Python and BeautifulSoup]]></title>
            <link>https://medium.com/@yosami14/web-scraping-tutorial-extracting-news-data-from-a-website-using-python-and-beautifulsoup-5030062ddb42?source=rss-46ae8106fc1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5030062ddb42</guid>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 06:29:21 GMT</pubDate>
            <atom:updated>2023-07-22T06:29:21.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*6r_U-90buIs4tB9jueU6XA.png" /></figure><p>Web scraping is the process of automatically extracting information from websites, making it a powerful tool for data collection and analysis. In this tutorial, we will explore how to use Python and BeautifulSoup to scrape news data from a website. We’ll specifically focus on the task of extracting news headlines, publish dates, article content, and images from a news website.</p><h3>Prerequisites</h3><p>Before we start, make sure you have the following installed:</p><ol><li>Python (<a href="https://www.python.org/downloads/">https://www.python.org/downloads/</a>)</li><li>Requests library (pip install requests)</li><li>BeautifulSoup library (pip install beautifulsoup4)</li></ol><h3>Introduction to Web Scraping</h3><p>Web scraping involves fetching HTML content from web pages and then parsing that content to extract relevant data. The requests library allows us to fetch the HTML content of web pages, and BeautifulSoup makes it easy to parse and extract data from the HTML.</p><pre>import requests<br>from bs4 import BeautifulSoup<br>from urllib.parse import urljoin</pre><h3>Creating the Telegram bot</h3><p>First, we need to create a Telegram bot. To do this, follow these steps:</p><ol><li>Open Telegram and search for the BotFather bot.</li><li>Start a chat with BotFather.</li><li>Send the /newbot command to BotFather.</li><li>Follow the prompts to create a new bot.</li><li>Once you’ve created the bot, BotFather will give you a token. Copy this token and save it somewhere safe.</li></ol><h3>Writing the Python script</h3><p>Now that we have our bot token, we can write our Python script for scraping :</p><pre>def get_news():<br>    base_url = &#39; insert here the URL you want to scrape&#39;<br>    html_text = requests.get(base_url).text<br>    soup = BeautifulSoup(html_text, &#39;lxml&#39;)<br><br>    news_container = soup.find_all(&#39;article&#39;, class_=&#39;listing-item-blog&#39;)<br><br>    my_news = []<br>    prev_publish_date = None  # Store the previous news publish date<br>    for each_news in news_container:<br>        new_subpage = each_news.find(&#39;a&#39;, class_=&quot;post-title post-url&quot;)[&#39;href&#39;]<br>        subpage_html = requests.get(new_subpage).text<br>        subpage_soup = BeautifulSoup(subpage_html, &#39;lxml&#39;)<br><br>        news_title = subpage_soup.find(&#39;span&#39;, class_=&quot;post-title&quot;).text<br><br>        news_publish_date_element = each_news.find(<br>            &#39;time&#39;, class_=&quot;post-published updated&quot;)<br>        news_publish_date = news_publish_date_element[&#39;datetime&#39;]<br><br>        if prev_publish_date and news_publish_date &gt; prev_publish_date:<br>            # Skip this news as its publish date is not greater than the previous one<br>            continue<br><br>        div_element = subpage_soup.find(<br>            &#39;div&#39;, class_=&#39;entry-content clearfix single-post-content&#39;)<br>        p_elements = div_element.find_all(&#39;p&#39;)<br><br>        paragraphs = []<br>        for p_element in p_elements:<br>            paragraph_text = p_element.get_text(strip=True).replace(<br>                &#39;�&#39;, &#39;&#39;)  # Remove unsupported character &#39;�&#39;<br>            paragraphs.append(paragraph_text)<br><br>        # Extract the image URL<br>        image_element = subpage_soup.find(<br>            &#39;a&#39;, class_=&quot;post-thumbnail open-lightbox&quot;)<br>        if image_element:<br>            image_url = image_element[&#39;href&#39;]<br>            news_data = {<br>                &#39;Title&#39;: news_title,<br>                &#39;Publish Date&#39;: news_publish_date,<br>                &#39;Paragraphs&#39;: paragraphs,<br>                &#39;Image&#39;: image_url,<br>                &#39;link&#39;: new_subpage<br>            }<br>        else:<br>            news_data = {<br>                &#39;Title&#39;: news_title,<br>                &#39;Publish Date&#39;: news_publish_date,<br>                &#39;Paragraphs&#39;: paragraphs,<br>                &#39;link&#39;: new_subpage<br>            }<br><br>        my_news.append(news_data)<br><br>    # Update the previous publish date for the next iteration<br>    if my_news:<br>        prev_publish_date = my_news[-1][&#39;Publish Date&#39;][0]<br><br><br>    return my_news</pre><p>This function fetches the latest news data using the get_news() function. For each news item, it creates the message content, including the title, publish date, and paragraphs. If the news item has an image, it sends a photo message; otherwise, it sends a text message to the Telegram channel.</p><pre>def send_latest_news_message():<br>    try:<br>        # Fetch the latest news data<br>        news_data = get_news()<br><br>        # Check if there are no news articles available<br>        if not news_data:<br>            logging.info(&quot;No news available to send.&quot;)<br>            return<br><br>        for latest_news in news_data:<br>            # Create the message content<br>            message = f&quot;*Title: {latest_news[&#39;Title&#39;]}*\n_{latest_news[&#39;Publish Date&#39;]}_ \n\n&quot;<br>            message += &quot;\n&quot;.join(latest_news[&#39;Paragraphs&#39;])<br><br>            # Check if the news item has an image<br>            if &#39;Image&#39; in latest_news:<br>                image_url = latest_news[&#39;Image&#39;]<br>                # Truncate the caption to the allowed length<br>                caption = message[:CAPTION_LIMIT]<br>                bot.send_photo(chat_id=channel_id, photo=image_url,<br>                               caption=caption, parse_mode=&#39;Markdown&#39;)<br>                logging.info(&quot;News message sent successfully.&quot;)<br>            else:<br>                bot.send_message(chat_id=channel_id,<br>                                 text=message, parse_mode=&#39;Markdown&#39;)<br><br>    except Exception as e:<br>        logging.error(&quot;Error occurred while sending news:&quot;, exc_info=True)</pre><h3>Putting it All Together</h3><ol><li>Make sure you have created a Telegram bot and obtained the API key.</li><li>Create a Telegram channel and obtain its channel ID.</li><li>Create a constants.py file with the following content, replacing the placeholders with your actual API key and channel ID:</li></ol><pre># constants.py<br>API_KEY = &#39;YOUR_TELEGRAM_BOT_API_KEY&#39;<br>CHANNEL_ID = &#39;@YOUR_TELEGRAM_CHANNEL_ID&#39;</pre><p>In this tutorial, we have learned how to automate the process of sharing the latest news articles on a Telegram channel using Python and Telebot. By integrating web scraping and scheduling features, you can keep your channel up-to-date with the latest news effortlessly. Remember to handle exceptions and errors properly in your final implementation to ensure the bot runs smoothly. Happy bot building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5030062ddb42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Weather Dashboard using HTML, CSS, JavaScript and Openweather API]]></title>
            <link>https://medium.com/@yosami14/creating-a-weather-dashboard-using-html-css-and-javascript-217f80229fb?source=rss-46ae8106fc1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/217f80229fb</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[openweathermap-api]]></category>
            <category><![CDATA[highcharts]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Sat, 15 Jul 2023 06:16:12 GMT</pubDate>
            <atom:updated>2023-07-15T06:51:16.653Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MlkRf5Wt4PyyJW0j-8grQ.png" /><figcaption>preview of the website visit this link:<a href="https://yosami14.github.io/Earth-Flow/">https://yosami14.github.io/Earth-Flow/</a></figcaption></figure><p>Weather is an integral part of our lives, impacting our daily activities, travel plans, and even our moods. Wouldn’t it be great to have a visually appealing and informative weather dashboard that provides real-time weather data along with insightful charts and maps? In this article, we will walk you through the process of creating an interactive weather dashboard called Earth Flow, using HTML, CSS, and JavaScript.</p><h3>Setting Up the Environment</h3><p>Before we delve into the code, let’s ensure that we have the necessary dependencies and libraries. Earth Flow utilizes the Bootstrap framework, Leaflet maps, Highcharts for data visualization, and Font Awesome for icons. Make sure you have the following links in your HTML file’s &lt;head&gt; section:</p><pre>&lt;!-- Required meta tags --&gt;<br>&lt;meta charset=&quot;utf-8&quot; /&gt;<br>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, shrink-to-fit=no&quot; /&gt;<br><br>&lt;!-- Bootstrap CSS v5.2.1 --&gt;<br>&lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; /&gt;<br><br>&lt;!-- Leaflet map --&gt;<br>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://unpkg.com/leaflet@1.7.1/dist/leaflet.css&quot; /&gt;<br><br>&lt;!-- Google Font - Space Grotesk --&gt;<br>&lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot; /&gt;<br>&lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot; crossorigin /&gt;<br>&lt;link href=&quot;https://fonts.googleapis.com/css2?family=Space+Grotesk&amp;display=swap&quot; rel=&quot;stylesheet&quot; /&gt;<br><br>&lt;!-- Font Awesome --&gt;<br>&lt;script src=&quot;https://kit.fontawesome.com/ada9dfd0e0.js&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br><br>&lt;!-- Custom CSS --&gt;<br>&lt;link rel=&quot;stylesheet&quot; href=&quot;./style.css&quot; /&gt;</pre><p>In addition to the CSS and font links, we need to include the necessary JavaScript libraries at the end of the &lt;body&gt; tag:</p><pre>&lt;!-- Highcharts --&gt;<br>&lt;script src=&quot;https://code.highcharts.com/highcharts.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://code.highcharts.com/modules/series-label.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://code.highcharts.com/modules/exporting.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://code.highcharts.com/modules/export-data.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://code.highcharts.com/modules/accessibility.js&quot;&gt;&lt;/script&gt;<br><br>&lt;!-- Bootstrap JavaScript Libraries --&gt;<br>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js&quot; integrity=&quot;sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.min.js&quot; integrity=&quot;sha384-7VPbUDkoPSGFnVtYi0QogXtr74QeVeeIs99Qfg5YCF+TidwNdjvaKZX19NZ/e6oz&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br><br>&lt;!-- Leaflet map --&gt;<br>&lt;script src=&quot;https://unpkg.com/leaflet@1.7.1/dist/leaflet.js&quot;&gt;&lt;/script&gt;<br><br>&lt;!-- jQuery --&gt;<br>&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js&quot;&gt;&lt;/script&gt;<br><br>&lt;!-- Custom JavaScript --&gt;<br>&lt;script src=&quot;./index.js&quot;&gt;&lt;/script&gt;</pre><p>Now that our environment is set up let’s proceed to the code implementation.</p><h3>Building the HTML Structure</h3><p>The first step is to define the HTML structure of our weather dashboard. We’ll have a header, main section, and a footer. Here’s a snippet of the HTML structure:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;title&gt;Earth Flow&lt;/title&gt;<br>  &lt;!-- Required meta tags, CSS links, and libraries --&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;header&gt;<br>    &lt;!-- Navbar --&gt;<br>  &lt;/header&gt;<br>  &lt;main&gt;<br>    &lt;!-- Location and weather overview section --&gt;<br>    &lt;!-- Weekly charts section --&gt;<br>  &lt;/main&gt;<br>  &lt;footer&gt;<br>    &lt;!-- Footer content --&gt;<br>  &lt;/footer&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This navbar includes the Earth Flow logo, the brand name, and a search input field to allow users to search for a specific location. We have used Font Awesome icons to enhance the visual appeal of the search button.</p><h3>Designing the Weather Overview Section</h3><p>The weather overview section displays the current weather conditions, including temperature, humidity, and wind speed. It also provides a map to visualize the location. Here’s the HTML code for this section:</p><pre>&lt;section class=&quot;topSection&quot;&gt;<br>  &lt;div class=&quot;container-fluid&quot;&gt;<br>    &lt;div class=&quot;row&quot;&gt;<br>      &lt;h2&gt;Today OverViews&lt;/h2&gt;<br>      &lt;div class=&quot;col col-lg-6 col-12 DailyWeather&quot;&gt;<br>        &lt;div class=&quot;countryDiv d-flex&quot;&gt;<br>          &lt;!-- Country icon and name --&gt;<br>          &lt;!-- Temperature, humidity, and wind speed --&gt;<br>        &lt;/div&gt;<br>        &lt;div class=&quot;WeatherDailyList&quot;&gt;&lt;/div&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;col col-lg-6 col-12 weatherMapContainer&quot;&gt;<br>        &lt;div class=&quot;weatherMap&quot;&gt;&lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>  &lt;img src=&quot;&quot; alt=&quot;&quot; /&gt;<br>&lt;/section&gt;</pre><p>Inside the .DailyWeather container, we&#39;ll display the country icon and name, temperature, humidity, and wind speed. The .WeatherDailyList container will dynamically populate weather data for different time intervals. The .weatherMapContainer will hold the Leaflet map to visualize the location. Make sure to include the necessary CSS classes for proper styling.</p><h3>Including the Weekly Charts</h3><p>To provide users with insights into weekly weather trends, we’ll include informative charts. Here’s the HTML code for the weekly charts section:</p><pre>&lt;section class=&quot;weeklyCharts&quot;&gt;<br>  &lt;div class=&quot;container-fluid&quot;&gt;<br>    &lt;div class=&quot;row&quot;&gt;<br>      &lt;div class=&quot;d-flex&quot;&gt;<br>        &lt;h3&gt;Weekly OverViews&lt;/h3&gt;<br>        &lt;a href=&quot;#temprature&quot; class=&quot;text-secondary&quot;&gt; More&lt;/a&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;col col-lg-6 col-12&quot;&gt;<br>        &lt;figure class=&quot;highcharts-figure humidityChart&quot;&gt;<br>          &lt;div id=&quot;humidity&quot;&gt;&lt;/div&gt;<br>        &lt;/figure&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;col col-lg-6 col-12&quot;&gt;<br>        &lt;figure class=&quot;highcharts-figure&quot;&gt;<br>          &lt;div id=&quot;temprature&quot;&gt;&lt;/div&gt;<br>        &lt;/figure&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;col col-lg-6 col-12&quot;&gt;<br>        &lt;figure class=&quot;highcharts-figure&quot;&gt;<br>          &lt;div id=&quot;pressure&quot;&gt;&lt;/div&gt;<br>        &lt;/figure&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;col col-lg-6 col-12&quot;&gt;<br>        &lt;figure class=&quot;highcharts-figure&quot;&gt;<br>          &lt;div id=&quot;overViewAll&quot;&gt;&lt;/div&gt;<br>        &lt;/figure&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/section&gt;</pre><p>This section includes four Highcharts figures representing the humidity, temperature, pressure, and overall weather trends. You can customize the chart titles, subtitles, and the number of charts based on your preferences.</p><h3>Styling with CSS</h3><p>To ensure our weather dashboard looks visually appealing, we’ll add custom CSS. You can either define your styles in the &lt;style&gt; tag within the HTML file or link an external CSS file. Here&#39;s an overview of the main CSS classes used:</p><ul><li>.navbar: Styles the overall appearance of the navbar.</li><li>.brandName: Controls the layout and alignment of the brand name and logo.</li><li>.search-input-Div: Styles the search input field and search icon.</li><li>.topSection: Defines the layout of the weather overview section.</li><li>.DailyWeather: Styles the layout of the daily weather information.</li><li>.weatherMapContainer: Adjusts the appearance of the weather map container.</li><li>.weeklyCharts: Defines the layout and spacing of the weekly charts section.</li><li>.humidityChart, .highcharts-figure: Styles the individual chart figures.</li></ul><p>Feel free to customize these styles to match your desired design aesthetic.</p><h3>Fetching Weather Data</h3><p>Now comes the exciting part — fetching real-time weather data using the OpenWeatherMap API. We’ll utilize JavaScript to retrieve the weather data and dynamically update the dashboard. Here’s the code responsible for fetching the weather data:</p><pre>const endpoints = {<br>  weather: {<br>    baseUrl: &#39;https://api.openweathermap.org/data/2.5/forecast&#39;,<br>    apiKey: &#39;4f944c0231428c0ac6ebf79e36eba04d&#39;<br>  },<br>};<br><br>let countryChoice = &#39;Addis Ababa&#39;;<br>fetchWeatherData(countryChoice);<br><br>$(&#39;.searchIcon&#39;).click(function() {<br>  const userChoice = $(&#39;.search-input&#39;).val();<br>  if (userChoice !== &#39;&#39;) {<br>    countryChoice = userChoice;<br>    fetchWeatherData(countryChoice);<br>  }<br>});<br><br>function fetchWeatherData(city) {<br>  const weatherURL = `${endpoints.weather.baseUrl}?q=${city}&amp;appid=${endpoints.weather.apiKey}&amp;units=metric`;<br>  fetch(weatherURL)<br>    .then((response) =&gt; response.json())<br>    .then((data) =&gt; {<br>      weatherData(data);<br>    })<br>    .catch((error) =&gt; {<br>      console.log(&quot;Error:&quot;, error);<br>    });<br>}<br><br>const weatherData = (data) =&gt; {<br>  // Process and display weather data<br>};</pre><p>In the endpoints object, we store the base URL for the OpenWeatherMap API and the provided API key. The fetchWeatherData function sends a request to the API using the provided city name. Upon receiving the data, the weatherData function is called to process and display the weather information.</p><h3>Displaying Weather Data and Charts</h3><p>The weatherData function is responsible for extracting the necessary weather data and updating the dashboard. Here&#39;s a snippet of the code that populates the weather overview section:</p><pre>const weatherData = (data) =&gt; {<br>  const listOfWeatherData = data.list;<br>  const startDate = fixDateInterval(data.list[0].dt_txt);<br>  const humidityArray = [];<br>  const tempArray = [];<br>  const windArray = [];<br>  // Extract relevant data and populate arrays<br>  <br>  // Display country icon, name, temperature, humidity, wind speed, and map<br>  createWeatherList(iconArray, tempArray, humidityArray, windArray, startDate, data);<br>  createMap(xAxis, yAxis);<br>};</pre><p>We extract the necessary weather data from the API response and store it in arrays (humidityArray, tempArray, windArray, etc.). These arrays will be used to populate the weather list and charts. The createWeatherList function dynamically generates the weather list based on the time intervals, and the createMap function creates the Leaflet map with the provided latitude (xAxis) and longitude (yAxis).</p><p>Lastly, we create the charts using the Highcharts library. The createHumidityChart, createPressureChart, createTempChart, and createOverAllChart functions generate the respective charts by passing the necessary data and configurations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=217f80229fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s Guide to Building a Movie and TV Show Website with Themoviedb API]]></title>
            <link>https://medium.com/@yosami14/beginners-guide-to-building-a-movie-and-tv-show-website-with-themoviedb-api-9b0cc57e1267?source=rss-46ae8106fc1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b0cc57e1267</guid>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[tmdb]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[filmweb]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Fri, 07 Jul 2023 20:48:24 GMT</pubDate>
            <atom:updated>2023-07-07T20:48:24.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlKJRMgkIttj8GfH-b8tTw.png" /></figure><p>Are you interested in creating your own movie and TV show website? In this tutorial, we’ll walk you through the process of building a website that displays trending movies, trending TV shows, upcoming movies, and top-rated movies using the Themoviedb API. By following this step-by-step guide, you’ll gain a profound understanding of how to implement fundamental functions and features in your own program.<br>Prerequisites</p><p>To follow along with this tutorial, you’ll need the following:</p><ol><li>Basic knowledge of HTML, CSS, and JavaScript.</li><li>A text editor or integrated development environment (IDE) to write your code.</li><li>An internet connection to fetch data from the Themoviedb API.</li><li>An API key from Themoviedb. You can sign up for a free account and obtain your API key from the <a href="https://www.themoviedb.org/">Themoviedb website</a>.</li></ol><h3>Setting Up the Project</h3><p>Let’s start by setting up the basic structure of our project. Follow these steps:</p><ol><li>Create a new directory for your project.</li><li>Open your text editor or IDE and create a new HTML file. Save it as index.html in your project directory.</li><li>Create a new CSS file and save it as style.css in your project directory.</li><li>Create a new JavaScript file and save it as script.js in your project directory.</li></ol><h3>Creating the HTML Structure</h3><p>In the index.html file, paste the following HTML code:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;Movie and TV Show Website&lt;/title&gt;<br>    &lt;!-- Required meta tags --&gt;<br>    &lt;meta charset=&quot;utf-8&quot; /&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, shrink-to-fit=no&quot; /&gt;<br><br>    &lt;!-- Bootstrap CSS v5.2.1 --&gt;<br>    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; /&gt;<br><br>    &lt;!-- Custom CSS --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; /&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;header&gt;<br>      &lt;!-- Navbar code goes here --&gt;<br>    &lt;/header&gt;<br><br>    &lt;main&gt;<br>      &lt;!-- Banner section goes here --&gt;<br>      &lt;section id=&quot;banner&quot;&gt;<br>        &lt;div class=&quot;col col-lg-12 col-12 h-75 w-100&quot;&gt;<br>          &lt;div<br>            id=&quot;carouselExampleDark&quot;<br>            class=&quot;carousel carousel-dark slide&quot;<br>            data-bs-ride=&quot;carousel&quot;<br>          &gt;<br>            &lt;div class=&quot;carousel-indicators&quot;&gt;&lt;/div&gt;<br>            &lt;div class=&quot;carousel-inner&quot;&gt;&lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;button<br>          class=&quot;carousel-control-prev&quot;<br>          type=&quot;button&quot;<br>          data-bs-target=&quot;#carouselExampleDark&quot;<br>          data-bs-slide=&quot;prev&quot;<br>        &gt;<br>          &lt;span<br>            class=&quot;carousel-control-prev-icon visually-hidden&quot;<br>            aria-hidden=&quot;true&quot;<br>          &gt;&lt;/span&gt;<br>          &lt;span class=&quot;visually-hidden&quot;&gt;Previous&lt;/span&gt;<br>        &lt;/button&gt;<br>        &lt;button<br>          class=&quot;carousel-control-next&quot;<br>          type=&quot;button&quot;<br>          data-bs-target=&quot;#carouselExampleDark&quot;<br>          data-bs-slide=&quot;next&quot;<br>        &gt;<br>          &lt;span<br>            class=&quot;carousel-control-next-icon visually-hidden&quot;<br>            aria-hidden=&quot;true&quot;<br>          &gt;&lt;/span&gt;<br>          &lt;span class=&quot;visually-hidden&quot;&gt;Next&lt;/span&gt;<br>        &lt;/button&gt;<br>      &lt;/section&gt;<br><br>      &lt;!-- Trending Movies section goes here --&gt;<br><br>      &lt;!-- Trending TV Shows section goes here --&gt;<br><br>      &lt;!-- Upcoming Movies section goes here --&gt;<br><br>      &lt;!-- Top Rated Movies section goes here --&gt;<br>    &lt;/main&gt;<br><br>    &lt;footer&gt;<br>      &lt;!-- Footer code goes here --&gt;<br>    &lt;/footer&gt;<br><br>    &lt;!-- JavaScript --&gt;<br>    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>This code sets up the basic structure of our webpage and includes the necessary CSS and JavaScript files.</p><h3>Styling the Website</h3><p>Now, let’s add some styles to our website. Open the style.css file and add the following CSS code:</p><pre>/* Add your CSS styles here */</pre><p>Feel free to customize the styles based on your preferences or add additional CSS to enhance the appearance of your website.</p><h3>Implementing jQuery</h3><p>To simplify DOM manipulation and make AJAX requests, we utilize the jQuery library in our project.</p><p>In the HTML file, we include the jQuery library by adding the following script tag before the closing body tag:</p><pre>&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js&quot;&gt;&lt;/script&gt;</pre><p>This allows us to use jQuery’s functions and methods in our JavaScript code.</p><p>In the script.js file, we use jQuery selectors (e.g., $(&#39;#carouselExampleDark&#39;)) to target elements in the HTML document and perform operations on them.</p><p>For example, we create new HTML elements using $(&#39;&lt;element&gt;&#39;) and manipulate their attributes and content using jQuery&#39;s methods (e.g., .attr(), .addClass(), .text()). We also append these elements to specific containers using jQuery&#39;s .append() method.</p><p>By utilizing jQuery, we simplify the process of selecting and manipulating HTML elements, making our code more concise and readable.</p><p>Remember to include the jQuery library in your project by referencing it in your HTML file before using any jQuery code.</p><p><em>let continue ….</em></p><h3>Explanation of Data Fetching Process</h3><p>To fetch data from the Themoviedb API, we use JavaScript’s fetch function. We send a GET request to the API endpoints, specifying the necessary headers and authorization using our API key.</p><p>We use the fetchData function to handle the API requests. It takes a URL as a parameter and returns a promise. The promise resolves to the response data in JSON format.</p><p>In the Promise.all block, we fetch data from multiple API endpoints simultaneously using fetchData function. We use destructuring to store the responses in separate variables for each endpoint.</p><p>We then call the appropriate functions to populate each section of the website with the retrieved data.</p><h3>Fetching Data from Themoviedb API</h3><p>In the script.js file, we&#39;ll write JavaScript code to fetch data from the Themoviedb API and populate our website with the retrieved information. Paste the following code:</p><pre>// API configuration<br>const apiKey = &#39;YOUR_API_KEY&#39;; // Replace with your actual API key<br><br>// Fetch data from the API<br>const fetchData = (url) =&gt; {<br>  return fetch(url, {<br>    method: &#39;GET&#39;,<br>    headers: {<br>      accept: &#39;application/json&#39;,<br>      Authorization: `Bearer ${apiKey}`,<br>    },<br>  }).then((response) =&gt; response.json());<br>};<br><br>// Fetch data from different API endpoints<br>Promise.all([<br>  fetchData(&#39;https://api.themoviedb.org/3/trending/all/day?language=en-US&#39;),<br>  fetchData(<br>    &#39;https://api.themoviedb.org/3/discover/movie?include_adult=false&amp;include_video=false&amp;language=en-US&amp;page=1&amp;sort_by=popularity.desc&#39;<br>  ),<br>  fetchData(<br>    &#39;https://api.themoviedb.org/3/discover/tv?include_adult=true&amp;include_null_first_air_dates=false&amp;language=en-US&amp;page=1&amp;sort_by=popularity.desc&#39;<br>  ),<br>  fetchData(&#39;https://api.themoviedb.org/3/movie/upcoming?language=en-US&amp;page=1&#39;),<br>  fetchData(&#39;https://api.themoviedb.org/3/movie/top_rated?language=en-US&amp;page=1&#39;),<br>])<br>  .then((responses) =&gt; {<br>    const trendingResponse = responses[0];<br>    const moviesResponse = responses[1];<br>    const tvShowsResponse = responses[2];<br>    const upcomingMoviesResponse = responses[3];<br>    const topRatedMoviesResponse = responses[4];<br><br>    // Call functions to populate each section with data<br>    populateBanner(trendingResponse);<br>    populateMovies(moviesResponse);<br>    populateTVShows(tvShowsResponse);<br>    populateUpcomingMovies(upcomingMoviesResponse);<br>    populateTopRatedMovies(topRatedMoviesResponse);<br>  })<br>  .catch((error) =&gt; {<br>    console.error(&#39;Error:&#39;, error);<br>  });<br><br>// Function to populate the banner section with trending content<br>const populateBanner = (data) =&gt; {<br>  // Add code to populate the banner section with data<br>};<br><br>// Function to populate the trending movies section<br>const populateMovies = (data) =&gt; {<br>  // Add code to populate the trending movies section with data<br>};<br><br>// Function to populate the trending TV shows section<br>const populateTVShows = (data) =&gt; {<br>  // Add code to populate the trending TV shows section with data<br>};<br><br>// Function to populate the upcoming movies section<br>const populateUpcomingMovies = (data) =&gt; {<br>  // Add code to populate the upcoming movies section with data<br>};<br><br>// Function to populate the top rated movies section<br>const populateTopRatedMovies = (data) =&gt; {<br>  // Add code to populate the top rated movies section with data<br>};</pre><p>Make sure to replace &#39;YOUR_API_KEY&#39; with your actual Themoviedb API key.</p><h3>Populating the Website with Data</h3><p>Now that we have the basic structure and API data fetching in place, let’s implement the functions to populate each section of our website with the retrieved data.</p><h3>Populating the Banner Section</h3><p>Inside the populateBanner function, add the following code to populate the banner section with trending content:</p><pre>const populateBanner = (data) =&gt; {<br>  const carouselExampleDark = $(&#39;#carouselExampleDark&#39;);<br><br>  for (const item of data.results) {<br>    const index = data.results.indexOf(item);<br>    let indexActive = &#39;&#39;;<br><br>    if (index === 0) {<br>      indexActive = &#39;active&#39;;<br>    }<br><br>    const indicator = $(&#39;&lt;button&gt;&#39;)<br>      .attr(&#39;type&#39;, &#39;button&#39;)<br>      .attr(&#39;data-bs-target&#39;, &#39;#carouselExampleDark&#39;)<br>      .attr(&#39;data-bs-slide-to&#39;, index)<br>      .addClass(indexActive)<br>      .attr(&#39;aria-current&#39;, index === 0)<br>      .attr(&#39;aria-label&#39;, `Slide ${index + 1}`);<br><br>    $(&#39;.carousel-indicators&#39;).append(indicator);<br><br>    const carouselItem = $(&#39;&lt;div&gt;&#39;).addClass(&#39;carousel-item&#39;);<br>    if (index === 0) {<br>      carouselItem.addClass(&#39;active&#39;);<br>    }<br>    carouselItem.attr(&#39;data-bs-interval&#39;, 3000);<br><br>    $(&#39;.carousel-inner&#39;).append(carouselItem);<br><br>    const carouselImg = $(&#39;&lt;img&gt;&#39;)<br>      .attr(&#39;alt&#39;, `Image of ${item.name}`)<br>      .addClass(&#39;d-block w-100&#39;);<br><br>    if ($(window).width() &gt; 600) {<br>      carouselImg.attr(&#39;src&#39;, `http://image.tmdb.org/t/p/w500${item.backdrop_path}`);<br>    } else if ($(window).width() &lt; 600) {<br>      carouselImg.attr(&#39;src&#39;, `http://image.tmdb.org/t/p/w500${item.poster_path}`);<br>    }<br><br>    const carouselCaption = $(&#39;&lt;div&gt;&#39;).addClass(&#39;carousel-caption d-none d-md-block text-start col col-lg-4&#39;);<br>    let h5Caption;<br><br>    if (item.name) {<br>      h5Caption = $(&#39;&lt;h1&gt;&#39;).text(`${item.name}`);<br>    } else {<br>      h5Caption = $(&#39;&lt;h1&gt;&#39;).text(`${item.title}`);<br>    }<br><br>    const pCaption = $(&#39;&lt;h4&gt;&#39;).text(item.overview);<br>    carouselCaption.append(h5Caption, pCaption);<br><br>    carouselItem.append(carouselImg, carouselCaption);<br>  }<br>};</pre><p>This code dynamically generates the carousel slides and adds the necessary indicators and captions.</p><h3>Populating the Trending Movies Section</h3><p>Inside the populateMovies function, add the following code to populate the trending movies section:</p><pre>const populateMovies = (data) =&gt; {<br>  for (const movie of data.results) {<br>    const card = $(&#39;&lt;div&gt;&#39;).addClass(&#39;card&#39;);<br>    const img = $(&#39;&lt;img&gt;&#39;)<br>      .addClass(&#39;card-img-top&#39;)<br>      .attr(&#39;alt&#39;, `Image of ${movie.name}`)<br>      .attr(&#39;src&#39;, `http://image.tmdb.org/t/p/w500${movie.poster_path}`);<br><br>    const cardBody = $(&#39;&lt;div&gt;&#39;).addClass(&#39;card-body&#39;);<br>    const cardTitle = $(&#39;&lt;h5&gt;&#39;).addClass(&#39;card-title&#39;).text(movie.title);<br><br>    cardBody.append(cardTitle);<br>    card.append(img, cardBody);<br>    $(&#39;.movieGroup&#39;).append(card);<br>  }<br>};</pre><p>This code creates cards for each trending movie and adds them to the movieGroup container.</p><h3>Populating the Trending TV Shows Section</h3><p>Inside the populateTVShows function, add the following code to populate the trending TV shows section:</p><pre>const populateTVShows = (data) =&gt; {<br>  for (const tvShow of data.results) {<br>    const card = $(&#39;&lt;div&gt;&#39;).addClass(&#39;card&#39;);<br>    const img = $(&#39;&lt;img&gt;&#39;)<br>      .addClass(&#39;card-img-top&#39;)<br>      .attr(&#39;alt&#39;, `Image of ${tvShow.name}`)<br>      .attr(&#39;src&#39;, `http://image.tmdb.org/t/p/w500${tvShow.poster_path}`);<br><br>    const cardBody = $(&#39;&lt;div&gt;&#39;).addClass(&#39;card-body&#39;);<br>    const cardTitle = $(&#39;&lt;h5&gt;&#39;).addClass(&#39;card-title&#39;).text(tvShow.name);<br><br>    cardBody.append(cardTitle);<br>    card.append(img, cardBody);<br>    $(&#39;.tvGroup&#39;).append(card);<br>  }<br>};</pre><p>Add more section according to your needs</p><h3>Finalizing the Website</h3><p>To complete your website, you can customize the navbar, footer, and overall styling based on your preferences. Feel free to add additional features and functionalities to enhance the user experience.</p><h3>Testing Your Website</h3><p>To test your website, open the index.html file in a web browser. You should see the banner section, trending movies section, trending TV shows section, upcoming movies section, and top rated movies section populated with data from the Themoviedb API.</p><p>Congratulations! You have successfully built a movie and TV show website using the Themoviedb API. You can further expand and improve this project by adding search functionality, movie details pages, TV show details pages, and more.</p><p>Remember to keep your API key secure and avoid committing it to a public repository.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b0cc57e1267" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Experience as a Web Developer Intern at Let’s Grow More (LGM) Virtual Internship Program (LGMVIP…]]></title>
            <link>https://medium.com/@yosami14/my-experience-as-a-web-developer-intern-at-lets-grow-more-lgm-virtual-internship-program-lgmvip-840003709a09?source=rss-46ae8106fc1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/840003709a09</guid>
            <category><![CDATA[letsgrowmore]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Fri, 30 Jun 2023 16:32:29 GMT</pubDate>
            <atom:updated>2023-06-30T16:32:29.805Z</atom:updated>
            <content:encoded><![CDATA[<h3>My Experience as a Web Developer Intern at Let’s Grow More (LGM) Virtual Internship Program (LGMVIP 2023)</h3><p>Hello everyone! In this article, I will be sharing my experience as an intern at Let’s Grow More (LGM) during their Virtual Internship Program (LGMVIP 2021) as a Web Developer. This program lasted for a month and was filled with valuable new knowledge.</p><p>As a Web Developer intern, my responsibilities included completing a minimum of two tasks from a list of three, utilizing relevant technologies. The tasks were as follows:</p><p>1. Beginner Level Task: Developing a web application using create-react-app and creating a to-do list using HTML, CSS, and JavaScript. I successfully completed this task and gained hands-on experience in building interactive web applications and managing user tasks.</p><p>2. Intermediate Level Task: Designing a registration form that displays the entered data on the same page using HTML, CSS, JavaScript, or ReactJS. I successfully completed this task and gained proficiency in creating user-friendly registration forms with real-time data display.</p><p>3. Advanced Level Task: Student Result Management System (titled “05 Advance LEVEL Task”). Although I did not complete this task, I gained valuable insights into managing and organizing student results within a system.</p><p>Throughout the internship, I had the opportunity to work on diverse projects such as a calculator, to-do list, and registration form. These projects allowed me to apply my knowledge, enhance my problem-solving skills, and further develop my proficiency as a web developer.</p><p>Overall, my internship experience at Let’s Grow More was enriching, and I am grateful for the opportunity to learn and grow in a supportive environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=840003709a09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Harmony Harvest (Equib)]]></title>
            <link>https://medium.com/@yosami14/harmony-harvest-equib-4acea8bb6924?source=rss-46ae8106fc1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4acea8bb6924</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[event-listener]]></category>
            <category><![CDATA[dom-manipulation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sam]]></dc:creator>
            <pubDate>Fri, 23 Jun 2023 19:39:39 GMT</pubDate>
            <atom:updated>2023-06-23T19:39:39.683Z</atom:updated>
            <content:encoded><![CDATA[<p>Harmony Harvest (Equib) is a website built to cultivate wealth as a community, drawing inspiration from traditional Ethiopian culture and bridging the gap between traditional and modern practices. It provides a platform for users to join and contribute to a community-driven wealth-building initiative, while incorporating elements of Ethiopia’s rich cultural heritage.</p><h4>User Registration and Contributions</h4><p>As a user on Harmony Harvest (Equib), you can enter your personal information, such as your name, contact details, and financial information. Once registered, you can make contributions towards the wealth-building initiative. These contributions can be in the form of monetary investments, sharing resources or knowledge, or any other means determined by the community.</p><p>Harmony Harvest (Equib) embraces a spirit of inclusivity and fairness by randomly selecting a winner from the participants after a certain interval. This random selection process adds an element of excitement and ensures equal opportunities for all contributors. It encourages active participation and motivates users to continue contributing towards the community’s wealth-building goals.</p><h4>Cultural Integration</h4><p>Harmony Harvest (Equib) acknowledges and respects the traditional values and practices of Ethiopia, infusing them with modern approaches to wealth creation and collaboration. The website fosters a sense of community, encourages collective effort, and embraces the principles of harmony and abundance found within Ethiopian culture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPrt_ROiu2Fj0WNi8rGQrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBQeo_7WQqsqBDXkgI5OLQ.png" /></figure><h4>How the system works</h4><p>Dependency</p><p>This project has the following dependencies:</p><ul><li>Bootstrap CSS v5.2.1</li><li>Font Awesome</li></ul><p>These dependencies are included via CDNs (Content Delivery Networks) in the HTML file.</p><blockquote>If you are interested in seeing the design of the registration webpage, you can visit <a href="https://yosami14.github.io/Harmony-Harvest/">yosami14.github.io/Harmony-Harvest/</a> to view it.</blockquote><h4>1.User fills in the form fields:</h4><p>- The JavaScript code uses the getElementById method to access the input fields in the HTML form and retrieves the values entered by the user.<br>- The values are stored in variables: firstName, fathersName, email, phoneNumber, contributionAmount, and gender.<br>- These variables will be used to create a user object that represents the data entered by the user.</p><pre>let firstName = document.getElementById(&quot;firstNameInput&quot;).value;<br>let fathersName = document.getElementById(&quot;fatherNameInput&quot;).value;<br>let email = document.getElementById(&quot;userEmailInput&quot;).value;<br>let phoneNumber = document.getElementById(&quot;userPhoneNumberInput&quot;).value;<br>let contributionAmount = document.getElementById(&quot;userContributionInput&quot;).value;<br>let gender = document.querySelector(&#39;input[name=&quot;userGender&quot;]:checked&#39;).value;<br>userObject[countOfUsers] = {<br> firstName: firstName,<br> fathersName: fathersName,<br> gender: gender,<br> email: email,<br> phoneNumber: phoneNumber,<br> contributionAmount: contributionAmount,<br> date: formattedDate<br>};</pre><h4>2. User clicks the “submit” button:</h4><p>- An event listener is attached to the “submit” button using the addEventListener method.<br>- The event listener is triggered when the button is clicked.<br>- The collectData function is called when the event is triggered.</p><pre>document.getElementById(&quot;collectDataBtn&quot;).addEventListener(&quot;click&quot;, collectData);<br>function collectData() {<br> // Code body<br>}</pre><h4>3. The collectData function is executed:</h4><p>- The collectData function is responsible for collecting the data entered by the user and processing it.<br>- It retrieves the values entered by the user from the input fields using their respective id attributes.<br>- The values are stored in variables: firstName, fathersName, email, phoneNumber, contributionAmount, and gender.<br>- The function then creates a new user object and assigns the retrieved values to its properties.<br>- The user object is stored in the userObject variable.</p><h4>4. User data is added to the table:</h4><p>- The user data is added to the HTML table by manipulating the table’s DOM (Document Object Model).<br>- The addUserToTable function is called to add the user data to the table.<br>- The function first creates a new table row (&lt;tr&gt;) and table data (&lt;td&gt;) elements.<br>- The user data is inserted into the table data elements using the textContent property.<br>- The table data elements are appended to the table row.<br>- The table row is then appended to the table’s &lt;tbody&gt; element.</p><pre><br>        // Row data print<br>        let lastObject = userObject[countOfUsers - 1];<br><br>        for (let property in lastObject) {<br>          if (lastObject.hasOwnProperty(property)) {<br>            var createRowData = document.createElement(&#39;td&#39;);<br>            createRowData.textContent = lastObject[property];<br>            createRow.appendChild(createRowData);<br>          }<br>        }<br><br>    // Append the row to the table<br>    addUserRow.appendChild(createRow);<br><br>    // append the row to the table<br>    addUserRow.appendChild(createRow);</pre><h4>5. User data is displayed on the table:</h4><p>- The user data is displayed in the HTML table, which is initially empty.<br>- When the addUserToTable function is called, it adds the user data to the table.<br>- The function creates a new table row and appends it to the table’s &lt;tbody&gt; element.<br>- The table row contains table data elements that display the user’s data in separate columns.<br>- The textContent property is used to set the content of each table data element.</p><pre>&lt;tbody class=&quot;&quot; id=&quot;addUserRow&quot;&gt;<br> &lt;! - User data will be added dynamically here →<br>&lt;/tbody&gt;</pre><h4>6. Total contribution is calculated and displayed:</h4><p>- The calculateTotalContribution function calculates the total contribution amount from all users.<br>- It iterates over the table rows and retrieves the contribution amount from each row.<br>- The contribution amounts are converted to numbers using the parseFloat function and added together.<br>- The total contribution amount is stored in the totalContribution variable.<br>- The total contribution is displayed in the table by setting the textContent of the corresponding table data element.</p><pre>// Update total contribution<br>totalContribution += parseInt(contributionAmount);<br>// Update total contribution display<br>let totalContributionElement = document.getElementById(&quot;displayTotal&quot;);<br>totalContributionElement.textContent = `Total: ${totalContribution}`;</pre><h4>7. Lot winner is generated and displayed in a modal:</h4><p>- The winner function is called when the “generate” button is clicked.<br>- The function selects a random user from the table to determine the lot winner.<br>- It retrieves the table rows using the querySelectorAll method and stores them in an array.<br>- A random index is generated using the Math.random() function and the length of the table rows array.<br>- The user at the randomly generated index is selected as the lot winner.<br>- The winner’s details (name and contribution amount) are extracted from the table.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4acea8bb6924" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>