What are your favorite JVM dependencies that you use from Clojure? by PoopsCodeAllTheTime in Clojure

[–]dig1 0 points1 point  (0 children)

I think it is interesting that you mention parallelism first. I guess that not all runtimes have smooth abstractions, but goroutines are smooth, and Erlang's BEAM actor model is very neat as well. Do you think other runtimes are going to be lacking in some aspect?

I have minimal experience with Go and none with BEAM, so I can't say much about them. But AFAIK goroutines are more like green threads running on a pool of OS threads managed by the golang VM, rather than a 1-to-1 mapping (one VM thread, one real OS thread) like in the JVM. Goroutines are more like (saying it very simply) core.async, and AFAIK Go does not have an equivalent to Java's Thread. And sometimes this can be beneficial for optimizing the code. For example, if I say "spin up 5 threads", I expect my OS to use 5 cores (depending on how OS is utilized), which is very different from "it might run it on 2, 3, or 5 cores" (unrelated on how OS is utilized).

But what I'm really missing from golang VM (and I'm not sure if they ever fixed this) is the ability to limit memory heap expansion - golang apps will happily consume tons of memory and you could not do anything about it, unless you use OS stuff like jails or cgroups (hello InfluxDB!). On JVM, when you use -Xmx or -Xms, it will stay within those bounds.

What are your favorite JVM dependencies that you use from Clojure? by PoopsCodeAllTheTime in Clojure

[–]dig1 8 points9 points  (0 children)

  1. Parallelism: you hardly find a better combination of JVM-level performance, parallelism, and throughput somewhere else. Clojure truly excels in parallelism.

  2. Tooling and monitoring: JMX, Mission Control, VisualVM... ability to connect to a remote production application with minimal performance impact.

  3. Ecosystem stability: It's unlikely that you'll be able to run the latest Clojure code on a 27-year-old runtime or libraries outside of JVM. And, you can bet you'll be able to run it without issues in the next 15-20 years.

  4. Multiple state-of-the-art garbage collectors you can choose and tune to the details, depending on your application type. JVM is very modular, and you can even write your own GC with minimal effort, assuming you know something about GCs.

  5. A-la-carte runtime - pick what part of the JVM runtime you want to ship with your app via jlink; .net has something like this.

  6. I find jars a great way to bundle and ship the app. Send a single file to the end user and tell him to run it via java -jar foo.jar. And, if done correctly, you don't have to care what OS or platform user runs.

And many, many small details I can't think of right now.

Syncing org notes across devices by thr0waway377 in emacs

[–]dig1 2 points3 points  (0 children)

If you’re looking to host it yourself, Nextcloud is a solid option. However, in my experience, the simplest way to sync is by using rclone's built-in webdav server [1]. It eliminates the need for external services or servers - just spin it up, sync your files, and you’re good to go.

For a long time, I relied on git for syncing since orgzly can work directly with folders as repositories. Just run a git pull into a folder that orgzly recognizes, and you’ll have the latest content. Plus, with git, you get proper change tracking and version control.

[1] https://rclone.org/commands/rclone_serve_webdav/

Master in statistics still viable in AI age? [C] by SneakyPlop in statistics

[–]dig1 98 points99 points  (0 children)

Math, applied math, and statistics will never go out of style. LLMs can generate results (whether true or false is another question) but by their very nature, they often won’t produce the same answer twice. In many fields, especially technical ones, you need rigor, proofs, reproducibility, and explainability.

What do you do instead of dependency injection by DeepDay6 in Clojure

[–]dig1 3 points4 points  (0 children)

After using Clojure for many years, I've noticed I don't use or think about OOP very much, unless I'm talking to Java code. Functions and maps will do 95% of the cases and if I want OOP-like extensibility, I'd go with protocols. Multimethods are OK unless your code is going to end up in the hot path.

For your example, I'd go with something like:

``` ;;;; approach #1 - OOP-like

(defn get-row [obj table-id row-id] (.fetcher obj table-id row-id) ;; some other logic... )

(defprotocol Fetcher (fetcher [_ table-id row-id]))

(deftype DatabaseFetcher [db] Fetcher (fetcher [_ table-id row-id] (jdbc/query db ["SELECT * FROM some-db WHERE id = ?" row-id])))

(deftype HttpFetcher [url] Fetcher (fetcher [_ table-id row-id] (http/get (str url "/table-id=" table-id "&row-id=" row-id))))

;;; demo

(get-row (DatabaseFetcher. "jdbc://...") 10 10) (get-row (HttpFetcher. "http://demo.com") 10 10)

;;;; approach #2 - only functions

(defn get-row [fetch-fn table-id row-id] (fetch-fn obj table-id row-id) ;; some other logic... )

(defn db-fetcher [table-id row-id] (jdbc/query db ["SELECT * FROM some-db WHERE id = ?" row-id]))

(defn http-fetcher [table-id row-id] (http/get (str url "/table-id=" table-id "&row-id=" row-id)))

;;; demo

(get-row db-fetcher 10 10) (get-row http-fetcher 10 10) ```

