Threads for eduard

    1. 5

      I also really like the element showing the current CPU usage, temperature and so on! I’ll copy that feature when I eventually migrate my blog to being hosted on a Raspberry Pi.

      I thought about the fact that your cronjob is executing the getstats.sh script every minute and I think that it might be possible for you to have some concurrency-related issues.

      The script over-writes the file with the stats on this line:

      echo "<!DOCTYPE html><html lang="en">[...]</head>">"$STATS_FILE"

      And then you append all other values to the files with single echo commands, like this:

      echo "CPU Temp: ${cpu_temp_celsius}°C<br>" >> "$STATS_FILE"

      I am wondering that if a user requests your web page, in between the single echo calls, it could possibly get an incomplete picture of the statistics, because those values would be missing from the file.

      Another unrequested suggestion: if you’d use caddy instead of apache, you could forget about step 5 in your post, because caddy automatically handles your HTTPS configuration. I now use caddy in all of my projects (and also even at work) and I can really recommend it.

      Thanks a lot for the post, it really motivated me to do something similar!

      1. 8

        […] because making games is my hobby, releasing them and making money from them is not, so naively exploring roguelike design (and especially deckbuilder design, since I had never played one before) was part of the fun for me. I wanted to make mistakes, I wanted to reinvent the wheel, I didn’t want to borrow tried-and-true designs from existing games. That likely would have resulted in a more tight game but it would have defeated the purpose of what I love about making games.

        This really resonated with me. I have a lot of project ideas; some of them fall into the category of ‘not fun but might make some money’ and others fall into ‘fun but definitely will not make money’. These ideas constantly battle within me for my attention and my contradicting desires of having fun while programming and wanting to make money to become a solo developer.

        1. 9

          I think the most important feature for me will be tracking tool dependencies with the go command directly. No more problems caused due to different tooling versions when collaborating with other people :)

          1. 1

            I was lucky that most tools I am using for my projects can be used as libraries and can be used with my own little command line executable, which then can be used in a versioned manner. Here is an example where I’m using //go generate which wraps an internal command, which uses esbuild for building JavaScript and CSS assets.

            1. 1

              One possible downside is if the tool dependencies clash with the dependencies of your package.

              1. 2

                I’ve never had this problem, but you can use a separate mod file for tools if you’re worried about that.

                1. 1

                  Although I wrote a post, being very excited about go tool, this is still an unfortunate side effect of the pattern. Using a separate go.mod for them works, but has it’s own tradeoffs 🙃

                  1. 1

                    That’s a possibility but you can always go back to what people were doing before with a tools package or doing go install @version on its own.

                    I haven’t run into an issue with the common dependency graph yet. The unfortunate thing about it is not being able to discern quickly your own dependencies from the tools’ in go.mod.

                    1. 1

                      In fact I seem to have problems now with different tools having conflicting dependencies

                2. 37

                  The server doing something useful is a requirement for building an interesting business. The client doing something is often a nice-to-have.

                  A great quote from the article, which also resembles the HTMX philosophy.

                  1. 10

                    This is not true in any sense: a backend process that performs no I/O and leaves no observable output has no user value. There needs to be an interface between the user and the application.

                    We can debate how rich that interface needs to be, but there is most certainly value in the interface itself. And you can make it more or less valuable based on how you build it.

                    1. 2

                      The client doing something is often a nice-to-have.

                      (Emphasis mine)

                      1. 3

                        And my point is the client is never a nice-to-have, it’s always essential. On top of that, proper business functionality requires proper presentation in the client. Business value is inherently coupled to the user interface.

                        1. 4

                          You have not understood their point. They said:

                          The client doing something is often a nice-to-have.

                          When they say ‘the client doing something’, they are talking about things like ‘drag an email into the Trash folder to delete it’, which is a nice-to-have. Whereas if you are looking at an email and click the Delete button, the server actually deleting the email is essential.

                          Go back and read that paragraph carefully. It’s not difficult to get this when it’s in the proper context. The immediate previous sentence is:

                          Many interactions are not possible without JavaScript, but that doesn’t mean we should look to write more than we have to.

                          Clearly we are talking about complex interactivity that can only be implemented with JavaScript when we say ‘nice-to-have’.

                          1. 4

                            It seems to me you also have not read what I wrote. This is the key part:

                            Business value is inherently coupled to the user interface.

                            Sometimes interactivity is essential to the business functionality. That’s the point. Like, great for this person who doesn’t need it. That doesn’t mean that’s how every business is. Sending an email is a silly example. Most businesses are not email-sending businesses.

                            For example, anything involving complex data analysis. Which every vertical SaaS app ends up becoming. Tables and buttons for server-rendered data actively gets in the way of achieving business value. Because business value is completely coupled to the client experience.

                            1. 1

                              I feel like you are now arguing for the sake of arguing. Basically you are saying the same thing in a different way.

                              Them: it’s often not needed.

                              You: it’s sometimes needed.

                              OK great sometimes it’s needed 👍🏼

                              1. 3

                                That’s not a good faith summary of what’s going on here, at all. It’s clear that we have different definitions of “sometimes.”

                                My definition is that more often than not, more interactivity is better. The author’s definition is that more often than not, less interactivity is better.

                                I frankly don’t know what your opinion is since you’re only nitpicking words and trying to be a representative for the posts’s author or (ironically you seem to be the one just looking to argue for the sake of arguing. I have an actual point).

                                The article is about entirely moving away from a JS-heavy framework, and claiming that:

                                “fat client” era JS-heavy frontends is on its way out

                                I disagree with this. And I think HTMX, and server rendering in general, is going back to the Stone Age.

                                Do you have an opinion on that?

                                1. 3

                                  Here is what you said first:

                                  Sometimes interactivity is essential

                                  Here is what you are saying now:

                                  My definition is that more often than not, more interactivity is better

                                  If you are redefining the meaning of ‘sometimes’ to be ‘more often than not’, then I don’t have anything more to say because this is not a useful discussion.

                                  1. 0

                                    Do you have an interest in getting into the conversation of preferring interactivity or not? That was my real intention all the way back to my initial reply. We’ve devolved into nitpicking about the semantics of words, which I agree isn’t useful.

                                    1. 1

                                      I already engaged in good faith by giving an example of the kind of interactions that the OP was talking about, the drag-and-drop email delete. I don’t see how any reasonable person can disagree that these kinds of interactions are often nice-to-have rather than essential 🤷‍♂️

                                      1. 3

                                        What if it were proven that the drag-and-drop experience prevented accidental deletions, made it more clear to the user what they were doing, as well as reduced the time it took to figure out how to perform the action they wanted to take?

                                        Would that fall under “essential” to you? Because sure, the user technically could take the action without any them, but this is just another manifestation of the Turing tarpit. Just because something can be done doesn’t mean that it is practically viable for it to be done.

                                        1. 2

                                          What if it were proven that…

                                          What if we both magically set up our own scenarios such that they were infallible and unassailable? This is not engaging with the discussion, it is just steelmanning your own point to make sure you never have to acknowledge another’s. No reasonable developer would ascribe those benefits to DnD UIs. In fact DnD is also an accessibility nightmare for people without perfect motor control. Let’s be realistic here.

                                          Just because something can be done doesn’t mean that it is practically viable for it to be done.

                                          This is exactly the point that OP and I are trying to make. Just because a fancy interactive UI can be made with JavaScript, doesn’t mean it should.

                                          I think you would benefit from watching this talk that delves into the complexities of UI/UX/interaction design and just how difficult it is to get it right: https://youtu.be/mtHf7crZZIQ

                                          Think several times before reaching for JavaScript to code up fancy interactions. Chances are really good that it will be broken for a large variety of users.

                                          1. 0

                                            Friend, the point of the contrived example was to see if you distinguish between technically supporting requirements and supporting them well (for an arbitrary definition of “well” and nothing to do with drag and drop in particular). Not to trick you into agreeing with something.

                                            This is exactly the point that OP and I are trying to make. Just because a fancy interactive UI can be made with JavaScript, doesn’t mean it should.

                                            You misunderstood the point then. My point was that an oversimplified UI technically works, but that shouldn’t count as fulfilling a user’s requirements because the requirements may include a more efficient interaction. Your point is that just because a more complicated UI can exist doesn’t mean it should exist. These are not the same thing. Do you see the difference?

                                            1. 1

                                              the requirements may include a more efficient interaction

                                              Do you see that you are repeatedly making up scenarios where your argument can be the only possible ‘winner’? I gave you a realistic, reasonable scenario to illustrate my point. You took it and repeatedly tried to move the goalposts.

                                              ‘What if DnD is actually better for moving emails to Trash?’ It’s not.

                                              ‘What if the requirements require it?’ Then ask where the requirements come from. More often than not someone just added it in without thinking through the tradeoffs and consequences, and if you let them know, they will immediately and happily drop it.

                            2. 1

                              Clearly we are talking about complex interactivity that can only be implemented with JavaScript when we say ‘nice-to-have’.

                              Just for fun, that kind of drag and drop thing actually can be done without javascript. Make the emails links and have a textarea. When you drag and drop a link in, the URL lands there. Server then parses the pasted link text and makes it so. See: https://arsdnet.net/ddemail.html

                              Is this a good experience? No, it sucks lol, I’d do some script here too (well actually, I’d probably just have a delete button or maybe a checkbox on the list or something, I think that’s easier to use than drag and drop anyway). But you can make it work. Again, just for fun.

                      2. 4

                        If you step outside the world of web SaaS, then there are all kinds of software where the client is a requirement to the business and a server is unneeded or a nice-to-have. I don’t think you can make such a generalised distinction based on where your code runs.

                        1. 1

                          If you step outside the world of web SaaS

                          But we are not doing that in this post.

                          I don’t think you can make such a generalised distinction based on where your code runs.

                          But they didn’t make a generalized distinction, they made it specifically in the world of React-based SPAs, which you are tried to step out of earlier, but as established, we are not doing that.

                      3. 3

                        For me the tool dependencies are the nicest new feature and the one I see myself using soon!

                        Especially when collaborating with other people on the same codebase, it has been problematic when we use external tools like swag to generate docs for an API.

                        There was no simple way to fix the tool’s version for everyone working on the codebase, and we would each get different outputs when using different versions of the tool. That should now be a problem from the past!

                        1. 2

                          We solved that with Nix, but doing it via Go itself also makes sense, sure.

                        2. 3

                          Hypermedia systems, a book written by the creators of HTMX and Hyperview has a chapter specifically for Hyperview.

                          I can really recommend this book. It is easy to read and it made me understand both HTML and HTMX better. It made me question design decisions of the HTML spec that I had never thought of.

                          1. 82

                            People shouldn’t feel pressure to upgrade htmx over time unless there are specific bugs that they want fixed, and they should feel comfortable that the htmx that they write in 2025 will look very similar to htmx they write in 2035 and beyond.

                            *thunderous applause*

                            1. 27

                              The API stability and low effort while upgrading dependencies is also one of the main reasons why I use Go with HTMX for my backend and templating.

                              1. 12

                                I really like this approach. This is how it should work for (almost) all software out there.

                              2. 8
                                • eza: a “replacement” for ls which generates nicer output than ls.
                                • yazi: a terminal file manager. I used to use lf but I feel that yazi is being recently more actively developed. It renders images in the terminal out-of-the-box.
                                • z: it tracks your most-used directories and then works as a “smartcd.
                                • direnv: it has already been mentioned in this thread, but it has been such a game-changer for me, that I had to mention it as well. If you haven’t tried yet, you should!
                                1. 16

                                  The best code is the code that you can use but don’t have to maintain.

                                  I couldn’t agree more with this sentence.

                                  This statement coupled with the fact that the stdlib is very very stable, means that the effort required to give long-term support to a Go project is minimal.

                                  1. 3

                                    I would say that this is the second-best type of code. The best code is the code you don’t use :)

                                  2. 2

                                    That is maybe the main reason why I will solely use Go+HTMX+Templ in my personal projects from now on.

                                    There’s your answer. The second someone needs a production web app for a business they’re going to be looking more fondly at React.

                                    For small-to-medium sized projects with 1-2 developers, it doesn’t really matter what tech stack is chosen.

                                    1. 6

                                      The maintenance burden is what matters, the last thing I want to be doing after I finally get back to a personal project is fight with the hips system, update dependencies with braking changes, find out there is no replacement for one lib I’m using and it’s abandoned / not longer compiles if I update common dependencies wit other libs, etc.

                                      I want to come back months later and be able to work on a personal project, not spend my fleeting time maintaining it. Tech stack here matters

                                      1. 2

                                        It’s insane to me that people accept the BS work of keeping up with the version treadmill. Don’t you want to be doing things other than fiddling with code that was working fine yesterday?

                                        1. 3

                                          In my opinion, I think many developers feel that any code containing bugs (or that hasn’t seen an update in some period of time) is a potential exploit and the only thing to do is constantly update the code. Yes, I want to do other things than fiddling with code that was working fine yesterday, but I think that’s a (sadly) minority position these days.

                                          Edit: remove sarcastic remark.

                                        2. 2

                                          This is exactly what I was trying to convey with my article!

                                          I want to come back months later and be able to work on a personal project, not spend my fleeting time maintaining it. Tech stack here matters

                                          At least from my experience Go+HTMX+Templ allows me to do this.

                                          Less dependency management pain = more fun time programming my personal project

                                          1. 2

                                            Any chance you could write a more detailed article about your stack, how you use, and how it all fits together?

                                            1. 1

                                              Yes, I am considering this, since multiple people gave me the same feedback.

                                              I didn’t go into too much detail about the Go+HTMX+Templ stack because I wanted to keep the blog post short and focus exclusively on the topic of dependency management.

                                        3. 5

                                          I’m maintaining a React app at work in production and am looking fondly at htmx, lol. The whole React stack has a bonkers level of complexity. The constant flow of upgrades and security vulns. The evolving ‘best practices’ every couple of years. The Node and npm breakages. Having to move away from the deprecated CRA to Vite and Vitest. The list goes on.

                                          1. 4

                                            The second someone needs a production web app for a business they’re going to be looking more fondly at React.

                                            Maybe?

                                            At my previous job we switched away from React to HTMX for our less rich Web UIs (think portals in HTMX vs. real-time positioning displays in React).

                                          2. 19

                                            I will wryly note that the author finds a way to make 7 GET requests, including HTMX, to render something that is trivial to style with bare HTML and style tags.

                                            1. 13

                                              Tbf, personal projects are for experimenting with things, even if they are overkill.

                                              1. 7

                                                Agreed, but the trick is knowing when you’re doing it.

                                                1. 1

                                                  And why not experimenting doing it simple and using bare bones tech?

                                                2. 2

                                                  If you are refering to my blog, you can see in its codebase that it is simply a Hugo static site. I don’t think of this codebase as a Go+HTMX+Templ project, I am just writing content in Markdown and letting Hugo generate the static HTML files.

                                                  I did experiment a little bit with HTMX on that codebase in the past, and I erroneously left the <script> embedding the HTMX package in the header of the page. Nonetheless, as of the time of publishing this blog post, no element on the page was actively using the imported HTMX package.

                                                  Thanks for the feedback though, I removed the <script> element that was unnecessarily embedding HTMX to the blog.

                                                  1. 2

                                                    Looks like it’s down to the page text, analytics (no big deal), and two favicons. Solid shave, well done! :)

                                                    EDIT: Not trying to bust your chops too much, just felt topical given the content of the blog post.

                                                3. 9

                                                  I had never encountered the concept of Fish Linux before. It made me laugh.

                                                  1. 3

                                                    I wouldn’t use context.Background() as the author of the post. I normally initialize a context on my main function with context.Background() and that context is then passed around in the arguments of any other function (that requires a context) that gets called by main or any other function down the stack.

                                                    I can then create further “children” contexts from the single origin context that can have their own unique timeouts and cancellation policies, but they are all still tied to the origin context.

                                                    1. 1

                                                      There is a story I like about someone going to a software shop that created missile guidance system. The code was leaking memory like crazy. When asked about it, the shop engineer said that it didn’t matter, as long as there was enough memory until the missile reached its target, because the system would then perform the most explosive garbage collection that can possibly exists.

                                                      “Don’t waste your time on things irrelevant to the problem you are trying to solve”, I think, is the lesson from that story.

                                                    2. 18

                                                      Disclaimer: I’m from Spain.

                                                      I think many people wouldn’t consider itself Europeans because it’s a very broad term. Many people still don’t know the difference between Europe, the European Union, the Eurozone, the Council of Europe and Eurovision! Regarding (Br|L|.*)exit, it’s true it’s not just conservatives that want it, this was just the main force behind Brexit. The EU is a trade union after all, that evolved to harmonize more and more law between countries so trade could be made more efficiently. But there’s no real culture behind. We usually speak together in English, which is a language with very few native speakers in the EU nowadays. There are no newspapers, radio stations, TVs, that are cross border,… there are no memes that only an EU person would understand (but within a country, there are). Most memes that are widely known in the EU, are because they’re also popular in the US. Even in European Elections political parties are the local political parties, they go with that name, and then they form alliances to create the groups in the parliament.

                                                      1. 6

                                                        Quite honestly to feel more European we need to move the population around. I would love to see for all the citizens a 1year mandatory erasmus/social service in a randomly selected location of the union.

                                                        1. 3

                                                          There are no newspapers, radio stations, TVs, that are cross border,…

                                                          Although I mostly agree with your point of view, this is actually not true. Look at arte a TV station conceived to create and broadcast mostly the same programming for German and French audiences.

                                                            1. 1

                                                              I’m aware of arte.tv, but it doesn’t broadcast in Spain, so for me, it doesn’t count as a TV station.

                                                              1. 2

                                                                it is beamed to you from Hotbird 13 and ASTRA 1:

                                                                • ASTRA HD (dt. Fassung): 11494 MHz / Horizontal / FEC 2/3
                                                                • HOT BIRD 13 HD (frz. Fassung): 11681 MHz / Horizontal / FEC 3/4
                                                            2. 2

                                                              It’s always markedly surprising that the Yanks expect anyone to be or feel “European”.

                                                              Do they not know that they’re European too?

                                                              1. 2

                                                                Err…no? I’d say in my neighborhood probably half the population has no ties to Europe whatsoever.

                                                                1. 1

                                                                  surprising that the Yanks expect anyone to be or feel “European”

                                                                  It may help explain their mistake, to consider that the people of the USA “[are] or feel” “American” even while the USA is very close in size to Europe (and more than twice as large as the EU).

                                                                2. 1

                                                                  From reading history, I think the EU is akin to the United States before the Civil War (or even before WW2) where the primary allegiance was to the constituent state, not the federal government.

                                                                3. 1

                                                                  Great article, I hope there’s a follow-up article in which we get to know if the OOM problems definitely went away!

                                                                  I now also really want to read the guide that she links in the article on how to use pprof.

                                                                  PS: another possible optimization might be to use a very lean OS in the VM hosting the webservice (one of the BSDs?) so that in theory you could allocate even more memory to the webservice.

                                                                  1. 4

                                                                    I used to do most git operations directly from the command-line with git. But maybe around a year ago I discovered lazygit and it dramatically changed my git workflow. lazygit is a TUI.

                                                                    I now do the vast majority of git operations (i.e. merging, rebasing, changing commit messages, diffs between commits, staging hunks instead of whole files, and a very big etc.) with lazygit. As a neovim user I was doing almost everything from the command-line already, lazygit allows me to do more “complex” git operations much quicker.

                                                                    And to be honest, it has increased my git game substantially, I can now perform operations that I wasn’t even aware of before installing lazygit.

                                                                    1. 5

                                                                      Wow, the first thing in their readme is an Ad involving AI. Something tells me I’m not the target audience for this tool.

                                                                      1. 5

                                                                        As per c357284e1a1c1269eceee2b32c7dca4f1dd2f4d4 on their repo, Warp is sponsoring them. While I personally don’t have use for AI tooling in terminals, I think it’s worth recognizing that developers need to eat and pay their bills.

                                                                        Compared to doing like a freemium thing for lazygit, advertising on Warp is dramatically better imo. If they get some number of conversions that work into the ad budget, then it’s kind of a win for everyone.

                                                                        Here’s a selection of other projects that Warp sponsors:

                                                                        https://github.com/junegunn/fzf

                                                                        https://github.com/antonmedv/fx

                                                                        https://github.com/deployphp/deployer

                                                                        https://github.com/sharkdp/bat

                                                                        https://github.com/khulnasoft/lazydocker

                                                                        (Disclaimer - I absolutely don’t mean to argue that you are the target audience for the tool, I just had a similar reaction initially and this was my thought process for why I’m ultimately not as bothered by it.)

                                                                      2. 1

                                                                        What’s a cool thing you’ve learned from lazygit?

                                                                        1. 1

                                                                          It’s really nothing revolutionary.

                                                                          For example, I guess other people just know by heart the commands necessary to perform an interactive rebase. I haven’t learnt them, so I used to never perform any interactive rebases.

                                                                          An introductory video on lazygit showed me how easy this can be done with lazygit, so I started doing it with lazygit.

                                                                          The same applies to staging particular hunks of a file, among many other things. But as I said, it’s nothing revolutionary and if you are already a git advanced user, all this will sound pretty trivial.

                                                                          1. 2

                                                                            Yes but git has enough in it that almost everyone thinks they’re an advanced user. I’m always learning that there’s more to it.

                                                                      3. 2

                                                                        @simonw did you try reducing the screen time on the emails with the desired data? If so, how were the scraping results? I am interested on that particular question in order to know how careful one should be with the screen capture and to even further reduce the Gemini costs.

                                                                        1. 2

                                                                          I waited about 2 seconds on each email because I know that when Gemini first launched in February it treated videos as one frame per second sequence of images.

                                                                          I think they may have changed that now but I wasn’t sure if they had.

                                                                        2. 4

                                                                          From How to monetize a blog:

                                                                          The reward for clicks is much greater than it is for impressions, but that depends on someone actually interacting with an advertisement. Nobody has ever clicked on an advertisement on purpose.

                                                                          The text has a slight douglas-adamesque tone.

                                                                          1. 2

                                                                            Nobody has ever clicked on an advertisement on purpose.

                                                                            I run a non-profit news website, and this is an annoyance to me. We want people to see our donation box and feel vaguely guilty about reading the content without donating, but we don’t actually want to interrupt your reading by sending you to the donation site if you aren’t going to donate. However analytics show a lot of people apparently accidentally click the ad when trying to make it go away because the number of people on the donation page is too large compared to the number of donors. I’m not sure why this is, since the whole page is a click away zone that will close the ad, but I guess people are aiming for the X and miss. Maybe I should just move the X further away or make it bigger, but I can’t remove it entirely because you’d have even less clue about how to get rid of the ad.

                                                                            1. 7

                                                                              Don’t use an X.

                                                                              Make the bottom bar of the ad:

                                                                              [ I want to donate now ] [ I want to donate later ] [ No, thanks ]

                                                                              on the first choice, send them to the donate page. On the second choice, close the box and open one at the bottom of the page so they see it when they scroll all the way down. And on the third choice, just close the box.

                                                                              1. 1

                                                                                We use different ads at different times. That would require using the same template every time and I think people would still click wrong because no one reads anything.

                                                                                1. 1

                                                                                  OK, how about the even more “don’t use an X” method: embed the graphic for the ad in the main text flow, instead of popping up a toast. Instead of having to clear it, they can scroll past it.

                                                                                  1. 1

                                                                                    Oh believe me, we do that too. 😆

                                                                                    I don’t think we’re the worst website when it comes to annoying ads, but you can judge for yourself: https://www.spotlightpa.org

                                                                                    1. 1

                                                                                      With my standard adblocker in place, it’s smooth, laid out nicely, and shows a couple of “signup for the newsletter?” and one “would you like to donate?” in-line.

                                                                                      Completely unobjectionable.

                                                                                      1. 1

                                                                                        I’ve seen multiple news site developers get tripped up by their own ad blockers. 😆