Archive for the ‘Development’ Category
Posted by jpluimers on 2019/06/27
In [WayBack] Anyone here with an “F2092 Program or unit ‘?’ recursively uses itself” error in Tokyo? I have this error in Tokyo but the same project compiles ok in Berlin… – Luis Madaleno – Google+, I commented this:
Large circular reference cycles can trip the compiler into emitting this error (next to out-of-memory errors, access violations and internal errors and “unitX.pas F2063 Could not compile used unit ‘unitY.pas'”).
Solution that usually works: quit Delphi, delete .DCU files, start Delphi, build all, then compile. Cumbersome, time consuming, but since the error is intermittent and involves large code bases, it’s was hard to get it to R&D back in the days.
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/06/27
For my archive:
I happened to notice that the Arduino OneWire library uses a 256 entry lookup table for its CRC calculations.
I did some research on this topic in 1992-1993, while working on Bulletin Board Systems, FidoNet code and file transfer protocols.
These days memory is not at a premium on most computers, however on Arduino and microcontroller environments it definitely is, and I happen to know that table-lookup CRC can be done using two 16-entry tables!
So I’ve dug up my documentation and code from the time, and applied it to the CRC-8 calculation for the Maxim (Dallas Semiconductor) OneWire bus protocol.
I think this provides a neat trade-off between code size and speed.
License For any of the below code, apply the following license (2-clause “simplified” BSD license), which should suffice for any use. If you do require another license, just ask.
Source: [WayBack/Archive.is] Calculating CRC with a tiny (32 entry) lookup-table | Lentz family blog
The example on the page is for the CRC-8 implementation used in the [WayBack] 1-Wire Communication protocol – Wikipedia.
The generator works for CRC-8, CRC-16 and CRC-32 polynomials and can be downloaded here:
–jeroen
Posted in Algorithms, C, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/06/26
This became a huge batch-file which I need to refactor into smaller bits.
:: based on bc.bat
:: needs to be refactored into find-bc.bat
:: assumes git is on the path
:begin
@echo off
:checkGit
:: https://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file/25696405#25696405
where /q git || echo Cound not find git on the PATH %PATH%. && goto :eof
:: for now, the above is good enough as git installs itself on the path, but Beyond Compare does not.
:findBeyondCompare
setlocal EnableExtensions EnableDelayedExpansion
IF /I [%PROCESSOR_ARCHITECTURE%] == [amd64] goto :x64
IF /I [%PROCESSOR_ARCHITEW6432%] == [amd64] goto :x64
goto :x86
:x64
:: OS is 64bit
set hkcuBaseKey=HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare
set hklmBaseKey=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Scooter Software\Beyond Compare
goto :findBC
:x86
:: OS is 32bit
set hkcuBaseKey=HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare
set hklmBaseKey=HKEY_LOCAL_MACHINE\SOFTWARE\Scooter Software\Beyond Compare
goto :findBC
:findBC
:: https://gist.github.com/rojepp/634908
:: http://stackoverflow.com/questions/5369528/windows-batch-reg-query-key-value-to-a-variable-but-do-not-display-error-if-key
set SupportedBeyondCompareVersions=3, 4
for %%v in (%SupportedBeyondCompareVersions%) do (
for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hkcuBaseKey% %%v" /v ExePath 2^>NUL`) do (
call :do set bcExe="%%d"
)
)
if not [%bcExe%]==[] goto :foundBC
for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hkcuBaseKey%" /v ExePath 2^>NUL`) do (
call :do set bcExe="%%d"
)
if not [%bcExe%]==[] goto :foundBC
for %%v in (%SupportedBeyondCompareVersions%) do (
for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hklmBaseKey% %%v" /v ExePath 2^>NUL`) do (
call :do set bcExe="%%d"
)
)
if not [%bcExe%]==[] goto :foundBC
for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hklmBaseKey%" /v ExePath 2^>NUL`) do (
call :do set bcExe="%%d"
)
:: note that FOR /R needs a wildcard!
if not [%bcExe%]==[] goto :foundBC
for /r . %%d in (bcompare*.exe) do (
call :do set bcExe="%%d"
)
:foundBC
:: https://stackoverflow.com/questions/2772456/string-replacement-in-batch-file
:: note the BCompExe assignment requires at least https://ss64.com/nt/setlocal.html to have EnableDelayedExpansion and likely EnableExtensions
:: see https://ss64.com/nt/delayedexpansion.html for ! expansion
if [%bcExe%]==[] ( echo no bc.exe found in registry or relative to batch file) else (
echo bcExe=%bcExe%
if exist %bcExe% (
call :do set bcCompExe=%bcExe:BCompare=BComp%
:: echo bcCompExe=!bcCompExe!
echo "Beyond Compare" %bcExe:\=/%
echo "BComp" !bcCompExe:\=/!
call :do git config --global diff.tool bc
call :do git config --global difftool.bc.path !bcCompExe:\=/!
call :do git config --global merge.tool bc
call :do git config --global mergetool.bc.path !bcCompExe:\=/!
)
if not exist %bcExe% echo not found: [%bcExe%]
)
:exit
endlocal
:end
goto :eof
:do
echo %*
call %*
goto :eof
–jeroen
Posted in Batch-Files, Development, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2019/06/26
Via a private share, I found out that some software forgets to perform a Unicode normalisation when doing a search.
That means that ligatures do not match the non-ligatures in for instance these words:
- “ff” and “ff”, as in “difference” versus “difference”
- “fi” and “fi” as in “notification” versus “notification”.
For more information, read [WayBack] Unicode equivalence – Wikipedia and make sure you know about these normal forms:
NFD
Normalization Form Canonical Decomposition |
Characters are decomposed by canonical equivalence, and multiple combining characters are arranged in a specific order. |
NFC
Normalization Form Canonical Composition |
Characters are decomposed and then recomposed by canonical equivalence. |
NFKD
Normalization Form Compatibility Decomposition |
Characters are decomposed by compatibility, and multiple combining characters are arranged in a specific order. |
NFKC
Normalization Form Compatibility Composition |
Characters are decomposed by compatibility, then recomposed by canonical equivalence. |
–jeroen
Posted in Development, Encoding, Software Development, Unicode | Leave a Comment »
Posted by jpluimers on 2019/06/26
Definitely worth reading when you think you’re being Agile, but you don’t. [WayBack] Why Isn’t Agile Working? – Hacker Noon.
Via:
–jeroen
Posted in Agile, Development, Software Development | 1 Comment »
Posted by jpluimers on 2019/06/25
Packt free books
Usually one free book each day, with some pauses when Packt Publishing runs other specials [WayBack] Packt Free Learning (@packtfreebook) | Twitter.
This account started on 20190621. Hopefully it lasts for a while, as it is a very easy reminder on when a new free book becomes available.
Maybe they will notify of other free specials as well; time will tell.
Hopefully, the WordPress Twitter binding will show the most recent one below by Packt – Wikipedia.
EU versus USA Packt prices
Note that since a month or two, the Packt site asks me on a daily base to switch to their European site instead of to their USA site.
Avoid switching, as that incurs a high currency conversion cost. For example:
So that is a EUR/USD conversion factor of between 0.9 and 0.86 right (eBook 9/10 and paper+eBook 38.99/44.99).
Actually that’s not true: at the time of writing, the conversion is 0.78 which leaves a ~15% profit for just eBooks (0.9/0.78-1) and ~10% (0.86/0.78) margin for the Packt conversion. A tad high for my likings.
[Archive.is] 10 usd in eur – Google Search
Read the rest of this entry »
Posted in Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/06/25
a method to detect when the menu was closed without a selection (i.e. none of the menuitem OnClick handlers fired). Add the unit below to your project and the form the popup menu is on will receive the custom messages defined in the unit when the menu appears or closes.
The solution by Peter Below in ExPopupList works from D5 on: [Archive.is] missing TPopupMenu features? – Google Groups.
Now you can hook the [WayBack] TControl.OnContextPopup Event for a [WayBack] TPopupMenu activation, and the custom Windows messages CM_MENUCLOSED, CM_ENTERMENULOOP and CM_EXITMENULOOP to monitor the state of the popup menu.
Via:
–jeroen
Read the rest of this entry »
Posted in Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/06/24
Learned a new thing today: you can change the line styles in PlantUML to these:
This in addition to the colour I already knew about. The order of these does not matter:
@startuml
' Make a dashed line, alternative syntax for ..>
(*) -[dashed]-> "Write outline"
' Make line bold and use color name
"Write outline" -[bold,#green]-> "Find example"
' Only change the color with hexadecimal RGB code
"Find example" -[#ff00ff]-> "Write blog"
' Order of line style and color can be reversed
"Write blog" -[#6666ff,dashed]-> "Publish"
' Use dotted line style
"Publish" -[dotted]-> (*)
@enduml
Source: [WayBack] PlantUML Pleasantness: Change Line Style And Color – Messages from mrhaki
–jeroen
Posted in Color (software development), Development, Diagram, PlantUML, Power User, Software Development, UML | Leave a Comment »
Posted by jpluimers on 2019/06/21
I like PlantUML a lot as it is an easy way to create even simple diagrams using plain text, for instance a simple Sequence Diagram like below.
Sometimes, you want to add comments because the way you build the diagram needs explanation that is not needed in the diagram itself. You can:
[Archive.is] Is it possible to comment out lines of diagram syntax? – PlantUML Q&A:
You can use quote like in the following example
@startuml
' This is a comment on a single line
Bob->Alice : hello
/' You quote by using slash-and-quote
to split your comments on several
lines '/
@enduml
[Archive.is] Sequence Diagram syntax and features

–jeroen
Posted in Development, Diagram, PlantUML, Power User, Software Development, UML | Leave a Comment »