Archive for Technology category

Typography in bits: Other English micros

I’ve been wanting to do a follow-up to the popular Typography in 8-bits: System fonts post and the 16-bit sequel for some time and recent Hacker News and ArsTechnica traffic reminded me that I’m not the only one nostalgic for chunky pixel fonts of old.

This time I’m focusing on a handful British machines that were much less well known around the globe which – all seem to borrow heavily from other machines!

Sinclair QL (1984)

Specifications

Condensed sans
5 pixels
7 pixels
ASCII+code pages
256×256 (40×25 text)
512×256 (80×25 text)
Unknown
Download in TrueType

Sinclair QL system font in medium resolution

The short-lived Sinclair QL was Sir Clive’s attempt at getting into the business market but the corner cutting on the CPU (a Motorola 68008 – the 8-bit data-bus version of the 68000) and storage (Microdrives consisting of loops of high speed tape instead of disc) meant it wasn’t taken very seriously. This was a shame as the operating system and software was advanced for its time.

Unusual characteristics

  • True descenders making the font effectively 9 pixels tall
  • Single story lower case ‘a’
  • Over-extended ’7′
  • Squished lower-case ‘f’
  • Aligns braces and brackets to tightly wrap contents
  • Soft curves on ‘gil’
  • Unusual join on ‘k’

Rationale

A rather tidy condensed font very similar to those used on LCD displays still today. Almost certainly looked good on a monitor although perhaps not using the system default colors shown here. Almost certainly too hard to read on a TV at the time.

Influences

Has similar proportions and characters to much of the Apple ][ font but with various visual improvements such as on the 6,9,2,$ etc.

Memotech MTX512 (1984)

Specifications

Condensed sans
7 pixels
7 pixels
ASCII+code pages
256×192 (34×24 text)
Unknown
Download in TrueType

Memotech MTX512 system font in low resolution

Memotech were a peripheral maker who decided to get in on the action and produce their own machine in the 1984-1985 period that saw a lot of machines and failures. Despite some good specifications it never made a dent and its claim to fame is being the computer in the movie Weird Science.

Unusual characteristics

  • Some very quirky decisions especially in lower-case
  • Awful character alignment especially on 'q'
  • Uneven descenders on 'gy'
  • Mismatched '.,;:'
  • Weird serifs on 'adu'

Rationale

This quirky font doesn't looks okay on low-quality TVs of the time with oddities lost in the blur. On sharper screens it looks amateur and unfinished.

Influences

Despite some similarities in the upper-case to the Apple ][ font it doesn't take many cues from anywhere else.

Amstrad PCW (1985)

Specifications

Serif
7 pixels
7 pixels
ASCII+code pages
720×256 (90×32 text)
Unknown
Download in TrueType

Amstrad PCW system font in high resolution

Alan Sugar’s Amstrad didn’t waste any time after the CPC in going after the business market with a range of cheap machines for word processing and other general tasks. In the UK these machines could be found everywhere either paired up with Amstrad’s own daisywheel or dot-matrix printers.

Unusual characteristics

  • Pixels were actually rectangular (simulated here by doubling the vertical size)
  • Very distinctive curves on ‘CGOQ’
  • ‘X’ looks like a different style because of high mid-point

Rationale

These machines came with their own monochrome monitors and were very high resolution for consumers at the time. The font is not a bad choice and did allow for 90 columns of text but smarter alternatives existed in word processing programs such as Locoscript.

Influences

An almost direct copy of the Amstrad CPC font disguised by the double-height pixels. Actual changes are the 0 taking on the more oval shape, O and Q taking on the boxier shape and the apostrophe loosing its slant.

The PCW was not alone in using an existing 8×8 font in a double-height manner. The Atari ST, Commodore Amiga and Acorn Archimedes all used the same trick.

Acorn Archimedes/A series (1987)

Specifications

Bold sans
6 pixels
7 pixels
ASCII
various
Unknown
Download in TrueType

Acorn Archimedes using double-height pixels
Acorn’s successor to the BBC Micro was a lovely piece of hardware with an all-new 32-bit RISC processor they developed dubbed ARM. While it did well in Acorn’s entrenched education markets it never found a foothold anywhere else. After various models they cancelled their upcoming Phoebe workstation (yes, named after the Friends character) and would concentrate on thin-clients before abandoning that and focusing purely on processor design where they had immense success. The ARM design now powers almost all the smart phones on the market today.

Unusual characteristics

  • Pixels were actually rectangular (simulated here by doubling the vertical size)

Rationale

These machines came with Acorn’s color monitors and were capable of running VGA-like resolutions. The GUI on these machines really missed an opportunity here to use a specifically designed font and to add proportional text printing and take on the Mac. Instead these used a scaled fixed-width font like the Amiga and ST despite being a couple of years late to that party. Proportional fonts were supported later.

Influences

Identical to the BBC font except for ‘^|’

SAM Coupé (1989)

Specifications

Condensed sans
5 pixels
7 pixels
ASCII
256×192 (32×24 text)
512×192 (85×24 text)
Unknown
Download in TrueType

SAM Coupé in high resolution

MGT were a third-party producer of expansion products for the Sinclair ZX Spectrum who bet their company on a Spectrum successor using VLSI technology that would ‘rival an Amiga’ at a fraction of the price. While the machine was impressive by 8-bit standards when it finally arrived somewhat late and more expensive than originally touted it failed to make a dent as the market went to the 16-bit machines and it took MGT down with it.

Unusual characteristics

  • Rather ugly ‘*’ asterisk
  • Inconsistent ‘.,;:’ set
  • Inconsistent ‘ and “

Rationale

A smart font that despite the various inconsistencies looked good on a quality display in both high and low-resolution modes.

Influences

Almost a direct copy of the Sinclair QL font. The upper-case are identical and a most lower case with some exceptions to squeeze the QL’s 9 pixel high font into 8 pixels. This is especially apparent in the over-extended 7, the slashes and the bracket alignments.

5 simple steps to publishing a NuGet package

There is a fair amount of info on making and publishing NuGet packages but I couldn’t find a simplified guide for the simple case. Here it is and start by downloading nuget.exe and putting it in your path.

1. Multi-platform considerations (optional)

Supporting multiple platforms gives you a choice to make:

  1. Portable Class Library (PCL)
  2. One project with MSBuild magic
  3. Multiple projects

If you can go with PCL do it. For CSharpAnalytics we use platform-specific system info and hooks so it’s not an option – we went with multiple projects.

Multiple projects

Creating a separate .csproj for each platform and putting in the same folder means adding files isn’t too painful (show all files then include the ones you need) but you do need to take steps to make sure the build process for the projects don’t interfere with each other by separating the bin and obj paths:

  1. Set the output path in the Build tab of project properties to be unique per configuration to for the bin files, e.g. “bin\Net45\Release\”
  2. Edit the .csproj file adding a BaseIntermediateOutputPath tag for obj files, e.g. <BaseIntermediateOutputPath>obj\Net45</BaseIntermediateOutputPath>

2. Create your .nuspec definition

Now that you know which release dll files you need to include you can go ahead and create the nuspec file that tells nuget how to package your files up.

Open a PowerShell and type nuget spec to create you an XML file to edit in your text editor

Once you’ve entered your author details, a snappy description and links to your project page and license you can then add the files. Libraries will want to copy the .dlls into the lib folder with element like these:

<file src="..\bin\Net45\Release\MyLibrary.dll" target="lib\net45" />

Each platform will require a specific target and they should use platform name (e.g. net45, sl5, windows8) described in the NuSpec creating packages documentation. That page has a lot more detail on things such as content file types etc.

If you prefer a graphical UI then NuGet Package Explorer will make your life easier.

Remember to check your .nuspec file to source control (there is nothing private in it) and add it to your solution as a solution item so it doesn’t get missed.

3. Create your .nupkg package

The easiest part of the process. From PowerShell type:

nuget pack yourfile.nuspec

If all goes well it will create yourfile.nupkg.

4. Test your package

Just because your package was created doesn’t mean it works and you don’t want to publish to the world until you know it works especially given you can’t delete packages from NuGet:

  1. Create a folder to be your own private testing NuGet repository, e.g. c:\testnuget
  2. Publish to your test repository with nuget publish yourfile.nuspec -source c:\testnuget
  3. Configure Visual Studio to use your test repository by going to Tools > Library Package Manager > Package Manager Settings > Package Sources and then adding your test folder to the Available package sources test
  4. Create a new test application and then add a reference using Manage NuGet Packages to choose your new package from your test repository.
  5. Write a few lines of code to test you can actually use your package ok!

5. Publish to the world

Okay, you’re now ready to publish. If you haven’t yet signed up for an account over at Nuget.org you’ll need to do that first.

  1. Go to Your Account and copy your API key
  2. Run the PowerShell command nuget setApiKey followed by your API key, e.g. nuget setApiKey 99995594-38d2-42cd-a8b1-ddcd722bb7e7
  3. Run nuget publish yourfile.nuspec again this time without the -source option to publish to the default public repository

[)amien

A case for my MacBook Pro: Snugg wallet case review

I did it. Earlier this year I caved and purchased a MacBook Pro 15" Retina after being Mac-less for a few months despite some reservations about the lack of upgrade options.

Finally I had a lovely unibody machine. Now I needed something to prevent the beating my 17" acquired over the years – something with a bit of padding to prevent the occasional bump as my backpacks tend to be very thin.

Imagine my surprise when the people at Snugg asked if I was interested in a free case to review. I’d been considering something quite plain but my eyes lit up at their Snugg MacBook Pro 15 Wallet Case in Brown Leather.

The case arrived a few days later and you can just smell the leather. The outside is a slightly rough texture (on the brown at least) with very neat stitching while the inside is a very smooth microfiber – presumably to ensure the MacBook slides in nicely.

Front of my MacBook Pro case.

The front flap snaps down with quite a strong magnet – a worry for the older magnetic hard drive machines perhaps but not a concern for people with SSD drives. It also features a small business card holder and the back has a full-width pouch that easily fits a few documents.

The fit is great, it is indeed "snugg" without being tricky to remove. Despite providing good protection the case isn’t bulky and fits nicely into my backpack and on one occasion I’ve just carried it as-is. Hmm I wonder if you could attach a shoulder-strap…

Side view of my MacBook Pro in the case.

I’ve taken to putting the case under my laptop – the slightly thicker top angling the laptop keyboard to a more comfortable position.

Overall a very nice case – I might grab one for my iPad and my wife has made it known to me that she’d quite like one too!

[)amien

Probable C# 6.0 features illustrated

Adam Ralph has a list of the probable C# 6.0 features Mads Torgersen from the C# design team covered at new Developers Conference() NDC 2013 in London.

I thought it would be fun to show some before and after syntax for comparison and in doing so ended up with a few thoughts and questions.

1. Primary Constructors

Shorter way to write a constructor that automatically assigns to private instance variables.

Before

public class Point {
    private int x, y;

    public Point(int x, int y)
        this.x = x;
        this.y = y;
    }
}

After

public class Point(int x, int y) {
    private int x, y;
}

Thoughts

  • Do you need to independently define x and y?
  • Can you still write a body?
  • How would you make the default private?

This solution feels too constrained, would have preferred something like:

public Point(set int x, set int y)

That set the property and optionally created a private one if it didn’t. Would allow bodies, use on multiple constructors etc.

2. Readonly auto properties

Readonly properties require less syntax.

Before

private readonly int x;
public int X { get { return x; } }

After

public int X { get; } = x;  

Thoughts

  • Love this.
  • Very useful for immutable classes.

3. Static type using statements;

Imports all the public static methods of a type into the current namespace.

Before

public double A { get { return Math.Sqrt(Math.Round(5.142)); } }

After

using System.Math;
...
public double A { get { return Sqrt(Round(5.142)); } }

Thoughts

  • Not something I’ve run into often but no doubt very useful for Math-heavy classes.
  • Could be useful for Enumerable LINQ-heavy classes if it works with static extension methods.

4. Property Expressions

Allows you to define a property using a shorthand syntax.

Before

public double Distance {
    get { return Math.Sqrt((X * X) + (Y * Y)); }
}

After

public double Distance => Math.Sqrt((X * X) + (Y * Y));

Thoughts

  • Small but useful syntax reduction.
  • Has nothing to do with System.Linq.Expression despite the name.

5. Method Expressions

Allows you to define a method using a shorthand syntax.

Before

public Point Move(int dx, int dy) {
    return new Point(X + dx1, Y + dy1);
}

After

public Point Move(int dx, int dy) => new Point(X + dx, Y + dy);

Thoughts

Same as Property Expressions.

6. Params for enumerables

No longer need to define your params methods as an array and force early evaluation of the arguments.

Before

Do(someEnum.ToArray());
...
public void Do(params int[] values) { ... }

After

Do(someEnum);
public void Do(params IEnumerable<Point> points) { ... }

Thoughts

  • Can have params methods for IEnumerable and array side-by-side? Probably not.
  • Is evaluation deferred until evaluated if you pass a single IEnumerable instead of a params?

7. Monadic null checking

Removes the need to check for nulls before accessing properties or methods. Known as the Safe Navigation Operator in Groovy).

Before

if (points != null) {
    var next = points.FirstOrDefault();
    if (next != null && next.X != null) return next.X;
}   
return -1;

After

var bestValue = points?.FirstOrDefault()?.X ?? -1;

Thoughts

Love it. Will reduce noise in code and hopefully reduce null reference errors everywhere!

8. Constructor type parameter inference

Removes the need to create static factory methods to infer generic types. This is helpful with Tuples etc.

Before

var x = MyClass.Create(1, "X");
...
public MyClass<T1, T2> Create<T1, T2>(T1 a, T2 b) {
    return new MyClass<T1, T2>(a, b);
}

After

var x = new MyClass(1, "X");

Thoughts

  • Another great addition.
  • Does it understand list and collection initializers to automatically determine the generic types too?

9. Inline declarations for out params

Lets you declare the out variables inline with the call.

Before

int x;
int.TryParse("123", out x);

After

int.TryParse("123", out int x);

Thoughts

  • Not a particularly large syntax reduction.
  • Shorter code for Try methods and DirectX.

Wrapping up

Hopefully there are a few more gems to come that would help reduce noise. Would especially like to see syntax that wired up an interface to an internal instance variable where not specifically overridden to aid in encapsulation, e.g.

public MyClass : IList => myList {
  private IList myList;

  public Add(object item) {
    // Do something first
    myList.Add(item);
  }
}

[)amien