Fork me on GitHub

Is it normal for sites to work if you have www. and be broken if you don't have www. ? Surprised I'm tried to access a large companies site ( and it didn't work, but it works if I typed in I always just assumed browsers would append the www bit, if I didn't type it.

Wanja Hentze14:03:06

Modern websites usually have both domain names and redirect one towards the other. The question is which one is the cannonical form 😄 There are arguments to be made for either, see and

Dimitar Uzunov18:03:55

It is normally handled by a server side redirect (the web server for one does a 302 redirect to the other). Since the redirect response is an empty body it looks as if the browser did it


Funny, I recently also ran into this, as I wanted to know which social platform was used just by looking at the first part of the url. Where some do and some don't use www.


I think most places just register both domain names (i.e. with and without the www.) to point to the same host. The browser does not automatically add it.


answers with a 301 to redirect to (can be seen using curl -v)


hmmm.. maybe one of my extensions blocks redirects then.


Technically you have to think of www as being an arbitrary subdomain which may or may not point to the same address. It is common to do so and then redirect either from the www subdomain or to the www subdomain, depending on whether it is the canonical url for a given site.


The redirect is issues by the webserver. The browser just reacts to it. There might be multiple (quasi partial) redirects being issues but handled internally to the webserver until it tells the browser where to go. If you open the network tab in the browser you can see that the mentioned site redirects from http to https as well:


I must have an extension stopping this from working. just gives me


Same IP does not mean "handle in the same way". The server, while itself being the same, will distinguish between and .


Also, the server can pay attention to a lot of other things. Your IP's location, your browser, even your screen size (I think).


See: (Sidenote: Here they don’t talk much about 304 which is a bit of an underused response IMO.)


622883673e74770430283014 is both a valid Mongo BSON ObjectID, and a "valid" JS number.

> JSON.parse('622883673e74770430283014')
Don't ask me how we know 🙂

😬 2
😂 3

This post feels like the perfect recollection of the ethos of the "we should've switched to PostgreSQL sooner" kind of articles. :D


Trust me, it’s quite an undertaking…


We've embarked :)


So have we…


Perhaps we should compare notes @U04V5VAUN - were only reading so far, writes go to mongo, as we have a legacy Node app that reads from that.


With a continuous process that updates Postgres so that everything is eventually synced.


Ha! 622883673 x e^74770430283014 :rolling_on_the_floor_laughing:


I'm going to start linking this tweet in commit messages when fixing egregiously stupid bugs


What do you do when the problem you want to solve is beyond your capabilities?

Cora (she/her)22:03:47

ask for help 🙂

upvote 1

• Make the problem less hard • Improve your capabilities • Make it someone else's problem (asking for help, delegating) • Decide it's not a problem. :D (those are options, and not a TODO list)


This is a carryover from #clojure-art I'm trying to get the capability to draw in a given X11 window with any Clojure library. The problem cuts from from Xlib up to AWT and on into Java2d|Clojure2D|Java-Gnome|Swing|Seesaw. There don't seem to be places to ask about AWT. I can't figure out how to make this less hard.


> I'm trying to get the capability to draw in a given X11 window with any Clojure library So that's how you have defined your problem. But why? From your messages in #clojure-art, it seems to me that you want to be able to write X11 and/or Wayland screensavers in Clojure. That might be quite a bit different problem.


Not too hard to do in C or Rust. But getting that capability exposed in Java is a deep dive into old code.


I'm not sure what API you're trying to use, but it's often easier to directly wrap C libraries using ffi libraries like clojure-jna or dtype-next than it is to use Java libraries that wrap C code.


If seems that you can use xephyr for that: As an alternative, this is how Python does it - without having to go down all the way to the C level. Perhaps there's a wrapper for GTK libraries for Java that you could use in the same way.

🤯 1

I was hoping I could just expose the existing Xlib functions through AWT or Swing or Java-Gnome. There was a project years ago called SaverBeans that seems to use libMotif to make the magic happen.


xephy is a crazy option. I'll have to play with that.


> expose the existing Xlib functions through AWT or Swing or Java-Gnome My understanding is that the point of AWT / Swing are to abstract away (remove) any differences between windowing systems on various OS. X11 is notoriously difficult / weird (it's a design from the '80s, when programming practices were radically different, and adapted to constraints we don't deal with in desktop apps today). If you want to learn to use X11, I think the best resources are elderly programmers who hang out on IRC.


I've used Xephyr before - it makes load / reload workflows when writing X11 apps (especially window managers and screen savers) much easier.

👍 1

I thought the point was more to make a common cross-platform capable library. Not to hide capabilities? My problem isn't the X11 part, it's the "make this work with Java" part. I've already written enough X11 in C to be reasonably comfortable with it.


Even with Rust it requires some patching of the lower level libraries to get the root window.


If you're comfortable with C, then it's really worth checking out c ffi libraries like dtype-next and clojure-jna. You can write a small c wrapper that is easy to call from clojure.


Do you think I can then somehow make the leap from there to making it work with Clojure2d? I expect that if I have to work at the JNA level, I would also have to re-implement everything from there up.


> Do you think I can then somehow make the leap from there to making it work with Clojure2d? Yes. I've implemented graphics for most of the 2d stuff like shapes, text, images, fills, paths, transforms, etc using Swing, JavaFx, Skia, and Skija on the clojure side, so it's definitely possible. They can all render to several raster formats so I assume that one of them should match what Xlib expects. I'd be happy to answer any questions.


If you want examples, then you can look at the corresponding namespaces in cljfx, java2d, skia, skija.


I guess I don't understand. It looks like you're using AWT. But I what I would need to do is use JNA to get the root window reference and somehow coerce AWT to use that?


I'm not actually sure what xlib or xscreensaver expects, but I assume there's at least some way to draw a bitmap image. So the most basic plan would be to use clojure to draw into a buffer using a bitmap image format that xlib understands and then export a c function accessible via jna that can render that buffer. There's probably even fancier ways to do that.


It looks like there's a way to use opengl with xscreensaver. I know that skia can render using openGL as well as libraries like lwjgl.


My expectation is that if I can get a handle to the window and a graphics context, I can draw on that window with that GC.


But without a GC in that window, I don't think there's a way to even render a buffer/bitmap to it.


And with OpenGL there would be the same problem - getting a handle to the correct window.


Right, that's where c ffi libraries come in. You either call xscreensaver directly or you write a small c wrapper, build a shared library, and expose whatever functionality you need that way.


That's essentially what any java library would do anyways.


There's still some misunderstanding here. Nothing calls xscreensaver, not even the xscreensaver hacks themselves. There's no xscreensaver API to call.


The hacks are just GUI programs that grab the root window and draw on it.


Ok, same deal. Either setup the opengl context via direct ffi calls or write a small c wrapper that sets up the opengl context and expose it for clojure to call via ffi.


Thank you for trying. I still don't understand how to cross the bridge between ffi and java2d. Which I suppose is my lack of understanding what JNA would do for me?


JNA (Java Native Interface) is an ffi (Foreign Function Interface) option that allows java/clojure to call c functions and expose functions that can be called from c code.


Those words strung together make sense 😉 I could call XtAppInitialize[1], then maybe XGetWindowAttributes[2] and get a pointer to a C struct representing the window I need to work on. But then I don't see a way to inform AWT or Java2D or openGL about what has happened. That's my hangup. Copying over pixmaps through ffi would work, but would also be really ugly when it comes to animation. 1: 2:


There's more than one way to do it, but I'm assuming it's easier to adapt a working sample by using a setup similar to the following: 1. Expose a clojure function, drawMyScreenSaver as a c entry point that receives any necessary graphics context info as arguments and draws whatever you want to draw 2. Expose a c function, runMyScreenSaver, that you can call from clojure that creates the window, creates the graphics context, runs the graphics loop that calls your exposed clojure draw function 3. When your clojure programs starts, create a new OS thread that calls the exposed c function runMyScreenSaver > Copying over pixmaps through ffi would work, but would also be really ugly when it comes to animation You can just past raw pointers to memory. You shouldn't have to copy buffers.

thinking-face 1

Are there docs for clojure-jna hiding somewhere? Maybe it's awesome, but the only example the project gives is calling printf.


clojure-jna is mostly just a light wrapper for JNA, so you may need to refer to JNA's docs to get a complete picture,


If you'd like an alternative, I highly recommend I think the ramp up for dtype-next is a little steeper, but it's a highly capable library.