Closed ogdenwebb closed 2 years ago
@lizmat I've update styles, but probably it's all that I can achieve without changes in template right now. At least we need to append class="message"
or something like that to normal message, because it's hard to select normal messages. System messages don't have padding before them, but I can't implement that using table tag in any way.
Furthermore, using HTML table for such complex layout isn't a good idea at all, because it prevents us from tweaking margins to get different padding for different rows. Table is not suitable for this case. :/
@ogdenwebb: the use of tables for this, is simply because of my background in HTML 0.9 :-) I used to be able to do layout stuff by using <table><tr><td>
. There is no other reason than that.
Marking "normal" messages with a class, is definitely an option. It would be but a simple tweak to the template.
So if you could give me some pointers for a non-table
approach, I could do the necessary changes. If you think it'd be easier to do them yourself, that's also fine by me. I could give you write access to this repo, if you want.
Currently I'm working on homepage, so I wanna push those changes next. Besides I will think about a better approach for the message log, maybe an extra class for "normal" messages would be enough.
@ogdenwebb: there is already a class special-same-nick
. You'd want the opposite of that?
@ogdenwebb: FYI, I've moved the message rendering logic to a subroutine in common-subs, to ensure the scrollup/scrolldown message rendering is automatically in sync.
there is already a class special-same-nick. You'd want the opposite of that?
Yes, if a message not special-* type -> it needs a specific class, I suggest something like message
. For now I can't say in styles something like "select normal messages after special-same-nick" simple because there's no such class.
I've just added an initial
class, which will be set on each message that would not need to be closer to its predecessor.
@ogdenwebb: that's what you wanted, right?
@lizmat nah, it's not what I wanted. I wanted to get a class for normal messages, i.e. messages without any other classes.
I will try to example with this pseudocode:
if msg-class not in [special-same-nick, special-camelia, special-commit, special-thread-header, ...]
add class "_class_name_"
@ogdenwebb: I can also make that happen. But I thought that the idea was to easily identify the messages that should not have their vertical spacing reduced? "initial" will do that, because all of the "special-" class cases should not have vertical spacing reduced?
Well, I take a look at the message log again, and I can't see a way to implement it with this table layout. Top margin for elements like special-commit is prolly impossible, because other messages have padding which add some space on top within their container, but I can't actually add extra padding to special-commit, because instead of
<empty space>
----border----
_special_commit_text_
----border----
It will do that
----border----
<empty space>
_special_commit_text_
----border----
Alas limitations of CSS don't allow us to choose the last element in subsequence, so I can't properly select each last element in group of special-same-nick.
So @lizmat would you accept the PR like is or it needs a better solution? If not, you can close this request.
Almost ready to close this request. :-)
What would be needed for a better solution? Could you elaborate (other than "not using <table>
s" :-)
Also, as to doing things differently: would it make sense to make 3 different templates, one for mobile, one for pad, and one for desktop, and use an outer <iframe>
to make the decision which form to use?
What would be needed for a better solution?
Rewrite that not using table. :)
Could you elaborate (other than "not using table's
As I said, it's related to table tag/CSS limitations, not because I want to see more work on that. As you can see now, I tried to rewrite this keeping current layout with minimal changes, but sadly without success.
and use an outer
I don't think so.
@ogdenwebb: FWIW, It could also be a redirect on mode change, I could live with that, e.g. by adding .mobile
and .pad
to the URLs, before the extension?
"media queries" what are they?
@ogdenwebb: FWIW, It could also be a redirect on mode change, I could live with that, e.g. by adding
.mobile
and.pad
to the URLs, before the extension?
I'm not sure what you want to achieve with that. Better describe me - why are you want to use iframes?
media queries" what are they?
CSS part which allow you to have different layout for different viewport sizes (you can treat that as browser window width for now) and even more.
https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries https://www.w3schools.com/css/css_rwd_mediaqueries.asp https://css-tricks.com/a-complete-guide-to-css-media-queries/
Bulma has its own mixins to help with that: https://bulma.io/documentation/utilities/responsive-mixins/
From what I see, the original goal is implemented here, isn't it? Smaller padding before special messages does not look like a blocker to merge this to me.
Rewriting the layout or doing iframes or whatever for something so arbitrary/small is swatting a fly with a sledgehammer (as if we don't have tons of more noticeable things to fix for users), no?
"I'm not sure what you want to achieve with that. Better describe me - why are you want to use iframes?"
What I see in the current setup, is that a lot of logic is copied between the different views (and in some case is missing, like the "Gist" pulldown in the mobile view). This means that all users will have a lot of HTML dropped on them that they don't need, as they generally would not be switching between views. This is both a load on the server (more to render, more to compress) as well as on the bandwidth (more to send), adding to perceived slowness of the site.
Yes, I'm old fashioned this way. Resources are finite, if you start lean, you will have a much easier time to scale out if necessary.
What I am proposing is to have 3 different sets of templates, one for each possible view. When the JS detects a mode change, it would do a redirect to the associated URL, so e.g. assume I'm on desktop (which to me still will be the default):
/moarvm/live.html
Then switching to the mobile view, would be a redirect to:
/moarvm/live.mobile.html
The <iframe>
question was basically an idea from me as a possible solution. But you made me realize that that was the wrong way to think about that.
Does that make sense?
What I am proposing is to have 3 different sets of templates, one for each possible view. When the JS detects a mode change, it would do a redirect to the associated URL, so e.g. assume I'm on desktop (which to me still will be the default):
Why should we invent the wheel when the current solution results in a simple setup and works nicely?
This is both a load on the server (more to render, more to compress) as well as on the bandwidth (more to send), adding to perceived slowness of the site.
Premature optimization is a root of all evil. Is it slow? If yes, did we profile? If yes, what bits are slow? Let's address this exact bits instead of writing in C instead of Raku because the resulting programs are much more lean on start.
If you ask me, keeping three sets of templates sounds like an overcomplication for both users ("Am I at the correct URL now, what are those redirects") and devs ("Oh, I need to deal with a spaghetti or do a copypaste because there are three directories instead of one"). A technology exists to precisely deal with displaying different things on different screens, there is nothing wrong with relying on it.
Yes, I'm old fashioned this way. Resources are finite, if you start lean, you will have a much easier time to scale out if necessary.
I don't think anyone seriously contributing to Raku can be considered old-fashioned. :)
I remember discussing with you why the backend doesn't rely on a database to hold data (and as a result of this decision it loads gigabytes of data into RAM, 5+ on my machine just on startup, something that probably would be absolutely ridiculous to think about 20 years ago) and you wrote you want to show what Raku is capable of and not over-complicate the setup. In this regard you preferred to trade ease of maintenance and the overall setup simplicity over caring about server resources. But when it comes to other part of the project why would it not work?
If we want to care about resources, we should certainly do something with 5+ GB of RAM busy right after startup, it's much more noticeable for the server, no? IMO even if the server has to give off static files (which is extremely cheap nowadays, it streams data from cache to a socket) 10x larger than now, it would still be a tiny fraction of what it has to do keeping gigabytes of objects in memory.
For the record, there is absolutely nothing wrong per se with a separate domain for mobile view. Large projects like Wiki or YouTube do that, for example. But again, Wiki has 18 billion page views per month, there are absolutely different criteria for them. It is just a lot of hassle for almost no merit in our case.
Why should we invent the wheel
This would not be re-inventing the wheel, as you point out in a later comment. Also, I would not want separate domains, just different extensions: /moar/live.html
vs /moar/live.mobile.html
vs /moar/live.pad.html
.
The advantage would be that one could test out whatever mode on whatever device (probably with a separate debug flag to prevent automatic switching).
when the current solution results in a simple setup
I currently do not think this is a simple setup. It feels like a Perl 4 setup to me.
and works nicely?
Yes, it works nicely.
Premature optimization is a root of all evil. Is it slow? If yes, did we profile? If yes, what bits are slow? Let's address this exact bits instead of writing in C instead of Raku because the resulting programs are much more lean on start.
Writing in C? Who said that? Not me. I was simply stating that when the CPU has less to do per request, you can handle requests of more people.
an overcomplication for both users ("Am I at the correct URL now, what are those redirects")
Modern users don't care about URLs. That's an implementation detail. The only valid point you have, is that if people start sharing links, it could be confusing if multiple links would show the same content, but only in a slightly different format. I guess that's why the big sites choose to use different domains, so that at least the relative links are the same everywhere.
devs ("Oh, I need to deal with a spaghetti or do a copypaste because there are three directories instead of one")
Well, even inside the same file, you can haz copypastas. I've seen them. That's why I abstracted much of the display logic into Cro template subs, so that they can be re-used everywhere, and if needed, to be changed in one place only.
A technology exists to precisely deal with displaying different things on different screens, there is nothing wrong with relying on it.
If this could be done without needing to create separate versions of each interaction (e.g. the search and filter options), then that would be great. So why do we have to do that? Is there something inherently wrong in the design that this should be hacked that way? I mean, if the technology is so good for that, why do we need this duplication of interactions?
it loads gigabytes of data into RAM
Yes, it does, because at least during development, I want to get a better idea of the worst case memory usage.
preferred to trade ease of maintenance and the overall setup simplicity over caring about server resources
You misunderstand me. I do care about server resources. Very much so indeed. Using a database on the same physical hardware, also does come with a significant memory footprint. The only advantage you have with using a database is, is that technically that could live on a separate machine.
I've already significantly optimized the parsing and creation of message objects. In the original version, it took about 2x as much RAM. I'm also betting on MoarVM becoming more memory friendly. And there is always the option of loading the logs more on-demand. But that still would not prevent the growth in memory as soon as a search engine bot decides to slurp all pages of all logs (several have done that already, afaics). So for that case, it is better to have all in memory to start with.
If you're complaining about the memory usage during testing. Just create a directory and copy what log files you'd like to work that in there in the same directory structure, and just pass that as the first parameter to raku-logs-server
. Alternately, if you use the irc log repo, you can pass --channels=raku,moarvm
to the startup script, so it will only handle those channels.
IMO even if the server has to give off static files (which is extremely cheap nowadays, it streams data from cache to a socket)
That would be EXACTLY my approach to the daily files (except today's one). Sadly, Cro doesn't allow you to pass an already gzipped file to the client. if it does allow you to do that, then please enlighten me. Or fix it in App::IRC::Log
.
keeping gigabytes of objects in memory.
We can still look at other approaches, such as lazy log loading. Thing is, I think there's still a lot to be had in Raku / Rakudo itself, especially with regards to stopping memory leaks. And that the log server is a good example of a pure Raku approach to providing a small / medium size application.
I'm closing this PR because we apparently need to do rethink the basic HTML design of the site for this to work correctly, and this will apparently mean a lot of work. An amount of work that I'm willing to put into it, but which I cannot ask of you two.
Pushed with https://github.com/lizmat/App-Raku-Log/commit/7bc09e1cdb6a4f1c736f0aeddd4e7036aa51abb0 @ogdenwebb++
Looks great! Thank you very much!
However, this appears to have some repercussions on the special styles used for camelia messages and commit messages, and on the live view: for date changes:
They're not vertically centered correctly, or their top border is too tall.
Looks like the config for "special-test", "special-code" and "special-commit" also need the same type of tweaking? Or tweaking to counteract the tweaking?