Why is ModulesAnywhere loading my module 3 times? - joomla2.5

It is as simple as that.
I'm referencing my custom module from joomla article using modulesanywhere extension. After experiencing an unacceptably long loading times I've discovered that module file (mod_mymodule.php) is being included 3 times. It loading includes making a web service call lasting couple of seconds, resulting in almost 10 secs for page to load...
Is there anything I can do in mod_mymodule.php to only execute code once?
Thanks
v.

It really was ModulesAnywhere to render module before it decides that it won't use the rendered content due to cache settings and returns MO_IGNORE string instead of rendered html.
Module had 'No caching' as the only option.
Setting 'Ignore caching' to Yes in ModulesAnywhere plugin Basic Settings did the trick, so now the first time the module is rendered - the HTML is 'accepted' so we have no more lag due to calling web service thrice.

Related

WebKitGtk doesn't load local files

I've tried loading a local html file using webkit_web_view_load_uri() with a file:// URL. However, the webview would display a blank page. To circumvent this, I tried using webkit_web_view_load_html() and it worked correctly.
Now that I'm trying to load some images in the html using the <img> tag, the images aren't loaded (It displays a blank page).
I'm puzzled because I tried before (~ 2 months ago) a similar method and it worked.
Note: I copied the contents of the generated HTML into a file and loaded it with Firefox and it worked as it should (The images are visible), but with another WebKitGtk application I had lying around the images didn't load.
Note: I'm using C++ as the main programming language (I'd prefer having C++ types in the solutions only if possible)
Note: I have set webkit_settings_set_allow_file_access_from_file_urls() and webkit_settings_set_allow_universal_access_from_file_urls() to TRUE
Ok, I've managed to solve this. The solution had NOTHING to do with webkitgtk, which is strange. It seems that the application was trying to download the page instead of loading it. This traces to a faulty MIME type database.
Tl;Dr:
Execute this:
rm ~/.local/share/mime/packages/user-extension-html.xml
update-mime-database ~/.local/share/mime
and use webkit_web_view_load_uri() instead of webkit_web_view_load_html() with a file:// URI
I had the same problem in C. You have to explicitly set file:// as base_uri when you call webkit_web_view_load_html().
See also answer here

javascript file loading problem in a web browser, relating to mime types, context Django debug_toolbar concerning Django/debug_toolbar versions >=3.X

