## The Midlife Geek

### Ramblings of a middle aged engineer, runner and open source enthusiast

#### Category: Computing (page 2 of 5)

Project Euler problem 21 is to find the sum of all amicable numbers under 10000. An amicable number is:

Let $$d(n)$$ be the sum of proper divisors of $$n$$ then $$d(a)=b$$ and $$d(b)=a$$ if $$a!=b$$ then $$a$$ and $$b$$ are amicable numbers.

Problem 13 is summing a list of fifty digit numbers. I used the gmp library and R to solve in 2 lines:

library(gmp)
print(substring((sum(as.bigz(readLines("euler13.txt")))), 0, 10))

Not much more to say really. I forgot the problem asks for the first 10 digits, so my first answer was wrong.

OK so today I’m trying problem 12 – find the first triangular number with over 500 divisors. This is the first Project Euler problem I’ve really struggled to find a solution in a reasonable amount of time. Continue reading

I’m beginning to like R. You can capture table data from a connection (a generalised file), one of which is the clipboard, to a data frame.

problem.matrix <-
as.matrix(read.table("clipboard",sep=" "))

I got Visual Studio 2017 through Microsoft’s Dreamspark promotion and thought I’d give it a try. I haven’t done a lot of development under Windows because its only on my laptop and my Linux desktop has 12 Gb RAM.

This is a quick post to remind myself of the stuff I do when re-installing Arch. Continue reading

My wife’s laptop is an Asus X541SA – a fairly generic and inexpensive workhorse. With a Quad-Core N3710, 4Gb of RAM and a 1TB HDD. Unfortunately its ridiculously slow. Opening, switching and closing applications leaves time to make a cup of tea and clicking save in Word is likely to see a “(not responding)” caption in the title bar.

A quick look in task manager shows the HDD is perpetually at 100%. Having already tried a clean install of Windows 10, I figured an SSD might help. I got this 120 Gb SanDisk SSD, having used them before with good results.

What a difference it makes, the laptop is not only usable but responsive. While I doubt it would handle many games it can at least cope with Office and Firefox, which it couldn’t before.

This tablet was super fast when I got it but now it lags and drives me nuts. I’d seen someone post on Reddit that flashing the factory image helped so I gave it a go.

Factory images are available here along with good, clear instructions. One caveat, Arch needs super user for fastboot otherwise you get “< Waiting for device >”. For the same reason run flash-all.sh with sudo too.

As to whether or not it helped, it is hard to say but I feel it has. How do you measure something that is entirely subjective?

Edit. Its been a few days now and it is faster. Much faster and without lag. I’m unclear why though. I’m not completely familiar with Android’s architecture but wonder if it’s a combination of multiple updates being applied (this was I think Android 5.0 when bought) and accumulated futz.

An Android fitness tracker application. Feedback from the preparation forum was positive, there is enough scope to expand or contract the project as needed. Importantly, it is “substantially within the sphere of information technology”.

Taking approaches from IT Systems Planning for Success (TM353) and an Agile approach from Software Engineering (TM354) meets the requirements. There is a substantial part of the application that needs synchronise with a server, utilising another level 3 module Developing Concurrent Distributed Systems (M362).

What I haven’t decided is the title!

Android Studio is a great development environment and is available on Ubuntu. I’m using Ubuntu Mate 16.10 “Yakkety Yak”.

First install a Java Development Kit (JDK). OpenJDK is pre-installed or you can use Oracle Java 8 (there is a great guide here). I don’t wish to argue over your choice – I need to use the latter (my tutor does). Download Android Studio here. – I extracted it to /opt; ran the installer; and used my home folder for the SDK. If you are using 64 bit, you need the 32 bit GNU standard C++ library:
sudo apt install lib32stdc++6

For Arch you need to enable “multilib” repository:

<code><span class="pln">sudo pacman </span><span class="pun">-</span><span class="typ">Syu</span> <span class="pun">&amp;&amp;</span><span class="pln"> sudo pacman </span><span class="pun">-</span><span class="pln">S multilib</span><span class="pun">/</span><span class="pln">lib32</span><span class="pun">-</span><span class="pln">libstdc</span><span class="pun">++</span><span class="lit">5</span><span class="pln"> multilib</span><span class="pun">/</span><span class="pln">lib32</span><span class="pun">-</span><span class="pln">zlib</span></code>

Virtualisation support is interesting. I read two tutorial and Google’s guide. The former makes reference to command line options not in version 2.2.2. These posts suggest this is a bug, but it may now be default behaviour. First enable that virtualisation in BIOS (check if enabled using “kvm-ok”).

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
sudo adduser dougie libvirtd

This results in an error.

Using the system version of libstdc++.so.6 works. Add the following to /etc/environment:

ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

It seems snappy but with no feedback I’m unsure if accelerated.

So I now have a development environment set up for my project. The next hurdle is to choose a title. So far it is a: development project; distributed application; and uses Android.