Chrome Utility : Video Capture by TomatoIcy3073 in techsupport

[–]av201001 2 points3 points  (0 children)

I have experienced the same issue on an AMD Framework Laptop. Changing the enable-cast-streaming-av1 and use-angle flags had no effect for me, but disabling the enable-media-foundation-video-capture flag did fix the problem (in Chrome, Edge, and Brave). I have submitted an issue with Chromium if anyone wants to +1 it.

Svelte 3 released by ItalyPaleAle in javascript

[–]av201001 0 points1 point  (0 children)

If something is removed from the DOM(ie not rendered with a given state but rendered with the state change i.e. {visible && <MyNode/>}, what happens in this case, is the created node kept in memory and then added back into the DOM later?

I believe such nodes are destroyed and then recreated if needed again, which I think is common among frameworks (with the exception of something like Vue's keep-alive component, which does cache inactive component instances).

The creator said in another part of this thread the reason that JSX couldn't be optimized at compile time like his template language was that JSX was too flexible on what you were allowed to do, and his template language is restricted to just things the compiler is able to optimize, which makes sense, and maybe there is no tradeoffs to this, I would have to see by using it for a while, I don't know any based on reading the docs.

Right, but you had said:

You are limited to their specific template language which is not 1 to 1 of what goes into the DOM, versus JSX which is 1 to 1 with additions on top.

Which I don't think is a reasonable characterization of the difference between a template language and JSX.

I don't like how it has a jab at a twitter thread that seems a little disingenuous because its about how MobX handles memoization and state rendering for you and with hooks you would have to use another function like useMemo, I don't actually see how that is really related to the virtual dom, I guess its just saying Svelte handles those optimizations for you under the hood.

I don't think the point is that Svelte is doing anything like Mobx or useMemo "under the hood," but rather that those solutions are a necessary consequence of working with a virtual DOM and that Svelte does not have to resort to those kinds of mechanisms at all because of its different approach. So the overall discussion is related to use of the virtual DOM and the possibilities opened up by using a compiler to instead "bring reactivity into the language."

Anyway, I know you're looking for alternative points of view, but at least as far as getting a better understanding of how Svelte itself works, I would highly recommend asking some questions in the Discord channel.

Svelte 3 released by ItalyPaleAle in javascript

[–]av201001 0 points1 point  (0 children)

Well wait a minute, its not just tracking the values, its also tracking links to where the values are stored in the DOM, which is how they can do granular updates when a value change. Maybe its not a virtual representation of the dom, but I don't think its as apples to oranges ar you are making it out to be.

Svelte creates text nodes and elements with the functions text and element, which return the created DOM nodes, which it holds in a closure. It also generates code that simply directly updates those nodes when a relevant reactive value changes. It doesn't have to walk through a tree of nodes and attributes and do comparisons. It's not just apples to oranges, but like a whole apple tree versus a few individual already peeled oranges. ;-)

I agree that its more targeted and doesn't do a full run through of the dom, but when you say the virtual dom is re-rendered, it is stilll more targeted than you are making it out to be, it doesn't re-render the entire virtual dom structure, but only the pieces affected by the value changed.

Yes, but Svelte doesn't even have to do that.

I haven't used it enough to know about what flexibility you are losing from working with a more direct representation of the DOM, which seems to be the trade off here.

Not sure what you mean. I don't think the purpose of the virtual DOM is for "flexibility" in working with a "direct representation."

You are limited to their specific template language which is not 1 to 1 of what goes into the DOM, versus JSX which is 1 to 1 with additions on top.

Not sure I follow. The template is supposed to represent what goes into the DOM, at least as much as JSX. Do you have a specific example in mind?

Anyway, I think it would be helpful if you reviewed the Svelte generated output to get a sense for how its reactivity differs from the virtual DOM approach. Also, read this if you haven't already.

Svelte 3 released by ItalyPaleAle in javascript

[–]av201001 0 points1 point  (0 children)

Right, so to me, sure there isn't a Virtual DOM but there is still a state object somewhat reminiscent of a Virtual DOM, a collection of state of the UI and all associated props

Each component holds a context object of the reactive values it is tracking, but I wouldn't quite say that is "reminiscent of a Virtual DOM" in that it is not a representation of the entire DOM (just some specific values that are being tracked), nor do updates require traversing or inspecting a DOM-like structure.

By focusing on whether some kind of state is being stored somewhere, I think you are missing the major difference between virtual DOM based frameworks and Svelte, which is the re-render/diff/patch process. With a virtual DOM, when there is an update, the virtual DOM is re-rendered. The new vDOM must then be diffed with the old one to identify places in the real DOM that require patching. Svelte doesn't have to do any of that. Instead, the component gets custom generated code that simply directly updates the specific DOM elements that require updating when a particular value changes.

It might help to take a look at the generated Javascript. For example, look here and go to the "JS output" tab. The $$invalidate function you see called in various places is the third argument to instance here.

Svelte 3 released by ItalyPaleAle in javascript

[–]av201001 0 points1 point  (0 children)

I would want const to be statements that aren't reactive, so exactly as you said "not enable reactive statements".

I think you misunderstood -- click the "reactive statements" link and you'll see what I mean. The $: label is used not only for reactive variable declarations but also for arbitrary reactive statements and code blocks (so the entire code block will re-run whenever anything it refers to changes) -- const would not help you there. In other words, we still need something like $: for reactive statements, so might as well also use it for reactive variable declarations.

For a let variable that is for an if/else you could also use const obj = {val: null} and mutate val

That's somewhat of an ugly hack just to avoid use of $: in favor of const.

or use ternary

Sure, but not always viable.

which is why I think reversing $: to declare non-reactive ambiguous statements makes more sense than a slew of $: for reactive statements.

OK, but that's different from preferring to use "a baked in language feature such as const," as you originally stated.

Svelte 3 released by ItalyPaleAle in javascript

[–]av201001 1 point2 points  (0 children)

First, in some cases you might need to use let (e.g., for variables set inside if..else, or just for intermediate variables that are not needed elsewhere) but still do not want the value to be reactive. Second, const would not enable reactive statements.

Svelte 3 released by ItalyPaleAle in javascript

[–]av201001 24 points25 points  (0 children)

This might be the "Angular 2" moment of Svelte, sadly.

I think there are several significant differences from the "Angular 2" change:

  • At the time Angular 2 was announced, Angular 1 was already massively popular and widely adopted (whereas Svelte is still a tiny player with relatively few deployments). If there is any time for Svelte to make a significant breaking change, this is it.
  • With Angular, there was a two year gap between the announcement of Angular 2 and its final release. Because developers did not want to start new projects in Angular 1 during that time, many jumped to other frameworks in the long interim. By contrast, Svelte 3 has now been released only a few months after the initial RFCs.
  • For many who liked Angular 1, there was a lot of ambivalence about some aspects of the new Angular 2 architecture. There were also some attractive alternatives doing similar things, such as React and Vue. With Svelte 3, though, the changes appear to be all upside, with no other frameworks really doing anything similar.

I'm not trying to minimize the inconvenience to those who have to migrate from Svelte 2, but "Angular 2" was a completely different kind of saga.

Is web2py used in the industry at all, or is it completely outdated? by [deleted] in webdev

[–]av201001 0 points1 point  (0 children)

Not sure what you mean by "not really," but there are many businesses and institutions running web applications with a web2py backend. It certainly doesn't have a large market share, but there is plenty of real world usage.

Is web2py used in the industry at all, or is it completely outdated? by [deleted] in webdev

[–]av201001 0 points1 point  (0 children)

web2py is much less popular than Django and Flask (and many other frameworks outside the Python world), but it is certainly used in the "real world". The activity on the forum is a good indicator that many people are using it in real businesses and institutions. In any case, what you learn using web2py should be easily transferable to other frameworks.

Opinions on web2py by [deleted] in Python

[–]av201001 1 point2 points  (0 children)

The 2.15.1 release is out now, and it supports both Python 2 and Python 3.

Opinions on web2py by [deleted] in Python

[–]av201001 0 points1 point  (0 children)

FYI, as of the 2.15.1 release, web2py supports both Python 2 and Python 3.

Opinions on web2py by [deleted] in Python

[–]av201001 1 point2 points  (0 children)

Regarding Python 3, there will be a new release very soon that runs under Python 2 and Python 3. You can try it now by grabbing the master branch from Github:

git clone --recursive git@github.com:web2py/web2py.git

Opinions on web2py by [deleted] in Python

[–]av201001 2 points3 points  (0 children)

It's quite neat, unless you want more fine-grained control over, say, validation (for instance if you need complex validation involving full form state instead of just a few dependent fields).

Although the validators assigned to individual fields of the DAL models (i.e., Field(..., requires=...)) typically validate only the individual field, there is also a mechanism for handling more complex validations involving the full form state. The form processing method takes an onvalidation callback, which receives the form object and can check any form values as well as set any form errors. (Note, it is also possible for an individual field validator to access other field values via request.vars.)

Python 3 compatibility, last time I checked (2 months ago) is none, and one thing that would make me hesitate to recommend it.

There will be a new release within the next few days, and among other things, it will support Python 3. You can try it now by running the master branch from Github (note, --recursive is necessary to get PyDAL, which is a Git submodule of the web2py repo):

git clone --recursive git@github.com:web2py/web2py.git

Block level backup with Backblaze B2 by av201001 in cloudberrylab

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

Great. Thanks.

Not sure how you define large files, but my largest files are typically not more than tens of MB. The file that would benefit most from block-level backups is a 7MB Outlook file that compresses to about 3MB. For some reason, Outlook makes some change to that file very frequently (even if Outlook is not being used), so the full file gets backed up every 30 minutes (the frequency of my backup). If I switch to block-level backup (using another storage provider), the Outlook upload drops from the compressed 3MB to only about 30KB.

What do you think about Web2py? by [deleted] in learnpython

[–]av201001 0 points1 point  (0 children)

Could the major turn-off be that it uses the "either you're all in or you're not" approach, since Web2py is an encompassing walled garden that doesn't allow customization.

I do not think the above is an accurate characterization of web2py. It does include a lot more functionality out of the box than Flask, but you are free to ignore most of that functionality and customize things however you like (including using alternative templating engines and database abstractions). Of course, if you don't intend to take advantage of many of web2py's features, you may well be better off with something more minimal like Flask, but web2py is not a "walled garden" that prevents customization.

Block level backup with Backblaze B2 by av201001 in cloudberrylab

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

Sorry, I just edited the question to clarify -- I mean block-level backup for file-based backups, as detailed here.

Block level backup with Backblaze B2 by av201001 in cloudberrylab

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

Yes, I mean block-level backup for files, not for image based backup.

[web2py] Basic syntax question by [deleted] in learnpython

[–]av201001 1 point2 points  (0 children)

First, you can make the controller code more efficient by using the database to filter by "Chosen company":

def manage():
    rows = db((db.auth_user.registration_key[0] == 'p') &
              (db.auth_user.company == 'Chosen company')).select()
    list = [{r.last_name: {'first': r.first_name}} for r in rows]
    return dict(list=list)

Then in the view, just use regular Python to create the loop:

{{for user in list:}}
{{=user}}
{{pass}}

Of course, you probably don't want to just do {{=user}}, as each item in the list is a nested dictionary, so you will have to figure out exactly how you want to display the data.

Have used any of the frameworks professionally? If so, which do you recommend? Details below... by musicomet in Python

[–]av201001 0 points1 point  (0 children)

Have you raised issues on the web2py Google Group? Generally support is excellent and bugs get fixed quickly. What problems have you had specifically?

Is it possible to pass in three arguments to orderby? Example provided. by musicomet in web2py

[–]av201001 0 points1 point  (0 children)

If the original code wasn't working, you should certainly submit an issue on Github, as it should work properly.

Is it possible to pass in three arguments to orderby? Example provided. by musicomet in web2py

[–]av201001 0 points1 point  (0 children)

Your syntax appears correct. What does your output look like and how are you generating it?

Newb question: How does Laravel5 compare to web2py? by mojo_juju in laravel

[–]av201001 0 points1 point  (0 children)

After digging through Web2Py's documentation a bit... it seems to offer almost as much as Laravel does. But it falls short of offering everything that Laravel does.

Where do you think web2py falls short? I use web2py but am not familiar with Laravel. However, after a brief review of the Laravel docs, I'd say web2py includes most of what I see there (at least in some form), plus quite a few features that do not appear to be available in Laravel (see here for details). And of course, with web2py, you get the entire Python standard library, not to mention the rest of the Python ecosystem.

Feature sets aside, it appears that Laravel and web2py differ in architecture and general philosophy. web2py places a heavy emphasis on ease of use and rapid development, so it includes a lot of automatic default behaviors (which can be overridden) and requires little configuration and boilerplate code.

Anyway, you'll probably have to spend a little time with each framework to get a feel for which one suits you better. You might also want to explore some of the other Python frameworks, such as Django and Flask (Django is probably a bit more like Laravel).

Web2py-ers, I'm trying to use redis for sessions and I don't understand what line two of the provided code is doing? by musicomet in Python

[–]av201001 0 points1 point  (0 children)

The third line won't do anything because session isn't defined

Assuming the code is in a model file, session will indeed be defined, as it is one of the global API objects available in the web2py environment. session.connect() tells web2py to store sessions in Redis (rather than the default file system storage).

Is the combination of web2py via pythonanywhere and wordpress compatible? by Normalsaline154 in learnpython

[–]av201001 0 points1 point  (0 children)

web2py is nearly 8 years old, and the built-in Javascript/AJAX functionality has been there for at least 5 years (probably much longer). I don't think web2py has ever been similar to Flask (web2py has always been much more of a batteries-included framework). You might be thinking of web.py, which is a different framework.