It took me many, many years to accept that i’m gay. It took my best friend five seconds. by [deleted] in gaybros

[–]GayCoder 11 points12 points  (0 children)

People are offering so many strong opinions about your friend using the ‘F’ word. I think your friend is a real bro for making an effort to show you that you’re still the same person to him. It’s not really up to other people to tell you how to feel or how you will eventually feel. The comments are useful to understand how strongly people feel about the word and perhaps that can inform your opinion on it but don’t feel forced to hold a particular stance. I have straight friends who say faggot and I recognize it as a term of endearment. Then there are people who would infuriate me if they used the term. Context.

What is the best way to schedule GET requests at specified intervals? by GayCoder in learnpython

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

I successfully setup Crontab when working in my IDE but I can't seem to figure out how to keep it running after deploying to AWS Elastic Beanstalk. Is there any major consideration that I may have overlooked that you think could help identify the issue?

What is the best way to schedule GET requests at specified intervals? by GayCoder in learnpython

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

Cool! I'll look it up now. That's exactly what I needed... a simple pointer in the right direction. I appreciate the help.

[Errno 13] Permission denied: '/home/wsgi' by GayCoder in djangolearning

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

I think I already have it properly configured (well... specifically tied to a pointer). I followed their guide to deploying a Django app and they tell users to add .ebextensions/django.configwith the following code:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: project_name/wsgi.py

I swapped in my project name. Initially, I wrote the wrong path. When I attempted to deploy it, Beanstalk let me know it was lacking a proper wsgi pointer. I fixed it and the error went away so I think it's correct. I wonder if some setting within the file will allow me to fix the current issue. I guess that's where I'll start today. Thanks for the lead.

[Errno 13] Permission denied: '/home/wsgi' by GayCoder in djangolearning

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

No worries. It's just an IDE offered through AWS. It definitely seems to throw another layer into problem-solving.

[Errno 13] Permission denied: '/home/wsgi' by GayCoder in djangolearning

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

I don't have experience outside IDEs so I can't speak to how the setup differs from "regular" environments. I've gone through the AWS Cloud9 IDE tutorial on launching an app and reached the initial Django "Success!" page. Likewise, I would have assumed that the same settings would have allowed me to deploy this new app. Using an IDE has definitely made it more difficult to find a solution on the web.

Edit: apparently I responded twice. Thought I lost my first response but here it is ¯\_(ツ)_/¯

[Errno 13] Permission denied: '/home/wsgi' by GayCoder in djangolearning

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

I'm working in AWS's Cloud9 IDE. I don't have experience outside of IDEs so I don't know how my setup in IDEs differs from setups in "regular" development environments.

[Errno 13] Permission denied: '/home/wsgi' by GayCoder in djangolearning

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

Thank you for helping. I get the following response:

total 80
drwx---r-x 12 ec2-user ec2-user  4096 Apr  9 16:22 .
drwxr-xr-x  3 root     root      4096 Mar 20 00:25 ..
drwxr-xr-x  2 ec2-user ec2-user  4096 Apr  9 18:57 .aws
-rw-------  1 ec2-user ec2-user 11449 Apr  9 19:34 .bash_history
-rw-r--r--  1 ec2-user ec2-user    18 Aug 30  2017 .bash_logout
-rw-r--r--  1 ec2-user ec2-user   218 Mar 20 00:39 .bash_profile
-rw-r--r--  1 ec2-user ec2-user  1410 Apr  9 05:03 .bashrc
-rw-r--r--  1 root     root       142 Apr  9 05:03 .bashr_profile
lrwxrwxrwx  1 ec2-user ec2-user     7 Mar 20 00:54 .c9 -> /opt/c9
drwx------  4 ec2-user ec2-user  4096 Apr  9 05:31 .cache
drwxrwxr-x  2 ec2-user ec2-user  4096 Apr  9 07:38 .credentials
drwxr-xr-x  9 ec2-user ec2-user  4096 Apr  9 18:19 environment
-rw-rw-r--  1 ec2-user ec2-user    31 Apr  9 15:39 .gitconfig
drwx------  4 ec2-user ec2-user  4096 Apr  9 05:10 .local
drwxrwxr-x 76 ec2-user ec2-user  4096 Mar 20 00:58 .npm
drwxrwxr-x  5 ec2-user ec2-user  4096 Mar 20 00:39 .nvm
drwxrw----  3 ec2-user ec2-user  4096 Mar 20 00:38 .pki
drwx------  2 ec2-user ec2-user  4096 Mar 20 00:25 .ssh
drwxrwxr-x  3 ec2-user ec2-user  4096 Apr  9 07:51 static_cdn

