<?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 Bernard Adhitya on Medium]]></title>
        <description><![CDATA[Stories by Bernard Adhitya on Medium]]></description>
        <link>https://medium.com/@bernard.adhitya?source=rss-3c42c02249a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*52dZ_UTDfeXoSf992bLb1g.jpeg</url>
            <title>Stories by Bernard Adhitya on Medium</title>
            <link>https://medium.com/@bernard.adhitya?source=rss-3c42c02249a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 17:18:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bernard.adhitya/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[Knee X-ray Analysis with ResNet for Osteoarthritis]]></title>
            <link>https://medium.com/@bernard.adhitya/knee-x-ray-analysis-with-resnet-for-osteoarthritis-29eb39ca8e12?source=rss-3c42c02249a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/29eb39ca8e12</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[resnet]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <dc:creator><![CDATA[Bernard Adhitya]]></dc:creator>
            <pubDate>Mon, 16 Sep 2024 09:56:13 GMT</pubDate>
            <atom:updated>2024-09-16T09:58:36.625Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iYy2Mc1v3nBVcaNUi4tE9A.jpeg" /><figcaption><strong>Figure 1</strong> Illustration on Stages of Knee Osteoarthritis</figcaption></figure><h3><strong>Introduction</strong></h3><p>Osteoarthritis is one of the most common forms of arthritis, especially in older adults. It causes pain and stiffness in joints, particularly in the knees. Determining the severity of osteoarthritis is crucial for deciding appropriate treatment options. Currently, the most common method for assessing osteoarthritis severity is the visual evaluation of knee radiographs by radiologists. However, this method is often subjective and can vary between experts. Therefore, a more objective and consistent method is needed. With advancements in artificial intelligence (AI) technology, particularly in the field of computer vision, models like Convolutional Neural Networks (CNN), such as ResNet, are now being used to automate the analysis of medical images with accuracy and efficiency. This research aims to evaluate the effectiveness of the ResNet CNN model in analyzing knee X-rays to assess osteoarthritis severity.</p><h3><strong>Dataset Used</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fQ78iOkvo7Nw9gjsSVRhAA.png" /><figcaption><strong>Figure 2 </strong>Osteoarthritis Initiative (OAI) Dataset Sample</figcaption></figure><p>This study uses the <em>Osteoarthritis Initiative (OAI)</em> dataset provided by the National Institute of Health (NIH) in the United States. The OAI dataset is a longitudinal study aimed at identifying risk factors and the progression of knee osteoarthritis. It contains thousands of knee X-ray images from various patients, with different levels of osteoarthritis severity, ranging from grade 0 (normal) to grade 4 (severe). These images are labeled with the severity level of osteoarthritis, which helps train and evaluate the CNN model developed in this research.</p><h3><strong>Model Used</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W81n5yfPN49mlss3Vna_Fg.png" /><figcaption><strong>Figure 3 </strong>ResNet Architecture</figcaption></figure><p>The model employed in this study is ResNet18, a deep learning architecture well-known for its effectiveness in medical image processing. ResNet was introduced to address the vanishing gradient problem in deep neural networks by incorporating <em>skip connections</em>. These connections allow gradients to flow more efficiently through the network’s layers, improving both accuracy and stability. The ResNet18 model used in this study is pre-trained on the ImageNet dataset and modified in its final layer to accommodate the five classes present in the osteoarthritis dataset.</p><h3><strong>Preprocessing Steps</strong></h3><p>The preprocessing phase involves several steps. First, the necessary libraries for data processing and model training are imported (Step 1). Second, the OAI dataset is loaded and split into training and test sets (Step 2 and 3). Next, image transformations are applied, such as resizing the images to 224x224 pixels and augmenting the training set with horizontal flips (Step 4). A custom dataset class is created to handle the loading and transformation of images (Step 5). Data loaders are then established to batch the data into sets of 32 and shuffle the training data during each epoch (Step 6). Sample images are visualized to verify that the data has been loaded correctly (Step 7).</p><h3><strong>Model Preparation and Training</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFQk2BKK1kdTVgJEbOw74g.png" /><figcaption><strong>Figure 4</strong> Log of Accuracy and Loss Results per Epoch</figcaption></figure><p>In this phase, the pre-trained ResNet18 model is modified by replacing its final layer to match the number of classes in the dataset (Step 8). The loss function used is CrossEntropyLoss, and the optimization is handled by the Adam optimizer with a learning rate of 0.001 (Step 9). The model is trained for 25 epochs, where each epoch involves multiple iterations of processing batches of training data and updating the model’s weights after each iteration (Step 10). The model’s accuracy is evaluated on the training data throughout the training process.</p><h3><strong>Model Evaluation Results</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNdEnUaN5RsLuCrD3YgnsQ.png" /><figcaption><strong>Figure 5</strong> ResNet Model Evaluation Results on the OAI Test Dataset</figcaption></figure><p>The model was evaluated on the test set, achieving a final accuracy of 94.57% (Step 11). The model performed well across most classes, with high precision, recall, and f1-score values. For example, for class 0 (normal), the model had a precision of 99% and a recall of 93%. Classes with fewer samples, such as class 4 (severe), showed slightly lower performance with an f1-score of 77%. Nevertheless, the model demonstrated good and consistent performance across all classes. Training process took approximately 4 hours for 25 epochs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fF3Em-Xg5TOaX95Bvd08rQ.png" /><figcaption><strong>Figure 6</strong> Confusion Matrix of ResNet Evaluation Results on the OAI Test Dataset</figcaption></figure><h3><strong>Conclusion</strong></h3><p>This research concludes that the ResNet18 model is effective in analyzing knee X-rays for assessing the severity of osteoarthritis. The model achieved high accuracy in classifying X-ray images across different severity levels. However, there is still room for improvement, particularly in handling classes with fewer samples. Future developments could explore the use of other <em>transfer learning</em> architectures or more diverse data augmentation techniques to further enhance the model’s performance, especially for minority classes.</p><p>For more details, I’ve published the notebook on Kaggle here;</p><p><a href="https://www.kaggle.com/code/bernardadhitya/knee-x-ray-analysis-with-resnet-for-osteoarthritis/">Knee X-ray Analysis with ResNet for Osteoarthritis</a></p><h4>References</h4><blockquote>Kumar, G., &amp; Goswami, A. D. (2023). Automatic classification of the severity of knee osteoarthritis using enhanced image sharpening and CNN. <em>Applied Sciences</em>. <a href="https://doi.org/10.3390/app13031658">https://doi.org/10.3390/app13031658</a></blockquote><blockquote>Merino, I., Azpiazu, J., Remazeilles, A., &amp; Sierra, B. (2021). 3D convolutional neural networks initialized from pretrained 2D convolutional neural networks for classification of industrial parts. <em>Sensors</em>. <a href="https://doi.org/10.3390/s21041078">https://doi.org/10.3390/s21041078</a></blockquote><blockquote>Tiulpin, A., Thevenot, J., Rahtu, E., Lehenkari, P., &amp; Saarakkala, S. (2018). Automatic knee osteoarthritis diagnosis from plain radiographs: A deep learning-based approach. <em>Scientific Reports</em>. <a href="https://doi.org/10.1038/s41598-018-20132-7">https://doi.org/10.1038/s41598-018-20132-7</a></blockquote><blockquote>Targ, S., Almeida, D., &amp; Lyman, K. (2016). ResNet in ResNet: Generalizing residual architectures. <em>ArXiv</em>. <a href="https://doi.org/10.48550/arXiv.1603.08029">https://doi.org/10.48550/arXiv.1603.08029</a></blockquote><blockquote>Tan, M., &amp; Le, Q. V. (2019). MixConv: Mixed depthwise convolutional kernels. <em>ArXiv</em>. <a href="https://doi.org/10.48550/arXiv.1907.09595">https://doi.org/10.48550/arXiv.1907.09595</a></blockquote><blockquote>He, K., Zhang, X., Ren, S., &amp; Sun, J. (2016). Deep residual learning for image recognition. <em>Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR).</em> <a href="https://doi.org/10.1109/CVPR.2016.90">https://doi.org/10.1109/CVPR.2016.90</a></blockquote><blockquote>Antony, J., McGuinness, K., Moran, K., &amp; O’Connor, N. E. (2017). Automatic detection of knee joints and quantification of knee osteoarthritis severity using convolutional neural networks. <em>arXiv</em>. <a href="https://arxiv.org/abs/1703.09856">https://arxiv.org/abs/1703.09856</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29eb39ca8e12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Integrate 1000++ Hive Tables into Data Warehouse Without ETL Seamlessly]]></title>
            <link>https://blog.dataengineerthings.org/how-we-integrate-1000-hive-tables-into-data-warehouse-without-etl-seamlessly-38f053e1a00b?source=rss-3c42c02249a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/38f053e1a00b</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[hadoop]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[spark]]></category>
            <dc:creator><![CDATA[Bernard Adhitya]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 13:22:29 GMT</pubDate>
            <atom:updated>2024-05-21T08:26:00.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nAo-DDzC64AddGZC6tiZNA.png" /><figcaption>How Hive and Greenplum are match made in data-heaven ✨ — (Hive logo from <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fen.m.wikipedia.org%2Fwiki%2FFile%3AApache_Hive_logo.svg&amp;psig=AOvVaw1ZganXdFCy3AAN5poAH3SB&amp;ust=1716366067662000&amp;source=images&amp;cd=vfe&amp;opi=89978449&amp;ved=0CBIQjRxqFwoTCMib5f-nnoYDFQAAAAAdAAAAABAE">Wikipedia</a>, and Greenplum logo from <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.cabinetm.com%2Fproduct%2Fpivotal%2Fpivotal-greenplum&amp;psig=AOvVaw3ae0dr8b2cCYOlw_PQK8ZU&amp;ust=1716366088343000&amp;source=images&amp;cd=vfe&amp;opi=89978449&amp;ved=0CBIQjRxqFwoTCJjhsoqonoYDFQAAAAAdAAAAABAb">CabinetM</a>)</figcaption></figure><p>As a Data Engineer within the banking industry, one of my most challenging project is to manage and migrate our core data process to a new infrastructure, which involves making thousands of tables readily available from our data lake to data warehouse.</p><p>Our current data warehouse tech stack, based on SQL Server 2008; a single-node relational database, has reached its end-of-life (EOL), forcing us to come up with a more robust, scalable, and modern solution. After years of research, we decided to <strong>migrate our data warehouse to Greenplum</strong>, and here’s why!</p><h3>Background</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WQII4MGKFGWaV0H2LUwNMA.png" /><figcaption>Visualization on current data lake — data warehouse integration</figcaption></figure><p>Our initial solution to manage data involved a complex setup with Hive, as our data lake, where data was stored in HDFS (Hadoop Distributed File System) and managed via Hive. To feed data from our data lake to the data warehouse, we relied on a combination of PySpark + Airflow. This system was designed to handle the extraction, transformation, and loading (ETL) of data from Hive tables to our data warehouse, a process that was both resource-intensive and time-consuming.</p><h3>Our Data Lake Stack: Hive, PySpark, and Airflow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*J7ha9ibPavWJzSteoV6IqQ.png" /><figcaption>Hive + Spark + Airflow = ❤️</figcaption></figure><p>To fully understand our migration strategy and the decision to move to Greenplum, let’s delve deeper into the tech stack of our data lake, which involves Hive, PySpark, and Airflow.</p><h4>Hive: Architecture and Table Interaction</h4><p>Hive operates on top of the Hadoop ecosystem and is primarily used for querying and managing large datasets in a distributed storage. Hive architecture includes the following components:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ls2FyJ6asa2a2cvLenQNZg.png" /><figcaption>An illustration on how each components contribute in the Hive architecture</figcaption></figure><ul><li>HDFS (Hadoop Distributed File System): The underlying file storage system used for storing actual data in a distributed manner across the cluster.</li><li>Hive Metastore: Stores metadata about the structure of the Hive tables (like schema and data types).</li><li>HiveQL (Hive Query Language): SQL-like language used to write queries on data stored in HDFS via Hive.</li></ul><p>Hive tables are logical constructs used to manage data. When you create a Hive table, you specify the schema and point Hive to the data in HDFS. For instance, let’s consider a simple text file stored in HDFS and how it translates into a Hive table.</p><p>Sample Text File in HDFS (customers.txt):</p><pre>101,John Doe,30,1500.00<br>102,Jane Smith,25,2500.50<br>103,Emily Johnson,22,3200.75<br>104,Michael Brown,35,1800.20</pre><p>Hive Table DDL to Read the Text File:</p><pre>CREATE EXTERNAL TABLE IF NOT EXISTS staging.customers (<br>    customer_id INT,<br>    name STRING,<br>    age INT,<br>    account_balance DECIMAL(10,2)<br>)<br>ROW FORMAT DELIMITED<br>FIELDS TERMINATED BY &#39;,&#39;<br>STORED AS TEXTFILE<br>LOCATION &#39;/user/hive/warehouse/staging/customers&#39;;</pre><p>This DDL forms the table customers which makes it possible to perform SQL-like queries on the data stored in the text file within HDFS.</p><pre>customer_id | name          | age | account_balance<br>------------|---------------|-----|----------------<br>101         | John Doe      | 30  | 1500.00<br>102         | Jane Smith    | 25  | 2500.50<br>103         | Emily Johnson | 22  | 3200.75<br>104         | Michael Brown | 35  | 1800.20</pre><h4>PySpark: Data Processing and Integration</h4><p>Spark is an engine used for large-scale data processing. PySpark is the Python API for Spark that lets data engineers interact with Spark through Python.</p><p>How PySpark Works:</p><ul><li>Reading from Hive: PySpark can connect to Hive and use Spark’s powerful distributed computation capability to process data.</li><li>DataFrames: PySpark processes data in the form of DataFrames, which allows for high-level abstractions and operations on the data.</li></ul><p>Sample PySpark Script to Process Hive Data and Write to SQL Server:</p><pre>from pyspark.sql import SparkSession<br><br># Start a Spark Session<br>spark = SparkSession.builder \<br>    .appName(&quot;Hive to SQL Server Example&quot;) \<br>    .enableHiveSupport() \<br>    .getOrCreate()<br><br># Read data from Hive<br>df = spark.sql(&quot;SELECT * FROM staging.customers&quot;)<br><br># Write to SQL Server (example connection details need to be configured)<br>df.write \<br>  .format(&quot;jdbc&quot;) \<br>  .option(&quot;url&quot;, &quot;jdbc:sqlserver://yourserver.database.windows.net:1433;databaseName=staging&quot;) \<br>  .option(&quot;dbtable&quot;, &quot;customers&quot;) \<br>  .option(&quot;user&quot;, &quot;username&quot;) \<br>  .option(&quot;password&quot;, &quot;password&quot;) \<br>  .save()</pre><h4>Airflow: Job Scheduling and Management</h4><p>Airflow is an open-source tool designed to orchestrate complex workflows and data pipelines.</p><p>How Airflow Works:</p><ul><li>DAGs (Directed Acyclic Graphs): Workflows are defined as DAGs, with each node of the graph being a task in the workflow.</li><li>Schedulers and Executors: Airflow uses schedulers to trigger task runs and executors to execute the tasks.</li></ul><p>Sample Airflow DAG for Multiple Tables:</p><pre>from airflow import DAG<br>from airflow.providers.apache.spark.operators.spark_submit import SparkSubmitOperator<br>from airflow.operators.dummy import DummyOperator<br>from datetime import datetime, timedelta<br><br>default_args = {<br>    ‘owner’: ‘airflow’,<br>    ‘depends_on_past’: False,<br>    ‘start_date’: datetime(2021, 1, 1),<br>    ‘email_on_failure’: False,<br>    ‘email_on_retry’: False,<br>    ‘retries’: 1,<br>    ‘retry_delay’: timedelta(minutes=5),<br>}<br>dag = DAG(‘hive_to_sqlserver’,<br>          default_args=default_args,<br>          description=’Load tables from Hive to SQL Server’,<br>          schedule_interval=timedelta(days=1),<br>          catchup=False)<br><br>tables = [‘transactions’, ‘casa_account’, ‘customers’, ‘loan’, ‘loan_account’]<br><br>start = DummyOperator(task_id=“start_process”, dag=dag)<br>end = DummyOperator(task_id=“end_process”, dag=dag)<br><br>for table in tables:<br>    task = SparkSubmitOperator(<br>        task_id=f’load_{table}_table’,<br>        application=’path/to/your/spark_script.py’,  # Your Spark application path<br>        name=f’load_{table}’,<br>        application_args=[table],<br>        dag=dag<br>    )<br>    start &gt;&gt; task &gt;&gt; end<br></pre><p>Which results to the following DAG;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1oQtjsx9AP6OqNrIKiSUhg.png" /><figcaption>An Airflow DAG that ingests data to SQL Server using SparkSubmitOperator</figcaption></figure><p>With the combination of Hive, PySpark and Airflow, our data lake is able to ingest data from various data sources in our bank, and process them into data products, which are then made available to our end users by feeding the data to their database or other desired format, scheduled thoroughly.</p><h3>Challenges of Manual Feeding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2321H2U0PLzWECh3UdYgA.jpeg" /><figcaption>A very complex and tangled data pipeline…</figcaption></figure><p>The primary challenge with manually feeding data from the data lake to the data warehouse included:</p><h4>High Resource Consumption</h4><p>Running 1000++ table transfers daily would require huge resources. Both the data lake and the data warehouse will experience high loads. This slows down other processes that rely on the same infrastructure, such as existing data processing or real-time analytics.</p><h4>Complex Scheduling</h4><p>With multiple DAGs and dependencies, scheduling becomes a complex task. Making sure that dependencies are met and jobs are completed in sequence within SLA for data consistency can be challenging.</p><p>Monitoring hundreds and thousands of processes that run across multiple systems (Hive, Spark, SQL Server) increases operational complexity. This requires robust monitoring tools and potentially more personnel to oversee operations.</p><p>With the increase in job numbers, the potential for failures increases. Effective mechanisms need to be in place to quickly identify, log, and address failures or data inconsistencies.</p><h4>Maintenance Overhead</h4><p>As the number of tables and the complexity of data transformations grow, maintaining the data pipelines (updates, changes in data schema, etc.) will require more effort and coordination.</p><p>Enhanced infrastructure to handle the load will inevitably lead to increased costs — both capital expenditure for hardware and operational expenses for maintenance and energy consumption.</p><h3>Introducing Greenplum!</h3><p>Greenplum is a multi-node PostgreSQL data warehouse, which offers a powerful MPP (massively parallel processing) architecture, making it highly effective for large-scale data analytics. Unlike traditional databases, Greenplum enables high-performance queries across petabytes of data and integrates seamlessly with various data sources, making it an ideal choice for our next-generation data warehouse.</p><p>One key feature we found in Greenplum which we find very fascinating is the <strong>Platform Extension Framework (PXF)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*FBm2ADvQvWJeLjpdpaFgOw.png" /><figcaption>How Greenplum can integrate with various data stores seemlessly — (Illustration from <a href="https://www.kodyaz.com/images/aws/Greenplum-Platform-Extension-Framework.png">Kodyaz.com</a>)</figcaption></figure><p>It allows Greenplum to access external databases, files, and web services through simple SQL queries. PXF supports Hive, enabling direct access to tables stored in HDFS without duplicating them into Greenplum. This direct access is facilitated via external tables using PXF’s Hive connector, which we configured to interface seamlessly with our Hive setup.</p><h3>Integrating Hive Tables into Greenplum Using PXF</h3><h4>1. Ensure PXF is Installed and Running</h4><ul><li>Check that PXF is installed on your Greenplum cluster nodes and that the PXF service is started. PXF usually comes pre-installed with Greenplum.</li></ul><h4>2. Configure PXF to Access Hive</h4><ul><li>Configure the PXF Hive connector. You’ll need to set up a server configuration in PXF that includes the Hive metastore URI and potentially other security settings if your Hive installation requires it.</li></ul><pre># Example: Setting up or editing PXF configuration for Hive<br>cd $PXF_CONF/servers/hive<br>echo &quot;jdbc.url=jdbc:hive2://hive-metastore-host:10000/default&quot; &gt; hive-site.xml<br>echo &quot;jdbc.user=&lt;username&gt;&quot; &gt;&gt; hive-site.xml<br>echo &quot;jdbc.password=&lt;password&gt;&quot; &gt;&gt; hive-site.xml</pre><ul><li>Restart PXF service after making changes to the configuration.</li></ul><pre>pxf cluster restart</pre><h4>3. Define an External Table in Greenplum Using PXF</h4><p>We created external tables in Greenplum that directly read from Hive tables. This approach eliminates the need for complex ETL processes, as data can now be queried in real-time from its source in HDFS through Greenplum. Here’s a sample DDL for creating an external table in Greenplum that links to a Hive table:</p><pre>CREATE EXTERNAL TABLE staging.customers (<br>    customer_id INT,<br>    name TEXT,<br>    age INT,<br>    account_balance NUMERIC<br>)<br>LOCATION (&#39;pxf://staging.customers?PROFILE=hive&amp;SERVER=hive&#39;)<br>FORMAT &#39;CUSTOM&#39; (FORMATTER=&#39;pxfwritable_import&#39;);</pre><p>staging.customers is the name of the external table in Greenplum, and the columns should match those defined in the Hive table both in name and compatible data types.</p><p>The key for an external table to read table cross-platform is its LOCATION clause;</p><ul><li>pxf://staging.customers specifies the Hive database (staging) and table (customers) you are accessing.</li><li>PROFILE=hive tells PXF to use the Hive connector.</li><li>SERVER=hive refers to the PXF server configuration for Hive that you have set up.</li><li>FORMAT ‘CUSTOM’ (FORMATTER=’pxfwritable_import&#39;) specifies that the data format being imported from Hive via PXF should be handled by Greenplum’s writable external table format.</li></ul><h4>4. Query the External Table</h4><p>Once the external table is created, you can query it directly using standard SQL commands in Greenplum:</p><pre>SELECT * FROM staging.customers;</pre><h3>Why Greenplum + PXF Approach?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u1afI3heFmV_O5hoPRVALw.png" /><figcaption>Visualization on data lake — data warehouse integration without ETL</figcaption></figure><p>We chose to use the Greenplum + PXF approach because the combination matches our need for efficiency, up-to-date information, and a simpler system.</p><h4>Reduced Data Redundancy</h4><p>Using Greenplum with PXF helps us avoid duplicating data. Normally, data warehouses need to copy data from the data lake into the warehouse. With PXF linking directly to our Hive data, we skip this step. This saves space and reduces the effort needed to keep data updated and consistent, streamlining how we manage and synchronize our data.</p><h4>Real-Time Access</h4><p>Moreover, this method lets us access the most current data quickly. Having up-to-date information is crucial for timely decision-making. With Greenplum’s external tables, we can directly query data from Hive, ensuring our reports and analyses are always based on the latest data without the usual delays that come with traditional data transfers. This speedy access supports faster and better decisions across the bank.</p><h4>Simplified Architecture</h4><p>Lastly, by removing unnecessary ETL (Extract, Transform, Load) processes, our data architecture becomes simpler and easier to manage. Fewer components mean less maintenance, fewer things that can go wrong, and more stability. This simplification allows our data teams to focus more on analyzing data and less on managing data systems.</p><h3>Things to Consider When Using Greenplum + PXF Approach</h3><p>Using Greenplum with PXF to integrate our data warehouse with our Hive data lake comes with several benefits but also a few important challenges to consider.</p><p>When we query large sets of data using external tables that connect directly to Hive, the speed of our queries can suffer. If the network is busy or the Hive server is overloaded, it can take longer to get the data we need. Optimizing queries on external tables can be tricky. This is because Greenplum doesn’t fully control the external data in Hive, making it harder to fine-tune these queries for better performance.</p><p>Our data warehouse’s performance is closely dependent to our data lake condition. Any problems with Hive, like slow performance or server downtime, will directly affect how quickly and reliably we can access our data in Greenplum.</p><p>Migrating to Greenplum and integrating Hive tables using PXF has significantly streamlined our data management processes. By eliminating traditional ETL tasks, we’ve reduced operational overhead, enhanced performance, and enabled real-time data access and analytics. This strategy not only meets our current needs but also scales effectively as our data demands grow, proving to be a significant upgrade in our data warehousing capabilities in the banking sector.</p><p>— Bernard Adhitya</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38f053e1a00b" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/how-we-integrate-1000-hive-tables-into-data-warehouse-without-etl-seamlessly-38f053e1a00b">How We Integrate 1000++ Hive Tables into Data Warehouse Without ETL Seamlessly</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Web Server with NodeMCU ESP8266 and LM35 Temperature Sensor]]></title>
            <link>https://medium.com/h7w/building-a-web-server-with-nodemcu-esp8266-and-lm35-temperature-sensor-d4db54bf6113?source=rss-3c42c02249a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4db54bf6113</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Bernard Adhitya]]></dc:creator>
            <pubDate>Wed, 24 Apr 2024 15:26:59 GMT</pubDate>
            <atom:updated>2024-11-08T06:17:23.327Z</atom:updated>
            <content:encoded><![CDATA[<p>The ability to monitor environmental data through simple web interfaces can be incredibly useful. In this article, I’d like to dive into a project I’ve been part of, where we use a NodeMCU ESP8266 module along with an LM35 temperature sensor to create a web server that displays temperature readings. This project demonstrates not just a practical application of IoT principles, but also the ease with which one can integrate sensors, microcontrollers, and web technologies.</p><h3>Project Overview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*fZ9ON1c7aathxYig3-sNyA.png" /><figcaption>Simple System Design of How ESP8266 + LM35 Output Accessed Through Web Server</figcaption></figure><p>The goal of this project was to set up a NodeMCU ESP8266 as a web server that could read temperature data from an LM35 sensor and display it on a web page accessible within a local network. The LM35 sensor was chosen for its straightforward output that directly corresponds to the temperature in Celsius, making it ideal for our needs without requiring complex calibration.</p><h3>Materials Needed</h3><ul><li>NodeMCU ESP8266 board</li><li>LM35 temperature sensor</li><li>Breadboard and connecting wires</li><li>Mini USB cable for programming and power supply</li></ul><h3>Understanding the LM35 Temperature Sensor</h3><p>The LM35 temperature sensor is a precision integrated-circuit device that is widely favored for its ease of use and accurate temperature readings. It is particularly advantageous in projects like ours due to its direct output of temperature without the need for complex calculations or calibrations.</p><p>The LM35 sensor measures temperature by outputting an analog voltage that is linearly proportional to the Celsius temperature. The scale factor is 10 mV/°C, which means for every degree Celsius increase, the output voltage increases by 10 millivolts. This characteristic allows for straightforward integration with microcontrollers like the NodeMCU ESP8266, which can read analog voltages.</p><h3>Converting Voltage to Temperature</h3><p>To convert the analog voltage reading from the LM35 into a temperature reading, we use the following formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*5kRBJf632jq7KHxE7oLw1w.png" /></figure><p>In the context of our NodeMCU ESP8266 setup, where the ADC (Analog to Digital Converter) reference voltage is 3.3V and the resolution is 10 bits, the maximum readable voltage is 3.3V (or 3300 mV), and it can be divided into 1024 parts (since 2¹⁰ = 1024). Therefore, each unit of ADC reading represents 3300/1024​ mV. Here’s how we implement it in our code:</p><p>Read the analog value from the LM35 connected to the A0 pin.</p><p>Convert this reading to a voltage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*GxHd6wyKYRRvhnorNuACqQ.png" /></figure><p>Convert the voltage to a temperature:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*uwZj54ev8t4H0t-7z-X0hg.png" /></figure><p>This calculation results in the temperature in degrees Celsius, which can be displayed on the web server.</p><h3>Alternatives to LM35</h3><p>The LM35 sensor is an excellent choice for projects that require straightforward, accurate temperature monitoring. It fits perfectly into our scenario where simplicity and cost-effectiveness are key considerations.</p><p>While the LM35 is well-suited for many applications, alternatives like the DS18B20 and the DHT11/DHT22 sensors also offer temperature measurement capabilities:</p><ul><li>DS18B20: This sensor provides digital temperature readings and communicates over a one-wire bus, eliminating the need for analog to digital conversion. It is accurate and suitable for applications requiring digital communication.</li><li>DHT11/DHT22: These sensors measure both temperature and humidity, making them useful for environmental monitoring. However, they are slower in response and less accurate in temperature readings compared to the LM35.</li></ul><h3>Step 1: Assembling the Circuit</h3><p>Connecting the LM35 to NodeMCU:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*SIz4I8sVTDZVsZsXWmw0Jg.png" /><figcaption>NodeMCU ESP8266 and LM35 Temperature Sensor Circuit</figcaption></figure><ul><li>Connect the first pin (left pin if the flat side is facing you) of the LM35 to the 3V pin on the NodeMCU.</li><li>Connect the middle pin of the LM35 to the A0 (analog input) pin on the NodeMCU.</li><li>Connect the third pin (right pin) of the LM35 to a GND pin on the NodeMCU.</li></ul><p>This simple setup allows the LM35 to send an analog voltage to the NodeMCU that is proportional to the temperature it senses.</p><h3>Step 2: Programming the NodeMCU</h3><h4>Setup and Network Connection</h4><p>The ESP8266 module can be programmed to connect to a WiFi network using its onboard WiFi capabilities. This is accomplished through simple programming steps using the Arduino IDE. Here’s the typical workflow:</p><ol><li>Include the ESP8266WiFi library which provides the necessary functions to connect to a WiFi network.</li><li>Set the WiFi credentials: The network name (SSID) and password are set as constants in the code.</li><li>Initiate the connection: The WiFi.begin() function is used with the SSID and password as parameters.</li><li>Monitor the connection status: The connection attempt can be monitored in a loop using WiFi.status() until the connection is established.</li><li>Creating an instance of the web server on a specific port, typically port 80 for HTTP.</li><li>Starting the server with server.begin(), which makes the ESP8266 listen for incoming connections.</li></ol><pre>#include &lt;ESP8266WiFi.h&gt;<br>#include &lt;WiFiClient.h&gt;<br>#include &lt;ESP8266WebServer.h&gt;<br>#include &lt;ESP8266mDNS.h&gt;<br><br>const char* ssid = &quot;YOUR_WIFI_SSID&quot;;<br>const char* password = &quot;YOUR_WIFI_PASSWORD&quot;;<br>ESP8266WebServer server(80);<br><br>void setup() {<br>  Serial.begin(115200);<br>  WiFi.mode(WIFI_STA);<br>  WiFi.begin(ssid, password);<br><br>  while (WiFi.status() != WL_CONNECTED) {<br>    delay(500);<br>    Serial.print(&quot;.&quot;);<br>  }<br>  Serial.println(&quot;&quot;);<br>  Serial.print(&quot;Connected to &quot;);<br>  Serial.println(ssid);<br>  Serial.print(&quot;IP address: &quot;);<br>  Serial.println(WiFi.localIP());<br><br>  if (MDNS.begin(&quot;esp8266&quot;)) {<br>    Serial.println(&quot;MDNS responder started&quot;);<br>  }<br><br>  server.on(&quot;/&quot;, handleRoot);<br>  server.begin();<br>  Serial.println(&quot;HTTP server started&quot;);<br>}</pre><h4>Setting Up as a Web Server</h4><p>The ESP8266 can serve as a web server using the ESP8266WebServer library. This involves defining handlers for different endpoints which determine how the server responds to HTTP requests. For our project, a handler function handleRoot() is used to serve the temperature data when the root URL is accessed.</p><p>The web server serves a simple HTML page that displays the temperature:</p><pre>const char MAIN_page[] PROGMEM = R&quot;=====(<br>&lt;HTML&gt;<br>  &lt;HEAD&gt;<br>    &lt;meta http-equiv=&quot;refresh&quot; content=&quot;2&quot;&gt;<br>    &lt;TITLE&gt;Temperature Sensor LM35&lt;/TITLE&gt;<br>  &lt;/HEAD&gt;<br>  &lt;BODY&gt;<br>    &lt;CENTER&gt;<br>      &lt;p1&gt;&lt;b&gt;Temperature Sensor LM35&lt;/b&gt;&lt;/p1&gt;<br>      &lt;br/&gt;<br>      &lt;p2&gt;Temperature: #TEMPERATURE_VAL# &amp;deg;C&lt;/p2&gt;<br>    &lt;/CENTER&gt;  <br>  &lt;/BODY&gt;<br>&lt;/HTML&gt;<br>)=====&quot;;<br><br>void handleRoot() {<br>  float reading = analogRead(A0);<br>  float voltage = reading * (3.30 / 1024.0);<br>  temperatureC = voltage * 100;<br><br>  Serial.print(&quot;analog read -&gt; &quot;);<br>  Serial.print(reading);<br><br>  Serial.print(&quot; | voltage -&gt; &quot;);<br>  Serial.print(voltage);<br><br>  Serial.print(&quot; | temperature (celcius) -&gt; &quot;);<br>  Serial.println(temperatureC);<br><br>  String s = MAIN_page;<br>  s.replace(&quot;#TEMPERATURE_VAL#&quot;, String(temperatureC));<br><br>  server.send(200, &quot;text/html&quot;, s);<br>}</pre><p>The HTML meta tag &lt;meta http-equiv=&quot;refresh&quot; content=&quot;2&quot;&gt; in the webpage&#39;s header ensures that the webpage refreshes every 2 seconds, displaying the most recent temperature reading.</p><p>Once done, we tell the server to host the web server by looping server.handleClient() and MDNS.update() . Make sure to give it a little delay of 500 ms to server as buffer.</p><pre>void loop(void) {<br>  server.handleClient();<br>  MDNS.update();<br>  delay(500);<br>}</pre><h3>Step 3: Run the Circuit and Web Server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mxd8vMLQhi4NsDNXqd5r9g.png" /><figcaption>Web Server HTML Page and Serial Monitor Log of the ESP8266 + LM35 Circuit</figcaption></figure><p>As a result, when entering the IP address of the ESP8266 webserver, a display will appear showing the temperature value detected by the LM35 sensor, and will be refreshed every 0.5 seconds;</p><p>This project not only provided a hands-on experience with IoT hardware and software but also demonstrated how microcontrollers like the NodeMCU ESP8266 can be used to create useful web-based applications. By deploying a web server that provides real-time temperature data, we can monitor environmental conditions conveniently through any device connected to the same network. This opens up numerous possibilities for home automation, environmental monitoring, and much more.</p><p>— Bernard Adhitya</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4db54bf6113" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/building-a-web-server-with-nodemcu-esp8266-and-lm35-temperature-sensor-d4db54bf6113">Building a Web Server with NodeMCU ESP8266 and LM35 Temperature Sensor</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Temperature and Humidity Sensor with DHT11 and NodeMCU ESP8266]]></title>
            <link>https://medium.com/engineering-iot/building-a-temperature-and-humidity-sensor-with-dht11-and-nodemcu-esp8266-e7522ff7a866?source=rss-3c42c02249a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7522ff7a866</guid>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Bernard Adhitya]]></dc:creator>
            <pubDate>Wed, 17 Apr 2024 15:46:39 GMT</pubDate>
            <atom:updated>2025-01-29T15:39:07.337Z</atom:updated>
            <content:encoded><![CDATA[<p>To truly understand how sensor contributes to an IoT project, I learned to build a basic project; use temperature and humidity sensor DHT11 and connecting it to a NodeMCU ESP8266 . This blog post will guide you through the process step-by-step, from setting up your environment to reading the sensor data.</p><h3>Materials Needed</h3><ul><li>NodeMCU ESP8266 board</li><li>DHT11 Temperature and Humidity Sensor</li><li>Jumper wires</li><li>Mini USB cable</li><li>A personal computer with Arduino IDE installed</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDgKvmbsORffzfGFZiwmfw.jpeg" /><figcaption>NodeMCU ESP8266 and DHT11 Sensor</figcaption></figure><h3>Step 1: Setting Up Your Arduino Environment</h3><p>Before diving into the hardware assembly, ensure that your Arduino IDE is properly configured to work with the NodeMCU board:</p><ol><li>Install Arduino IDE: Download and install the Arduino IDE from the Arduino website.</li><li>Configure the IDE for ESP8266:</li></ol><ul><li>Open Arduino IDE and navigate to File &gt; Preferences.</li><li>Add the ESP8266 board manager URL (http://arduino.esp8266.com/stable/package_esp8266com_index.json) to the &quot;Additional Boards Manager URLs&quot;.</li><li>Open Tools &gt; Board &gt; Boards Manager, search for ESP8266, and install the package by ESP8266 Community.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-WaJ7BdoALY8Ybm1de2iA.png" /><figcaption>Setting Up Arduino IDE to Recognize NodeMCU ESP8266 Board</figcaption></figure><ul><li>Install necessary drivers like CP210x VCP Driver and NodeMCU PyFlasher for MacOS to ensure the board connects properly via USB.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nr0oNomz6LIRTFvzb0ndMA.png" /><figcaption>Install CP210x VCP Driver and NodeMCU PyFlasher</figcaption></figure><h3>Step 2: Assembling the Circuit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooTsjMo4YO8Ymaj0t6bhlw.png" /><figcaption>Connect the Pins on DHT11 Sensor to NodeMCU ESP8266</figcaption></figure><p>Construct the circuit to connect the DHT11 sensor to the NodeMCU ESP8266 according to the sample image above;</p><ul><li>Connect the + (plus) pin of the DHT11 sensor to the 3V pin on the NodeMCU.</li><li>Connect the out pin of the DHT11 sensor to pin D7 of the NodeMCU.</li><li>Connect the — (minus) pin of the DHT11 sensor to one of the GND (ground) pins on the NodeMCU.</li><li>Use jumper wires to make these connections tidy and secure.</li></ul><h3>Step 3: Programming the NodeMCU</h3><p>With the circuit ready, the next step involves programming the NodeMCU to read data from the DHT11 sensor:</p><ul><li>Write the Code: Develop the code in the Arduino IDE, ensuring to adjust the pin number to D7 and include the correct libraries for the DHT11 sensor. Below is a simplified version of the necessary code:</li></ul><pre>#include &quot;DHT.h&quot;<br><br>#define DHTPIN D7     // what pin we&#39;re connected to<br>#define DHTTYPE DHT11   // DHT 11<br>DHT dht(DHTPIN, DHTTYPE);<br><br>void setup() {<br>  Serial.begin(9600); <br>  dht.begin();<br>}<br><br>void loop() {<br>  // Reading temperature or humidity takes about 250 milliseconds!<br>  float humidity = dht.readHumidity();<br>  // Read temperature as Celsius (the default)<br>  float temperature = dht.readTemperature();<br>  // Check if any reads failed and exit early (to try again).<br>  if (isnan(humidity) || isnan(temperature)) {<br>    Serial.println(&quot;Failed to read from DHT sensor!&quot;);<br>    return;<br>  }<br>  Serial.print(&quot;Humidity: &quot;);<br>  Serial.print(humidity);<br>  Serial.print(&quot; %\t&quot;);<br>  Serial.print(&quot;Temperature: &quot;);<br>  Serial.print(temperature);<br>  Serial.println(&quot; *C&quot;);<br>  delay(2000); // Delay between readings.<br>}</pre><ul><li>Upload the Code: Connect your NodeMCU board to your computer via a mini USB cable. In Arduino IDE, select the correct board under Tools &gt; Board and the port that shows your NodeMCU. Click the upload button to transfer your sketch to the board.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*dNz2ORrwOES4xUp9EICKeA.png" /><figcaption>Make Sure the NodeMCU ESP8266 Board is Connected</figcaption></figure><h3>Step 4: Monitoring Output</h3><p>Finally, monitor the temperature and humidity readings:</p><ul><li>Open the Serial Monitor from the Arduino IDE.</li><li>Set the baud rate to 9600.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*1yaAUlkoVMKHwy9EHvDjog.png" /><figcaption>Open Serial Monitor and Use 9600 Baut Rate</figcaption></figure><ul><li>Observe the temperature and humidity data displayed every two seconds. Adjust the sensor’s environment, such as placing it near a fan, to see changes in the readings.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-QAkyLKRpFGHg8DH1JMawQ.png" /></figure><p>Setting up a DHT11 sensor with a NodeMCU ESP8266 is a straightforward yet powerful project for anyone interested in entering the IoT world. This setup not only provides real-time environmental data but also serves as a foundation for more complex projects like home automation systems or weather stations. With this knowledge, you’re well on your way to exploring the vast possibilities of IoT.</p><p>— Bernard Adhitya</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7522ff7a866" width="1" height="1" alt=""><hr><p><a href="https://medium.com/engineering-iot/building-a-temperature-and-humidity-sensor-with-dht11-and-nodemcu-esp8266-e7522ff7a866">Building a Temperature and Humidity Sensor with DHT11 and NodeMCU ESP8266</a> was originally published in <a href="https://medium.com/engineering-iot">Engineering IoT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying WordPress on Amazon EC2: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@bernard.adhitya/deploying-wordpress-on-amazon-ec2-a-step-by-step-guide-99f87a586e27?source=rss-3c42c02249a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/99f87a586e27</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Bernard Adhitya]]></dc:creator>
            <pubDate>Sun, 14 Apr 2024 19:22:13 GMT</pubDate>
            <atom:updated>2024-04-14T19:26:05.596Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most effective way to understand cloud computing is to actually dive-in to project-based exercise. When I started learning Amazon Web Service (AWS), my first exercise is to deploy Wordpress; a popular open-source blogging platform to public, using Amazon EC2 instance.</p><p>How it works is that the EC2 instance will host the things Wordpress needs to be up and running; a webserver and a database. The design can be illustrated like below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gV02RXcitlb1vn8nnQEDdw.png" /><figcaption>System Design for Deploying Wordpress in Amazon EC2 Instance</figcaption></figure><p>This guide will walk you through deploying WordPress on an AWS EC2 instance from scratch, ensuring you understand each step clearly — from creating the instance to accessing your WordPress site publicly and setting up API endpoints for development with Postman.</p><h4>Step 1: Creating an EC2 Instance</h4><p>First, log into your AWS account and navigate to the EC2 dashboard. Here, you’ll create a new EC2 instance which acts as your cloud server. For this setup, choose the Ubuntu 22.04 OS for its reliability and widespread support. During this process, you’ll also need to generate a key pair. This key pair is crucial as it will be used to SSH into your instance securely from your local terminal, providing the base for your WordPress setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZ5wjuXmC1YGj8CyUOtHSw.png" /><figcaption>Creating a New EC2 Instance with Ubuntu 22.04 OS Installed</figcaption></figure><h4>Step 2: Initial Setup and Installation</h4><p>Once your EC2 instance is running, access it via an SSH session from your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hG2cTNdCwA_eERq53RfMbg.png" /><figcaption>Login to EC2 Instance via Remote SSH</figcaption></figure><p>This is where the actual setup begins. Start by updating your package manager and installing necessary components:</p><pre>sudo su<br>apt update &amp;&amp; apt upgrade<br>apt install apache2 mariadb-server<br>apt install php7.4 php7.4-cli php7.4-mbstring php7.4-gd php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-zip php7.4-curl</pre><p>Note that PHP version compatibility with WordPress is essential, hence the selection of PHP 7.4. Additionally, install npm and xmysql, which will later allow you to create a MySQL API for development access:</p><pre>apt install npm<br>npm install -g xmysql</pre><h4>Step 3: Configuring MySQL and WordPress</h4><p>Next, configure your MySQL installation to set up the WordPress database:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b39GHFSwhW1_PZhYXg-xXw.png" /><figcaption>Setting Up Database and Users for Wordpress Backend</figcaption></figure><p>Adjust `bind-address` in your MySQL configuration to `0.0.0.0` to allow remote connections, vital for API interactions and external database management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f03tPuMWFtxcSRl_CCCTpA.png" /><figcaption>Add bind-access in MySQL Configuration File</figcaption></figure><p>Download and configure WordPress:</p><pre>wget https://wordpress.org/latest.zip<br>unzip latest.zip -d /var/www/html/<br>mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php</pre><p>Edit `/var/www/html/wordpress/wp-config.php` to include the database details you configured above, ensuring WordPress can interact with its database smoothly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Qn7W73oUfoYPi0VDef_SA.png" /><figcaption>Add Access Information to MySQL for Wordpress Database</figcaption></figure><h4>Step 4: Configuring Apache and WordPress</h4><p>Modify Apache’s configuration in `/etc/apache2/sites-available/default-ssl.conf` to serve your WordPress site. Enable the necessary modules and set up your site configuration in Apache to direct traffic to the WordPress directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbG5r9OqXRTrehJONdn0Nw.png" /><figcaption>Enable Redirection to Wordpress when Accessing EC2 Instance Webserver</figcaption></figure><h4>Step 5: Accessing WordPress</h4><p>Now, WordPress should be accessible via your EC2 instance’s public IP, e.g., `<a href="http://your-ec2-ip/wordpress%60">http://your-ec2-ip/wordpress`</a>. Follow the on-screen instructions to finish the WordPress installation through its web interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_oezxWEaVNnhtYNtH0e3g.png" /><figcaption>Wordpress Admin Dashboard</figcaption></figure><h4>Step 6: Setting Up API Access with Postman</h4><p>If you have admin access, the user will be directed to the admin dashboard which functions completely; manage blog posts, content, website design, and so on, because WordPress is connected to a database which also functions. For example, I created a blog post to demonstrate my WordPress functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TMpfl_DR9H0nk8iFsRGSDA.png" /><figcaption>Sample Blog Created from Wordpress Admin Dashboard</figcaption></figure><p>The post is stored in the MySQL database “wpdb”, which was previously created. When Wordpress successfully connects to the database, the tables required for Wordpress function are automatically created, and data will be written and stored in this database, as in the following example;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IW4J8xIZGqJ074qvcun67w.png" /><figcaption>MySQL Database for Wordpress</figcaption></figure><h4>Step 6: Setting Up API Access with Postman</h4><p>For API interaction, particularly useful for developers, install and configure xmysql:</p><pre>npm install -g xmysql<br>xmysql -h localhost -u wordpressuser -p password -d wordpress</pre><p>Then turn on xmysql by filling in the host you want to turn on, MySQL user, MySQL password, and the database you want to use, in this case wpdb, as a Wordpress database</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OrQGov-NKPLj9N52tiq7LA.png" /><figcaption>Running xmysql to Generate Rest APIs</figcaption></figure><p>Ensure your EC2 security group allows traffic on the port used by xmysql (default 3000). Now, you can use Postman to interact with your WordPress database via API, accessing data in JSON format for easy manipulation and testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dPEgpL4aax0iNav-QzhAMg.png" /><figcaption>Allow Traffic on Port 3000 on EC2 Instance to Access Rest APIs</figcaption></figure><p>By using Postman, you can make calls to the API endpoints generated by xmysql and work with your WordPress data directly, such as retrieving posts, updating content, or any other CRUD operations, all in real-time and via a user-friendly interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QvG3wmE-z5h_W-Bdvp9G0g.png" /><figcaption>GET Request to Get All Wordpress Posts using Postman</figcaption></figure><p>Deploying WordPress on an AWS EC2 instance provides a flexible, powerful platform for hosting a dynamic website accessible worldwide. By integrating with tools like Postman and technologies like xmysql, developers gain a powerful environment for creating, testing, and deploying web applications. This step-by-step guide not only sets up a robust WordPress site but also extends its functionality for API-driven development, ensuring you have a comprehensive, scalable web solution.</p><p>— Bernard Adhitya</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99f87a586e27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello World !]]></title>
            <link>https://medium.com/@bernard.adhitya/hello-world-0596f99e7309?source=rss-3c42c02249a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0596f99e7309</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Bernard Adhitya]]></dc:creator>
            <pubDate>Tue, 09 Apr 2024 11:46:26 GMT</pubDate>
            <atom:updated>2024-04-09T11:46:26.052Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, and welcome to my blog! I’m Bernard, and I’m so excited to start my blog! I am a Data Engineer, currently in the banking industry, and am currently taking masters in computer science. I want to share what I learned in class, share my knowledge and experiences, and make a space where I can freely share my insights regarding my career and studies.</p><h3>A Bit About Me</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ey4X280A2cQyBsaHaq-nqA.jpeg" /><figcaption>Me as an intern, sharing our team’s final project ✨</figcaption></figure><p>So, a little about me. I’ve been working in the banking world for the last four years. It started with a year as a software engineer, which was a great way to get my feet wet. Then, I shifted gears and jumped into an IT management trainee program, where I started my journey as a data engineer.</p><p>For the past three years, as a data engineer, I’ve been involved in various projects; data migration, developing data ingestion framework, optimize data pipeline processes, and involved in providing our data to various users across the bank.</p><p>But that’s not all. Right now, I’m working on getting my master’s degree in computer science. For the next three semesters, I’ll further study my field in depth and will eventually start my research for my thesis.</p><h3>Why I Started This Blog</h3><p>I decided to start this blog to share what I learn with you. There’s a ton of subjects we can dive into together, from technical subjects like IoT, Big Data, Machine Learning, and Deep Learning to the management-related sides of IT like Business Intelligence, risk management, and audit in IT.</p><p>Who knows, I might also be sharing the ups and downs of working on my thesis someday. I’m hoping that by sharing my experiences, I can help someone else out there who might be interested in knowing further the things I’m currently going through. Plus, it’s always more fun when you’ve got friends along for the ride 😉.</p><h3>Stick Around, and Buckle Up!</h3><p>Whether you’re a student like me, working in tech, or just curious about how all this stuff works, hopefully this space can be inspiring and insightful for you.</p><p>So, stick around, drop me a comment, and let’s make this blog a place where we can all learn something new. Your support means a ton, and I can’t wait to get started on this adventure with you.</p><p>Thanks for stopping by, and here’s to the journey ahead!</p><p>— Bernard Adhitya</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0596f99e7309" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>