<?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 Rahul Patodi on Medium]]></title>
        <description><![CDATA[Stories by Rahul Patodi on Medium]]></description>
        <link>https://medium.com/@rahulpatodi?source=rss-d32b4f823e64------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hebmu6YafDM6W7jB4iWYoQ.jpeg</url>
            <title>Stories by Rahul Patodi on Medium</title>
            <link>https://medium.com/@rahulpatodi?source=rss-d32b4f823e64------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 22 May 2026 13:31:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahulpatodi/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[Word Count Application using Java]]></title>
            <link>https://medium.com/dataflair/word-count-application-using-java-b6612577d056?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6612577d056</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Sat, 26 Jul 2025 12:31:50 GMT</pubDate>
            <atom:updated>2025-07-26T12:31:50.528Z</atom:updated>
            <content:encoded><![CDATA[<p>The objective of our project is to implement a Word Count Application using Java Swing. Java Swing offers a robust framework for building graphical user interfaces, making it an ideal choice for creating interactive applications, such as our Word Count tool. This application allows users to input text, dynamically count words, and update the count in real-time.</p><h3>Prerequisites for Java Word Count Application</h3><p>This word count project requires a solid understanding of <a href="https://techvidvan.com/java-courses/">Java</a> programming fundamentals, particularly working with Java Swing for GUI development. Knowledge of event handling and text manipulation in Java is essential for implementing the functionality of the Word Count Application.</p><h3>Project File Structure of Java Word Count Application</h3><p>The Word Count Application in Java consists of the following:</p><h4>WordCountApp.java</h4><ul><li>The entry point of the application.</li><li>Initialises and displays the WordCountUI.</li></ul><h4>WordCountUI.java</h4><ul><li>Implements the main GUI interface using JFrame, JTextArea, JButton, and various Swing components.</li><li>Allows users to input text, dynamically updates word count on key release events, and provides a button for manual word count updates.</li><li>Utilises WordCounter class to compute word counts.</li></ul><h4>WordCounter.java</h4><ul><li>It contains a static method called countWords that calculates the number of words in a given text string.</li><li>Handles edge cases such as empty input gracefully.</li></ul><figure><img alt="Java Word Count Application" src="https://cdn-images-1.medium.com/max/1024/1*PlansjlUK6CIw8Z_fwDKrg.jpeg" /></figure><h3>Step-by-Step Implementation of Java Word Count</h3><h4>WordCountUI Class</h4><p><strong>Components Used:</strong></p><ul><li><strong>JFrame: </strong>Main application window.</li><li><strong>JTextArea: </strong>Text area for user input.</li><li><strong>JButton: </strong>Button to trigger word count updates.</li><li><strong>JScrollPane: </strong>Allows scrolling within the text area.</li></ul><p><strong>Event Handling:</strong></p><ul><li><strong>KeyListener: </strong>Updates word count on text area key release events.</li><li><strong>ActionListener (for JButton): </strong>Triggers word count update when the button is clicked.</li></ul><p><strong>Layout and Design:</strong></p><ul><li>Utilises BorderLayout and FlowLayout to organise components effectively.</li><li>Customises fonts, colours, and dimensions for aesthetic and functional purposes.</li></ul><h3><strong>Source Code and Explanation of Java Word Count</strong></h3><h4>WordCountApp.java</h4><p><strong>1. Package and Class Definition</strong></p><pre>package com.mycompany.wordcountapp; <br>public class WordCountApp {</pre><p><strong>Explanation: </strong><br>In this section, the WordCountApp class is defined within the com.mycompany.wordcountapp package. This class serves as the entry point for the Word Count Application.</p><p><strong>2. main Method</strong></p><pre> public static void main(String[] args) { <br> WordCountUI wordCountUI = new WordCountUI(); <br> wordCountUI.show(); <br> } <br>}</pre><p><strong>Explanation: </strong><br>The main method is the entry point of the application. It instantiates a WordCountUI object, which initializes the user interface for the word count application (WordCountUI is explained in detail in the next section). It then calls the show() method to display the UI to the user.</p><h4>WordCountUI.java</h4><p><strong>1. Class and Fields Declaration</strong></p><pre>package com.mycompany.wordcountapp; <br>import javax.swing.*; <br>import java.awt.*; <br>import java.awt.event.*; <br>public class WordCountUI { <br> private JFrame mainFrame; <br> private JTextArea textArea; <br> private JButton wordCountButton;</pre><p><strong>Explanation: </strong><br>This section starts by importing the necessary packages (javax.swing.* and java.awt.*). The WordCountUI class is declared, which is responsible for creating the graphical user interface (GUI) of the Word Count Application. It declares three main fields: mainFrame (the application&#39;s main window frame), textArea (for user input of text), and wordCountButton (to trigger the word count action).</p><p><strong>2. Constructor (WordCountUI())</strong></p><pre> public WordCountUI() { <br> mainFrame = new JFrame(&quot;Word Count Application&quot;); <br> mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); <br> textArea = new JTextArea(15, 40); <br> textArea.setFont(new Font(&quot;Arial&quot;, Font.PLAIN, 24)); <br> textArea.setLineWrap(true); <br> textArea.setWrapStyleWord(true); <br> textArea.addKeyListener(new KeyAdapter() { <br> @Override <br> public void keyReleased(KeyEvent e) { <br> updateWordCount(); <br> } <br> }); <br> JScrollPane scrollPane = new JScrollPane(textArea); <br> wordCountButton = new JButton(&quot;Word Count: 0&quot;); <br> wordCountButton.setFont(new Font(&quot;Arial&quot;, Font.BOLD, 28));  wordCountButton.setBackground(new Color(100, 180, 255));  wordCountButton.setForeground(Color.WHITE); <br> wordCountButton.setFocusPainted(false); <br> wordCountButton.setPreferredSize(new Dimension(300, 60));  wordCountButton.addActionListener(new ActionListener() {  @Override <br> public void actionPerformed(ActionEvent e) { <br> // Button action listener logic can be added here if required  } <br> });</pre><p><strong>Explanation: </strong><br>The constructor initialises the WordCountUI object. It starts by setting up the main frame (mainFrame) with a title and default close operation. Then, it initialises the text area with specific dimensions and formatting (font, line wrap, word wrap). A KeyListener is added to the textArea to listen for key releases, triggering the updateWordCount() method whenever the user types or modifies the text. The textArea is wrapped in a JScrollPane (scrollPane) to enable scrolling if the text overflows. Next, the wordCountButton is initialised with text, font, background, and foreground colour settings. An ActionListener is added to the button to define its behaviour when clicked.</p><p><strong>3. UI Layout Setup</strong></p><pre> JPanel panel = new JPanel(); <br> panel.setBackground(new Color(240, 240, 240)); <br> panel.setLayout(new BorderLayout()); <br> panel.add(scrollPane, BorderLayout.CENTER);<br> JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));  buttonPanel.setBackground(new Color(240, 240, 240));  buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0));  buttonPanel.add(wordCountButton); <br> mainFrame.getContentPane().setBackground(new Color(240, 240, 240));  mainFrame.getContentPane().setLayout(new BorderLayout());  mainFrame.getContentPane().add(panel, BorderLayout.CENTER);  mainFrame.getContentPane().add(buttonPanel, BorderLayout.SOUTH);  mainFrame.pack();</pre><p><strong>Explanation: </strong><br>This section sets up the layout of the GUI components. It creates two JPanel containers (panel and buttonPanel) to organise the elements within the main frame (mainFrame). The panel is set with a BorderLayout to hold the scrollPane (containing a textArea) at the centre of the frame. The buttonPanel, using FlowLayout, is placed at the bottom (BorderLayout.SOUTH) of the frame and adds the wordCountButton. The main content pane of mainFrame is configured with these panels to arrange the UI components accordingly. Finally, mainFrame.pack() is called to resize the frame based on its contents.</p><p><strong>4. updateWordCount() Method</strong></p><pre> updateWordCount(); <br> } <br> private void updateWordCount() { <br> String text = textArea.getText(); <br> int wordCount = WordCounter.countWords(text); <br> wordCountButton.setText(&quot;Word Count: &quot; + wordCount);  }</pre><p><strong>Explanation: </strong><br>The updateWordCount() method updates the word count displayed on the wordCountButton. It retrieves the current text from the text area, calculates the number of words using the WordCounter.countWords() method, and sets the text of wordCountButton to display the updated word count.</p><p><strong>5. show() Method</strong></p><pre> public void show() { <br> mainFrame.setVisible(true); <br> }</pre><p><strong>Explanation: </strong><br>The show() method makes the main frame (mainFrame) visible to the user by setting its visibility to true. This method is called after the UI components are initialised and set up in the constructor.</p><p><strong>6. main Method</strong></p><pre> public static void main(String[] args) { <br> SwingUtilities.invokeLater(new Runnable() { <br> public void run() { <br> new WordCountUI().show(); <br> } <br> }); <br> } <br>}</pre><p><strong>Explanation: </strong><br>The main method is the entry point of the application. It ensures that all Swing-related operations are performed on the Event Dispatch Thread (EDT) by invoking SwingUtilities.invokeLater(). Inside the run() method, a new instance of WordCountUI is created and its show() method is called to display the GUI to the user.</p><h4>WordCounter.java</h4><p><strong>1. Class Definition and Method</strong></p><pre>package com.mycompany.wordcountapp; <br>public class WordCounter { <br> public static int countWords(String text) { <br> if (text == null || text.isEmpty()) { <br> return 0; <br> } <br> String[] words = text.split(&quot;\\s+&quot;); <br> return words.length; <br> } <br>}</pre><p><strong>Explanation: </strong><br>This section defines the WordCounter class, which provides utility methods for counting words in a text. The countWords(String text) method takes a String parameter text, checks if it is null or empty, and returns zero if true. If the text is not empty, it splits the text into an array of words using whitespace (\\s+) as a delimiter and returns the length of the array, representing the number of words in the text.</p><h3>Java Word Count Application Output</h3><figure><img alt="Java Word Count Application Output" src="https://cdn-images-1.medium.com/max/1024/1*Ksz8mKGhfwTQOF2D4FQcyA.jpeg" /></figure><figure><img alt="Word Count Application using Java Output" src="https://cdn-images-1.medium.com/max/1024/1*eu4StGCpt2B_am1a-hmmFw.jpeg" /></figure><h3>Conclusion</h3><p>The Java Swing Word Count Application project demonstrates how Java can be used to create a tool that counts words as you type. It’s designed to be user-friendly and practical, making it a valuable learning experience in Java GUI programming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6612577d056" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataflair/word-count-application-using-java-b6612577d056">Word Count Application using Java</a> was originally published in <a href="https://medium.com/dataflair">DataFlair</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage Your Timetable using Android.]]></title>
            <link>https://medium.com/wiki-flood/manage-your-timetable-using-android-0e2dcd5f051d?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e2dcd5f051d</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Fri, 25 Jul 2025 12:31:50 GMT</pubDate>
            <atom:updated>2025-07-25T12:31:50.373Z</atom:updated>
            <content:encoded><![CDATA[<p>Timetable Manager is an application that enables users to add, manage, and sort various entries, including adding, deleting, and rearranging them.</p><p><strong>The following are the applications of the project:</strong></p><ul><li>Allow users to add entries to the database</li><li>Allow users to delete entries in the database</li><li>Allows sorting the entries as well</li></ul><p><strong>The user-interface components are:</strong></p><ul><li>An add button which allows users to add entries to the database</li><li>A delete button which deletes the entries from the database.</li></ul><h3><strong>About the Android Timetable Manager Project</strong></h3><p>The Timetable Manager is an <a href="https://techvidvan.com/tutorials/android-project-ideas/">Android</a> application that helps users efficiently manage their daily tasks and organise their schedules. This application is built with integration to Firebase, which will also provide security for your entries. The rules you publish will also be available to the users only and can be changed at any time.</p><h3><strong>Prerequisites For the Android Timetable Manager</strong></h3><p>Before we begin the project, we need to be aware of some prerequisites.</p><ul><li>OOP Concepts(Inheritance, Abstraction, etc..)</li><li>An Android Virtual Device or a USB-connected device for running the application</li><li><a href="https://developer.android.com/studio">Android Studio</a></li><li>Understanding of JAVA/Kotlin</li></ul><figure><img alt="Android Timetable Manager Project" src="https://cdn-images-1.medium.com/max/1024/1*NtEuRYm-CG4FMVBeHO5iTQ.jpeg" /></figure><h3><strong>Android Timetable Manager File Structure:</strong></h3><p>Let’s check the steps to build a tourist guide application in Android Studio.</p><ul><li>First, we have to add Firebase to the project.</li><li>Go and add the name of your project&#39;s package to Firebase.</li><li>Run the <strong><em>signingReport </em></strong>on the Android Studio Terminal and add the <strong>SHA-1 </strong>fingerprint to Firebase.</li><li>Download the <em>google-services.json </em>and paste it into your app directory in the Project.</li></ul><h3><strong>Implementation of the Android Timetable Manager</strong></h3><p>Let’s start the implementation of the project.</p><h4><strong>Step 1: Setting up the Project</strong></h4><p><strong>Create a new project in Android Studio</strong>:</p><ul><li>Open Android Studio and select “Start a new Android Studio project.”</li><li>Choose “Empty Activity” and set the project name, package name, and save location.</li><li>Configure the project with the desired SDK and language (Java or Kotlin).</li></ul><h4><strong>Step 2: Designing the UI</strong></h4><p><strong>activity_main.xml:</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;match_parent&quot;<br>   tools:context=&quot;.MainActivity&quot;&gt;<br><br><br>   &lt;androidx.recyclerview.widget.RecyclerView<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;match_parent&quot;<br>       android:padding=&quot;3dp&quot;<br>       android:clipToPadding=&quot;false&quot;<br>       android:layout_marginBottom=&quot;60dp&quot;<br>       android:id=&quot;@+id/recycler_view&quot;<br>       tools:listitem=&quot;@layout/timetable_item&quot;/&gt;<br><br><br>   &lt;com.google.android.material.floatingactionbutton.FloatingActionButton<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:id=&quot;@+id/fab&quot;<br>       android:src=&quot;@drawable/baseline_add_24&quot;<br>       android:layout_margin=&quot;16dp&quot;<br>       android:contentDescription=&quot;add_timetable_entry&quot;<br>       android:layout_alignParentBottom=&quot;true&quot;<br>       android:layout_alignParentEnd=&quot;true&quot;/&gt;<br><br><br>&lt;/RelativeLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li>We add a <strong>RecyclerView </strong>and retrieve the data from <strong><em>timetable_item.xml</em></strong> to display in a list manner.</li><li>Add a button to add the entries to the database.</li></ul><figure><img alt="Timeatable Manager" src="https://cdn-images-1.medium.com/max/373/1*n03tvsOgZNQjR8iUBb54XA.jpeg" /></figure><p><strong>timetable_item.xml:</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;wrap_content&quot;<br>   android:orientation=&quot;vertical&quot;<br>   android:padding=&quot;8dp&quot;&gt;<br><br><br>   &lt;TextView<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:id=&quot;@+id/tv_Subject&quot;<br>       android:text=&quot;Subject&quot;<br>       android:textSize=&quot;18sp&quot;<br>       android:textStyle=&quot;bold&quot;/&gt;<br><br><br>   &lt;TextView<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:id=&quot;@+id/tv_Time&quot;<br>       android:text=&quot;Time&quot;<br>       android:textSize=&quot;16sp&quot;<br>       android:textStyle=&quot;bold&quot;/&gt;<br><br><br>   &lt;Button<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;-&quot;<br>       android:id=&quot;@+id/btnDelete&quot;<br>       android:textStyle=&quot;bold&quot;<br>       android:textSize=&quot;16sp&quot;<br>       android:layout_gravity=&quot;end&quot;/&gt;<br><br><br>&lt;/LinearLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li>We add a <strong>TextView </strong>for displaying the subject and time through a RecyclerView.</li><li>We add a delete button to delete the entries from the database.</li></ul><figure><img alt="Timetable Item" src="https://cdn-images-1.medium.com/max/375/1*6koLD0vMoURxS87F4IM40w.jpeg" /></figure><h4><strong>Step 3: Implementing the Functionality</strong></h4><p><strong>MainActivity.java:</strong></p><p><strong>Code:</strong></p><pre>package com.example.timetablemanager;<br><br><br>import androidx.annotation.NonNull;<br>import androidx.appcompat.app.AlertDialog;<br>import androidx.appcompat.app.AppCompatActivity;<br>import androidx.recyclerview.widget.LinearLayoutManager;<br>import androidx.recyclerview.widget.RecyclerView;<br><br><br>import android.content.DialogInterface;<br>import android.os.Bundle;<br>import android.view.View;<br>import android.widget.EditText;<br>import android.widget.LinearLayout;<br>import android.widget.Toast;<br><br><br>import com.google.android.material.floatingactionbutton.FloatingActionButton;<br>import com.google.firebase.database.DataSnapshot;<br>import com.google.firebase.database.DatabaseError;<br>import com.google.firebase.database.DatabaseReference;<br>import com.google.firebase.database.FirebaseDatabase;<br>import com.google.firebase.database.ValueEventListener;<br><br><br>import java.util.ArrayList;<br>import java.util.List;<br><br><br>public class MainActivity extends AppCompatActivity {<br>   private RecyclerView recyclerView;<br>   private TimetableAdapter adapter;<br>   private FloatingActionButton fab;<br>   private DatabaseReference databaseReference;<br><br><br>   @Override<br>   protected void onCreate(Bundle savedInstanceState) {<br>       super.onCreate(savedInstanceState);<br>       setContentView(R.layout.activity_main);<br>       recyclerView=findViewById(R.id.recycler_view);<br>       recyclerView.setLayoutManager(new LinearLayoutManager(this));<br>       recyclerView.setHasFixedSize(true);<br>       recyclerView.addItemDecoration(new ItemDecoration(0));<br><br><br>       adapter=new TimetableAdapter();<br>       recyclerView.setAdapter(adapter);<br>       databaseReference= FirebaseDatabase.getInstance().getReference(&quot;timetable&quot;);<br>       fab=findViewById(R.id.fab);<br>       fab.setOnClickListener(new View.OnClickListener() {<br>           @Override<br>           public void onClick(View v) {<br>               openAddTimetableEntryDialog();<br>           }<br>       });<br><br><br>       loadTimetableEntries();<br>       adapter.setOnItemClickListener(new TimetableAdapter.OnItemClickListener() {<br>           @Override<br>           public void onDeleteClick(TimetableEntry entry) {<br>               deleteTimetableEntry(entry);<br>           }<br>       });<br>   }<br><br><br>   private void deleteTimetableEntry(TimetableEntry entry) {<br>       databaseReference.child(entry.getId()).removeValue();<br>   }<br><br><br>   private void loadTimetableEntries() {<br>       databaseReference.addValueEventListener(new ValueEventListener() {<br>           @Override<br>           public void onDataChange(@NonNull DataSnapshot snapshot) {<br>               List&lt;TimetableEntry&gt; entries=new ArrayList&lt;&gt;();<br>               for(DataSnapshot postSnapshot:snapshot.getChildren()){<br>                   TimetableEntry entry=postSnapshot.getValue(TimetableEntry.class);<br>                   entries.add(entry);<br>               }<br>               adapter.setEntries(entries);<br>           }<br><br><br>           @Override<br>           public void onCancelled(@NonNull DatabaseError error) {<br>               Toast.makeText(MainActivity.this,error.getMessage(), Toast.LENGTH_SHORT).show();<br>           }<br>       });<br>   }<br><br><br>   private void openAddTimetableEntryDialog() {<br>       AlertDialog.Builder builder=new AlertDialog.Builder(this);<br>       builder.setTitle(&quot;Add Timetable Entry&quot;);<br><br><br>       LinearLayout layout=new LinearLayout(this);<br>       layout.setOrientation(LinearLayout.VERTICAL);<br><br><br>       final EditText subjectInput=new EditText(this);<br>       subjectInput.setHint(&quot;Subject&quot;);<br>       layout.addView(subjectInput);<br><br><br>       final EditText timeInput=new EditText(this);<br>       timeInput.setHint(&quot;Time&quot;);<br>       layout.addView(timeInput);<br><br><br>       builder.setView(layout);<br><br><br>       builder.setPositiveButton(&quot;Add&quot;, new DialogInterface.OnClickListener() {<br>           @Override<br>           public void onClick(DialogInterface dialog, int which) {<br>               String subject=subjectInput.getText().toString();<br>               String time=timeInput.getText().toString();<br>               addTimetableEntry(subject,time);<br>           }<br>       });<br>       builder.setNegativeButton(&quot;Cancel&quot;, new DialogInterface.OnClickListener() {<br>           @Override<br>           public void onClick(DialogInterface dialog, int which) {<br>               dialog.cancel();<br>           }<br>       });<br>       builder.show();<br>   }<br>   private void addTimetableEntry(String subject, String time)<br>   {<br>       String id=databaseReference.push().getKey();<br>       TimetableEntry entry=new TimetableEntry(id,subject,time);<br>       databaseReference.child(id).setValue(entry);<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>addTimetableEntry():</strong> Adds entries to the Firebase Realtime Database</li><li><strong>openAddTimetableEntryDialog(): </strong>adds the subject and time entries to the database. Also sets various dialogues for positive and negative outcomes.</li><li><strong>deleteTimetableEntry(): </strong>Deletes entries in the database.</li></ul><p><strong>TimetableEntry.java:</strong></p><p><strong>Code:</strong></p><pre>package com.example.timetablemanager;<br><br><br>public class TimetableEntry {<br>   private String id;<br>   private String subject;<br>   private String time;<br><br><br>   public TimetableEntry(){<br><br><br>   }<br>   public TimetableEntry(String id, String subject, String time)<br>   {<br>       this.id=id;<br>       this.subject=subject;<br>       this.time=time;<br>   }<br><br><br>   public String getSubject() {<br>       return subject;<br>   }<br><br><br>   public void setSubject(String subject) {<br>       this.subject = subject;<br>   }<br><br><br>   public String getTime() {<br>       return time;<br>   }<br><br><br>   public void setTime(String time) {<br>       this.time = time;<br>   }<br><br><br>   public String getId() {<br>       return id;<br>   }<br><br><br>   public void setId(String id) {<br>       this.id = id;<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li>Used to add getters and setters for various variables such as id, time and subject.</li></ul><p><strong>TimetableAdapter.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.timetablemanager;<br><br><br>import android.view.LayoutInflater;<br>import android.view.View;<br>import android.view.ViewGroup;<br>import android.widget.Button;<br>import android.widget.TextView;<br><br><br>import androidx.annotation.NonNull;<br>import androidx.recyclerview.widget.RecyclerView;<br><br><br>import java.util.ArrayList;<br>import java.util.List;<br><br><br>public class TimetableAdapter extends RecyclerView.Adapter&lt;TimetableAdapter.TimetableHolder&gt; {<br>   private List&lt;TimetableEntry&gt; entries=new ArrayList&lt;&gt;();<br>   private OnItemClickListener listener;<br><br><br>   @NonNull<br>   @Override<br>   public TimetableHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {<br>       View itemView=LayoutInflater.from(parent.getContext()).inflate(R.layout.timetable_item,parent,false);<br>       return new TimetableHolder(itemView);<br>   }<br><br><br>   @Override<br>   public void onBindViewHolder(@NonNull TimetableHolder holder, int position) {<br>       TimetableEntry currententry=entries.get(position);<br>       holder.textViewSubject.setText(currententry.getSubject());<br>       holder.textViewTime.setText(currententry.getTime());<br>   }<br><br><br>   @Override<br>   public int getItemCount() {<br>       return entries.size();<br>   }<br>   public void setEntries(List&lt;TimetableEntry&gt; entries)<br>   {<br>       this.entries=entries;<br>       notifyDataSetChanged();<br>   }<br><br><br><br><br>   class TimetableHolder extends RecyclerView.ViewHolder{<br>       private TextView textViewSubject;<br>       private TextView textViewTime;<br>       private Button deletebutton;<br><br><br>       public TimetableHolder(View itemView){<br>           super(itemView);<br>           textViewSubject=itemView.findViewById(R.id.tv_Subject);<br>           textViewTime=itemView.findViewById(R.id.tv_Time);<br>           deletebutton=itemView.findViewById(R.id.btnDelete);<br><br><br>           deletebutton.setOnClickListener(new View.OnClickListener() {<br>               @Override<br>               public void onClick(View v) {<br>                   int position=getAdapterPosition();<br>                   if(listener!=null &amp;&amp; position!=RecyclerView.NO_POSITION)<br>                   {<br>                       listener.onDeleteClick(entries.get(position));<br>                   }<br>               }<br>           });<br>       }<br>   }<br>   public interface OnItemClickListener{<br>       void onDeleteClick(TimetableEntry entry);<br>   }<br>   public void setOnItemClickListener(OnItemClickListener listener)<br>   {<br>       this.listener=listener;<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li>Used to inflate the data items received in the <strong><em>activity_main.xml </em></strong>through <strong>RecyclerView</strong></li><li>CustomAdapter<strong> </strong>for <strong>RecyclerView</strong></li></ul><h3>Android Timetable Manager Output</h3><figure><img alt="Android Timetable Manager Output" src="https://cdn-images-1.medium.com/max/1024/1*aaTF1ogOV2ukA99mn5jpvg.jpeg" /></figure><figure><img alt="Realtime Database" src="https://cdn-images-1.medium.com/max/1024/1*qNvLVlB56DrIWYhzpDALyg.jpeg" /></figure><h3><strong>Conclusion</strong></h3><p>We have successfully made a Timetable Manager, which serves its purpose of adding tasks and entries and helps to organise them. They can also be deleted from both the app and the Firebase Console.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e2dcd5f051d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wiki-flood/manage-your-timetable-using-android-0e2dcd5f051d">Manage Your Timetable using Android.</a> was originally published in <a href="https://medium.com/wiki-flood">Wiki Flood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create an Instagram Photo Downloader using Python.]]></title>
            <link>https://datascienceflood.com/create-an-instagram-photo-downloader-using-python-a2bcbc570ec1?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2bcbc570ec1</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 12:31:49 GMT</pubDate>
            <atom:updated>2025-07-24T12:31:49.421Z</atom:updated>
            <content:encoded><![CDATA[<p>This project aims to create an Instagram Photo Downloader application using the Instaloader library to download photos from Instagram and the Tkinter library in Python to create the graphical user interface (GUI). Users can enter the URL of an Instagram post using Tkinter’s user-friendly interface. After extracting the post’s shortcode, the application downloads the image using Instaloader.</p><p>Managing downloaded content is made simple for users by providing them with the option of where to store the photo. This project streamlines the Instagram photo download process by providing a helpful tool for quickly saving favourite material to a user’s PC.</p><h3>Prerequisites for Python Instagram Photo Downloader Project</h3><p>To implement this project successfully, you should have:</p><ul><li><strong>Python Programming:</strong> A fundamental understanding of<a href="https://techvidvan.com/python-courses/"> Python</a> that covers functions, data structures, grammar, and object-oriented programming.</li><li><strong>Tkinter:</strong> knowledge of Tkinter for managing events, handling widgets (buttons, labels, etc.), generating GUI windows, and organising layouts with grid or pack managers.</li><li><strong>Instaloader:</strong> Instaloader library for downloading photos from Instagram.</li><li>Both <strong>Tkinter</strong> and <strong>Instaloader</strong> libraries should be installed in your Python environment.</li></ul><figure><img alt="Python Instagram Photo Downloader" src="https://cdn-images-1.medium.com/max/1024/1*QOImAblurJ9h0efI2EAdSg.jpeg" /></figure><h3>Step by Step Python Instagram Photo Downloader Implementation</h3><h4>Import Necessary Libraries and Modules</h4><pre>import tkinter as tk<br>from tkinter import messagebox<br>import instaloader<br>import os</pre><p><strong>Explanation:</strong></p><ul><li>The <strong>tkinter</strong> library is imported as <strong>tk</strong> for ease of use. Tkinter is the standard GUI toolkit for Python.</li><li>The <strong>messagebox</strong> and <strong>filedialog</strong> submodules from <a href="https://docs.python.org/3/library/tkinter.html">Tkinter</a> are imported to display messages to the user and to select download directories, respectively.</li><li><strong>instaloader</strong> is imported for downloading Instagram photos.</li></ul><h4>Function to Download Photo</h4><pre>def download_photo():<br>    link = entry.get()<br>    if not link:<br>        messagebox.showerror(&quot;Error&quot;, &quot;Please enter a valid Instagram post link.&quot;)<br>        return<br>    <br>    try:<br>        # Extracting shortcode from the link<br>        shortcode = link.split(&quot;/&quot;)[-2]<br><br><br>        # Creating an instance of Instaloader<br>        loader = instaloader.Instaloader()<br>        <br>        # Getting the current working directory<br>        download_directory = os.getcwd()<br>        <br>        # Downloading the post<br>        loader.download_post(instaloader.Post.from_shortcode(loader.context, shortcode), target=download_directory)<br>        <br>        messagebox.showinfo(&quot;Success&quot;, f&quot;Photo downloaded successfully to {download_directory}!&quot;)<br>    except Exception as e:<br>        messagebox.showerror(&quot;Error&quot;, f&quot;An error occurred: {e}&quot;)</pre><p><strong>Explanation:</strong></p><ul><li>The <strong>download_photo</strong> function retrieves the link from the entry widget and extracts the shortcode from the link.</li><li>An <strong>Instaloader</strong> instance is created to download the post.<br>The post is downloaded to the current directory, and a success message</li><li>is displayed. If an error occurs, an error message is shown.</li></ul><h4>Setting Up the GUI</h4><pre>root = tk.Tk()<br>root.title(&quot;Instagram Photo Downloader&quot;)<br>root.geometry(&quot;400x200&quot;)<br>root.resizable(False, False)<br><br><br># Adding a frame for better layout<br>frame = tk.Frame(root, bg=&quot;#f0f0f0&quot;)<br>frame.place(relwidth=1, relheight=1)<br><br><br># Header label<br>header_label = tk.Label(frame, text=&quot;Instagram Photo Downloader&quot;, font=(&quot;Helvetica&quot;, 16), bg=&quot;#f0f0f0&quot;)<br>header_label.pack(pady=20)<br><br><br># Label for the entry widget<br>entry_label = tk.Label(frame, text=&quot;Enter Instagram Post Link:&quot;, font=(&quot;Helvetica&quot;, 12), bg=&quot;#f0f0f0&quot;)<br>entry_label.pack(pady=5)<br><br><br># Entry widget for the link<br>entry = tk.Entry(frame, width=50, font=(&quot;Helvetica&quot;, 12))<br>entry.pack(pady=5)<br><br><br># Download button<br>download_button = tk.Button(frame, text=&quot;Download Photo&quot;, font=(&quot;Helvetica&quot;, 12), bg=&quot;#4caf50&quot;, fg=&quot;white&quot;, command=download_photo)<br>download_button.pack(pady=20)<br><br><br># Run the main loop<br>root.mainloop()</pre><p><strong>Explanation:</strong></p><ul><li>The <strong>root</strong> window is set up with a fixed size and a title.</li><li>A frame is used to manage the layout more effectively and set a background color.</li><li>The header label, entry label, entry widget, and download button are created and styled with consistent fonts and colors.</li><li>The <strong>download_button</strong> is connected to the <strong>download_photo</strong> function.</li></ul><h3>Complete Code</h3><pre>import tkinter as tk<br>from tkinter import messagebox<br>import instaloader<br>import os<br><br><br># Function to download photo<br>def download_photo():<br>    link = entry.get()<br>    if not link:<br>        messagebox.showerror(&quot;Error&quot;, &quot;Please enter a valid Instagram post link.&quot;)<br>        return<br>    <br>    try:<br>        # Extracting shortcode from the link<br>        shortcode = link.split(&quot;/&quot;)[-2]<br><br><br>        # Creating an instance of Instaloader<br>        loader = instaloader.Instaloader()<br>        <br>        # Getting the current working directory<br>        download_directory = os.getcwd()<br>        <br>        # Downloading the post<br>        loader.download_post(instaloader.Post.from_shortcode(loader.context, shortcode), target=download_directory)<br>        <br>        messagebox.showinfo(&quot;Success&quot;, f&quot;Photo downloaded successfully to {download_directory}!&quot;)<br>    except Exception as e:<br>        messagebox.showerror(&quot;Error&quot;, f&quot;An error occurred: {e}&quot;)<br><br><br># Setting up the GUI<br>root = tk.Tk()<br>root.title(&quot;Instagram Photo Downloader&quot;)<br>root.geometry(&quot;400x200&quot;)<br>root.resizable(False, False)<br><br><br># Adding a frame for better layout<br>frame = tk.Frame(root, bg=&quot;#f0f0f0&quot;)<br>frame.place(relwidth=1, relheight=1)<br><br><br># Header label<br>header_label = tk.Label(frame, text=&quot;Instagram Photo Downloader&quot;, font=(&quot;Helvetica&quot;, 16), bg=&quot;#f0f0f0&quot;)<br>header_label.pack(pady=20)<br><br><br># Label for the entry widget<br>entry_label = tk.Label(frame, text=&quot;Enter Instagram Post Link:&quot;, font=(&quot;Helvetica&quot;, 12), bg=&quot;#f0f0f0&quot;)<br>entry_label.pack(pady=5)<br><br><br># Entry widget for the link<br>entry = tk.Entry(frame, width=50, font=(&quot;Helvetica&quot;, 12))<br>entry.pack(pady=5)<br><br><br># Download button<br>download_button = tk.Button(frame, text=&quot;Download Photo&quot;, font=(&quot;Helvetica&quot;, 12), bg=&quot;#4caf50&quot;, fg=&quot;white&quot;, command=download_photo)<br>download_button.pack(pady=20)<br><br><br>root.mainloop()</pre><h3>Python Instagram Photo Downloader Output</h3><figure><img alt="Instagram Photo Downloader Output" src="https://cdn-images-1.medium.com/max/593/1*uLzBoPEr2jowVlfzLTzfOw.jpeg" /></figure><figure><img alt="Python Instagram Photo Downloader Output" src="https://cdn-images-1.medium.com/max/598/1*EMKqyZvpnE4wjp3GR-TnTQ.jpeg" /></figure><figure><img alt="Instagram Photo Downloader" src="https://cdn-images-1.medium.com/max/977/1*9qOe_TpcwtV687wdJKBUrA.jpeg" /></figure><h3>Conclusion</h3><p>This project shows how to download Instagram photographs using the Instaloader module and develop a graphical user interface (GUI) using Python’s Tkinter library. The end product is a valuable application called Instagram Photo Downloader. With Tkinter, users can input an Instagram post link in an intuitive UI. The downloading procedure is managed by Instaloader, which makes saving Instagram photographs easier. Users need to input the post link; the application downloads the photo independently.</p><p>This is a practical application for anyone who wants to save their favourite Instagram photographs directly to their computer, thanks to its user-friendly layout and effective performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2bcbc570ec1" width="1" height="1" alt=""><hr><p><a href="https://datascienceflood.com/create-an-instagram-photo-downloader-using-python-a2bcbc570ec1">Create an Instagram Photo Downloader using Python.</a> was originally published in <a href="https://datascienceflood.com">Data Science Flood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Measurement Converter using Python.]]></title>
            <link>https://projectsflood.com/create-a-measurement-converter-using-python-94887ba40860?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/94887ba40860</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 12:31:48 GMT</pubDate>
            <atom:updated>2025-07-23T12:31:48.868Z</atom:updated>
            <content:encoded><![CDATA[<p>A measurement converter is designed to convert one measurement unit into another measurement unit. These converters can handle various measurements, including length, weight, volume, and temperature.</p><h3><strong>Need for Python Measurement Converter</strong></h3><p>Measurement converters help bridge the gap between different measurement systems used worldwide. In areas where precision and accuracy are essential, reliable converters prevent errors that could compromise project integrity.</p><h3><strong>About the Python Measurement Converter</strong></h3><p>The <a href="https://techvidvan.com/tutorials/learn-python/">Python</a> project aims to develop a user-friendly measurement converter tool that can handle a wide range of measurement types. The tool will be designed to support conversions between multiple measurement systems.</p><figure><img alt="Python Measurement Converter Project" src="https://cdn-images-1.medium.com/max/1024/1*w_-n6viHdRtr4IOyUDgVFw.jpeg" /></figure><h3><strong>Prerequisites for the Python Measurement Converter</strong></h3><p>To run this <a href="https://techvidvan.com/tutorials/learn-python/">Python</a> project, the following prerequisites must be met:</p><ul><li><strong>Python:</strong> The user must have <a href="https://www.python.org/downloads/">Python installed</a> on their system.</li><li><strong>tkinter Library</strong>: This library is used to make a Windows GUI.</li></ul><h3><strong>Step-by-Step Explanation of the Python Measurement Converter Code</strong></h3><ol><li>The first step is to import the necessary libraries, which in this project are “Tkinter.” This library helps create GUIS, and the “ttk” module within Tkinter helps improve widget styling.</li></ol><pre>import tkinter as tk<br>from tkinter import ttk</pre><p>2. The “Measurement_Converter” class inherits from tk.Tk and initialise the main window with a title and a particular geometry.</p><pre>class Measurement_Converter(tk.Tk):<br>    def __init__(self):<br>        super().__init__()<br>        self.title(&quot;Measurement Converter&quot;)<br>        self.geometry(&quot;400x300&quot;)</pre><p>3. This dictionary, “conversionFunctions”, helps map measurement types with their corresponding conversion functions.</p><pre>self.conversionFunctions = {<br>            &#39;Length&#39; : self.lengthConversion,<br>            &#39;Time&#39; : self.timeConversion,<br>            &#39;Area&#39; : self.areaConversion,<br>            &#39;Mass/Weight&#39; : self.massConversion,<br>            &#39;Temperature&#39; : self.tempConversion,<br>            &#39;Plane Angle&#39; : self.angleConversion,<br>            &#39;Pressure&#39; : self.pressureConversion<br>        }</pre><p>4. The mentioned code is used to create the GUI for the Measurement Converter, including the measurement type, input value, input unit, converted unit, and result.</p><pre>self.type = ttk.Label(self, text=&quot;Measurement Type: &quot;)<br>        self.type.grid(column=0, row=0, padx=10, pady=10)<br>        self.typesMeasurement = tk.StringVar()<br>        self.type_drop = ttk.Combobox(self, textvariable=self.typesMeasurement)<br>        self.type_drop[&#39;values&#39;] = list(self.conversionFunctions.keys())<br>        self.type_drop.grid(column=1, row=0, padx=10, pady=10)<br>        self.type_drop.bind(&#39;&lt;&lt;ComboboxSelected&gt;&gt;&#39;, self.update_units)<br><br><br>        self.labelInput1 = ttk.Label(self, text=&quot;Input: &quot;)<br>        self.labelInput1.grid(column=0, row=1, padx=10, pady=10)<br>        self.labelValueInput = tk.StringVar()<br>        self.labelEntryInput = ttk.Entry(self, textvariable=self.labelValueInput)<br>        self.labelEntryInput.grid(column=1, row=1, padx=10, pady=10)<br><br><br>        self.conversionUnitLabel = ttk.Label(self, text=&quot;From Unit: &quot;)<br>        self.conversionUnitLabel.grid(column=0, row=2, padx=10, pady=10)<br>        self.fromUnit = tk.StringVar()<br>        self.fromUnit_drop = ttk.Combobox(self, textvariable=self.fromUnit)<br>        self.fromUnit_drop.grid(column=1, row=2, padx=10, pady=10)<br><br><br>        self.conversionUnitLabel = ttk.Label(self, text=&quot;To Unit: &quot;)<br>        self.conversionUnitLabel.grid(column=0, row=3, padx=10, pady=10)<br>        self.toUnit = tk.StringVar()<br>        self.toUnit_drop = ttk.Combobox(self, textvariable=self.toUnit)<br>        self.toUnit_drop.grid(column=1, row=3, padx=10, pady=10)<br><br><br>        self.buttonConvert = ttk.Button(self, text=&quot;Convert&quot;, command=self.convert)<br>        self.buttonConvert.grid(column=0, row=4, padx=10, pady=10)<br><br><br>        self.labelResult = ttk.Label(self, text=&quot;Result:&quot;)<br>        self.labelResult.grid(column=0, row=5, padx=10, pady=10)<br>        self.answerResult = ttk.Label(self, text=&quot;&quot;)<br>        self.answerResult.grid(column=1, row=5, padx=10, pady=10)</pre><p>5. This function updates the available units in the ComboBoxes based on the selected measurement type.</p><pre>def update_units(self, event):<br>        typesMeasurement = self.typesMeasurement.get()<br>        units = []<br>        if typesMeasurement == &#39;Length&#39;:<br>            units = [&#39;meters&#39;, &#39;kilometers&#39;, &#39;miles&#39;, &#39;feet&#39;, &#39;inches&#39;, &#39;centimeters&#39;]<br>        elif typesMeasurement == &#39;Time&#39;:<br>            units = [&#39;sec&#39;, &#39;min&#39;, &#39;hrs&#39;, &#39;days&#39;]<br>        elif typesMeasurement == &#39;Area&#39;:<br>            units = [&#39;square meters&#39;, &#39;square kilometers&#39;, &#39;hectares&#39;, &#39;acres&#39;, &#39;square miles&#39;]<br>        elif typesMeasurement == &#39;Mass/Weight&#39;:<br>            units = [&#39;grams&#39;, &#39;kilograms&#39;, &#39;pounds&#39;, &#39;ounces&#39;]<br>        elif typesMeasurement == &#39;Temperature&#39;:<br>            units = [&#39;C&#39;, &#39;F&#39;, &#39;K&#39;]<br>        elif typesMeasurement == &#39;Angle&#39;:<br>            units = [&#39;degrees&#39;, &#39;radians&#39;]<br>        elif typesMeasurement == &#39;Pressure&#39;:<br>            units = [&#39;Pascals&#39;, &#39;atm&#39;, &#39;bar&#39;, &#39;psi&#39;]<br><br><br>        self.fromUnit_drop[&#39;values&#39;] = units<br>        self.toUnit_drop[&#39;values&#39;] = units</pre><p>6. This function retrieves the user input, calls the appropriate conversion function, and displays the result.</p><pre>def convert(self):<br>        typesMeasurement = self.typesMeasurement.get()<br>        input_value = float(self.labelValueInput.get())<br>        first_unit = self.fromUnit.get()<br>        second_unit = self.toUnit.get()<br><br><br>        if typesMeasurement in self.conversionFunctions:<br>            result = self.conversionFunctions[typesMeasurement](input_value, first_unit, second_unit)<br>            self.answerResult.config(text=str(result))</pre><p>7. Each of the conversion functions performs unit conversions using predefined conversion factors.</p><pre>def lengthConversion(self, value, first_unit, second_unit):<br>        convert_measure = {<br>            &#39;meters&#39;: 1,<br>            &#39;kilometers&#39;: 1000,<br>            &#39;miles&#39;: 1609.34,<br>            &#39;feet&#39;: 0.3048,<br>            &#39;inches&#39;: 0.0254,<br>            &#39;centimeters&#39;: 0.01<br>        }<br>        return value * convert_measure[first_unit] / convert_measure[second_unit]<br><br><br>    def timeConversion(self, value, first_unit, second_unit):<br>        convert_measure = {<br>            &#39;sec&#39;: 1,<br>            &#39;min&#39;: 60,<br>            &#39;hrs&#39;: 3600,<br>            &#39;days&#39;: 86400<br>        }<br>        return value * convert_measure[first_unit] / convert_measure[second_unit]<br><br><br>    def areaConversion(self, value, first_unit, second_unit):<br>        convert_measure = {<br>            &#39;square meters&#39;: 1,<br>            &#39;square kilometers&#39;: 1e6,<br>            &#39;hectares&#39;: 1e4,<br>            &#39;acres&#39;: 4046.86,<br>            &#39;square miles&#39;: 2.59e6<br>        }<br>        return value * convert_measure[first_unit] / convert_measure[second_unit]<br><br><br>    def massConversion(self, value, first_unit, second_unit):<br>        convert_measure = {<br>            &#39;grams&#39;: 1,<br>            &#39;kilograms&#39;: 1000,<br>            &#39;pounds&#39;: 453.592,<br>            &#39;ounces&#39;: 28.3495<br>        }<br>        return value * convert_measure[first_unit] / convert_measure[second_unit]<br><br><br>    def tempConversion(self, value, first_unit, second_unit):<br>        if first_unit == &#39;C&#39;:<br>            if second_unit == &#39;F&#39;:<br>                return value * 9/5 + 32<br>            elif second_unit == &#39;K&#39;:<br>                return value + 273.15<br>        elif first_unit == &#39;F&#39;:<br>            if second_unit == &#39;C&#39;:<br>                return (value - 32) * 5/9<br>            elif second_unit == &#39;K&#39;:<br>                return (value - 32) * 5/9 + 273.15<br>        elif first_unit == &#39;K&#39;:<br>            if second_unit == &#39;C&#39;:<br>                return value - 273.15<br>            elif second_unit == &#39;F&#39;:<br>                return (value - 273.15) * 9/5 + 32<br><br><br>    def angleConversion(self, value, first_unit, second_unit):<br>        convert_measure = {<br>            &#39;degrees&#39;: 1,<br>            &#39;radians&#39;: 57.2958<br>        }<br>        return value * convert_measure[first_unit] / convert_measure[second_unit]<br><br><br>    def pressureConversion(self, value, first_unit, second_unit):<br>        convert_measure = {<br>            &#39;Pascals&#39;: 1,<br>            &#39;atm&#39;: 101325,<br>            &#39;bar&#39;: 100000,<br>            &#39;psi&#39;: 6894.76<br>        }<br>        return value * convert_measure[first_unit] / convert_measure[second_unit] </pre><p>8. This code creates an instance of the “Measurement Converter” class and runs the application.</p><pre>if __name__ == &quot;__main__&quot;:<br>    app = Measurement_Converter()<br>    app.mainloop()</pre><h3><strong>Python Measurement Converter Output</strong></h3><ol><li>This is the launch page for the activity, which displays four entries: measurement type, input, and the units from and to, along with a single “convert” button and a result section.</li></ol><figure><img alt="Python Measurement Converter Interface" src="https://cdn-images-1.medium.com/max/592/1*QUhu1RSWkRR7nCQ2MxehZw.jpeg" /></figure><p>2. The user has entered all the entries and pressed the convert button to produce the result.</p><figure><img alt="Python Measurement Converter Output" src="https://cdn-images-1.medium.com/max/600/1*gicLoHsi3H5-MYIaIQJf7A.jpeg" /></figure><figure><img alt="Python Measurement Converter" src="https://cdn-images-1.medium.com/max/592/1*gPTQ5dUvLmQJi2D5iVSeBg.jpeg" /></figure><p>3. This is the final stage of the application, which provides the output of the input entries and enables the user to utilise this result as needed.</p><figure><img alt="Measurement Converter using Python" src="https://cdn-images-1.medium.com/max/600/1*4vt07gJ4eyWFuWCHUHgqvA.jpeg" /></figure><h3><strong>Conclusion</strong></h3><p>This project resulted in the creation of a graphical user interface application using Python’s “tkinter” library to convert various measurements. Measurement Converter allows users to convert values between units, including length, time, area, mass/weight, temperature, plane angle, and pressure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94887ba40860" width="1" height="1" alt=""><hr><p><a href="https://projectsflood.com/create-a-measurement-converter-using-python-94887ba40860">Create a Measurement Converter using Python.</a> was originally published in <a href="https://projectsflood.com">ProjectsFlood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Color Picker Project]]></title>
            <link>https://tutorialsflood.com/java-color-picker-project-c9f9793ee5e0?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f9793ee5e0</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 12:33:05 GMT</pubDate>
            <atom:updated>2025-07-22T12:33:05.470Z</atom:updated>
            <content:encoded><![CDATA[<p>The Color Picker application is a straightforward Java Swing project designed to provide a hands-on experience with graphical user interfaces (GUIs). This application allows users to select colors using Java’s built-in JColorChooser dialog and see the changes reflected immediately on the text color. The project is a practical introduction to Swing components and event handling, making it an excellent starting point for those looking to delve into Java GUI development.</p><h3><strong>About Java Color Picker Application</strong></h3><p>The Color Picker is a simple graphical user interface (GUI) <a href="https://techvidvan.com/java-courses/">Java</a> application that allows users to choose a color and change the color of the text. It provides an interactive way to select colors using Java’s built-in JColorChooser dialogue, demonstrating the use of Swing components and event handling.</p><h3>Color Picker App Functionalities</h3><ul><li><strong>Text Display:</strong> The application shows a label with customizable text.</li><li><strong>Color Selection: </strong>Users can click a button to open a color chooser dialog.</li><li><strong>Real-time Update:</strong> The text color changes immediately upon color selection.</li><li><strong>Responsive Layout:</strong> The app utilises FlowLayout for a simple and responsive design.</li></ul><figure><img alt="Java Color Picker App Project" src="https://cdn-images-1.medium.com/max/1024/1*zc_VHQHT8S5WjrUAhco6IQ.jpeg" /></figure><h3>Prerequisites for Color Picker App</h3><ul><li><strong>IDE Used:</strong> <a href="https://www.jetbrains.com/idea/download/other.html">IntelliJ IDEA</a> Community Edition 2024.1</li><li>Java should be installed on the machine.</li><li>Basic knowledge of Java and Swing.</li></ul><h3>Steps to Create a Color Picker App</h3><h4>Import necessary packages</h4><ul><li>We import Java Swing and AWT packages to create GUI components and handle events.</li></ul><pre>import javax.swing.*;<br>import java.awt.*;<br>import java.awt.event.ActionEvent;<br>import java.awt.event.ActionListener;</pre><h4>Create a custom JFrame class</h4><ul><li>We extend <strong>JFrame</strong> and implement <strong>ActionListener</strong> to create the main application window and handle button clicks.</li><li>Then, we define a <strong>JLabel</strong> for text display and a <strong>JButton</strong> to open the color chooser. When the user clicks on the button, the JColorChooser dialog is activated, which opens a new window with the title ”Choose color” and a default color selected as black.</li><li>We then set up the frame with a title, layout, close operation, and size and added the components.</li></ul><pre>public class MyFrame extends JFrame implements ActionListener {<br>   JLabel label;<br>   JButton button;<br>   MyFrame(){<br>       label = new JLabel();<br>       label.setText(&quot;Change Color of this text :)&quot;);<br>       label.setBackground(Color.WHITE);<br>       label.setFont(new Font(&quot;Times New Roman&quot;, Font. PLAIN,50));<br>       label.setOpaque(true);<br><br><br>       button = new JButton(&quot;Choose Color&quot;);<br>       button.addActionListener(this);<br><br><br>       this.setTitle(&quot;Color Picker&quot;);<br>       this.setLayout(new FlowLayout());<br>       this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br>       this.setSize(500,500);<br>       this.add(button);<br>       this.add(label);<br>       this.pack();<br>       this.setVisible(true);<br>   }</pre><h4>Implement the action listener for color selection</h4><ul><li>In the <strong>actionPerformed</strong> method, we use “If Else” to check if the button was clicked.</li><li>If the button is clicked, we show the <strong>JColorChooser</strong> dialog.</li><li>After the user chooses a colour, it is loaded in color “c,” using which the color of the Foreground, that is, the text color, is set the same as the user selected.</li></ul><pre> @Override<br>   public void actionPerformed(ActionEvent e) {<br>       if(e.getSource()==button){<br>           JColorChooser cc = new JColorChooser();<br>           Color c = JColorChooser.showDialog(null,&quot;Choose color&quot;,Color.BLACK);<br>           label.setForeground(c);<br>       }<br>   }<br>}</pre><h4>Main method in a separate class:</h4><ul><li>An instance of <strong>MyFrame</strong> is created to run the application.</li></ul><pre>public class Main{<br>   public static void main(String[] args) {<br>       new MyFrame();<br>   }<br>}</pre><h3>Complete Code</h3><pre>import javax.swing.*;<br>import java.awt.*;<br>import java.awt.event.ActionEvent;<br>import java.awt.event.ActionListener;<br><br><br>public class MyFrame extends JFrame implements ActionListener {<br>   JLabel label;<br>   JButton button;<br>   MyFrame(){<br>       label = new JLabel();<br>       label.setText(&quot;Change Color of this text :)&quot;);<br>       label.setBackground(Color.WHITE);<br>       label.setFont(new Font(&quot;Times New Roman&quot;, Font. PLAIN,50));<br>       label.setOpaque(true);<br><br><br>       button = new JButton(&quot;Choose Color&quot;);<br>       button.addActionListener(this);<br><br><br>       this.setTitle(&quot;Color Picker&quot;);<br>       this.setLayout(new FlowLayout());<br>       this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br>       this.setSize(500,500);<br>       this.add(button);<br>       this.add(label);<br>       this.pack();<br>       this.setVisible(true);<br>   }<br>   @Override<br>   public void actionPerformed(ActionEvent e) {<br>       if(e.getSource()==button){<br>           JColorChooser cc = new JColorChooser();<br>           Color c = JColorChooser.showDialog(null,&quot;Choose color&quot;,Color.BLACK);<br>           label.setForeground(c);<br>       }<br>   }<br>}</pre><h3>Java Color Picker App Output</h3><ul><li>When the main class is ruined, a window with the title “Color Picker” pops up, with a button that changes the color of the text.</li></ul><figure><img alt="Java Color Picker App" src="https://cdn-images-1.medium.com/max/852/1*5B_Sz8Nw1DuUUaCDcgwNvg.jpeg" /></figure><ul><li>After pressing the button, the following dialog of JColorChooser pops up.</li></ul><figure><img alt="Choose Color" src="https://cdn-images-1.medium.com/max/762/1*aOfVQ2Y7CYltVqycQTvCMg.jpeg" /></figure><ul><li>Users can choose any color.</li></ul><figure><img alt="Java Color Picker Output" src="https://cdn-images-1.medium.com/max/762/1*rwP0ufAbJXwA8wdVe-MG3A.jpeg" /></figure><ul><li>After pressing ok, the color chosen is applied to the text.</li></ul><figure><img alt="Java Color Picker Final Output" src="https://cdn-images-1.medium.com/max/852/1*00D6UF97pldFh1DgxxfyXg.jpeg" /></figure><h3>Conclusion</h3><p>This project demonstrates the creation of a user-friendly Color Picker application using Java Swing. It showcases the use of JFrame, JLabel, JButton, and JColorChooser components. The application allows users to interactively change the color of displayed text, providing a practical example of event handling and GUI updates in Java Swing. This project is an excellent starting point for learning about Java GUI development. It can be extended with additional features like saving color choices or applying colors to different UI elements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f9793ee5e0" width="1" height="1" alt=""><hr><p><a href="https://tutorialsflood.com/java-color-picker-project-c9f9793ee5e0">Java Color Picker Project</a> was originally published in <a href="https://tutorialsflood.com">Tutorials Flood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Project — Regex Query Tool]]></title>
            <link>https://pythonflood.com/python-project-regex-query-tool-15e14c9f356b?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/15e14c9f356b</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 12:31:26 GMT</pubDate>
            <atom:updated>2025-07-21T12:31:26.689Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Project — Regex Query Tool</h3><p>A regex query tool is a software utility designed to help create, test and execute regular expressions. Regular Expressions are sequences of characters that form search patterns and are primarily used for string matching and manipulation.</p><h3><strong>Need for a Python Regex Query Tool</strong></h3><p>There is a need to develop a regex query tool because working with regular expressions entails intricate work that demands precision. Regex patterns are expressed in a cryptic, specialised format that is difficult to correct for more complex cases. Mistakes in the use of regular expressions (regex) are likely to result in incorrect results when analysing data, and it may require a significant amount of resources to identify the problem. Hence, a regular expression (regex) query tool is needed.</p><h3><strong>About Python Regex Query Tool</strong></h3><p>This <a href="https://techvidvan.com/python-courses/">Python</a> project aims to develop a user-friendly regular expression (regex) query tool. The tool will allow users to input and test regular expressions against various sample texts.</p><h3><strong>Prerequisites for </strong>Python Regex Query Tool</h3><p>To run this project, the following prerequisites must be met:</p><ul><li><strong>Python:</strong> The user must have Python installed on their system.</li><li><strong>Understanding of Regex:</strong> A solid grasp of regex syntax and operations.</li><li><strong>tkinter Library:</strong> This library is used to make a Windows GUI.</li></ul><figure><img alt="Python Regex Query Tool Project" src="https://cdn-images-1.medium.com/max/1024/1*YYfqKTZDNvSG_eEmH2GPMw.jpeg" /></figure><h3><strong>Step by Step Explanation of the Code</strong></h3><p>The following set of Python code assists in developing a basic GUI application in the Python language using the <a href="https://docs.python.org/3/library/tkinter.html">Tkinter</a> toolkit for a regular expression (regex) query tool.</p><p><strong>Here is a detailed explanation of the code:</strong></p><h4>Importing Necessary Libraries</h4><pre>import tkinter as tkin<br>from tkinter import ttk<br>from tkinter import scrolledtext<br>import re</pre><ul><li><strong>tkinter: </strong>It is used to create the application window</li><li><strong>ttk:</strong> It provides access to the Tk themed widget set.</li><li><strong>scrolledtext: </strong>It creates scrollable text areas for entering the text to search.</li><li><strong>re: </strong>It is used to compile and search for patterns within text.</li></ul><h4>Class Definition and Initialisation</h4><pre>class RegexQueryTool:<br>    def __init__(self, root):<br>        self.root = root<br>        self.root.title(&quot;Regex-Query-Tool&quot;)<br>        self.create_widgets()</pre><p>The ‘RegexQueryTool’ class contains all the functionality of the regex query tool. The constructor initialises the main window and sets its title. It is also called the ‘create_widgets’ method, which sets up the user interface.</p><h4>Creating Widgets</h4><pre> def create_widgets(self):<br>        self.regex_label = ttk.Label(self.root, text=&quot;Enter Regex Pattern:&quot;)<br>        self.regex_label.grid(column=0, row=0, padx=10, pady=5, sticky=tkin.W)<br>        self.regex_entry = ttk.Entry(self.root, width=50)<br>        self.regex_entry.grid(column=1, row=0, padx=10, pady=5)<br>        self.text_label = ttk.Label(self.root, text=&quot;Enter Text to Search:&quot;)<br>        self.text_label.grid(column=0, row=1, padx=10, pady=5, sticky=tkin.W)<br>        self.text_area = scrolledtext.ScrolledText(self.root, width=50, height=10, wrap=tkin.WORD)<br>        self.text_area.grid(column=1, row=1, padx=10, pady=5)<br>        self.search_button = ttk.Button(self.root, text=&quot;Search&quot;, command=self.search_regex)<br>        self.search_button.grid(column=1, row=2, padx=10, pady=10, sticky=tkin.E)<br>        self.result_label = ttk.Label(self.root, text=&quot;Results:&quot;)<br>        self.result_label.grid(column=0, row=3, padx=10, pady=5, sticky=tkin.W)<br>        self.result_area = scrolledtext.ScrolledText(self.root, width=50, height=10, wrap=tkin.WORD)<br>        self.result_area.grid(column=1, row=3, padx=10, pady=5)</pre><p>The ‘create_widgets’ function helps create the labels and input boxes for Regex Pattern input, Text to Search Input, Search Button, and Results Display.</p><h4>Search Function</h4><pre>def search_regex(self):<br>        pattern = self.regex_entry.get()<br>        text = self.text_area.get(&quot;1.0&quot;, tkin.END)<br>        self.result_area.delete(&quot;1.0&quot;, tkin.END)<br>        try:<br>            match_phrase = re.findall(pattern, text)<br>            if match_phrase:<br>                for match in match_phrase:<br>                    self.result_area.insert(tkin.END, match + &quot;\n&quot;)<br>            else:<br>                self.result_area.insert(tkin.END, &quot;No match_phrase found.&quot;)<br>        except re.error as e:<br>            self.result_area.insert(tkin.END, f&quot;Regex error: {e}&quot;)</pre><p>This method helps search for words or phrases in the input text according to the provided regular expression and displays the results in the output section.</p><h4>Starting the Main Event Loop</h4><pre>if __name__ == &quot;__main__&quot;:<br>    root = tkin.Tk()<br>    app = RegexQueryTool(root)<br>    root.mainloop()</pre><p>It helps create the main window and starts the Tkinter event loop, which waits for user interaction.</p><h3><strong>Python Regex Query Tool Output</strong></h3><ol><li>This is the initial state of the Regex Query Tool application upon launch. The window contains three labeled entry fields: one for the regex pattern, one for the text to search and one for the results. The “Search” button is displayed below the entry fields, ready for the user to input the text.</li></ol><figure><img alt="Python Regex Query Tool Output" src="https://cdn-images-1.medium.com/max/860/1*1l_IRGplNDErpTiyBm4bmQ.jpeg" /></figure><p>2. The user has entered a regex pattern sentence into the first entry field. The entry field labeled “Enter Text to search” is filled with the user’s input, and the “Search” button is now ready to be clicked to process this text.</p><figure><img alt="Regex Query Tool Output" src="https://cdn-images-1.medium.com/max/852/1*hm2caTQDRWa7JwyELIJ96w.jpeg" /></figure><figure><img alt="Regex Query Tool using Python" src="https://cdn-images-1.medium.com/max/855/1*VFCTtcUPQC_GL_gL8Vm7qQ.jpeg" /></figure><p>3. In this step, the user has clicked the “Search” button after entering the text. The application is processing the request. The entry fields remain visible, but the output text field remains empty while the request is processed.</p><figure><img alt="Regex Query Tool" src="https://cdn-images-1.medium.com/max/856/1*1GQblIAqDAJxso1O-L7s3A.jpeg" /></figure><p>4. After processing the text, the application displays the output text in the second field, labelled “Results”. The user can now use this text as needed.</p><figure><img alt="Python Regex Query Tool Project Output" src="https://cdn-images-1.medium.com/max/856/1*jxQEtdpUVwYwhswVk1WioA.jpeg" /></figure><h3><strong>Summary</strong></h3><p>The regex query tool is essential for anyone working with regular expressions. In this project, we are developing a tool using Python and Tkinter that helps users understand regular expressions. The above code yields an accessible and user-friendly regex query tool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15e14c9f356b" width="1" height="1" alt=""><hr><p><a href="https://pythonflood.com/python-project-regex-query-tool-15e14c9f356b">Python Project — Regex Query Tool</a> was originally published in <a href="https://pythonflood.com">PythonFlood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ClickOmania Game in Python —  Design, Code, and Play]]></title>
            <link>https://pythonflood.com/clickomania-game-in-python-design-code-and-play-ba7f298d36a0?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba7f298d36a0</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 12:37:18 GMT</pubDate>
            <atom:updated>2025-03-31T12:37:18.632Z</atom:updated>
            <content:encoded><![CDATA[<h3>ClickOmania Game in Python — Design, Code, and Play</h3><p>ClickOmania, also known as SameGame, is a popular tile-matching puzzle game that originated in the 1980s. In the traditional version: The game board is filled with tiles of different colors.</p><p>Players click on groups of two or more adjacent tiles of the same color. When clicked, these tiles disappear, and the tiles above fall to fill the gaps. In most cases, the objective is to remove a majority of the tiles if not all, which makes a player the winner.</p><p>This is achieved by accumulating points depending on the number of tiles cleared with every move — more tiles cleared mean more points scored. The difficulty level increases significantly as the number of remaining matching groups decreases.</p><p>Over time, ClickOmania has had many versions that differ in board size; some have unique special tile effects, while others have different scoring systems.</p><h3><strong>Need for Python ClickOmania Game</strong></h3><p>ClickOmania-style games serve several purposes:</p><ul><li><strong>Entertainment:</strong> They provide a fun, engaging puzzle experience.</li><li><strong>Cognitive exercise:</strong> These games can help improve pattern recognition and strategic thinking.</li><li><strong>Stress relief:</strong> The simple mechanics and satisfying tile-clearing can be relaxing.</li><li><strong>Time management:</strong> They’re excellent for short gaming sessions or passing time.</li></ul><figure><img alt="Python Click-O-Mania Game" src="https://cdn-images-1.medium.com/max/1024/1*DJCllyPeqT8xkg9gdHvDkQ.jpeg" /></figure><h3><strong>About </strong>Python ClickOmania Game</h3><p>Vampire Frenzy takes the concept of ClickOmania and adds a vampire twist.</p><p><strong>But it goes beyond just changing the visuals:</strong></p><ul><li>Instead of clearing groups of same-coloured tiles, players match pairs of vampire-related items like fangs or chalices, creating a focus on memory-matching over group-clearing gameplay, similar to Concentration.</li><li>The vampire theme isn’t just for show; it’s integrated into gameplay mechanics. Your life meter is represented by a count of “Souls.” Successful matches boost the Soul count and reduce the number of “prey,” while mismatches lower the Soul count, adding risk to every move.</li><li>The main objective is to match all pairs before running out of Souls, creating a more narrative-driven environment than typical ClickOmania games.</li><li>The game uses a darker color scheme, vampire-related item names, and features like high score tracking to add replay value and competition.</li></ul><p>By combining <a href="https://techvidvan.com/python-courses/">Python</a> ClickOmania, memory games, and vampire lore elements, Vampire Frenzy offers a unique puzzle experience beyond simple tile-matching, providing players a themed and strategic gameplay challenge.</p><h3><strong>Prerequisites for </strong>Python ClickOmania Game</h3><p>To run the project, you need the following:</p><ul><li><a href="https://www.python.org/">Python</a> installed on your system.</li><li>The tkinter library (usually comes with Python).</li></ul><h3>Step by Step Implementation of Python ClickOmania Game</h3><p>This Python code uses the Tkinter library to create a GUI application for the Vampire Frenzy game. Here’s a detailed breakdown of the code:</p><h4><strong>Import necessary libraries</strong></h4><pre>import tkinter as tk<br>import random</pre><ul><li><strong>`tkinter as tk`: </strong>The code imports the Tkinter library, Python’s standard GUI toolkit, to create visual elements like windows, buttons, and labels using the abbreviation `tk`.</li><li><strong>`random`:</strong> This imports Python’s built-in random module. In this game, it is used to shuffle items, ensuring that each game has a different arrangement of items on the grid.</li></ul><h4><strong>Vampirefrenzy Class Definition</strong></h4><pre>class Vampirefrenzy:<br>    def __init__(self, window):<br>        self.window = window<br>        self.window.title(&quot;Vampire Frenzy&quot;)<br>        self.window.geometry(&quot;800x750&quot;)<br>        self.window.config(bg=&quot;#282A36&quot;)<br><br><br>        self.items = {<br>            &quot;Fang&quot;: &quot;#FF79C6&quot;, &quot;Mirror&quot;: &quot;#8BE9FD&quot;, &quot;Chalice&quot;: &quot;#FFD700&quot;,<br>            &quot;Wing&quot;: &quot;#BD93F9&quot;, &quot;Flower&quot;: &quot;#50FA7B&quot;, &quot;Blood&quot;: &quot;#880808&quot;,<br>            &quot;Feather&quot;: &quot;#F1FA8C&quot;, &quot;Nail&quot;: &quot;#6272A4&quot;<br>        }  <br>        self.blood = 100<br>        self.prey = 8<br>        self.first_pick = None<br>        self.moves = 0<br><br><br>        self.setup_ui()<br>        self.create_grid()</pre><ul><li><strong>class VampireFrenzy:</strong> Defines the game’s main class. All game logic and UI elements are encapsulated within this class.</li><li>def __init__(self, window):</li><li>Constructor method for the class. It is called when a new instance of the class is created.</li><li>self.window = window Stores the main Tkinter window of the passed class.</li><li>self.window.title(“Vampire Frenzy”) Sets the window title.</li><li>self.window.geometry(“800x750”) Sets the initial window size to 800x750 pixels.</li><li>self.window.config(bg=”#282A36&quot;) Sets the background color of the window using the hexadecimal color code.</li><li>self.items = {} This dictionary stores game items (keys) and their assigned colors (values).</li><li>self.blood = 100 Initializes the player’s blood (or souls) count.</li><li>self.prey = 8 Sets the initial number of prey (pairs to match).</li><li>self.first_pick = None Saves the first item picked in a turn.</li><li>self.moves = 0 Initializes the move counter.</li><li>self.setup_ui() Calls methods to set up the UI.</li><li>self.create_grid() Calls a method to create the game grid.</li></ul><h4><strong>User interface settings</strong></h4><pre>    def setup_ui(self):<br>        self.font = (&quot;Arial&quot;, 14, &quot;bold&quot;)<br>       <br>        tk.Label(self.window, text=&quot;Vampire frenzy&quot;, font=(&quot;Arial&quot;, 28, &quot;bold&quot;),<br>                 bg=&quot;#282A36&quot;, fg=&quot;#780606&quot;).pack(pady=10)<br><br><br>        self.info_frame = tk.Frame(self.window, bg=&quot;#282A36&quot;)<br>        self.info_frame.pack(fill=tk.X, padx=20, pady=10)<br><br><br>        self.blood_label = tk.Label(self.info_frame, text=f&quot;Souls: {self.blood}&quot;,<br>                                     font=self.font, bg=&quot;#282A36&quot;, fg=&quot;#780606&quot;)<br>        self.blood_label.pack(side=tk.LEFT)<br><br><br>        self.prey_label = tk.Label(self.info_frame, text=f&quot;Prey: {self.prey}&quot;,<br>                                      font=self.font, bg=&quot;#282A36&quot;, fg=&quot;#BD93F9&quot;)<br>        self.prey_label.pack(side=tk.RIGHT)<br><br><br>        self.grid_frame = tk.Frame(self.window, bg=&quot;#44475A&quot;, padx=15, pady=15)<br>        self.grid_frame.pack(pady=10)<br><br><br>        self.result_label = tk.Label(self.window, text=&quot;&quot;, font=self.font,<br>                                      bg=&quot;#282A36&quot;, fg=&quot;#F8F8F2&quot;, wraplength=600)<br>        self.result_label.pack(pady=10)<br><br><br>        self.reset_button = tk.Button(self.window, text=&quot;New Game&quot;, command=self.new_game,<br>                  font=self.font, bg=&quot;#6272A4&quot;, fg=&quot;#F8F8F2&quot;, activebackground=&quot;#44475A&quot;)<br>        self.reset_button.pack(pady=10)</pre><ul><li><strong>`self.font = (“Arial”, 14, “bold”)`:</strong> Defines the default font for UI elements.</li><li><strong>`tk.Label(self.window, )`:</strong> Creates a label for the main game title.</li><li><strong>`self.info_frame = tk.Frame()`:</strong> Creates a frame to store game information.</li><li><strong>`self.blood_label` and `self.prey_label`:</strong> Create labels to display the current soul count and remaining loot.</li><li><strong>`self.grid_frame = tk.Frame()`: </strong>Creates a frame for the game grid.</li><li><strong>`self.result_label`:</strong> Creates a label to display game results or messages.</li><li><strong>`self.reset_button`: </strong>Creates a button to start a new game.</li><li>The `pack()` method arranges these elements in the window.</li></ul><h4><strong>Creating a game grid</strong></h4><pre>    def create_grid(self):<br>        item_list = list(self.items.items()) * 2<br>        random.shuffle(item_list)<br><br><br>        for row in range(4):<br>            for col in range(4):<br>                item, color = item_list.pop()<br>                btn = tk.Button(self.grid_frame, text=&quot;|+|&quot;, width=10, height=3,<br>                                font=self.font, bg=&quot;#44475A&quot;, fg=&quot;#F8F8F2&quot;,<br>                                command=lambda r=row, c=col: self.reveal(r, c))<br>                btn.grid(row=row, column=col, padx=5, pady=5)<br>                btn.item = item<br>                btn.color = color</pre><p><strong>item_list = list(self.items.items()) * 2:</strong> Creates a list of item-color pairs, doubled to create matching pairs.</p><p><strong>random.shuffle(item_list):</strong> Randomly shuffles the list of items.</p><p><strong>Nested loops create a 4x4 grid of buttons:</strong></p><ul><li>Each button starts with the text “|+|” to hide its item.</li><li>command=lambda r=row, c=col: self.reveal(r, c): Sets up a function to call self.reveal when the button is clicked.</li><li>btn.item and btn.color: Store the item and color as attributes of the button for later use</li></ul><h4><strong>Item Reveal</strong></h4><pre> def reveal(self, row, col):<br>        button = self.grid_frame.grid_slaves(row=row, column=col)[0]<br>       <br>        if button[&#39;text&#39;] != &quot;|+|&quot;:<br>            return<br><br><br>        button.config(text=button.item, bg=button.color)<br>       <br>        if not self.first_pick:<br>            self.first_pick = button<br>        else:<br>            self.moves += 1<br>            self.window.after(666, lambda: self.check_match(button))</pre><ul><li>In the code, when we use `button = self.grid_frame.grid_slaves(row=row, column=column)[0]` loads a button at the specified grid position.</li><li>To check if the button has already been exposed, we can use the condition `if button[‘text’] != “|+|”`.</li><li>To reveal an item by changing the text and background color of the button, we can use the code: `button.config(text=button.item, bg=button.color)`.</li><li>When it’s the first pick in the turn, it’s stored in `self.first_pick`. If it’s the second pick, the move counter is incremented and we schedule `check_match()` to run after a short delay.</li></ul><h4><strong>Compliance check</strong></h4><pre>    def check_match(self, second_pick):<br>        if self.first_pick.item == second_pick.item:<br>            self.result_label.config(text=f&quot;Match found! You caught {self.first_pick.item}!&quot;)<br>            self.blood += 13<br>            self.prey -= 1<br>        else:<br>            self.result_label.config(text=&quot;No match. Try again.&quot;)<br>            self.blood -= 7<br>            self.first_pick.config(text=&quot;|+|&quot;, bg=&quot;#44475A&quot;)<br>            second_pick.config(text=&quot;|+|&quot;, bg=&quot;#44475A&quot;)<br><br><br>        self.first_pick = None<br>        self.update_info()<br>        self.check_game_over()</pre><p><strong>When comparing the items of the two selected buttons:</strong></p><ul><li>If they match, update the result label with a success message, increase the blood (souls) count by 13, and decrease the prey count by 1.</li><li>If they don’t match, update the result label with a failure message, decrease the blood count by 7, hide the items again by resetting the button text and color, reset self.first_pick for the next turn, and call update_info() to refresh the display and check_game_over() to see if the game has ended.</li></ul><h4><strong>Game State Management</strong></h4><p>Game state management is crucial for maintaining the game&#39;s current status, updating the user interface, and determining when the game ends. In the Vampiric match, this is handled by several methods:</p><ol><li><strong>update_info Method:</strong></li></ol><pre>    def update_info(self):<br>        self.blood_label.config(text=f&quot;Souls: {self.blood}&quot;)<br>        self.prey_label.config(text=f&quot;Prey: {self.prey}&quot;)</pre><ul><li>It updates the blood_label to show the player&#39;s number of souls (blood).</li><li>It updates the prey_label to show the remaining prey (pairs to match).</li><li>This method is called after each move to ensure the display always reflects the current game state.</li></ul><p><strong>2. check_game_over Method:</strong></p><pre>   def check_game_over(self):<br>        if self.prey == 0:<br>            self.show_message(&quot;You Win!&quot;, f&quot;All prey caught in {self.moves} moves! \n You are now Count Dracula!&quot;)<br>            self.end_game()<br>        elif self.blood &lt;= 0:<br>            self.show_message(&quot;Game Over&quot;, &quot;You ran out of Souls!&quot;)<br>            self.end_game()<br></pre><ul><li>If self.prey is 0, all pairs have been matched, and the player wins.</li><li>It displays a win message showing the number of moves taken.</li><li>If self.blood is 0 or less, the player has run out of souls and loses.</li><li>It displays a game-over message.</li><li>In both cases, the end_game method finalises the game state.</li><li>This method ensures the game ends appropriately when winning or losing conditions are met.</li></ul><p><strong>3. end_game Method:</strong></p><pre>    def end_game(self):<br>        for button in self.grid_frame.winfo_children():<br>            if isinstance(button, tk.Button):<br>                button.config(state=tk.DISABLED)</pre><ul><li>It iterates through all widgets in the grid_frame.</li><li>For each button, it sets its state to DISABLED.</li><li>This prevents further interaction with the game grid after the game has ended.</li><li>It “freezes” the game state effectively, allowing the player to see the final board configuration.</li></ul><p><strong>4. new_game Method:</strong></p><pre> def new_game(self):<br>        self.blood = 100<br>        self.prey = 8<br>        self.first_pick = None<br>        self.moves = 0<br>        self.result_label.config(text=&quot;&quot;)<br>        self.update_info()<br>        for widget in self.grid_frame.winfo_children():<br>            widget.destroy()<br>        self.create_grid()</pre><ul><li>Resets blood (souls) to the starting value of 100.</li><li>Resets prey to 8 (indicating 8 pairs to match).</li><li>Clears first_pick and resets the moves counter.</li><li>Clears any text in the result_label.</li><li>Calls update_info() to refresh the displayed game information.</li><li>Destroys all existing widgets in the grid_frame.</li><li>Calls create_grid() to set up a new game board.</li></ul><h4><strong>Displaying Messages</strong></h4><pre> def show_message(self, title, message):<br>        popup = tk.Toplevel(self.window)<br>        popup.title(title)<br>        popup.geometry(&quot;400x200&quot;)<br>        popup.config(bg=&quot;#282A36&quot;)<br><br><br>        tk.Label(popup, text=message, font=self.font, bg=&quot;#282A36&quot;, fg=&quot;#F8F8F2&quot;, wraplength=350).pack(pady=20)<br>        tk.Button(popup, text=&quot;Close&quot;, command=popup.destroy,<br>                  font=self.font, bg=&quot;#6272A4&quot;, fg=&quot;#F8F8F2&quot;).pack()</pre><ul><li>Creates a new top-level window for displaying messages.</li><li>Sets up the window with a title, size, and background color.</li><li>Adds a label to display the message and a button to close the popup.</li></ul><h4><strong>Main Execution</strong></h4><pre>if __name__ == &quot;__main__&quot;:<br>    root = tk.Tk()<br>    game = Vampirefrenzy(root)<br>    root.mainloop()</pre><ul><li>Check if the script is being run directly (not imported).</li><li>Creates the main Tkinter window (root).</li><li>Instantiates the Vampirefrenzy class with this window.</li><li>Starts the Tkinter event loop with mainloop(), which keeps the window open and responsive to user interactions.</li></ul><h3>Python ClickOmania Game <strong>Output</strong></h3><p>This image displays the initial state of the Vampire Frenzy game upon launch. It showcases the results of the setup_ui() and create_grid() methods. The game title “Vampire Frenzy” is shown at the top as a tk.Label. The initial values of 100 Souls and 8 Prey are displayed in the self.blood_label and self.prey_label. The 4x4 grid of buttons created in the create_grid() method is visible, each marked with “|+|”. The self.result_label is empty, and the self.reset_button labeled “New Game” is also visible.</p><figure><img alt="Python ClickOmania Game Output" src="https://cdn-images-1.medium.com/max/996/1*gKbvts6k_h154IPzE93sVw.jpeg" /></figure><p>This picture shows the game in progress. It demonstrates how the reveal() and check_match() methods work. Some buttons on the grid have been revealed, displaying their item and color as set in the create_grid() method. The self.blood_label and self.prey_label have been updated to reflect the game progress. The self.result_label shows a message from a recent move to provide feedback from the check_match() method.</p><figure><img alt="Python ClickOmania Game Project Output" src="https://cdn-images-1.medium.com/max/1005/1*rQnHwlqSWtEHm9-W5VpXKg.jpeg" /></figure><p>This image illustrates the winning state of the game, highlighting the check_game_over() and show_message() methods. All grid buttons are revealed, indicating all matches have been found. The self.prey_label shows a count of 0, triggering the win condition in check_game_over(). A popup window created by show_message() displays the win message, including the number of moves taken.</p><figure><img alt="ClickOmania Game Output" src="https://cdn-images-1.medium.com/max/996/1*Tl0hK7eY4lX5EHZcWGJryA.jpeg" /></figure><p>This image illustrates the game-over state, highlighting the check_game_over(), show_message(), and end_game() methods. Several grid buttons are still concealed. The self.blood_label indicates a value of 0 or lower, triggering the loss condition in the check_game_over() method. A pop-up window generated by show_message() presents the game-over message. The grid buttons are deactivated as part of implementing the end_game() method.</p><figure><img alt="Python ClickOmania Output" src="https://cdn-images-1.medium.com/max/999/1*1EKbf5utXS8jUGknE9lGvw.jpeg" /></figure><figure><img alt="ClickOmania Output" src="https://cdn-images-1.medium.com/max/1024/1*C4cUIj2srxJbbV4dbaxFlg.jpeg" /></figure><h3>Conclusion</h3><p>The Vampire Frenzy project is a unique twist on the ClickOmania game concept, integrating vampire themes and memory game elements. It offers an engaging gameplay experience with blood and prey mechanics, adding strategy to the traditional tile-matching puzzle. The game’s GUI is designed with a dark, vampire-inspired color scheme, enhancing the thematic experience. This project showcases the practical application of GUI programming, game logic implementation, and basic file I/O for high score tracking.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba7f298d36a0" width="1" height="1" alt=""><hr><p><a href="https://pythonflood.com/clickomania-game-in-python-design-code-and-play-ba7f298d36a0">ClickOmania Game in Python —  Design, Code, and Play</a> was originally published in <a href="https://pythonflood.com">PythonFlood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create an E-Vaccination System using Android.]]></title>
            <link>https://medium.com/dataflair/create-an-e-vaccination-system-using-android-f9fd35b0595f?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9fd35b0595f</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Sat, 29 Mar 2025 12:36:21 GMT</pubDate>
            <atom:updated>2025-03-29T12:36:21.123Z</atom:updated>
            <content:encoded><![CDATA[<p>E Vaccination application allows users to register and log on to the application and schedule vaccination appointments. Users can select the date of the appointment and they can view the appointments they have made.</p><p><strong>Following are the applications of E Vaccination application:</strong></p><ul><li>Allow users to register using their credentials</li><li>Allow users to log in to the app through valid and authenticated credentials.</li><li>Allow users to schedule an appointment on the selected date.</li><li>Users can view their appointments as well.</li></ul><p><strong>The user-interface components are as follows:</strong></p><ul><li>A Login and Register activity so that users can sign up for the application</li><li>An appointment scheduling activity where users can input the date and click the button to schedule an appointment.</li><li>Users can also view their appointment details.</li></ul><h3><strong>About Android E-Vaccination System</strong></h3><p>This <a href="https://techvidvan.com/tutorials/android-project-ideas/">Android project</a> aims to allow users to register and log in to the app and then they can input the date on the given field, and then they can make an appointment; the app also allows users to view the appointments they have made. Using the FireBase Database, the user’s appointment will be stored, and they can view it either on the app or the Firebase console.</p><figure><img alt="Android E-Vaccination System" src="https://cdn-images-1.medium.com/max/1024/1*63YoJlDUGCiPtwZTxW33iw.jpeg" /></figure><h3><strong>Prerequisites For </strong>Android e-Vaccination System</h3><p>Before beginning this Android project, we must know some prerequisites.</p><ul><li>OOP Concepts(Inheritance, Abstraction, etc..)</li><li>An Android Virtual Device or a USB-connected device for running the application</li><li><a href="https://developer.android.com/studio">Android Studio</a></li><li>Understanding of JAVA/Kotlin</li></ul><h3>Android e-Vaccination System <strong>Project File Structure</strong></h3><p>Let’s check the steps to build a tourist guide application in Android Studio.</p><ul><li>Go to the Firebase website and add your project on Firebase.</li><li>Run the following command on the terminal: <strong><em>gradle signingReport, </em></strong>and press Ctrl+Enter. You will get a field named <strong>SHA-1 fingerprint.</strong> Add this to your project on Firebase.</li><li>Paste the google-services.json file in the <strong><em>Project→YourAppName→app</em></strong>.</li><li>Now add the authentication, database and Firebase storage SDK’s in the <strong><em>gradle</em></strong> files.</li><li>Now import the files required for the project, such as HashMap, String, Recycler View and the other Firebase Libraries required, such as FirebaseAuth and FirebaseDatabase.</li></ul><h3><strong>Step-by-Step Implementation of </strong>Android e-Vaccination System</h3><p>Let’s start the implementation of the project.</p><h4><strong>Step 1: Setting up the Project.</strong></h4><p><strong>Create a new project in Android Studio</strong></p><ul><li>Open Android Studio and select “Start a new Android Studio project.”</li><li>Choose “Empty Activity” and set the project name, package name, and save location.</li><li>Configure the project with the desired SDK and language (Java/Kotlin).</li></ul><h4><strong>Step 2: Designing the UI</strong></h4><p><strong>activity_main.xml</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;match_parent&quot;<br>   android:background=&quot;@color/black&quot;<br>   tools:context=&quot;.MainActivity&quot;&gt;<br><br><br>   &lt;TextView<br>       android:id=&quot;@+id/textView&quot;<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;E Vaccination System&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textSize=&quot;20sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;<br><br><br>   &lt;ProgressBar<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       android:outlineAmbientShadowColor=&quot;#D80B0B&quot;<br>       android:outlineSpotShadowColor=&quot;#6C0909&quot;<br>       app:layout_constraintHorizontal_bias=&quot;0.498&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.617&quot; /&gt;<br><br><br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li>Its a basic splash screen which is to show the during the launch of the app.</li><li>We have a <strong>Textview </strong>to display the title of the app and a <strong>progress bar</strong>.</li></ul><figure><img alt="activity main" src="https://cdn-images-1.medium.com/max/382/1*vPlRjeN_pUVBBewQ1ni_KQ.jpeg" /></figure><p><strong>activity_register.xml</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;match_parent&quot;<br>   android:background=&quot;@color/black&quot;<br>   tools:context=&quot;.RegisterActivity&quot;&gt;<br><br><br>   &lt;TextView<br>       android:id=&quot;@+id/textView2&quot;<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Registration Screen&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textSize=&quot;20sp&quot;<br>       android:textStyle=&quot;italic&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintHorizontal_bias=&quot;0.443&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.055&quot; /&gt;<br><br><br>   &lt;EditText<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:hint=&quot;Email&quot;<br>       android:id=&quot;@+id/email&quot;<br>       android:padding=&quot;20dp&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textColorHint=&quot;@color/white&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.212&quot;<br>       tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;<br><br><br>   &lt;EditText<br>       android:id=&quot;@+id/password&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:hint=&quot;Password&quot;<br>       android:padding=&quot;20dp&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textColorHint=&quot;@color/white&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.358&quot;<br>       tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;<br><br><br>   &lt;Button<br>       android:id=&quot;@+id/register&quot;<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Register&quot;<br>       android:textSize=&quot;20sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;<br><br><br><br><br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;`</pre><p><strong>Explanation:</strong></p><ul><li>Two <strong>EditText </strong>fields are provided for users to input their email and password.</li><li>A <strong>Button</strong> is provided which, when clicked upon, registers the user into the database.</li></ul><figure><img alt="Registration Screen" src="https://cdn-images-1.medium.com/max/374/1*C9dH-c_DFHYfM3XsSpPPfA.jpeg" /></figure><p><strong>activity_login.xml</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;match_parent&quot;<br>   android:background=&quot;@color/black&quot;<br>   tools:context=&quot;.LoginActivity&quot;&gt;<br><br><br>   &lt;TextView<br>       android:id=&quot;@+id/textView3&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:gravity=&quot;center&quot;<br>       android:text=&quot;Login Screen&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textSize=&quot;20sp&quot;<br>       android:textStyle=&quot;italic&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.072&quot;<br>       tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;<br><br><br>   &lt;EditText<br>       android:id=&quot;@+id/email&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:hint=&quot;Email&quot;<br>       android:padding=&quot;20dp&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textColorHint=&quot;@color/white&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.229&quot;<br>       tools:layout_editor_absoluteX=&quot;16dp&quot; /&gt;<br><br><br>   &lt;EditText<br>       android:id=&quot;@+id/password&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:hint=&quot;Password&quot;<br>       android:padding=&quot;20dp&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textColorHint=&quot;@color/white&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.373&quot;<br>       tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;<br><br><br>   &lt;Button<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Log In&quot;<br>       android:textSize=&quot;20sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintHorizontal_bias=&quot;0.498&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       android:id=&quot;@+id/login&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;<br><br><br>   &lt;TextView<br>       android:id=&quot;@+id/registertext&quot;<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Create account? Click Here&quot;<br>       android:textColor=&quot;#EA1414&quot;<br>       android:textStyle=&quot;italic&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.568&quot;<br>       android:clickable=&quot;true&quot;/&gt;<br><br><br><br><br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li>Two <strong>EditText </strong>fields allow users to enter their email and password.</li><li>A <strong>Button </strong>is provided, which, when clicked upon, checks whether the user is registered or not and does the action.</li><li>A <strong>TextView</strong> is provided, redirecting the user to Register Activity when clicked upon.</li></ul><figure><img alt="Login Screen" src="https://cdn-images-1.medium.com/max/380/1*HnsEahJP3d1SPDsN-akkWQ.jpeg" /></figure><p><strong>activity_schedule.xml</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;match_parent&quot;<br>   android:background=&quot;@color/black&quot;<br>   tools:context=&quot;.ScheduleActivity&quot;&gt;<br><br><br>   &lt;TextView<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Enter the date for appointment&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textSize=&quot;20sp&quot;<br>       android:textStyle=&quot;italic&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintHorizontal_bias=&quot;0.0&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.103&quot; /&gt;<br><br><br>   &lt;EditText<br>       android:id=&quot;@+id/date&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:hint=&quot;DATE (YYYY-MM-DD)&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textColorHint=&quot;@color/white&quot;<br>       android:gravity=&quot;center&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.19&quot;<br>       tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;<br><br><br>   &lt;Button<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Schedule&quot;<br>       android:textSize=&quot;15sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       android:id=&quot;@+id/schedule&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintHorizontal_bias=&quot;0.516&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.333&quot; /&gt;<br><br><br>   &lt;Button<br>       android:id=&quot;@+id/view_appointments&quot;<br>       android:layout_width=&quot;wrap_content&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;View Appointments&quot;<br>       android:textSize=&quot;15sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>       app:layout_constraintHorizontal_bias=&quot;0.543&quot;<br>       app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.44&quot; /&gt;<br><br><br><br><br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li><strong>EditText </strong>fields, which allow users to enter the date for the appointment.</li><li>A <strong>Button </strong>which, when clicked upon, schedules the appointment of the user and then registers them into the database.</li><li>Another <strong>Button </strong>“View Appointments” is provided which allow the users to view the appointments they have scheduled.</li></ul><figure><img alt="Enter Date for the Appointment" src="https://cdn-images-1.medium.com/max/376/1*6BtXNdgtVoyZ39YjZfov5g.jpeg" /></figure><p><strong>activity_appointment.xml</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:layout_height=&quot;match_parent&quot;<br>   android:background=&quot;@color/black&quot;<br>   tools:context=&quot;.AppointmentActivity&quot;&gt;<br><br><br><br><br>   &lt;androidx.recyclerview.widget.RecyclerView<br>       android:layout_width=&quot;match_parent&quot;<br>       android:padding=&quot;10dp&quot;<br>       android:layout_height=&quot;match_parent&quot;<br>       android:outlineAmbientShadowColor=&quot;@color/white&quot;<br>       android:outlineSpotShadowColor=&quot;@color/white&quot;<br>       android:id=&quot;@+id/recyclerview&quot;/&gt;<br><br><br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li>We have used a <strong>RecyclerView to view the appointments</strong> in a list-item manner.</li></ul><figure><img alt="activity appointment" src="https://cdn-images-1.medium.com/max/374/1*utDIQxnc5A45FwFQQV7_dg.jpeg" /></figure><p><strong>item_appointment.xml</strong></p><p><strong>Code:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>   xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>   xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>   android:layout_width=&quot;match_parent&quot;<br>   android:background=&quot;@color/black&quot;<br>   android:layout_height=&quot;match_parent&quot;&gt;<br><br><br>   &lt;TextView<br>       android:id=&quot;@+id/dateTextView&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;Date&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:padding=&quot;10dp&quot;<br>       android:textSize=&quot;18sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.043&quot;<br>       tools:layout_editor_absoluteX=&quot;0dp&quot; /&gt;<br><br><br>   &lt;TextView<br>       android:id=&quot;@+id/idTextView&quot;<br>       android:layout_width=&quot;match_parent&quot;<br>       android:layout_height=&quot;wrap_content&quot;<br>       android:text=&quot;ID&quot;<br>       android:padding=&quot;10dp&quot;<br>       android:textColor=&quot;@color/white&quot;<br>       android:textSize=&quot;18sp&quot;<br>       android:textStyle=&quot;bold&quot;<br>       app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>       app:layout_constraintTop_toTopOf=&quot;parent&quot;<br>       app:layout_constraintVertical_bias=&quot;0.008&quot;<br>       tools:layout_editor_absoluteX=&quot;-16dp&quot; /&gt;<br><br><br><br><br>&lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;</pre><p><strong>Explanation:</strong></p><ul><li>Two <strong>TextViews </strong>are provided for ID and Date, respectively, which show the respective date and ID of the user when they schedule an appointment.</li></ul><figure><img alt="Item Appointment" src="https://cdn-images-1.medium.com/max/375/1*6W1puVvMM9x-R4B0oKwWaQ.jpeg" /></figure><h4><strong>Step 3: Implementing the Functionality</strong></h4><p><strong>MainActivity.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>import androidx.appcompat.app.AppCompatActivity;<br><br><br>import android.content.Intent;<br>import android.os.Bundle;<br><br><br>import com.google.firebase.auth.FirebaseAuth;<br>import com.google.firebase.auth.FirebaseUser;<br>import com.google.firebase.ktx.Firebase;<br><br><br>public class MainActivity extends AppCompatActivity {<br>   private FirebaseAuth auths;<br><br><br>   @Override<br>   protected void onCreate(Bundle savedInstanceState) {<br>       super.onCreate(savedInstanceState);<br>       setContentView(R.layout.activity_main);<br><br><br>       auths=FirebaseAuth.getInstance();<br>   }<br><br><br>   @Override<br>   protected void onStart() {<br>       super.onStart();<br>       FirebaseUser curruser=auths.getCurrentUser();<br>       if(curruser!=null)<br>       {<br>           startActivity(new Intent(MainActivity.this, ScheduleActivity.class));<br>       }else{<br>           startActivity(new Intent(MainActivity.this, LoginActivity.class));<br>       }<br>       finish();<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>onStart(): </strong>Checks whether an existing user is there or not. If there is an existing user, it takes the user directly to the Schedule activity. If there is no use, it redirects them to the Login Screen.</li></ul><p><strong>RegisterActivity.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>import androidx.appcompat.app.AppCompatActivity;<br><br><br>import android.content.Intent;<br>import android.os.Bundle;<br>import android.text.TextUtils;<br>import android.widget.Button;<br>import android.widget.EditText;<br>import android.widget.Toast;<br><br><br>import com.google.firebase.auth.FirebaseAuth;<br>import com.google.firebase.auth.FirebaseUser;<br><br><br>public class RegisterActivity extends AppCompatActivity {<br>   private FirebaseAuth auths;<br>   private EditText emailedittext, passwordedittext;<br>   private Button registerbutton;<br><br><br>   @Override<br>   protected void onCreate(Bundle savedInstanceState) {<br>       super.onCreate(savedInstanceState);<br>       setContentView(R.layout.activity_register);<br>       auths=FirebaseAuth.getInstance();<br>       emailedittext=findViewById(R.id.email);<br>       passwordedittext=findViewById(R.id.password);<br>       registerbutton=findViewById(R.id.register);<br>       registerbutton.setOnClickListener(v -&gt; registeruser());<br><br><br>   }<br><br><br>   private void registeruser()<br>   {<br>       String email=emailedittext.getText().toString().trim();<br>       String password=passwordedittext.getText().toString().trim();<br>       if (email.isEmpty()|| password.isEmpty())<br>       {<br>           Toast.makeText(this, &quot;Please fill all the details&quot;, Toast.LENGTH_SHORT).show();<br>           return;<br>       }<br>       auths.createUserWithEmailAndPassword(email,password).addOnCompleteListener(this,task -&gt; {<br>           if (task.isSuccessful())<br>           {<br>               FirebaseUser user=auths.getCurrentUser();<br>               Toast.makeText(this, &quot;Registration successful.Please Log in.&quot;, Toast.LENGTH_SHORT).show();<br>               startActivity(new Intent(RegisterActivity.this, LoginActivity.class));<br>               finish();<br>           }else {<br>               Toast.makeText(this, &quot;Registration Failed&quot;, Toast.LENGTH_SHORT).show();<br>           }<br>       });<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>registeruser(): </strong>Registers the users by checking whether the task is successful and then returns an appropriate message.</li></ul><p><strong>LoginActivity.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>import androidx.appcompat.app.AppCompatActivity;<br><br><br>import android.content.Intent;<br>import android.os.Bundle;<br>import android.text.TextUtils;<br>import android.widget.Button;<br>import android.widget.EditText;<br>import android.widget.TextView;<br>import android.widget.Toast;<br><br><br>import com.google.firebase.auth.FirebaseAuth;<br>import com.google.firebase.auth.FirebaseUser;<br><br><br>public class LoginActivity extends AppCompatActivity {<br>   private FirebaseAuth auths;<br>   private EditText emailedt,passwordedt;<br>   private Button loginbutton;<br>   private TextView registertextview;<br><br><br>   @Override<br>   protected void onCreate(Bundle savedInstanceState) {<br>       super.onCreate(savedInstanceState);<br>       setContentView(R.layout.activity_login);<br>       auths=FirebaseAuth.getInstance();<br>       emailedt=findViewById(R.id.email);<br>       passwordedt=findViewById(R.id.password);<br>       loginbutton=findViewById(R.id.login);<br>       loginbutton.setOnClickListener(v -&gt; loginuser());<br>       registertextview=findViewById(R.id.registertext);<br>       registertextview.setOnClickListener(v -&gt; startActivity(new Intent(LoginActivity.this, RegisterActivity.class)));<br><br><br>   }<br><br><br>   private void loginuser()<br>   {<br>       String email=emailedt.getText().toString().trim();<br>       String password=passwordedt.getText().toString().trim();<br>       if(email.isEmpty()|| password.isEmpty()){<br>           Toast.makeText(this, &quot;Please fill all the details&quot;, Toast.LENGTH_SHORT).show();<br>           return;<br>       }<br>       auths.signInWithEmailAndPassword(email,password).addOnCompleteListener(this,task -&gt; {<br>           if (task.isSuccessful())<br>           {<br>               FirebaseUser user=auths.getCurrentUser();<br>               startActivity(new Intent(LoginActivity.this,ScheduleActivity.class));<br>               finish();<br>           }else {<br>               Toast.makeText(this, &quot;Authentication Failure&quot;, Toast.LENGTH_SHORT).show();<br>           }<br>       });<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>loginuser():</strong> Allows the user to login to the app by checking if their credentials are valid or not through Firebase.</li></ul><p><strong>ScheduleActivity.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>import androidx.appcompat.app.AppCompatActivity;<br><br><br>import android.content.Intent;<br>import android.os.Bundle;<br>import android.widget.Button;<br>import android.widget.EditText;<br>import android.widget.Toast;<br><br><br>import com.google.firebase.auth.FirebaseAuth;<br>import com.google.firebase.database.DatabaseReference;<br>import com.google.firebase.database.FirebaseDatabase;<br><br><br>import java.util.HashMap;<br>import java.util.Map;<br><br><br>public class ScheduleActivity extends AppCompatActivity {<br>   private DatabaseReference dbms;<br>   private EditText dateslot;<br>   private Button schedulebtn;<br>   private Button viewApptbtn;<br><br><br>   @Override<br>   protected void onCreate(Bundle savedInstanceState) {<br>       super.onCreate(savedInstanceState);<br>       setContentView(R.layout.activity_schedule);<br><br><br>       dbms= FirebaseDatabase.getInstance().getReference(&quot;appointments&quot;);<br>       dateslot=findViewById(R.id.date);<br>       schedulebtn=findViewById(R.id.schedule);<br>       viewApptbtn=findViewById(R.id.view_appointments);<br>       schedulebtn.setOnClickListener(v -&gt; scheduleAppointment());<br>       viewApptbtn.setOnClickListener(v -&gt; startActivity(new Intent(ScheduleActivity.this, AppointmentActivity.class)));<br><br><br>   }<br><br><br>   private void scheduleAppointment()<br>   {<br>       String date=dateslot.getText().toString().trim();<br>       String userId= FirebaseAuth.getInstance().getCurrentUser().getUid();<br>       if(date.isEmpty())<br>       {<br>           Toast.makeText(this, &quot;Enter Date please, it cannot be empty&quot;, Toast.LENGTH_SHORT).show();<br>           return;<br>       }<br>       String appointid=dbms.push().getKey();<br>       Map&lt;String,Object&gt; appointment=new HashMap&lt;&gt;();<br>       appointment.put(&quot;date&quot;,date);<br>       appointment.put(&quot;id&quot;, appointid);<br>       appointment.put(&quot;userId&quot;,userId);<br>       dbms.child(appointid).setValue(appointment).addOnSuccessListener(aVoid -&gt; Toast.makeText(this, &quot;Appointment Scheduled&quot;, Toast.LENGTH_SHORT).<br>               show()).addOnFailureListener(e -&gt; Toast.makeText(this, &quot;Scheduling Failed&quot;, Toast.LENGTH_SHORT).show());<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>scheduleAppointment(): </strong>Gets the userid and date field and then checks whether any input field is empty, and then, an entry is created into the database under the appointments table.</li></ul><p><strong>AppointmentActivity.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>import androidx.annotation.NonNull;<br>import androidx.appcompat.app.AppCompatActivity;<br>import androidx.recyclerview.widget.LinearLayoutManager;<br>import androidx.recyclerview.widget.RecyclerView;<br><br><br>import android.os.Bundle;<br>import android.util.Log;<br>import android.widget.Toast;<br><br><br>import com.google.firebase.auth.FirebaseAuth;<br>import com.google.firebase.database.DataSnapshot;<br>import com.google.firebase.database.DatabaseError;<br>import com.google.firebase.database.DatabaseReference;<br>import com.google.firebase.database.FirebaseDatabase;<br>import com.google.firebase.database.ValueEventListener;<br><br><br>import java.util.ArrayList;<br>import java.util.List;<br><br><br>public class AppointmentActivity extends AppCompatActivity {<br>   private DatabaseReference dbms;<br>   private RecyclerView recyclerView;<br>   private AppointmentAdapter adapter;<br>   private List&lt;Appointment&gt; appointments=new ArrayList&lt;&gt;();<br><br><br>   @Override<br>   protected void onCreate(Bundle savedInstanceState) {<br>       super.onCreate(savedInstanceState);<br>       setContentView(R.layout.activity_appointment);<br><br><br>       dbms= FirebaseDatabase.getInstance().getReference(&quot;appointments&quot;);<br>       recyclerView=findViewById(R.id.recyclerview);<br>       recyclerView.setLayoutManager(new LinearLayoutManager(this));<br><br><br>       loadAppointments();<br>   }<br><br><br>   private void loadAppointments() {<br>       String userId= FirebaseAuth.getInstance().getCurrentUser().getUid();<br>       dbms.orderByChild(&quot;userId&quot;).equalTo(userId).addValueEventListener(new ValueEventListener() {<br>           @Override<br>           public void onDataChange(@NonNull DataSnapshot dataSnapshot) {<br>               appointments.clear();<br>               for(DataSnapshot snapshot:dataSnapshot.getChildren())<br>               {<br>                   Appointment appointment=snapshot.getValue(Appointment.class);<br>                   appointments.add(appointment);<br>               }<br>               adapter=new AppointmentAdapter(appointments);<br>               recyclerView.setAdapter(adapter);<br>           }<br><br><br>           @Override<br>           public void onCancelled(@NonNull DatabaseError error) {<br>               Log.e(&quot;AppointmentsActivity&quot;,&quot;Failed to retrieve appointments&quot;,error.toException());<br>               Toast.makeText(AppointmentActivity.this, &quot;Failed to Load Appointments.Please try again&quot;, Toast.LENGTH_SHORT).show();<br>           }<br>       });<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>loadAppointments():</strong> It retrieves the entry through the userid and then displays them onto the appointment activity. If an error occurs an error message is displayed.</li></ul><p><strong>Appointment.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>public class Appointment {<br>   private String date;<br>   private String id;<br>   private String userId;<br><br><br>   public Appointment(){<br><br><br>   }<br>   public Appointment(String date, String id , String userId){<br>       this.date=date;<br>       this.id=id;<br>       this.userId=userId;<br>   }<br><br><br>   public String getDate() {<br>       return date;<br>   }<br><br><br>   public void setDate(String date) {<br>       this.date = date;<br>   }<br><br><br>   public String getUserId() {<br>       return userId;<br>   }<br><br><br>   public void setUserId(String userId) {<br>       this.userId = userId;<br>   }<br><br><br>   public String getId() {<br>       return id;<br>   }<br><br><br>   public void setId(String id) {<br>       this.id = id;<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li>Used to create getters and setters for the variables.</li></ul><p><strong>AppointmentAdapter.java</strong></p><p><strong>Code:</strong></p><pre>package com.example.e_vaccinationsystem;<br><br><br>import android.view.LayoutInflater;<br>import android.view.View;<br>import android.view.ViewGroup;<br>import android.widget.TextView;<br><br><br>import androidx.annotation.NonNull;<br>import androidx.recyclerview.widget.RecyclerView;<br><br><br>import java.util.List;<br><br><br>public class AppointmentAdapter extends RecyclerView.Adapter&lt;AppointmentAdapter.AppointmentViewHolder&gt; {<br>   private List&lt;Appointment&gt; appointments;<br><br><br>   public AppointmentAdapter(List&lt;Appointment&gt; appointments){<br>       this.appointments=appointments;<br>   }<br><br><br>   @NonNull<br>   @Override<br>   public AppointmentAdapter.AppointmentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {<br>       View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_appointment,parent,false);<br>       return new AppointmentViewHolder(view);<br>   }<br><br><br>   @Override<br>   public void onBindViewHolder(@NonNull AppointmentAdapter.AppointmentViewHolder holder, int position) {<br>       Appointment appointment=appointments.get(position);<br>       holder.dateTextView.setText(&quot;Date:&quot;+appointment.getDate());<br>       holder.idTextView.setText(&quot;ID:&quot;+appointment.getId());<br>   }<br><br><br>   @Override<br>   public int getItemCount() {<br>       return appointments.size();<br>   }<br><br><br>   public static class AppointmentViewHolder extends RecyclerView.ViewHolder{<br>       public TextView dateTextView;<br>       public TextView idTextView;<br>       public AppointmentViewHolder(View itemView){<br>           super(itemView);<br>           idTextView=itemView.findViewById(R.id.idTextView);<br>           dateTextView=itemView.findViewById(R.id.dateTextView);<br>       }<br>   }<br>}</pre><p><strong>Explanation:</strong></p><ul><li><strong>onCreateViewHolder(): </strong>This method is called when a new “AppointmentViewHolder” needs to be created. It inflates on item layout and returns a new “AppointmentViewHolder” instance.</li><li><strong>onBindViewHolder(): </strong>This method displays the data at the specified position.</li></ul><h3>Android e-Vaccination System Output</h3><figure><img alt="Android E-Vaccination System Output" src="https://cdn-images-1.medium.com/max/691/1*Q04skSAGPGlwWMTpKt4FZA.jpeg" /></figure><figure><img alt="Realtime Database" src="https://cdn-images-1.medium.com/max/1024/1*N9RoMV6u1GUf_uWG2e8wxQ.jpeg" /></figure><figure><img alt="Firebase Authentication" src="https://cdn-images-1.medium.com/max/1024/1*J3mPIhfpjpHQ2aqXieWsnQ.jpeg" /></figure><h3><strong>Conclusion</strong></h3><p>We have successfully made an Android e-vaccination system app where users can schedule an appointment on a particular date and view their appointments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9fd35b0595f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataflair/create-an-e-vaccination-system-using-android-f9fd35b0595f">Create an E-Vaccination System using Android.</a> was originally published in <a href="https://medium.com/dataflair">DataFlair</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Track Your Expenses using Java.]]></title>
            <link>https://tutorialsflood.com/track-your-expenses-using-java-ee74edc2d1e3?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee74edc2d1e3</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Fri, 28 Mar 2025 12:37:17 GMT</pubDate>
            <atom:updated>2025-03-28T12:37:17.716Z</atom:updated>
            <content:encoded><![CDATA[<p>An expense tracker system helps users to manage their expenses by recording, updating, deleting, and summarizing their expenditures. This system will provide a user-friendly interface to input expense details, view all recorded expenses, and get a summary of total expenses. This <a href="https://techvidvan.com/java-courses/">Java</a> project will consist of three main classes: Expense, ExpenseManager, and ExpenseTrackerGUI.</p><h3><strong>About Java Expense Tracker</strong></h3><p>An Expense Tracker system is a robust tool for individuals and businesses to monitor and manage their financial outflows meticulously. By facilitating the recording and categorising of expenses, these systems empower users to gain deeper insights into their spending patterns. They often come equipped with features like automated expense categorization, receipt scanning capabilities, and real-time updates, ensuring accuracy and efficiency in financial tracking.</p><p>Additionally, these systems enable users to set and manage budgets effectively while generating comprehensive reports that provide clear, actionable insights for better financial planning and decision-making.</p><h3><strong>Prerequisites for Java Expense Tracker</strong></h3><ul><li><strong>Java Development Kit (JDK)</strong>: Ensure your system has JDK installed. You can download it from the Oracle website.</li><li><strong>Integrated Development Environment (IDE)</strong>: Use an IDE like IntelliJ IDEA, Eclipse, or <a href="https://netbeans.apache.org/front/main/download/">NetBeans</a> to manage your project efficiently.</li><li><strong>Basic Knowledge of Java</strong>: Familiarity with Java programming and Swing for GUI development.</li></ul><figure><img alt="Java Expense Tracker Project" src="https://cdn-images-1.medium.com/max/1024/1*W7TOpQWDtjfIZZPS8T9Msg.jpeg" /></figure><h3><strong>Libraries Used in this Java Expense Tracker Project</strong></h3><h4><strong>javax.swing.*:</strong></h4><ul><li><strong>Description</strong>: This package provides a set of “lightweight” (all-Java language) components that work simultaneously on all platforms to the maximum degree possible.</li><li><strong>Usage</strong>: Used to create the graphical user interface (GUI) for the expense tracker application.</li></ul><h4><strong>javax.swing.table.DefaultTableModel:</strong></h4><ul><li><strong>Description</strong>: A TableModel implementation that uses a Vector of Vectors to store the cell value objects.</li><li><strong>Usage</strong>: Used to manage the data displayed in the table within the GUI.</li></ul><h4><strong>java.awt.*:</strong></h4><ul><li><strong>Description</strong>: All classes for creating user interfaces and painting graphics and images.</li><li><strong>Usage</strong>: Used for the layout and organization of GUI components.</li></ul><h4><strong>java.awt.event.*:</strong></h4><ul><li><strong>Description</strong>: Provides interfaces and classes for dealing with different events fired by AWT components.</li><li><strong>Usage</strong>: Used to handle actions performed by the user, such as button clicks.</li></ul><h4><strong>java.util.ArrayList and java.util.List:</strong></h4><ul><li><strong>Description</strong>: ArrayList is a resizable array implementation of the List interface.</li><li><strong>Usage</strong>: Used to store the list of expenses.</li></ul><h3><strong>Java Expense Tracker Project Setup</strong></h3><ol><li><strong>Create a New Project</strong></li></ol><ul><li>Open your IDE.</li><li>Create a new Java project.</li></ul><p><strong>2. Create Packages and Classes</strong></p><p>Create a new package.</p><p>Create the following classes within this package:</p><ul><li>Expense</li><li>ExpenseManager</li><li>ExpenseTrackerGUI</li></ul><p><strong>3. Write Code</strong></p><p>Copy and paste the provided code snippets into their respective classes. Ensure all the necessary imports are included at the top of each class file.</p><p><strong>4. Compile and Run</strong></p><ul><li>Compile your project.</li><li>Run the ExpenseTrackerGUI class to start the application.</li></ul><h3><strong>Classes Overview</strong></h3><h4><strong>1. Expense</strong></h4><p>This class is a model representing an expense with an amount and description.</p><pre>package com.ExpenseTracker;<br><br>public class Expense {<br>    private double amount;<br>    private String description;<br><br>    public Expense(double amount, String description) {<br>        this.amount = amount;<br>        this.description = description;<br>    }<br><br>    public double getAmount() {<br>        return amount;<br>    }<br><br>    public void setAmount(double amount) {<br>        this.amount = amount;<br>    }<br><br>    public String getDescription() {<br>        return description;<br>    }<br><br>    public void setDescription(String description) {<br>        this.description = description;<br>    }<br>}</pre><p><strong>Explanation of the above code</strong></p><p><strong>Package Declaration:</strong></p><ul><li>package com.ExpenseTracker;</li><li>Indicates that the Expense class is part of the com.ExpenseTracker package.</li></ul><p><strong>Class Declaration:</strong></p><ul><li>public class Expense {</li><li>Defines a public class named Expense.</li></ul><p><strong>Instance Variables:</strong></p><ul><li>private double amount;</li><li>Stores the amount of the expense as a double.</li><li>private String description;</li><li>Stores a description of the expense as a String.</li></ul><p><strong>Constructor:</strong></p><ul><li>public Expense(double amount, String description) { … }</li><li>Initializes an Expense object with a specified amount and description parameters.</li></ul><p><strong>Getter Method for Amount:</strong></p><ul><li>public double getAmount() { … }</li><li>Returns the current value of the amount instance variable.</li></ul><p><strong>Setter Method for Amount:</strong></p><ul><li>public void setAmount(double amount) { … }</li><li>Sets the value of the amount instance variable to the specified parameter.</li></ul><p><strong>Getter Method for Description:</strong></p><ul><li>public String getDescription() { … }</li><li>Returns the current value of the description instance variable.</li></ul><p><strong>Setter Method for Description:</strong></p><ul><li>public void setDescription(String description) { … }</li><li>Sets the value of the description instance variable to the specified parameter.</li></ul><h4><strong>2. ExpenseManager</strong></h4><p>This class manages the list of expenses, providing methods to add, remove, update, and get expenses.</p><pre>package com.ExpenseTracker;<br><br>import java.util.ArrayList;<br>import java.util.List;<br><br>public class ExpenseManager {<br>    private List&lt;Expense&gt; expenses;<br><br>    public ExpenseManager() {<br>        expenses = new ArrayList&lt;&gt;();<br>    }<br><br>    public void addExpense(Expense expense) {<br>        expenses.add(expense);<br>    }<br><br>    public void removeExpense(int index) {<br>        if (index &gt;= 0 &amp;&amp; index &lt; expenses.size()) {<br>            expenses.remove(index);<br>        }<br>    }<br><br>    public void updateExpense(int index, Expense expense) {<br>        if (index &gt;= 0 &amp;&amp; index &lt; expenses.size()) {<br>            expenses.set(index, expense);<br>        }<br>    }<br><br>    public List&lt;Expense&gt; getExpenses() {<br>        return new ArrayList&lt;&gt;(expenses);<br>    }<br><br>    public double getTotalExpenses() {<br>        double total = 0;<br>        for (Expense expense : expenses) {<br>            total += expense.getAmount();<br>        }<br>        return total;<br>    }<br>}</pre><p><strong>Explanation of the above code</strong></p><p><strong>Package Declaration:</strong></p><ul><li>package com.ExpenseTracker;</li><li>Indicates that the ExpenseManager class belongs to the com.ExpenseTracker package.</li></ul><p><strong>Imports:</strong></p><ul><li>import java.util.ArrayList;</li><li>import java.util.List;</li><li>Imports necessary Java classes (ArrayList and List) from the java.util package, used for managing collections of expenses (ArrayList) and defining the interface (List).</li></ul><p><strong>Class Declaration:</strong></p><ul><li>public class ExpenseManager {</li><li>Defines a public class named ExpenseManager, which manages a collection of Expense objects.</li></ul><p><strong>Instance Variables:</strong></p><ul><li>private List&lt;Expense&gt; expenses;</li><li>Declares a private instance variable expenses, a list that will hold objects of type Expense.</li></ul><p><strong>Constructor:</strong></p><ul><li>public ExpenseManager() { … }</li><li>Constructor initializes the expenses list as a new ArrayList, ensuring it’s ready to store expenses when an ExpenseManager object is created.</li></ul><p><strong>Methods:</strong></p><ul><li>addExpense(Expense expense):</li><li>Adds an Expense object to the expenses list.</li><li>removeExpense(int index):</li><li>Removes the Expense object at the specified index from the expenses list, provided the index is valid.</li><li>updateExpense(int index, Expense expense):</li><li>Updates the Expense object at the specified expense list index with a new Expense object, provided the index is valid.</li><li>getExpenses():</li><li>Returns a copy of the expenses list. This is done using the new ArrayList&lt;&gt;(expenses) to prevent external modification of the internal list.</li></ul><h4><strong>3. ExpenseTrackerGUI</strong></h4><p>This class sets up the main GUI, allowing users to interact with the system.</p><pre>package com.ExpenseTracker;<br><br>import javax.swing.*;<br>import javax.swing.table.DefaultTableModel;<br>import java.awt.*;<br>import java.awt.event.ActionEvent;<br>import java.awt.event.ActionListener;<br>import java.util.List;<br><br>public class ExpenseTrackerGUI extends JFrame {<br>    private JTextField txtAmount;<br>    private JTextField txtDescription;<br>    private DefaultTableModel tableModel;<br>    private ExpenseManager expenseManager;<br><br>    public ExpenseTrackerGUI() {<br>        expenseManager = new ExpenseManager();<br><br>        setTitle(&quot;Expense Tracker&quot;);<br>        setSize(600, 400);<br>        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br>        setLocationRelativeTo(null);<br><br>        // Create components<br>        JLabel lblAmount = new JLabel(&quot;Amount:&quot;);<br>        txtAmount = new JTextField(15);<br>        JLabel lblDescription = new JLabel(&quot;Description:&quot;);<br>        txtDescription = new JTextField(15);<br>        JButton btnAddExpense = new JButton(&quot;Add Expense&quot;);<br>        JButton btnEditExpense = new JButton(&quot;Edit Expense&quot;);<br>        JButton btnDeleteExpense = new JButton(&quot;Delete Expense&quot;);<br>        JButton btnViewExpenses = new JButton(&quot;View Expenses&quot;);<br>        JButton btnSummary = new JButton(&quot;Summary&quot;);<br><br>        // Create table<br>        tableModel = new DefaultTableModel(new Object[]{&quot;Amount&quot;, &quot;Description&quot;}, 0);<br>        JTable table = new JTable(tableModel);<br>        JScrollPane tableScrollPane = new JScrollPane(table);<br><br>        // Set layout and add components<br>        setLayout(new BorderLayout());<br>        JPanel inputPanel = new JPanel();<br>        inputPanel.add(lblAmount);<br>        inputPanel.add(txtAmount);<br>        inputPanel.add(lblDescription);<br>        inputPanel.add(txtDescription);<br>        inputPanel.add(btnAddExpense);<br>        inputPanel.add(btnEditExpense);<br>        inputPanel.add(btnDeleteExpense);<br>        inputPanel.add(btnViewExpenses);<br>        inputPanel.add(btnSummary);<br>        add(inputPanel, BorderLayout.NORTH);<br>        add(tableScrollPane, BorderLayout.CENTER);<br><br>        // Add action listeners<br>        btnAddExpense.addActionListener(new ActionListener() {<br>            @Override<br>            public void actionPerformed(ActionEvent e) {<br>                addExpense();<br>            }<br>        });<br><br>        btnEditExpense.addActionListener(new ActionListener() {<br>            @Override<br>            public void actionPerformed(ActionEvent e) {<br>                editExpense(table.getSelectedRow());<br>            }<br>        });<br><br>        btnDeleteExpense.addActionListener(new ActionListener() {<br>            @Override<br>            public void actionPerformed(ActionEvent e) {<br>                deleteExpense(table.getSelectedRow());<br>            }<br>        });<br><br>        btnViewExpenses.addActionListener(new ActionListener() {<br>            @Override<br>            public void actionPerformed(ActionEvent e) {<br>                viewExpenses();<br>            }<br>        });<br><br>        btnSummary.addActionListener(new ActionListener() {<br>            @Override<br>            public void actionPerformed(ActionEvent e) {<br>                showSummary();<br>            }<br>        });<br>    }<br><br>    private void addExpense() {<br>        String amountStr = txtAmount.getText();<br>        String description = txtDescription.getText();<br><br>        if (amountStr.isEmpty() || description.isEmpty()) {<br>            JOptionPane.showMessageDialog(this, &quot;Please enter both amount and description.&quot;, &quot;Error&quot;, JOptionPane.ERROR_MESSAGE);<br>            return;<br>        }<br><br>        try {<br>            double amount = Double.parseDouble(amountStr);<br>            Expense expense = new Expense(amount, description);<br>            expenseManager.addExpense(expense);<br>            viewExpenses();<br>            clearFields();<br>        } catch (NumberFormatException e) {<br>            JOptionPane.showMessageDialog(this, &quot;Invalid amount. Please enter a numeric value.&quot;, &quot;Error&quot;, JOptionPane.ERROR_MESSAGE);<br>        }<br>    }<br><br>    private void editExpense(int selectedRow) {<br>        if (selectedRow &lt; 0) {<br>            JOptionPane.showMessageDialog(this, &quot;Please select an expense to edit.&quot;, &quot;Error&quot;, JOptionPane.ERROR_MESSAGE);<br>            return;<br>        }<br><br>        String amountStr = txtAmount.getText();<br>        String description = txtDescription.getText();<br><br>        if (amountStr.isEmpty() || description.isEmpty()) {<br>            JOptionPane.showMessageDialog(this, &quot;Please enter both amount and description.&quot;, &quot;Error&quot;, JOptionPane.ERROR_MESSAGE);<br>            return;<br>        }<br><br>        try {<br>            double amount = Double.parseDouble(amountStr);<br>            Expense expense = new Expense(amount, description);<br>            expenseManager.updateExpense(selectedRow, expense);<br>            viewExpenses();<br>            clearFields();<br>        } catch (NumberFormatException e) {<br>            JOptionPane.showMessageDialog(this, &quot;Invalid amount. Please enter a numeric value.&quot;, &quot;Error&quot;, JOptionPane.ERROR_MESSAGE);<br>        }<br>    }<br><br>    private void deleteExpense(int selectedRow) {<br>        if (selectedRow &lt; 0) {<br>            JOptionPane.showMessageDialog(this, &quot;Please select an expense to delete.&quot;, &quot;Error&quot;, JOptionPane.ERROR_MESSAGE);<br>            return;<br>        }<br><br>        expenseManager.removeExpense(selectedRow);<br>        viewExpenses();<br>    }<br><br>    private void viewExpenses() {<br>        List&lt;Expense&gt; expenses = expenseManager.getExpenses();<br>        tableModel.setRowCount(0);<br><br>        for (Expense expense : expenses) {<br>            tableModel.addRow(new Object[]{expense.getAmount(), expense.getDescription()});<br>        }<br>    }<br><br>    private void showSummary() {<br>        double totalExpenses = expenseManager.getTotalExpenses();<br>        JOptionPane.showMessageDialog(this, &quot;Total Expenses: &quot; + totalExpenses, &quot;Summary&quot;, JOptionPane.INFORMATION_MESSAGE);<br>    }<br><br>    private void clearFields() {<br>        txtAmount.setText(&quot;&quot;);<br>        txtDescription.setText(&quot;&quot;);<br>    }<br><br>    public static void main(String[] args) {<br>        SwingUtilities.invokeLater(new Runnable() {<br>            @Override<br>            public void run() {<br>                new ExpenseTrackerGUI().setVisible(true);<br>            }<br>        });<br>    }<br>}</pre><p><strong>Explanation of the above code</strong></p><p><strong>Imports:</strong></p><ul><li>The class imports necessary Swing and AWT classes (JFrame, JPanel, JButton, JLabel, JTextField, JTable, DefaultTableModel, JScrollPane, ActionEvent, ActionListener, SwingUtilities, JOptionPane) for creating the GUI components and handling events.</li></ul><p><strong>Class Declaration:</strong></p><ul><li>public class ExpenseTrackerGUI extends JFrame { … }</li><li>Extends JFrame, indicating that this class represents a GUI window (a JFrame).</li></ul><p><strong>Instance Variables:</strong></p><ul><li>private JTextField txtAmount;</li><li>private JTextField txtDescription;</li><li>private DefaultTableModel tableModel;</li><li>private ExpenseManager expenseManager;</li><li>These variables hold references to GUI components (txtAmount, txtDescription), a table model for displaying expenses (tableModel), and an instance of ExpenseManager (expenseManager) for managing expense data.</li></ul><p><strong>Constructor (ExpenseTrackerGUI()):</strong></p><ul><li>Initializes the GUI:</li><li>Sets the window title, size, and default close operation and centres it on the screen.</li><li>Creates GUI components (JLabel, JTextField, JButton, JTable, JScrollPane) and arranges them using BorderLayout.</li><li>Button Actions:</li><li>addActionListener for each button:</li><li>btnAddExpense, btnEditExpense, btnDeleteExpense, btnViewExpenses, btnSummary:</li><li>Each button has an associated ActionListener that defines what happens when the button is clicked (actionPerformed method).</li><li>Button Actions Implementation:</li><li><strong>addExpense():</strong> Validates input, creates an Expense object, adds it to expenseManager, updates the table, and clears input fields.</li><li><strong>editExpense(int selectedRow): </strong>Validates input, updates the selected Expense in expenseManager, updates the table, and clears input fields.</li><li><strong>deleteExpense(int selectedRow): </strong>Removes the selected Expense from expenseManager, and updates the table.</li><li><strong>viewExpenses():</strong> Retrieves all expenses from expenseManager and updates the table with tableModel.</li><li><strong>showSummary():</strong> Retrieves total expenses from expenseManager and displays it in a message dialog.</li></ul><p><strong>Utility Methods:</strong></p><ul><li><strong>clearFields():</strong> Clears the txtAmount and txtDescription fields.</li><li><strong>main Method:</strong></li><li>public static void main(String[] args) { … }</li><li>The application&#39;s entry point creates an instance of ExpenseTrackerGUI and sets it visible on the Event Dispatch Thread (EDT) using SwingUtilities.invokeLater().</li></ul><h3><strong>Java Expense Tracker Output</strong></h3><figure><img alt="Add Expense" src="https://cdn-images-1.medium.com/max/1024/1*HiwBvMYFbXWJuA6aTeEUDw.jpeg" /></figure><figure><img alt="Edit Expense" src="https://cdn-images-1.medium.com/max/1024/1*tXh9wdImVwwUsU-MrzgYcw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jVJa-bnzT8ulzENogHyBMw.jpeg" /></figure><figure><img alt="Summary" src="https://cdn-images-1.medium.com/max/1024/1*5VHnz-SKatyDfBOp8zsfLA.jpeg" /></figure><h3>Conclusion</h3><p>This expense tracker system project demonstrates creating a simple yet functional application using Java. The system allows users to manage their expenses with a user-friendly interface. The Java Expense Tracker project is organized into three classes, each with specific responsibilities, ensuring modularity and maintainability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee74edc2d1e3" width="1" height="1" alt=""><hr><p><a href="https://tutorialsflood.com/track-your-expenses-using-java-ee74edc2d1e3">Track Your Expenses using Java.</a> was originally published in <a href="https://tutorialsflood.com">Tutorials Flood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Check the Internet Speed using Python.]]></title>
            <link>https://datascienceflood.com/check-the-internet-speed-using-python-4f6678c944f7?source=rss-d32b4f823e64------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f6678c944f7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rahul Patodi]]></dc:creator>
            <pubDate>Thu, 27 Mar 2025 12:32:59 GMT</pubDate>
            <atom:updated>2025-03-27T12:32:59.005Z</atom:updated>
            <content:encoded><![CDATA[<p>Internet speed test for your connected device is a test that determines the connection speed and available quality. Usually, it determines the downloading speed, the uploading speed, and the ‘ping’. This is defined as the rate at which data is downloaded from the internet to your device, while the second one depicts the rate at which data is uploaded to the internet. Meanwhile, Ping is the time it takes for a data packet to reach your device and then the server and back.</p><h3><strong>Need of a Python Internet Speed Test</strong></h3><p>It enables one to diagnose connectivity issues with your Internet connection to improve your network. It also aids in determining whether your Internet service provider (ISP) is providing the bandwidth they advertised in your package. Being informed about your internet speed can enable you to manage or adjust streaming, gaming and other activities on the internet to suit one’s desire.</p><h3><strong>About the Python Internet Speed Test Project</strong></h3><p>This project is about creating a simple GUI application using <a href="https://www.youtube.com/watch?v=sRrkqjqTTQQ&amp;t">Python</a> that tests the internet speed. This application uses the “speedtest” module to perform the speed test and the “tkinter” module for the GUI part.</p><h3><strong>Prerequisites of Python Internet Speed Test</strong></h3><p>To run this Python project, the following prerequisites must be met:</p><ul><li><strong>Python:</strong> The user must have <a href="https://www.python.org/">Python</a> installed in their system.</li><li><strong>Tkinter:</strong> This library is used for making the GUI for utility tools.</li><li><strong>Speedtest-cli:</strong> This module helps in performing the internet speed tests.</li></ul><figure><img alt="Python Internet Speed Test Project" src="https://cdn-images-1.medium.com/max/1024/1*ocusUGWor8kpm89W4FiA_g.jpeg" /></figure><h3>Step-by-Step Explanation of Python Internet Speed Test Project</h3><p>The following is the explanation of the code for the project:</p><h4>Importing the Libraries</h4><pre>import tkinter as tk<br>from tkinter import ttk<br>import speedtest</pre><p>The “tkinter” module is included for creating the GUI, and the “speedtest” module is for conducting the speed test.</p><h4>Function to check the speed</h4><pre>def speedCheck():<br>    speedtestCalc = speedtest.Speedtest()<br>    speedtestCalc.download()<br>    speedtestCalc.upload()<br>    results = speedtestCalc.results.dict()<br>    speedDownload = results[&quot;download&quot;] / 1_000_000<br>    speedUpload = results[&quot;upload&quot;] / 1_000_000<br>    ping = results[&quot;ping&quot;]<br>       labelDownload_1.config(text=f&quot;Download Speed: {speedDownload:.2f} Mbps&quot;)<br>    labelUpload_2.config(text=f&quot;Upload Speed: {speedUpload:.2f} Mbps&quot;)<br>    labelPing_3.config(text=f&quot;Ping: {ping:.2f} ms&quot;)</pre><p>This function assists in the execution of the internet speed test function. It also uses a “Speedtest” object performs download and upload speed tests, and gets the results. The download and upload speed figures are converted from bits per second to megabits per second (Mbps). The ping may be expressed in terms of milliseconds (ms).</p><h4>Setting up the GUI</h4><pre>root = tk.Tk()<br>root.title(&quot;Internet Speed Test&quot;)<br>ttk.Label(root, text=&quot;Internet Speed Test&quot;, font=(&quot;Arial&quot;, 16)).grid(column=0, row=0, pady=10)<br>ttk.Button(root, text=&quot;Start Test&quot;, command=speedCheck).grid(column=0, row=1, pady=10)<br>labelDownload_1 = ttk.Label(root, text=&quot;Download Speed: N/A&quot;, font=(&quot;Arial&quot;, 12))<br>labelDownload_1.grid(column=0, row=2, pady=5)<br>labelUpload_2 = ttk.Label(root, text=&quot;Upload Speed: N/A&quot;, font=(&quot;Arial&quot;, 12))<br>labelUpload_2.grid(column=0, row=3, pady=5)<br>labelPing_3 = ttk.Label(root, text=&quot;Ping: N/A&quot;, font=(&quot;Arial&quot;, 12))<br>labelPing_3.grid(column=0, row=4, pady=5)<br>root.mainloop()</pre><p>Tkinter window is launched. Three labels and one button are created on the window. On the labels, the indicators of the download speed, the upload speed and the ping can be observed. This button is associated with the “speedCheck” method that causes the speed test and sets the labels with the results.</p><h3><strong>Python Internet Speed Test Output</strong></h3><ol><li>This is the launch page of the application, where we can see a button which needs to be clicked to start the internet speed test.</li></ol><figure><img alt="Python Internet Speed Test Project Output" src="https://cdn-images-1.medium.com/max/368/1*GEGwHc8DOy1lriaVruiNWA.jpeg" /></figure><p>2. Here, we have started the speed test by clicking the button.</p><figure><img alt="Python Internet Speed Test Output" src="https://cdn-images-1.medium.com/max/360/1*1ltpzf8-nTTlfi1rH__M7g.jpeg" /></figure><p>3. The above image shows the test result, where we can see the download speed, the upload speed and the ping of the network.</p><figure><img alt="Internet Speed Test Project Output" src="https://cdn-images-1.medium.com/max/416/1*pTO7hTJBfKt22bA-xY2xxQ.jpeg" /></figure><h3>Conclusion</h3><p>This project demonstrates a simple application of Python for testing internet speed using a GUI. It uses the “tkinter” module for the graphical interface and the “speedtest” module for conducting the speed test. The project serves the purpose of helping diagnose a network problem and check the speed of the internet connection.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f6678c944f7" width="1" height="1" alt=""><hr><p><a href="https://datascienceflood.com/check-the-internet-speed-using-python-4f6678c944f7">Check the Internet Speed using Python.</a> was originally published in <a href="https://datascienceflood.com">Data Science Flood</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>