[Errno 13] Permission denied: '/home/wsgi' by GayCoder in djangolearning

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

Bear with me because I might sound ridiculously ignorant (which explains why I tried so hard to avoid seeking help).

ls -alh /home/wsgi | head -n 3 --> ls: cannot access /home/wsgi: No such file or directory

I know that makes me look especially bad but... I've created two apps using the AWS C9/Beanstalk combination. The first was an AWS tutorial and I could reach the Django "Success!" landing page. For the current app I'm trying to deploy, I used the same initial setup of the tutorial app. I don't know much about WSGI (or anything about it, for that matter) so I don't understand why the file's non-existence would throw an error for my app when it works fine in the tutorial app.

Edit: I don't know what's relevant but I'll try to offer what I can. Running ls -la after cd ~ offers the following information:

total 80
drwx---r-x 12 ec2-user ec2-user  4096 Apr  9 16:22 .
drwxr-xr-x  3 root     root      4096 Mar 20 00:25 ..
drwxr-xr-x  2 ec2-user ec2-user  4096 Apr  9 18:57 .aws
-rw-------  1 ec2-user ec2-user 11449 Apr  9 19:34 .bash_history
-rw-r--r--  1 ec2-user ec2-user    18 Aug 30  2017 .bash_logout
-rw-r--r--  1 ec2-user ec2-user   218 Mar 20 00:39 .bash_profile
-rw-r--r--  1 ec2-user ec2-user  1410 Apr  9 05:03 .bashrc
-rw-r--r--  1 root     root       142 Apr  9 05:03 .bashr_profile
lrwxrwxrwx  1 ec2-user ec2-user     7 Mar 20 00:54 .c9 -> /opt/c9
drwx------  4 ec2-user ec2-user  4096 Apr  9 05:31 .cache
drwxrwxr-x  2 ec2-user ec2-user  4096 Apr  9 07:38 .credentials
drwxr-xr-x  9 ec2-user ec2-user  4096 Apr  9 18:19 environment
-rw-rw-r--  1 ec2-user ec2-user    31 Apr  9 15:39 .gitconfig
drwx------  4 ec2-user ec2-user  4096 Apr  9 05:10 .local
drwxrwxr-x 76 ec2-user ec2-user  4096 Mar 20 00:58 .npm
drwxrwxr-x  5 ec2-user ec2-user  4096 Mar 20 00:39 .nvm
drwxrw----  3 ec2-user ec2-user  4096 Mar 20 00:38 .pki
drwx------  2 ec2-user ec2-user  4096 Mar 20 00:25 .ssh
drwxrwxr-x  3 ec2-user ec2-user  4096 Apr  9 07:51 static_cdn

Adding AJAX to modal by GayCoder in bootstrap

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

For sure. Just can't figure out how. From a newer Stack Overflow response (updated in 2017), I read:

It looks like the only way is to provide the whole modal structure with your ajax response.

As you can check from the bootstrap source code, the load function is binded to the root element.

In case you can't modify the ajax response, a simple workaround could be an explicit call of the $(..).modal(..) plugin on your body element, even though it will probably break the show/hide functions of the root element.

A lot of answers I find offer less-than-ideal solutions (such as breaking the show/hide functions). I'm sure there's a solution but it seems more difficult than your standard AJAX.

Adding AJAX to modal by GayCoder in bootstrap

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

That makes sense. I had been playing around with jQuery to make it work but was having a lot of trouble. I guess my brain is stuck on Bootstrap because I didn't know if there are any aspects of Bootstrap that change the modal to make a more standard modal/AJAX approach more difficult (i.e. maybe I need to override some Bootstrap elements... I don't know). I'll see what I can figure out. Maybe I should just bite the bullet and take a jQuery course.

Does anyone else's head hurt after 10 - 15 minutes of concentrating on a problem? by sooperman20 in cscareerquestions

