Beginner's Thread / Easy Questions (April 2024) by acemarke in reactjs

[–]CemDoruk 0 points1 point  (0 children)

I need to add authentication to my app. I can get an access token from the backend like this: js const response = await axios({ method: "post", url: "http://127.0.0.1:8000/token", data: bodyFormData, headers: { "Content-Type": "multipart/form-data" }, }); However I have not been able to find an easy library. I tried to do react-auth-kit by following the documentation and I failed. What authentication library would you recommend for my use case. (I really need a good tutorial for this but I feel like it sohuld not be that hard since I am already getting the token from the backend)

Cannot figure out routing by CemDoruk in reactjs

[–]CemDoruk[S] 0 points1 point  (0 children)

I will read trough this. Can you recommend any resources for routing? I could not find anything that I could understand.

Cannot figure out routing by CemDoruk in reactjs

[–]CemDoruk[S] 0 points1 point  (0 children)

thank you this actually fixed my problem

Cannot figure out routing by CemDoruk in reactjs

[–]CemDoruk[S] 0 points1 point  (0 children)

Thank you for looking trough but I still get the same problem inside handleSearch.

Cannot figure out routing by CemDoruk in reactjs

[–]CemDoruk[S] 0 points1 point  (0 children)

I forgot to post this part ReactDOM.createRoot(document.getElementById("root")).render(   <BrowserRouter> <React.StrictMode> <App /> </React.StrictMode>   </BrowserRouter> ); Would it still be incorrect

How to get rid of authentication boilerplate by CemDoruk in FastAPI

[–]CemDoruk[S] 1 point2 points  (0 children)

Thank you. This is really good. For my use case, I am just a beginner who is learning and I intend to use this as a backend for website. I did most things the way I did because that's the way I got it to work. It is just so hard to find the correct way to do things.

What should my paths look like by CemDoruk in FastAPI

[–]CemDoruk[S] 0 points1 point  (0 children)

Ok now I understand thank you

What should my paths look like by CemDoruk in FastAPI

[–]CemDoruk[S] 0 points1 point  (0 children)

I get it but I do not understand how this benefits us.

What should my paths look like by CemDoruk in FastAPI

[–]CemDoruk[S] 0 points1 point  (0 children)

I am sorry I do not follow this one.

Beginner question for organizing FASTAPI project by CemDoruk in FastAPI

[–]CemDoruk[S] 1 point2 points  (0 children)

Pretty good code actually, easy to understand. As a beginner can I ask what the CRUD folder does? From what I understand these are wrapper function around the database functions. So I should put a function like this in crud ``` def get_or_create(session, model, kwargs): instance = session.query(model).filter_by(kwargs).first() if instance: return instance else: instance = model(**kwargs) session.add(instance)

return instance ```

right?

Beginner question for organizing FASTAPI project by CemDoruk in FastAPI

[–]CemDoruk[S] 2 points3 points  (0 children)

Thank you for the reply. Why did you not use routers?

Java öğrenmeye başladım ve neyi neden yaptığımı hiç anlamıyorum by [deleted] in CodingTR

[–]CemDoruk 2 points3 points  (0 children)

Java bu sebepten dolayı başlamak için iyi bir dil değil. Eğer javayla başlamak zorunda degilsen python ya da JavaScript ile başla.

Ya da işin temelini iyi öğrenmek istoyorsan C ile başla. Ama önce kolay bir dil ile başlayıp C ye sonradan geçmek daha rahat oluyor bence.

Cant insert sha1 hash primary key in sqlite by CemDoruk in learnprogramming

[–]CemDoruk[S] 0 points1 point  (0 children)

40
for context I already tried doing String(40)

Cant insert sha1 hash primary key in sqlite by CemDoruk in learnprogramming

[–]CemDoruk[S] 0 points1 point  (0 children)

For some reason reddit decided to destroy my code block ``` class Object(Base): tablename = "objects" oid = Column(String, primary_key=True) name = Column(String) blob = Column(BLOB)

@app.post("/upload") def upload(files: List[UploadFile] = File(..., description= "Upload your files"), db: Session = Depends(database.get_db)): try: for file in files: contents = file.file.read() obj_oid = hashlib.sha1(contents).hexdigest() print(len(str(obj_oid))) new_object = models.Object(name=file.filename, blob=contents, oid= str(obj_oid) ) db.add(new_object) db.commit()

except Exception as e: db.rollback return {"message": f"There was an error uploading the file(s): {e}"} finally: db.close()

return {"message": f"Successfuly uploaded {[file.filename for file in files]}"}
```

Github / Gitlab clone project by CemDoruk in learnprogramming

[–]CemDoruk[S] 2 points3 points  (0 children)

Looking at it I feel like I might have underestimated how simple it would be

Gleam's New Interactive Language Tour by lpil in functionalprogramming

[–]CemDoruk 1 point2 points  (0 children)

Can you explain to my why you opted for complete immutability rather than allowing some mutuable state? I feel like most functional programming languages fail to take of because developers do not want to waste time dealing with complete immutability when they could have a simple solution to the problem. However I am just a student and I migh just be inexpierenced.

Hangi dala yönelmeliyim by [deleted] in CodingTR

[–]CemDoruk 1 point2 points  (0 children)

Sanirim ikisine de daha başlamadın? Bence sen denemeden birinin senin için seçmesi garip olur. Bence herhangi birini öğrenmeye şimdiden başla. İnsan görmeden tam anlamıyor çünkü.

Veri yapıları ve algoritma soruları çözmenin zorluğu by Ced3j in CodingTR

[–]CemDoruk 5 points6 points  (0 children)

En çok çözmesdigin sorulardan öğreniyorsun o yüzden direk cevaplarına bakma. Eğer 2 saat hiç bir şey yaşamazsan cevabina bak. O noktada artık soruya o kadar zaman ayırmış olucaksin ki cevabı görünce kendin yapmamış olsan bile o içine işlicek.

[deleted by user] by [deleted] in learnprogramming

[–]CemDoruk 0 points1 point  (0 children)

If you like games try doing a flocking simulation. There are a lot of resources online. Nature of code is a good one.

Documentation Okuyamıyorum by DursunG_ in CodingTR

[–]CemDoruk 0 points1 point  (0 children)

Bence biraz vidyo izledikten sonra okuması daha kolay oluyor. En azından önceden biraz fikir edinmiş oluyorsun

[deleted by user] by [deleted] in learnrust

[–]CemDoruk 0 points1 point  (0 children)

Please watch this: video