NPN, PNP, Sinking, Sourcing

I seem to always get in a bit of a muddle with the terminology and which sensor goes with which kind of input. This is the most comprehensive and accurate document I’ve found, so I’ll be using it as quick reference from now on.

Downloaded from https://cdn.automationdirect.com/static/specs/sinksource.pdf

QGIS 3.0 Map tips

I’ve been playing with QGIS, and it’s an awesomely powerful piece of software for map making an analyzing geographical data.

It has the ability to show HTML map tips when you hover over certain features, but with some restrictions.

The containing box (which you can’t style, AFAIK) has

  • white background
  • 1px border in grey (#120909),
  • 8px padding top & left and 12px padding right and bottom

The maximum size of the box is limited to half the size of the graphics area, which means scroll bars appear within the map tip if the content plus the padding and border would make it bigger than that.

Draftsight Units

 

I was a little confused by how units work in Draftsight, so now I think I’ve figured it out i thought I’d share.

The Model

They key thing to understand is that that the model, ie. the lines you’ve drawn, isn’t in mm or inches or feet, it’s just 1 Draftsight “unit”. When you change the settings related to units, nothing happens to model, it just changes what you see on the screen (in various places, like the cursor position in the status bar, or the length & co-ordinates of lines in the object properties).

The key setting is under Drawing Settings -> Unit System -> Length -> Type. Lets’ go through the options:

Archtectural
1 Draftsight unit is interpreted as 1 inch, but it will display that as feet & inches if it’s more than 1 foot. Distances less than 1 inch are shown as fractions (where the denominator is a power of 2)
Decimal
No interpretation. You’re simply shown the number of Draftsight units, with decimals used for distances less than 1 unit.
Engineering
1 Draftsight unit is interpreted as 1 inch, but it will display that as feet & inches if it’s more than 1 foot. Distances less than 1 inch are shown as decimals
Fractional
No interpretation. You’re simply shown the number of Draftsight units, but the instead of using decimals, fractions are used for quantites less than 1.
Scientific
No interpretation, but the number is presented in Scientific Notation

Blocks

Special handling is required for blocks because two designers could both draw something in different units. Alice draws in cm (ie. 1 draftsight unit = 1 cm) and Bob draws in inches (1 draftsight unit = 1 mm). If these drawings were simply combined without consideration of this, the scale would be different and they couldn’t be used together.

To get round this, Draftsight makes a record of the units when you create a block. The default for this is set in Drawing Settings -> Unit System -> Units Scale -> Block units format. When Alice creates a block, Draftsight records that unit in the block, so whenever it’s used Draftsight knows that 1 draftsight unit = 1 cm.

When Bob is drawing, he has the setting set to “Inches”. If he inserts a block made by Alice, Drafsight will recognise that his setting is different from the value stored in the block and scale it by the correct amount (2.54 in this case).

Dimensions

Dimensions deserve a mention while we’re discussion units. The key settings is Drafting Styles -> Dimension -> Linear Dimension -> Format. This has the same options as the first setting discussed above. This can be overridden on a per-dimension basis in the properties for the dimension.

 

Wiring colors

A quick reference, this is far from authoritative or exhaustive but intended to be used a go-to unless you have better information:

L1
(Hot 1)
(Hot 2) L2 L3 N PE
Europe Single Phase Brown Blue Green / Yellow
Three Phase Brown Black Grey Blue
(if present)
Green / Yellow
USA Single Phase 120 V Black White Green or Bare
Split Phase 120/240 V Black Red White Green or Bare
Three Phase 120/208 V Black Red Blue White
(if present)
Green or Bare

USA Plug configurations – NEMA Plug & Receptacle chart

SpiderOak Purge Historical versions

I don’t like the default for SpiderOak’s –purge-historical-versions command, which does this:

This allows you to remove historical versions of files in your backup set according to the following schedule, which is to keep one version per hour for the last 24 hours, then one version per day for 30 days, then one version per week thereafter.

So here’s my own version, which does:

  • One version per hour for the last 24 hours
  • Then one version per day for 14 days
  • Then one version per week for 8 weeks
  • Then one version per month thereafter

On Windows
"C:\Program Files\SpiderOakONE\SpiderOakONE.exe" --purge-historical-versions h24,d30,w8,m --verbose

On Linux
SpiderOakONE --purge-historical-versions h24,d30,w8,m --verbose

Gimp Plugin – fixed crop

This is a simple script to crop a plugin with fixed dimensions – I used it to crop out the window border from a VNC Client connected to an industrial touchscreen.

(script-fu-register
    "script-fu-crop"                    ;func name
    "Screenshot Crop"                   ;menu label
    "Crops an image to a fixed size"    ;description
    "Sandy Scott"                       ;author
    ""                                  ;copyright notice
    "January 11, 2015"                  ;date created
    ""               ;image type that the script works on
    SF-IMAGE    "Image"                 0
    SF-DRAWABLE "Drawable"              0
)
(script-fu-menu-register "script-fu-crop" "/Filters/Custom/")
(define (script-fu-crop image drawable)

    ; Prep
    (gimp-context-push)
    (gimp-image-undo-group-start image)
    
    ; Crop the image
    (gimp-image-crop image 800 480 8 30)
    
    ; Finishing Off
    (gimp-image-undo-group-end image)
    (gimp-context-pop)
    (gimp-displays-flush)
)

Save in the gimp scripts folder, something like C:\Users\JoeBloggs\.gimp-2.8\scripts\ on Windows, or /home/JoeBloggs/.gimp-2.8/scripts/ on Linux.

It will appear under Filters > Custom

MusicBrainz Classical Style Guide – Quick Reference

Editing MusicBrainz data can be intimidating at the best of times, but Classical recordings can be particularly tricky, as the 4 different “Artist” fields can all be different.

Hopefully this quick reference guide should avoid a few more mistakes in future.

Alternatively, check out the full Classical Style Guide

UniLogic functions

Int to Real

D = A + B x 10 ^ (-C)

Real to Int

A = XXXXXX.YYYYYY

C = XXXXXX

D = Round 0.YYYYYY to B decimal places, then multiply by 10 ^ B

At least I think this is what it’s supposed to do – it seems to have some issues:

  • Rounding close to 0.5 can be somewhat unpredictable. e.g. A = 5.246, B = 1 will give D=3, not D=2 as it should.
  • Note that the Integer part is always simply truncated – don’t expect this function to Round correctly – e.g. A = 12.99, B = 1 will give C=12 and D=10, instead of C=13, D=0 as you might expect!