Author: scruss

  • Using SI prefixes/multipliers in spreadsheets

    Note: I’ve lightly tested this with Microsoft Excel (Windows 10), Excel Online, Google Sheets and LibreOffice Calc. It seems to work. Like all spreadsheet data conversions, please verify before trusting your PhD thesis tables to it …

    Asked on the GTALUG mailing list the other week:

    Does anybody know how to display and work with SI numbers like 10k or 20M or 40G within LibreOffice?

    I came up with the following formula, in this example for data in cell D3:
    =IF(LEN(T(D3))=0, D3, CONVERT(VALUE(LEFT(D3, LEN(D3) - 1)),
        RIGHT(D3, 1) & "m", "m"))

    which results in:

    InputValue
    1u1.00E-06
    10u10.00E-06
    100u100.00E-06
    1m1.00E-03
    10m10.00E-03
    100m100.00E-03
    11.00E+00
    1010.00E+00
    100100.00E+00
    1k1.00E+03
    10k10.00E+03
    100k100.00E+03
    1M1.00E+06

    The right column is displayed in LibreOffice Calc’s newly(ish)-supported engineering notation.

    This function works through creative (mis-)use of the CONVERT() function:

    1. if the argument is a numeric value, pass it through;
    2. if the argument is a string, return CONVERT(«numeric part», "«prefix»m", "m"). This is lightly misusing overloading the unit conversion function by going via metres, but it saves having a lookup table.

    This function doesn’t work with IEC 60027-2 binary prefixes, but they’re silly and I wouldn’t be caught dead using ’em.

  • last of the speed machines

    last of the speed machines

    last of the speed machines

    Instagram filter used: Lo-fi

    Photo taken at: Gananoque, Ontario

    View in Instagram ⇒

  • missst …

    missst …

    missst …

    Instagram filter used: Normal

    View in Instagram ⇒

  • Remarkably pointy

    Remarkably pointy

    Remarkably pointy

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • vase mode

    I’m still a sucker for vase mode/spiral contour prints … this one made in OpenSCAD:

    Thanks to Andrew at ProtoLab for the loan of the PrintrBot. I’ve got a demo at UofT on Wednesday, and my Reach 3D isn’t exactly portable. Yeah, I should probably get a cheap Monoprice printer to lug around to occasional demos, but I’d need to find a donor …

  • morning stripes

    morning stripes

    morning stripes

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • Thingiverse Customizer: a tiny guide

    Thingiverse‘s Customizer allows users to customize suitable OpenSCAD models without knowing any OpenSCAD code. While it does have some documentation to help developers along, there’s still a lot of guesswork.

    I released my first (working!) Customizer design the other week: Parametric Finger Pen Holder (Vertical). While the docs are the primary source of developer information, you might want to know the following:

    • Customizer assumes that every variable defined before the first module definition in the script is a user parameter. To give it a hint that it should stop displaying variables, add an empty module (such as module naff() { }) after the last variable definition you want Customizer to display.
      (There’s supposed to be a CUSTOMIZER VARIABLES/CUSTOMIZER VARIABLES END comment pair that will do this too, but it didn’t work for me)
    • Customizer will fail if there’s any character other than strict ASCII in the script, and won’t give useful diagnostics about the problem. Check your comments for accents and fancy punctuation
    • Customizer displays a real-time preview of your model. This means the rendering will be a little rough, especially if you use set operations such as union(), difference() and intersection(). If you have to hit F6 to render your model in OpenSCAD properly, it’s going to look a bit off in Customizer
    • If you must use resource-intensive functions such as hull() and minkowski(), try to limit them to 2D paths that are subsequently extruded. Everyone else in the Customizer job queue will thank you
    • Similarly, keep the circle smoothness variables ($fa, $fn, $fs) in sensible ranges
    • Customizer creates a new Thing under your name rather than just letting you download your customized model. You likely want to delete that once you’re finished with it.
      (This also means that Customizer only works for registered Thingiverse users. I can’t see any way around this, unfortunately)
  • Addem Labs peelable flexible circuit demo

    Addem Labs peelable flexible circuit demo

    Addem Labs peelable flexible circuit demo

    Instagram filter used: Lo-fi

    Photo taken at: Site 3 coLaboratory

    View in Instagram ⇒

  • “space acid poisoning …”

    Thanks to users sbadger and lurkio on the stardot forum, I’ve been reunited the original BBC BASIC one-liner that begat 2d Star Dodge/Stardodger: Asterisk Tracker!

    game screen with zigzag line (you) vs static white asterisks and a frame around the screen. The object is to get through a small gap in the right hand side of the fram and avoid all the asterisks, using only one key
    Asterisk Tracker

    It was published in the December 1984 edition of BEEBUG Magazine (vol. 3, issue 7; page 9) and is credited to N. Silver.

    It’s impossibly short:

    1L=0:REP.L=L+3:MO.4:DR.1279,0:DR.1279,452:MOVE1279,572:DR.1279,1023:DR.0,1023:F.I=1TOL:V.31,RND(32)+5,RND(31),42,30:N.:P.(L-3)/3:X=0:Y=512:REP.PL.69,X,Y:X=X+4:Y=Y-(INKEY-74+.5)*8:U.PO.X,Y)=1ORX=1280:U.X<1280:V.7:REP.U.INKEY-99:RUN
    

    It makes extensive use of BBC BASIC’s abbreviations, and the writeup even warns

    … Here the programs are extensively abbreviated so that the line will fit into Basic’s keyboard buffer. Because of this, you cannot edit a LISTed version, and so, to allow for errors, it is best to spool out a copy of the text to tape/disc initially. This can be achieved as follows:

    *SPOOL PROGRAM
    type in program
    *SPOOL

    The program unwinds to something much more understandable:

       10 L=0
    20 REPEAT
    30 L=L+3
    40 MODE 4
    50 DRAW 1279,0
    60 DRAW 1279,452
    70 MOVE 1279,572
    80 DRAW 1279,1023
    90 DRAW 0,1023
    100 FOR I=1 TO L
    110 VDU 31,RND(32)+5,RND(31),42,30
    120 NEXT
    130 PRINT (L-3)/3
    140 X=0
    150 Y=512
    160 REPEAT
    170 PLOT 69,X,Y
    180 X=X+4
    190 Y=Y-(INKEY(-74)+.5)*8
    200 UNTIL POINT(X,Y)=1 OR X=1280
    210 UNTIL X<1280
    220 VDU 7
    230 REPEAT UNTIL INKEY(-99)
    240 RUN

    The instructions are typical of the day:

    The first game (called “Asterisk Tracker”) is a very simple game in which you have to guide a “snake” across the screen, whilst avoiding the stars. As the game progresses, more and more stars will be displayed, and the ease of the game rapidly disappears. The Return key guides the “snake” upwards, but it moves down if Return is not pressed. Aim your “snake” for the gap in the wall, and don’t touch any objects as this causes instant death from space acid poisoning!

    Um, yeah, N. Silver, whatevs …

    It’s pretty amazing that three type-ins could fit on a page: especially when you consider that the BEEBUG magazine was A5!

    page of text from Beebug magazine, including full program text and description of the game
    beebug vol 3 issue 7 page 9

    If you want to play it (and who wouldn’t? We wasted days on this game) you can either run this Asterisk Tracker alone in the browser: Asterisk Tracker, or lurkio has combined them into one, and put them here: Beebug One-Line Games (Asterisk Tracker, a Truffle Hunt clone, and a treasure hunt).

    I just wish Graeme Smith were still with us to play this.

  • Great Fencote, 10 cm contours; 50 m scale

    Great Fencote 10 cm contours, 50 m scale
    Great Fencote 10 cm contours, 50 m scale

    in the land of Count Alan.

  • Things Got Weird Real Fast

    things got weird real fast
    things got weird real fast

    this, but with alternate lines from the plot file drawn with alternate pens. The original was slow because it had a point roughly every 0.1 mm, and this has been smoothed. Still took maybe 15-20 minutes to draw, though.

  • moar 10PRINT nonsense

    10 Print CHR$(205.5+RND(1)): Goto 10

    but this still owns it:

    10 PRINT CHR$(199+2*RND);: GOTO 10

    I found I can get this to preload in an emulator, but you still have to type RUN and hit return. See, look: http://scruss.com/cpc/6128s.html?stardoj.dsk/10%20PRINT%20CHR$(199+2*RND);:%20GOTO%2010

  • Waveplot: interference contours

    Even though this plot is only about the size of a postcard, it took around 1½ hours to plot …