The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for December 30th, 2021

Leerlingen zelf een toets laten maken die ze zelf kunnen nakijken (door Martijn Leisink)

Posted by jpluimers on 2021/12/30

[Archive.is] Martijn Leisink on Twitter: “Soms wil je leerlingen een zelftoets laten maken. Je wil dat ze die zelf na kunnen kijken, maar tegelijkertijd wil je juist niet dat ze meteen de antwoorden op kunnen zoeken. Dat lijkt tegenstrijdig, maar er is een manier! (Ter inspiratie voor andere bèta-docenten.)… “

Thread: [Wayback] Thread by @mleisink on Thread Reader App – Thread Reader App

Truc: [Archive.is] Harry de Jonge on Twitter: “In eerste instantie 8 van de 9 goed. Uit de formule volgt dat ‘t te behalen totaal aantal punten n x 360 – 90 moet zijn, met behulp daarvan bepaald dat ik vraag 8 fout had. Ergens 2 of 4 van aftrekken is nog lastig😀 Natuurkunde is toegepaste wiskunde.… “

Zelf maken: [Archive.is] http://zelftoets.wiskunstelaar.nl/

Maak een aantal vragen met telkens drie antwoordopties.
Zet de getallen in de tabel hierboven voor de antwoorden.
Een leerling kan met het volgende recept controleren hoeveel antwoorden hij goed heeft:

  1. Tel de getallen voor het antwoord van jouw keus bij elkaar op.
  2. Vermenigvuldig het resultaat met 10.
  3. Druk op de knop sinus en vervolgens op de inverse cosinus.
  4. Deel de uitkomst door 20 en je weet hoeveel vragen je goed hebt beantwoord.

Leerlingen kunnen dus wel achterhalen hoeveel antwoorden ze goed hebben, maar niet welke antwoorden goed zijn.
Let er overigens op dat de rekenmachine op graden moet staan en niet op radialen!

–jeroen

Posted in Learning/Teaching, LifeHacker, Power User | Leave a Comment »

Productivity tips by Florian Haas and David Moreau-Simard: the mottos you work by

Posted by jpluimers on 2021/12/30

My own motto: learn new things every day.

Florian:

[Archive.is] Florian Haas 🇪🇺 on Twitter: “Docs or it didn’t happen.… “

David:

[Archive.is] ☁David Moreau-Simard on Twitter: “Hey software and system folks, I’m curious: what are some of the mottos you work by ? I’ll start:

Via Florian’s pinned Twitter post I found while writing media.ccc.de – No, we won’t have a video call for that! (Communications in distributed teams by Florian Haas).

–jeroen

Posted in Development, DevOps, Software Development | 1 Comment »

windows 7 – How can I eject a CD via the cmd? – Super User

Posted by jpluimers on 2021/12/30

Quite a while ago I found [Wayback] windows 7 – How can I eject a CD via the cmd? – Super User, but forgot to document that in the batch-files I created from it.

It shows both this one-liner:

powershell "(new-object -COM Shell.Application).NameSpace(17).ParseName('D:').InvokeVerb('Eject')"

The hardcoded const 17 is for the ssfDRIVES element in the ShellSpecialFolderConstants, which is documented at [Wayback] ShellSpecialFolderConstants (shldisp.h) – Win32 apps | Microsoft Docs.

There is no PowerShell equivalent of that element, hence the hardcoded value 17.

The script invokes the verb Eject, which works on any kind of removable media (not just optical drives). If you want to limit it to only certain drive types, then you would need to compare the Type of the ParseName() result. However, that result has a Type property returns a string for which the possible values are not documented.

Here are some links I tried to find out what is returned:

In addition to the Shell.Application, there also is Scripting.FileSystemObject, which allows enumerating the drives and filter on DriveType. This is the relevant documentation:

The second example in the above mentioned answer shows how to use this to filter for optical drives.

It also shows a cool technique to have a hybrid batch-file/JScript script:

@if (@CodeSection == @Batch) @then

@echo off
setlocal

cscript /nologo /e:JScript "%~f0"

goto :EOF

@end // end batch / begin JScript hybrid chimera

// DriveType=4 means CD drive for a WScript FSO object.
// See http://msdn.microsoft.com/en-us/library/ys4ctaz0%28v=vs.84%29.aspx

// NameSpace(17) = ssfDRIVES, or My Computer.
// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb774096%28v=vs.85%29.aspx

var oSH = new ActiveXObject('Shell.Application'),
    FSO = new ActiveXObject('Scripting.FileSystemObject'),
    CDdriveType = 4,
    ssfDRIVES = 17,
    drives = new Enumerator(FSO.Drives);

while (!drives.atEnd()) {
    var x = drives.item();
    if (x.DriveType == CDdriveType) {
        oSH.NameSpace(ssfDRIVES).ParseName(x.DriveLetter + ':').InvokeVerb('Eject');
        while (x.IsReady)
            WSH.Sleep(50);
    }
    drives.moveNext();
}

–jeroen

Posted in Batch-Files, Development, JScript, PowerShell, Scripting, Software Development | Leave a Comment »