Skip to content

Add Complete Tutorials #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 24, 2023
Merged

Conversation

rajkumardongre
Copy link
Contributor

No description provided.

Copy link
Member

@milancurcic milancurcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank your for this PR, @rajkumardongre, great progress.

Only tiny formatting nit-picks for now:

  • tuotrial.md -> tutorial.md
  • Don't bold the text in the headings
  • real_proj -> I suggest just "mini-project" or "example-project"

I will take some time to go through the tutorial and test that everything works.

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It is easy to follow and repeat.

fpm build
```

### **Step 5: Import the Libraries**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### **Step 5: Import the Libraries**
### **Step 4: Import the Libraries**


* `to_string` : We use this function to convert integers to their string representations

### **Step 6: Create the `print_org_repositories` Subroutine**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### **Step 6: Create the `print_org_repositories` Subroutine**
### **Step 5: Create the `print_org_repositories` Subroutine**

README.md Outdated

* **[foropenai](https://github.com/gha3mi/foropenai):** A Fortran library for OpenAI API.

*~By [AliG (gha3mi)](https://github.com/gha3mi)*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The primary purpose of this project is to facilitate interaction with the OpenAI API. To achieve this, the project is using http package for making API calls.


# **Prerequisite** 🚩

Before building the GitHub Organization Analyzer library and running the program, you need to ensure that you have [`fpm`](https://fpm.fortran-lang.org/) (Fortran Package Manager) installed. Additionally, there is one dependency required for the [`http-client`](https://github.com/fortran-lang/http-client) library used in the project. Follow the steps below to set up your environment:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention the minimum version of fpm also here.


### **Step 2: Install libcurl Development Headers**

The `http-client` library, requires the libcurl development headers to be installed. On Ubuntu-based systems, you can install the required dependencies using the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `http-client` library, requires the libcurl development headers to be installed. On Ubuntu-based systems, you can install the required dependencies using the following command:
The `http-client` library requires the libcurl development headers to be installed. On Ubuntu-based systems, you can install the required dependencies using the following command:


### **Step 2: Install libcurl Development Headers**

The `http-client` library, requires the libcurl development headers to be installed. On Ubuntu-based systems, you can install the required dependencies using the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
The `http-client` library, requires the libcurl development headers to be installed. On Ubuntu-based systems, you can install the required dependencies using the following command:
The `http-client` library, requires the ``libcurl`` development headers to be installed. On Ubuntu-based systems, you can install the required dependencies using the following command:

?


1. Open your terminal or command prompt and create a new directory for the project:

```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```bash

??

Comment on lines 64 to 70
### **Step 3: Build the Project**

Run the following command to build the project:

```
fpm build
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this step really needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding, when executing the fpm run command, the project will be built automatically during that process. Therefore, it seems unnecessary to include a separate step for building the project. So Should I remove this step?

call json%get('['//count//'].name', value, found)

! Enter the loop to traverse all repositories while they exist
do while(found)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop is strange. Does it call twice json%get for the same count? Why is the last json%get needed?

Comment on lines 145 to 176
! Traverse Repositories and Print Names

! Counter to traverse all repos one by one
i = 1

! Storing the string equivalent of i in the count variable
count = to_string(i)

! Fetching the name of the 1st GitHub repository, if it exists (found is set to true)
call json%get('['//count//'].name', value, found)

! Enter the loop to traverse all repositories while they exist
do while(found)

! Fetch the name of the current repository (based on the `i` counter) and check if it exists
call json%get('['//count//'].name', value, found)

! If the repository name exists (`found` is true), print the repository number and name
if (found) then
print *, count//'. ', value
end if

! Increment the counter for the next repository
i = i + 1

! Convert the updated counter to its string representation and store it in count variable
count = to_string(i)

! Fetch the name of the next repository (based on the updated `i` counter) and update `found` accordingly
call json%get('['//count//'].name', value, found)

end do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a suggestion (with a single call to json%get) that looks easier to understand (at least to me):

Suggested change
! Traverse Repositories and Print Names
! Counter to traverse all repos one by one
i = 1
! Storing the string equivalent of i in the count variable
count = to_string(i)
! Fetching the name of the 1st GitHub repository, if it exists (found is set to true)
call json%get('['//count//'].name', value, found)
! Enter the loop to traverse all repositories while they exist
do while(found)
! Fetch the name of the current repository (based on the `i` counter) and check if it exists
call json%get('['//count//'].name', value, found)
! If the repository name exists (`found` is true), print the repository number and name
if (found) then
print *, count//'. ', value
end if
! Increment the counter for the next repository
i = i + 1
! Convert the updated counter to its string representation and store it in count variable
count = to_string(i)
! Fetch the name of the next repository (based on the updated `i` counter) and update `found` accordingly
call json%get('['//count//'].name', value, found)
end do
! Traverse Repositories and Print Names
! Counter to traverse all repos one by one
i = 0
! Enter the loop to traverse all repositories while they exist
do
! Increment the counter for the next repository
i = i + 1
! Convert the updated counter to its string representation and store it in count variable
count = to_string(i)
! Fetch the name of the current repository (based on the `i` counter) and check if it exists
call json%get('['//count//'].name', value, found)
if(.not.found) exit
! If the repository name exists (`found` is true), print the repository number and name
print *, count//'. ', value
end do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @jvdp1 now it's more readable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples of command-line input should probably start with a dollar sign to make it more obvious, i.e.,

$ sudo apt install -y libcurl4-openssl-dev

Instead of:

sudo apt install -y libcurl4-openssl-dev

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, but one issue with that is that commands like this are likely to be copied to clipboard, which when pasted includes the "$" which breaks the command. So I think it's better to leave it out.

README.md Outdated
Comment on lines 128 to 135
*~By [Rajkumar Dongre (rajkumardongre)](https://github.com/rajkumardongre)*
* **[fortran-xkcd](https://github.com/rajkumardongre/fortran-xkcd/tree/http_client_version):** An fpm example project written in Fortran 2018 that displays the latest xkcd comic inside an X window. As a limitation, only images in PNG format are supported (no JPEG). The alt text will be printed to console.

*~By [Philipp (interkosmos)](https://github.com/interkosmos)*

* **[foropenai](https://github.com/gha3mi/foropenai):** A Fortran library for OpenAI API.

*~By [AliG (gha3mi)](https://github.com/gha3mi)*
Copy link
Member

@milancurcic milancurcic Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these "By author name" attributions are redundant, since you already link to the project GitHub repos, it's obvious who their authors are.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, but one issue with that is that commands like this are likely to be copied to clipboard, which when pasted includes the "$" which breaks the command. So I think it's better to leave it out.

README.md Outdated
## Getting Started Guides 👋


### Table of contents:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than having the tutorial TOC here, why not put it on top of tutorial.md? It seems more appropriate that a TOC for a doc would be in that doc, not outside of it. Here in the README you can just link to the tutorial doc.

Copy link
Member

@milancurcic milancurcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the great work, @rajkumardongre, I'll merge it.

@milancurcic milancurcic merged commit e9f4926 into fortran-lang:main Aug 24, 2023
@rajkumardongre rajkumardongre deleted the issue42 branch September 14, 2023 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants