Asynchronous loading of JavaScript and CSS files in Friendica?

@Friendica Developers what do you think? It mostly involves adding the attribute async="" to the tags.
@friendica developers friendica async javascript css
Way ahead of you, it’s already on develop in frio 😜
BTW: Is that why I always have to reload a page until it works?
Possibly, but you would have to be more specific about the "it" if you want me to be able to do something about it. async means that the script file will be imported after the HTML and CSS to first render the page faster.

In an ideal world, all the Javascript should be executed once the page finishes loading, no matter the order between HTML, CSS, images and scripts, but unfortunately we have some examples of inline Javascript that need JQuery to be loaded first before the body loads.
My current problem with the "dev" branch is that (only on Firefox and Pale Moon, tested on Linux and MacOS) the clicking on the notifications in Frio (haven't tested the other themes) don't open the submenu, but the "notifications" page. When loading the network page, I do not have the button in the top right to create a new item. The notifications for new posts (the small numbers in the top bar) don't appear either.

I always have to reload the page so that this all works. Currently I'm on the RC with both of my servers, so I cannot do some further testing for it.
Yeah, this sounds like it could be an asynchronous-related, the reload would work because the Javascript is cached and it can be loaded faster before the Javascript is evaluated.
The console will tell you which parts are missing next time you encounter the issue though.
I will do. But I guess I will switch back to dev after the release, not before. So this will have to wait for some days.
The problem is mitigated by the fact only you reported it so far. 😁
I noticed it in #vier design. Okay, not maybe fully the best solution then. However there is a JS-loader support in jQuery. I have written for this to load Scripts asynchronously a small loader: http://mxchange.org/js/ajax-loader.js It basically puts a wrapper around $.getScript()

Finally committing and developing again

Finally I found some time to continue developing (at least a bit) on my upcoming FLOSS Java projects (do I have to add the class path exception here?) with entities (JPA), Enterprise Java Beans and JSF applications.

And I listen to #Psy-Trance . :-)

I have to commit a lot as I have not done that for several months. Now I review my changes and found here and there some bad things, like having "complex" methods in entity classes (you should better write an utility class for these methods and declare them static).

Really a lot stuff to do here. :-) I have many small projects as suggested by my trainer. Have small reusable "components" and not one big "core" that all have to include.
#psy-trance developing free-time floss
I was trained by a person that was talking and showing to me over a virtual class room. It were actually 3 professionals or "trainer" or "coaches", one for #Java basics and advanced course (still #JavaSE ) and one for #JavaEE basic and advance course and the third was last introduced to me for project management and I got best remarks everywhere. :-) Sure I don't know everything at a glance, in Java with 3 editions, this is next to impossible.

Maybe coach is the better word here?
This is pretty cool!

Only a #test , if working.
There still is a link problem as I reported eons ago!

Fragebogen zu FOSS

Ich habe heute mal den Fragebogen zum Thema #FOSS der #FSFE komplett ausgefuellt. Hat nicht lange gedauert. Schoen auch, dass er bei der FSFE gehostet ist, was die Domain vermuten laesst.

FOSS4SMEs: Fragebogen

Achtung: Javascript ist in Ihrem Browser deaktiviert. Es kann sein, dass sie daher die Umfrage nicht abschließen werden können. Bitte überprüfen Sie ihre Browser-Einstellungen. wir führen eine Umfrage durch, um mehr über die Wissenslücken in KMU (kleine und mittlere Unternehmen) bezüglich der Nutzung Freier und Open Source Software (FOSS) i...
Bitte weiter sharen!
#foss #fsfe foss survey fragebogen
#LOL , der Hinweis wegen abgeschaltetem #JavaScript ist mit drinne. ;-)

Roland Häder is now friends with admin


JPA causes tons of SQL queries

I'm currently developing (free time project) a Java Server Faces application which uses the #JPA (very common to do so) over EJBs (Enterprise Java Beans). When I turned on logging of SQL queries, I thought I didn't see it right. For each entity ("row" in database table) a distinct query has been issued. Means, when I have 1,000 rows, the same amount of queries are being issued.

