HN user

mozey

367 karma

[ my public key: https://keybase.io/mozey; my proof: https://keybase.io/mozey/sigs/xSF9tMAMKCKz4u2waGjej5krzW2F1NYoUojccHAavIY ]

Posts1
Comments149
View on HN

What is the benefit of writing Go to generate HTML?

1. With go-app

  func (h *hello) Render() app.UI { 
    return app.Div().Body(app.Text(fmt.Sprintf("Hello %s", h.name))) 
  }
2. Compared to using templ
  templ Hello(name string) { 
    <div>Hello, { name }</div> 
  }
For me personally, the latter seems nicer

- I can see at a glance the structure of the HTML

- Completion on the HTML tags, attributes, etc

- Completion on CSS (TailwindCSS LSP for VSCode)

- Logic can still be shared with other types of UIs (e.g. CLI, Native Apps, Webkit, gRPC)

If what you want is option 1, isn't this solution incomplete. That is, the fully realised vision would be a native component / widgets API (e.g. Fyne, QT, GTK), and then generate HTML from the components?

However, "since Dagger Cloud is built as a PWA, it can be installed as a desktop or a mobile application. This makes it possible to launch Dagger Cloud like a native application and get a full-screen experience without needing to open a browser first, or just have a dedicated icon in your desktop taskbar/dock", so it sounds like the "Native App" is using a Webkit (e.g. Wails, Tauri, Electron)

Anyway, congrats on having commercial users building stuff with your project!

I'm working on a server/backend for htmx that's intended to run as a local service beside the browser. In theory you could do this with any server stack that is self host-able. My goal is to produce a single binary with no external service dependancies. I'm using Go, and a lot of the components are readily available, e.g. self updating local service, replicated database, etc. It's easy to cross-compile for different target OS and architectures. As an alternative to building everything into the browser, and assuming you're able to run a separate process, this approach makes a lot of sense to me. It would be great if Go had something similar to Deno's permission management though...

Been renovating an old house with a large garden for almost ten years now. I tell myself this is better than building something from scratch, but it definitely doesn't always feel more efficient. It helps that I didn't have the option back then, but now maybe I do? Sometimes it's also hard to tell, in the moment, which things to keep and what to rip out.

Touch typing is something I should've invested in much earlier, can't imagine how I ever coped without this ability. Another thing that really helped me is the "Alternative finger positioning" described here: https://typingsoft.com/typing.htm It feel much more natural not having to bend your wrists. Is anyone else also doing this? Whenever people ask me how to learn touch typing I look for native Linux or macOS app that teach this technique, but I haven't found any yet...

I applied for a UK visa from South-Africa about a year ago. To start my application I had to submit a form on this domain. The navigation to the form was obscured by a giant banner about the Ukraine invasion and a message about how service levels might be reduced due to refugees... no matter how I resized my browser window I couldn't get to the part of the page behind the banner. Eventually I opened up the Dev Tools and added some CSS to hide the banner. The link was revealed and I could continue with my application

Last time I checked it's not possible on iOS. On Android it's possible with some effort (e.g. you have to use Termux), not something you could expect a user to setup

Instead of wrapping the application with something like Electron, why not install as a service and connect to a localhost port using your default browser?

I know this is not the same UX as installing an app. But why isn't this technique more standard?

Besides more efficient resource usage, another benefit is that it keeps the client/server architecture.

dynamically loaded modules, error boundaries

In an MPA, modules https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid... can be included on the pages that require them with a script tag. Errors (and new features) are limited to a specific page, and the rest of the site remains unchanged.

suspense (or another form of components loading their own data)

The htmx lib https://htmx.org/ mostly takes care of this: "gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML". The hx-boost tag can also be used for progressive enhancement.

as soon as you need the bloat you’re just reinventing a wobbly wheel without one

When building a rich client, using a framework could be productive. For example a photo/video editor app. For a news site and CMS I would probably stick to the approach I've described above.

by wrapping a vanilla lib to a component or an action, you’ve essentially created basic Svelte version of that lib

This is the key to making framework churn go away. The DX of using vanilla JavaScript is getting better every day. And is a much better experience than it was a decade ago.

Islands architecture and partial hydration can help you render static HTML with just a small portion of JavaScript for those components who need it

I'm doing this with Hugo for rendering the static parts, and htmx for loading hydrated partials. The HATEOAS approach simplifies state management in the application. There is no client side "routing", just links and the back button.

In addition to vanilla libs, I include one "app.js" bundle. This file is created with esbuild and linted with deno. My "business logic" can be written in TypeScript in VSCode with the Deno extension and LSP server.

One thing this kind of pattern actually does is expose the conversation to more of YOUR psychology and perspectives. You expose it to more nerves to tickle, let’s say. Or in effect, you are giving the AI more of your brain’s surface area to work on

Conveying and interpreting "mood" correctly is the most difficult part of human to human conversation. It has a huge impact on how efficiently "the message" is communicated.

Go with PHP 3 years ago

The compilation step, and the resulting binary, is also very useful if you need to distribute your software. As opposed to creating a ZIP file.

There are tools for creating stand-alone executables from PHP source code, but they're not as nice to use, compared to languages that were designed for this. By distributing software I also mean making your latest code live in prod.

I suppose the benefit of using PHP (or other interpreted languages) is that it's easier to create "plugins", just copy the new source files to the server.

Modules are for organising your code, services are for organising processes on the OS, and micro-services are for organising teams of developers

I built an example that uses separate select tags for year, month, day, and time.

The benefits of doing this are:

- Standard elements that work everywhere

- Easy to refresh the available options after a date change

- Mimics the "rolodex" behaviour to quickly find any date/time

The libs I used are arbitrary, won't be hard to rewrite using only built-in Javascript, or any library / framework

https://www.mozey.co/demo/ts/examples/datepicker/

Not using a framework doesn't automatically imply everything is built from scratch. Maybe I prefer calling libraries, instead of plugging my code into a framework. I could also implement patterns using the batteries included features of the platform. For example Web Components on the frontend, or a REST API on the backend built using the standard Go "net/http" package

As a backend person that used to be a front end person, there has never been a better time for using VanillaJS (or TypeScript), HTML, and CSS?

someday pick one to learn in depth without worrying about it being replaced by the next hotness

So maybe the trick is to not use a framework. Like, I don't need a "framework" for backend dev, just a toolbox of good libraries.

The tooling around TypeScript is similar to a backend language like Go, a very different experience from writing JavaScript a decade ago

In reality, a cashless society is a type of enclosure, in which the only form of money in society becomes digital bank chips (a bit like being stuck in a network of casinos where you can no longer exit)

Quote from an interview with the author: "The State endorse a currency as a mean to pay taxes, but what ultimately gives money its power is the network effect: there is no opt out": https://www.ouishare.net/article/on-the-illusion-of-money-an...

The part about CBDCs is interesting: "The banking sector has been attacking the cash system for decades, but confidence in their Layer 2 chips depends on the public being able to redeem them for state money... In reality, Layer 1 CBDC has existed for decades, but it’s traditionally called ‘reserves’ and is only accessible to banks who use it between themselves"

"banks control the Layer 2 system, but see a future in which they might end up sandwiched by competition from a hypothetical Layer 1 CBDC and Layer 3 stablecoin systems (which admittedly plug into them). This is why banks are currently lobbying against CBDC to water it down (e.g. demanding limits upon its use), while demanding that stablecoins be regulated in the same way that banks are"

"The CBDC debate is really about whether access to digital state money should be extended to all of us"

Yeah, I used Bootstrap for a long time, and got used to how it works.

I wanted to like Tailwind, but it seems a bit disingenuous. It's like using inline style tags, just with shorter names.

From time to time I've made an effort to learn how CSS works, but after a while I forget the details. It's more productive if I can browse a catalogue of visual examples, with concise markup that is easy to copy and paste.

Bulma seems like the more "modern" take on Bootstrap: https://bulma.io/