• 3 Posts
  • 819 Comments
Joined 2 years ago
cake
Cake day: September 24th, 2023

help-circle
  • I think Fusion 360 defaults to direct modelling which may be easier for beginners. FreeCAD uses parametric modelling which is more powerful and easier to use, but probably a bit confusing if you aren’t expecting it.

    Also Fusion360 is commercial software that has had lots and lots of UX effort put into it. FreeCAD hasn’t. Until FreeCAD 1.0 I would say it had pretty awful UX, even for someone already familiar with parametric CAD.

    With FreeCAD 1.0 it’s quite good and usable for people with experience in parametric CAD (mostly) but it definitely doesn’t hold your hand and I wouldn’t expect a beginner to be able to design a part easily first time.










  • So, Windows has fully optimal behaviour here:

    If you click on an area of the window that cannot be dragged from, it raises it on mouse-down.

    If you click on an area of the window that can be dragged on, it doesn’t raise if you start a drag, otherwise it raises it on mouse-up.

    That’s the desired behaviour. I agree people didn’t really explain that clearly.

    I haven’t looked into it for over 20 years but as I recall it is impossible to do this with X11. I have no idea if Wayland added some kind of support for this, but I would be quite surprised given how long it took them to do screenshots.

    Part of the difficulty is that you need to somehow query an app on mouse-down if it might start a drag. I have no idea how Windows does that… but… they solved it decades ago.




  • The linked patch actually explains it really well.

    If you want two processes to communicate (IPC) normally, you would set up some shared memory, so that in each process’s virtual memory some pages are shared between them both, so when process A writes to that memory it is visible to process B and vice versa. There are other ways to do IPC but this is the fastest since it doesn’t involve any syscalls (context switch to the kernel which is slow).

    However it still requires each process to copy its private data into and out of the shared memory. Also it still requires a context switch from process A to process B.

    A common use of IPC is for RPC (Remote Procedure Calls). Basically you want to run a function in the other process. This solution does that but differently and faster.

    1. First, both processes share the same virtual memory. This is normally a recipe for disaster since it completely destroys the normal process memory sandboxing (a memory error in one process can now crash the other one!). However they use a new Intel MPK hardware feature that allows splitting the pages into one of 16 groups (“keys”), and you can control read/write access to each group independently.

    2. Next when process A wants to call a function in process B, the RPAL code does a lightweight context switch in user space. I guess this just means changing the MPK key, and normal saving of registers for the function call. I’m not sure what else you’d need to change. It’s a little unclear about how you pass heap data from process A to process B. I guess both processes just have read access to the entire address space? That doesn’t really change the security model on Unix since any process can already debug any other process with no extra permissions.

    It sounds very similar to running two processes as if they were threads in the same process. Why not just use threads? Probably a better option if you can, but I guess if you are e.g. running processes written in different languages that might be tricky?





  • Nah AI can be extremely useful for learning technologies. You just need to be careful to verify they aren’t bullshitting you.

    For example find an explanation of PPM compression that is concrete and simple. As far as I can tell it doesn’t exist.

    But I could ask ChatGPT and it told me how it works (probably) in just a few seconds. I haven’t verified yet (at a BBQ) whether it is the correct algorithm but it’s certainly a plausible one that would work.

    It told me that you use a trie (typically) of symbol prefixes to record the probability of the following symbols, so for example you know that for the prefix “Th” the probability of “e” is 90%. Then you encode the symbol with arithmetic coding using the modelled probabilities. Apparently the typical max context length is 4-6.

    That would have taken me hours to find by reading code and ancient papers but I can verify it a lot quicker.