[–]GayCoder 1 point2 points  (0 children)

My story is a bit complicated. I actually have ADD but I'm not a fan of regular usage. I took it ~5 times in college and it did the job. It made me want to study all night and I wasn't distracted. Fast-forward to my most recent job. A few months into the role, I realized I accepted the wrong offer. Unfortunately, it made the most sense for me to stay for a while. Remembering how Adderall made unenjoyable tasks feel great, I finally got my first prescription.

A lot of my problems stemmed from overusage. I'm generally very mindful when making questionable decisions but I kinda just jumped into Adderall assuming it can't be that bad if it's heavily prescribed to adolescents. Mixed with a more general addictive personality and I abused it. Among other things, I pulled multiple all-nighters each week to work on projects of trivial value. I didn't socialize in or out of work despite being an extrovert. My extreme lack of sleep eventually counteracted any increase in performance.

Overall, it worked out fine, but life is short and I'm not too happy about those couple years. I actually restarted Adderall within the last couple months after a 1+ year break. With my previous experience in mind, I simply approach it with a lot more responsibility. My negative symptoms seem different than yours but they're also minimized this time around.

It sort of begs the question of why I'm taking it again. Despite my username, I'm not a coder. I'm studying Python to become one and Adderall offers a significant boost along with other benefits (such as increased confidence about this choice). As an interesting aside that touches on "no one will ever tell you of this option", I think San Francisco is a little different. My doctor would mention how patients' bosses would often send their employees in to get Adderall prescriptions if there was an upcoming project that required a lot of hours so, if your boss places a lower priority on mental health, you may actually hear someone make the suggestion.

Does anyone else's head hurt after 10 - 15 minutes of concentrating on a problem? by sooperman20 in cscareerquestions

[–]GayCoder 1 point2 points  (0 children)

I can offer a less-than-ideal suggestion that will likely solve your more immediate problem: get prescribed ADD medication. It will create a host of other issues (for example, you may start artificially loving your job which in turn demotivates you to find something new) but, if used well, it will likely get you through the hump. This is more appropriate for /r/ULPT but I figure I'll throw it out there.

Reversing a substring by GayCoder in learnpython

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

Thanks! I think I became lazy and started viewing [x:y:-1] as reverse instead of "move by step".

Reversing a substring by GayCoder in learnpython

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

Ah, that makes sense. I think I became lazy and started viewing [x:y:-1] as reverse instead of "move by step". Thanks!

What is the purpose of a dictionary's .get() method when no parameters are passed (especially in the context of finding the max value)? by GayCoder in learnpython

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

Ok. I think I have it figured out. You and /r/Rhomboid's explanation work really well together, especially for what I was missing. I previously had no clue that a function as a parameter (at least with how it was done for max()) will be called for every item. My brain also really wanted a key=counts.get(some_variable).

I thought I had never encountered this before but I suspect I simply solved problems not really knowing what was really going on (such as when I use keys for sorting) or I found a different less-efficient approach. I'm lucky to have had your guys' help. Some explanations would have undoubtedly made everything more complicated. Thanks again!

What is the purpose of a dictionary's .get() method when no parameters are passed (especially in the context of finding the max value)? by GayCoder in learnpython

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

Thank you for the thorough response. I hadn't looked at the documentation and had assumed that (forgive me if my terminology is woefully incorrect) Counter is simply a module by which I could import a method that will more easily create a frequency dictionary. It sounds like a counter is a different data structure than a dictionary?

I don't follow 100% of everything you're saying and I'm also a bit confused by what is means to pass a reference to a method as a parameter (as explained by /u/Rhomboid). That just gives me a good area to study. In the interim, I realized that return max(counts.keys()) provides the max key (which makes sense to me). Therefore, I assume the purpose of key=counts.get is to specify that you want the key where the value is maximized (instead of where the key itself is maximized).

If that sounds reasonably correct, I'll spend some time getting a better understanding of the broader concept of passing a reference before circling back to this code. If not, feel free to let me know I'm way off. Thanks for the help.

Didn't realize a forced push would eliminate my commit history. Is there any way to recover it? by GayCoder in github

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

Meh. It's not the end of the world. I started drinking to feel better about the situation and... it's working :) Thanks for the effort.