This can become a nightmare when "only" 100 users are on the server. Does someone know how to reconfigure the JPA (I use #Payara ) to issue only one SQL query per table?

Surely I have used JPQL (Java Persistence Query Language) and no WHERE was used there. So normally the whole table should be fetched. But this is not the case for linked tables (e.g. with @OneToOne) where each such referenced entity is being fetched distinctly.

So is there a way to prevent this from happening? RAM is not a issue here. 16 GB are installed and data will not grow so much.
#jpa #payara jpa sql performance tweaks
Limit the amount of fetched rows with pagination for example?
Maybe I need to explain more about my program. On initialization of the backing bean (means when an instance is being created and the web container is creating a wrapper class around it) I load the entire table rows from the EJB to into the controller to cache it there (see #JCache #JS107 ).

This gives great performance improvement due to not with every request (POST/GET) data is not being loaded from database but taken from cache. This is what I call asynchronous loading of data, most PHP applications however are synchronous, means with every click data is fetched from database and scripts are loaded and parsed (OpCache is maybe a bit improving here) and are being "forgotten" after the request was finished.

But with a JSF application, the "controller" (backing bean) remains instanced (and wrapped) in the web container's heap until you redeploy the application or restart the web container.

So sure I want to use that advantage of having all loaded at "all" (not at the beginning, but you can implement a ServletContextListener interface where you can "hook" on the initialization phase) times. Still this issue is there.

As you can see, not on every request these SQL queries are performed (which is very good for overall performance) but still they are really a lot. Just imagine 1,000 users on your web server (you may need a cluster then) and several 10,000 records.

Sure, when you cache them all in RAM, then you need a lot RAM. The #Payara application server uses here #Hazelcast ( https://hazelcast.com/ ) for having a distributed heap (cluster members contribute their heap to the cluster) and JCache (JSR107).

So what now? I still found this a bit to much. Currently I use eager fetch-mode, I could switch to lazy but that only delays the problem as foreign entities are being lazyless (on getter invocation) loaded.
#JSR107 is the right one ...
So limiting the amount of fetched rows by pagination is only working with synchronous applications where on each request, the database is being queried. This is not the case with asynchronous applications where the whole data is already loaded (and cached) and SELECT statements are (normally) reduced to a minimum.
I think you have the terminology backwards. In PHP-Javascript web applications asynchronous means the data is fetched when it is needed, after the main page is loaded. This gave the term AJAX ("Asynchronous JavaScript + XML"). On the contrary, synchronous would mean the data is loaded on page load. For example, on Friendica, the network page is loaded synchronously, but then the post refresh or the infinite scroll are loaded asynchronously. I don't think it matters for your problem, but it may confuse other people.

Back to your issue. Initial data load takes more RAM. This actually was the subject of a recent performance improvement in Friendica: should we load all the configuration values at once at the start of each script or should we query each individual values? it turns out RAM consumption rarely is the bottleneck in a PHP application because of the "fire and forget" architecture you described: the script is loaded, executed, forgotten. So a increase in memory consumption wouldn't be significant, especially if it implies a reduction in script execution because the memory consumption pike will be shorter. However, for a long-running server application, using more RAM probably is a bigger deal.

No matter what, here are the general axes of improvement to reduce the number of requests:
  • Write your own SQL query: I don't know if is it possible, especially in Java where everything seems to be broken down in atomic parts.
  • Limit the initial data load, use lazy loading beyond: Like you said, the initial data load doesn't scale. If you can cap the size of the initial data load, you probably can use a dynamic cache checking for row existence before querying either the cache, or the DB directly.
I understand and know what AJAX means and I'm not targeting PHP or labeling it as bad and "look how cool this or that is". No, that is not my style.

Back to my issue, the #JPA (Java Persistence API) fetches records from database, creates an instance for each record of your entity class and wraps it into a proxy class. Then that proxy class is being compiled and most JPA implementations are caching them (the entity manager does this). This has nothing to do with the application or that it uses AJAX. My main goal is to reduce invocations of EJB business methods as this is "expensive" (a lot code need to be executed).

Just imagine, you can deploy your model classes on an other server or even data center and from your backing bean's perspective you have to change nothing at all as all is encapsulated away for you (most #JavaEE application servers use #CORBA for serializing and deserializing data).

Means on one server (or cluster, doesn't make a difference in Java code) you have your web "controllers" (they are not called controllers, backing beans are the right words for them) and on the other your model classes are running. This means one thing: distributed application load. :-) BTW: Amazon is running on Java Server Faces, when you hit the "order" button, EJBs are being invoked.

Okay, I'm explaining to much off-topic. With "synchronous" I mean with every request (even AJAX requests as they are basically HTTP requests. too) data is being fetched from the database. With "asynchronous" this is not the case. And I mean with this, that data is not being fetched from on each database, but maybe from a cache (that needs to stay updated, of course).
I didn't think you looked down on PHP, I was just reiterating the structure I personally know inside and out, since I don't know Java much.

Anyway, I probably would go the caching way, it seems more in the spirit of Java (adding a middle block between two atomic blocks) than trying to coerce an atomic block into doing a non-atomic task.
Okay. :-) I have found something programmatic (with annotations) for this, but it looks a bit like an overhead when you have +20 entities. What I would prefer is a 3rd fetch type ALL to the existing EAGER and LAZY. That would have to go into JPA specification, of course which made all persistence providers, like #eclipselink , #hibernate, #datanucleus and so on unified as before every provider did it on their way.

This is why I like the JPA, because it is dbms-independent and provider-independent at the same time. No need to worry if your data is stored in a SQLite, MsSQL, Oracle DB or good-old MySQL or even "exotic" database systems like MongoDB.
I’ve always felt that “things”-independent software often ends up being the lowest common denominator between the abstracted products, and that very few actual migrations occur to justify the loss in features. Sure, on paper not having to care about which DBMS is used is great, but this often erases any advantage of choosing a specific DBMS over another, and migration between DBMS is so expensive that the DBMS-independent sofyware will often be used with a single DBMS for the project lifetime.

Have you seen such pattern professionally?
Remember from which times #JPA came: 2006, there was not much #BigData or so. And yes, there are annotations now that will help model your entities. Maybe I take that approach.
Ah, @NamedEntityGraph(s) were the annotations I was looking for.
For PHP, Doctrine is using annotations as well, but I still don’t like it. I believe the foreign relationships should be defined once, in the database schema, and the application should automatically take them into account, in a long-cached manner if it is too expensive to query the schema on each load.
Yes, that is what I mean with synchronous loading, on each load/request all over again, no persisted caching (except when you use memcache/redis but that is not the solution for all scenarios). One thing that could be interesting for non-Java but #PHP people can be the PHP Application server which aims to be a #JavaEE application server written in PHP. There also the application is loaded at all times and entities are cached there, too.
It's foreign to me because I don't see PHP developers suddenly take the Java infrastructure approach without switching to Java altogether, and conversely, don't see Java developers suddenly learn PHP and reproduce the same infrastructure as well.
I have learned both languages. :-) So I can live in both worlds.
If you get the freedom of choosing a technology for a personal project, which one would you naturally lean towards to?
Hard to say as you cannot compare PHP and Java as they are fundamentally different languages. PHP is type-lazy (allows no type at all) and Java is type-safe (unless you do "unsafe casts").

To answer your question, I like both, if that satisfies your question. :-)
My question was more about ease of use and programming fun versus professional obligation.