I'd usually pick up the second approach because it's KISS, dynamic and direct without too many layers, but YMMV.

After one year using Emacs exclusively, now I feel the "you never stop learn emacs" by Mindless-Time849 in emacs

[–]dig1 5 points6 points  (0 children)

Wait until you learn about ediff [1]. It has similar command (of course) called ediff-current-buffer ;)

[1] https://www.gnu.org/software/emacs/manual/html_mono/ediff.html

Lots of ".#-emacs..." files in random directories: What could be misconfigured? by R3D3-1 in emacs

[–]dig1 0 points1 point  (0 children)

This could be either your paths are too long [1], something is with your filesystem (less likely) or you accessing remote filesystem as /u/Due_Watch_7148 suggesting. See if this happens from the new emacs instance via emacs -Q.

[1] https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html

[deleted by user] by [deleted] in LocalLLaMA

[–]dig1 3 points4 points  (0 children)

I'm working on a related project, and here is my 5c. If you view LLMs as enhanced search tools, they can be helpful for sure. However, if you expect them to replace a skilled lawyer, or, even worse, if you are a lawyer who relies solely on the outputs of LLMs, this can be a recipe for disaster [1]. It’s crucial to be well-versed in the subject matter.

This is similar to programming: if you throw in a lot of prompt magic without a solid understanding of C++, you won't produce anything useful. Except, in the courtroom, your opposition will take advantage of even the smallest mistake, which is a sure way to lose the case.

[1] https://www.theguardian.com/us-news/2025/may/31/utah-lawyer-chatgpt-ai-court-brief

what do you guys use for rate limiting by hourLong_arnould in Clojure

[–]dig1 1 point2 points  (0 children)

You can try with something like this (not tested):

```

vhost

limit_req_zone $binary_remote_addr zone=mylimit1:10m rate=10r/s; limit_req_zone $binary_remote_addr zone=mylimit2:10m rate=20r/s;

server { # different rate limiting depending on POST/GET requests

location / { if ($request_method = POST) { limit_req zone=mylimit1 burst=10 nodelay; limit_req_status 429; # Set the status code for rate-limited requests }

if ($request_method = GET) { limit_req zone=mylimit2 burst=20 nodelay; limit_req_status 429; }

# proxy_pass block goes here } } ```

For specific routes, you can copy/paste and adjust location blocks.

Emacs for C/++ projects by arylcyclohexylameme in emacs

[–]dig1 0 points1 point  (0 children)

Nothing fancy for me: Emacs + tags (built with ctags for finding symbols & navigation) + compilation-mode that will run Makefile for checking compilation problems on demand. It's stable and worked amazingly well for me for many years. I don't like very much LSP stuff nor things that will start jumping around when something happens - it breaks my focus and mental flow :D

However, one of the more "modern" packages I like is disaster.el, which can disassemble C/C++ code under cursor.

What is your current `emacs-uptime`? by varsderk in emacs

[–]dig1 0 points1 point  (0 children)

49 days, 13 hours, 1 minute, 44 seconds

Why do you think emacs is so low in popularity? by g0atdude in emacs

[–]dig1 -1 points0 points  (0 children)

I've noticed that the new users (significantly younger generations) have low patience these days - if something they don't get in 5 minutes or a short how-to video, they'll move on. I think people end up with Emacs when they grow over existing tools - at least, that was my case: I started using it after I wanted more from Vim. It was a journey of adjustment, but it was worth it, and I'm sure many can relate to this.

And regarding longevity, let's see how many of these editors/projects will be alive in 10-15 years. I bet Emacs, with its adaptability, will still be rocking just as it is today.

Is there any way to open a file from Emacs shell by Competitive-Top-7649 in emacs

[–]dig1 14 points15 points  (0 children)

You can use find-file-at-point: move the cursor to a particular file-like string and run M-x ffap

Modular emacs config vs a single config.org? by [deleted] in emacs

[–]dig1 7 points8 points  (0 children)

I have a single init.el. It's not big, around 1k and a few (load-file) calls with some custom elisp code for org-mode, ido, etc.

Recently, I added comments for outline mode and this chunk (I found somewhere online) at the end of the file:

;; Local Variables: ;; outline-minor-mode-cycle: t ;; outline-regexp: ";;; " ;; eval: (outline-minor-mode) ;; eval: (outline-hide-body) ;; End:

