Homebrew is excellent and you can install a minimal racket by running
brew istall racket
Once this finishes, you’ll see instructions on how to install DrRacket with
raco
. Follow the advice:
raco pkg install --auto drracket
This takes a while. You might struggle to actually find the DrRacket.app or launch DrRacket.
If you’ve never used racket before, you probably don’t know raco
either and you won’t know where it has installed all the things.
Run the following to find out where raco
has placed the .app
:
racket -e '(require setup/dirs) (displayln (path->string (find-gui-bin-dir))) (for-each displayln (directory-list (find-gui-bin-dir)))'
This lists /usr/local/Cellar/minimal-racket/7.5/bin
as the directory where
DrRacket.app
sits on my machine. Running
/usr/local/Cellar/minimal-racket/7.5/bin/DrRacket.app/Contents/MacOS/DrRacket
from the command line will launch DrRacket.
I symlinked it so it was a little easier:
ln -s /usr/local/Cellar/minimal-racket/7.5/bin/DrRacket.app/Contents/MacOS/DrRacket /usr/local/bin/drracket
I chaired the tech fortnightly. It is an open agenda; anyone can put a topic in and speak. I always forget how much work it is to co-ordinate the events. Finding people to talk and suggesting topics takes more time than I expect.
I presented three things I have enjoyed while learning some Python. It sparked some good discussion in a community which does day to day work in Ruby. I am glad that my presentation served as a conversation starter. I want the tech fortnightly to become more two sided discussions rather than one sided presentations. I was a little dismissive of JavaScript in the middle of my talk, which I regret. It is insensitive to those who work primarily in JavaScript.
I started working on a prototype to explore data from a satisfaction survey. This involved putting together a database schema from a spreadsheet of data of denormalised and anonymised data. I inadvertently created quite a large chunk of what is a generic survey data design in the process.
I also attended a strategy workshop with other lead developers, head of tech and senior product managers. Thinking strategically is a skill in which I am not practiced. I still fall back to thinking of solutions and immediate implementation detail.
I spent some time tidying up my vale linting setup. Writing to vale’s exacting standard is hard!
I started working with a new team focussed on using data science to make GOV.UK better for the end users. My previous team focussed on long term maintenance of the platform. Data science is a whole new world for me. I’m excited to get stuck in and learn.
The code is largely in Python and is the first time I have worked with a significant piece of production Python code. I immediately bumped into problems trying to install the requirements for the project.
In the project, two of the top level dependencies rely on Pygments. Pip installed an up to date version of Pygments when it resolved the first dependency, but the second dependency required an earlier version of Pygments. I think this was the result of merging Dependabot PRs without running pip install
and ensuring a clean install.
Pip, to my surprise, does not resolve dependency versioning issues and I am reminded of DLL Hell.
My current understanding of workflow on a Python project is developers occasionally use pip freeze
to write requirements to a file. Subsequent efforts can install from the file. Apart from the versioning issues, it is also easy to commit unwanted packages to a project if developers are not careful.
I spent some time investigating how other projects manage Python dependencies. A colleague pointed me towards PEP-0518 which looks interesting, but in my limited view of repositories around GDS, I did not see a .toml
file being used so I don’t know whether people are doing this in the wild or not.
I found pipdeptree which outputs a tree view of dependencies similar to Bundler’s Gemfile.lock.
I discussed the problem with one of the other developers on my new team and went digging around some other Python projects. We found a pattern of two requirements files. One for base project dependencies that is hand crafted, and one autogenerated with all dependencies and their sub-dependencies. The advantage is developers are more aware of the dependencies they are adding and this should address the unwanted or unneeded packages sneaking their way into a project.
Going forward, I want to add some automated process around the projects to catch these errors earlier. The first thing to do is spin up a new virtual environment and run pip install -r requirements.txt
on each branch push. After that, I want to put some linting in place. The code is still small enough for this not to be too daunting.
Here’s a small bit of scheme code:
(define (adding a b)
(+ a b))
(display (adding 7 4))
To run this directly from the command line, you can use the following:
mit-scheme --quiet < script.scm
I always forget this.
I don’t know why, because my editor shows big nasty red blotches whenever I have
trailing spaces.
To force a line break in markdown, end your line with two spaces.
A couple of devs with nice Macs
Thought up some quite clever hacks
They opened PRs
Approved them too fast
Now production is being rolled back
Here’s a snippet you can add to your rspec config to print out the name of the method being run:
config.before do |example|
puts "----- state ----"
puts example.metadata[:full_description]
puts "inline: #{Sidekiq::Testing.inline?}"
puts "fake: #{Sidekiq::Testing.fake?}"
puts "----------------"
puts
end
Why on earth would you wan to do this? Sometimes you are working with something like Sidekiq where state can bleed between tests (for example changing from inline
to fake
); this little snippet helps you figure out where it’s happening without having to investigate all your test files.
If setting up a new Rails project with Mongoid and trying to run rails g
mongoid:config
hangs, try
spring stop
spring start
Sometimes you want a quick “not in” or “not equal” query in Rails, but you’re
running Mongo. ActiveRecord allows us to write where.not
against relational
databases, but this doesn’t work when using Mongoid. Instead, you can use nin
or it’s alias not_in
Book.not_in(title: "Of mice and men")
The method is also chainable, so this is valid:
Book.where(author: "Steinbeck").not_in(title: "Of mice and men")
If you prefer not to chain your methods, you can also write the query by sending
nin
to a symbolised version of your model’s property and then using the old hashrocket syntax to specify the value:
Book.where(author: "Steinbeck", :title.nin => ["Of mice and men"])
Module not found: Error: Can't resolve 'fs'
If you’ve set up webpack with an Electron application and you hit this strange error when trying to bundle your project, you’ve probably forgotten to include the target
in your webpack config. This is easily fixed by editing webpack.config.js
to include the target, something like this:
const path = require('path');
module.exports = {
entry: './app.js',
output: {
filename: 'bundle.js'
},
target: 'electron'
.
.
.
}