News for hackers. Stuff that matters.

malft

Re:Show HN: LLMs can generate valid JSON 100% of the time on Tuesday August 15, 2023 @02:20AM (#37130812)
Regex-constrained GPT, what is a mnemonic for pi?

> It's a word, a short statement or phrase which you learn.

Can you make a good one?

> Man, I wish I could recommend an answer. You're not gonna remember something, because, obviously, pi's so big. Actually, let's forget pi. There's only one way: Googling for it.

(count the letters)

Re:My first superoptimizer on Tuesday May 30, 2023 @03:01AM (#36121921)
If you are familiar with that paper, I'm a little confused by the results section. If I'm reading p01 from figure 7 correctly, the "before" is x&(x-1) and the "after" is a single instruction x&(x<<1). What am I doing wrong?

(The other two wins listed are "recognize the Hacker's Delight trick and replace it with the straight-forward implementation a human would write", which I like.)

Re:Using HDMI radio interference for high-speed data transfer on Tuesday February 28, 2023 @08:18AM (#34968929)
TMDS will reduce the number of crossings, but 10110110 will still have more crossings than 0.

It'll be some pseudo-random mapping, not "greyscale", but it'll still be readable.

Look up the wikipedia page for 'ECB mode' for a nice illustration.

Re:Lenses on Monday June 27, 2022 @03:43AM (#31891671)
The type looks a little insane, but it's just a combination of three mundane hacks that also exist in other languages.

The first: If you need a serializer/deserializer in a simple language like old-school Java, you can either write two methods for each class, or you can combine them into one method like this:

class HoveringSkull inmplements Streamable { String desc; float height; void stream(Stream c) { desc = c.stream(desc); height = c.stream(height); }

... and have two different implementations of Streamable. That's what the choice of (pro-)functor instance does -- you can swap out the implementation to get 'read' and 'write' (and 'deepClone' and 'equals' and 'hashCode' and 'defaultGui' and 'treeMatch' and ...)

Re:You don't need that CORS request on Monday January 03, 2022 @01:37AM (#29778020)
Before you start rearchitecting your app, be sure to check if the only reason you're seeing preflights on GET is that someone added a dumb X-Requested-By header.

(You can even do POSTs without preflight if you use a whitelisted content-type.)

Re:Microsoft_craziness.h (2018) on Wednesday November 24, 2021 @12:39PM (#29332689)
'by a char or two', they said.
Re:Microsoft_craziness.h (2018) on Wednesday November 24, 2021 @12:32PM (#29332597)
Pray tell, what is the size of a wchar_t on your system?
Re:Microsoft_craziness.h (2018) on Wednesday November 24, 2021 @10:12AM (#29330711)
wchar_t *value = (wchar_t *)malloc(length);

// The documentation says that if the string for some reason was not stored with zero-termination, we need to manually terminate it. Sigh!

if (value[length]) { value[length+1] = 0; }

Re:The Facebook Logout – We're over Facebook on Thursday October 07, 2021 @11:53AM (#28787950)
Isn't that how fundraising works? You make people commit to "supporting your cause" with a trivial pledge, so that when you ask for actual money they can't back out without losing face.

"I will maybe log off at some point" sounds like maybe too weak a pledge to me, but I'm sure they've focus grouped the shit out this.

Java has all the security logic INSIDE THE VM.

That's the big difference.

Re:Q1K3 - An homage to Quake in 13kb of JavaScript on Tuesday September 14, 2021 @04:36AM (#28521902)
"You can't compress noise." Well, humans can't tell the difference between two snippets of white noise.

It'll be fun. Remember jbig? (can't find the source, but iirc "most of what we're sending is text, so our fax can detect identical characters and reuse them! genius! [ten years and several bonuses later] um boss, our fax swapped a few ... 'identical' ... digits in someone's legal documents, so you have to appear in court now. also their entire scanned document archive is potentially corrupted and they may want damages")

I guess the 'no photos on the internet' people will have the last laugh; they won't be the ones seen criming in the background of someone else's blurry holiday photo.

Re:Lunatic is an Erlang-inspired runtime for WebAssembly on Saturday July 31, 2021 @04:14AM (#28016363)
Yes, that's the point. If you need to parse a JPEG, you spawn a VM to do so. It is allowed to use n seconds of CPU, k bytes of memory, and send a bitmap back to the caller.

(Sure, you could screw it up if the caller accepts a negative-size bitmap and corrupts its heap. Lets assume that process is written in a memory-safe language.)

Re:The P-versus-NP Page (2016) on Wednesday July 21, 2021 @08:16AM (#27905259)
Why are the examples for P≟NP always so bad? "Solving TSP", "planning airlines better", "get the $1M bounty"?

Why not SAT? There's a $200,000 bounty paid out every ten minutes for solutions to a well-known SAT problem.

Or crypto. Math. Chess.

Re:Neil Armstrong's reply to a Moon landing skeptic on Friday June 19, 2020 @03:22AM (#23571945)
I assume it was flagged because unless you're already a true believer, "look! this falling building is falling according to the laws of physics" is not a very strong argument.
Re:You-Dont-Need-Lodash-Underscore on Friday August 09, 2019 @01:32PM (#20656508)
The very first code snippet is a reimplementation of 'chunk' that is at least quadratic. Run away.
This sentence sums up the paper:

"Turing machines can only compute what can be modelled mathematically, and since we cannot model human dialogues mathematically, it follows that Turing machines cannot pass the Turing test."

Re:RSA-230 has been factored on Thursday August 23, 2018 @10:54AM (#17827741)
It's very rare for something to scale sublinearly in the number of bits :-)

complexity(2∗∗1024)/complexity(2∗∗762) comes out to about 1500x more work.

Re:JDK 10 Early Access Release Notes on Saturday February 24, 2018 @02:34PM (#16454853)
> The clear passwords present in jmxremote.password file will now be over-written by their SHA3-512 hash by the JMX agent

I must be misreading this. As far as I can tell the ability to read the new format was added in the same version. Did someone forget about forwards compatibility in the jvm?

Re:The root of all eval on Sunday April 23, 2017 @02:35PM (#14179606)
"It's just a normal function." No, it has magical access to the lexical scope.
Secure payments? If you hook up a display to the secure enclave, suddenly it's really expensive for malware to steal your money.

(Sorry, replied to the wrong comment and apparently can't delete now?)

They're allowed to ask "does anything on this system handle yelp:// URLs?".
Your mental superpowers are caused by a rare mutation shared with 40% of all people?
Re:Do not let your CDN betray you: Use Subresource Integrity on Sunday October 04, 2015 @10:17AM (#10327557)
You get slightly more power in that you can post malformed multipart stuff.
Re:Do not let your CDN betray you: Use Subresource Integrity on Thursday October 01, 2015 @09:57AM (#10311126)
An extra header.
Re:Ask HN: Facebook clickjacking – is it detectable? on Tuesday September 15, 2015 @09:05AM (#10220382)
getComputedStyle() doesn't work across iframes.
Re:37 rental cars – 2 days – 185,000 miles earned on Monday September 14, 2015 @04:31PM (#10217285)
It would remove the incentive for employees to pay $2k of company money to get $100 worth of (personal) free stuff.
Re:Resource Hints for Modern Browsers on Thursday September 10, 2015 @01:46PM (#10199442)
How does preconnect crossorigin=anonymous differ from a regular preconnect? (I'm guessing some http2 thing?)
Awesome! More of this. My competitors making suboptimal decisions based on immaturity or prudishness is free money.
A book in a library, perhaps?
Re:Things which aren't magic – JSONP on Saturday April 18, 2015 @06:10PM (#9401273)
Now run two fetches at the same time, and watch it get the data mysteriously mixed up 0.1% of the time.

Older »