Friendica verwechselbar mit FB?

Ich wurde hier #aufarbeit angesprochen, ob ich [bold]hier[/bold] auf #Facebook unterwegs sei ... Ja, ist verwechselbar, wenn man sehr ungenau hinsieht. Vielleicht hat er sich an dem Favicon festgeklammert?

Naja, nicht als Kritik oder FB-Bashing verstehen, was damit auch nicht beabsichtigt ist, ich weis sehr wohl, dass Friendica != Facebook ist, da es eine freie Alternative ist.

Ich finde es halt etwas bedenklich. Ich musste nachkorrigieren und sagen, dass es nicht FB, sondern Friendica ist. Mal schauen, vielleicht wechsel ich das Theme? Sieht es wirklich so verwandt mit FB aus? Finde nicht, hier ist vieles weiss und grau, bei FB weiss und blau.
#aufarbeit #facebook friendica verwechselung facebook
7 comments show more
Verwechselbar? FB hat doch ein kleines f o.O
Zudem ist dieses (Favicon) blau/gelb, das von FB blau/weiss. Aber okay ... so verallgemeinert man halt, einige (anderes Unternehmen) hielten das sogar für eine Nachrichtenseite nur weil hier die Bilder samt Überschrift vorhanden sind ... Nennt man Tatsachen und Fakten, interessiert es nicht. :-(
Hhmm, ich bin im örtlichen Hackerspace auch schon komisch beäugt und gefragt worden, ob ich tatsächlich Facebook benutzen würde.

Scheint gewisse Ähnlichkeiten zu geben. Kann ich nicht beurteilen, ich war da (bei dem anderen) noch nie.
Hängt vom Theme ab. Welches nutzt Du denn?
Hier #vier . Ich schalte mal #frio frei und gucke, wie es aussieht. Etwas FB konnte ich bei meiner Frau "zwangsweise" sehen (sie ist dort wegen der Familie auf den #Philippinen viel unterwegs, dort gibt es FB kostenlos, (fast) der Rest kostet Aufschlag, 2-Lane-Internet ist dort schon angekommen ... :-( )

Empörung über schwarzen Jungen mit rassistischen H&M-Pulli -

Empörung über schwarzen Jungen mit rassistischen H&M-Pulli (neues deutschland)

Mit der Bezeichnung »Affe« werden schwarze Menschen oft rassistisch beledigt. Da scheint der Modekette H&M offenbar egal zu sein. Sie zeigt einen schwarzen Jungen mit einem Pullover, auf dem steht: »Coolster Affe im Urwald«.

#Rassismus #HundM #HM

Stuck together glass in porcelain

I currently have a glass stuck in a porcelain. I have already setup cold water in top glass and hot (boiling, I'm careful) around lower but still they remain stuck. Plus I added salt in upper (cold) glass. I got this (last) idea from a #youtube video with ID #HOglOnne3As which seems quite straight-forward but still no success here.

Any ideas? I cannot currently upload images, size limit of 780k exceeded but I set $a->config['system']['maximagesize'] = 2*1024*1024; which should be enough, right?

Strange #bug in #Friendica ... So you have to live with a link to my #nextcloud instance: https://cloud.mxchange.org/s/rnFtrpbQqAXx8O1
#youtube #hoglonne3as #bug #friendica #nextcloud household glass porcelain problem
Fabio Friendica
No idea for glass stuck, sorry.
For upload limit, check: the value in admin panel (configs from db override the ones in htconfig); the php.ini settings for upload limit, I don't remember which is atm, sorry...
Ah, that is why my change did not have any effect. Thank you for pointing this out.
I did not remember it at that time.
I've updated my max image size limit over time, but these cameras get so high mp, so I just always go into my camera and change the setting before I take a picture that I know I'm going to post.

I was going to say about the cups, if you throw them against the wall they'll come apart, but that's just silly :-D
Ich würde mal versuchen, die beiden im Spülbecken komplett in heißem Wasser zu versenken. Vielleicht haben die Materialien unterschiedliche Ausdehnungskoeffizienten. ;-) Dann alle paar Minuten probieren, ob sie sich trennen lassen.
Wenn das nicht hilft, hilft ein Hammer. :-)
It is finally separated, luck with us. :-)
@Steffen K9 🐰 das mit dem Hammer brauche ich zum Glueck nicht. Die Glaeser sind gluecklich voneinander getrennt. ;-)