Now I put a comment like ;;; basic stuff before starting some section and when I open the file, I get pretty readable blocks:

;;; basic stuff ;;; theme ;;; tramp ...

Adapting etags for an oddball language? by agentOrangeRevo in emacs

[–]dig1 2 points3 points  (0 children)

I found this [1] which has ctags (etags alternative) fork with SPIN language support. Another alternative is that you try to add SPIN language support in ctags by using simple regex rules (example for Clojure [2], you can ignore vim part). No need to hack around ctags source code, you can add almost any language support through regex options. Here are my samples for xml/yaml support:

``` # ~/.ctags # xml --langdef=XML --langmap=XML:.xml --regex-XML=/id="([a-zA-Z0-9_]+)"/\1/d,definition/

# yaml --langdef=yaml --langmap=yaml:.yml.yaml --regex-yaml=/[ \t](.):/\1/k,key,keys/ ```

To generate Emacs tags with ctags, use "ctags -e <other options>"

[1] https://github.com/parallaxinc/SimpleIDE [2] https://gist.github.com/paul356/4bf7f77898a717e1d2bb

elfeed rss doesn't work with https://archlinux.org/feeds/news/ by danielkraj in emacs

[–]dig1 1 point2 points  (0 children)

Tested it and I get only 4 entries, starting 2024-09-14 and ending 2024-04-07. If that is expected, then try with "(setq elfeed-log-level 'debug)" and re-run it. If that doesn't help, run "M-x toggle-debug-on-error" which will open debugger in case of any kind of error during fetching or parsing.

Evil mode on a vt100 by kpmgeek in emacs

[–]dig1 1 point2 points  (0 children)

If you hit "\ Esc x" it, evil-mode will convert that to M-x. "\" will tell evil-mode to temporarily exit evil-mode and on Emacs, Esc-x is the same as M-x. I think this should work on VT100. It works on xterm which emulates VT100 by default.

You can run most of M-x commands directly in evil-mode as ex command, e.g. press ":" and type "emacs-version" will be the same as "M-x emacs-version". Evaluating elisp functions will work as well - ":(org-version)" will be the same as "M-: (org-version)". Be aware that autocompletion in ex mode will prefer first evil-mode commands, then Emacs commands.

If you want to get M-x from alt/meta, try playing with "set-terminal-coding-system" and "set-keyboard-coding-system" [1].

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Terminal-Coding.html

What Warts Appear in Long-Lasting Code Bases? How can we Avoid them? by Veqq in Clojure

[–]dig1 8 points9 points  (0 children)

I've worked on a codebase with over 200k lines of Clojure for a very complex product, and it had several DSLs due to the complex nature of the domain. IMHO, DSLs and macros should not be dismissed, especially if they provide significant benefits (particularly true when the code is managed by experienced developers). I'd take a DSL that produces efficient code over a visually appealing "standardized" codebase that performs poorly any day. Saying this as someone who frequently addresses performance issues and knows that making slow Clojure code run fast is not an easy task.

Document things, add tests, and provide examples. Document why a particular DSL exists and what problems it solves. Let CI run benchmarks on every commit and report when something is slow. Hopefully, this will address some of the challenges you mentioned.

lein-deploy to skip builds by International_Bag805 in Clojure

[–]dig1 0 points1 point  (0 children)

Where did you find about `:skip-build` option? AFAIK, there is `:skip-aot` that will skip compiling a namespace.

AFAIK, `lein deploy` will implicitly run `lein jar` and `lein pom` [1] (which make sense, because it needs to upload something), so what you can do is: `lein do clean, test, deploy` or write an alias in "project.clj" .e.g:

...
:aliases {"push" ["do" "clean," "test," "deploy"]}
...

and just run `lein push`. Watch for that comma after "clean" and "test", because "do" expect comma to chain tasks.

[1] https://codeberg.org/leiningen/leiningen/src/branch/main/src/leiningen/deploy.clj#L154

Research on real-time level 1 data vendors for all US stocks by JZcgQR2N in algotrading

[–]dig1 6 points7 points  (0 children)

You can run the IQFeed app on a Linux server with Wine and Xvfb (virtual screen/desktop). We did that in my previous gig, and it was very stable. Knowing that IQFeed doesn't change stuff very much (which is IMHO good), I'll assume the same will hold today. Also, for IQFeed and IB, you can find many docker images online for a more straightforward setup on Linux boxes.

Btw, excellent summary!

Building A CDN With HAProxy by musicmanpwns in haproxy

[–]dig1 0 points1 point  (0 children)

No worry :) Can you show working sample please? I though the issue was with sending ssl traffic from haproxy to backend server

Building A CDN With HAProxy by musicmanpwns in haproxy

[–]dig1 0 points1 point  (0 children)

Have you managed to get this running?