News for hackers. Stuff that matters.

TooCreative

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @12:06PM (#24607669)
For that to work, you have to import those explicitly:

    use something\Http;
    use something\Http\Method;
    use something\Http\URL;
    $body = Http::request(Method.GET, URL.Parse('https://example.com'))->body;
Now you have a bunch of lines instead of one. And have "Method" and "URL" in your current scope.

And all of that instead of this beauty:

    $body = Http:request('GET', 'https://example.com')['body'];
There is a certain quality to making the world more poetic. I like it.
I can very well see similar statements in 20 years:

"Not surprising considering that the vast majority of people just use robo taxis now. The ICE manufacturers did just fine in the transition to EVs. It was the transition to self-driving they lost out in."

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @11:10AM (#24607190)
And now instead of

    $body = Http::request('GET', 'https://example.com')['body'];
You have to do this?

    $body = Http::request(new Method('GET'), new URL('https://example.com'))->body;
And you have cuttered the global namespace with "Method", "URL" and "Option"?
Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @11:01AM (#24607125)
For the example I took a random line from Symfony and shortened it a bit:

https://github.com/symfony/http-client/blob/master/HttpClien...

You are free to link to some other example.

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @10:58AM (#24607104)
For the example I simply took to a random, recently updated file from Symfony:

https://github.com/symfony/http-client/blob/master/HttpClien...

And shortened it a bit. In the real example, as you can see, there are even more parameters, making it even harder to read.

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @10:54AM (#24607068)
That is just another piece of metadata. But it does not help either. Now you know you get an array of strings. But you still don't know what is inside of the strings.

It might be ['headers'=>'...','body'=>'...' ] or ['status'=>'...','response'=>'...'] or god knows what.

And you are back to reading the function body.

Attempts at facial reconstruction? What does this mean?
Nikon's market cap is down 90% since the 2000s.

I think with Canon it is similar - I can't find a long term chart right now though.

Easier when you know how. It might be easier to cook dinner then to write a web app. But not for me :)

Might be easier to build a digital camera then a film camera. But where is Polaroid now? Kodak also did not fare well in the transition to digital.

It is certainly easier to run an online marketplace then a gazillion stores you have to restock everyday, right? Yet, Walmart has a hard time in the ecommerce landgrap.

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @08:16AM (#24606072)
Wishful thinking.

You know it returns an array, but you don't know what the array contains. So you don't know how to use it.

You still need to look into the code to see what it returns. Then you will see that it returns an array and what the array contains.

And now you had to process the information that it returns an array twice. Once in the function definition and once in the function body.

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @07:26AM (#24605838)
Compare this:

    private static function request(?string $method, ?string $url, array $options): array
    {
        ...
    }
To this:

    function request($method, $url, $options)
    {
        ...
    }
I can grasp the latter much better. It immediately forms a structure in my head that I will remember while I read other parts of the code. To do the same with the former, I think my brain uses up twice the energy or more. And even then, I will not have such a good grasp on it as with the former.
Which symptoms did you have and what is the underlying cause?

I have a slight chronic sinusitis and I am currently trying a corticosteroid spray too.

Studies seem to say it works against chronic sinusitus. I am not sure how though.

Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @04:49AM (#24605200)
That might be a matter of personal taste. How ones brain is wired. For me, types make code less expressive. I can grasp the structure of a piece of code the easier, the less meta data there is on top of the algorithmic structure.
Re:Things I Was Wrong About: Types on Sunday September 27, 2020 @04:30AM (#24605124)
I code without types. My "proof", that types do not pay for themselves goes like this:

Every time I encounter a bug (during coding, testing or in production) I make a note what type of bug it was and how it could have been prevented.

Types are way down on the list of what could have prevented the bug. Especially for production bugs, which are the most important of course. It is so rare, that a bug could have prevented by types that I can say with confidence that they would have been a net negative.

Talking about which tool can prevent the most bugs, integration tests win by a large margin.

The reason is that most bugs are conceptual. Like "Oh shit! We have allowed people to tag items as duplicates of other items. And we have a function that traverses the list up to the original item. But now this new feature over there had a bug where it marks the last original as a duplicate of another duplicate and then when the traversal function in that other module is used, it ends up in an infinite loop".

Another example of a popular bug category: The code contains assumptions about the environment that do not hold true. For example PHP's mb_strtolower() will not always create the same string as MySQL's LOWER(). It is very rare and only holds true for a tiny tiny fraction of the UTF-8 characters. So you might expect them to behave the same until you one day trip over one of those few chars.

Rent and real estate are artificially low because of rent control. In a free market, the value decrease of money would be more visible compared to these assets.

Calling the prise increase in equities a "bull market" does not change the fact that the prise increased.

    If things were really different over the
    past decade than any other
I did not state that. I only stated that FED-money doubled in 2010-2020 and the value of money halfed.

I said nothing about any other decade.

Maybe the same happened in 2000-2010 or any other decade, maybe not. It is not part of my statement.

    2010, when you say the fed
    started printing money
I did not say the FED started printing money in 2010. I said nothing about the time before 2010 or about the future.

Your argument would have been much more precise and useful if you focussed on the same timeframe as I did: 2010-2020. Mixing it with the time before and what you read in the charts for the future muddled it to a degree that I find it hard to reply.

Over the last 10 years, the FED has more then doubled the amount of money they have out in the market. Other central banks have done the same.

Despite popular belief, the value of money decreased by about 50% during this time. It is not easy to say if this is a coincidence. But it looks a lot like there is causality at play.

The reason why inflation "officially" is lower then what one would expect given the amount of money printed lies in the way it is calculated.

The calculation includes mostly goods and services bought by people who live from hand to mouth. Not the goods and services bought by people with savings and high income.

Rent and real estate in desireable areas, gold, bitcoin, equities - all of these now require significantly more money to buy then they did in 2010. People who saved money lost about 50% of their buying power to inflation.

Re:Show HN: SlowTube – Learn songs by ear by slowing them down on Wednesday October 30, 2019 @10:11AM (#21397910)
Interesting. Just tried PaulStretch.

While it sounds more "logical" without the strange micro-repeats, it takes all of the punch out of the music.

On youtube, at x0.25 a drum hit goes from KABOUM! to something like:

KAKAKABOBOBOBUMUMUM

While with PaulStretch, it goes to something like:

FFHHAHAHCHCHOHUHMHH

No kick, no pressure behind the lower frequencies anymore.

It sounds like it is far far in the distance.

Re:Show HN: SlowTube – Learn songs by ear by slowing them down on Wednesday October 30, 2019 @05:32AM (#21395893)
Trying it now. At 0.3x it also has these weird ripples in the sound as if it just loops very short sequences.

There must be a better way!

This is cool. But the name is a bit misleading. I have the same 0.25x - 2x speed range on Youtube anyhow. What it adds is the looping capability. So this is rather LoopTube then SlowTube.

By the way: It would be nice if something like this would be available with better sound quality for slow speeds. I am now half way through listening to this at 0.25:

https://www.youtube.com/watch?v=LjjfSESoC4s

With better sound quality this would be pretty epic ...

Why does this come up in 2019 for the first time?

How did Newspapers, Radio and then TV handle this for the past 1200 years?

Re:Panopticlick on Sunday October 27, 2019 @02:23PM (#21371480)
Aha, it is in navigator.platform!

There is even more stuff in navigator, that should not be accessible to the website. For example how much ram my machine has in navigator.deviceMemory, how many cpu cores in navigator.hardwareConcurrency and so on.

Re:Panopticlick on Sunday October 27, 2019 @02:00PM (#21371317)
"17.63 bits of identifying information" for me.

Strange, that they do not make use of the fact that browsers leak your local ip:

https://browserleaks.com/webrtc

This is one of the most glaring privacy holes build right into the browsers.

On the other hand, I am surprised they correctly identify my "platform" as "Linux x86_64". Even though I used a windows user agent. How do they do that?

Also: What does the "Share on Google+" button do? It prompts me to log into Google. What would happen if I do?

Re:PDC 1996 Keynote with Bob Muglia and Steve Jobs [video] on Sunday October 27, 2019 @07:58AM (#21369168)
Displays with wrong aspect ratio for me. Which makes Steve Jobs look pretty fat.

On YouTube, it has the correct aspect ratio:

https://www.youtube.com/watch?v=DmCu97u35Ek

How do we find the car of the uploader?

Relevant XKCD: https://xkcd.com/1187/

Some perspective on the presentation:

At 13:20 or so, Jobs says "Of course you need a compiler, because a scripting language would be too slow for the server if it is used by a lot of users". Little did he know ... PHP was out for about a year when this presentation was given. Still lives today and powers most of the web.

Re:Facebook crawls links in PDFs you send in Messenger on Saturday October 26, 2019 @01:02PM (#21364809)
e2e would not necessarily stop it. Since FB controls the apps that send and receive the message, they can do whatever they want to the unencrypted message on both sides.
Aren't humans single-use too?

Older »