<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ADEMOLA OGUNMOKUN</title>
    <description>The latest articles on DEV Community by ADEMOLA OGUNMOKUN (@ademola_isr).</description>
    <link>https://dev.to/ademola_isr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F193059%2F0e10351c-633d-45f0-b63c-e37fe2dc7ec8.jpg</url>
      <title>DEV Community: ADEMOLA OGUNMOKUN</title>
      <link>https://dev.to/ademola_isr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ademola_isr"/>
    <language>en</language>
    <item>
      <title>How to connect your Django local development server to your mobile phone and test your app on your phone.</title>
      <dc:creator>ADEMOLA OGUNMOKUN</dc:creator>
      <pubDate>Sat, 02 Jan 2021 06:46:41 +0000</pubDate>
      <link>https://dev.to/ademola_isr/how-to-connect-your-django-local-development-server-to-your-mobile-phone-and-test-your-app-on-your-phone-3ehh</link>
      <guid>https://dev.to/ademola_isr/how-to-connect-your-django-local-development-server-to-your-mobile-phone-and-test-your-app-on-your-phone-3ehh</guid>
      <description>&lt;p&gt;Building a web application in &lt;a href="//www.djangoproject.com"&gt;Django&lt;/a&gt;, the developer will often use the lightweight local development server to run the code and see the changes that have been made.&lt;/p&gt;

&lt;p&gt;However it is often useful to see how the web app is doing on a particular mobile phone.&lt;/p&gt;

&lt;p&gt;To do that, we need to connect the phone and the computer(local machine) on the same WiFi network. With Phone as the hotspot and the computer as WiFi.&lt;/p&gt;

&lt;p&gt;Thereafter, click on your computer WiFi settings and note the IP address used.&lt;/p&gt;

&lt;p&gt;For this example I am using 192.168.43.167 as the WiFi IP address.&lt;/p&gt;

&lt;p&gt;On the Django project on your computer, click on the settings.py and navigate through to the Allowed Host. Change the empty list to the IP address noted earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#Settings.py
&lt;/span&gt;
&lt;span class="n"&gt;Allowed&lt;/span&gt; &lt;span class="n"&gt;Host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"192.168.43.167"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start your local development server by running&lt;/p&gt;

&lt;p&gt;Python manage.py runserver IP:Port&lt;/p&gt;

&lt;p&gt;For example, if the WiFi IP address noted earlier is 192.168.43.167.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Python&lt;/span&gt; &lt;span class="n"&gt;manage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt; &lt;span class="n"&gt;runserver&lt;/span&gt; &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;43.167&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On your phone browser input the IP address and the port number into the address bar to see your app.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://192.168.43.167:8000"&gt;http://192.168.43.167:8000&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Gitignore (untrack) files already pushed to GitHub repository.</title>
      <dc:creator>ADEMOLA OGUNMOKUN</dc:creator>
      <pubDate>Tue, 29 Dec 2020 13:48:05 +0000</pubDate>
      <link>https://dev.to/ademola_isr/how-to-gitignore-untrack-files-already-pushed-to-github-repository-1h96</link>
      <guid>https://dev.to/ademola_isr/how-to-gitignore-untrack-files-already-pushed-to-github-repository-1h96</guid>
      <description>&lt;p&gt;Most developers usually initialize the folder they are working from as their GitHub repository. However, some files or/and directories may be present in that folder that you would not want to push to GitHub (files such as database, environment variables etc.)&lt;/p&gt;

&lt;p&gt;Adding the file(s) or directories to &lt;a href="https://git-scm.com/docs/gitignore"&gt;gitignore&lt;/a&gt; seems to solve the issue. However, sometimes, you might have unknowingly pushed that file(s) to our GitHub repository failing or forgetting to gitignore the file(s) we did not want to push to the remote repository. &lt;/p&gt;

&lt;p&gt;Once the file has been pushed, adding it to gitignore afterwards would not untrack the file from that commit. The file would still be present in the repository.&lt;/p&gt;

&lt;p&gt;If you have that kind of issue, follow these simple five steps to solve the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Git commit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Make sure the changes you have made on the projects have been added and committed, including the .gitignore file.&lt;/p&gt;

&lt;p&gt;Do this by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m "initial commit" 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Remove all the files in the repository&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You do that by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rm -r --cached .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;rm is the remove command,  adding &lt;strong&gt;-cached&lt;/strong&gt; allow us to remove the files from the index. Our files are still present.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Add everything&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next step is to re-add/track our files. By doing this, the files in the . gitignore file will not be tracked.&lt;/p&gt;

&lt;p&gt;This is done by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Commit the changes.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thus, let's commit our changes by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "gitignore fix"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Push to GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After we are through with everything, we still need to push it to our online GitHub repository by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Basics of openpyxl : A Python module for Excel files</title>
      <dc:creator>ADEMOLA OGUNMOKUN</dc:creator>
      <pubDate>Thu, 10 Dec 2020 15:19:57 +0000</pubDate>
      <link>https://dev.to/ademola_isr/basics-of-openpyxl-a-python-module-for-excel-files-546d</link>
      <guid>https://dev.to/ademola_isr/basics-of-openpyxl-a-python-module-for-excel-files-546d</guid>
      <description>&lt;p&gt;This is an introduction to openpyxl, a Python module built for reading and writing Excel document files. &lt;br&gt;
Most often, we would like to automate many of our repetitive tasks on Excel using a programming language. &lt;/p&gt;

&lt;p&gt;Python's openpyxl module makes it very easy for us to access an excel file.&lt;br&gt;
Note that Openpyxl is not a built-in module, therefore we need to install it first. &lt;/p&gt;
&lt;h1&gt;
  
  
  Installing Openpyxl
&lt;/h1&gt;

&lt;p&gt;Run the following code in your Python terminal to install Openpyxl.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;openpyxl&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code installs the openpyxl module after a few minutes.&lt;br&gt;
To use the openpyxl on our in python, we need to import it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;openpyxl&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Loading our excel file can be done by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;openpyxl&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_workbook&lt;/span&gt;
&lt;span class="n"&gt;survey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;load_workbook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ourworkbook.xlsx"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code above uses the imported load_workbook method to read the excel file of interest and  stores it in variable "survey" &lt;br&gt;
Note that the file we are accessing must be in the same folder we are working from.&lt;/p&gt;

&lt;p&gt;Excel document can contain many sheets, to print all the active sheets in the excel file .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;survey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sheetnames&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code will display the name of the active sheets in the excel files.&lt;br&gt;
To access the first sheet in the document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt; &lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;survey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We stored the first sheet in the excel document as variable "first"&lt;/p&gt;

&lt;h2&gt;
  
  
  Rows and columns in excel file
&lt;/h2&gt;

&lt;p&gt;Accessing column A:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;col_A&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"A"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;col_A&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To access range of columns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;range_A_to_C&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"A:C"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;range_A_to_C&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The range of columns from A to C is stored in the variable "range_A_to_C" as it is shown in the above code, we can thus print it out.&lt;/p&gt;

&lt;p&gt;There are quite few nice things we can do with the Openpyxl module in Python, and interested person should check &lt;a href="https://pypi.org/project/openpyxl/"&gt;Openpyxl documentation&lt;/a&gt; for more information. &lt;/p&gt;

&lt;p&gt;Openpyxl has been around for quite some time now and has its own usefulness. However, better tools (eg. pandas) has been developed in Python for better handling of Excel file. &lt;/p&gt;

</description>
      <category>python</category>
      <category>excel</category>
      <category>openpyxl</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
