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,860 other subscribers

Archive for August, 2017

What is the right way to convert into UNIX timestamp from the date and time in C/C++? – Stack Overflow

Posted by jpluimers on 2017/08/16

Thanks R.. for answering this:

POSIX has a formula for exactly what you want:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15 [WayBack]

tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
    (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
    ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400

This works whenever you have a broken-down time in GMT, even if the underlying system’s mktime, etc. functions do not use the same format time_t as “Unix timestamps”.

If your original time is in local time, you can use mktime and gmtime to convert it to GMT using the system’s notion of timezone rules. If you want to apply your own timezone offset rules, just do that manually before using the above formula.

Source: What is the right way to convert into UNIX timestamp from the date and time in C/C++? – Stack Overflow [WayBack]

For testing and more examples: Epoch Converter – Unix Timestamp Converter [WayBack]

Hopefully this will help me getting better implementations for these:

–jeroen

Posted in Algorithms, C, C++, Development, Software Development | Leave a Comment »

Why doesn’t RevertToSelf undo the most recent SetThreadToken? | The Old New Thing

Posted by jpluimers on 2017/08/16

Oops: I fell in this trap as well: When you call Set­Thread­Token, [WayBack] it replaces the token. When you call Revert­To­Self [WayBack], the token is cleared and the thread no longer has a token. Maybe Revert­To­Self should have been named Clear­Thread­Token, since that would emphasize that the function erases any existing thread token, leaving the thread to inherit the identity of its host process.

Source: Why doesn’t RevertToSelf undo the most recent SetThreadToken? | The Old New Thing [WayBack]

–jeroen

Posted in Development, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Some links on Belise/Elise licensing server (yes, AppWave is dead or at least: should be)

Posted by jpluimers on 2017/08/15

Some links on the Embarcadero License Center server (formerly known as Belise and Elise) from my contributions to these G+ threads:

When for instance your workstations cannot communicate to the external license servers or you want to run concurrent Delphi/C++-Builder/RAD-Studio instances on your local network, you need to run the Elise licensing server on your network, which requires you to have a server with Java running somewhere.

URL Title
http://docwiki.embarcadero.com/ELC/en/Obtaining_License_Files [WayBackObtaining License Files – ELC
http://docwiki.embarcadero.com/ELC/en/Installing_the_Embarcadero_License_Center [WayBackInstalling the Embarcadero License Center – ELC
http://support.codegear.com/article/43557 [WayBackDelphi, C++Builder, RAD Studio XE5 Update 2 install for network licenses
http://license.embarcadero.com/lservers/elise.jsp [WayBackEmbarcadero License Center Setup
http://support.codegear.com/article/36588 [WayBackEmbarcadero License Server overview
http://support.codegear.com/license [WayBackLicense Server
https://docs.bmc.com/docs/display/Configipedia/Borland+License+Server [WayBackBorland License Server – Configipedia – BMC Documentation
http://borland.public.jbuilder.enterprise.narkive.com/dk5UBkGc/borland-license-server-instalation [WayBackBorland License Server Instalation

Despite some of the documentation, it runs on more recent Windows versions too.

Not sure about the money: it’s just that a few clients of mine use it as it makes it easier to manage licenses when you switch contractors or not having various team members only use Delphi part of the time.

Read the rest of this entry »

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

Inline code highlighting in reStructuredText – Stack Overflow

Posted by jpluimers on 2017/08/15

To inline code inside reStructuredText embed it with back-ticks and pre-pend the first back-tick with :code:

This is how some text with :code:`a = b + c` embedded will look like.

This is how some text with a = b + c embedded will look like.

Source: Inline code highlighting in reStructuredText – Stack Overflow [WayBack]

The above is in addition to the a = b + c that renders to default code as described for instance by reST – reStructuredText — Sphinx/Rest Memo v1.0-14-ga2798e1 documentation [WayBack]

–jeroen

Posted in Development, Lightweight markup language, reStructuredText, Software Development | Leave a Comment »

Mikrotik UDP port 5678 usage is for MikroTik Neighbor Discovery Protocol (MNDP)

Posted by jpluimers on 2017/08/14

Just in case you see UDP port 5678 in the firewall log of your MikroTik device: it’s usage of the MikroTik Neighbor Discovery Protocol (MNDP) [WayBack] protocol.

You can either block Neighbour Discovery [WayBack] in the firewall or turn it off on the MikroTik Services [WayBack] or inspect any of these protocols:

Proto/Port Description
20/tcp FTP data connection
21/tcp FTP control connection
22/tcp Secure Shell (SSH) remote Login protocol
23/tcp Telnet protocol
53/tcp
53/udp
DNS
67/udp Bootstrap protocol or DHCP Server
68/udp Bootstrap protocol or DHCP Client
80/tcp World Wide Web HTTP
123/udp Network Time Protocol ( NTP)
161/udp Simple Network Management Protocol (SNMP)
179/tcp Border Gateway Protocol ( BGP)
443/tcp Secure Socket Layer (SSL) encrypted HTTP
500/udp Internet Key Exchange (IKE) protocol
520/udp
521/udp
RIP routing protocol
646/tcp LDP transport session
646/udp LDP hello protocol
1080/tcp SOCKS proxy protocol
1698/udp 1699/udp RSVP TE Tunnels
1701/udp Layer 2 Tunnel Protocol ( L2TP)
1723/tcp Point-To-Point Tunneling Protocol ( PPTP)
1900/udp
2828/tcp
Universal Plug and Play ( uPnP)
1966/udp MME originator message traffic
1966/tcp MME gateway protocol
2000/tcp Bandwidth test server
5246,5247/udp CAPsMan
5678/udp Mikrotik Neighbor Discovery Protocol
6343/tcp Default OpenFlow port
8080/tcp HTTP Web Proxy
8291/tcp Winbox
8728/tcp API
8729/tcp API-SSL
20561/udp MAC winbox
/1 ICMP
/2 Multicast | IGMP
/4 IPIP encapsulation
/41 IPv6 (encapsulation)
/46 RSVP TE tunnels
/47 General Routing Encapsulation (GRE) – used for PPTP and EoIP tunnels
/50 Encapsulating Security Payload for IPv4 (ESP)
/51 Authentication Header for IPv4 (AH)
/89 OSPF routing protocol
/103 Multicast | PIM
/112 VRRP

–jeroen

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

Play to Chromecast from VLC 3.0 on Mac OS X (OS X, macOS, or whatever other names apple comes up with)

Posted by jpluimers on 2017/08/14

On my Mac OS X machine, I got this to work with the 20170731 nightly of VLC 3.0.

[WayBackHow to stream from VLC to Your Chromecast (3.0 Updated Version) – VLC Media Player only explains the steps for Windows and Android, probably because they were the first platforms supported by VLC to render on Chromecast: [WayBackHow to Stream Videos from VLC to Chromecast (Including on Windows, Mac & Android) / [WayBackHow to Stream From VLC to Your Chromecast

To make it easier for end-users, on other platforms the menu entries are different.

  • Windows: Menu Video -> Render
  • Mac: Menu Playback -> Renderer (not Render as shown in some posts)
  • Linux: No UI yet.

I found this via [WayBackLatest VLC 3 Nightly Streams to Chromecast Perfectly! : Chromecast and [WayBackHow do I stream to Chromecast using VLC? – Unix & Linux Stack Exchange

On Linux, there is the command-line for now (which works on OS X and Windows as well), or if you insist: use MKChromecast as described in [WayBackHow To Cast Video from Ubuntu to a Chromecast – OMG! Ubuntu!. [WayBack]Mkchromecast This is a program to cast your macOS X, or Linux audio to your Google Cast or Sonos devices with sources at https://github.com/muammar/mkchromecast

On Windows and Mac OS X, after choosing the Render, the steps are the same:

  1. Choose Render discovery on
  2. Choose a Chromecast device
  3. Accept the security certificate for it

Download: [WayBackhttps://nightlies.videolan.org/build/macosx-intel/vlc-3.0.0-20170731-0451/vlc-3.0.0-20170731-0451-git.dmg via [WayBackhttps://nightlies.videolan.org/build/macosx-intel/vlc-3.0.0-20170731-0451/

I didn’t need [WayBack] https://nightlies.videolan.org/build/macosx-intel/vlc-3.0.0-20170731-0451/vlc-contrib-x86_64-apple-darwin15-20170731.tar.bz2 

–jeroen

Posted in Chromecast, Google, Media, Media Streaming, Power User, Video | Leave a Comment »

wget for nirsoft

Posted by jpluimers on 2017/08/11

Since they require a referer:

wget --referer=http://launcher.nirsoft.net/downloads/ -m -np http://download.nirsoft.net/nirsoft_package_1.20.10.zip
wget --referer=http://launcher.nirsoft.net/downloads/ -m -np http://download2.nirsoft.net/nirsoft_package_enc_1.20.10.zip

The latter has password nirsoft9876$

The filenames change over time (the 2016 archive of http://launcher.nirsoft.net/downloads/ shows http://download.nirsoft.net/nirsoft_package_1.20.5.zip and http://download2.nirsoft.net/nirsoft_package_enc_1.20.5.zip

Need to check out if I can automate this, as they seem to keep a SysInternals link http://download.nirsoft.net/sysinternals4.nlp

–jeroen

Posted in NirSoft, Power User, SysInternals, Windows | Leave a Comment »

Pass: The Standard Unix Password Manager

Posted by jpluimers on 2017/08/11

Anyone having experience with “Pass is the standard unix password manager, a lightweight password manager that uses GPG and Git for Linux, BSD, and Mac OS X.”?

Source: Pass: The Standard Unix Password Manager

–jeroen

Posted in Power User | Leave a Comment »

How-To: Automatically change your Mac’s display resolution when running specific apps [Video] – via: 9to5Mac

Posted by jpluimers on 2017/08/11

Yet another reason I love SwitchResX: : How-To: Automatically change your Mac’s display resolution when running specific apps [Video] | 9to5Mac

A few years ago, SwitchResX helped me switch my Mac machine to 1360×768 and 1888×1062 « The Wiert Corner – irregular stream of stuff

–jeroen

Posted in Apple, iMac, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks | Leave a Comment »

Experiments in Uniform Memory Management – grijjy blog

Posted by jpluimers on 2017/08/10

TL;DR of [WayBackExperiments in Uniform Memory Management – grijjy blog:

the closest we can get to uniform memory management is to use object interfaces

The reason is that cross platform memory management in Delphi is a mess.

Via: [WayBackErik van Bilsen – Google+ I share some results of my quest for a uniform memory management model across all platforms. For some reason, it also touches on old-school linked lists and new-school messaging…

–jeroen

 

Posted in Delphi, Development, Software Development | Leave a Comment »