List of Fun things to do with the Raspberry Pi (tiny computer, not desert)

I recently acquired a Raspberry Pi 1B. Yes, a 1B. Even after seeing the speed of the 2, and looking at the Specs for the 3 and zero, I intentionally opted for an RPI 1. Why? Well, I don’t need all that extra CPU and RAM. I also find micr-SD’s a bit too small and snappable for something that I’d rather not break. Not to mention the challenge of making a highly effective machine with only 8GB!

Click here to view image for your order

Anyway, here’s a list of things I intend to do with it:

  1. Turn it into a (low power) digital music player (so that I don’t have to turn on my phone or desktop to listen to things) – The obvious problem with this is that the raspberry pi doesn’t really come with any input devices, so I’m thinking of playing around with the UEFI interface (a bunch of pins that stick out of the motherboard), or finding a 5 button keyboard (that would look kind of funny, wouldn’t it?)
  2. Set up a didiwiki – This one is a given. I love didiwiki, especially for storing documentation on projects.
  3. Install learnwithtext – I really enjoy this program for language learning (seeing my word-count going higher and higher with loads of tables is extremely satisfying) more so than the commercial ones (not so much due to their content but their form) and would like to be able to access it remotely. Not to mention being able to fiddle with the code!
  4. Write a python chatbot with a webfront – As I said in my last post, I love AI, and despite how I think that hard-AI is a fantasy-like dream in disguise, it can still be a good laugh trying!

And of course, last but not least: Whatever strikes my fancy! Running one’s own constant server has so much potential for things that are just fun.

I Robot: A film review

At certain times of the year, I love Sci-Fi, particularly anything with an dark weird inhuman Asimov flavour. Therefore one of my favourite film is Will Smith’s I-Robot, a story about a futuristic humanity where robots have become highly functional (and cool, I might add). Now this film has been out for a long time, and I’ve always enjoyed sitting down to watch it. So here I would like to do a little analysis of the various aspects of the film (after all, no human story is perfect, leaving space for juicy analytical potential).

For the time (2004), the special effects were very impressive, and drew one into this weird futuristic world. Sadly, unlike, for example Jurassic Park which came out 10 years before), the special effects have not held up as well as I would have liked. That set aside, (as I wouldn’t have wanted them trading off the awesome NS5’s for anything that they could have made more believable in 2004) really the special effects aren’t that bad at all, and, on first viewing, I’m sure one wouldn’t notice!

Plot Taster

The film’s protagonist is Detective Spooner (Will Smith), a highly skilled, but emotional cop with a grudge against all robots (not technology, mind, but rather any attempt to replace humans). He is then put on a case of an apparent suicide with a message intended for him. This leads him onto a fairly complex case with several lines of causality. As he pursues this case, increasingly dramatic things happen, eventually centering culminating in an awesome climax (as you may have notices, I am unashamedly biased in favour of this film).

Image result for I robot

Parallels with the books

Unlike some film adaptations of some other classics (e.g. The Lord of the Rings), this film not only differs quantitatively but also qualitatively from the books. First of all, the story is not an original Asimov story, but rather attempts to tie in with Asimov’s ideas. Doctor Calvin (the lady), for example, is clearly taken from a Doctor Calvin in Asimov’s work. However, in the film, she is portrayed as significantly less cold than in the books. She is a more relatable, less alienating character. This of course, was a good move on the film makers’ part. It also serves to illustrate other changes that were made to the feel of the world, and how they made it more appealing to the modern audience. Another clear difference is that the film assumes the existence of the integrated circuit, which even Asimov didn’t imagine existing back in the fifties. This means that the technology of the film is much more compact, as opposed to the huge clunky grid-connected robots of Asimov’s world.

however, it must be said that despite these changes, one fundemental Asimovian idea was kept: The three laws of robotics:

  1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
  2. A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
  3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.

The film starts by showing these staples of Asimov’s short stories, and continues to use them as a backbone to the major conflict of the story. And being so fundamental, one could say that because of this inclusion, the film really has kept the spirit of the originals by having them play such a major part.

Image result for I robot

Themes

Emotion and Intellect – On my most recent watching of the film, an aspect that really struck me is how the film constantly refers to the apparent conflict between emotion and reason. Detective Spooner starts out as this very emotional person with a confused grudge against robot-kind. In contrast, Doctor Calvin (the lady on the left of the above picture) is shown as a cold, unfeeling engineer. then of course you have Sonny, the most recent breakthrough in Robot intelligence, who is highly skilled, but is also learning to feel reality, and also (once) actualising irrational emotion. Now I thought that this portrayal actually felt a bit clumsy. I would have appreciated a more subtle portrayal of this aspect, which felt a bit unresolved/confused. I didn’t get the impression that the protagonist had really developed much from the plot.

Technology – Obviously, this film very much centres on Artificial Intelligence, in a similarly vague way to how Asimov dealt with it (this mysterious “Positronic Brain”) and although I don’t take hard AI too seriously, I always did find the idea, and it’s potentiality, fun, if anything.

The solution to the three laws of robotics – I must admit, until just now, I didn’t actually understand this. But now I realise that the second part of the first law of robotics creates this loop hole. Not only must a robot not harm a human being, but it must also prevent said human from being harmed. This suggests the idea that robots’ only legitimate solution to best fulfilling the three laws is dominating humanity to such an extent that humans are never able to harm each other. Of course, this is a political assertion, except its object is not a state, but robots. Would you like to live in such a “safe” world?

Conclusion

The thing about most Science-Fiction is that, admittedly, it is all quite boxed-in in comparison to other stories. It does not really centre on life and eternity (like Fantasy, for example) but simply technology, and its potential. This of course makes it fun/cool to watch, but also quite trivial. That said however, I personally put I-Robot high on the list of films that fulfils that aim of Sci-Fi, for it does exactly that: It explores the potential of technology in a fun and exciting way!

On Friendship: Unfinished Assertions

In this post, I would like to explore the idea of friendship. Ever since I read CS Lewis’s “Four Loves”, I have realised what an aid it can be to abstract the nature of human relationships. however, I continue to ponder his ideas. This post is not so much a conclusion to these pondering, but rather an account of some of them, in the hope that perhaps we can find ourselves pondering this idea together!

Of course, each and every relationship that one has with another person has it’s own “soul”, so to speak, and is different from every other. However, I agree with Lewis that there among these complexities, there are certain types. Some relationships are more like some and less like others. I personally find this differentiation useful to reflect upon, in order to value a little more what one has.

In line with this spirit of differentiation, I would like to start by distinguishing friendship from companionship. Companionship is sharing a common interest, like fencing, or memes. I went to the same school as somebody: I was his companion. This is not necessarily friendship, as it does not necessarily indicate sympathy, or even knowing a person much at all. This is not meant to put down companionship, which is all well and good, but simply to distinguish it.

Friendship is a little more substantial than being in the same group, or even sympathising (but rather empathising). Friendship really starts with a realised common ground, a discovered empathy: To paraphrase Lewis: It begins with a “Oh! You too? I thought I was the only one!” moment.

File:WinslowHomer-Eight Bells 1886.jpg

Winslow Homer – Eight Bells 1886

So friendship starts with a moment of empathy. After that, it can grow like a plant in the sun. Of course, like a plant in the sun, it can also diminish. But really I think that’s not to be seen as a bad thing, but rather something to be valued: Friendship, though valuable, is light. Of course, it could deepen, and last a lifetime. For this reason, I agree with the idea that a friendship can vary tremendously in degree, yet remain friendship

Although it is more than a common interest, it also retains a degree of passivity. It may not always seem evident until it’s no longer there. However, it is not apathetic, quite the contrary. Despite this evasiveness, I think it lends itself to frankness, and clarity: A simple alliance.


I must admit, I’m finding this concept extremely hard to put down in words. I hope to continue to formalise my understanding as time goes by. Friendship’s very clarity, and yet lightness, and simple empathy is, I would argue, an extremely undervalued (or perhaps watered down) relationship in this weighted, complex world.

Although, I am not yet satisfied with this explanation, I do hope that it has shed some light on the value of friendship. In future, I hope to formalise my understanding a little more, and maybe even come up with (or find!) a definition that concisely captures the uniqueness and of this subtle human relationship. So would appreciate any gems ye can share on this topic!

Hardship creates greatness

Life is so very complicated, is it not? Well of course the answer is it is and it isn’t… Sometimes the answer one is looking for isn’t anything like the true answer, and most of the time the real answer points to something much more subtle… much more profound:

I hope you like the picture! It was a bit of an accident… But I think it’s beautiful. At the time, I called it “Eternal Rose” probably because I was obsessed with eternity at the time ;) It isn’t really an eternal rose… In fact it isn’t really a rose. It’s square, and wound into the red clouds around it. But I couldn’t exactly have called it “Square picture that looks like a rose in a sea of red cloud that reminded me once of eternity”… now could I?

On that note, let’s start with a rose. Let us animate that rose. It has the will to choose. Now of course it grows naturally from good things… water, sunlight. It needs them to survive. And if something really bad were to happen to that rose, it would be crushed and die. It is really a very fragile thing. However, if something painful, if something annoying, if something hard were to befall the rose, what would become of it?

Now, remember, our rose can choose. It can choose to shrivel and die under hardship. It can choose to give up. But with a little fear, but with more than a little bravery, our rose can not only exist like the normal plants beside it, but it can thrive. It can claw it’s way through the dead log that has fallen on top of it, and stretch its way into the light.

Would it not then be a greater rose?

Culture and Change

α: What exactly does one mean by culture?

β: By culture, one is referring to the form of a people. Just like a jug is a specific form of glass, so is culture a specific arrangement of people. Therefore this is clearly a very wide-ranging term and covers everything from language to specificities. An example of the latter extreme would be the fact that such a town in Wales has a wonky signpost near it’s oldest train station. Of course, when one refers to culture, one is generally referring more to the former type of culture (language and customs) but for the sake of coherence and clarity, it seems to make more sense to define culture more widely.

α: It would seem that culturess are all equally meritorious, since any evidence to the contrary would, by definition come from a person who had grown up in one culture, and is therefore tainted by that lens. Even a person who grew up between two cultures would really be the product of his own pidgin culture, and would therefore not be able to see beyond that.

β: The assertion that a person cannot truly abstract one’s-self from what one is accustomed goes against the very meaning of being human. Whether or not any particular abstract generalisation can be contested, but there is no reason why any given person cannot take an objectively valid position by abstracting one’s own experience.
Further, I would argue that all cultures are not equally meritorious, but rather that some cultures are, in fact, better than other cultures.

α: Are you asserting that some cultures have moral superiority over other cultures?

β: No, definitely not! Morality is really another matter entirely. The goodness of badness of a person isn’t so much dependant on how one’s prosperity or natural talent, but rather what they do with it, and the free choices they make with the cup they have been given.

α: So is culture then measured by prosperity?

β: Well, yes, but I would prefer to expand on that, as I think the answer is more subtle.
Culture is, like a good jug, best measured by how it fulfils it’s purpose. Now a jug’s primary purpose is to hold water and pour it without issue. It also has secondary aims like looking beautiful and clearly showing how much water remains, but these should be satisfied with the fullness of the first aim.
However, Culture’s final purpose is to spiritually enrich it’s people. This means to draw them to the transcendentals of Truth, Goodness and Beauty; consequently: God. And in the same way as the jug, culture has secondary objectives like Economic and Social goals, but also in the same way, these should flow from the fullness of the first aim.

α: How can a culture tend towards, or gain such value?

β: If a culture was truly perfect, I think it would be quite clear. However, one possible indicator would be how long the culture has existed without major change. A truly old culture would have been touched by all the wise hands that perfected her over the ages.

α: So then what makes a culture bad?

β: Well, a culture that has experienced great change would have the detailed perfection that time brings it. Of course, this observation does not bode well on our modern world, where culture seems to be changing at a much faster (and possibly more destructive) rate than it ever was before. So whether or not these great changes are good, this of course means that it cannot have been enriched by the process I have been describing.

α: Ah, but what does the reader reckon?

On Subtlety and Complexity

What’s the difference between explaining something in a more complex way as opposed to a more subtle way? After all, both explanations will inevitably be longer, and more complicated. Isn’t subtlety therefore just as complex as complexity?


The example I’m going to use is that of of faith, hope and charity. At first, they all seem fairly similar. Having faith in someone can also be seen as having a strong hope in them; In this wikipedia article, faith is seen as being aligned with goodness (which is otherwise thought of as charity); what’s worse: a modern rendition of charity is the word “love” (which sounds more like trust/hope).

I think perhaps a way of disentangling this confusion is with three very fundamental concepts: Truth, beauty and goodness. Now if you think about it, these are actually really fundamental concepts. They run through everything we know, and anything can be described in terms of them, like a cup:

For example, in front of me, I have truly have a green cup, that because of it’s elegant (beautiful) design is good for holding water (or coffee, in the case of the picture). Something is truly described as what it really is; Something is beautiful when its form follows its function; And something is good when that function is fulfilled.

Now if we back up a bit and look at these two trios side-by side, things start to get interesting. Faith clearly maps with truth, independently of either hope or charity (something simply to be known). The next obvious connection is that of Charity and goodness (“it is in giving that we receive”). And last, but not least, we can see that Hope is left with beauty. This is the analogy that I find most fascinating. Does beauty make one hopeful? Is one who has not hope blind to beauty? I think perhaps simply pondering those questions will do the comparison more justice.

The point is, the ideas of faith hope and charity are clearly different, but they can be quite hard to clearly wrap one’s head round. However, one doesn’t need to break them down (complicate them) in order to understand them more, but instead try to squash and stretch them a bit, until the “shape” of the idea is just right.


The definition of complex is consisting of multiple parts. Subtlety, in contrast is any distinction made that does not break a thing down. As you can see, the distinction between Faith, Hope and Charity is therefore subtle (extremely so), but ironically, trying to explain how it is has proved to be somewhat complex!

Euler Project: Challenge #3

Ok, so a while back (I don’t remember exactly when). I tried to get into the Euler Project. What it is is a series of difficult mathematical (programming) challenges. When I first tried it, I solved the first two challenges, and couldn’t progress much further.

Anyway, I was recently on a bit of a programming spree, and gave challenge #3 another shot. Instead of coding my solution in Javascript, I have now switched to Python (a newer, lower level, yet more elegant, programming language). This post is an explanation of how I solved it, so if you don’t want the solution spoiled, go and figure it out yourself (then please come back here to tell me how inefficient mine is).

The exact problem, as stated on the website, is:

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

As you can see, it is quite a nicely stated problem since it gives you a number you can test out before trying to compute the highest prime of the monster 12-digit number. Initially, I went about coding my solution in a fairly obvious way (pseudo code)

loop bigNumber:

  if number%bigNumber == 0 (i.e. if there is no remainder, then it’s a factor) then
   loop through factor to check if it has factors. if it has none, then it’s prime!

Now, this logic worked fine for the relatively small 13195 (in 0.011 seconds, I might add) but when I threw the huge number at it, the program just hung (sat there, showing no result). After examining it in more detail, I found that it was simply going to take too many life times to check all the factors.

However, I knew there must be a solution that didn’t involve a supercomputer, since I know a guy who solved this problem. Back to the drawing board…

My basic problem was one of efficiency. So in my second version of the program, I changed the program in two different ways. I manually multiplied the number (also known as chunking, a mistake in hindsight, since the computational equivalent of long-division is, in fact, faster). The second change I made was a bit more complicated, but I personally found it fascinating. So, please humour me for a moment with this explanation:


Let’s find out if 13 is a prime number.
So we’ll check the potential factors one by one:

  1. 2 times 2 is 4
  2. 2 times 3 is 6
  3. 2 times 4 is 8
  4. 2 times 5 is 10
  5. 2 times 6 is 12
  6. 2 times 7 is 14 (greater than 13, so we’ll jump to the next number)
  7. 3 times 2 is 6
  8. 3 times 3 is 9
  9. 3 times 4 is 12
  10. 3 times 5 is 14 (greater than 13, so we’ll jump to the next number)
  11. 4 times 2 is 8
  12. 4 times 3 is 12
  13. 4 times 4 is 16 (greater than 13, so we’ll jump to the next number)
  14. 5 times 2 is 10
  15. 5 times 3 is 15 (greater than 13, so we’ll jump to the next number)
  16. 6 times 2 is 12
  17. 6 times 3 is 16 (greater than 13, so we’ll jump to the next number)
  18. 7 times 2 is 14 (greater than 13, so we’ll jump to the next number)
  19. 8 times 2 is 16 (greater than 13, so we’ll jump to the next number)
  20. 9 times 2 is 18 (greater than 13, so we’ll jump to the next number)
  21. 10 times 2 is 20 (greater than 13, so we’ll jump to the next number)
  22. 11 times 2 is 22 (greater than 13, so we’ll jump to the next number)
  23. 12 times 2 is 24 (greater than 13, so we’ll jump to the next number)

Now, since none of the numbers we’ve checked multiplied neatly into 13, we can conclude that 13 is a prime number. However, did you notice that after 4, every single potential factor we checked had already been checked in reverse?

For example, 5 times two (line 14) had already been checked (as 2×5) on line 4!

By simply ending the sequence when we start to see the same number again, we half the number of steps needed. If we do this for a bigger number, like 23, we cut it down by 6 sevenths! So as you can imagine,

There were a few other efficiencies I implemented (like not chunking, for example) and there might even be more still (like looking into how the program does long division, and trying to make it easier relative to the problem). But as it turns out, this simple change knocked the program run time from multiple lifetimes to about 3 seconds! So yes, I did find the highest prime number that factors into 600851475143 and I hope that you can too!


I really enjoyed this challenge, and can see myself attempting more in the future (even reattempting the ones I’ve done in order to do them better). I also see myself switching to a lower level language (like C), so that I can program an even faster and more efficient solution (even though it will make doing so more complex). Perhaps this project can be my doorway into really understanding the truly complex mathematics which has hitherto evaded me.

More Toki Pona

One day I’ll get sick of this constructed language once and for all, but for the moment, there still seem to be some things that bring me back to Toki Pona. I had a more thorough read of the book today, and frustratingly read through the “Toki Pona Proverbs section”, which managed to concentrate all the things that I didn’t like about the language…

And don’t get me wrong, the sound of the words doesn’t bother me that much. My current solution (though technically breaking the phonetic rules) are simply to change the stress patterns of the language. So instead of saying TOki POna LI TOki POna, one says toKI poNA li toKI poNA, which personally I find sounds a lot better.

No what bothers me is the shallow philosophy that seems to sit in the background of The Toki Pona Book: Truth is Relative, Simplicity is Goodness, non-essentials are bad (literally “Ike). So instead of rehashing all these frustrations, i decided to write a Toki Pona “sequence” (it doesn’t display enough structure to be called a poem, but it might just resemble one):

pona li pona ala nanpa ali
 
 wan ijo li pona ala e ali
 wan li pona e oko
 mute ijo li ike e ala ali
 oko li oko e mute pona
 
 mute ali li ike ala
 mute li pona
 wan wan li ike ala
 wan li pona
 
 pona li pona ala
 ike li ike ala

And no, don’t worry. This time, I wont be daft enough to leave you without a translation, even though it is rough, and won’t carry the same tone as the (extremely ambiguous) original:

simple is not good always
 
 one thing does not make good all
 one does good to the eye
 many things do not bad to all
 the eye sees a lot good
 
 not many is all bad
 many is good
 one one is all bad
 one is good
 
 simple is not good
 non-essential is not bad

If you concluded that that made very little sense, don’t worry. You’re probably right!