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

Archive for October, 2019

WayBack machine now rate limits your requests and blocks if you go over it

Posted by jpluimers on 2019/10/19

Got this a while ago while saving a bunch of links for my blog; unfortunately the email address did not respond for information

Too Many Requests

We are limiting the number of URLs you can submit to be Archived to the Wayback Machine, using the Save Page Now features, to no more than 15 per minute.

If you submit more than that we will block Save Page Now requests from your IP number for one day.

Please feel free to write to us at info@archive.org if you have questions about this. Please include your IP address and any URLs in the email so we can provide you with better service.

I wish there was a queue service that would make you wait longer, but does fulfill the request.

–jeroen

Posted in Internet, InternetArchive, Power User, WayBack machine | Leave a Comment »

Reminder to politicians: concrete blocks do not help against trucks

Posted by jpluimers on 2019/10/18

These physics lessens at school were useful after all.

TL;DR:

A concrete block of ~1.500kg will loose against a truck of ~9.000kg, especially if that drives 50 km/hour.

It will not stop the truck, but will start moving by itself in unexpected directions and speeds becoming a projectile by itself or worse: usually pieces break off traveling at quite high speed.

The video below shows what happens.

Beton blocks

Over the last year or so, concrete blocks are deployed in many places of the public areas. The usual deeper motivation is to protect against traffic.

The blocks are put on the ground without anchoring for a variety of motivations like flexibility, ease of deployment/removal, cost of blocks (EUR ~100 each) versus anchoring (EUR ~250 per block) in a non-interconnected way.

Often, the rectangular lego-like blocks with 8 bumps are used which come in two varieties: 40cm high (easier to sit on, look more friendly) of a mere 1200kg or 80cm high (look more massive) of only 2400kg.

Other concrete blocks used are roughly the same dimensions, so an average weight of ~1500kg is reasonable.

Trucks

An average truck (at about 10.000 kg) isn’t a static object. In cities they are usually allowed to drive at 50 km/hour, but during assassination attempts they drove much faster and also were much heavier.

Let’s assume however that a truck used is less heavy (not all bad people are smart to get a really heavy truck) at ~9.000kg.

Truck concrete collision

The assumptions so far: a truck of 9.000kg at 50 km/hour against a concrete block of 1.500kg at standstill.

Even though a collision with a truck looses some energy, a moving truck has a lot of it. So most of the energy from the truck will be partially or fully transferred via its momentum to the concrete block(s).

The physics involved here are about momentum:

  • momentum = mass * velocity
  • momentum in a system is conserved

Before colliding, the truck has momentum, but the concrete block does not. After the collision, the momentum is divided over truck and concrete block so they both have a velocity.

A few cases that can happen, usually in a combined fashion:

  1. The truck comes to a full stop and all momentum is transferred to the block. The block now travels 9.000/1.500 * 50 km/h which is 200 km/h if it was in front of the truck.
  2. If the concrete wasn’t fully in front of the truck, the truck will move in another direction as well as the concrete block. Those directions are hard to predict for the public.
  3. Part of the concrete comes off during collision. Since their weight is smaller, their speed will be higher (because momentum is conserved) and direction even less predictable.

–jeroen

References

Read the rest of this entry »

Posted in LifeHacker, Power User, science | Leave a Comment »

Sam Knutson on Twitter: ““Every piece of equipment is shipped from the factory able to successfully complete n power cycles and you only find out n at n+1” Anonymous IBM Customer Engineer (CE)… 

Posted by jpluimers on 2019/10/18

[WayBackSam Knutson on Twitter: ““Every piece of equipment is shipped from the factory able to successfully complete n power cycles and you only find out n at n+1” Anonymous IBM Customer Engineer (CE)… .

I could not track down earlier versions of the image than 2005; see the images below.

Failures

[WayBack] flowcart troubleshooting komputer | superplayboy:

–jeroen

Posted in Hardware, LifeHacker, Power User | Leave a Comment »

Researchers “unblur” images to gain access to Bitcoin wallet. The lesson here…

Posted by jpluimers on 2019/10/18

via: [WayBack] Researchers “unblur” images to gain access to Bitcoin wallet. The lesson here is that blurring sensitive images is no longer safe. – Kevin Powick – Google+:

Background information:

–jeroen

 

Posted in Bitcoin, Cryptocurrency, Power User, Security | Leave a Comment »

My code of conduct – Marcin Juszkiewicz

Posted by jpluimers on 2019/10/17

There are many “code of conduct” documents. Often they differ a lot. I have my own: Do not be an asshole. Respect the others.

Source: [WayBackMy code of conduct – Marcin Juszkiewicz

Via: [WayBack] I like this code of conduct and general remarks. – Jean-Luc Aufranc – Google+

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

The Delphi System.Exit “Function”

Posted by jpluimers on 2019/10/17

Still wrongly documented as System.Exit Function [WayBack], most people think it is a statement.

However, it is a compiler intrinsic procedure in the System unit that – when called inside a real function – optionally accepts a parameter with the same type as the encompassing function because it is a compiler intrinsic. It kind of acts as an overloaded procedure, but in fact translate to machine code via an intermediate parse tree.

The parameterless version has been there since at least Turbo Pascal 3.0, but the parameterised version is more recent: I think it was introduced around Delphi 7.

It then stops executing that function after first executing any explicit or implicit finally blocks.

I’ve seen various projects that used their own Exit procedure. This is a very bad habit: Since the System unit is always further away in scope, the introduced one is called which can severely confuse programmers not being aware of this.

The code generation for the parameterless and parameterised  “overloads” of System.Exit is slightly different:

  • The parameterless one can often be optimised away, for instance folding multiple calls to them into one, or rearranging code execution so a jump isn’t needed any more. This means you cannot always put a breakpoint on them.
  • The parameterised one always needs code to load the function result, so you can always put a breakpoint on them.

Stefan Glienke explained the above in [WayBack] The advantage of using Exit() instead of a plain Exit? You can place a breakpoint! – Uwe Raabe – Google+

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 1 Comment »

How to debug small programs

Posted by jpluimers on 2019/10/17

As a follow up of SSCCE, MWE and MCVE are basically the same: provide code people can use to reproduce a problem, I found [WayBackHow to debug small programs which is starts as

One of the most frequent categories of bad questions I see on StackOverflow is: I wrote this program for my assignment and it doesn’t work. [20 lines of code]. And… that’s it.

Then it goes on how to debug those pieces of code, trim them into an SSCCE/MWE/MCVW to form the base of a question which you can ask on StackOverflow/SuperUser/ServerFault/StackExchange, forum, group/community or even your co-worker.

The really cool thing about the techniques used there are that they also apply to bigger pieces of code, heck even large code bases.

They force you to trim down your problem in to manageable pieces that are easy to explain and write concise documentation and tests around them to assist you in the process.

Below are the steps in a short list. Be sure to read the original article How to debug small programs | Fabulous adventures in coding after going through the list.

  1. Turn on compiler warnings, inspect all of them, resolve or explain them
  2. Rubber duck to an imaginary person or even a live one explaining each part in simple terms
  3. If the bug is still there, break up the code into pieces
  4. Write technical specifications for all the pieces
  5. Verify the pieces against the specifications, for instance by adding pre- and postconditions to them
  6. Add assertions in the pieces for all the specifications
  7. Write test cases for the pieces
  8. Write down on paper the expected behaviour for all the lines of code
  9. Use a debugger to step through all the lines of code and verify the expected behaviour you wrote down
  10. While debugging, listen to all your doubts (gut feeling is a good thing!)

This sounds like a lot of work. It is. All good programming is.

If you apply these before writing any logic code, then your life becomes easier because you will spot bugs sooner:

  • specification
  • test cases
  • preconditions
  • postconditions
  • assertions

Does this again sound like a lot of work?

Then remember: taking a shortcut will make the actual work longer. The reason is that hunting for bugs is a tedious and time consuming process scaling very badly with complexity.

–jeroen

Posted in Conference Topics, Conferences, Debugging, Development, Event, Software Development | Leave a Comment »

delphi – How to set form height larger than 1096 pixels? (or width > 1620 pixels)- Stack Overflow

Posted by jpluimers on 2019/10/16

Delphi will limit [WayBackHeight or [WayBack] Width of a form in the designer based on the current Windows limitations, not on what your target users might.

See [WayBack] delphi – How to set form height larger than 1096 pixels? – Stack Overflow:

The reason for this behavior is that when you do not set constraints for the form size, Delphi will automatically get constraints at system level via the [WayBackWM_GETMINMAXINFO message, which is fired when…

Solution is to configure the [WayBack] Constraints property by setting either [WayBackConstraints.MaxHeight or [WayBackConstraints.MaxWidth.

Via: [WayBack] Since I put up 10.2, I cannot get a form width >1620. Whenever I enter a greater value, the system changes it back! As I have some programmes with comp… – erik wilson – Google+

–jeroen

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

Some Delphi settings require you to run with an Administrative UAC token

Posted by jpluimers on 2019/10/16

Though user-defined Code Templates live under %UserProfile%\Documents\Embarcadero\Studio\code_templates\Delphi, the stock ones (standard ones shipping with Delphi) ones do not: they live under %ProgramFiles(x86)%\x\Studio\y.0\ObjRepos\en\Code_Templates.

Above, x usually is Embarcadero, and y is your Galileo version number; see for instance Update to List-Delphi-Installed-Packages.ps1 shows HKCU/HKLM keys and doesn’t truncated fields any more.

Unlike user registry settings, which are copied from HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER, the stock Code Templates are not.

This means that if you want to change the stock Live Templates (for instance disable them) from the IDE, or from the Windows Explorer, you need to run them with an UAC token to elevate them to Administrator level permissions.

Oh, did you notice the consistency between code_templates and Code_Templates? Delphi is full of these consistency surprises**

via: [WayBack] EDIT…..ANSWER: Right-click and run Delphi IDE as “Run as Admin”.. remove the template. Start IDE normally. .. IMHO, you shouldn’t have to do this… – Vin Colgin – Google+ who commented:

Vin Colgin:
+Uwe Raabe yes. Imho. Delphi should use a UAC helper app to change things that need elevated permissions… just like we all have been doing with shipping software since Windows Vista. But nobody asked me. Imho.

as a response to

Uwe Raabe:
Usually you don’t have access rights to Program Files where the standard code templates live. Therefore you cannot remove any of these from inside the IDE. Either adjust the behavior to your needs (that will make a copy) or remove it from $(BDS) with admin rights.

** Some more consistency examples:

Just pick a few functions from these or more recent Delphi versions:

For example (there are many more):

Read the rest of this entry »

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

SSCCE, MWE and MCVE are basically the same: provide code people can use to reproduce a problem

Posted by jpluimers on 2019/10/16

Many times I see people asking questions about problems in their source code, it goes like this:

  1. Question is asked formulating the problem, but without any source code
  2. A comment asks for source code
  3. Either the response is “the source code is too big”, or the response contains a really big blob of (compressed) code that

If you have such questions (I still often have them), then you need to do just two things (which you often can combine in one step):

  1. Condense down the code into a small bit that others can use to reproduce the problem.
  2. Talk to an (imaginary) person explaining the problem you have and the condensed code.

The second is called Rubber Ducking after a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck.

The first is known under at least three terms:

They all come down to the following:

Provide a small piece of working code that is readable anyone can use to reproduce a problem without much effort.

via: Can we create a Help Center topic that outlines what a SSCCE / MWE means for Stack Overflow?

–jeroen

Posted in Conference Topics, Conferences, Development, Event, Software Development | Leave a Comment »