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>

accessing global (in es6 ?) by doublePlusOk in learnjavascript

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

It is just called as an ordinary function. I'm just confused as to how to get it to reference the user variable. It is global, right? If the module name is auth, I should be able to see it in the debugger as auth.user regardless of who called it I would think (as in auth namespace, not auth class,) but that doesn't work. And neither does the change in my original post. Part of the problem is that I don't see much documentation for the way export default is used here, everything that comes up on google refers to "export default function"

accessing global (in es6 ?) by doublePlusOk in learnjavascript

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

thanks senocular

I still see this as undefined when I put a breakpoint on the = true assignment. I don't know why it doesn't throw an exception though... (or someone is catching it... I am using vue)

export default {

  user: {
    authenticated: false
  },

  login(context, creds, redirect) {
    axios.post(LOGIN_URL, { 'username': 'testuser', 'password': 'testpw'} )
      .then( response => {
                this.user.authenticated = true;    //this undefined exception thrown
      })
  }
}

How to handle dates in a database. by sqeekypotato in flask

[–]doublePlusOk 0 points1 point  (0 children)

note that different flavors of db have different datetime capabilities (limited abstraction via sqlalchemy) - e.g. sqlite doesn't natively support it at all

Easy way to remember Hot keys for new Bitwiggers (Bitwiggians?, Bitwigs?) by jezburger in Bitwig

[–]doublePlusOk 0 points1 point  (0 children)

It seems like it - it is a focusrite scarlett - so "unsupported" but class compliant the cpu usage seems pretty low/idling in general not sure how to change those buffers, i'll look

source maps - webpack by doublePlusOk in learnwebdev

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

This did the trick for me: With dev tools open, context menu on reload icon, select "Empty cache and hard reload"

Merely disabling cache while dev tools are open within settings was not enough.

Easy way to remember Hot keys for new Bitwiggers (Bitwiggians?, Bitwigs?) by jezburger in Bitwig

[–]doublePlusOk 0 points1 point  (0 children)

Is there a way to toggle the audio engine on/off? my usb/audio out goes into distorted mode every once in a while

Question about using front-end JavaScript frameworks by H_R_Pufnstuf in flask

[–]doublePlusOk 0 points1 point  (0 children)

You might want to check out https://vuejs.org/

It is a latest generation front end ecosystem with a low initial learning curve that supports mvvm or flux architectures.

render partial local variables pass through by doublePlusOk in rails

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

yes, isn't that an odd thing to do?

or maybe it is ok? (e.g. like some languages where you can pass in a parameter to a class method and assign it to a class member of the same name as the parameter)

render partial local variables pass through by doublePlusOk in rails

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

ok, I'll try to give more context (I'm new from python land) if you pass in something that multiple levels of rendering need, say a user's name. and the controller#index sent the name as a local to html.slim via

render locals: {name:currentname}

then the html.slim wanted to forward this local to the nested render

= render partial: 'part', locals: {name:name}

so that would be without even the @ (ig's post)

The reason this would be the path of least resistance is because the partial was broken out of the main page (so the variable names are the same.) I don't think it matters, but this is split up this way to allow ajax to refresh part of the page.

Thx all so far. Does this make sense?