2017-05-21

A collection of home computers and accessories: Video Technology VZ200

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my former collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.

The VZ200 is somehow the bigger brother to the Laser 110, which has no colous. And there is the Laser 210, which has 8 KB RAM, looks like the Laser 110 but is otherwise identical to the VZ200 (besides the larger RAM).

Main unit front view

Main unit diagonal view

2017-05-20

Drawing on screen

In this post I would like to share my experience regarding drawing on screen.

Now, what do I mean by this? First, consider a pair programming session. Your fellow programmer and you are sitting in front of the screen. You wish to discuss something that is currently on display. For whatever reason your colleague does not get what you want to tell. So you end up pointing at an area on the screen with your finger. While this may work during a one on one, it does not scale well in mob programming sessions. So, you might end up using a laser pointer, just as you might do during ordinary presentations.

But… Why not simply draw on screen?

The idea is far from new, presentation programs have just the right tools for this. The following screenshot shows what Powerpoint offers while in presentation mode.

Choosing how to draw on screen in Powerpoint

Then again, my initial scenario did not involve a presentation. Windows 10 Anniversary Update introduced the Windows Ink Workspace, which you can see in the following screenshot:

Windows Ink Workspace

Screen Sketch takes a screenshot and gives you a couple of drawing tools you can use to annotate, save and share it. However, as you can see in the following screenshot, editing does not take place full screen. The upper right portion of the screen contains the drawing tools. The bottom shows the grayed out taskbar. On my monitor, a saved screenshot was 1728 by 972 pixel, compared to its original resolution of 1920 by 1080 pixel. That border in my opinion limits the impression of directly drawing on screen.

Drawing on a screenshot

A very good alternative in my opinion is Epic Pen. Here is how it looks like:

Screenshot of Epic Pen

The program is (at the time of writing this) free for personal use and has a nice clean interface.

If you are on a Mac, I suggest taking a look at Highlight by Nicolas Zinovieff. It has an even more reduced user interface and offers few paint modes. But in my experience, painting on screen does not require much features. Draw something freehand, draw a circle or a line. That’s it. Remember, I used this to draw someone’s attention to something on display – nothing more.

Do you use similar tools? Which one do you prefer?

2017-05-14

for ever young – musings about for loops

Welcome to another installment of my series about polyglot madness. Winking smile

Today we will take a look at one way to do things repeatedly. Let’s tart with BASIC yet again.

10 FOR I = 1 TO 3
20 PRINT I
30 NEXT I

The FOR keyword defines both start and end value. Anything that follows until the NEXT keyword is executed repeatedly, in my case, that is just printing a number. Have you noticed the loop variable after NEXT? Most BASIC dialects allow to omit it. In this case the most recent loop is used. Now take a look at this one:

10 FOR I = 1 TO 5 STEP 2
15 FOR J = 1 TO 3
20 PRINT I, J
25 NEXT
30 NEXT

Screenshot of an Oric emulator

The STEP keyword is used to change the increment or decrement value. Before we go back to the future, please note that start, end and increment value are computed prior to the execution of the loop.

Here is how JavaScript handles for loops:

for (i = 1; i <= 3; i++) {
  console.log(i);
}

This surely looks familiar to C, Java and C# developers. There is a nice alternative usage, this time written in Java:

String [] a = {"Java", "C#", "JavaScript", "..."};
  for (String b : a) {
  System.out.println(b);
}

If we translate this into JavaScript, we get something like:

var a = ["Java", "C#", "JavaScript", "..."];
for (var b in a) {
  console.log(b);
}

If we run it, we get… the numbers 0 to 3. Oh my.  In defense of JavaScript I should say that I misused in. The for...in statement is meant to be used to iterate over object properties. To get my above example working as intended, we have to use of instead of in.

Now let’s turn to Swift. Take a look at the following code fragment.

let a = ["Java", "C#", "JavaScript", "..."]
for b in a {
  print(b)
}

This resembles my JavaScript example. But please not the missing paranthesis. To count from 1 to 10 is as simple as:

for b in 1...10 {
  print(b)
}

However, counting down from 10 to 1 has a caveat. Using 10...1, the code will crash. To achieve this, we can use the reversed() instance method:

for b in (1...10).reversed() {
  print(b)
}

Next: Dart:

var a = ["Java", "C#", "JavaScript", "..."];
for (var b in a) {
  print(b);
}

Looks familiar, right? As Dart is greatly influenced by C-like languages, the three-part variant works as well:

for (var i = 1; i <= 10; i++) {
  print(i);
}

That’s it for today. Stay tuned.

2017-05-11

A collection of home computers and accessories: Philips VideoPac C7010

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my former collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.
This is a chess module for the Philips VideoPac G7000.
Box front view
Box back view
Main unit
Manual (front cover)
Manual (two pages)

2017-05-08

A collection of home computers and accessories: Atari VCS 2600 new version

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my former collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.
See my post about the original version of the VCS 2600 here.
Box front view
Box back view
Main unit
Main unit diagonal view

Some reflections on functions

Regular readers know my fascination for home computers. So, please take a look at the following small BASIC program:

10 PRINT "HELLO ";
20 GOSUB 70
30 FOR I = 1 TO 3
40 GOSUB 70
50 NEXT
60 END
70 PRINT "WORLD ";
80 RETURN

Screenshot taken from a emulated C64

In BASIC you can reuse code through so-called subroutines. They are invoked using the GOSUB keyword. END marks the end of the subroutine. As you can see in the above example, subroutines can be called from different parts of the program. However, subroutines are no functions, as they lack the ability to return a vlaue and to receive parameters. This is done as follows:

10 DEF FN POW2(X) = X * X
20 INPUT "PLEASE ENTER A NUMBER: "; A
30 PRINT FN POW2(A)

So, DEF FN defines a function, whereas FN invokes it.

JavaScript has the function keyword. It is used as follows:

function pow2(x) { return x * x; }

To invoke the function use something like pow2(3)

Swift is similar, but uses the func keyword:

func pow2(x: Double) -> Double { return x * x; }
print(pow2(x: 3.0))

Dart can be very terse:

pow2(x) => x * x;

Or more descriptive:

double pow2(double x) {
  return x * x;
}

Finally, Scheme:

(define pow2 (lambda (x) (* x x)))
(pow2 3)

What other language feature would you like to see compared? Feel free to suggest your favorites...

2017-05-06

A collection of home computers and accessories: Commodore 116

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my former collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.
Main unit
Main unit (diagonal view)
Power supply
Power supply (back)

Developing Flutter apps on Windows

Just a quick reminder that it is now possible to develop Flutter apps on Windows, too. The setup consists of a couple of easy steps and is well documented here. If you have already installed Android Studio, it boils down to:
  • Cloning the Flutter repo
  • Setting the PATH environment variable
  • Running flutter doctor
  • Picking your favorite editor and installing a Flutter plugin
I prefer IntelliJ, which offers a seamless integration of Flutter. Below is the screenshot of my sample Flutter app called Temperature Converter.
Screenshot of my temperature converter
Please keep in mind, that you cannot build iOS apps on a Windows machine.

Quick tip: stop your Android SDK Tools Blues

As you all know, SDK Tools, Revision 25.3.0 (March 2017) brought significant changes to the Android SDK commandline tools. Most notably, the android command is no more.

I used that command frequently in order to list my Android virtual devices: android list avd.

To do that now, just use emulator -list-avds

To launch the emulator with an avd, type emulator @avd_name, where avd_name is returned by the above command.

2017-05-02

Setting the Java version for NetBeans

Just a friendly reminder, primarily to myself- ;-) You can override the Java version to be used for running NetBeans in the file etc/netbeans.conf.

As you know I gave two talks during our company conference MATHEMA Campus. One was about jshell which naturally ;-) required me to install Java 9 early access. Today, back in the office, I wanted to do some programming. I launched NetBeans on my Mac - and after a couple of seconds it terminated. It was clear that this had to have to do with the early access install. However, I did not want to remove it. So - what to do?

/usr/libexec/java_home, as you may know, lists installed Java versions. It (expectedly) pointed to /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home.

I hat already set JAVA_HOME to the Java 8 installation, but this certainly has no effect on app bundles. This is where etc/netbeans.conf comes in handy. It's inside the NetBeans installation directory, for example /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans.

Just remove the hash symbol at the beginning of the line #netbeans_jdkhome= and enter the path to a jdk installation. On my machine this currently is /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home.


2017-05-01

LET it be

In my previous post Some thoughts on being a polyglot developer I pondered about the usage of arrow constructs in programming languages. This time I will reflect on the let keyword.

As you know, I love home computers. So, let’s (ah, no pun intended) start with them. The following screenshot, by the way, shows the Oric emulator Oricutron by Peter Gordon.

Screenshot of the Oric emulator Oricutron by Peter Gordon

Most (but certainly not all) home computers offered a builtin BASIC interpreter and a (full screen) editor. As BASIC aimed to be easily learnable and understanable, the language sounds like short english sentences. For example, to assign a value to a variable, one might say Let A be Hello World. This translates to let a$ = “Hello World”. The dollar sign is needed to represent sequences of characters.

Other languages use let for assignment, too. There is an interesting question In what programming language did “let” first appear? on Software Engineering. Well. So far, so good. But we don’t use BASIC, do we?

Winking smile

ES6 brought let to the web. Instead of var we can now say

class black {}
let orange = new black();

The difference between both keywords is scoping. var is scoped to the nearest function block and let is scoped to the nearest enclosing block (which can be smaller than a function block). Both are global if the are outside any block. Variables declared with let are not accessible before they have been declared in their enclosing block. Further assignments to an already declared variable (using let) are valid. Why am I emphasizing this? Let us take a look at Swift. This language knows let, too. However assignments can be made only once. As you can see in the following screenshot, for non-constant-like usages we need to take var instead.

A Swift session at https://iswift.org/playground

The Dart programming language is optionally typed. That means that we can either write

var a = 42;
print(a.runtimeType);

or

int a = 42;
print(a.runtimeType);

Both result in int being printed.

To declare constants, Dart has the const keyword:

const a = 42;
print(a.runtimeType);

Again, int is printed. Dart offers compiletime constants, so const a = new Random().nextInt(10); is not valid. A similar expression in ES6, however, is valid:

const c2 = Math.random();

The same is true for Swift’s let. The assigned value can be computed during runtime.

let a = random()
print(a);

Speaking of const, remember that const is a reserved keyword in Java, but currently not used. C#, on the other hand, does:

public const double Pi = 3.14159;
Well, that has been enough of brain dance for now. 
Smile
Happy coding!

2017-04-30

Some thoughts on being a polyglot developer

A few days ago I gave two talks during our company conference MATHEMA Campus. One introduced the jshell, the other one offered a glipse at the Dart programming language. While demoing jshel I entered a lambda expression. I srewed up the input, using => instead of ->. The reason: in Dart => is used for one line functions, as in

test(var i) => i * i;

main() {
  print(test(4));
}

The Dart talk was scheduled for the following day so my brain must have pressed fast forward.

Smile

C#, by the way, uses => for lambda expressions. C, on the other hand, uses -> in conjunction with a pointer to access members of a sctruct or union. Then again, ES6 introduced arrow functions that look like this one:

let test = (x,y) => x*y;

One more thing... Swift also knows ->. Here it is a function type. AnyObject -> Void is the type of a function that accepts AnyObject and returns Void.

That's it for today, I think my next post will be called LET it be. Guess what I will cover...

Smile

If you mixed language constructs while try to be a polyglot developer, please feel free to share them

2017-04-23

An update to my Temperature Converter

Today I updated my Flutter sample app called Temperature Converter. It now makes use of Flutter's InputDecoration to show an error message if the input value is no floating point number. Here is how it looks like:
The following screenshot shows a valid input.
As you can see, the app disables the Calculate button accordingly. This is done by setting the onPressed parameter to null. To find out more, please grab the source at GitHub.

2017-04-17

Quick tip: copy ip address to clipboard

My Mac runs Windows 10 in a virtual machine that is connected to the host using a network bridge. This way both host and client share the same network. Now you may be asking why I would need that. On Windows I use Visual Studio and Xamarin to create native iOS and Android apps. Using the Xamarin Mac agent I can both build and run the iOS app. But Android? The virtualized Windows can neither run Intel HAXM nor Hyper-V as VirtualBox does not support this type of nested virtualization. However, on the host (macOS) I can easily launch another VirtualBox client, for example Android x86. After adb connect ... I can use the simulated device to launch and debug apps. Here is a small shell function that copies the ip address to the clipboard:

function ipaddress {
    ipconfig getifaddr en0 | pbcopy
}

2017-03-13

A collection of home computers and accessories: Philips VideoPac G7000

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.
Actually, the Philips VideoPac G7000 is not a home computer but an early video game console. However, I think there was a BASIC extension…
Main unit
Main unit (diagonal view)
A couple of games
Joysticks
One more game

2017-02-25

C64 Tribute Watch Face updated

A couple of years ago I bought an Android Wear device. Naturally, I wanted to see how to write apps for this smartwatch. That app is part of my book about Android programming. When I finalized the version for Android 7 a few months ago, Android Wear 2.0 was still in beta. This has changed recently, so I updated the app accordingly. You can find the source on GitHub. The app itself can be downloaded from the Play Store. Here’s how it looks like:
The watchface
The settings
Watchface chooser
Of course you need an Android Wear smartwatch to give it a try.

Quick tip regarding Android Wear watch faces: PROVIDE_BACKGROUND apparently not needed

Stumbled upon this one by chance. Turns out com.google.android.permission.PROVIDE_BACKGROUND is not needed.

2017-02-22

Quick tip: Call a rest service with curl

curl \
--header "Content-type: application/json" \
--request POST \
--data '{"id": 42, "active": true}' \
http://localhost:8080/lanes/addTask

2017-02-21

A collection of home computers and accessories: Video Technology Laser 110

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.
Main unit
Main unit (diagonal view(

2017-02-19

A collection of home computers and accessories: Atari VCS 2600

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. Sit back and enjoy the picutres.
Please note: The Atari VCS 2600 certainly is not a homecomputer, still, you could even add a keyboard and code in BASIC. As of 128 Bytes of RAM, not particularly useful, though.
Main unit
Switches
Main unit (diagonal view)

2017-02-18

A collection of home computers and accessories: Oric 1

I collected home computers for almost a decade. As I decided to donate my collection to the Museum Industriekultur in Nuremberg and already handed over these cute little machines and its accessories to the museum, it’s time to share some pictures of my collection. You can find the technical specification of all of then throughout the Internet, so no need to repeat it here. So, just sit back and enjoy the picutres.
Box
Inner packaging
Manuals
Main unit
Main unit (bottom view)
Main unit (diagonal view)