program – Creative Programming https://alllinuxdevices.com What a programmer needs to know Wed, 28 Apr 2021 12:15:45 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://alllinuxdevices.com/wp-content/uploads/2021/04/1bde620701d143c0b006dfd1f5bfb1f8-100x100.png program – Creative Programming https://alllinuxdevices.com 32 32 Analysis of programs and compilers in Compiler Explorer https://alllinuxdevices.com/2021/04/27/main-reasons-to-explain-fast-business-builder/ Tue, 27 Apr 2021 05:35:41 +0000 http://localhost/themedev/?p=67 If you have been programming for a long time, you probably were engaged in disassembling the code and asked the question "Why did the compiler optimize the code in one case, but not in the other?"

The post Analysis of programs and compilers in Compiler Explorer appeared first on Creative Programming.

]]>
If you have been programming for a long time, you probably were engaged in disassembling the code and asked the question “Why did the compiler optimize the code in one case, but not in the other?” Usually, to answer a question, you need to do a little research with small pieces of programs. Sometimes you need to compare the results of several compilers with different optimization flags.

If you teach computer disciplines, then it is very useful to bring the assembler code. For example, you told students about how variables are created “on the stack” or how the stack unwinds when an exception is thrown. It is worth showing that not always arguments are passed through the stack, which means that the stack unwinding mechanism must take this into account for each function. This can be done using the following program:

int bar (int a, int b) {
return a + b;
}

I would like to collect it with various optimization flags and compare the results. A very handy tool for this godbolt.

Here you can see that in this online environment you can:

  • enter pieces of code (not necessarily the whole program). And get an assembly view for them;
  • select a compiler (I chose gcc10.2) and set compilation options;
  • select several compilers at the same time – it is convenient to compare the results;
  • enter the program code in different languages. Supported by Pascal, Python and a sea of ​​less popular languages ​​like D and Haskell.
  • simultaneously enter several fragments of source code, for each of which add their own compilers. Sometimes this is convenient – for example, to show how the code optimizer can take into account constants or something like noexcept
  • in C ++.

If there is an entry point in the code (in C ++, the main
) – then you can see the result of the code execution. In this, this online environment is not much different from other online compilers, except for the ability to connect popular libraries such as boost, Google Benchmark, Google Test, Doctest, and so on to the project.

In addition, the results obtained can be shared (there is a Share button), while you share not only the source, but also the configured compilers. If you are inserting results from godbolt into your presentation, then you should add links there as well – this is convenient.

The post Analysis of programs and compilers in Compiler Explorer appeared first on Creative Programming.

]]>
Bad software sent post workers to jail https://alllinuxdevices.com/2021/04/20/consulting-about-the-business-aim/ Tue, 20 Apr 2021 07:23:57 +0000 https://demo.bosathemes.com/bosa/business-04/?p=133 For the past 20 years, the Post Office (a postal company from the UK) has been dealing with the Horizon program, which had a fatal error: due to a malfunction, employees appeared to be stealing tens of thousands of pounds.

The post Bad software sent post workers to jail appeared first on Creative Programming.

]]>
For the past 20 years, the Post Office (a postal company from the UK) has been dealing with the Horizon program, which had a fatal error: due to a malfunction, employees appeared to be stealing tens of thousands of pounds. Some local postmasters were convicted and jailed because the Post Office insisted on trusting the software. After decades of fighting, the sentences of 39 people were finally overturned. The case was the largest miscarriage of justice the UK has ever seen.

Employees suffered enormous damage: according to the BBC, someone had a broken marriage, and someone lost time that they could have spent with their children. In an interview with the BBC, Janet Skinner reveals that she was separated from her two children for nine months during which she was in prison after Horizon showed a £ 59,000 shortfall. She also reports that she lost a job offer due to her criminal record. The time spent by her and others in prison cannot be returned, and it happened because the program was trusted at its word.

Another woman, who had sworn innocence, was sent to prison while pregnant for theft, according to the BBC. One person reportedly committed suicide after a computer system showed that he had lost almost £ 100,000. A few months later, the employee who replaced him also suffered losses due to inconsistencies in the software.

Horizon was created by the Japanese company Fujitsu. The data from this program was used to prosecute 736 Post Office employees between 2000 and 2014, some of whom subsequently ended up in jail. Errors in the system led to reports that there was a shortage in employee accounts – the BBC reported that some employees tried to make up for it by mortgaging their homes and using their own savings.

It looks like the employee nightmare is coming to an end. The 39 people who had their convictions overturned follow six more who were dropped in December. The Post Office paid financial compensation to employees who were charged based on the program’s messages.

In 2019, the Post Office settled with 555 claimants and reimbursed them for damages, as well as organized a system of payments to other injured employees. To date, according to the BBC, more than 2,400 applications have been filed.

