Here is a task: You need to write a function that takes 2 integers and calculates the factorial of the first number and returns how many zeroes there will be at the end of that factorial at the radix represented by the second number.
For example, for an input (4, 12), the function will return 1, because 4! will be 24 and 24 at radix 12 will be 20.
Acceptable range for a number is from 1 to 1,000,000 and for a radix range is from 1 to 256.
Simplest way to do this task is to calculate factorial and count how many times we can divide factorial by radix without reminder. Obviously that factorial from 1,000,000 is a really
Here is task. You have a pyramid that looks like that:
4 5 6
3 10 2 3
You start at top, and travel down. You can only travel down and only do adjusted node. You have only 2 choices. For example, from node with value 1 you can move to node with value 2 or 3. From node with value 2 you can only move to node with value 4 or 5, but you cannot move to node with value 6 because it is too far. Also, you cannot move from node with value 3 to node with value 4.
Your task is to find path that provides biggest sum
Recently I had a task to migrate large SVN repository to Git and I would like to share with you how we did it.
Step 1, size
There is principal difference between SVN and Git. In SVN after checkout, will download only one revision. But in Git you will download whole repo. Bigger repository means longer clone times and in general slower repository. Experts in that area advice to have repository under 1Gb in size without LFS.
As a result, you need to do some homework and reduce repository size in SVN. Try to find everything that is not needed anymore. There is no penalty for garbage in SVN if you are not using it, but in Git it will
In Windows it is very simple to make a child process to inherit a handle. All you need to specify bInheritHandle to TRUE in SecurityAttributes or call this function:
SetHandleInformation(handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)
After that pass TRUE for bInheritHandles parameter of CreateProcess function. After that, the handle will be inherited by the child process. You can use the same handle value in the child process. Usually, you can pass it via command line to the child process.
Most developers would never use it, but handle inheritance is required
Many people believe that what we have on the market is what people really need. But it is not completely true. Very often marketing department just found what people are buying and sell more of it. It could be dots per inch on your phone, inches in TV diagonal, Gigahertz in CPU frequency etc. And very often is it just overkill. And today I would like to talk about 4K and 8K TVs.
But firstly, I would like to state that I would like to talk only about TVs that everyone can afford to buy. Let say 60-80” diagonal. Of course, if you have 150” TV everything that I will say below will not apply or apply only partially.
Many people saying: “I created small site, surely nobody will want to hack it”. And this is 100% wrong. And I will explain why.
Yeah, it is true that hack into Google, Microsoft or any financial institution will be quite profitable for hackers and they are definitely trying. But it is one side of the story. Other side of the story that to do it they need computer power and millions of the computers. Hacking big company from personal computer has many limitations:
- There is chance that other side will be able to find where you are from and then there is possibility of serious personal consequences for hacker.
- Very often after few attempts IP address of hacker will be blocked. This block is easy to overcome but it will require time and thus reduce effectiveness of hack.
- Trying to do it from personal computer can be quite slow and sometimes you need like millions attempts to do something.
Previous part is here.
I found that I was missed one critical part that I did in my application but forgot to explain here. Let me explain little bit. Effectively secure communication via HTTPS protocol happens between browser and nginx that is web server. Nginx communicates with .NET application via HTTP protocol. And effectively .NET application believes that it is communicating via HTTP. It called SSL termination.
And as result .NET application can return something that is not compatible with HTTPS protocol. In my case it returns link to profile from Gravatar service via HTTP. This in turn leads to complain from web browser that there is mixed content: HTTP and HTTPS. And that one only minor problem but
If you are planning to buy new PC and thinking about buying new i9-11900K, then read this post and perhaps you will change your mind.
In short, this CPU MSRP price is the same as AMD 5900X. 5900X will be faster pretty much everywhere with 1-2 exceptions in games where it is slightly slower. But when it faster it often much faster than i9-11900K. Specially it is faster in productivity tasks. Moreover, 5900X consumes considerably less power. If you compare retail price, 5900X about $65 cheaper.
So, in short if you want faster CPU than consumes less power, buy AMD 5900X.
But if you Intel fan and AMD is not for you, then buy i9-10900K. It is faster in most
This is continuation of Running .NET Core app on AWS Lightsail Linux instance.
By this moment everything is working exactly as I want. But I have 2 things that really annoys me: backup and updating web site. Because I revoked access to web site directory for every account except www.example.com I have to run a lot of commands from sudo user to backup and update my web site. I would like to automate these steps.
I have 2 things to backup: web site itself and its data. I separate them because they have different update schedule. For example, I can update web site few times per day and then did not update it for weeks. Obviously, I