2 May 2020
Familiar with password forms like this?
Restrictive password rules are not just frustating and unhelpful for people trying to manage logins for a multitude of sites; they (officially) do not do much for security on your website.
Read More
25 Apr 2020
Every time I take my hands off the keyboard and reach for the mouse, and drag the mouse across the desk, I’m losing time. I’m going slower and moving out of flow. It’s especially true when I’m working with a large monitor, or dual-monitors, and I have to moooove the mouse all the way to where it needs to me. Or the mouse cursor has disappeared on me, and I have to frantically slide the mouse until the movement traps my eyes and I can see where it is on the screen.
We all know the basics are Cmd+C for Copy, Cmd+X for Cut, and Cmd+V for Paste.
Read More
1 Aug 2019
productivity, time management
These are my reading notes & a quick summary. If we’re aiming for big things, it’s easier to succeed if we get the small details right.
Read More
30 Oct 2018
macintosh
Okay. So I had a problem with my Mac. Basically, about 10 minutes after a restart, the application switcher and the dock would stop working. Whichever application I had at the front (chrome, terminal, editor whatever) would be fine but I won’t be able to load or change to any other application. Alt-Ctrl-Esc would work, so I could kill applications, but that wasn’t particularly helpful.
The cause of the problem took FAR TOO LONG to track down. It was apache. More specifically, I had installed Homebrew’s Apache and the built-in version of apache hadn’t been disabled properly, so they both started up on a reboot. NO IDEA why this broke the dock.
(Note: I had setup apache using this guide macOS 10.14 Mojave Apache Setup: Multiple PHP Versions – and thank-you grav people, very helpful.)
If I killed all the httpd processes (sudo pkill httpd
) immediately after the restart, and then restarted apache I was fine but that wasn’t exactly a longterm solution.
This command should stop the running instance of Apache, and record that it should not be restarted.
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
But it gave the error:
/System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service
Basically, the native OSX instance was still running, but it had become separated from launchctl, so launchctl couldn’t unload or stop it.
First of all, I took the brew apache out of the picture
brew unlink httpd
Then try
which httpd
This showed /usr/sbin/httpd
Okay, we can now FINALLY see the OSX apache. Try restarting it.
sudo apachectl restart
It gave this error:
Address already in use: AH00072: make_sock: could not bind to address [::]:80
That’s my problem. Because of this error, the apachectl process would start up, but the launchctl couldn’t shut it down properly.
A little bit of headscratching, but fixed by editing the apache config file (for OSX, not brew apache) /private/etc/apache2/httpd.conf
and setting:
ServerName 127.0.0.1
Now the command sudo apachectl restart
works. And sudo launchctl unload ...
also works.
Restart the mac, check the processes and (hurrah) no httpd processes found.
Link brew version back up.
brew link httpd
brew services restart httpd
Normality restored. But it took me a long time to get there.
Pretty sure all this kicked off when I upgraded to Mojave 10.14.
TL;DR launchctl thought it had properly shut the apache process down, but the apachectl agent refused to stop because reasons, resulting in a decoupled process
25 Feb 2018
And I’m sure I’ve bumped into it before, but today I got confused all over again, so I’m writing it down so I know where to look the next time I get confused.
I had problems with a webpage which couldn’t load a javascript file – the server gave me a 403 (forbidden) status code.
The command ls -l
shows
-rwxr-xr-x@ 1 bronwen staff 22691 24 Feb 19:17 jquery.validate.min.js
and the @
sign means that the file has extended attributes
Run ls -l@
to see the extended attributes
-rwxr-xr-x@ 1 bronwen staff 46285 24 Feb 19:17 jquery.validate.js
com.apple.quarantine 26
The com.apple.quarantine
extended attributes are part of the file quarantine feature that Apple added yonks ago (OS X Leopard – 2009?). From the release notes for OS X Leopard
File Quarantine is a new feature in Leopard designed to protect users from trojan horse attacks. It allows applications which download file content from the Internet to place files in “quarantine” to indicate that the file could be from an untrustworthy source. An application quarantines a file simply by assigning values to one or more quarantine properties which preserve information about when and where the file come from.
To remove the file from quarantine:
xattr -d com.apple.quarantine *
And to remove ALL FILES in the folder from quarantine:
find . -iname '*.js' -print0 | xargs -0 xattr -d com.apple.quarantine
12 Jun 2016
php
I think it was Rasmus Lerdorf who once quipped PHP is like English. I can’t find the exact quotation, but it went something like “Yeah, PHP has quirks and isn’t the most elegant, but it’s simple overall and easy to get started. Look at English. Full of exceptions! But having a lot of exceptions and grammatical inconsistencies didn’t prevent English from becoming the dominant natural language.”
The analogy stuck with me. Like PHP, English is a relentlessly pragmatic language that’s relatively simple with a ton of gotchas.
From What do non-native English speakers think of the English language?
7 May 2016
macintosh
Basically, root is no longer all powerful – there are some things even root account cannot do! Official name is “System Integrity Protection” I’m writing all this down so next time I run into the problem and start googling, I’ll find my own notes.
I was trying to rename / remove the previous version of php
sudo mv /usr/bin/php /usr/bin/php55
This failed with the error “Operation not permitted”
When I try ls -lO /usr/bin/php
I get:
-rwxr-xr-x 1 root wheel restricted,compressed 10577504 3 Dec 06:35 /usr/bin/php
restricted is a new flag for El Capitan. Basically Apple has added a whole new layer of security in OS X. They have taken away some privileges from root. If a file has a restricted flag, only restricted processes which are signed by Apple will be able to modify them. However, you can disable this security system by booting in recovery mode and disabling it in a Terminal by running the command:
csrutil disable
And for all the exciting details: https://apple.stackexchange.com/questions/193368/what-is-the-rootless-feature-in-el-capitan-really
1 Apr 2016
I have been reading Double Cross: The True Story of The D-Day Spies by Ben Macintyre and the thing I am going to remember the best is … The Pigeon Contamination Plan
Flight Lieutenant Walker was head of ‘The Pigeon Service Special Section, B3C’, charged with disrupting the enemy’s use of pigeons, and deploying Allied pigeons for passing on secret intelligence.
Walker was convinced that Nazi pigeons were now pouring into Britain, by parachute, high-speed motor launch and by U-boat, providing enemy spies in Britain with an undetectable method of sending information to occupied Europe.
Read More
9 Mar 2015
I have only recently learnt about this – it’s a nice trick available from the Firefox Developer Toolbar
The Developer Toolbar is NOT the same as the Web Developer menus – it’s a command-line which gives you access to a number of developer options from within Firefox.
Press SHIFT+F2 to open the Developer Toolbar.
Once the toolbar is open, you can tell Firefox to take a screenshot of the current viewport with this command:
screenshot homepage.png
You can pass an additional argument to get a screenshot of the entire page:
screenshot homepage.png --fullpage
All images are saved to the browser’s default download directory.
11 Nov 2014
people, working
This animated film is a tribute to Jiro Horikoshi, who designed the Zero fighter plane used in the second world war. (I’m assuming that tribute means you don’t have to worry too much about historical accuracy). It ends before Pearl Habour, but there are some flash-forwards and we the audience all know how it ends, but this film isn’t about the glories or the horrors of war.
It’s about aeroplanes, and learning things, and being in love with your work, and the joys of making something beautiful. There is a romantic love story (the love interest has consumption and dies beautifully and it’s all very heart-breaking), but it’s really not the heart and soul of the film. The heart and soul is work. There aren’t enough films about work and what people do all day.
Also we have the immortal line “Gentlemen, behold the miracle that is extruded aluminium”.
However, there is one change I’d like to make: in the film Horikoshi is in love with aeroplanes from childhood onwards; in real life Horikoshi studied aeronautical engineering because it seemed like a good idea at the time (I paraphrase slightly from wikipedia), and I’d really have liked to have seen this happen in the film.
Very few adolescents have any idea what they want to do in life, and having a career advisor or a motivational speaker tell you to “do what you love” is really not helpful at all. I’m much more about the “do something, get good at it, love it”.