(Files/move (.toPath (io/file source))
(.toPath (io/file target))
(into-array (if replace-existing?
[StandardCopyOption/REPLACE_EXISTING]
[])))
Some of the interesting things I did, learned, or found in the past week.
babashka/fs is a file system utility library that helps you use java.nio package from Clojure. The standard clojure.java.io namespace and some other libraries like Raynes/fs use the old java.io package and thus suffer from several drawbacks. However, the nio package isn’t that nice to use from Clojure and this library should help with that.
I had
problems with Rayne’s fs/rename
when moving files between file system.
Had I used babashka.fs
then I could replace this code:
(Files/move (.toPath (io/file source))
(.toPath (io/file target))
(into-array (if replace-existing?
[StandardCopyOption/REPLACE_EXISTING]
[])))
with this call (and perhaps eliminate my custom function entirely)
(babashka.fs/move source target {:replace-existing replace-existing?})
Jacek published a new course reviewed by experts such as Paul de Grandis. I wanted to have a look at pedestal for a long time and I hope this will be the right motivation to give it a try.
I was excited to see a few improvements in the latest Cider release, notably the support to undefine all the previous definitions
inside a namespace before loading it - simply by prefixing the usual cider-load-file
command with C-u
(or SPC-u
in spacemacs).
Unfortunately, there are some problems with respect to Java imports so it’s not fully functional yet.
Watch Unexpected cider-undef-all outcome wrt. java.lang classes #3194.
The Clouncil is a fun and friendly live call-in show for Clojure beginners to ask experienced Clojurians questions and work out problems together.
I think it’s a great iniative and it’s run by Clojure (and teaching) experts like Arne Brasseur and Daniel Higginbotham.
I re-discovered this essay by didibus via Clojurians slack.
My take is that in general, the right tool for the job actually doesn’t matter that much when it comes to programming language. … That’s why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.
A new clojure trace "debugger" has been published. It reminds me the tracing functionality available in Cider, but maybe it can offer something valuable to specific audience.
If interested, watch the video here: https://www.youtube.com/watch?v=YnpQMrkj4v8
Sean Corfield offered good advice:
In general, good function and argument names, and good docstrings, should tell the reader all they need to know – see Zach Tellman’s excellent book “Elements of Clojure”. But using Spec as an additional form of documentation for data structure can also help. Destructuring can also be a helpful tool. There’s no One True Way(™) here.
An older article from Cloudonaut discusses a few different architectures and their tradeoffs. They talk about:
Active-Standby (only one instance is actively serving the traffic but the other one can be used in case of failure)
multi-AZ RDS deployments with AZ preference to avoid costly cross-zone traffic
EBS replication between two AZs (via DRBD, Distributed Replicated Block Device),
and a very specific one: Oracle APEX on Fargate and RDS
This is a good introduction to the topics of **data privacy and GDPR / regulations. Their "framework" contains three pillars:
Learn - identify categories of information such as Personal Information
Assess - compile a list of customer data that is already being handled and stored by your company and do technical and policy assessment
Govern - determine regulations and policies that apply to your situation and design or find a technical solution to implement and reinforce those policies.
With AWS RDS, it’s easy to setup a backup schedule and perform regular snapshots of the database, let’s say on a daily basis. But you have another option and that’s called point-in-time recovery. You can simply restore your DB instance to a specific point in time (with 5-minute granularity) within your backup retention period. To see the latest restorable time for each DB instance go to the Amazon RDS console and choose the Automated backups menu.
Chris Houser have been looking for people joing his book club reading Lisp in Small Pieces I hesitated at first, but decided to give it a shot and started reading the book last week.
It’s quite dense right from the beginning but even if I don’t finish it I think I’ll get a lot of value from the process. And it will be fun doing it with other people.
I’ve just got this wonderful little book. It’s a distillation of The Feynman Lectures on Physics.
So far, I’ve read only the introduction by Paul Davies - and that was already great!
I published a long summary for the whole April.
This book contains a lot of good advice and, even more importantly, writing exercises. I’ll be trying some of them - one that can be quite helpful is a re-writing/eliminating exercise (on p.92):
Select a couple of paragraphs
Eliminate 1/Nth of words in every sentence of those paragraphs
Eliminate 1/Nth of sentences in every paragraph
Add max 3 words for a paragraph if it lacks something.
Tip: For most writers, N=3 is a good value to start with.
A quick recap of some of the links mentioned in this post: