The other day I had to iterate over a large number of items but to avoid a timeout I could only compute a certain amount at a time. So I had to split the number into equal chunks and a remainder. Here’s an easy way to determine the chunk size:
The code return the following values: $remainder => 194 $chunks => 49 Verification: (49 * 1023) + 194 = 50321
How does it work? In line 4 $totalNumber is divided by a modulo operator (“%” is the PHP token for modulo). The operator returns the remainder of the division (194 in this case). By subtracting this value from $totalNumber it becomes a whole number multiple of $chunks and the division with $chunkSize equals the desired number of $chunks (line 6). Now you have the number of necessary iterations and the remaining part.
Web development is based on free software by developers like you and me, isn’t it? At first glance, this seems to be the case. Let’s take a look at the main tools modern web is mainly developed with nowadays:
Most of the tools are Open Source projects (VS Code only in parts, npm is proprietary). So where are the big companies? Well, all six tools and sites are owned by Big Tech:
The tools we use all day rise and fall with the benevolence of companies typically seen as enemies of Free Software by the majority of Open Source developers.
Especially GitHub and npm are irreplaceable because of their large data collection. If Microsoft decides to pull the plug from one moment to the next, the access to the vast collection of free code will be gone at least for some time and the build processes of millions of programs will break.
Of course, these services can and would be replaced by others, but it would take some time until dominant services will emerge and web developers would need to find an interim way of accessing their externalized source code.
What? add_action does nothing but call add_filter and nothing else? There is no difference in functionality, it’s only a different name. So there is no reason why you shouldn’t use add_filter instead of add_action if you have no other solution.
I don’t say that you should interchange filter and action hooks at will. Using the correct hook type makes your code more readable and maintainable, for yourself and for others. Nevertheless, if there’s not other way to accomplish your goal but to use a filter hook instead of an action, don’t hesitate, it virtually makes no difference.
If I want to tweet a link of a site currently opened in my Firefox/Waterfox browser I using the “Hootlet” from “Hootsuite“. This little Add-On simply takes the text of the titlebar of the browser and adds an ow.ly link so I can tweet it with a single click.
Unfortunately Firefox adds “Firefox” to the titlebar which I have to delete manually every time. But hey, computers are for automationing things so this should be automated, too. The Add-On repository contains an Add-Ons called “Customize Titlebar” which would do exact the requested task but it hasn’t been updated 2009 and is compatible with Firefox 3.9 (!).
In many cases those Add-Ons still work with current versions of Firefox the only problem is that they are marked incompatible. It’s always worth a try to simply increase the entry and check if it still works. Especially Add-Ons that are not critical like “Customize titlebar“. In this case this little hack actually works and I’m happy to be able to use the plugin.
I set the compatibility information of the Add-On to “50.*” so it should work for some while.
Wait, wait, wait! A hackerspace? In Kassel? No, of course there isn’t one. Not yet. But there could be soon. Some people thought they could change this state and create such a space in Kassel, whereby space does not exclusively has to be taken as a physical room.
So the call went out into the great wide open of the Internet and the initiators hoped for a small group of interested people. at the first meeting in a small pub this small group turned out to be a large group of 28 combatants.
Unfortunately the locality was quite unsuitable for such a large group. If only five or ten people had shown up it would have been a nice and cosy get-together but actually we had to make the best of the circumstances. Some verbal contributions could hardly be heard others not at all. But nobody could expect such an immense interest. Nonetheless everybody was concentrated and the discussion was quite constructive. After a short introduction to the basic ideas of hackerspaces everyone told a bit about his background, his intentions, ideas, and expectations. I think a lot of Blinkenlights will be created in the near future.
Obviously there is a great crowd of hardware freaks, programmers, and artistically interested men (yes, there wasn’t a single woman) having many ideas for new and/or interesting projects and ideas how they can help others and how others can help them. The initiators presented a welled planned concept and even looked after some affordable rooms with a good infrastructure. Next week we will have a go and see.
Hopefully everybody will keep at it and the new hackerspace will have a good substantial and financial foundation. It’s going to be interesting!