Wikipedia:Reference desk/Archives/Computing/2023 June 29
Computing desk | ||
---|---|---|
< June 28 | << May | June | Jul >> | June 30 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
June 29
Help with CSS request
I'm an admin from SqWiki. Our homepage's body is made of 4 blocks which consist of dynamic content (especially the ones on the left). Is there a quick way to keep the 4 blocks aligned automatically when the content changes, for example, by filling up the missing space on one side with extra padding? I've searched around but haven't been able to find a CSS solution for that. - Klein Muçi (talk) 12:07, 29 June 2023 (UTC)
- How do you define "aligned"? Numbering the blocks
, the only way to avoid blank space if blocks 1 and 4 are much larger than blocks 2 and 3 is to do something ugly, like putting 2 and 3 in a thin column. If you insert1234<div style="clear:both;"></div>
between the code for blocks 2 and 3, at least the tops of blocks 3 and 4 will be aligned. --Lambiam 15:27, 29 June 2023 (UTC)- Lambiam, hey there! "Aligned" in this case means that the extremes of each box on each side are aligned vertically, neither of them is lower or higher than their counterparts. So in other words, the top of block 1 is aligned with the top of block 2, the bottom of block 1 is aligned with the bottom of block 2, the top of block 3 is aligned with the top of block 4 and the bottom of block 3 is aligned with the bottom of block 4. Currently only the tops are aligned, not the bottoms. I wanted the bottoms to also be aligned, so the blocks that have smaller content be filled with extra padding (maybe top and bottom of their content, maybe only on bottom, whichever looks better) so their bottoms also align. This should happen dynamically as their content is prone to change on a daily basis. Does it make more sense now? I tried your suggestion but it didn't provide the solution I was hoping for. — Klein Muçi (talk) 15:45, 29 June 2023 (UTC)
- Given the content of a block, its height is a non-increasing function of its width. To give blocks and the same height, given that their combined widths equal a fixed value , requires a solution of the equation Unfortunately, these height functions are not simple; the height decreases with jumps as the width increases, which depends in a complicated way on the content. Also, the available width is not constant; the user can resize the window, and the optimal ratio is then also not constant. CSS allows some simple arithmetic, but nothing that would allow computing the heights. While the smallest block can be made taller by adding vertical padding, to do this automatically, given a value for the width of block requires padding of height to be added to the shorter of the two blocks. If the heights were available as variables, you could pad block with padding of height
max(calc(var(--hB)-var(--hA),0px))
, and block likewise withhA
andhB
swapped. As far as I'm aware – but I'm not a CSS buff – it is not possible to assign the dynamically determined height of an element to a variable. (If you could, you can create some strange loops.) --Lambiam 23:25, 29 June 2023 (UTC)- Lambiam, thanks for bringing a detailed argument in this! Yes, this is where I'm stuck: I've asked for help in this in the past (again on wiki), people actually understand my request on the second time but they all say that most likely such a functionality doesn't exist on CSS. Which surprises me as I'm forced to naively ask myself: Am I the first person ever to want to have some blocks aligned on their height on a dynamical environment? Surely other websites would have had this simple request before considering general aesthetics and dynamical contents? But as I said, this is the 2nd or 3rd time I ask about this and I've been researching StackOverflow questions for months and I'm yet to find a solution to this situation so maybe I must "admit defeat" now...
PS: I must say though I had failed to consider the range-resizing aspect before. I'm used to only thinking of resizing on a quantic aspect: You're either a PC (standard big screen) or a mobile (standard small screen). An aspect which surely isn't true. I tried manually resizing my window now and indeed there was a moment where all the blocks became almost symmetrical. Also the width changed drastically in jumps, like you explained. That does make the problem even more complicated that what I had thought all this time... — Klein Muçi (talk) 01:15, 30 June 2023 (UTC)- You ate not the first. Most people give up and use tables, which do exactly what you want without any trouble. 97.82.165.112 (talk) 02:47, 5 July 2023 (UTC)
- 97.82.165.112, interesting... Our whole main page was written with a table design but we switched to using CSS because tables are a bit hard to edit and to modify for different screens. I'm guessing this is what we lost in the process... Thank you for the insight! — Klein Muçi (talk) 09:58, 5 July 2023 (UTC)
- You ate not the first. Most people give up and use tables, which do exactly what you want without any trouble. 97.82.165.112 (talk) 02:47, 5 July 2023 (UTC)
- Lambiam, thanks for bringing a detailed argument in this! Yes, this is where I'm stuck: I've asked for help in this in the past (again on wiki), people actually understand my request on the second time but they all say that most likely such a functionality doesn't exist on CSS. Which surprises me as I'm forced to naively ask myself: Am I the first person ever to want to have some blocks aligned on their height on a dynamical environment? Surely other websites would have had this simple request before considering general aesthetics and dynamical contents? But as I said, this is the 2nd or 3rd time I ask about this and I've been researching StackOverflow questions for months and I'm yet to find a solution to this situation so maybe I must "admit defeat" now...
- Given the content of a block, its height is a non-increasing function of its width. To give blocks and the same height, given that their combined widths equal a fixed value , requires a solution of the equation Unfortunately, these height functions are not simple; the height decreases with jumps as the width increases, which depends in a complicated way on the content. Also, the available width is not constant; the user can resize the window, and the optimal ratio is then also not constant. CSS allows some simple arithmetic, but nothing that would allow computing the heights. While the smallest block can be made taller by adding vertical padding, to do this automatically, given a value for the width of block requires padding of height to be added to the shorter of the two blocks. If the heights were available as variables, you could pad block with padding of height
- Lambiam, hey there! "Aligned" in this case means that the extremes of each box on each side are aligned vertically, neither of them is lower or higher than their counterparts. So in other words, the top of block 1 is aligned with the top of block 2, the bottom of block 1 is aligned with the bottom of block 2, the top of block 3 is aligned with the top of block 4 and the bottom of block 3 is aligned with the bottom of block 4. Currently only the tops are aligned, not the bottoms. I wanted the bottoms to also be aligned, so the blocks that have smaller content be filled with extra padding (maybe top and bottom of their content, maybe only on bottom, whichever looks better) so their bottoms also align. This should happen dynamically as their content is prone to change on a daily basis. Does it make more sense now? I tried your suggestion but it didn't provide the solution I was hoping for. — Klein Muçi (talk) 15:45, 29 June 2023 (UTC)
- You can simply use a grid for that these days. Grid used to not be supported in all browsers, but the Wikipedia skin itself now also uses grid as most old browsers are no longer in use, and those few users who still use them, can get an acceptable 'less pretty' version that is still readable. I've put some CSS in https://sq.wikipedia.org/wiki/P%C3%ABrdoruesi:TheDJ/common.css that attempts to demo this. To do it properly also requires making some changes to some of the templates, because all these overrides are stacking and stacking, which is needless and confusing. —TheDJ (talk • contribs) 11:43, 5 July 2023 (UTC)
- TheDJ, hey there! Thanks for providing this! Can I temporarily lower the protection of the templates that make up the main page and you change one of them to show me what to do exactly and then update your demo accordingly? I think I can replicate the result on the other ones, no? Are we talking about all the templates (header and footer too) or just the 4 ones that make up the body? What about the css page dedicated to mobile screens? — Klein Muçi (talk) 12:37, 5 July 2023 (UTC)
- I'm a bit busy with other engagements the rest of today, but I can help you with this tomorrow evening CEST, if you want. —TheDJ (talk • contribs) 12:56, 5 July 2023 (UTC)
- TheDJ, oh yes, of course. Whenever you can. Just let me know when you're ready and I can lower the protection levels then, so we limit the time the main page will spend without protection. Thank you! :)) — Klein Muçi (talk) 13:14, 5 July 2023 (UTC)
- I'm a bit busy with other engagements the rest of today, but I can help you with this tomorrow evening CEST, if you want. —TheDJ (talk • contribs) 12:56, 5 July 2023 (UTC)
- TheDJ, hey there! Thanks for providing this! Can I temporarily lower the protection of the templates that make up the main page and you change one of them to show me what to do exactly and then update your demo accordingly? I think I can replicate the result on the other ones, no? Are we talking about all the templates (header and footer too) or just the 4 ones that make up the body? What about the css page dedicated to mobile screens? — Klein Muçi (talk) 12:37, 5 July 2023 (UTC)
If PHP Composer developers don't expect me to use Composer as a sudoer, how would should I use it?
I have installed Composer this way:
curl -sS https://getcomposer.org/installer -o composer-setup.php
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
For some reason composer.phar isn’t available in the directory of the curl operation, but anyway, I ran the command composer
, and got this output:
Do not run Composer as root/super user! See https://getcomposer.org/root for details
I clicked the link and read that short page but I couldn’t understand it. For example, I couldn’t understand this:
It was always discouraged to run Composer as root for the reasons detailed below.
As of Composer 2.4.2, plugins are disabled automatically when running as root and there is no sign that the user is consciously doing this. There are two ways this user consent can be given:
If you run interactively, Composer will prompt if you are sure that you want to continue running as root. If you run non-interactively, plugins will be disabled, unless… If you set the COMPOSER_ALLOW_SUPERUSER environment variable to 1, this also indicates that you intended to run Composer as root and are accepting the risks of doing so.
If Composer developers expect me not to run Composer as root or sudoer, than how sould I run it? Should I create a specific user for it which isn’t a sudoer? How does it help?
Oh and if it helps you help me in any way – I just need Composer for Drupal, nothing more besides Drupal. — Preceding unsigned comment added by 2A10:8012:F:F548:5831:5F73:4C2B:3E83 (talk) 18:36, 29 June 2023 (UTC)
- It is generally needed to run Composer as the user owning the website directory, so if this user is www-data do:
passwd www-data # Set a password for user www-data;
su www-data # Switch user to www-data
composer # some composer command
- Or perhaps only
sudo -u www-data composer
"Updating" Tutanota
A couple of years ago (or so), I adopted a tutanota.com address for use with Wikipedia. I only used it with Firefox, on my computer (and only for Wikipedia). It worked well. But after a few months, the website started nagging me to "update" Tutanota. As Tutanota was, for me, no more or less than a website, this notion puzzled me. So I just ignored the nagging.
From a couple of months ago, attempts to log in to Tutanota have been met with "Please update Tutanota. The currently installed version is too old and not supported any longer." I don't know how I should update a website, especially when I can't log in to it.
Wild guess: I should install some Tutanota-only "app" on my Android toy (which I don't want to use for Tutanota or indeed any but a very few purposes), and log in, and this process will "update" Tutanota; whereupon I'll be able to use tutanota.com via Firefox on my computer and delete the junk from my Android toy. But am I missing something obvious here? -- Hoary (talk) 23:16, 29 June 2023 (UTC)
- I note that about two-fifths of the way down their front page there are download links for executables for Linux, Windows and macOS. Our Tutanota article says these are open-source (so you aren't merely trusting Tutanota to be non-evil). So even if mail.tutanota.com/login doesn't any more, at least you don't have to use Android. But really, it should.
- You might post this as an issue on their issue tracker, which is in active use (and currently I see an issue relating to Firefox there, so evidently browser-webmail is an acceptable topic and this isn't limited to bugs in their apps). You might also experiment with another browser just for diagnostic purposes. I wonder whether it's simply that the apps use the same login as the webmail, and your browser is hiding its identity (via a faked-up user-agent string, which is often desirable) and thus is assumed to be an outdated app. Card Zero (talk) 02:08, 30 June 2023 (UTC)
- A pile of ideas there, Card Zero. Thank you. Just to look at one possibility, I'd forgotten all about user-agent strings, which certainly were a concern a decade or more ago. I tried using Chrome: No difference. I scrolled down https://tutanota.com/ as far as "Download Tutanota". The options are the expected "Android" [plus variants], "iOS", "Linux", "Windows", and "MacOS", but also "Browser". I'd never previously noticed that last one. My browser was updated as recently as this week (thank you, Synaptic), but I clicked all the same, expecting to read of a required extension/plug-in, or perhaps some new and bizarre constraint (
MSIE 6Chrome). Instead, there was no talk of any kind: I was instantly logged into my mail, and with no mention of anything having been, or needing to be, updated. Very odd. But of course very welcome. -- Hoary (talk) 05:27, 30 June 2023 (UTC)
- A pile of ideas there, Card Zero. Thank you. Just to look at one possibility, I'd forgotten all about user-agent strings, which certainly were a concern a decade or more ago. I tried using Chrome: No difference. I scrolled down https://tutanota.com/ as far as "Download Tutanota". The options are the expected "Android" [plus variants], "iOS", "Linux", "Windows", and "MacOS", but also "Browser". I'd never previously noticed that last one. My browser was updated as recently as this week (thank you, Synaptic), but I clicked all the same, expecting to read of a required extension/plug-in, or perhaps some new and bizarre constraint (
- That just links to mail.tutanota.com, so do you mean that my link (above) wouldn't work, but theirs would? That is odd. It's not done with cookies, either. There's probably some HTTP header to say what the user clicked on to get there ... ah yes, Referer, maybe they use that to prevent direct linking. But why do they care? And why do they then give the spurious error about an outdated version? Still worth putting the issue ticket in, I think. (In fact, are you saying you were logged in automatically when you clicked it, without having to enter name and password? So this is some sort of bug with store password.) Card Zero (talk) 05:40, 30 June 2023 (UTC)
- Card Zero, you overestimate my energy. And this is one reason why I won't make an "issue" out of this. The other is that I was locked out weeks ago, and at this point it's unlikely that I'll say something that (i) the Tutanota people don't already know and that (ii) might help others (who by now will have either succeeded in "updating" or just given up and gone back to Hotmail or wherever). But since you ask: From the start, the website "knew" my name. And I'd got Firefox to remember and automatically supply both my name and my password. (Securitywise, this may not be a good idea for all I know. But I've only ever used the address for Wikipedia and the Wikipedia Library.) -- Hoary (talk) 06:40, 30 June 2023 (UTC)