Fork me on GitHub

Hi, maybe somebody know that: how store data/process like smalltalk, like “os” image, .. so you can stop the process and restart, or pause.. I read about and very interesting (“Smalltalk’s principal claim to fame is its image-based approach to software creation. An image is a snapshot of memory that contains all the objects in your running application or system. It encapsulates the entire execution state of your program. An image can be saved to disk, and execution can later be resumed exactly from where you left off!“) . what is the main solution behind this? save the process data dynamically to bytecode? how to encapsulate the state?

☝️ 1

@sb Well, a running process can be largely described by 1) a set of memory address ranges visible to it + their content, 2) the state of CPUs (~ content of their registers), and 3) a set of external OS resources (files, sockets, etc) in use by it. (1) and (2) can be relatively trivially dumped to disk, and, with some OS support, restored from that dump. (3) can be less simple, but there are some tricks that can sometimes help. Some variants of this approach use virtual machine memory / state instead of CPU memory / state.


@jason358 thanks, the answer.. yes, totally new for me.. store state of a running process. really interesting! I think, I try out the easier way 1+2..


There are some libraries / utilities for linux that can handle freezing/unfreezing a process, to some extent, I think


Doing it by hand is a lot of low-level work, can be tricky


I would like to try out on microcontrollers, totally create via C/C++.


Yes, I see. But sounds interesting.. store a state, maybe transfer, simulate etc..


Before I saw you mention microcontrollers, I wanted to suggest lxc snapshot.

👍 2

Yes, perhaps the state is much simpler on microcontrollers


Yes, much much easier, if you create eg. a simple stack based virtual machine...


IDEA: A / libp2p lib to clojure that (ipfs/ref {:some "value"}) ;; => #ipfs"<CID block ID>" (ipfs/deref #ipfs"<CID block ID>") ;;=> {:some "value"}

👍 1

@jjttjj I notice that clojars displays the coordinates they way you suggested:


Yeah, I think I noticed I subconsciously started to look for the clojars link on a readme more often since I started using tools deps due to this


I feel so clean after fixing +60 issues reported by clj-kondo in my small codebase 😎

clj-kondo 5

Just don't run it on the code of the libraries that you use. :)


I invoke it from these:

alias t="cd $PROJECT_HOME"
alias tls="clear && t && clj-kondo --lint src"
alias tlt="clear && t && clj-kondo --lint test"


And I feel so good removing my old cobbled dev and build config consisting of a frankenstein combo of lein/boot from the days of yore to deps.edn. Shrunk my compiled JS file by 30kb due to shadow-cljs build report and uberjar from 120M to 76M. Full compilation in 50 secs down from 3 mins.


Nice. I am not there yet. I still depend on quite a few lein plugins.


I actually want to do the same.


I'd highly recommend depstar for uberjar, nothing else completely worked for me.

👍 2

seancorfield's fork


@naomarik Thanks for the kind words! 🙂

Renato Alencar16:06:56

Hi everyone, as Clojure is described as tool for professionals, I would like to hear from you, who work no software companies, consulting, etc. About software engineering practices, do you gather requirements? Design docs? And things like this.


Hi, I have some code that converts yaml to edn. Now, there are several libraries for clj and cljs, but I have not found one for both. As I convert yaml to edn in clj and cljs I would like to use the same code to make sure it returns the same edn on front and backend. 1. Does someone know a library for both clj and cljs that I have just not found? 2. If not, is there a way to run cljs/javascript in the jvm (like nashorn did) or 3. run clj code in the frontend?


@sveri why use JS on the backend if you can run your clj yaml lib there?


@borkdude Because I want to make sure it generates the same output as the javascript one. The only way to be sure, is to use the same code for the conversion, everything else leaves the possibility for differences.


@sveri why must it be identical? for comparison? or other?


(because yaml is a nightmare)

👆 1

I agree, but it's what a lot of people use for swagger / openapi.


I derive business logic from that, validation for instance, and that should be the same. To be more specific, I have an openapi specification that I can "test" on frontend side and which is then later used to generate backend code.


it’s much easier to run js on the backend than to run a clj library wrapping a java library on the frontend


well, all clj yaml libs I know are based on SnakeYML. Good luck finding a JS lib that does exactly the same


@smith.adriane I am fine with that, but I only know about Nashorn, which is deprecated IIRC.


Hm, I could execute shell code.


@sveri the successor to nashorn is GraalJS I think


I’ve used before, but it’s been a while


@borkdude Thanks, I have a look at it.


Thats exactly what I have been looking for 🙂


I have a scheduling problem. I have a floor layout of rooms that need to be scheduled to optimize social distancing. Constraints are things like, "I don't want to schedule a room for this hour that was scheduled for the previous hour," "never schedule two rooms next to each other." Ideally, I could also maximize distance between rooms and optimize for ease of exit/entry.


I remember a talk where Mark and Alex Engelberg discussed the 12 nurses problem (maybe it was "Solving problems declaratively"?) where he wrapped a Java constraint library, maybe it could give some inspiration?


where would I start researching for solving this type of problem? any good resources on it?


it sounds a lot like Rich Hickey's twofer Tuesday problem 🙂


lol I had the same thought


sounds like a logic constraint problem


rules engines get used for that sort of thing, so you might ask in #clara


clara and something like core.logic feel very low level. I can't think of an efficient way to apply them yet


the output I need is a schedule that I can use to allow people to sign up for rooms at various times of day


you can probably use the interval scheduling algorithm from wikipedia to find schedules that satisfy your constraints and then assign weights to other attributes (eg. penalizing scheduling rooms next to each other) to sort results by desirability (eg. desirability= kDistanceWeight*distance_between_rooms_sum - kCooldownWeight*time_since_last_meeting_sum)


it also reminds me of this d3 animation where each dot has a certain force field to it, pushing away other dots.


given a set of rooms and a set of meetings, find schedules that satisfy some set of rules is also a different problem from having a list of potential meeting slots and filtering out the ones that fail some rules.


the first problem is a super set of the second, so if your problem is actually the second then you are a good way there because you have the easier problem to solve


While rules could be used to solve the problem, resolving these will not lead by definition to the optimal solution. It's more like a, these are the rules, this is the input, so this is the outcome.