function html(strings, ...values) {
let result = strings[0];
for (let i = 0; i < values.length; i++) {
result += escapeHtml(values[i]);
result += strings[i + 1];
}
return result;
}7,565 karma · joined August 19, 2011
www.gibney.org
function html(strings, ...values) {
let result = strings[0];
for (let i = 0; i < values.length; i++) {
result += escapeHtml(values[i]);
result += strings[i + 1];
}
return result;
}Well, for some definition of "manually".
If you have untrusted variables to interpolate, you can do
this.innerHTML = html`Hello ${name}!`
Where html is a function that escapes the variables.The arguments brought forward against web components all seem to fall under "But it does not contain every functionality you want to use out of the box". Personally, I don't think browsers should provide more and more functionality, but rather a good base to build upon.
Say we want to make an icon that when clicked shows how often it was clicked. The webcomponent code seens quite sane to me:
class HelloIcon extends HTMLElement {
connectedCallback() {
this.clickCount = 0;
this.innerHTML = `
<button class="icon">:)</button>
<dialog>
<p>Hello, I was clicked 0 times</p>
<button class="close">Close</button>
</dialog>
`;
const icon = this.querySelector('.icon');
const dialog = this.querySelector('dialog');
const closeBtn = this.querySelector('.close');
const dialogText = this.querySelector('p');
icon.addEventListener('click', () => {
this.clickCount++;
dialogText.textContent = `Hello, I was clicked ${this.clickCount} times`;
dialog.showModal();
});
closeBtn.addEventListener('click', () => dialog.close());
}
}
Try it here:https://plnkr.co/edit/0XUOLyM52xfFiIBu?open=index.html&previ...
give it a normal text prompt, and it
continues that prompt by searching
for the byte sequences that compress
best.
One moment, how are we supposed to know how well that search was done? There is no way to search a meaningful part of the search space.So the result only gives us some lower bound of how well gzip works as a "plausibility tester" of a continuation of a text. The space of possible sequences is many orders of magnitude larger than what was searched. So there might be sequences in there that compress much better.
The text mentions beamsearch, but I don't see a discussion about how well beamsearch performs in finding the global optima when it comes to gzip compressibility of a text?
For business profits to rise, people need
to to have disposable income
Does it matter, if the business pays employees who then use their salary to buy goods from the business or if the government collects taxes and uses that to pay for the goods? The government could also give the taxes to the people, so they have disposable income.Imagine an island with two people on it and there is one tree that grows apples. And every other day, one of the two people climbs the tree and picks apples so they both have something to eat. Then the next day, the other person owes to climb on the tree because they are in debt to the first person.
Now, let's say one day, one of them discovers, hey, we can just give the tree a kick and the apples fall down on their own!
With the perspective you are proposing, the other one would have to say: Oh my God, don't do it! We will be out of work and starve!
I think the flow of Chrome where the user has to select a file from disk and then acknowledge a prompt that the site will have access to that file until they close the window is fine. But if Mozilla wanted to protect users from themselves even more, they could make it as strong as they like. For example, by requiring to turn the functionality on in about:config.
Not giving the user the choice at all, if they want a cloud only browser or a browser that lets them work with local files is the wrong way.
In theory, as things get cheaper to produce, business profits should rise and governments should be able to raise more taxes. So the government then has more means to provide goods and services for free to people who need them.
window.showOpenFilePicker()
What Firefox supports is a "File System API" which creates something similar to the other old ways of storing data in a browser, like cookies and indexeddb. You cannot use it to edit normal files on your disk.This is my main gripe with Firefox. They force their users to either store everything in the cloud or go through the arcane "download" workflow where you have to manually save files.
With the File System Access API, webpages nowadays can read and write local files just like desktop applications:
https://developer.chrome.com/docs/capabilities/web-apis/file...
Try this text editor for example:
https://googlechromelabs.github.io/text-editor/
It works nicely on Desktop and Mobile.
In that regard AI fits the bill well. Because many of the AI related posts are about tools one can immediately tinker with.
While a new type of laptop cooling might become interesting once the laptops come out, the news is not as interesting to me as a new LLM or agent that I can experiment with right away.
Why not offer a simple form that humans and AI can use alike?
<form action=book_table>
<input type=date name=date>
<input type=time name=time>
<input type=number name=party_size>
<input type=submit value="Book table">
</form>It jumps to the newest story on the frontpage. And when I click the bookmarklet again (or press "n") it jumps to the next. So I just click it until I land on a story I have already seen and know I have seen them all.
If you want to use it, you can convert the code into a bookmarklet with my bookmarklet editor:
https://www.gibney.org/bookmarklet_editor
The bookmarklet:
if (!location.href.match('ycom'))
location.href='https://news.ycombinator.com';
doTheMagic = function() {
if (typeof e!=='undefined')
e.style.background='#c0c0c0';
e=Array.from(
document.querySelectorAll(
'.age a:not(.seen)')
).sort().at(-1);
e.style.background='#ff0';
e.classList.add('seen');
e.scrollIntoView({
behavior:"smooth",
block:"center",
inline:"nearest"
});
}
function addShortcuts() {
document.addEventListener("keydown", function(evnt) {
if (evnt.key === "n") doTheMagic();
});
}
function addStyle() {
let style = document.createElement('style');
style.type = 'text/css';
style.textContent = `
.noshow {
display: initial;
}
`;
document.head.appendChild(style);
}
if (typeof theMagicIsActive=='undefined') {
addShortcuts();
addStyle();
theMagicIsActive = true;
}
doTheMagic();And I expect that it will turn out Python is the most productive. As it is most easy to reason about. It allows for the most elegant expression of the idea behind a program.
The first tests I have seen seem to confirm this. One recent example:
One of my first web projects involved a music forum and I have been keeping the URLs alive for 24 years now:
https://www.gnoosic.com/discussion/
I feel like I owe it to the people who participated to keep it online forever. Also as a document of history.
Cabs are replaced something like 3x more often than privately owned cars. And when they run 24/7 because of self-driving, that factor will even increase.
Because a single autonomous vehicle operating in a shared
fleet can replace multiple privately owned cars, the
widespread adoption of this technology can’t help but
reduce new-car sales volumes.
The old "Thing will become more useful so we'll make less of it" argument. No mention of Jevons Paradox?If we can travel and send stuff around from point A to point B cheaply and instantly by dropping ourselves or an item into an ocean of cars roaming our streets autonomously, there is a lot more demand for rides.
Also comfortably traveling longer distances might alter where we live. If we can walk out the door, sit down in a comfortable robotaxi right away and exit in the city center 10 minutes later, we might not have to live right in the city center anymore. Another driver for more demand.
Have a sales tax on each product that corresponds to the toxicity of its components.
Exempt recycled materials from the tax so companies have an incentive to collect old parts and recycle them, preventing them from going to a landfill.
I wrote my own agent, and it sends data to LLMs in this order: "General Prompts (How to write good code)" + "The Code" + "The Feature Request". This means the KV cache will be used even when the feature request changes.
And output tokens are usually way less than the input tokens.
So I think that my approach is very lightweight on token usage compared to an interactive session.
It would be interesting to measure it for the other agents out there. Sending a feature request two times vs an interactive session.
In an interactive session, adding "Fine, but make the button red" after the model generated a first solution more than doubles the tokens used. As the model now not only gets the original code and the feature request but also the updated code plus the change request as input tokens.
Sending a feature request to an LLM and then sending the feature request again with "The button shall be red" only doubles the tokens used.
Personally, I already see LLMs and agents as blackboxes. I give each feature request to multiple LLMs and then compare the results. I don't manually use "sessions" at all. I just look at the outcome. When I dislike it, I "git reset --hard", change my prompts and restart the feature request.
To have an ongoing sense of which agents perform best, I keep a log and calculate an ELO score of which agents meet my demands best. This score is imporant to me, not so much how the agent achieves it.
In fact, I usually let multiple LLMs implement the same feature, and then I compare them. I even run my own arena in which I calculate Elo scores for LLMs from my perspective of which one implemented features better.
Having the ability to control code agents via voice would not take away my ability to do that. But I think in the future, that will become less and less necessary. If we look back at this conversation in five years, it will look very archaic, and we will be used to having superhuman AI do everything for us. In 10 years, it will sound like a strange idea that humans were once fiddling with code to improve the quality.
How would you detect the
presence of bugs in this
scenario?
I would ask AI. "Did the last commit introduce any bugs or unintended consequences?". In fact I already use this prompt after every change I make manually. How would you make sure the LLM
isn't adding yet another
useless, redundant function to
the code base?
By asking AI. In fact, I already run a long "Can you refactor anything in this codebase to reduce redundancy, improve readability, performance or maintainability" pretty regularly."It changed the plot function so it takes another parameter called linewidth. It also added an input field in the stylecontrols section where the user can ...".
you will be surrounded by an ecosystem of
devices, none of which stand alone, but are
more like portals to interact with your agents
I would be really happy with my phone + headphones as the device I use most. But only if I could use Gemini (or ChatGPT or Grok or any other chat agent) in voice mode and say "SSH into my GitHub Codespace soandso and implement feature soandso.". And it replies "Did it. I told copilot (or codex or whatever coding agent lives on that VM) to implement the feature".And then a minute later I could ask it "Is copilot done yet?" and it replies "No, looks like it is still working on it". And then a minute later I ask again. It replies "Yes, it finished. It changed chart.py and styles.css. Do you want me to tell you what specific changes it made to the files?".
But it looks like none of the chat agents with voice interface have such a connector at the moment? An SSH connector would be the most useful. But a "GitHub Codespace connector" or something like that would also do.
I wonder if that will be a missing piece for long. If so, I would build an agent with voice mode and ssh connector myself. But I guess it should come out from the big guys any moment now?
I can tick files in Vim, those get concatenated into a prompt. Along with a feature request. Plus an instructions file that tells the LLM how to reply. Plus my general "rules for good code" file, plus one "rules for good code" file per language involved, plus a project specific overview file. The LLM then answers with a list of changes it wants to make to the code. My tooling then applies those changes and I look at them via "git diff". If I like it, I commit. If not, I change one of the prompts and start the process again.
Instead of replying with code changes, the LLM can also decide to request more files. I wrote a little DSL for that.
I described the beginnings of this workflow last July:
https://www.gibney.org/prompt_coding
Feels like an eternity ago. I think I will write a new blog post this July and describe how the workflow has evolved over the past year.
You can’t import or require() a module
that only exists in memory.
You can convert it into a data url and import that, can't you?If there is no money to pay them, they should get shares in the company. So if their R&D is successful, they participate in the outcome.
You could put the example code on the filesystem of that VM too.