<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ali Hassan</title>
    <description>The latest articles on Forem by Ali Hassan (@codewithhassan).</description>
    <link>https://forem.com/codewithhassan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3326101%2F74f371d5-e163-4c7e-b153-3facc0a9d252.png</url>
      <title>Forem: Ali Hassan</title>
      <link>https://forem.com/codewithhassan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/codewithhassan"/>
    <language>en</language>
    <item>
      <title>Weather Dashboard (CLI)</title>
      <dc:creator>Ali Hassan</dc:creator>
      <pubDate>Tue, 15 Jul 2025 18:43:38 +0000</pubDate>
      <link>https://forem.com/codewithhassan/weather-dashboard-cli-247c</link>
      <guid>https://forem.com/codewithhassan/weather-dashboard-cli-247c</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image
import requests

Window.clearcolor = (1, 1, 1, 1)

class Weather(App):
    def build(self):
        self.root = FloatLayout()

        # Background image
        self.background = Image(source='default.jpg', allow_stretch=True, keep_ratio=False)
        self.root.add_widget(self.background)

        # BoxLayout for UI elements
        self.boxlayout = BoxLayout(orientation="vertical", spacing=20, padding=40,
                                   size_hint=(0.9, 0.9), pos_hint={"center_x": 0.5, "center_y": 0.5})

        # Widgets
        self.label = Label(text="Weather App", color=(0, 0, 0, 1), bold=True, font_size=34)
        self.cityname = TextInput(hint_text="Enter City Name", size_hint_y=None, height=40)
        self.button = Button(text="Check Weather", size_hint_y=None, height=40,
                             size_hint_x=None, width=200,
                             pos_hint={"center_x": 0.5}, on_press=self.buttonpressed)

        self.label2 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)
        self.label3 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)
        self.label4 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)
        self.label5 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)
        self.label6 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)
        self.label7 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)
        self.label8 = Label(text="", color=(1,1,1, 1), italic=True, font_size=34)

        # Add widgets to layout
        self.boxlayout.add_widget(self.label)
        self.boxlayout.add_widget(self.cityname)
        self.boxlayout.add_widget(self.button)
        self.boxlayout.add_widget(self.label2)
        self.boxlayout.add_widget(self.label3)
        self.boxlayout.add_widget(self.label4)
        self.boxlayout.add_widget(self.label5)
        self.boxlayout.add_widget(self.label6)
        self.boxlayout.add_widget(self.label7)
        self.boxlayout.add_widget(self.label8)

        self.root.add_widget(self.boxlayout)
        return self.root

    def buttonpressed(self, instance):
        api_key = "a0e1e3df147647ebad9110730251105"
        city = self.cityname.text.strip()

        if not city:
            self.label2.text = "Please enter a city name"
            return

        url = f"http://api.weatherapi.com/v1/current.json?key={api_key}&amp;amp;q={city}"

        try:
            response = requests.get(url)
            if response.status_code == 200:
                data = response.json()
                condition = data["current"]["condition"]["text"].lower()

                # Change background image based on condition
                if "sunny" in condition:
                    self.background.source = "sunny.jpg"
                elif "rain" in condition or "drizzle" in condition:
                    self.background.source = "rainy.jpg"
                elif "cloud" in condition or "overcast" in condition:
                    self.background.source = "cloudy.jpg"
                else:
                    self.background.source = "default.jpg"

                self.background.reload()  # Refresh the image

                # Set weather details
                self.label2.text = f"City Name : {data['location']['name']}"
                self.label3.text = f"Region : {data['location']['region']}"
                self.label4.text = f"Country : {data['location']['country']}"
                self.label5.text = f"Condition : {data['current']['condition']['text']}"
                self.label6.text = f"Wind Speed : {data['current']['wind_kph']} kph"
                self.label7.text = f"Feels Like : {data['current']['feelslike_c']} °C"
                self.label8.text = f"Temperature : {data['current']['temp_c']} °C"
            else:
                self.label2.text = "Error fetching weather data"
        except Exception as e:
            self.label2.text = f"Error: {str(e)}"


if __name__ == "__main__":
    Weather().run()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Message Encoder and Decoder</title>
      <dc:creator>Ali Hassan</dc:creator>
      <pubDate>Sat, 05 Jul 2025 15:52:30 +0000</pubDate>
      <link>https://forem.com/codewithhassan/message-encoder-and-decoder-3b7b</link>
      <guid>https://forem.com/codewithhassan/message-encoder-and-decoder-3b7b</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pyperclip

def encode(message):
    secret = ""
    for char in message:
        if char.isalpha():
            base = ord("A") if char.isupper() else ord("a")
            encoded = (ord(char) - base + 3) % 26 + base
            secret += chr(encoded)
        else:
            secret += char
    pyperclip.copy(secret)
    print("✅ Encoded Message:", secret)
    print("📋 Copied to clipboard.")

def decode(message):
    original = ""
    for char in message:
        if char.isalpha():
            base = ord("A") if char.isupper() else ord("a")
            decoded = (ord(char) - base - 3) % 26 + base
            original += chr(decoded)
        else:
            original += char
    pyperclip.copy(original)
    print("✅ Decoded Message:", original)
    print("📋 Copied to clipboard.")

def main():
    while True:
        print("\n=== MESSAGE ENCODER &amp;amp; DECODER ===")
        print("1. Encode a message")
        print("2. Decode a message")
        print("3. Exit")
        choice = input("Enter your choice (1/2/3): ")

        if choice == '1':
            msg = input("Enter your message to ENCODE: ")
            encode(msg)

        elif choice == '2':
            msg = input("Enter your message to DECODE: ")
            decode(msg)

        elif choice == '3':
            print("👋 Exiting. Goodbye!")
            break
        else:
            print("❌ Invalid option. Try again.")

if __name__ == "__main__":
    main()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔗 Visit my GitHub: &lt;a href="https://github.com/AliPythonDev" rel="noopener noreferrer"&gt;AliPythonDev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>coding</category>
      <category>chatgpt</category>
    </item>
  </channel>
</rss>