Earlier this month, the Post Office chief executive announced that Horizon will be replaced with a new cloud solution. He also said that the company will work with the government to compensate employees affected by Horizon.

British Prime Minister Boris Johnson spoke out, calling the initial sentences “appalling injustice.”

The post Bad software sent post workers to jail appeared first on Creative Programming.

]]>
How to code eight-plus hours without fatigue https://alllinuxdevices.com/2020/12/19/how-to-code-eight-plus-hours-without-fatigue/ Sat, 19 Dec 2020 09:43:58 +0000 https://alllinuxdevices.com/?p=25 All my life I've written code wrong.
I thought it was enough to just sit down at the table, open my laptop, select a task from my to-do list, and code until I get tired.

The post How to code eight-plus hours without fatigue appeared first on Creative Programming.

]]>
All my life I’ve written code wrong.
I thought it was enough to just sit down at the table, open my laptop, select a task from my to-do list, and code until I get tired.
But in reality, this style of work was killing my productivity level after 2-4 hours of coding. I felt so tired that I didn’t want anything other than other low-energy tasks (like code review).

After 62 books on self-development, dozens of articles and research on productivity, my own trial and error, I created a productivity system that helps me code, write, create and live as much as possible without procrastination, fatigue and fog in my head.

Schedule

It all starts with a schedule. What, where and when will I do.
I’ve always ignored graph creation.
“I know what and when I have to do!” I said to myself.
But in fact, I constantly forgot to do my daily tasks or did too many of them (even with the habit of doing them).

For example, when I woke up at 7:00 in the morning, I knew that I had one free hour before work. At this hour, I wanted to find time for the morning ritual (food, stretching, shower, breathing exercises) and read for 30 minutes. But very often I could eat breakfast for an hour, forgetting to leave time for reading. Even if I remembered that every morning I have to read for 30 minutes. I overdid it with one activity (breakfast) and wasted time with another activity (reading).

I also noticed that without a schedule, it takes a lot of time to choose what to do next. I could finish my workout in the afternoon, take a shower, sit down at the table, open my laptop, and then for ten minutes decide which task to choose next. If you count how many times a day I made the same decisions, then 10 minutes turns into 60 minutes. A whole hour! This is a lot of time.

In addition, in the process of choosing what to do next, an angel and a demon always sat on my shoulders, “helping” me decide whether to work on things that are important to me, or to do some easier work, or even take a break to rest. Without a schedule, I often had to force myself to do the “right” things by willpower.

“If you waste resources deciding when or where to work, you interfere with your ability to do the work.” – Guardian

When I created the graph, these problems disappeared.
Now I always have time for what I have planned.
I always know what I need to do next.
I don’t need to use willpower to force myself to do the necessary things.
The graph puts my decision-making process on autopilot.

The post How to code eight-plus hours without fatigue appeared first on Creative Programming.

]]>
Apology for visual programming https://alllinuxdevices.com/2020/09/01/apology-for-visual-programming/ Tue, 01 Sep 2020 09:49:29 +0000 https://alllinuxdevices.com/?p=32 Visual programming? Seriously?! Did I miss something? Someone invented touch programming? Or smells? Not? Does everyone program with their eyes? Why then do we use this adjective?

The post Apology for visual programming appeared first on Creative Programming.

]]>
Visual programming? Seriously?! Did I miss something? Someone invented touch programming? Or smells? Not? Does everyone program with their eyes? Why then do we use this adjective?

Of course, I am aware of what this is about. I just want to draw your attention to a certain oddity in terminology. Which, as I see it, is a consequence of some general misunderstanding.

Of course, visual programming is programming for the general public. And let’s take the bull by the horns right away. Will programming become widespread in the near future? How is your writing skill? Or, at least, how is the skill of driving a car?

Personally, I have conflicting information on this score. Many people answer this question with a confident “no”. On the other hand, I have experience teaching children to program. The statistics are more than eloquent. Everybody learns. I communicated with colleagues. They have the same picture. A child’s chances of mastering programming are about the same as their chances of mastering reading and writing.

It remains to be seen what is behind this confident “no”. As it turns out, not everyone thinks that there are some insurmountable obstacles to the common man’s ability to master programming. Rather, it is said that almost no one will do this, because why?

Indeed. Why would an ordinary person need programming? Let those who have chosen such a profession do this. Here I would like to remind you that in exactly the same way some time ago there was a spread of the skills of writing. At first, it was believed that writing was the business of a narrow circle of professionals. It seemed shameful to the elites to engage in such a low business. Then the mood of the elite turns one hundred and eighty degrees. And now the possession of written speech is a mandatory attribute for her. And after the elite, written language is mastered by all polls.

The post Apology for visual programming appeared first on Creative Programming.

]]>