Author Archives: smike19

Programmatically Capture Energy Saver Events on Mac

Mac OS X device may go to sleep by forced or idle events. The force event is related to some action performed by users, such as closing laptop lid or clicking on Sleep menu item. The idle event happens when users did not make any any actions with device for a specific period of time:… Read More »

How to get reboot time on Mac machine programmatically.

It is similar implementation as about reboot time as “How to get reboot time on Linux machine programmatically“, but for Mac OSX devices. The code is based on the same sysctl function described already in “sysctl command and function” and “Get kernel information through command line and programmatically“, but using different management information base (MIB)… Read More »

Configure Console Application through Registry

There are several ways to change console appearance: programmatically and/or using registry setting. When it is done programmatically application care itself about own size, font or colors. Registry settings instruct Windows OS what console properties are applied to application during its startup. The registry approach gives possible to change console presentation without alter the code.… Read More »

Small surprise from Catalina: error 23, Failed writing body

The application which worked perfectly beginning from OSX 10.6 stopped updating itself on Catalina OSX 10.15. Actually update process was very simple. Once a day the application checked if new version was available sending HTTP GET request to Web server. If server responded that new version is available, the application started the update script, the… Read More »

Disable dark mode for single appliacation

New versions of Mac OSX Mojave and Catalina have addition setting in “System Preferences” called Dark mode. To turn your Mac on Dark mode you need to go Apple menu then select System Preferences => General and click on Dark icon in Appearance. Dark Mode uses a dark color pattern and works on system level,… Read More »

From Russia with Fraud

Regularity receiving text message that some bank security systems have detected unusual activity. These SMS messages are similar to phishing, except that they are spamming via cell phones. Below the text is URL link which looks like bank WWW domain name, however looking carefully you can see that it is only submain prefix to another… Read More »

Get all windows

Long time ago I mean begining of nineties of the last century I started GUI Windows programming. The first application was based on message loop with 3 main players: GetMessage, TranslateMessage, DispatchMessage. Later higher level graphical interface API such as MFC did not require to write the code of Windows message loop, but application can… Read More »

cURL for port scanning

Usually such tools as telnet, nmap or nc are used to find listening remote ports. However nmap and netcat are not included in default Linux installation, telnet is good for manual testing and is not friendly for scripting task. So sometime I am using cURL or wget to get information about open ports on remote… Read More »

Ping in Network Discovery

Network discovery is a process to find other computers and devices on some network and to get obtainable information about them. The discovery procedure is based on sending out request messages over and analyzing responses from remote devices. ICMP (Internet Control Message Protocol) is most frequently method detect remote device. Below is presented simple Linux… Read More »

Garbage Collection and Recycling

Recently I converted some old c++ application to managed .Net c# one. The code built OK but crashing sometime during execution. It shows me “Unhandled System.NullReferenceException Exception” and I could not find what it was the source of this exception. Multiple try-catch statements did not help. Finally when I stated binaries under Visual Studio debugger… Read More »