Lately I’ve been on a pretty productive work streak doing something that I originally thought impossible while programming: going offline. I disconnect my router and throw my phone across the room and take breaks a few times a day.
I’ve done this by downloading the documentation, references and the stack overflow databases for my languages and frameworks of choice and searching through them and my old code when I don’t remember the best way to accomplish something. Not to turn this into a plug but I use and paid for Dash to accomplish the above and run my dev servers locally on my laptop.
This is probably a somewhat extreme solution but with the internet available I have a very hard time avoiding the temptation of alt-tabbing to a browser and opening a new tab, will power or not. I am weak. I accept this. The work must still be finished.
What I would like to know is if anyone else has a similar development pattern or if you’ve found any tools helpful for making an offline programming experience smoother?
I don’t do fully offline programming often, but a big fan of offline tools, because they are usually much faster to use even when you do have interne. For offline docs there is devdocs.io and zeal. Also often you can install the docs from the package manager, or along with the dev toolchain depending on the programming language, then you can set a keyword in the browser to use it as a search engine. E.g in my firefox I have
, so when I type, say,
py re.sub
, I get instant results.It’s certainly hard to replace googling + stackoverflow, but I often find myself searching for the same things I’ve already figured out before in other projects. For that it might be useful to setup a local code search (e.g. via Ripgrep). I’m describing my own code search setup here.
I personally think it’s a shame that in many languages (e.g. Python, the one I’m working most with) it’s not a common practice to package tests and documentation alongside the code, this would really help with offline workflows.
Wow, I had no idea there was a search page for local html python docs.
You can also use pydoc, which ships with python by default
Or
help(re.sub)
from the repl, which shows you the docstring of that functionI don’t think there is. In Firefox you can set shortcuts for frequently used searches, this one just points to a local file.
I use Dash on macOS for offline programming language and other programming related documentation searching and browsing (see Zeal for Windows, BSD, Linux). There are lots of docsets available for download.
This is what I was going to put, I use Zeal on a daily basis. I have it mapped to a key-binding so I can search documentation quickly. Once you get used to it it’s hard to go back to just regular search engines!
Since we are recommending docsets’ applications, it is worth to tell about another one: Dasht.
I went from Zeal to Dasht because I also wanted a full experience in the terminal.
It still uses the Dash docsets and
w3m
to open the docsets.I also use Dash here, without even working offline.
I find it to be like man pages but for libraries and frameworks. If I want the doc from a Flask method, I write the name and I have it, like I would with syscalls on man pages.
man 3
the man command is for online manual pages
I know you are looking for tools and techniques you can just deploy, but ultimately many people with these issues are better in invest in therapy to understand and deal with the behaviour.
You may see it impacting your programming, but this is likely only one example of it. We all suffer from varying degrees of mental issues and programmers need their minds operating as optimally as possible. There are lots of blog posts espousing exercise for the sedentary programmer because it’s an important aspect of health. Few directly mention anxiety, depression, etc which we are not immune from as programmers. In fact, we are going to be hurt because our minds are so important to our work.
I wouldn’t have guessed some of my behaviour was driven by anxiety because I didn’t understand these disorders and thought it only manifested in very big ways (and that it couldn’t be me.) I was very apprehensive about talking to a therapist, but I eventually reframed it as a performance optimisation versus a recovery. I now have some tools and techniques for dealing with it, but the main part was recognising when it was kicking in.
I would caution against life, or exec coaches, because you need someone who can properly diagnose a health issue. Some therapists work with executives, sports people, and the like. They are good ones to seek out. Finding the right therapist take some time.
Tools/life-hacks and therapy are both valuable, and synergistic. (Medication may help too.) I have ADD and mild anxiety, so I know whereof you all speak. I am pretty sure that ADD is very common among coders: hyperfocus is a very useful skill, as is the drive to keep bouncing around trying and learning new things. But there are downsides to it too. No one should feel a stigma about seeing a therapist — I think of it like debugging my mind, or getting a brain massage.
Personally, I haven’t needed to take measures to prevent myself from web-surfing during work. I usually find it more of a helpful break, between bouts of focusing. But we’re all different. I do agree that Dash is enormously useful as a fast way to look up docs on anything.
The main life-hack I use is an app called BreakTime that blocks the entire screen for one minute every 30 minutes (configurable) so I can stretch, wiggle my wrists, focus my eyes on something distant.
I seek stimulation - both interesting or easy to digest information fills the requirement.
Information is my drug of choice and the internet is a very well designed supplier. I deal with the addiction by adding enough friction between me and the reward. As long as I can finish my work I’m fine. This isn’t going to go away by talking to someone.
Metta meditation is a great way to address anxiety.
for video chat and conferences, I have a different place with an older thinkpad and a logitech cam in front of a sofa with neutral backdrop. I also use it for private lockdown/can-not-travel chatting. my office is sometimes my creative chaos (and will be), and I will never have the problem of someone spotting sensitive data. Plus I do not have the distraction of I might try to call XYZ, maybe he has time..
Perhaps you mean a white noise machine?
I mean a “Zimmerbrunnen”, optically a close relative of this one: https://res.cloudinary.com/chal-tec/image/upload/w_545,q_auto,f_auto/bbg/10034777/Gallery/10034777_yy_0001_titel___Blumfeldt_Riverrun_Gartenbrunnen_Zimmerbrunnen.jpg
I got it from a friend who also has tinnitus, changed the broken pump, gave it a thorough run with the pressure washer and ever since it helps me ignore the noise in my ears, and also to focus my thoughts. It works even if I sit beneath a river or creek.
That looks beautiful. Now I’m tempted to find one for my room
They may mean one of those little indoor fountains with water trickling over rocks. They’re pretty and make a nice sound. But yeah, of course there are apps and machines to make similar sounds.
I’ve found this to be one of the more useful things to do with my Echo Dot. I could put on soothing sounds like running water while snuggling my youngest to sleep. Better yet, I could change the sounds, adjust the volume, etc., all without shifting position to try to reach it and risking disturbing him as he’s drifting off.
Pen and paper!
I’m not joking. That said, this is an approach I tend to use only when there’s a tricky logic problem I need to think through, or when I’m extremely blocked on something. I’ve found it particularly useful for those situations where I’m convinced there’s some magic assumptions in the intended software design but haven’t isolated what they are yet.
Basically, just write code. In pen, ideally, so you can see where your edits were after the fact.
Then, if it’s code that’s useable, type it in and (compile|test|whatnot). There’s something particularly satisfying about typing code in from longhand and having it work correctly the first try. I mean, you don’t always succeed at that, but it’s very satisfying when you do.
Along this line, I’ve occasionally unblocked myself by pulling together a collection of snippets of related code (e.g., callers and callees at different levels) and then printing them out. It’s an old-school way to do it, but I think there’s still something to be said for tracing through listings with a pen and annotating them or drawing arrows as you go. And putting related chunks of code together on one page can reveal things in a very different way than jumping from file to file on screen.
^this. paper and post-its on a whiteboard, where you can glance over the whole problem domain. It also helps tremendously to find your flow again, if you’re interrupted often (kids, seniors, paket delivery, …).
Sounds like you’re doing it right. Removing an entire class of distractions altogether is gonna work way better than will power.
I mostly code in Go and use
go doc -all <package name>
to view documentation. It’s fast, convenient, and works offline!You can also use
godoc
to have your local godoc.org for packages you have locally. Since go 1.13 you have to download and compile it separately.Yep, but I prefer
go doc
because it’s in the terminal and I don’t have to download anything extra.last year I did Train Jam, which is a game jam on a train from Chicago to SF. It takes about two days, and there’s a stretch of about 20 hours where you have no internet.
I took a Raspberry Pi and one of those external batteries that’s used for charging cellphones. I configured that as a WiFi access point, and then put all of my documentation on the Pi. Unless you’ve overridden your DNS settings, you’ll pick up DNS through the access point, so I had the Pi setup as a DNS relay where I could override specific domain names and point them at the Pi itself. I also put an IRC server on it, installers for various tools and game engines, a small file server, and configured a git user for putting repos on the Pi. It was great. We had a team of four people, chatting on IRC, sending links to docs, pushing and pulling to the Pi for our code sharing; we basically had all of the parts of the internet that were consistently helpful in doing our work, and none of the parts that were just distracting.
But more regularly at home I simply leave my phone inside and read a book on the porch, away from all the stuff to remove all of the distraction.
Yes, I work the same way, it helps me manage my ADHD.
Things that help me solve problems without needing to go online:
mirror
to download a website for local viewing./etc/hosts
like0.0.0.0 google-analytics.com www.google-analytics.com
, so the request will fail quickly with ‘no route to host’. Bonus: this speeds up online surfing, too.xxx
is usually calledxxx-doc
, so runapt-get install xxx xxx-doc
instead of only installing xxx.locate
(find file anywhere in filesystem),find
(find file under current folder),grep
/rg
(find files containing text, andless
(displays files, includingman
manual pages).less
): keep a copy of thisless
cheat sheetThings that help me look things up as little as possible: emprace the exobrain.
code2png
.import pdb; pdb.pm()
starts a post-mortem debugger. When you get an error in an interactive session (such as a Jupyter notebook), this will jump to the scene of the error, let you inspect local variables, and let you walk up and down the stack. Ofter quicker than searching for others who got the same error message.pdb
command reference. NB:ipdb
andpudb
are even better debuggers.I have two computers setups for what I call “ascetic computing,” which are minimal interaction machines; they:
I just use
git
, whatever compilers I need, and theman
pages for the most part. Getting a good workflow with my editor & version control system was pretty big, and being disciplined enought to make sure I pull before starting to code and push after I come back is key, but otherwise it’s pretty natural for me.It really reminds me of when I was young, and would code just by
man
pages and local version control…FWIW, which is perhaps not much, I’ve had some success doing this with a screen on the border of my field of vision.
https://rant.gulbrandsen.priv.no/images/arnt-desk.jpg is around half of my office. The top monitor is connected to a minimac and is used only for internet things, including team chat and suchlike. I am typing this on the minimac. All development takes place on the lower screens, connected to a shuffle mini-pc running linux. The minimac and screen was bought because I was required to have slack running, but I wanted it far from my vield of vision.
This is a bit of a hack: The top screen is just distant enough, above, that things there aren’t immediately visible. I ear glasses, and the top edge of my glasses “is at” the bottom edge of that screen. Once I get into the zone, what happens on the top screen is just distant enough that I don’t pay attention, and using the KVM to move my keyboard there doesn’t happen much.
Getting into the zone isn’t always easy, though. Sigh.
Honestly, I don’t think I could do offline programming on any regular basis. The kind of blockers that I cannot get past on my own are not the kind that can be dealt with even if armed with 100% comprehensive local documentation for languages, libraries, packages, APIs, etc. For me to get unblocked, I usually need to get on Slack to ask colleagues about some nuance about our codebase; or I need to hit the Internet with a copy-paste of some error output or stack trace message.
The test suites I deal with on a day to day basis execute parallelized in double-digit numbers of remote containers, and still take tens of minutes to run. A local run is so resource-costly that essentially nobody on the team does that any more. (We each only run a tiny subset of the suite related to whatever we’re working on at the moment.) We also have so much third-party integration by now that even local development requires Internet connectivity for authentication to the app(s).
When on flights, I’m always looking to get on-board wifi, just so I can get things done.
For me, hitting CTRL+SHIFT+B in chrome to hide the bookmarks bar when i begin work has worked wonders.
I have several office machines, each with a different level of connectivity. My main development machine, for instance, can’t get social media. That’s because I don’t want to be distracted by that crap when I’m trying to solve problems. My presentation/streaming machine doesn’t get any kind of pop-ups. I have one place in the entire house/office with FB messenger installed, and it’s in an inconvenient place. When I want to tweak things, I use my pi-hole.
I’ve used Kiwix in the past to keep an offline copy of StackOverflow and Wikipedia.
I do agree that offline time is useful for tasks related to productivity, though I find it makes research tasks more difficult.
[Comment removed by author]
In my experience, at least for my tech stack of choice (Go primarily), the main tool I need for effective offline development is the habit of using TDD. When I follow TDD practices, I find that my code works pretty well in isolation, and can be tested and developed easily without access to any network.
A couple of years ago I let myself get lazy, and built an OAuth flow without proper TDD. Then I had a trans-atlantic flight (back when those were still possible, aaah the good ol’ days….).
I spent the first half of the flight writing an OAuth implementation that would work without a server, so that I could continue development.
Obviously this isn’t a complete answer. It’s just the one thing I found that I kicked myself over when it bit me.
The godoc binary from the go package is nice. By simply running the binary, you have all relevant docs presented on http://localhost:6060.
For me
go doc {package_name}
in combination withgrep
works the best. Then you can even avoid running browser.I use different computers for different activities on different projects in different ways. I do a lot of work on my OpenBSD laptop because it doesn’t run most of the tools I use professionally but I can jump to machines that do. The modern browsing experience on this thing is not good. I do what I need to do, then get off the computer.
I’m fortunate enough to have been working on a computer that runs CP/M for a customer. I’ve had quite a profound experience using it. Doing one thing at a time in one session at a time allows me to remain much more focused. The web is not a thing on CP/M. I’ve been writing the manual for this thing in restructured text on the device itself today because it’s that good for distractionless writing.
For me, I think adding friction and removing distractions are some of the best things I’ve done for my workflow. Removing distractions helps focus. Adding friction slows me down to think about the problem instead of tweaking bashing build till it works.
It depends a lot on your environment obviously. I’m mainly developing native code on Windows, so:
For me, you never know what obscure mailing list will have a hint, let alone a solution to the issue you face. Trying to save everything you can think of locally won’t be enough,
The other fact is I have to work with machines that are not the same platform as the machine I work on. (I have one in the basement, but it’s ancient and I have it because I’m a freak.)