<?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 Cooper on Medium]]></title>
        <description><![CDATA[Stories by Cooper on Medium]]></description>
        <link>https://medium.com/@undextrois.jobs?source=rss-3dfb5cc47ccf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*iX-NKFAUITvQBwqz</url>
            <title>Stories by Cooper on Medium</title>
            <link>https://medium.com/@undextrois.jobs?source=rss-3dfb5cc47ccf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:31:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@undextrois.jobs/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[Building a Basic Text Classifier Using Python and Scikit-Learn]]></title>
            <link>https://medium.com/@undextrois.jobs/building-a-basic-text-classifier-using-python-and-scikit-learn-4f300b4d8228?source=rss-3dfb5cc47ccf------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f300b4d8228</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Cooper]]></dc:creator>
            <pubDate>Sat, 23 Mar 2024 18:18:28 GMT</pubDate>
            <atom:updated>2024-03-23T18:19:58.836Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a Basic Text Classifier Using Python and Scikit-Learn</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/0*51ak9-DC4qqJy3V4" /></figure><p>From sentiment analysis to language translation, NLP techniques empower machines to comprehend and process human language, opening doors to a myriad of applications across various industries. In this blog post, we’ll embark on a hands-on exploration of NLP by building a basic text classifier using Python and the popular scikit-learn library.</p><p>Through this practical demonstration, we’ll unravel the essential steps involved in processing and analyzing textual data, from tokenization to model evaluation. Whether you’re a seasoned data scientist or a curious beginner, this guide will provide valuable insights into the fundamental concepts and techniques of NLP.</p><p>So, let’s dive in and discover the magic of NLP as we embark on our journey to build a text classifier from scratch. By the end of this blog post, you’ll not only have a deeper understanding of NLP principles but also possess the skills to tackle your own text analysis projects with confidence.</p><p><strong>Let’s get started!</strong></p><pre>pip install nltk</pre><p><strong>2. Download the punkt zip file from the 3. Unzipped and Drop it into </strong><a href="https://drive.google.com/drive/folders/1h6OsetTGfZTXydfFhp_-wVLO3f90aoUX?usp=sharing">https://drive.google.com/drive/folders/1h6OsetTGfZTXydfFhp_-wVLO3f90aoUX?usp=sharing</a></p><ul><li>Windows: C:\nltk_data\tokenizers</li><li>OSX: /usr/local/share/nltk_data/tokenizers</li><li>Unix: /usr/share/nltk_data/tokenizers</li></ul><p>4. Copy and Paste this code</p><p><strong>Explanation:</strong></p><pre>import nltk from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from sklearn.svm import SVC from sklearn.metrics import accuracy_score # Load NLTK data nltk.data.path.append(&#39;/Library/Frameworks/Python.framework/Versions/3.11/share/nltk_data&#39;) # Input strings and their categories texts = [ &quot;the quick brown fox jumps over the lazy dog.&quot;, &quot;apples and oranges are fruits.&quot;, &quot;the cat is sleeping on the mat.&quot;, &quot;birds chirp in the morning.&quot;, &quot;elephants are large mammals.&quot;, &quot;cars are vehicles used for transportation.&quot;, &quot;the sun shines brightly in the sky.&quot;, &quot;the moon rises at night.&quot; ] categories = [&quot;animal-related&quot;, &quot;non-animal-related&quot;, &quot;animal-related&quot;, &quot;non-animal-related&quot;, &quot;animal-related&quot;, &quot;non-animal-related&quot;, &quot;non-animal-related&quot;, &quot;non-animal-related&quot;] # Tokenize the texts tokenized_texts = [word_tokenize(text) for text in texts] print(&quot;TOKENIZED TEXTS:&quot;, tokenized_texts) # Convert tokenized texts into single strings text_strings = [&#39; &#39;.join(tokens) for tokens in tokenized_texts] print(&quot;TEXT STRINGS:&quot;, text_strings) # Initialize CountVectorizer to perform feature engineering. vectorizer = CountVectorizer() # Fit the vectorizer to the texts vectorized_texts = vectorizer.fit_transform(text_strings) print(&quot;VOCABULARY:&quot;, vectorizer.get_feature_names_out()) # Transform tokenized texts into numerical vectors print(&quot;VECTORIZED TEXTS:&quot;, vectorized_texts.toarray()) # Convert categories into numerical labels label_map = {&quot;animal-related&quot;: 0, &quot;non-animal-related&quot;: 1} labels = [label_map[category] for category in categories] # Split data into training and testing sets X_train, X_test, y_train, y_test = train_test_split(vectorized_texts, labels, test_size=0.2, random_state=42) print(&quot;TRAINING DATA:&quot;, X_train.toarray()) print(&quot;TESTING DATA:&quot;, X_test.toarray()) # Initialize Support Vector Classifier (SVC) clf = SVC() # Train the classifier clf.fit(X_train, y_train) # Make predictions on the test data predictions = clf.predict(X_test) # Calculate accuracy accuracy = accuracy_score(y_test, predictions) # Print the accuracy print(&quot;Accuracy:&quot;, accuracy)</pre><ol><li><strong>Tokenization and Text Cleaning:</strong></li><li><strong>Feature Engineering with Bag-of-Words:</strong></li><li><strong>Splitting Data and Model Training:</strong></li></ol><ul><li>The data is split into training and testing sets using train_test_split function. This step is necessary to evaluate the model&#39;s performance on unseen data.</li><li>The Support Vector Classifier (SVC) from scikit-learn is initialized and trained on the training data.</li></ul><ol><li><strong>Model Evaluation:</strong></li></ol><p>This sample code demonstrate the a fundamental concept in NLP and machine learning, making it suitable for presentation to illustrate the basic workflow of text processing and classification.</p><p><em>Originally published at </em><a href="https://agilecreativelabs.ca/building-a-basic-text-classifier-using-python-and-scikit-learn/"><em>https://agilecreativelabs.ca</em></a><em> on March 23, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f300b4d8228" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the Art of Displaying SQL Query Results in JavaScript: A Comprehensive Guide]]></title>
            <link>https://medium.com/@undextrois.jobs/mastering-the-art-of-displaying-sql-query-results-in-javascript-a-comprehensive-guide-ea56b74312af?source=rss-3dfb5cc47ccf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea56b74312af</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Cooper]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 01:40:50 GMT</pubDate>
            <atom:updated>2024-03-09T04:24:33.196Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Mastering the Art of Displaying SQL Query Results in JavaScript: A Comprehensive Guide</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4yilkHQkGUYPYwCEkySaqA.png" /></figure><p>When you execute an SQL query in a JavaScript environment (like Node.js) and receive a result that, when printed using console.log, shows [object Object], it means you’re trying to print an object (or an array of objects) directly to the console. This is a common scenario when working with databases, as query results are typically returned as objects where each key represents a column name from your database.</p><p>To properly display the contents of these objects, you have several options:</p><h3>1. JSON.stringify</h3><p>You can convert the object (or array of objects) to a JSON string, which can then be printed out. This method is useful for seeing the entire structure at once, especially when dealing with simple objects.</p><blockquote><strong>console.log(JSON.stringify(result, null, 2));</strong></blockquote><ul><li>result is the object you’re trying to print.</li><li>The second argument (null) is a replacer function; in this case, it’s not used, so null is passed.</li><li>The third argument (2) specifies the number of spaces used for indentation, making the output more readable.</li></ul><h3>2. Looping Through the Array of Objects</h3><p>If result is an array of objects (common with SQL SELECT queries returning multiple rows), you can loop through each object and print them individually:</p><blockquote><strong>result.forEach(row =&gt; {console.log(row);});</strong></blockquote><p>This method prints each row as an object to the console, which might still show as [object Object] depending on your environment. To avoid this, you can use JSON.stringify on each row or:</p><blockquote><strong>result.forEach(row =&gt; {console.log(JSON.stringify(row, null, 2));});</strong></blockquote><h3>3. Accessing Individual Properties</h3><p>If you’re interested in specific columns from your SQL query result, you can access them directly using their keys (which correspond to column names):</p><blockquote><strong>result.forEach(row =&gt; {</strong></blockquote><blockquote><strong>console.log(`ID: ${row.id}, Name: ${row.name}`); // Assuming the objects have ‘id’ and ‘name’ properties</strong></blockquote><blockquote><strong>});</strong></blockquote><h3>4. Utilizing Console.table</h3><p>For a more tabular and visually appealing output, especially when dealing with arrays of objects, you can use console.table:</p><blockquote><strong>console.table(result);</strong></blockquote><p>This will print the array of objects in a table format in the console, making it easier to read each row’s values by column.</p><h3>Important Note</h3><p>Ensure that result is indeed the part of your SQL query result that contains the rows you’re interested in. Depending on the library you’re using to execute SQL queries (e.g., pg for PostgreSQL, mysql for MySQL), the actual data might be nested within properties like rows in the result object:</p><blockquote><strong>console.log(JSON.stringify(result.rows, null, 2)); // For libraries where the rows are under ‘rows’ property</strong></blockquote><p>Select the method that best suits your needs based on the readability and the amount of data you’re dealing with.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea56b74312af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Apache2]]></title>
            <link>https://medium.com/@undextrois.jobs/how-to-apache2-4e8f9dd361c2?source=rss-3dfb5cc47ccf------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e8f9dd361c2</guid>
            <category><![CDATA[service-apache2-restart]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[apache2]]></category>
            <dc:creator><![CDATA[Cooper]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 23:41:57 GMT</pubDate>
            <atom:updated>2024-02-23T23:41:57.085Z</atom:updated>
            <content:encoded><![CDATA[<p>To manage the Apache2 service on Ubuntu, you can use the systemctl command, which is the control interface for systemd. Here are the common commands to stop, start, restart, and check the status of Apache2:</p><h3>To Start Apache2</h3><pre>sudo systemctl start apache2</pre><h3>To Stop Apache2</h3><pre>sudo systemctl stop apache2</pre><h3>To Restart Apache2</h3><p>This command is useful when you have made changes to the configuration files and need to apply them.</p><pre>sudo systemctl restart apache2</pre><h3>To Reload Apache2</h3><p>If you want to apply configuration changes without dropping connections, use reload instead of restart.</p><pre>sudo systemctl reload apache2</pre><h3>To Check Apache2 Status</h3><p>This command shows the current status of the Apache2 service, including whether it is running or stopped.</p><pre>sudo systemctl status apache2</pre><h3>To Enable Apache2 to Start at Boot</h3><pre>sudo systemctl enable apache2</pre><h3>To Disable Apache2 from Starting at Boot</h3><pre>sudo systemctl disable apache2</pre><p>These commands provide basic management actions for the Apache2 service on Ubuntu systems using systemd. For more detailed configuration or troubleshooting, you might need to delve into Apache’s configuration files, typically located in /etc/apache2/.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e8f9dd361c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy NextJS in AWS EC2 Ubuntu with Apache2]]></title>
            <link>https://medium.com/@undextrois.jobs/deploy-nextjs-in-aws-ec2-ubuntu-with-apache2-81aa2113bfb0?source=rss-3dfb5cc47ccf------2</link>
            <guid isPermaLink="false">https://medium.com/p/81aa2113bfb0</guid>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[apache2]]></category>
            <category><![CDATA[nextjs-tutorial]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Cooper]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 20:43:54 GMT</pubDate>
            <atom:updated>2024-02-23T20:43:54.444Z</atom:updated>
            <content:encoded><![CDATA[<p>Deploying a Next.js application on an AWS EC2 instance using Apache as a reverse proxy and managing the app with PM2 involves several steps, including initial setup, configuration, and troubleshooting common issues.</p><p>Below is a comprehensive guide, including the steps we discussed and some common troubleshooting tips.</p><h3>Initial Setup</h3><ul><li>Launch EC2 Instance:</li><li>Choose an Ubuntu Server.</li><li>Configure instance details, storage, and security groups. Ensure port 22 (SSH), 80 (HTTP), and 443 (HTTPS, if needed) are open.</li><li>Launch the instance and download the key pair.</li><li>Connect to Your EC2 Instance:</li><li>Use SSH to connect to your instance:</li></ul><p><strong>ssh -i /path/to/key.pem ubuntu@your-instance-ip.</strong></p><ul><li>Update System Packages:</li><li>Run <strong>sudo apt-get update</strong> and <strong>sudo apt-get upgrade</strong> to ensure your system is up to date.</li><li>Install Node.js and NPM:</li><li>Install Node.js (including NPM): <strong>curl -fsSL </strong><a href="https://deb.nodesource.com/setup_lts.x"><strong>https://deb.nodesource.com/setup_lts.x</strong></a><strong> | sudo -E bash </strong>— followed by <strong>sudo apt-get install -y nodejs.</strong></li><li>Install PM2:</li><li>Install PM2 globally: <strong>npm install pm2@latest -g.</strong></li><li>Install Apache:</li><li>Install Apache2: <strong>sudo apt-get install apache2.</strong></li><li>Ensure it’s running: <strong>sudo systemctl status apache2.</strong></li></ul><h3>Deploying Your Next.js Application</h3><ul><li>Upload Your Next.js Application:</li><li>Use SCP or an FTP client to upload your Next.js app to your EC2 instance.</li><li><strong>scp -r -i ~/Downloads/my-key-pair.pem ~/Documents/my-folder ec2-user@ec2–11–222–33–44.compute-1.amazonaws.com:/home/ec2-user</strong></li><li>Install Dependencies:</li><li>Navigate to your app directory: <strong>cd /path/to/your-app.</strong></li><li>Install dependencies: <strong>npm install.</strong></li><li>Build Your Next.js Application:</li><li>Build your app for production: <strong>npm run build.</strong></li><li>Start Your Next.js Application with PM2:</li><li>Start your app with PM2: <strong>pm2 start npm — name “next-app” — start.</strong></li><li>Generate and configure a startup script to resurrect PM2 processes after reboots: <strong>pm2 startup.</strong></li><li>Configure Apache as a Reverse Proxy:</li><li>Enable necessary Apache modules: <strong>sudo a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests rewrite headers.</strong></li><li>Create <strong>.Htaccess </strong>file inside the <strong>/var/www/html </strong>root with the following information.</li></ul><p><strong>DirectoryIndex disabled</strong></p><p><strong>RewriteEngine On</strong></p><p><strong>RewriteRule ^$ </strong><a href="http://127.0.0.1:XXXXX/"><strong>http://127.0.0.1:XXXXX/</strong></a><strong> [P,L]</strong></p><p><strong>RewriteCond %{REQUEST_FILENAME} !-f</strong></p><p><strong>RewriteCond %{REQUEST_FILENAME} !-d</strong></p><p><strong>RewriteRule ^(.*)$ </strong><a href="http://127.0.0.1:XXXXX/$1"><strong>http://127.0.0.1:XXXXX/$1</strong></a><strong> [P,L]</strong></p><ul><li>Edit your site configuration: <strong>sudo nano /etc/apache2/sites-available/000-default.conf.</strong></li><li>Inside the configuration file, locate the<strong> </strong>&lt;Directory&gt;<strong> </strong>section that corresponds to your website’s document root (e.g.,<strong> </strong>/var/www/html<strong>). </strong>If there isn’t a<strong> </strong>&lt;Directory&gt;<strong> </strong>section for your document root, you can add one.</li><li>Modify or add the<strong> </strong>&lt;Directory&gt;<strong> </strong>section to include<strong> </strong>Options Indexes FollowSymLinks<strong> </strong>and<strong> </strong>AllowOverride All<strong>.</strong> It should look something like this:</li></ul><p><strong>&lt;Directory /var/www/html&gt;</strong></p><p><strong>Options Indexes FollowSymLinks</strong></p><p><strong>AllowOverride All</strong></p><p><strong>Require all granted</strong></p><p><strong>&lt;/Directory&gt;</strong></p><p>Restart Apache to apply changes: <strong>sudo systemctl restart apache2.</strong></p><h3>Troubleshooting Guide</h3><ul><li>Application Not Starting:</li><li>Check PM2 logs: pm2 logs.</li><li>Ensure your application is running: pm2 status.</li><li>502/503 Errors or Application Not Accessible Through Apache:</li><li>Verify Apache is running and configured correctly.</li><li>Check Apache error logs: sudo tail -f /var/log/apache2/error.log.</li><li>Ensure port forwarding is correctly configured in your Apache site configuration.</li><li>Application Starts but Crashes:</li><li>Review your application logs for errors.</li><li>Check for out-of-memory issues; consider upgrading your instance if necessary.</li><li>Permissions Issues:</li><li>Ensure your uploaded files have the correct permissions. Use chown and chmod if necessary.</li><li>Firewall/Security Group Settings:</li><li>Double-check your EC2 instance’s security group settings to ensure ports 80 and 443 are open to the public.</li><li>.htaccess or Apache Configuration Issues:</li><li>Verify your .htaccess file (if using) and Apache configurations are correct. Apache does not read .htaccess files unless allowed by the configuration with AllowOverride All.</li></ul><p>Remember, deploying applications to a production environment requires careful consideration of security and performance aspects. Regularly update your software, monitor application performance, and apply security best practices to keep your deployment smooth and secure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81aa2113bfb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>