divider

Installing & Tweaking CyanogenMod 7 on a Samsung Galaxy Ace from Debian

Or: How I Broke My Phone And Then Fixed It Again

I will preface this by saying that I did a terrible job backing up my contacts, text messages, apps and phone settings before I tried to re-flash my phone. Don’t do that. It’s a pain.

I have a shiny phone, called a Samsung Galaxy Ace, and it runs a well-known version of Linux called Android (please stop me if I’m patronising you). I feel very lucky to carry around such a fancy little computer in my pocket all the time. My favourite free apps that I’ve found are MIUI music player, Dolphin internet browser, and F-droid, which is a repository of free and open source software for Android phones. The only app I have actually paid money for is Cogs, which is a completely amazing steampunk puzzle game.

The version of Android that my phone came installed with was some bizarre combination of what Samsung and Orange thought that I would enjoy, which disabled quite a few of the phone’s more interesting features. The nice thing about these phones, however, is that you can install different operating systems on them. I chose CyanogenMod mainly because I had heard of it. Here is a walkthrough of CyanogenMod 7 if you are curious about what it looks like.

I followed the phone-specific instructions on this website for installation. Before following the instructions, please remember to back up anything important using your phone’s native features and also in a second way. I used Titanium Backup, which didn’t work well at all for me. Pick something else.

In brief, the version of CyanogenMod for the Galaxy Ace is codenamed “cooper”. You can read about it on the CyanogenMod wiki, and download it from here. Incidentally, installing it on your phone is terrifying and I really don’t recommend doing it while hung over on December 29th.

I, rather cleverly, managed to lose all my contacts thanks to my aforementioned failure to back them up properly. Fortunately, Orange kept a backup for me (if you are with Orange, yours are downloadable from here). It’s an odd list of old and new contacts, which you can export in comma separated value (csv) format. I went through and pruned out a couple of ex-boyfriends and all the empty columns. I ended up with a csv file that looked like this:

Other Phone,Mobile Phone,First Name,Last Name
01xxxxxxxxx, 07xxxxxxxxx, Joe, Bloggs

There’s probably an easier way to put them back onto your phone via an app, but I decided to try and convert them to VCard format so I could import them directly. I wrote a python program to do this that you can download: csvtovcard.py. If you put the program in the same folder as a csv file (formatted as above) called “Contacts.csv” and run the program, it should output a file called Contacts.vcf which contains all your contacts. The main thing I learned from this is that putting spaces at the end of lines really, really breaks VCards.

So, I had my contacts back. I also tried restoring all my apps from Titanium Backup. Don’t do that. I ended up in a situation whereby I had CyanogenMod installed, with several bits broken (including wifi and email), and I needed to re-install to see if I could fix it. I didn’t get around to this until 3 months after installation, by which point I had lots of text messages from my loved ones that I wanted to keep hold of.

It turns out all text messages are kept on an SQLite database on the phone. It’s in a protected area that isn’t mounted when you connect your phone by to your computer via USB. You can find out where it’s kept by typing the following commands in a terminal emulator on a rooted phone:

su
file | grep -i mmssms

When you find mmssms.db, you can copy it over to your computer using the USB android debug bridge (ADB). It’s available for various operating systems, but you can download it for Debian as a package from here. After installing ADB, type:

abd pull /path/to/file ./

There are probably all kinds of clever things you can do to restore your text messages, but I just wanted to look at them, so I installed sqlitebrowser from the repositories and open up the file occasionally to remind myself how funny and lovely all my friends are.

The moral of this story is: try not to break things – and if you do, try to fix them afterwards.

Posted in Geeking | Tagged , , , , , , | Leave a comment
divider

Cellular automaton model of bacterial biosensors

So this fortnight at the doctoral training centre, we’ve been from “Hello World” to image processing in C and Perl. Yeah.

Anyway, before my brain explodes from over-knowledge-ness, I thought I’d blog about the program I made! It’s a cellular automaton (like Conway’s Game of Life) that essentially represents lots of bacteria immobilised on a silicon chip. I based it on this paper from 2004. In my simulation, the cells grow, divide and die based on how much food they are getting from the environment.

The bacteria contain a special gene from fireflies called luciferase, which allows them to bioluminesce. Halfway through the simulation, the cells are bathed in a solution that causes DNA damage. This activates the luciferase gene. The idea behind the original experiment was to use bacteria to sense when a molecule causes DNA damage, in order to screen for molecules that might cause cancer.

A picture of the simulation running

The simulation outputs a rudimentary display to the terminal. The glowing bacteria are represented by the letter “O” and the wild-type bacteria are shown by the “#” symbol.

If you want to read more about the biological background and the implementation, you can read my report, or try compiling and running my C code.

This was a really good opportunity to test out all the things I learned about C this week! In addition, the write-up I handed in was written in LaTeX, which I am completely new to. I’ve uploaded my Tex files (report.tex and code.tex) and the bibliography file (cellularautomata.bib, which was created by Mendeley) if you want to have a look at them – it turns out that the trick with LaTeX is just to have a template file to build on.

I found a useful bit of LaTeX code to stitch two PDFs together (which you can download as a file):

\documentclass[11pt,a4paper]{article}

\usepackage{pdfpages}
\begin{document}

\includepdf[pages={1-5}]{writeup.pdf}
\includepdf[pages={1-7}]{code.pdf}

\end{document}

Pretty cool, huh? I’ve put all the LaTeX bits together in a .tar.gz file here. To extract and compile, run these commands in sequence:

tar -xzvf tex-files.tar.gz
pdflatex writeup.tex
bibtex writeup.aux
pdflatex writeup.tex
pdflatex writeup.tex
pdflatex code.tex
pdflatex stitch.tex

Posted in Geeking, Science | Tagged , , , , | Leave a comment
divider

Abzymes: tiny factories made to order

I wrote this for the Wellcome science writing prize. It didn’t make the shortlist, so I can publish it here!

Enzymes are the machines of the biological world. In our bodies, they break down our food, fight off invading bacteria, turn sugar into energy, and perform all the processes that keep us alive. Honed by millions of years of evolution, they perform reactions at lightning speed – thousands of times faster than they would happen naturally. Chemists look on in envy as enzymes effortlessly do things that would take them millions of pounds of equipment, and often several years, to copy.

At home, we’re all familiar with enzymes as the secret behind biological washing powders, which clean stains at low temperatures. Commercially, enzymes are used to recycle paper, as well as in septic tanks, and even in kitchens as meat tenderisers. And they do this all at room temperature, without help from strong chemicals.

Making enzymes that perform any reaction we want could revolutionise modern living. Imagine soaking your potatoes in an enzyme bath that takes the skins right off, no peeling necessary. We could make enzymes to break down oil spills into harmless substances, make new medicines that target specific cancers or infections and destroy them – or even make a magic spray that eats away the horrible sticky marks that price labels always leave on books, without destroying the cardboard covers (this one is a dream of mine).

So why haven’t we done this? Well, enzymes need to be a specific shape in order to work at all. Unfortunately, enzymes are a type of protein, and we still don’t know how to make proteins that fold into the shapes we want. A protein chain will always fold into the same shape, time and time again – but the forces behind this are, for the most part, a complete mystery. Until we know this, it’s impossible to make artificial enzymes that are anything other than floppy, useless messes.

We can copy proteins from the natural world, stealing structural sections and active sites and mashing them together. But – if the enzyme produced is even functional – we’re still limited to reactions that real enzymes already do catalyse. So, we’re stuck in this situation, where we can’t design our own enzymes, because we don’t know how to make the structure. But what if we could side-step that problem altogether, and make evolution do the work for us?

Enter antibodies. Antibodies are the first line of defence your immune system puts up against invading germs. They’re proteins as well, and they bind very tightly to specific parts of the bacteria or virus your body is fighting, signalling to the rest of the immune system to come in and destroy it. New antibodies are produced every time your immune system comes across a new pathogen. Antibodies are very specific – each antibody binds to one thing, and it binds that one thing very well indeed.

Scientists raise specific antibodies against a particular molecule by injecting it into a rabbit or a mouse. The animal’s immune system then makes new antibodies against the unfamiliar molecule, which can be taken out and grown in a petri dish.

But what use is a protein that just binds tightly to something if you’re trying to make an enzyme? Well, enzymes use a lot of different tools to make reactions happen. But if we take a step back and look at the whole picture, one common theme underpins them all: enzymes bind the most tightly to the intermediate stage of the reaction they supervise.

Take, for example, an enzyme that converts starch into sugar. It will bind to starch fairly well to start things off, but it will twist the starch molecule out of shape, because it really wants to bind to the intermediate. The intermediate’s structure isn’t quite starch, and it isn’t quite sugar, but it’s something in between. This twisting puts a strain on the starch, making the molecule react and form the intermediate. Intermediates are always unstable molecules, so then the intermediate will rapidly turn into the final product, which is sugar. Et voilà, the reaction has occurred.

So if we can create a stable version of this intermediate and create an antibody which binds to it, we’ll have a sturdy protein shape that catalyses a reaction the way we want it to – no assembly required. These new biological machines have been dubbed “abzymes”, and have already been used to target and inactivate the HIV virus.

Without having to unlock the secrets of protein structure, we’ve managed to make custom, functioning enzymes, just by relying on the immune system to do the work for us. Abzymes: lazy science at its best.

Posted in Science | Tagged , , , , , , , | Leave a comment
divider