I have noticed, at some point last year, that the debug_toolbar is not present anymore. Now I have found the problem, but do not actually completely understand what is happening and why. [Update: I have found an answer - see the last few paragraphs ]
The initial information is that I tried a lot of different version combinations for Django/delug_toolbar and there were no problems as the version number of both started by 2.
However, the toolbar is not showing itself if a version number starts by 3. The toolbar 2.2 should work with Django version 3 or larger also.
Now I have located the problem to be that toolbar.js is not loaded. There is a message in the developer tool's console:
:8001/static/debug_toolbar/js/toolbar.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
So I found the location of the toolbar.js under the static files folder of the debug_toolbar.
The file is loaded in a template base.html (in folder env\Lib\site-packages\debug_toolbar\templates\debug_toolbar)
There is a line:
<script type="module" src="{% static 'debug_toolbar/js/toolbar.js' %}" async></script>
But I do not understand why type="module" is preventing the browser to load and use the toolbar.js?
There was a section in the (https://readthedocs.org/projects/django-debug-toolbar/downloads/pdf/stable/) Django Debug Toolbar manual that said in case of the problem with mimetypes the user should edit Windows registry.
"1.6 Troubleshooting
On some platforms, the Django runserver command may use incorrect content types for static assets. To guess content types, Django relies on the mimetypes module from the Python standard library, which itself relies on the underlying platform’s map files. If you find improper content types for certain files, it is most likely that the platform’s map files are incorrect or need to be updated. This can be achieved, for example, by installing or updating the mailcap package on a Red Hat distribution, mime-support on a Debian distribution, or by editing the keys under HKEY_CLASSES_ROOT in the Windows registry"
Could someone please give me an explanation for what is going on here? I tried to find if there was any discussion about this problem with these new Django/Django Debug Tool versions but there was nothing to be found. The other discussion was concerning about the earlier versions.
Do I have a security setting of a browser (etc) that is causing the problem as there is no question about the people that have made the Debug toolbar would have implemented their code/settings not to work at all? I have tried Firefox/Edge/Chrome and the issue is in all of them.
I found a tip from another question.
By adding
if DEBUG:
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
to settings.py causes that the toolbar.js is loaded.
That addition solved the whole problem. There is no need to do anything for the Windows registry.
The discussion can be found here:
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking i
So my question was in fact a duplicate.

Why is my site not fully rendering after implementing WP Rocket? I get "Uncaught SyntaxError: Invalid regular expression: missing /" in my console

I've recently implemented WP Rocket on my WordPress site and suddenly it's not rendering correctly. I'm getting this error message in the console:
Uncaught SyntaxError: Invalid regular expression: missing /
I can clear the cache and it loads the first time I load it, but then fails to fully render on all subsequent loads. I've disabled all other plugins and I still get the same error. I'm using a popular theme Divi which is not seeing the same issues on other sites I've got with Divi.
I created a blank site with Divi and loaded only WP Rocket with the same settings. Turns out the page fully loads, but I still get the same error in the console:
Uncaught SyntaxError: Invalid regular expression: missing /
I'm fairly certain it's related to the WP Rocket cache at this point. Here's the full WP Rocket cache settings:
[x] Enable caching for mobile devices
[x] Separate cache files for mobile devices
[ ] Enable caching for logged-in WordPress users
Cache Lifespan: 1 Day
I've seen others post about this same issue, but no solutions other than clearing the cache - which only works on the very next load, not subsequent ones.
As I was typing this up and listing out the cache settings, I noticed the WP Rocket section for File Optimization which led me to finding a solution. By unchecking Minify HTML and Minify JavaScript file I was able to fully eliminate the issue.
Further research uncovered that this may the caused by a dependency of WP Rocket called Minify.
Hopefully this will help anybody else who stumbles upon the same issue. My site is running very quickly now with WP Rocket despite not minifying the HTML and JavaScript.
It's about DIVI: When you checked minify in the DIVI builder, it will regenerate the minified files each time you do a new post/page. But not the same filename, DIVI uses each time a different filename for the minified files. So if minify the minified files by another plugin you wil drive into trouble.
Easy solution for every cache-plugin with DIVI: Uncheck minify in the DIVI-Builder and let your cache-plugin do the job

Uploading files with classic ASP - Cant do larger than 120 KB?

This is driving me crazy. We recently migrated over to Amazons EC2 service, and now file uploads (using Motobit Huge ASP Upload) in our application fail for any files larger than 120kb. I know the default limit is 200kb, but its failing for anything larger than 120 with an error number of -2147024893 (0x80070003) with no description/details at all. I cannot find anything in the event viewer or IIS logs to help point me in any direction.
I did go into IIS under the ASP properties for the site in question, and changed the Maximum Requesting Entity Body Limit from 200000 to 400000, and it made no difference at all. I even tried an iisreset, as well as rebooted the server after making the change just to ensure it applied out of hopeless desperation.
I have tried a multitude of different files and file sizes. The most I have been able to upload is a 120KB file. Its not a code issue, as this same code is working on my local box (IIS 7) without issue, and was simply copied over from our old server as-is.
EDIT: I have also tried the following with no results:
set the request filtering settings of Maximum allowed content length to 30000000 (30 Mb).
Manually edited web.config and added requestLimits maxAllowedContentLength="15728640" and httpRuntime maxRequestLength="2147483647"
I hope this can help someone in the future, because I was banging my head against my desk trying to resolve this.
This component has a maximum memory setting of 128K. Any files that are larger than this are not stored in memory, but instead stored in the temp folder. The default temp folder is C:\Windows\Temp.
The culprit was an Application Pool Setting, under advanced settings. 'Load User Profile' was set to true. Resulting in the component trying to use a temp path in C:\Users, which was failing. There are 3 solutions:
Set Load User Profile = False
Assign a temp folder in code (Form.TempPath = "")
Create the folder in C:\Users (use response.write form.CheckRequirements)
For our case, #1 was the perfect solution. #2 would have required edited over 100 files, and #3 would only be needed if you are required to have #1 set to true.

django sitemap efficiency

I saw on this page that it's possible to lower the limit on your sitemap so that it is paginated differently:
Caching sitemaps in django
But when I try to generate my sitemap, it hangs and hangs, and never comes up.
Eventually, if I wait long enough, I get this error in Firefox:
XML Parsing Error: no element found
Location: http://sitename.com/sitemap.xml
Line Number 1, Column 1:
My site has about 70K pages at present, so I'm using the index generator in urls.py. For some reason though it's not working. I'm guessing it is because my server lacks the power to generate sitemaps containing 70K links, but I'm not at all sure.
Does anybody have any insight?
One thing you could do it to split your huge sitemap into several files.
Probably each file will contain a different content area of your site and you can use caching as probably not all sections update in the same frequency?
http://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/#creating-a-sitemap-index
I finally figured this out. Turns out I had a misconfiguration in my urls.py. Ugh.
Big sitemaps? Try django-fastsitemaps