Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

I use Firefox for the same reason, especially that, thanks to tab containers, I can be logged in in one tab and out in another.

Linking your browser login to online services is incredibly invasive.


Regarding tab containers: last I tried them there was no way to clear cookies in a container. Is this still the case?


Still the case.

The features is no used enought, people don't know about it, and because of that, there is no pressure to improve it.

E.G: the "forget this site" button will remove all cookies, local storage, cache, etc. for one site. Very handy, because I don't want to bust my entire cache every time. But it will remove them for all containers, which sometimes is not what you need.


Thanks. Ironically, this also means that chrome has more visible support for tab-containering, with its clear support for simultaneous windows with different profiles. Can I do the same in Firefox?


About:profiles is what you are looking for.


This is a messy workaround, but I just delete the container and create a new one with the same name.


I can think of 3 main use cases for them:

- databases

- file systems

- hash maps

The first 2 are not something you code everyday, so if you go for that, installing a dep doing it is not a problem.

The last is usually included in all languages.

Why would you need them available in all languages for?


They're very good all around structures when you want to store anything. i.e. good for any container; just requires an orderable key (or one that can support `contains` and then use a GiST). If the key is orderable then you can iterate over spans with better cache locality.

I think they're only used for databases and file systems because those are cases where people actually bother to write them since they care about performance. If they were in the stdlib then they'd be used for many more things.


I get the point, but I rarely find myself in the case I even need an _ordered_ hash map. Despite the fact my language provide one by default.

I can't remember one time in the last decade where I was in need of a _sorted_ hash map.

And if it ever happen I can easily depend install one.

I'm unsure of having something even more general like a b+tree would help.

It's possible that, because I'm not use to have them handy, I don't think about them when I encounter a problem for which they would be perfect.

But I never felt like I missed them.

Can you give me a few examples of problems you them for in the past year?

Was that with a high or low level language?


Let's get all the records from 2020-06-28T10:00:00.000Z to 2020-06-29T09:59:59.999Z and sum the quantity field. Or anywhere you would want to group_by. Or anywhere you might use something like an RDD that partitions the data to compute something for each chunk of data (in parallel) (also after a group_by).

Also, sparse vectors. You don't have a value to store for each index so you use a BTreeMap. I've done this using sentinel values in an array, but that's gross depending on how sparse and how large the vector is.

In Python I would just use a Dataframe (pandas), but in Rust I would use BTreeMap. I wouldn't wish for all languages to have a dataframe type in them since they're such complicated beasts with tricky APIs (pandas and R are such acquired tastes) so I think people can get quite far with B(+)Trees. So that's what I wish was in every stdlib.


I don't know, wouldn't dumping the data into a db easier? If it fits on sqlite, you already have a solution in most languages to this problem.

Technically you would be using a btree, but a higher level interface, like with a fs or hashmap. Which is kinda my point.

I dont say it's not a good DS, but having it in all languages stdlib seems overkill given the tool we have today.

I'm a python guy, and even without panda it has the heapq module which is a b-tree, yet I never really got a reason to use it.


Heapq is a priority queue implemented on a binary tree; not a btree.

> I dont say it's not a good DS, but having it in all languages stdlib seems overkill given the tool we have today.

C++ has map and Java has TreeMap. These are both red black trees (which are equivalent to btrees where k=4). So there's no question of whether there are ordered mapping types in these languages. IMO they'd be better as b(+)rees with a wider fanout. That's all.


Keep in mind you should still use a venv with docker, this removes the need for sudo and won't conflict with the image system python if it has one.


For the longest time I thought the standard was to install stuff on Docker as root and not worry about typical permission/user idioms you'd practice on a classic box.

But now I am seeing more of this. Do you have any good links to read more about why using venv/non-root makes sense for Docker?


In my case, I think Docker voids the need for virtualenv. But a quick google search returns interesting results [1]

I do know setting up a proper user in Docker is just a couple lines away in a Dockerfile (As a matter of fact, I did that for the main app I develop).

For my other use cases, I just don't care. I'm using Docker to quickly bootstrap a Jupyter Labs environment, and I do that by sharing some confs (Like the Pip cache folder).

