Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/08/2020 in all areas

  1. @MSP01 1.. pw cachis any.thing it load, so no.many how times u.cal $page->feld or $page->parent->smoga or $page->feld->bilpa --- it load feld or smoga or bilpa 1 time....... if autojoinin for.feld smoga or bilpa then it load it with th 1 queery that loader page 2) yes 1 sql to loader template=settings page and 1 sql to loader somesetting. ifs somesetting.feld is autojoinin then 1 sql for both. if u.cal eithers template=settings page agains or somesetting agains then alredy loadeded so no xtra sql unless u $pages->uncacheAll() whch clearys it all 3- may be. autojoinin can makes littel small faster but at cost of memry .use autojoinin only for.felds that u accessor on.evry load of $page. title good one to be.autojoinin ......most othrs not;;; body or images and most betters not autojoinin
    5 points
  2. Almost every time I find one of these interesting ML/AI/Science based Python projects I want to include in my own work, I run in major compatibility issues. Either a bound C library has changed its signature too much, or the Python lib never got adapted to version 3 (or 3.7 and another lib needs native types). To me it seems like Python is partly a graveyard of university projects nobody cared to continue. Not that Python is bad in general. When Google app engine support for Python came out I implemented a service together with two other devs (extending in-game functionality of a virtual world) that took up to a few million hits per day and was lots of fun to build. But developing in Python can easily become a package version nightmare, and most tutorials out there just ignore that, which adds a steep learning curve if you want to do complex projects in Python. pyenv and pipenv, which came out last year, only address parts of that. This xkcd is quite fitting I think ? I for one also have a (subjective) aversion to languages where whitespace has too much meaning. If you ever learned Cobol, you probably know what I mean...
    3 points
  3. For anyone interested in how you might do this by modifying the SQL query that's created from a PW selector, here is one way: In your template file or wherever: // A field name is supplied in a custom "empty_first" item in the $options array // The field name supplied here must also be used as a sort value in the selector string $items = $pages->find('template=news_item, sort=-date_1, limit=20', ['empty_first' => 'date_1']); In /site/ready.php: $wire->addHookAfter('PageFinder::getQuery', function(HookEvent $event) { $options = $event->arguments(1); // Return early if there is no "empty_first" item in the $options array if(!isset($options['empty_first'])) return; // Get the DatabaseQuerySelect object /** @var DatabaseQuerySelect $dqs */ $dqs = $event->return; // Prepend a custom ORDER BY $dqs->orderBy("ISNULL(_sort_{$options['empty_first']}.data) DESC", true); // Return the modified query $event->return = $dqs; });
    2 points
  4. This module allows you to integrate hCaptcha bot / spam protection into ProcessWire forms. hCaptcha is a great alternative to Google ReCaptcha, especially if you are in the EU and need to comply with privacy regulations. The development of this module is sponsored by schwarzdesign. The module is built as an Inputfield, allowing you to integrate it into any ProcessWire form you want. It's primarily intended for frontend forms and can be added to Form Builder forms for automatic spam protection. There's a step-by-step guide for adding the hCaptcha widget to Form Builder forms in the README, as well as instructions for API usage. Features Inputfield that displays an hCaptcha widget in ProcessWire forms. The inputfield verifies the hCaptcha response upon submission, and adds a field error if it is invalid. All hCaptcha configuration options for the widget (theme, display size etc) can be changed through the inputfield configuration, as well as programmatically. hCaptcha script options can be changed through a hook. Error messages can be translated through ProcessWire's site translations. hCaptcha secret keys and site-keys can be set for each individual inputfield or globally in your config.php. Error codes and failures are logged to help you find configuration errors. Please check the README for setup instructions. Links Github Repository and documentation InputfieldHCaptcha in the module directory Screenshots (configuration) Screenshots (hCaptcha widget)
    1 point
  5. Hello, I finished this toy project. A simple API to show data for Chilean Birds. Used to flex my PW and React muscles, since a lot of time has passed since making something with those techs. Code: https://github.com/NinjasCL/chileanbirds-api Frontend (React): https://aves.ninjas.cl Backend (PW): https://aves.ninjas.cl/api Hope you like it ? Thanks.
    1 point
  6. That's because the file input field uses ajax requests for the files. So each request only holds a single file.
    1 point
  7. I guess it is it) But I was hoping for something similar, yet different: the side-to-side permissions list)) Guess will have to compare them "by hand".
    1 point
  8. Imo the most important part missing in conversations about one language vs. the other is context. Just using features for comparison is useful mostly to fanboys. One needs to look at existing knowledge, time to learn, amount of benefit from the learned language (short term and long term), team dynamics (hiring, on-boarding, finding devs already fluent), existing code, …. There's a reason there's so much PHP written for things objectively much simpler done in other languages – because all the above things often outweigh changing away from PHP. Like everything async/stateful (even just websockets) is a pain in the ass in php, because the common way to deploy php is stateless. Does that stop people from doing that with PHP? Nope, people take on a bunch of complexity to do it even with languages/runtimes out there much more suited to the task. Take the leap from webdev to ML and the context is completely different. Suddenly things like existing code don't exist anymore, ML is "new". ML needs to be learned anyway, so existing PHP knowledge is vain. Other people mostly use python for ML, so it makes sense to use them. Short term there's a clear benefit in moving to python for ML. The same should apply to green field projects, but what today is actually properly green field (including team knowledge and such).
    1 point
  9. Works like a charm... thanks for that!
    1 point
  10. $this is a special variable within classes to refer to the current instance. It's simply not available in hooks. But $event->object should refer to the current object instance, but I'd expect you'll only have access to public methods and properties that way. So because of the context switch (within the class vs. outside) you might still need to change things.
    1 point
  11. If you have the time, never hurts to learn a new language. Python is very easy to pick up. You don't need to learn Django or use Python for web dev....there's lots of other stuff you can do with it.
    1 point
  12. Yes, from your code, I can see that it isn't. You are inside a function. Use wire instead (wire('session'), etc). Did you try that? Why $this2, by the way?
    1 point
  13. Welcome to the PW forums @j-w! The thing you're asking about doesn't relate to PW as such - it's more an Apache question. As far as I know there isn't anything in the PW htaccess that would prevent you from using basic auth. I don't think you can use <Location> in htaccess - that has to go in your virtual hosts config file. If you want to use htaccess then this Stack Overflow answer might help (it worked for me when I tested it): https://stackoverflow.com/a/14605066/1036672 Or see the answer to the same question for a virtual hosts example: https://stackoverflow.com/a/26980313/1036672
    1 point
  14. On the job market I see a lot of junior and senior php coders wanted. I see hardly anything about python coders wanted.
    1 point
  15. This week we’re proud to announce the newest ProcessWire master version 3.0.164. Relative to the previous master version (3.0.148) this version adds a ton of new and useful features and fixes more than 85 issues, with more than 225 commits over a period of 7 months. There were also a lot of technical changes in the core, including some pretty significant refactoring of several classes to further optimize and improve upon our already solid core, making it that much better. I’m confident this master version is one of our best and if you are running an older version I’d encourage you to upgrade when convenient to do so—I think you will really like what this version brings! Read all about what’s new in the latest blog post: https://processwire.com/blog/posts/pw-3.0.164/
    1 point
  16. Good article and postgresql looks interesting with its search capabilities, thanks. Though none of these really solve what I was after here. I experimented quite as bit with stemming and different stemming libraries. Though they all did roughly the same thing. When it came to searching, stemming just wasn’t that useful. WireWordTools originally had a stemming library and methods, and the appropriate fulltext queries included the word stems with wildcards. In the end, it just wasn’t helpful most of the time. And in the few cases where it was worthwhile, it was redundant, though far less thorough, than what we already had with inflection and lemmatisation. So while stemming can have its uses, it’s not even half way there, if trying to build a smart search. Cool nevertheless that they have it built-in apparently. As far as accent support, ranking and fuzzy search, these are all things that MySQL does as well, though maybe there are differences in how they do them. For instance, MySQL supports “sounds like” and also supports pluggable parsers for fulltext searches. Fuzzy search also isn't what I'm after here, but certainly interested in exploring in the future. For me the most useful thing by far is boolean mode searches, particularly in InnoDB, which has a full-text engine modeled on Sphinx. Boolean mode searches are really very powerful, enabling you to specify what’s required, what’s excluded, matching of words or phrases, partial matching of words with wildcards, specifying noise words, isolating distance between words, adjusting ranking up or down on a per-word basis, grouped expressions and nested subexpressions. All while being incredibly fast. I’m pretty thrilled with what MySQL supports here and what it brings to ProcessWire. Postgresql looks very nice too, but for our needs, I don’t feel we are lacking anything relative to it. I think anyone that would say that as a general thing is not very familiar with what MySQL fulltext supports, or maybe is thinking of fulltext support where it was back a long time ago. For ProcessWire and the scale that most use it at, MySQL fulltext is really a sweet spot, enabling PW to deliver enormous power and capability when it comes to search features.
    1 point
  17. 1 point
  18. I made a fork because i needed some changes for my use - maybe it can be useful. https://github.com/dauni/TextformatterSrcset/releases/tag/1.0.6
    1 point
  19. I'm old enough to actually remember Macromedia Adobe Flash... sometimes you were forced to use that plugin just to display a (dynamic) custom font (sIFR). Oh the fun we had... sometimes I think the young generation of web developers don't know how lucky they are. ? </derail>
    1 point
  20. hello @Richard Jedlička, i found the issue. It was not an issue with the module but a problem with an ImageMagick-6 policy update on my Ubuntu machine, which seems to have happen around the same time as i updated my Processwire version: The solution to my problem was to edit /etc/ImageMagick-6/policy.xml than change the following line from: <policy domain="coder" rights="none" pattern="PDF" /> to <policy domain="coder" rights="read|write" pattern="PDF" /> and added the following line <policy domain="coder" rights="read|write" pattern="LABEL" /> By changing the policy you have to make sure that you can trust the users that upload the pdf files.
    1 point
  21. Python has one big advantage over PHP, which people might or might not care about: It‘s widely used for devops tooling because it‘s preinstalled on so many systems and it‘s growing super fast in the space of ML/AI/Science based computing because of it‘s bindings to fast low level C code while still writing python on top. If you care about those things or you want to do them as well, but not introduce a mix of technology, then sure python is a great solution. If not I don‘t see any reason to switch from whatever one is using right now.
    1 point
  22. Exactly what BitPoet said. Over the years I've heard over and over again how PHP is a dead/dying language, and how the future is all about [insert any imaginable language here]. If anything, I've learned not to care: PHP has been around for a long time, and to date it's still a lively project with a massive ecosystem. When I started with PHP 4 (or 3 — can't remember for sure) back in the days, it was a whole different language, really. 5.x made it a viable object-oriented language, 7.x brought in massive improvements in terms of features and performance, and 8 looks like it's going to be a blast as well. So yeah, I don't see any reason to jump the ship at this point; if anything, I'm pretty sure that PHP will have a lot more to offer in the future ?
    1 point
  23. I've kept hearing that one for the last twenty years, yet here we are. I think that's enough said ?
    1 point
  24. Hey folks. I want to resurrect this old topic and share my latest finding ? Source: https://www.jqueryscript.net/text/Fast-Word-Highlighting.html file: _main.php ------------------------- <style> .highlight { background-color: #FFFF88; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="<?php echo $config->urls->templates?>scripts/jquery.highlight.js"></script> <script type="text/javascript"> $('#content').highlight('<?php echo $q; ?>'); </script> And optionally, I added this to 'search.php' file: search.php --------------------- // did we find any matches? if($matches->count) { // yes we did $content = "<h2>Found $matches->count pages matching your query: $q</h2>"; // <<<<< ADD: $q // we'll use our renderNav function (in _func.php) to render the navigation $content .= renderNav($matches); } else { // we didn't find any $content = "<h2>Sorry, no results were found for $q.</h2>"; // <<<<< ADD: $q } ?
    1 point
  25. In case anyone else* (*so that would be the future me then, when I've forgotten o_O) wants to know how to do this, I worked it out, it's probably in the docs but for the life of me I could not find it (sorry doc writers). You have a hanna code called my_hanna_snippet and you want to output it from within a template, not from the Admin i/f. $hanna = $modules->get('TextformatterHannaCode'); echo $hanna->render("[[my_hanna_snippet]]"); Hope this helps someone/me in the future
    1 point
  26. How the new editor window looks like.
    1 point
×
×
  • Create New...