Recently I figured out that Windows 10 has a built-in ssh application. Great! If you would like to connect to Linux PC using it, you need to use the following command:
ssh -i key.pem username@ipaddress_or_host
But if you will try to run it you will get following error:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'key.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
It is a very strange error message. I would say it is the typical Linux way. A smart person will figure it out and a dumb person doesn’t need it. What it trying to tell,
[...Read More]
Recently I was asked to investigate a strange crash that happens in our application. The application calls function Test that returns HRESULT. This function is part of the interface. Let’s call it IMyIntf. The caller is located in the main.dll and the interface is implemented in the module.dll.
And this call failed. Initially, I started checking the function implementation of the
Test function to see what can be possibly wrong there but after some time I found that it returns a rather strange
HRESULT. In this call stack
HRESULT was
0xd337fe00. I cannot find any description for such a strange
HRESULT.
[...Read More]
I’m sure many of you watching some tutorial videos on YouTube. I do. And there are different people who do the talking. Some are talking fast, and some are talking slow. Some of them put quite condensed information and some put a lot of “water” in their talk.
For quite some time I was watching on regular speed, but a few years ago I found really nice advice to use faster speeds. I tried 1.25 initially and it was amazing. If you have a tutorial that is one hour long, you can finish watching it in 48 minutes and save 12 minutes of your life. 1.25 speed does not distort the voice much and it is almost the same as
[...Read More]
Some time ago, I, like many of you moved to Visual Studio 2022. It works great with C# and eventually, I decided to move C++ activities to VS 2022 as well. After I installed everything, I created C++ Console Application and I try to compile it. To my surprise, it didn’t work, and got the following message:
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.32.31326\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
After some research, I found an article that helped me. For some reason, there is an invalid path to Windows SDK in the registry. To fix this issue you need to go to this registry key:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots
And change
[...Read More]
For many years, when I get a new notebook, I wipe it out and install a fresh version of Windows. There are multiple reasons for that:
- To instantly get rid of unwanted software that takes valuable disk space
- To avoid unwanted software draining your battery and heating your notebook (especially in the summertime)
- To remove potential conflicts with the installed software. For example, a trial version of Microsoft Office conflicts with another office package. Even removing Microsoft Office does not help
- To avoid problems with an installed antivirus solution. The best example is McAfee. I spent weeks or even months of my life fighting with it. It is the worst antivirus on the market. Built-in Windows Defender is much better and provides better protection
[...Read More]
I think many of you a familiar with function SetWindowsHookEx. It is quite useful function, and we use it in a lot of places in our software. But recently I found interesting issue: if exception is raised in hook function, then Windows will terminate your application with status code 0x C000041D STATUS_FATAL_USER_CALLBACK_EXCEPTION. But there is one caveat: if you run application from debugger, Windows will not terminate application and will just suppress exception. So, if you have encounter that exception as developer, you may think that everything is correct, but when end user will run your application – application will crash.
I work primarily with languages that have native support for exceptions and it feels kind of wrong. There is
[...Read More]
I did some research on this topic and I decided to share my findings.
First reason: Standards
On most 32 bits systems type short is 2 bytes long, type int is 4 bytes long. But there are also standards.
According to C90 standard:
sizeof(short) <= sizeof(int) <= sizeof(long)
According to C99 standard:
sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)
If
int size will 8 bytes long then there will be no type that it is 4 bytes
long because due to standard,
long type should be at least the same size as
int type. It is possible to make
short type 4 bytes long
[...Read More]
About 5 years ago, we moved our main application to 64-bit. And we quickly discovered one pattern that was everywhere and in many different languages: converting pointers to 4-byte integers and back. Here is one of such examples is C++ code:
void* address;
…
(void*)(((unsigned int)address) + 1)
It was working in 32-bit systems because pointer and integers are exactly the same size and there is no data loss. But during transition to 64 bits, decision was made to keep integer 4 bytes in size. At least on systems I know of.
As result, if you run code above for address that is greater than max int, you will get invalid address. But until address is in first
[...Read More]
Previous part is here. This post will explain, how to restart your web site at specific intervals without returning errors to clients. You can scroll to solution, if you are no interested in my thoughts and to see what I try.
Thoughts and research
As I mentioned in
this post, I decided to restart my web site periodically to avoid out of memory issue. And I would like to mention that it wasn’t easy to do. Obviously, restarting web site is super simple and all you need is to restart its service. But that means that your web site will be unavailable for some time. Depending on size of the web site, we are talking about seconds or
[...Read More]