libera/#commonlisp - IRC Chatlog
Search
11:01:04
hamza
1 thing is that divisor-count is MUCCCH faster now especially for even numbers, but p12 takes the same amount of time even after timing I know, kind of premature optimization
11:02:05
hamza
Running it, I ccouldn't get an answer under a minute or even after a minute lol so uhhhh probably need to change algo
11:02:53
zest
ogamita: thanks guess I'll go with streams since the protocol I'll use will do file transfers...
11:05:47
zest
hamza: A list wouldn't work, you need a hash-table since a hash-table's efficiency doesn't worsen with size
11:06:28
zest
hamza: I think if you wanted to, you could make a version of p12 that's 3 lines if you used pure recursion
11:23:50
beach
With every new candiate prime, you need to test all previously computed primes to see whether one is a factor.
11:24:21
beach
And it is best to do that from the smallest one, so that you are more likely to hit a factor and decide the candidate is not a prime.
11:27:02
beach
zest: You wouldn't attempt to access the already computed primes in some random order, so a list is just fine.
11:30:12
beach
Oh, maybe I didn't read very carefully. The task was not to implement the sieve, was it? Sorry!
11:30:28
hamza
wait so now that i got the divisors that are primes, now for every prime divisor i found i should go through the list and multiply by each one? and repeat that?
11:58:52
hamza
Actually divisor-count is MUCCHHH faster, However, again, it isn't able to catch all primes
12:02:55
hamza
Here is what I got, I could obviously optimize this ALOT but it doesn't need it getting the divisors of a really large number is sub millisecond
12:26:21
hamza
lol, I kept looking for faster divisor algorithm and they all decieved me because they calculated from 1 to sqrt of n but that missed some numbers!
12:27:10
hamza
I didn't realise that each of the numbers uptill sqrt n, n came in each one of those number's table
12:30:35
zest
loop exists for a reason and that is to stop people like write me from writing recursion functions
12:31:06
hamza
srsly, in the middle after learning haskell i wanted to write everything in recursive functions, turns out that's not always the best ;)
12:32:39
hamza
Uh the entire problem wasn't able to finish even after 1 and a half minute, so there is that. But here, I get the answer in .703 seconds
16:01:09
gilberth
piethesailor: Have you verified that xwd works? I mean, this puzzles me as the only cause for a Match error according to the protocol spec is that the rectangle asked for is not viewable (and thus not really present).
16:04:56
gilberth
Hence I suspect the X server being funny. And: Is it really XLIB:GET-IMAGE causing this error? First thing after you opened the display, please say (setf (xlib:display-after-function dpy) #'xlib:display-finish-output) to make requests synchronous. That's not recommended in general, but aids debugging.
17:03:44
piethesailor
xwd isnt on my machine, or at least in terminal: $ xwd returns xwd: command not found
17:06:23
Nilby
piethesailor: It turns out x11 apps can't do screenshots with X protocol when running under wayland.
17:08:43
Nilby
It exists but it always get that error. Apps like gimp and obs had to be fix to do screen capture under wayland.
17:08:55
piethesailor
hmm, so I suppose my issue is that I am running wayland and that my x11 applications are running under Xwayland?
17:09:54
splittist
People might take pictures of videos, and then what is the point of all that vital CD anti-copying technology?
17:16:40
Nilby
The problem is that in wayland you have to do everything yourself, unless you're using a big toolkit like gtk or qt.
17:38:44
gilberth
The whole story is quite sad IMHO. And you see beginnings of that with the RENDER extension. With that you're also on your own, all RENDER can do is drawing triangles and blittering. So you need to turn your shapes you want to draw into triangles and raster your fonts on your own. I really don't like that idea. I mean, why isn't Cairo with the server? And why isn't font rendering happening at the server?
17:39:13
Nilby
piethesailor: it's even worse because the window system should probably be a glorified pixel shader, but the hardware is proprietary
17:39:30
gilberth
So, when you're on your own and that is modern, moving to a mere blittering protocol and thus Wayland appears to be logical next step.
17:45:16
piethesailor
Is there any kind of answer to this? I suppose there might at least be a linux distro that is just doubling down on staying with Xorg?
17:46:04
gilberth
The original argument for moving to "you're on your own" was that transferring font metrics from the server to the client increases application start-up time. Funny however is that when I want to send you a PS or PDF file, I don't need to ask you for your font metrics first. Magic?
17:48:33
Nilby
gilberth: As you may know, of the "magic" is the font must be embedded, or identical to the server or it renders improperly.
17:50:51
gilberth
Yes, and that is no problem. DVI files e.g. embed a checksum. The client could say "I want to use Times.ttf checksum 269926926 as my font" The server then could check, whether it has that font. In 99% of the cases it already has it. If not, it could ask the client "Please send me a copy of font checksum 269926926". Could also work with a third party in the mix. Both client and server could communicate with a font server, so ...
17:52:06
gilberth
In most cases, no fonts need to be transferred as you always use the same fonts for your Emacs, your shell, and whatnot and thus server and client would already have a copy.
17:52:14
Nilby
Yes, it could be worked out much better. Ancient dvi and tex pdf files always see to render fine.
17:53:24
gilberth
With DVI it is pure luck. The DVI files don't even include metrics, which are needed to at least place glyphs correctly. I just named it as an example where checksums are used to identify a version of a particular font.
17:54:12
gilberth
With PDF you either use one of the default fonts Times, Helvetica, Courier, which have well-known metrics since PS exists. Or you embed that font.
17:55:29
piethesailor
gilberth: Unfortunately the topic might be wrapped up. I don't know that there is an immediate solution for screenshoting programaticly in CL. Of course I could start writing my own library for it I guess
17:56:29
piethesailor
even though that package is a light wrapper. Might need to build on that first
18:00:58
piethesailor
I'll take that advice.. Could use a solution sooner than later. Wayland isnt on ubuntu <21.10, right? being on windows subsystem, I should just downlaod ubuntu 18 and work on that from now on..
19:07:15
piethesailor
Still getting a match error. I need to check if I have wayland on here and if so, how do I rid myself of it
19:23:56
piethesailor
I suppose all linux distros moved to wayland in some form or fashion.. Nilby: what are you doing to run pure Xorg?
19:30:24
Nilby
piethesailor: I run a very weird environment without things like wayland, systemd, desktop env, etc. If you want to test, you can probably just run Xorg by hand.
19:32:44
Nilby
piethesailor: I don't use arch, but the arch wiki https://wiki.archlinux.org/ has good information for doing everything by hand.
19:35:38
piethesailor
Hmm. is there at least a way to force X11 to be the only renderer? Like if I just delete the $WAYLAND_DISPLAY vaiable or something?
19:36:50
piethesailor
Maybe that will break something? I only use emacs and ... well chrome for some cl-selenium webscrapping. I suppose things could break there
19:44:09
Nilby
The problem is getting at the root window contents is probably disallowed with x11, no matter what. Also running under WSL it proably runs X11 in "rootless" mode. You'd have to change the startup scripts to run Xorg instead of wayland + xwayland. I've never run WSL so I don't know if it supports it. One thing you could try is tesing a VM booted on a non-wayland linux distro.
20:19:23
piethesailor
Whats a good non-wayland distro? A google search only shows distros that have defaulted to wayland
20:19:47
piethesailor
I know I could build arch without wayland, but i'd like to avoid the arch route if possible
20:27:33
Nilby
Unless you enjoy that sort of thing I would just run-program a screenshot program that works on wayland.
20:27:37
gilberth
piethesailor: Usually with the login screen once you chose the user there is a cog wheel at the lower right which allows you to chose between Wayland and no Wayland. I just fired up my Ubuntu 20 and it still has that. And indeed, when I chose Wayland, xwd too catches this BadMatch error we where talking about. When I chose not to use Wayland that is fine again.
20:29:05
gilberth
Otherwise, I am a Debian user without a desktop environment, when I use Linux. I have that Ubuntu there only for testing purposes.
21:21:01
aeth
does it matter if a distro defaults to Wayland or not? As long as Wayland-on-Nvidia is buggy and as long as Nvidia GPUs are so popular, then they'll still have to support X
21:21:47
aeth
in Fedora, for KDE you can select Wayland or X11 version. And most non-KDE/non-GNOME WMs/DEs are probably still X-only