Searx instance is working again

I have managed to bring back my #searx instance at


searx - a privacy-respecting, hackable metasearch engine
back working again. I had updated my Apache installation to 2.4 and forgot to change the settings to Require all granted.

Feel free to use it (on your own risk, careful: adult content is possible to find).
#searx #privacy apache24 searx uwsgi
17 comments show more
Holger redmatrix
@Steffen K9

Na ja, beim Hoovern über den roten Link Online-Verknüpfungen öffnet sich ein Fenster von dem ich den obigen Screenshot gemacht habe. Sinngemäß: Umleitung auf zu viele von McAfee rot markierte Webseiten...
Meine Searx-Instanz arbeitet per Standard-Einstellung mit POST-Anfragen und Image-Proxy, damit die IP des Nutzers über meinen Server verdeckt ist. Zudem loggen beide (Apache und uwsgi) nicht.
Holger redmatrix
Ich mache die Meldung nicht!!!
Sie ist mir nur aufgefallen und wollte sie an dich weiterleiten.
Ja, ist nicht böse gemeint. :-)

XMPP addon does no longer connect to ejabberd

@Friendica Support I had always a working XMPP instance on my friendica instance. Now it doesn't connect. I have enabled debug log in .htaconfig file but nothing is written there.

With pstree I can only see beam.smp with 18 beam.smp threads but no ejabberd_auth.php sub process which did happen before. strace tells me that it tries to read from 0 (stdin) so it seems to wait for input. Access rights and correct user/group are set (0700, ejabberd.ejabberd according to documentation). Yet still it isn't starting.

Any ideas what might cause this?
@friendica support ejabberd friendica xmpp jabber addon
Have you changed the path to ejabberd_auth.php? It moved to "scripts".
No, I still have it in include but it did work before. Sure, I need to find some time for updating my instance ...
Then try at first a regular XMPP client to see where the problem is.
As I said, only beam.smp is visible in pstree view, no forked auth_ejabberd.php.
You are on the develop branch. When have you updated your system? Several weeks ago the script moved.
And no, it is not working. Not even a single debug message in ejabberd.log.
Okay, I have always updated ejabberd.cfg but ejabberd.yml is used. No wonder that auth_ejabberd.php was never loaded. Now it is loaded but still the same. I'll digg deeper for this ...
Please check via an external client.
Tried it with #gajim, no change. :-(
Somehow it listens only on IPv6 requests, which I surely not do (not now).
Okay, the private key part in ejabberd.pem was missing. Now I can connect and even with SSL.
Still nothing on friendica's side. It looks like no connect is going through. http-bind is available at https://f.haeder.net/http-bind and returns a 503?
Have a look at your system logfile (/var/log/user.log). There you should see some lines for "auth_ejabberd".
I have found out that ejabberd's http-bin was listening not on but instead on public IP. Maybe misconfiguration, still I'm getting a 502 on pointing my browser to https://f.haeder.net/http-bind

