Blog

  • wörship

    wörship

    wörship

    Instagram filter used: Lo-fi

    Photo taken at: Sir Adam Beck Hydroelectric Generating Stations

    View in Instagram ⇒

  • shingles

    shingles

    shingles

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • Spring Raindrop Switches for @makersmakingchange

    Spring Raindrop Switches for @makersmakingchange

    Spring Raindrop Switches for @makersmakingchange

    Instagram filter used: Normal

    Photo taken at: Akin Collective Sunrise Studios

    View in Instagram ⇒

  • Brisket’s good

    Brisket’s good

    Brisket’s good

    Instagram filter used: Normal

    Photo taken at: The Barbq Factory

    View in Instagram ⇒

  • Local ‘Q

    Local ‘Q

    Local ‘Q

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • PET-G is so pretty …

    PET-G is so pretty …

    PET-G is so pretty …

    Instagram filter used: Lo-fi

    Photo taken at: Akin Collective Sunrise Studios

    View in Instagram ⇒

  • Possibly Painless Network Printing from your Raspberry Pi

    Printing from computers goes through waves of being difficult to being easy, then back to difficult again. This is likely due to the cycles of technology, complexity and user demand flow in and out of sync. I think we’re at peak annoyance right now.

    It’s even harder with Raspberry Pis, as when printer drivers support Linux, 90% of them are for x86 or x86_64 computers only (Canon: ಠ_ಠ). ARM doesn’t get a look in. But one technology does actually seem to help: network printers that support IPP — Internet Printing Protocol.

    We had an old Brother laser printer that just got slower and crankier and less useful as a printer, so yesterday I got a new Brother DCP-L2550DW to replace it. It says it supports Linux in the spec, but I knew not to be too optimistic with my Raspberry Pis. And indeed, it was seen on the network but no driver was found. I had a sad.

    What turned my frown upside down was finding out about Raspbian’s cups-ipp-utils package. For desktop use, install it this way:

    sudo apt install cups cups-ipp-utils system-config-printer

    (leave off system-config-printer if you’re running from the terminal.)

    Update: while you’re here, you might also want to install the print-to-PDF driver too. This allows you to print without wasting paper. Install it (and the IPP driver) with:

    sudo apt install cups cups-ipp-utils system-config-printer printer-driver-cups-pdf

    In many cases, this might be all you need to do: the network printers should be automatically found and added as devices.

    Adding the new printer

    On the desktop, open up Preferences → Print Settings and add a new printer. Yes, it prompts for your user password which you may have forgotten. I’ll wait while you try to remember it …

    Now under Network Printers, you should see a device you recognize. Pick the one that says IPP network printer somewhere:

    IPP network printer

    Here’s where the magic happens: you actually want to pick the generic driver for once:

    Select Generic (recommended) manufacturer

    And again, the IPP utilities package will have picked the right driver for you:

    Just go with what the driver suggests

    Changing the name and location is optional:

    Your new printer’s almost ready to go!

    Hit Apply, and you should be printing!

    (Hey, printer manufacturers have been known to be evil and make good, working stuff suddenly not work. IPP is supposed to make everything sparkly again, but I can’t guarantee that something wicked won’t come this way.)

    Update: After a few months of using the Brother DCP-L2550DW, I don’t recommend you buy it. It’s a perfectly capable printer, but it takes ‘chipped’ toner cartridges that:

    1. stop dead when you hit their page count limit, wasting toner and preventing you from finishing the print job;
    2. can’t easily be refilled by local technicians, so are wasteful of resources.

    To get around (1), select Continue instead of Stop in the Toner Out configuration menu.

    Update, January 2020: with sales and all needing a printer for work, the DCP-L2550DW will go with me to the office. I now have a MFC-L2750DW at home that scans to network, amongst other things. IPP proved it was magic yet again by the new printer being found and just worked with all my machines as soon as I added it to the network.

  • Everybody’s walkin’ the dinosaur …

    Everybody’s walkin’ the dinosaur …

    Everybody’s walkin’ the dinosaur …

    Instagram filter used: Gingham

    Photo taken at: Wye Marsh Wildlife Centre

    View in Instagram ⇒

  • Just what 2019 needs: the QBasic Online Help Index

    QBasic (from olddos.exe) running nicely under dosbox on Linux

    Only umpteen years late, I bring you the

    QBasic Online Help Index — https://scruss.com/qbasic_hlp/

    It’s the QuickHelp file from Microsoft’s ancient-but-still-useful QBasic interpreter for MS-DOS. I converted it to HTML, and made some minor cleanups so it would work better on the web.

    So if you’ve got a hankering to understand the parameters for MKSMBF$ or know the syntax of PRINT USING, I’ve got your back.

  • gleeful bash scripting: contrived GCD function

    The greatest common divisor (gcd) of two natural numbers is the largest number that evenly divides both. For instance gcd(8, 12) is 4. There are many clever and efficient ways to calculate the gcd of two numbers on a Linux machine. The method presented here is not among them.

    #!/bin/bash
    gcd(){ comm -12 --nocheck-order <(factor $1|sed 's/^[^ ]*/1/;s/ /\n/g') <(factor $2|sed 's/^[^ ]*/1/;s/ /\n/g')|tr '\n' \*|sed 's/.$/\n/'|bc;}
    gcd $1 $2

    (Contrived) example:

    gcd.sh 24691357802469135780246913578 61728394506172839450617283945
    12345678901234567890123456789

    Which breaks down as:

    prime factors of
    24691357802469135780246913578
    prime factors of
    61728394506172839450617283945
    2 
    33
    33
    33
     5
    77
    1313
    3131
    3737
    211211
    241241
    21612161
    36073607
    38033803
    29061612906161

    Multiply the factors common to both:

    3 × 3 × 3 × 7 × 13 × 31 × 37 × 211 × 241 × 2161 × 3607 × 3803 × 2906161 = 12345678901234567890123456789

    I’m sure someone else has used the output of factor and comm in this way before. The hard part was getting coprime numbers to output 1.

  • Digital Photo Archaeology: featuring hardware DRM from the crypt

    So I picked up this large boy from the MSU Surplus Store:

    Sony Digital Mavica MVC-FD91 (c. 1998 CE) — yes, that’s a 3½” floppy drive on there

    You get about 7 high-resolution pictures on a disk. And high resolution by 1998 standards means this:

    1024×768 whole pixels: that’s huge! The camera is autofocus with image stabilization, so it was quite a nifty unit at the time.

    Pre-dating EXIF, its image metadata is limited. There’s an external ‘411’ thumbnail file that looks a bit like this:

    If you care to dig about in such an ancient file, I’ve got a matching image and its 411 file here: MVC-005X.zip. And manuals? Here: Sony_Mavica-FDC91-W0007229M.pdf

    Most annoyingly, the camera really only likes real Sony batteries, or it shuts down with an “InfoLithium” battery error (swearies in link). As this battery format is now used in generate photo lighting systems and Sony don’t make it any more, this may be a camera that dies from DRM before anything else.

  • HSV(ish) Colour Wheel in Python

    Years back I wrote something about HSV colour cycling for Arduino. Things have moved on: we’re all writing code in MicroPython/CircuitPython now and 8-bit micro-controllers are looking decidedly quaint. Yes, yes; some of you must still write code in PIC assembly language and I’m sure that’s very lovely for you indeed don’t @ me.

    If you look at the output of a typical HSV to RGB algorithm, the components map something like this:

    Hue between 0-1, with saturation and value set to 1. Output range 0-1 for each component

    These lines remind me so much of sine waves, if very blocky ones. The red trace in particular is just the cosine function, with the input range of 0..2Ï€ and the output range of -1..1 both mapped to 0..1. The green and blue traces are just the red trace shifted horizontally by â…“ and â…” respectively.

    Since we have transcendental functions in MicroPython, we don’t have to fossick about with linear approximations. The common RGB LED function wheel() uses similar linear interpolation as the graph above. Why make do with blocky cogwheels when you can have a smooth colour wheel?

    def cos_wheel(pos):
         # Input a value 0 to 255 to get a colour value.
         # scruss (Stewart Russell) - 2019-03 - CC-BY-SA
         from math import cos, pi
         if pos < 0:
             return (0, 0, 0)
         pos %= 256
         pos /= 255.0
         return (int(255 * (1 + cos( pos            * 2 * pi)) / 2),
                 int(255 * (1 + cos((pos - 1 / 3.0) * 2 * pi)) / 2),
                 int(255 * (1 + cos((pos - 2 / 3.0) * 2 * pi)) / 2))
    
    Though you never quite get a pure red, green or blue, the results are pleasing

    Quite elegant, I thought. Yeah, it may be computationally expensive, but check next year when we’ll all be running even faster µcs. Certainly none of the mystery switch statements or nested conditionals you’ll see in other code. Just maths, doing its thing.

    First half is cosine wheel, second half (after red flash) is linear
  • Invented right here: the T-Nut

    from US Patent 3480061 ‘Fastener member’ by W. H. Leistner, granted 1969-11-25

    Simple things like fasteners don’t seem to be invented. It’s almost as if they’ve always been around. Like T-nuts — those hammer-in furniture nuts that also find use as 3D printable tripod mounts — someone invented those?

    Sure enough, it seems that local company Sigma Tool & Machine have a lot to do with T-nut development. They’re now on Nantucket Blvd just north of me, and they used to be at 96 Crockford Blvd very close by.

  • glowmoose

    glowmoose

    glowmoose

    Instagram filter used: Normal

    View in Instagram ⇒

    On Thingiverse: Glow Moose. Uses 8 mm LED template.