Using Android ADB over WiFi

I am debugging some code that requires a peripheral plugged into the phone’s USB port so I needed to be able to run adb’s logcat (and install functions) over WiFi. I found this page with the information required, the key points are repeated here for convenience.

The phone needs USB and WiFi debugging enabled in Settings->System->Developer options.

Plug the phone into the PC and enter the following on a console terminal:

adb tcpip 5555
adb connect <ip address of phone>

The phone can now be unplugged from the PC and the peripheral connected instead. As usual, to install an apk, use:

adb install -g <filename>.apk
adb logcat

Setting up an NVMe SSD on Ubuntu

I need a fast PC for some current work and decided that it’d be nice to use an NVMe SSD to speed up storage. I am using an Intel 750 PCIe 3.0 x4 add in card as it’s a simple way to go. Ubuntu has the NVMe driver built in so it came up straight away as /dev/nme0n1. One small issue is that gparted doesn’t seem to think this is a disk so it’s a case of reverting to old school command line stuff to get it set up for use.

First off is to create a partition:

sudo fdisk /dev/nvme0n1

Choose “n” to create a new partition, then “p” then “1” to create a new primary partition. Just use defaults for the sector numbers. Then “w” to write the data to the disk.

To create a file system on it:

sudo mkfs -t ext4 /dev/nvme0n1p1

Then create a mount point somewhere convenient:

sudo mkdir /media/nvme

Then mount the new partition on that mount point:

sudo mount /dev/nvme0n1p1 /media/nvme

At this point, the whole thing belongs to root which may not be what’s wanted. To change the ownership to a specific user (with the partition mounted):

sudo chown -R <user>:<user> /media/nvme

To get it to mount every time, add a line to /etc/fstab:

UUID=<nvme UUID> /media/nvme ext4 defaults 0 0

To find the UUID, enter:

sudo blkid

and then cut and paste the UUID for the NVMe drive.

To get some idea of performance, the hdparm command can be used.

Completely deleting a project from Xcode

I have to say that I consider the whole process of developing with Xcode deeply annoying. I recently had a problem where it claimed that I needed to set a development team for signing even though I already had. After spending a lot of time deleting, recreating projects etc etc, I realized that clearly Xcode was keeping some information elsewhere that was causing the problem.

Turns out that it caches some information in:


Each project has a folder here. I deleted any folders that had the same name as my project and that fixed the problem. Ugh. And don’t get me started on bitcode…

Java: converting a float to a byte array and back again

Many physical variables are best represented as floats and sometimes it is necessary to pass these variables across a network link. Floats are very standardized and can be safely passed around between different architectures and operating systems but need to be converted to a byte stream first (something like JSON can send floats as strings but this is pretty inefficient in time and space). In C or C++ this is pretty easy but Java is strongly typed and doesn’t make it easy to convert a float value to a byte stream and vice versa. However it can be done…

public void convertFloatToByteArray(float f, byte[] b, int offset) {
   ByteBuffer.wrap(b, offset, 4).order(ByteOrder.LITTLE_ENDIAN).putFloat(f);

public float convertByteArrayToFloat(byte[] b, int offset) {
   return ByteBuffer.wrap(b, offset, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat();