Android programming – a menu using Activities and Intents

Series: Setup, Menu, Drawing, non-Android, Working, Saving state

I will be talking about how to write Android programs that share code with non-Android programs. The program I will be writing is a simple game.

This time we’re making a simple menu structure:

Raspberry Pi Minecraft Python summer project screenshots

[Screenshots of Minecraft on the Raspberry Pi can’t be made with VNC or screenshot tool like scrot, but they can be made with the excellent raspi2png.]

We did some Python programming in Minecraft on the Raspberry Pi for our summer projects.

Child 2 made some lovely houses and enjoyed destroying things much more efficiently than when you do it by hand:

houses

and Child 0 made a spell book. You can see the “elements” spell has been cast in the background (earth, air, water and fire), the “topsy-turvy” spell on the right, the “frozen” spell on the left, and on the far left you can just see a bit of the “river” spell:

spells

To cast spells you must first utter the magical incantations:

python

and then:

from spells import *

then each spell can be cast by simply saying its name followed by the double brackets of power, for example:

topsyturvy()

Android programming – setting up Android Studio

Series: Setup, Menu, Drawing, non-Android, Working, Saving state

I will be talking about how to write Android programs that share code with non-Android programs. The program I will be writing is a simple game.

First, how to set up Android Studio:

Absolute Truth in programming languages

Is enforcing truthfulness the opposite of beauty?

Can 2 + 2 = 5?

Improvements, corrections, further contributions are welcome.

$ cat five.cpp 
#include <iostream>
int operator+( int x, int y ) { return 5; }
int main() {
    std::cout << 2 + 2 << std::endl;
}
$ g++ five.cpp 
five.cpp:2:29: error: ‘int operator+(int, int)’ must have an argument of class or enumerated type
$ python
>>> int.__add__ = lambda y: 5
TypeError: can't set attributes of built-in/extension type 'int'
$ cat five.hs
import Prelude hiding ((+))
x + y = 5
main = print ( 2 + 2 )
$ ghc five.hs && ./five
5
$ cat five.rb
class Fixnum
    def +(y)
        5
    end
end
print 2 + 2
$ ruby five.rb
5
$ mzscheme 
> (define (+ x y) 5)
> (+ 2 2)
5

Options for code reviews with Git

We’re thinking about switching to Git for my work, and I want to be confident we can still support good code reviews if we make the switch.

I am a big fan of in-person reviews, and for that, git difftool is enough but sometimes you need to do it asynchronously, and then you need a tool or a process or something.

Here are the options as I see them so far (please comment if you know others I should consider):

  1. Emailing patches. Git has git format-patch and git bundle that allow creating a file containing changes that can be sent by email or message. These can be reviewed as patches or applied to the working tree and reviewed in context.
  2. Feature branch and pull request. Devs to push their changes to a branch in a shared repo and send an email or message asking a colleague to pull the branch. The reviewer looks at the changes in the repo or pulls them, then either sends back comments, or merges the branch into their own and delivers to the master branch.
  3. Tools. There are several extra tools that sit in front of Git and deliver changes when they are reviewed. These include: Gerrit, Critic, Review Board.

References: