mg
Joined 15 years ago
Joined 15 years ago
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.
www.gibney.org