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

How can I get the default code page for a locale? – The Old New Thing

Posted by jpluimers on 2017/06/20

Ask GetLocaleInfo (example function GetAnsiCodePageForLocale included): [WayBackHow can I get the default code page for a locale? – The Old New Thing

UINT GetAnsiCodePageForLocale(LCID lcid)
{
  UINT acp;
  int sizeInChars = sizeof(acp) / sizeof(TCHAR);
  if (GetLocaleInfo(lcid,
                    LOCALE_IDEFAULTANSICODEPAGE |
                    LOCALE_RETURN_NUMBER,
                    reinterpret_cast<LPTSTR>(&acp),
                    sizeInChars) != sizeInChars) {
    // Oops - something went wrong
  }
  return acp;
}

And even though you didn’t ask, you can use LOCALE_IDEFAULT­CODE­PAGE to get the OEM code page for a locale.

Bonus gotchaThere are a number of locales that are Unicode-only. If you ask the Get­Locale­Info function and ask for their ANSI and OEM code pages, the answer is “Um, I don’t have one.” (You get zero back.)

Related:

–jeroen

Posted in Development, Encoding, internatiolanization (i18n) and localization (l10), Software Development, The Old New Thing, Windows Development, Windows-1252 | 2 Comments »

Mac OS X – need to research this one day: How do I Check DHCP Lease info in terminal – via Ars Technica OpenForum

Posted by jpluimers on 2017/06/20

One day I need to research how to get the conversions right for this: How do I Check DHCP Lease info in terminal – Ars Technica OpenForum as I think that ipconfig getoption en0 lease_time gives me the value in a different format than date -r expects.

Also:

At T1 seconds (typically set to 0.5*lease_time) after the last successful renewal, the DHCP client attempts to renew it’s lease with the DHCP server that granted it’s current address via unicast. If unsuccessful, at T2 seconds (typically set to 0.875*lease_time) after the last renewal, the DHCP client attempts to rebind with any DHCP server via multicast.

–jeroen

Posted in Apple, bash, Development, Mac, Mac OS X / OS X / MacOS, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »

MikroTik SFP module compatibility table – MikroTik Wiki

Posted by jpluimers on 2017/06/19

Paraphrased from MikroTik SFP module compatibility table – MikroTik Wiki [WayBack]:

SFP+ interface compatibility settings with 1G links

For MikroTik devices with SFP+ interface that support both 10G and 1G link rate following settings are needed to be set on both linked devices for required interfaces. In order to get them working in 1G link rate.

  • auto-negotiation disabled
  • port speed 1G
  • FD

Devices which SFP+ ports support 1G links:

Devices which SFP+ interfaces can be used only for 10G links:

Some caveats leading to the above info: CCR1036-8G-2S+ SFP Problems – MikroTik RouterOS [WayBack]

–jeroen

Posted in Internet, MikroTik, Power User, routers | Leave a Comment »

keyboard shortcut to edit cell content? | Apple Support Communities

Posted by jpluimers on 2017/06/19

When you’ve got an Excel on Windows back-ground, sometimes simple stuff is difficult. So:

option+return edits a cell’s content.

Source: keyboard shortcut to edit cell content? | Apple Support Communities

–jeroen

Posted in Apple, Keyboards and Keyboard Shortcuts, Mac OS X / OS X / MacOS, OS X 10.10 Yosemite, OS X 10.11 El Capitan, Power User | Leave a Comment »

URLs for Mikrotik PCC load balancing

Posted by jpluimers on 2017/06/16

PCC load balancing saved my ass; here are some link I used:

–jeroen

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

OpenSSH Escape Sequences (aka Kill Dead SSH Sessions) – The Lone Sysadmin

Posted by jpluimers on 2017/06/16

You can get the below help when pressing these keys in an OpensSSH session:

  1. Enter
  2. ~
  3. ?

So thats Enter, followed by tilde, then question mark.

Then you get this help:

Supported escape sequences:
 ~.   - terminate connection (and any multiplexed sessions)
 ~B   - send a BREAK to the remote system
 ~C   - open a command line
 ~R   - request rekey
 ~V/v - decrease/increase verbosity (LogLevel)
 ~^Z  - suspend ssh
 ~#   - list forwarded connections
 ~&   - background ssh (when waiting for connections to terminate)
 ~?   - this message
 ~~   - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

The one I use most is below; it leaves my tmux session alone.

  1. Enter
  2. ~
  3. .

–jeroen

via: SSH Escape Sequences (aka Kill Dead SSH Sessions) – The Lone Sysadmin

Posted in Power User, Security | Leave a Comment »

IPv6 on Mikrotik URLs

Posted by jpluimers on 2017/06/15

I need to really put some effort in this:

–jeroen

https://www.youtube.com/watch?v=TfCERJMC3wQ

Posted in Internet, MikroTik, Power User, routers | Leave a Comment »

Parable of the Polygons – a playable post on the shape of society

Posted by jpluimers on 2017/06/15

A diverse community pays off but also needs investment from everyone. Small steps…

A playable post on how harmless choices can make a harmful world.

Source: Parable of the Polygons – a playable post on the shape of society

–jeroen

Posted in Development, Fun, History, Software Development | Leave a Comment »

What the DEC?!? Records of Minicomputer Giant Digital Equipment Corporation Open for Research at CHM | Computer History Museum

Posted by jpluimers on 2017/06/14

The records represent the largest and most complete set of DEC records in existence, dating from 1947 through 2002, with the bulk from the company’s years of operation from 1957 through 1998, when they were bought by Compaq Computer. The collection is a comprehensive technical history of every major computing innovation at DEC, as well as its nontraditional business culture, which still serves as an industry model—nearly every contemporary company strives for a “culture of innovation.” The processing of the collection presents an extraordinary opportunity to study DEC’s product lines and business practices in depth as was never before possible. Very few companies as influential as DEC have as long a history, and the breadth and depth of this collection makes it unique in its comprehensiveness.

Source: [WayBackWhat the DEC?!? Records of Minicomputer Giant Digital Equipment Corporation Open for Research at CHM | Computer History Museum

via: [WayBackAlan Cox – Google+

I could spend months in this archive (:

The PDP-11 and VAX-11/750 were the machines I first learned about DECNET, EARN and BITNET.

–jeroen

Posted in History | Leave a Comment »

Mikrotik firewall URLs

Posted by jpluimers on 2017/06/14

Some links that inspired me for various Mikrotik firewall rules:

–jeroen

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »