Skip to content

Commit

Permalink
friday check
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishapatil1234 committed Mar 8, 2024
1 parent bc8663f commit 5d5279d
Show file tree
Hide file tree
Showing 2 changed files with 232 additions and 0 deletions.
109 changes: 109 additions & 0 deletions _posts/2024-03-08-DebuggingProcess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
comments: true
layout: post
title: Debugging Process
permalink: debug
unit: 2
---

# Preflight (No running Backend) Error
## Indication of Preflight Error
A preflight error occurs during cross-origin requests (CORS) when a preflight request fails. Either:
- The server does not respond with the appropriate CORS headers.
- The server rejects the preflight request due to incorrect CORS configuration.
- There is a network issue preventing the preflight request from reaching the server.

In this case, the third issue is present (because the backend is not running locally, the preflight request does not even reach the serve - as its not up)



<img width="1415" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/a581295e-95ab-4990-b6ee-381e2209b407">
<img width="1184" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/080d1e65-ee8a-4992-9567-ccbf8140b61e">

## Further Invesitgation into the error - in Sources
<img width="1184" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/3c5359a9-1387-49c1-932c-c024b0386ed7">

In sources, the source of the error is more clearly indicated. The error might indicate a failure to make the network request to http://localhost:8085/authenticate. This could happen if the server is not running or if there is an issue with the network connection, which is the case currently. However, let us continue investigating using debugging mode to confirm .

## Debug

First in debug mode I will test the ability to accept the use input of login information as an array. (I know already this is not the issue, but if it were an issue I would not be notified. For this reason I added a breakpoint here. Additionally, this step is important to come BEFORE the server is called)
<img width="1184" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/0729eadf-7f5d-4689-a7dc-0c934d77f9e6">

After stepping over, it is clear that the input of the user is saved as expected.

<img width="1184" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/c205fea9-77db-44b2-930a-eb2304d6b0ac">


In the next step over, the breakpoint set at the .catch for the js request is highlighted.
<img width="1184" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/c9dcf831-d9b3-43d2-9a56-4f3856d6f642">

The error message is in the format :
` console.error('Error during login:', error);`

If we check in the console, the error is present as expected along with a network error :

<img width="948" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/40a08468-0649-489a-98ef-4c7bc476565b">


## Fix
With the POST network error coupled with the console response error, it is clear that the issue lies in server connectivity. I went to check and my server was not even running! Once server ws started, error was resolved :

<img width="1181" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/19e763a5-8545-4173-b20e-30751f148c26">
<img width="1181" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/7c5206d3-9667-4718-bb3e-176480829976">
<img width="1181" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/0a603f06-5b3f-40de-ae3f-432f8ffb8983">
<img width="1181" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/d2cfe21a-6005-4c08-8479-5365e88b3e8f">