The caveat to this is that files I create are owned by root, but that again is just a command away for fixing (If I need it, that haven't yet).

[1] https://stackoverflow.com/questions/27017715/does-virtualenv...


Don't have a link at hand, but main reasons out of my head:

- exploits for breaking out of the container are easier to pull off if you have root access

- if the image has a system python, installing with sudo will install things in the system site-packages directory, which can cause a lot of troubles


> Also there is the idea that such an infastructure would scare criminals into not doing incriminating things.

Even if the criminals were afraid of the repercussion of their actions, and were aware of the system to catch them and be convinced it will work and would lead to their capture (that's already a LOT of if), this would only work on premeditated crimes, which is a minority of the ones commited in the street.

A lot of crimes are not though in advance, but done on the moment. People fighting because they are angry. Somebody stealing because they saw an opportunity.

We hear a lot about recurring pick pockets, or bank heists. But those are not the majority.

Most bad things in the street happen without being planned, and without consideration for the consequences.

Planned crimes are white colar crimes, and they don't get caught by cameras.


You also have to have a political system that can incriminate people caught on camera, for ex: (2019) https://www.google.com/amp/s/www.latimes.com/california/stor...

I still think it makes a big difference. I spent time in China and honestly I felt safer in areas where terrorists were a concern than I do in downtown SF.


Communication around birth control and abortion comes to mind.

You can always pretend we are right about this and those who are offended are biggots, but then you would make your parent's point.


I interpret it as "I didn't think about it, picked the first thing that worked in the past, and don't wish to make an argument about it, so let it go".


Sometimes, being a total outsider will see things other people cannot.


> But we shouldn't do that.

The average human sucks at understanding probabilities.

Until we can prove that most people handling this system are capabable of smart decision making, which the latest police scandals do not lead to believe right now, those systems should not be used.


> Unix piping is basically functional programming

Except you litterally use side effects to communicate. Not really FP, that part.


How so? While programs themselves could have side effects, the pipe -- if its elements are deterministic which is indeed not true of everything -- is just a series of composed transformations of text.

In a pipeline like

seq 100 | number | grep '[a-z]' | sort | tr -d '.' | tr a-z A-Z

every component is a pure function (byte strings -> byte strings) and the pipeline's results are totally deterministic [if you don't change the locale or collation order with environment variables]. No component of the pipeline makes any change to the filesystem¹.

¹ although both stat(2) and inotify(7) mechanisms could allow other processes to detect the interactions with the filesystem that are caused by running the pipeline, among other process-related mechanisms that system as a whole could use to detect how many times the pipeline has been run, so Unix itself is definitely not side-effect-free for almost any operation


> [if you don't change the locale or collation order with environment variables]

Or any other state change.

Because it's not stateless.

Hence not FP.


Most of those changes might be seen as akin to going in to your Haskell interpreter and changing definitions in the standard library or something. (Environment variable changes are weird because they are so local and ephemeral, but you still have to do them deliberately.)

Clearly not all command lines you can type in the shell are stateless (reading the disk, network, stdin, clock, or system RNG, among other things, isn't, and none of those things are rare or hard to do) and the shell doesn't specifically encourage you to write stateless code and it doesn't have a formal way to verify whether or not a particular command like is stateless or not. All of these properties are pretty similar to most popular FP language interpreters except for the last two. I guess it is a relevant distinction that your FP interpreter would typically know (as a matter of static inference) whether an expression is stateless, while your shell would typically not know.


Unless you use some stateful program or you're writing to a file typically a unix expression that uses purely reads and pipes is deterministic meaning you run the same expression twice you get the same result.

If you want to get pedantic fine, but the majority of use cases is stateless.


It's kind of an interesting pattern to think of having the pipeline as a whole be purely deterministic, but its initial input be something from the environment (kind of like the Haskell IO monad, right?).

Probably most complex shell pipelines follow this pattern in practice, but the first counterexample I thought of was shuf, or sort -R. Also, many pipelines that include any kind of interpolation or variable substitution also don't follow it.

A different insight about reasoning about pipelines might be that the byte string (or ASCII string) type is too weak to catch most kinds of errors, and it's not uncommon for one pipeline component to not, in fact, be a total function with respect to the actual data type that you're trying to capture (I don't know the right terminology for this). This most famously happens when you do regular expression substitutions but your regular expression doesn't actually match the full grammar that you're looking for. Then the pipeline can be incorrect as a whole for some inputs, but earlier and later stages don't notice. It can also happen anywhere that different tools have a different implicit understanding of the relevant grammar or structure.

That connects up with all sorts of other ideas which are actually about type safety and parsing more than FP. For example, PowerShell has tried to take the pipeline concept in a different direction, to the consternation of us Unix purists. Its use of typed objects in this context makes more explicit what the contract between programs in the pipeline is supposed to be. There is also a LANGSEC connection in terms of the risks of informal or underspecified parsers and grammars.

I know I've personally written lots of Unix pipelines that were correct for all the inputs that I personally threw at them, but definitely not correct for every possible input. I like to use ! in vim frequently to shell out to a command line to perform a text editing task, and vim has an associated undo and redo which means that sometimes I'm trying several variants until I find the one that successfully appears to do the edit that I intended. Sometimes I do this at an almost preconscious level, which is really strange in terms of thinking about the concept of the correctness of a program (in this case, where the program is literally only going to be used once, with the programmer looking over its shoulder).


Haskell hates side effects, but not functional programming. FP has been fine with side effects for decades - even SML, the precursor the Haskell, has them, although forwned upon.


"Companies just cannot be trusted with x" has been repeated and repeated for the last decades.

I think the conclusion is "Companies just cannot be trusted". At all. With anything.

We should assume guilty unless proven overthise for companies. They should go out of their way to show us their good will.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: