:::: MENU ::::

Tip: Fix Composer package 404 errors with continuous integration servers

Is PHP’s composer package manager pulling in dependencies successfully on your development machine but failing on your continuous integration server? In my case, Drone.io, the young, ludicrously simple CI platform, was failing in setup of a PHP project because of strange 404 “Not found” errors.

drone.io illustration

drone.io’s bug hunting, er, drone

The solution is to use a flag with your “composer install” command: “composer install  –prefer-source”.

The explanation is that composer users GitHub’s API to fetch packages, and it uses it anonymously by default. Anonymous users have a strict call limit – 60 per hour per IP. That means that for a hosted CI, only 60 calls can be made to GitHub for potentially thousands of customers. When the limit is reached, GitHub returns 404 (not the most helpful error given the context).

Thanks to Pagoda Box for researching this solution.


Manually pair bluetooth devices on Linux via CLI (NFC workaround)

Today my new Thinkpad bluetooth keyboard arrived. It’s beautiful; I’m thrilled. It’s such a better companion for my XPS 15 9530 laptop than my old Penclick K2 the two don’t even compare.

Thinkpad bluetooth keyboard

Lenovo ThinkPad Compact Bluetooth Keyboard with TrackPoint

NFC comes built in to the new keyboard,  but unfortunately Gnu/Linux doesn’t support NFC well yet. Although NFC support is built in to the Linux Kernel, neither Gnome nor KDE have any support for it, and the number of NFC enabled apps in my Fedora 20 repository is princely zero. NFC won’t help me out pairing my device, so we need to do it the old fashioned way instead.

Unfortunately, it seems that my shiny NFC chip gets in the way of bluetooth pairing. Gnome network manager (using gnome-bluetooth) fails to connect to the device for an unstated reason. Rather than debug network manager (not fun in my experience), I decided to pair the device manually for more verbose output and another shot at success.

Since the release of Bluez 5 – the “Official Linux Bluetooth protocol stack” – command line Bluetooth interaction has become far more pleasant (and more colourful). Bluez 5 comes with a new command line client built in, superseeding the old collection of separate scripts called “simple-agent”. Here’s how to use it to pair your Bluetooth device, avoiding pitfalls of the network manager GUI.

Start the Bluez command line client:
bluetoothctl

list available devices (you can also search for new ones separately):
devices

Note the MAC address of the devices that you wish to pair. E.g.:
90:7F:61:11:0E:52

Pair with the device:
pair 90:7F:61:11:0E:52

Trust the device (skip the laborious code entering step for keyboards):
trust 90:7F:61:11:0E:52

Finally, connect the device:
connect 90:7F:61:11:0E:52

Try out the connectivity – it should now work. In my case the keyboard is tapping away as I write this text. Good luck!


Prevent Git history re-writes with denyNonFastForwards on GitHub & BitBucket

As you may know, I’m (still) in love with Git. One of the reasons is it’s power, but, occasionally, that power allows you to shoot the rest of your team in the chest. Or delete their commits and wipe them from history (which feels about the same).

You can do this by forcing your pushes upon other git servers, using git push -f. As #git IRC‘s resident bot says, this is a bad idea:

Rewriting public history is not recommended. Everyone who has pulled the old history have to do work (and you’ll have to tell them to), so it’s infinitely better to just move on. If you must, you can use `git push -f <remote> <branch>` to force (and the remote may reject that, anyway). See http://goo.gl/waqum

It continues:

[!force_push] If you need to overwrite the history of a remote git repository (very bad idea, see !rewrite), you can do so with `git push -f`.  Note the remote server may reject this.  See man git-config and search for receive.denyNonFastForwards.  Best practice is for upstream servers to denyNonFastForwards.

If you don’t want team members to be able to rewrite time and wipe away a combined team’s work at the same time, you can do as the computer tells you and configure NonFastForwards by executing the following on your git staging server:

git config recieve.denyfastforwards true

That will tell the server to refuse receipt of commits that do not follow naturally from commits already received.

What if you don’t have access to the remote server directly however? Fear not, it’s still possible.

BitBucket

Thankfully this features was added in 2013, and you can configure it as administrator of a repository via the web interface.

  1. Log in
  2. Go to your repository URL (or click on the repository name). E.g. https://bitbucket.org/your-repo
  3. Click on “Settings” at the bottom of the left NavBar
  4. Click on “Branch Management”, under “Settings”, submenu “General”
  5. Find “Prevent history re-writes (rebase) on these branches”, type “master” into the field below it, and click “Add”

GitHub

Although GitHub currently provides no public interface for this functionality, it is apparently possible by contacting GitHub support directly and asking for the option to be set.

Do you know how to set this using GitLab? Share your how-tos for other platforms in the comments.



PHPList API sprint: results

The last two days I’ve been sprint-hacking the PHPList public API. What is PHPList, why an API, and what is a sprint-hack, you may ask. The first is a Free Software MailChimp competitor established 10 years ago, and available to install or use as a service. The second is for calling PHPList actions remotely (such as sending a newsletter), and for easy integration with other apps and websites. The third I guess you know: a hacking sprint is a short burst of effort to write or improve a project, typically (but not always) code.

PHPList logo

Continue Reading



Backup multiple email accounts automatically on Linux

ball of emails

I launched a new personal website last week, and changed my domain registrar and hosting company in the process. Being concerned how this would affect my primary email account (mail at samtuke dot com), and keen not to lose any of the 10.000+ messages that are stored there, I set about backing them up to a local folder. I also have an ancient Hotmail account, dating from 1997, containing all sorts of childhood contacts and life affecting discussions, and since Microsoft finally decided to allow users gratis use of the IMAP protocl, I decided to back up both email accounts to save time. Continue Reading


Get ArkOS up and running on Ubuntu in a virtual machine

So you’ve heard about the plucky new all-in-one host-it-yourself Linux distribution that’s turning Raspberry Pi’s into Freedom Boxes? ArkOS is a nifty little Arch Linux spin-off with slick marketing and granny-friendly interface. Yes it runs owncloud, dovecot, XMPP, transmission, and many more. Fortunately you don’t need a Raspberry Pi to give it a spin: here’s how to run it on Ubuntu machines. Continue Reading


What Heartbleed means for Free Software

The bug in OpenSSL nicknamed “heartbleed” that was discovered this week has been labelled “catastrophic“, “11 out of 10” for seriousness, and credited with “undoing web encryption“. It reached the height of mainstream press yesterday with dedicated front page articles on The Guardian and and The New York Times. This Free Software bug is now known worldwide and is set to remain infamous for years to come. So what does all this mean for the reputation of Free Software? Continue Reading



Pages:12345678