Interestingly enough, I found a new issue. While my login was successful (as shown by the breakpoints and a complete screenshot I will show below), there is a new issue... Apparently in future chrome versions: setting third-party cookies will be blocked. This behavior protects user data from cross-site tracking. Interesting to see how to navigate this, and I plan to read more about it in the article provided : [LINK](https://goo.gle/3pcd-dev-issue)


**LOGIN SUCCESSFUL REDIRECT TO AUTHORIZED PAGE:**
<img width="814" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/aa94ff2b-1620-4f48-ab5f-efc1c44d3a58">

<img width="898" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/48c343fd-7ead-48f6-b17d-444b95828374">



# Unathenticated Error

Now I want to explore a new error. What happens if somebody tries to access the authenticated page without properlly logging in. What will they see. Should I make a redirect to login page (probably!). This is what I plan to investigate on this page.

## Start Backend on Debug Mode
<img width="1280" alt="image" src="https://github.com/Codemaxxers/codemaxxerblog/assets/111611921/beb4647a-17aa-4596-adaa-898338b562e1">


## Cookies Cleared on Authenticate Page
<img width="828" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/dab7494c-e5df-4e73-95a7-7d076b9c0ba7">


## Error in Console with Cleared Cookies
<img width="1198" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/5ba0bf45-0a9f-4042-adb0-0f909e52e5e7">


## Sources
I added breakpoint to fetch, inside .then, inside .fetch

<img width="1169" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/4e993fa9-b96c-48b1-bbc3-fef9a7aa539a">

## Run frontend, screen capture break at fetch while examining Body
<img width="1169" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/787c41f0-afbd-4784-afcb-885b9ff50fa5">

## Press play on frontend, observe stop inside of backend
No Cookies error !

<img width="934" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/d47bae9e-bb0e-4f13-97fe-cf023d4c6e69">

## Press step over on backend until you have obtained data from database, screen capture HashMap or other data Object, Step in until you see data, screen capture capturing break point and Data.


<img width="1218" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/221db56b-e3c6-441f-970c-6ff8bedee0c6">
<img width="723" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/7e438be9-e540-4a08-8c88-cbe2424375fa">


# Further Application
For my LinkedIn-type application, leveraging the login debug functionality can greatly enhance the user authentication and authorization process. Since the LinkedIn backend is in Python, integrating the login debug feature involves strategically placing breakpoints within the Python codebase to intercept and inspect the authentication flow. By carefully analyzing the request/response cycle at crucial authentication endpoints, such as user login and token generation, developers can gain valuable insights into the authentication process's efficiency, security, and potential vulnerabilities. This debug capability allows for thorough testing and validation of various authentication scenarios, including successful logins, incorrect credentials, expired tokens, and unauthorized access attempts. Moreover, by utilizing logging frameworks or custom logging mechanisms, developers can track and log detailed information about authentication attempts, facilitating comprehensive auditing and troubleshooting. Ultimately, integrating login debug functionality into the LinkedIn-type application's backend empowers developers to ensure robust security measures, streamline user authentication workflows, and deliver a seamless and secure user experience.


I still have to do the frontend, so testing debug doesn't exactly make sense yet. However here is what I have worked on so far :

<img width="1119" alt="image" src="https://github.com/lightkurve/lightkurve/assets/111611921/57efb334-8ce3-415f-9c03-9a9e40e6a744">
123 changes: 123 additions & 0 deletions _posts/2024-03-08-PersonalSeed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
comments: true
layout: post
title: Personal Seed
permalink: debug
unit: 2
---

# Individual Progress

## Organization
<img width="783" alt="image" src="https://github.com/tanishapatil1234/tri2/assets/111611921/4a5a8d6f-9ee0-4a37-9d70-442542b1635e">


## Ap Prep Progress
I worked in much detail to finish these frqs. Each frq I related to my personal project. This was important as PBL application helped me understand unclear CB topics.

| FRQ | Link |
|---|---|
| 1 | [link](https://tanishapatil1234.github.io/tri2//2024/02/25/frq1_IPYNB_2_.html) |
| 2 | [link](https://tanishapatil1234.github.io/tri2//2024/02/25/frq2_IPYNB_2_.html) |
| 3 | [link](https://tanishapatil1234.github.io/tri2//2024/02/25/frq3_IPYNB_2_.html) |
| 4 | [link](https://tanishapatil1234.github.io/tri2//2024/02/25/frq4_IPYNB_2_.html) |


## Key Commits
**Pocket Therapist**
- [AI Work](https://tanishapatil1234.github.io/tri2//2023/01/18/ww3personal.html)
- [Backend Construction](https://tanishapatil1234.github.io/tri2//2023/01/18/ww3backend.html)
- [Key Commits ~ Frontend](https://github.com/vivianknee/PocketTherapist/commits?author=tanishapatil1234)
> Constructed camera and camera container. Frontend also holds code for the javascript OpenCV work
- [Key Commits ~ Backend](https://github.com/vivianknee/PT_Backend/commits?author=tanishapatil1234)
> Constructed the entire quotes database on Spring


**WW3 Mini Project**
- [All Accomplishments](https://tanishapatil1234.github.io/tri2//2023/01/18/worldwarplan.html)
- [Key Commits ~ Frontend](https://github.com/rachit-j/ww3/commits?author=tanishapatil1234)
> Constructed testing file where I worked to integrate backend requests of cards into sorting algos.
- [Key Commits ~ Backend](https://github.com/rachit-j/ww3-backend/commits?author=tanishapatil1234) .
> Constructed the entire cards database on Spring

**Personal Project**
- This is a model I created to forecast power voltage generation of a solar panel based on imaging data of weather conditions. It is a deep learning model I am building in pytorch, and an expansion on a very vague research paper done by professors at Stanford and Upenn.
- I have background in AI and machine learning but when I was preprocessing my data, I decided to utilize a class based approach to hone in my skills from this class into my own project. So even though my model is HUGE (13 million parameters as of now) it is able to utilize getter functions that I wrote efficiently
- I do not have it committed yet because of liscencing issues I am trying to navigate, but here is some code

<code>
class ImageDataset(Dataset):
def __init__(self, h5_file, group, transform=None, target_transform=None):
self.h5_file = h5_file
self.group = group
self.transform = transform
self.target_transform = target_transform

with h5py.File(h5_file, 'r') as f:
images = f[self.group]['images_log'][:]
labels = f[self.group]['pv_log'][:]

self.images = images
self.labels = labels

def __len__(self):
return len(self.images)

def convert_to_float32(self, image, label):
image = ((image - image.min()) / (image.max() - image.min()) * 255).astype(np.uint8)
return image.astype(np.float32), label.astype(np.float32)

def __getitem__(self, idx):
image = self.images[idx]
label = self.labels[idx]

# Convert to float32
image, label = self.convert_to_float32(image, label)

if self.transform:
image = (image * 255).astype(np.uint8)
image = self.transform(image)

if self.target_transform:
label = self.target_transform(label)

return image, label
</code>

**Tri 2 Continuing Project**
<img width="888" alt="image" src="https://github.com/tanishapatil1234/tri2/assets/111611921/977bb16e-db2e-42a1-941c-28428aea36ae">

Main Commit:
[LINK](https://github.com/Codemaxxers/codemaxxerFrontend/commit/0d733b1e73b3769dac86ca876295836454fcb973)

Blog Detailing Main Commit: [LINK](https://tanishapatil1234.github.io/tri2//2024/02/02/GamingInJava_IPYNB_2_.html)


## Github Analytics
<img width="672" alt="image" src="https://github.com/tanishapatil1234/tri2/assets/111611921/cb258d36-1d59-43cc-b857-7e7d741c8cdc">

## Personal Spotlight
- I need to commit more sporadically
- Work on collaboration and task assignment. Take on the role of scrum master and help my team stay on track
- I want to learn automated deployment more in depth (why deploy with the same commands over and over again if I can just learn how to make a deployment script)
- I want to work with more complicated APIs like AWS or Github to do some interesting data analysis
- Maybe something like commits/contributions to predict success on live reviews
- I want to try crowd sourcing data for atleast one project this year
- I want to update my personal website with any cool projects I do in this class
- I really want to do the student linkden project on the side
- I would like to push myself to explore UI, since I spent most of this year focused on using Spring/Flask/Django for backend

## GitHub Blog

[LINK](https://tanishapatil1234.github.io/tri2/compsci)

## Project Work
Up to this point, I've been enjoying the camaraderie within my group. They've been instrumental in aiding my comprehension of challenging concepts, and together, we maintain mutual accountability for our respective tasks. Our frequent communication, often through facetimes, ensures that we are well-prepared for upcoming activities and assignments.






0 comments on commit 5d5279d

Please sign in to comment.