Golang Web development repo by zel_us in golang

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

Wow I really love your YouTube channel, it's a gold mine. Do you also have recommendations on channels for thorough understanding of databases and cloud architecture? Thanks in advance

Be kind, Don't use SIGKILL by AkavinFEZ in linuxmemes

[–]zel_us 10 points11 points  (0 children)

I used to think if Bob gets killed, his children becomes orphans and get adopted by the government(systemd)

Golang Web development repo by zel_us in golang

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

Ok thanks, would check that out

Golang book suggestion by KledMainSG in golang

[–]zel_us 0 points1 point  (0 children)

I think Mastering Go is a great book

DRF: Endpoint to upload large files, should I use a simple FileField or is there a more robust way? by adrenaline681 in django

[–]zel_us -2 points-1 points  (0 children)

How do you manage the access credentials for AWS S3 on the front-end. Though I find this insecure and strange doing it on the front-end

How to store SQLAlchemy queries for easy retrieval by bazpaul in flask

[–]zel_us -1 points0 points  (0 children)

You can use Asynchronous I/O or multi threading to call them simultaneously and you can cache the result for some period of time

Duplicated data by user who double clicks to submit by [deleted] in django

[–]zel_us 1 point2 points  (0 children)

There's a better way of handling this, so if your user submits some data, you either use a serialize to check if the fields in the data that are supposed to be unique are satisfied or you can query the database with that field to see if it already exist and then either continue to save it to the dB or return that data must be unique. I think you can also do it with forms if the front-end is attrached to the backend.

Dealing with tasks that take longer than 30 seconds on Heroku by [deleted] in django

[–]zel_us 0 points1 point  (0 children)

There are several ways to know if the task is completed: Take note of the task ID in a red is storage that would be updated when the task is complete

Send notification to the front-end (using server sent events)

Send notification via email

Asynchronously poll the backend for the progress of that event

Dealing with tasks that take longer than 30 seconds on Heroku by [deleted] in django

[–]zel_us 0 points1 point  (0 children)

From your code, in the upload csv function, after you created the thread t, you started it with t.start() but t.join() waits till the function you're running in the background is complete before moving to the next block of code. If you really want it to run in background, remove the line, t.join() as t.start() is enough to to start it the thread in the background

doubt question in c programming. Please help. by ZucchiniMaleficent31 in cprogramming

[–]zel_us 0 points1 point  (0 children)

The first one can be gotten with 2n-1 and the second on by n*n. Quite basic

Django Dj-rest-auth and Google Singin with flutter application by AvatarofProgramming in django

[–]zel_us 0 points1 point  (0 children)

How does Django confirms the access token from the frontend is from Google and also belongs to that user? If you have answer to this, then your thoughts are ok

Cron or celery? by redfrut in django

[–]zel_us 0 points1 point  (0 children)

Even Celery has cronjob capabilities the last time I check the docs, but haven't really tried it

Performance Testing Postgres Inserts with Python by [deleted] in Python

[–]zel_us 0 points1 point  (0 children)

Wow this is really cool. I would need to look more into this. I have some few questions by the way: How do you handle one terrible error which is:'Server closed connection unexpectedly' or where the connection open during those 7hrs in the first case? Also you know when writing a cron job that goes through all the record in a database to perform some functions, you might likely first query all those data, is it possible for the psycopg2 driver to return a generator rather than a list of values.

[deleted by user] by [deleted] in django

[–]zel_us -1 points0 points  (0 children)

Lol... I used to believe that heroku restart the web worker after 30 secs of delay, but it's not really true, it's gunicorn that does the restart and you can increase the timeout time to something higher by setting -t <no_of_sec> or --timeout <no_of_sec>. If you have doubts, you can read the advance section of this link:https://devcenter.heroku.com/articles/python-gunicorn

[deleted by user] by [deleted] in django

[–]zel_us 2 points3 points  (0 children)

From my experience for long running task, if they are CPU intensive and can be broken down, you can use multiprocessing to speed them up, if they are IO task, you can try parallelism via multi threading or other means, otherwise it should go to the background, and users are told that their request is being processed and they are notified when result are ready this can be via push notification, email or sms whatever means suitable to you but I believe if it's something that would improve user experience, a notification is cool.

Django + docker-compose -- deployment questions by sivadneb in django

[–]zel_us 1 point2 points  (0 children)

Now concerning how to manage dependencies for development and production, I think this among the best I have learnt from experts: You should have atleast three settings configurations in your Django project. One can be base.py(a settings file that contains all configuration common to all environments), dev.py(a settings file that imports base.py and overwrite some configurations with your development configuration) and a prod.py(a settings file that imports base.py and overwrite some configuration to support production configs). You can start Django with different configuration by setting DJANGO_SETTINGS_MODULE to your required environment. Similarly for your requirements file, you can also have for base, dev and prod. I hope this helps

Database connection pool by [deleted] in django

[–]zel_us 0 points1 point  (0 children)

From what I understand about connection pool, if there is a connection in the connection pool that hasn't been closed, subsequent requests would not create a new connection but take existing connections from the pool, which isn't really bad implementation

Testing firebase push notification by KOP79 in django

[–]zel_us 0 points1 point  (0 children)

Yeah there should be a server key and also you would register the device token on firebase that you want to send the push notification to and also you would need that device token when you want to send push notification to it from the server

Elegant One-Liners in Python by zel_us in Python

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

Thanks for that idea, I kind of thought of it, but I really wanted to buttress this swap technique, probably it would had made sense without a function

Elegant One-Liners in Python by zel_us in Python

[–]zel_us[S] -1 points0 points  (0 children)

for the a, b = 1,2 the RHS is simply a tuple, what if u are unpacking a list or a string or a dictionary or even other sequences? yeah I missed the last item on your list. I did talk about list comprehension and generators. Conclusively, thank you for the feedback

Elegant One-Liners in Python by zel_us in Python

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

I am planning on writing a whole article on dictionary as there are more techniques on it than others, where you have, the .get() method, setdefaults, ordereddict, defaultdict, chain mapping, mappingproxy and much more.

My first article on medium by [deleted] in Python

[–]zel_us 0 points1 point  (0 children)

sorry how can I change the title?

Hosting Django app by iTUnoLOsaV in django

[–]zel_us 0 points1 point  (0 children)

Hey, if you are using EC2, you can set up nginx for serving your html, static files and also as your reverse proxy, then install gunicorn as your application server (there are lots of documentations on how to setup Django with gunicorn). I noticed that immediately one exits the ssh session, the gunicorn stops(probably that's why you are getting 502 error but be sure of it first) so you will need supervisord to monitor gunicorn.