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 2,117 other followers

Archive for the ‘Development’ Category

delphi – Can I use an Edit Mask to format output? (not just validate input) – Stack Overflow

Posted by jpluimers on 2020/10/27

From a while ago, and – being on the back-end side mostly – I sometimes forget: [WayBack] delphi – Can I use an Edit Mask to format output? (not just validate input) – Stack Overflow

You can use the TField.OnGetText event or TNumericField.DisplayFormat property to modify how the text is being displayed.

Since you have a TStringField holding numbers, you have two choices:

  • use a TNumericField and the DisplayFormat property
  • use the OnGetText event and do your own string formatting

Edit:

Sam used this approach:

I implemented OnSetText and OnGetText event handlers. I already had the Edit Mask 9999 9999 9999 9999;1;_ so the OnSetText was just

TStringField(Sender).Value := Trim(Text);

and OnGetText was just

sValue := TStringField(Sender).Value;  
Text := Format('%s %s %s %s', [Copy(sValue, 1, 4), Copy(sValue, 5, 4), Copy(sValue, 9, 4), Copy(sValue, 13, 4)]);

It works fine. Thanks.

–jeroen

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

Good tips for powering any kind of LED strips from the Adafruit NeoPixel Überguide | Adafruit Learning System

Posted by jpluimers on 2020/10/22

Read these tips before playing with any kind of LED strips: [WayBack] Powering NeoPixels | Adafruit NeoPixel Überguide | Adafruit Learning System.

There are more, but these are the most important:

  • When connecting NeoPixels to any live power source or microcontroller, ALWAYS CONNECT GROUND (–) BEFORE ANYTHING ELSE. Conversely, disconnect ground last when separating.
  • Adding a 300 to 500 Ohm resistor between your microcontroller’s data pin and the data input on the first NeoPixel can help prevent voltage spikes that might otherwise damage your first pixel. Please add one between your micro and NeoPixel.
  • Before connecting a NeoPixel strip to ANY source of power, we very strongly recommend adding a large capacitor (1000 µF, 6.3V or higher) across the + and – terminals. This prevents the initial onrush of current from damaging the pixels.
  • Be extremely cautious with bench power supplies. Some — even reputable, well-regarded brands — can produce a large voltage spike when initially switched on, instantly destroying your NeoPixels!
    If you use a bench supply, do not connect NeoPixels directly. Turn on the power supply first, let the voltage stabilize, then connect the pixels (GND first).

Via: [WayBack] Bouw je eigen ledtafel – Tot slot – Achtergrond – Tweakers

–jeroen

Posted in Arduino, Development, Hardware Development, Hardware Interfacing, Raspberry Pi | Leave a Comment »

My toolkit – Roald’s blog

Posted by jpluimers on 2020/10/22

Always interesting to see what others put on their Windows development systems, for instance: [WayBack] My toolkit – Roald’s blog

Everytime I (re)install my development computer I need to think about all the tools I need and use on a regular basis. For that reason, and maybe to inspire others, here’s my list of essentia…

–jeroen

Posted in .NET, Delphi, Development, Software Development, Windows Development | Leave a Comment »

delphi – How to convert a null terminated string to string? – Stack Overflow

Posted by jpluimers on 2020/10/22

An old trick that I tend to forget: [WayBack] delphi – How to convert a null terminated string to string? – Stack Overflow:

You can assign a null-terminated PChar directly to a String:

function GetFileName(DiskName: TFileNameIO): string;
begin
 Result := PChar(@DiskName);
end;

It can work even on string literals and constants, where you can leave out the @, like in:

var
  S: string;
begin
  S := PChar(FastMM4Messages.LogFileExtension;

Probably time to update the unit I mention in ISO 8601 Date, Time and DateTime in Delphi (was: Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool).

–jeroen

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

LED Chaser with only 4017 – YouTube

Posted by jpluimers on 2020/10/21

Cool:

The triggering in this case is the result of a main power drop and recover. The battery is unable to keep the votage at 9V level at the very moment any led is turned on, the voltage is droped down. That is what makes pin 14 to get the clock pulse so the 4017 shifts to the next led. The moment the led is off and right before the next led is turned on the main power gets recovered. When the next led is on again, the main power drops down, and so on.

Schema but less explanation on: [WayBack] LED Chaser with only 4017 – RevealNew

–jeroen

Read the rest of this entry »

Posted in Development, Electronics Development, Hardware Development | 1 Comment »

 
%d bloggers like this: