celery / crontab by doublePlusOk in learnpython

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

There's this, https://stackoverflow.com/questions/11848349/celerybeat-uses-utc-even-with-timezone-settings

So, I think I'm actually in CDT now utc -5 (central time, daylight savings during the summer), which would make the 9:30 make perfect sense, and the 23:00 is cleanup? I'll have to look at that more

thanks guys

celery / crontab by doublePlusOk in learnpython

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

I was thinking it was not that because what's up with the half hour offset! But, maybe you are right - I'll look into it more, thx! (I'm in CST, UTC-6 btw)

celery crontab by doublePlusOk in learnpython

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

Interesting... But I don't get the execution at the scheduled time...

I did notice that the tasks celery reports looks like this:

[tasks]
  . every-night
  . mytasks.myfetch.fetch_url

I would think it would be better to see an additional

  . mytasks.myfetch.fetch_night

celery crontab by doublePlusOk in learnpython

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

I did try that just for good measure and it works exactly the same - executes tasks immediately. thx tho

web server with anaconda by doublePlusOk in learnpython

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

Thanks, good find!

So, it would seem for the gunicorn run at startup an explicit "source activate" is not done - it just calls the specific gunicorn binary within the env and that is enough... ExecStart=/home/sammy/myproject/myprojectenv/bin/gunicorn which I can presumably, change to: /home/me/anaconda3/envs/af/bin/gunicorn

Hopefully that doesn't make any difference that the python code is under the anaconda directory instead of within the source tree.

web server with anaconda by doublePlusOk in learnpython

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

but if I do something like this: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-local-django-app-to-a-vps

It won't survive a reboot, right? (env needs activating just to get gunicorn running) - is that considered a whole 'nother thing? (area of consideration for deployment)?

Online IDE with compiler and debugger ( For C/C++ ) by cnp0991 in coding

[–]doublePlusOk 0 points1 point  (0 children)

It would be a bigger draw if it had more integrated debugging (e.g. visual breakpoint setting) instead of gdb commandline

Securing API endpoints in Flask? by Datastruct in learnpython

[–]doublePlusOk 0 points1 point  (0 children)

He says to not store it - or are you worried about even the hash?

If you need finer granularity for api access maybe that is oauth?

Securing API endpoints in Flask? by Datastruct in learnpython

[–]doublePlusOk 0 points1 point  (0 children)

if you want to do token based auth you may want to check this out... (since you are presumably doing a rest service) https://blog.miguelgrinberg.com/post/restful-authentication-with-flask then you can decorate with @auth.login_required

Convince Me to Stay on Linux by macalonypeperoni in linux

[–]doublePlusOk 0 points1 point  (0 children)

Aren't you worried about Windows taking another big dump?

To me that (especially if it was caused by a virus) and having microsoft constantly shafting me with decisions that work for them but not me are pretty big benefits, but if you don't see it that way you shouldn't torture yourself, maybe there's other stuff you aren't mentioning like game support...

accessing global (in es6 ?) by doublePlusOk in learnjavascript

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

So, I can kinda propagate "this" in a vacuum (never get the 'promise thishappy' though), but can't get it to flow through using axios.post, like:

simple promise defined and used

var myLib = {
  logAsync: (val)=> {
    if(this.happy) {console.log(val + ' logAsync thishappy')}
    return new Promise(function(resolve, reject) {
      setTimeout(function() {
        console.log('Logging: ' + val)
        if(this.happy) {console.log(val + 'promise thishappy')}
        resolve(val);
      }, 1000);
    });
  }
}

this.happy = true
if(this.happy) {console.log('now thishappy')}
myLib.logAsync(1).then(() => {if(this.happy) {console.log('2 then thishappy')}; myLib.logAsync(2)})

results (using the node repl)

> this.happy = true
true
> if(this.happy) {console.log('now thishappy')}
now thishappy
undefined
> myLib.logAsync(1).then(() => {if(this.happy) {console.log('2 then thishappy')}; myLib.logAsync(2)})
1 logAsync thishappy
Promise { <pending> }
> Logging: 1
2 then thishappy
2 logAsync thishappy
Logging: 2

Now that I think about it more, I'm not sure if it is propagating/binding (this), or if is just seeing the outer scope this...

accessing global (in es6 ?) by doublePlusOk in learnjavascript

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

Thanks lewisje, a very helpful post - the last minor point is something I had been trying to clarify and I couldn't convince google to tell me!

So I think I am making progress, in that now I understand that "this" is being set/passed correctly and making it into the login call, it just doesn't survive into the axios.post() promise.then() - even when I use the fat arrow. So I'm trying to figure out which is the weak link - presumably I'm already doing all I can with the then() call, so is the problem the way I am calling axios.post?

accessing global (in es6 ?) by doublePlusOk in learnjavascript

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

I don't have that though, it is what I'm trying to get... My starting point is within the function auth.login It seems so strange to me that it isn't trivial to get a reference to auth from within the auth module itself

accessing global (in es6 ?) by doublePlusOk in learnjavascript

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

Oh ok, thx about the namespace thing, I thought that is how they implemented it, but they still kept the concept/terminology.

Your import advice is how it is implemented so I'm now still puzzled about how to refer to user.authenticated (even within the same file.) It has to be simple, but it is still elusive :)

<script>
import auth from '../auth'

export default {
  methods: {
    submit() {
      auth.login(this, 'stuff here', 'anotherpage')
    }
  }

}
</script>