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 1,862 other subscribers

Archive for 2019

Stack Exchange – stackoverflow OpenID

Posted by jpluimers on 2019/09/06

If you want to log into any stackoverflow/superuser/serverfault/stackexchange related network using their OpenID, then read the following from [WayBackStack Exchange:

Your Stack Exchange account, or StackID, is a reusable form of public identity that can be used to log in to any website that supports OpenID.

To log in to sites in the Stack Exchange network:

  • click the “Log In with Stack Exchange” button

To log in to websites that support OpenID:

  • enter the URL https://openid.stackexchange.com

–jeroen

Posted in Pingback, Power User, Stackoverflow | Leave a Comment »

Money quote: “Reliability is valued far more than new features”

Posted by jpluimers on 2019/09/06

Remember:

  • Money quote: “Reliability is valued far more than new features”
  • Here’s the thing: As soon as your device is on a network, “stasis == reliability” is false.

There’s really no point in attempting to “but” or “what if” this – it’s just wrong. Sadly, while uptake of networking is rapidly approaching 100%, understanding of this point is still hovering near zero.

via:

–jeroen

Background:

Posted in LifeHacker, Power User | Leave a Comment »

Firebird 3.x SQL Language Changes

Posted by jpluimers on 2019/09/05

Since I likely need these [WayBack] SQL Language Changes in the future (some breaking Firebird 2.x habits).

The odd thing is that I got there looking for “no column name specified for column number 1 in derived table” when doing some weird CTE query things in Firebird 2.5x

–jeroen

Posted in Database Development, Development, Firebird | Leave a Comment »

Every time I try, I’m reminded of: You Don’ t Know JavaScript

Posted by jpluimers on 2019/09/05

I forgot how I originally bumped into the book series, but every time I try to program in JavaScript I’m reminded of them: You Don’ t Know JavaScript.

Originally a KickStarter project, they are now on GitHub and there is a Twitter account irregularly posting about them:

Titles

–jeroen

Read the rest of this entry »

Posted in Development, JavaScript/ECMAScript, Scripting, Software Development | Leave a Comment »

Python “NameError: name ‘socket’ is not defined”

Posted by jpluimers on 2019/09/05

I bumped into this a while ago, but could not find back the code example showing it, so below is the SO question to solve it:

NameError: name 'socket' is not defined

[WayBackHow to refer to a standard library in a logging configuration file?

Related: [WayBack[Tutor] Socket error in class

–jeroen

Posted in Development, Python, Scripting, Software Development | Leave a Comment »

Early version of Apple II Logo. · PDP-10/its-vault@4145dea · GitHub

Posted by jpluimers on 2019/09/04

[WayBack] Early version of Apple II Logo. · PDP-10/its-vault@4145dea · GitHub:

Early version of Apple II Logo.

Written by:
- Stephen L. Hain
- Patrick G. Sobalvarro
- Leigh L. Klotz

Brows the source files at [WayBack] its-vault/files/aplogo at master · PDP-10/its-vault · GitHub.

Via Lars Brinkhoff – Google+ commenting at [WayBack] This week, Logo on the 6502, in honour of Seymour Papert who died this week. He did a lot more, but Logo is a lasting and perhaps most visible contribut… – mos6502 – Google+.

Instructions at [WayBack] its-vault/usage.doc at master · PDP-10/its-vault · GitHub

–jeroen

Posted in //e, Apple, Apple ][, Development, Power User, Software Development | Leave a Comment »

python multithreading wait till all threads finished

Posted by jpluimers on 2019/09/04

A great tip from [WayBack] python multithreading wait till all threads finished:

ou need to use join method of Thread object in the end of the script.

t1 = Thread(target=call_script, args=(scriptA + argumentsA))
t2 = Thread(target=call_script, args=(scriptA + argumentsB))
t3 = Thread(target=call_script, args=(scriptA + argumentsC))

t1.start()
t2.start()
t3.start()

t1.join()
t2.join()
t3.join()

Thus the main thread will wait till t1t2 and t3 finish execution.

I’ve used a similar construct that’s used by the multi-threading code I posted a few ways ago (on Passing multiple parameters to a Python method: the * tag) in the ThreadManager class below.

But first some of the other links that helped me getting that code as it is now:

Example:

class ThreadManager:
    def __init__(self):
        self.threads = []

    def append(self, *threads):
        for thread in threads:
            self.threads.append(thread)

    def runAllToCompletion(self):
        ## The loops are the easiest way to run one methods on all entries in a list; see https://stackoverflow.com/questions/2682012/how-to-call-same-method-for-a-list-of-objects
        # First ensure everything runs in parallel:
        for thread in self.threads:
            thread.start()
        # Then wait until all monitoring work has finished:
        for thread in self.threads:
            thread.join()
        # here all threads have finished

def main():
    ## ...
    threadManager.append(
        UrlMonitorThread(monitor, "http://%s" % targetHost),
        SmtpMonitorThread(monitor, targetHost, 25),
        SmtpMonitorThread(monitor, targetHost, 587),
        SshMonitorThread(monitor, targetHost, 22),
        SshMonitorThread(monitor, targetHost, 10022),
        SshMonitorThread(monitor, targetHost, 20022))

    threadManager.runAllToCompletion()

–jeroen

Posted in Development, Python, Scripting, Software Development | Leave a Comment »

“Functional programmer: (noun) One who names variables ‘x’, names functions ‘f’, and names code patterns ‘zygohistomorphic prepromorphism.'” — James Iry on Twitter

Posted by jpluimers on 2019/09/04

“Functional programmer: (noun) One who names variables ‘x’, names functions ‘f’, and names code patterns ‘zygohistomorphic prepromorphism.'” — James Iry

–jeroen

Read the rest of this entry »

Posted in Development, Fun, Functional Programming, Quotes, Software Development, T-Shirt quotes | Leave a Comment »

How to Install Node.js and NPM on a Mac

Posted by jpluimers on 2019/09/03

Link archival: [WayBack] How to Install Node.js and NPM on a Mac:

In this article, I’ll take you through the process of installing Node.js and NPM on a Mac using Homebrew.

TL;DR

  1. Ensure you have installed homebrew.
  2. Run brew install node.

–jeroen

 

Posted in Apple, Development, Mac OS X / OS X / MacOS, Power User, Software Development | Leave a Comment »

how to filter name/value pairs under a registry key by name and value in PowerShell?

Posted by jpluimers on 2019/09/03

A very concise way for [WayBackhow to filter name/value pairs under a registry key by name and value in PowerShell?:

$path = 'hkcu:\Software\Microsoft\Windows\CurrentVersion\Extensions'
(Get-ItemProperty $path).PSObject.Properties |
  Where-Object { $_.Name -match '^xls' ` -or $_.Value -match 'msaccess.exe$' } |
  Select-Object Name, Value

Thanks montonero for getting me on that path and pointing me to the hidden PSObject property which by itself has Properties, and making me find these links with background information:

More in-depth information:

  • [WayBack] Get-Member (Microsoft.PowerShell.Utility)
    • The Get-Member cmdlet gets the members, the properties and methods, of objects. To specify the object, use the InputObject parameter or pipe an object to Get-Member. To get information about static members, the members of the class, not of the instance, use the Static parameter. To get only certain types of members, such as NoteProperties, use the MemberType parameter.
    • -Force

      Adds the intrinsic members (PSBase, PSAdapted, PSObject, PSTypeNames) and the compiler-generated get_ and set_ methods to the display. By default, Get-Member gets these properties in all views other than Base and Adapted, but it does not display them.

      The following list describes the properties that are added when you use the Force parameter:

      • PSBase: The original properties of the .NET Framework object without extension or adaptation. These are the properties defined for the object class and listed in MSDN.
      • PSAdapted. The properties and methods defined in the Windows PowerShell extended type system.
      • PSExtended. The properties and methods that were added in the Types.ps1xml files or by using the Add-Member cmdlet.
      • PSObject. The adapter that converts the base object to a Windows PowerShell PSObject object.
      • PSTypeNames. A list of object types that describe the object, in order of specificity. When formatting the object, Windows PowerShell searches for the types in the Format.ps1xml files in the Windows PowerShell installation directory ($pshome). It uses the formatting definition for the first type that it finds.
  • [WayBack] PSObject Class (System.Management.Automation)
    • Wraps an object providing alternate views of the available members and ways to extend them. Members can be methods, properties, parameterized properties, etc.
  • [WayBack] PSObject.Properties Property (System.Management.Automation)
    • Gets the Property collection, or the members that are actually properties.
      Is of type PSMemberInfoCollection<PSPropertyInfo>
  • [WayBack] PSMemberInfoCollection<T> Class
    • Serves as the collection of members in an PSObject or MemberSet
  • [WayBack] PSPropertyInfo Class (System.Management.Automation)
    • Serves as a base class for all members that behave like properties.
  • [WayBack] Difference between PSObject, Hashtable and PSCustomObject
  • [WayBack] Combining Objects Efficiently – Use a Hash Table to Index a Collection of Objects
    • With objects objects everywhere it may not seem apparent, but hash tables are still needed.  When the PowerShell mind sets to work it can be very easy to use where and selects everywhere to get you…
  • [Archive.isCustom objects default display in PowerShell 3.0
  • [WayBack] Using PSObject to store data in PowerShell | 9to5IT
    • PowerShell’s PSObject is a powerful tool which is used to store, retrieve, sort and export data. Here is how to use PSObject to store data in PowerShell.

–jeroen

Posted in CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Leave a Comment »