http-bind settings and listener

<IfModule mod_proxy.c>
<IfModule mod_proxy_http.c>
ProxyPass /http-bind retry=0


# netstat -lnp|grep 5280
tcp 0 0* LISTEN xxxxx/beam.smp
http-bind bosh ejabberd apache24

Reocities - GeoCities reborn!

I have found #reocities, an attempt to reborn GeoCities:

Reocities Archive, rising from the ashes - RIP Geocities...

If this is your first visit here, please sign the petition Here lies what we could salvage from the ashes of GeoCities. Yahoo! has done an amazing thing by keeping GeoCities alive for as long as they did, but we feel that it is a waste to leave the Internet with a hole of this magnitude. At a minimum, Yahoo! could have simply left GeoCities as a mo...
Currently I'm crawling it with my personal #YaCy cluster.
#reocities #yacy geocities old-times-internet flashback

Quiet and calm office room at work ...

Today I have one of the very rare opportunities to have a relatively quiet and calm office room for myself, my workmate is ill and others are not in. Only sometimes the CEO comes in.

Will use that moment to program and focus more.
atwork office collegs ceo

Fixed NPE in PrimeFaces!

I have just pushed a pull request for #PrimeFaces on #GitHub. Let's hope, they accept it.

Here is the link:

Fixed NPE and other improvements by Quix0r · Pull Request #3011 · primefaces/primefaces

What I have fixed so far:

fixed NPE in InFilterConstraint when value is NULL
added missing @Override annotation in all filter constraint classes
Code such as for (Iterator<? extends Object> it = c...
#primefaces #github jsf primefaces npe
fix primefaces repeatable-example
Just deploy it (here with #Payara, maybe Micro works?) and unselect all, then select "None selected".

LiMux is dead, maybe one time it lives again?

LiMux – Ende eines Vorzeigeprojekts https://linuxnews.de/2017/11/09/limux-ende-vorzeigeprojekt/

Wenn #Unkenntnis von Nicht-ITlern zum Ende des Vorzeigeprojektes #LiMux wird, hat der Verstand versagt. Einfach peinlich, was da abgeht ... Und dann sich beschweren, dass Linux eingeschränkt ist?! Hackt es? Ja, die #NSA-Software namens #Skype kann nicht unbeobachtet installiert werden, oh wie schade aber auch ...
#unkenntnis #limux #nsa-software #skype limux munich münchen linux windows

Scammer zurück scammen

Das könnte was für @goebelmasse sein

Ein lustiger Chat-Bot nervt die Verfasser von Betrugsmails

Re:Scam aus Neuseeland bindet Zeit und Ressourcen von E-Mail-Betrügern.

#ReScam "redet" sogar mit einem ...
#rescam @goebelmasse rescam
4 comments show more
I disapprove this initiative. $12 billion aren’t *lost* each year, they are redistributed from credule people to liars. Interestingly enough, when the scammer is richer than their mark, they’re called politicians. When the scammer is poorer than the marks, some idiots work on a chat-bot.
#TIL : Credule comes from credulity.
Bin schon aktiv dabei...

German "Pfand" on bottles in English?

I'm currently looking for a proper translation for the German word Pfand. Here in Germany we have 25 EUR cents on some plastic bottles (not all) like soft drinks or even caned drinks (not all cans).

When we bring that empty bottle/can back to the supermarket and put it there in a machine for one-way-bottles/cans, then we can that 25 EUR cents back for each bottle (that has a proper symbol on it's cover printed).

dict.cc gives me a lot words for this: pawn, collateral, mortgage, pledge, deposit, forfeit, earnest, security, gage. I can rule out 2,3 and 5, 6 sounds strange. Any ideas which might be the right one?
lingual english-language english
7 comments show more
#TIL Thank you to all repliers. So deposit is the best choice then. :-)
I'm looking for this because I write my #FLOSS program ( #Affero #GPLv3 ) where you can later control your personal financial with. And surely you want to include deposit on bottles and cans in it.

How Twitter Secretly Benefits From Bots And Fake Accounts https://theintercept.com/?p=155916

How Twitter Secretly Benefits From Bots And Fake Accounts

There's reason to believe that Twitter's user growth team chose not to delete fake accounts because it wanted to preserve higher user numbers for investors.
newer older